|
| 1 | +<html> |
| 2 | + <head> |
| 3 | + <title>Shared clip</title> |
| 4 | + |
| 5 | + <meta http-equiv="content-type" content="text/html; charset=UTF-8"> |
| 6 | + <meta http-equiv="x-ua-compatible" content="IE=edge"> |
| 7 | + <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" /> |
| 8 | + |
| 9 | + <script src="core/jquery-3.5.1.js"></script> |
| 10 | + <script src="skin/skin.js"></script> |
| 11 | + |
| 12 | + <script> |
| 13 | + $('head').append('<link rel="shortcut icon" href="'+window.skin.favicon+'" type="image/x-icon">') |
| 14 | + |
| 15 | + document.addEventListener('DOMContentLoaded', function(){ |
| 16 | + var url_string = window.location.href; //window.location.href |
| 17 | + var url = new URL(url_string); |
| 18 | + var c = url.searchParams.get("id"); |
| 19 | + var t = url.searchParams.get("token"); |
| 20 | + var h = url.searchParams.get("host"); |
| 21 | + |
| 22 | + getUrl(t,c,h?h:'https://web.skyvr.videoexpertsgroup.com'); |
| 23 | + }); |
| 24 | + |
| 25 | + function getClip(share_token, clipid, host) { |
| 26 | + args = {}; |
| 27 | + args.token = share_token; |
| 28 | + |
| 29 | + return $.ajax({ |
| 30 | + type: 'GET', |
| 31 | + url: host + '/api/v2/storage/clips/' + clipid + '/', |
| 32 | + contentType: "application/json", |
| 33 | + data: args |
| 34 | + }); |
| 35 | + }; |
| 36 | + |
| 37 | + function getUrl(token, clipid, host) { |
| 38 | + if (token === undefined || clipid === undefined) { |
| 39 | + return; |
| 40 | + } |
| 41 | + |
| 42 | + getClip(token, clipid, host).then(function (data) { |
| 43 | + console.log('success'); |
| 44 | + var url = data['url']; |
| 45 | + if (url.indexOf(location.protocol)==-1) |
| 46 | + url = url.replace(/(http:)/, location.protocol).replace(/(https:)/, location.protocol); |
| 47 | + playerOpen(url); |
| 48 | + $("#VideoArea").show(); |
| 49 | + $("#ErrorArea").hide(); |
| 50 | + }, function (error) { |
| 51 | + alert("Clip link is expired"); |
| 52 | + $("#VideoArea").hide(); |
| 53 | + $("#ErrorArea").show(); |
| 54 | + playerOpen(''); |
| 55 | + console.log('fail'); |
| 56 | + }); |
| 57 | + } |
| 58 | + |
| 59 | + function playerOpen(url) { |
| 60 | + $('#divVideo video').attr('src', url); |
| 61 | + $("#divVideo video")[0].load(); |
| 62 | + } |
| 63 | + </script> |
| 64 | + </head> |
| 65 | + <body> |
| 66 | + <div> |
| 67 | + <div> |
| 68 | + <div> |
| 69 | + <div id="ErrorArea" style="display: none;" class="error"></div> |
| 70 | + <div id="VideoArea" style="display: none;"> |
| 71 | + <div id="divVideo"> |
| 72 | + <video preload="auto" controls style="height:100%;width:100%;"> |
| 73 | + </video> |
| 74 | + </div> |
| 75 | + </div> |
| 76 | + </div> |
| 77 | + </div> |
| 78 | + </div> |
| 79 | + </body> |
| 80 | +</html> |
0 commit comments