@castlabs/prestoplay 6.7.0 → 6.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/cjs/cl.adobe.js +3 -3
- package/cjs/cl.airplay.js +3 -3
- package/cjs/cl.broadpeak.js +6 -6
- package/cjs/cl.cast.js +110 -110
- package/cjs/cl.conviva.js +33 -33
- package/cjs/cl.core.js +416 -417
- package/cjs/cl.crypto.js +9 -9
- package/cjs/cl.dash.js +72 -72
- package/cjs/cl.externs.js +26 -26
- package/cjs/cl.freewheel.js +23 -23
- package/cjs/cl.hls.js +67 -67
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +31 -31
- package/cjs/cl.ima.js +23 -23
- package/cjs/cl.mse.js +270 -259
- package/cjs/cl.muxdata.js +15 -11
- package/cjs/cl.onboard.js +3 -3
- package/cjs/cl.persistent.js +13 -13
- package/cjs/cl.playlist.js +6 -6
- package/cjs/cl.smooth.js +70 -70
- package/cjs/cl.thumbnails.js +24 -24
- package/cjs/cl.tizen.js +69 -69
- package/cjs/cl.ttml.js +27 -27
- package/cjs/cl.verimatrix.js +5 -5
- package/cjs/cl.vimond.js +13 -13
- package/cjs/cl.vr.js +19 -19
- package/cjs/cl.vtt.js +14 -14
- package/cjs/cl.youbora.js +18 -18
- package/cl.adobe.js +3 -3
- package/cl.airplay.js +3 -3
- package/cl.broadpeak.js +5 -5
- package/cl.cast.js +86 -86
- package/cl.conviva.js +27 -27
- package/cl.core.js +355 -360
- package/cl.crypto.js +8 -8
- package/cl.dash.js +66 -66
- package/cl.externs.js +26 -26
- package/cl.freewheel.js +19 -19
- package/cl.hls.js +58 -57
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +25 -25
- package/cl.ima.js +17 -17
- package/cl.mse.js +237 -227
- package/cl.muxdata.js +12 -9
- package/cl.onboard.js +4 -4
- package/cl.persistent.js +9 -9
- package/cl.playlist.js +5 -5
- package/cl.smooth.js +58 -58
- package/cl.thumbnails.js +17 -17
- package/cl.tizen.js +57 -57
- package/cl.ttml.js +22 -22
- package/cl.verimatrix.js +4 -4
- package/cl.vimond.js +8 -8
- package/cl.vr.js +15 -15
- package/cl.vtt.js +12 -12
- package/cl.youbora.js +14 -14
- package/package.json +1 -1
- package/typings.d.ts +47 -20
package/cjs/cl.mse.js
CHANGED
|
@@ -1,270 +1,281 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var Vu,Wu,Xu,Yu,Zu,$u,av,bv,
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
_.
|
|
6
|
-
_.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
_.Pv=function(a,b
|
|
13
|
-
|
|
14
|
-
Rv=function(a,b){a
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
_.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
Vw=function(a,b){var c=
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
return Promise.
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
2
|
+
var f=function(window){var Su,Tu,Uu,Vu,Wu,Xu,Yu,Zu,$u,av,bv,ev,fv,iv,jv,kv,lv,mv,nv,pv,rv,sv,uv,vv,wv,yv,zv,Av,Dv,Ev,Fv,Gv,Iv,Nv,Ov,Qv,Tv,Vv,Wv,Xv,Yv,Zv,$v,bw,gw,hw,lw,mw,ow,qw,rw,sw,tw,uw,vw,ww,yw,Fw,Jw,Mw,Lw,Nw,Ow,Pw,Qw,Uw,Ww,Vw,Xw,Yw,ax,bx,cx,dx,fx,jx,hx,lx,mx,nx,px,ox,qx,sx,tx,ux,wx,vx,yx,rx,zx,xx,Ax,Gx,Dx,Bx,Ex,Fx,Hx,Ix,Lx,Kx,Mx,Nx,Ox,Cx,Px,Rx,Jx,Sx,Tx,Ux,Vx,Wx,Xx,Yx,Zx,ay,by,$x,jy,iy,ky,ly,my,oy,py,ry,qy,sy,vy,ty,uy,xy,wy,yy,zy,Cy,Ey,Dy,Fy,Gy,Hy,Iy,Ky,Ly,My,Jy,Oy,Ny,Sy,Ty,Vy,Ry,Qy,Wy,Py,Uy,$y,bz,Zy,cz,Yy,az,Xy,ez,
|
|
3
|
+
dz,gz,iz,kz,lz,qz,tz,vz,xz,Az,Cz,Dz,Gz,wz,Jz,oz,Kz,mz,Iz,Nz,Lz,Fz,Hz,Qz,Pz,Mz,Wz,Xz,Rz,Zz,Sz,Uz,bA,aA,Vz,$z,cA,nz,Ez,Tz,Bz,pz,rz,sz,Yz,yz,zz,fA,gA,hA,nA,lA,kA,jA,mA,pA,tA,AA,LA,sA,FA,GA,HA,BA,IA,yA,OA,fy,dy,gy,ey,hy,cy,TA,RA,DA,zA,KA,UA,SA,WA,JA,MA,oA,CA,XA,xA,NA,$A,EA,wA,ZA,YA,qA,VA,QA,bB,uA,PA,aB,cB,rA,dB,eB,fB,gB,hB,iB,jB,kB,lB,Bv;Su=" buffer";Tu=" is being or has been set up";Uu="\x3c/DATA\x3e\x3c/WRMHEADER\x3e";Vu="\x3c/LA_URL\x3e";Wu="\x3cLA_URL\x3e";Xu='\x3cWRMHEADER xmlns\x3d"http://schemas.microsoft.com/DRM/2007/03/PlayReadyHeader" version\x3d"';
|
|
4
|
+
Yu="CHECKSUM";Zu="Choosing new streams after key status change";$u="IterateSegmentReference";av="Jumping forward";bv="MediaSource threw QuotaExceededError:";_.cv="No stream with id";_.dv="Player is in ERROR state and can not switch to ";ev="PrestoPlay TextTrack";fv="Removing audio from variant - audio not compatible with platform";_.gv="Updating manifest...";_.hv="VOD";iv="bufferBehind\x3d";jv="bufferedBehind\x3d";kv="calling onCanSwitch()...";lv="cannot find segment";mv="clpp.mse.Player";nv="currentPeriod.startTime\x3d";
|
|
5
|
+
_.ov="getSegmentNextReference";pv="key-restriction";_.qv="onChooseStreams_";rv="presentationTime:";sv="presentationTime\x3d";uv="reference.endTime\x3d";vv="reference.position\x3d";wv="reference.startTime\x3d";_.xv="subtitles";yv="switch: Stream ";zv=function(a,b){for(var c in a.a)b(c,a.a[c])};Av=function(a){for(var b=a.a;_.Gk(a)&&0!==a.f.getUint8(a.a);)a.a+=1;b=a.f.buffer.slice(b,a.a);a.a+=1;return _.vh(b)};
|
|
6
|
+
_.Cv=function(a){var b=new Uint8Array(Bv),c=4+b.byteLength+a.j.byteLength+4+a.f.byteLength,d=new _.Ck(c,!1);_.R(d,c);_.Ek(d,b);_.Ek(d,a.j);_.R(d,a.f.byteLength);_.Ek(d,a.f);return _.N(d.buffer)};Dv=function(a,b){a:{if(b){var c=_.u(a.f.keys());for(var d=c.next();!d.done;d=c.next()){d=a.f.get(d.value);for(var e=0;e<d.eb.length;e++)if(d.eb[e]===b){c=d;break a}}}c=null}return c?c.Da:null};Ev=function(a,b){return _.cj("Edge/")?!0:a.L.has(b)};
|
|
7
|
+
Fv=function(a,b){var c=a.m.get(b);return!(!c||c!==_.Td&&c!==_.od)};Gv=function(a,b){var c=b.audio,d=b.video;if(c&&c.encrypted&&!Ev(a,_.Xi(c.mimeType,c.codecs))||d&&d.encrypted&&!Ev(a,_.Xi(d.mimeType,d.codecs)))return!1;var e=a.keySystem();return 0==b.drmInfos.length||b.drmInfos.some(function(f){return f.keySystem==e})};_.Hv=function(a,b){return a.concat(b)};Iv=function(){};
|
|
8
|
+
_.Jv=function(a,b){if(0==b.length)return a;var c=b.map(function(d){return new _.Kg(d)});return a.map(function(d){return new _.Kg(d)}).map(function(d){return c.map(d.resolve.bind(d))}).reduce(_.Hv,[]).map(function(d){return d.toString()})};_.Kv=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:b||[],keyIds:[],periodId:c?c:null}};
|
|
9
|
+
_.Lv=function(a,b,c,d,e){this.Ka=a;this.sa=b;this.ea=c;this.keyInfo=d||null;this.Fc=_.K.R(e)?!1:!!e};
|
|
10
|
+
_.Mv=function(a,b,c,d,e,f,g,h,l,m,n,p,q,r){l=void 0===l?!1:l;m=void 0===m?null:m;n=void 0===n?null:n;p=void 0===p?null:p;q=void 0===q?null:q;r=void 0===r?[]:r;this.position=a;this.startTime=b;this.endTime=c;this.Na=g;this.Ka=d;this.sa=e;this.ea=f;this.keyInfo=(void 0===h?null:h)||null;this.Fc=_.K.R(l)?!1:!!l;this.timescale=m;this.horizontalTiles=n;this.verticalTiles=p;this.durationPerTile=q;this.a=r||[];this.g=!1};
|
|
11
|
+
Nv=function(a,b){a=_.fh(a);b=_.fh(b);var c=a.split("-"),d=b.split("-");return c[0]==d[0]&&1==c.length&&2==d.length};Ov=function(a){return a.language?_.fh(a.language):a.audio&&a.audio.language?_.fh(a.audio.language):a.video&&a.video.language?_.fh(a.video.language):_.He};
|
|
12
|
+
_.Pv=function(a,b){for(var c=_.fh(a),d=new Set,e=_.u(b),f=e.next();!f.done;f=e.next())d.add(_.fh(f.value));e=_.u(d);for(f=e.next();!f.done;f=e.next())if(f=f.value,f==c)return f;e=_.u(d);for(f=e.next();!f.done;f=e.next())if(f=f.value,Nv(f,c))return f;e=_.u(d);for(f=e.next();!f.done;f=e.next()){var g=f=f.value,h=c;g=_.fh(g);h=_.fh(h);g=g.split("-");h=h.split("-");if(2==g.length&&2==h.length&&g[0]==h[0])return f}d=_.u(d);for(f=d.next();!f.done;f=d.next())if(e=f.value,Nv(c,e))return e;return null};
|
|
13
|
+
Qv=function(a,b){for(var c in b)if(b[c]===a)return c;return""};
|
|
14
|
+
_.Rv=function(a,b){if(!a.length)return b;if(!b.length)return a;for(var c=[],d=0;d<a.length;d++)for(var e={},f=0;f<b.length;e={Uc:e.Uc},f++)if(a[d].keySystem===b[f].keySystem&&a[d].periodId===b[f].periodId){var g=a[d];f=b[f];var h=[];h=h.concat(g.initData||[]);h=h.concat(f.initData||[]);e.Uc=_.mf(g.keyIds||[]).concat();f.keyIds&&f.keyIds.length&&f.keyIds.forEach(function(l){return function(m){l.Uc.includes(m)||l.Uc.push(m)}}(e));c.push({keySystem:g.keySystem,licenseServerUri:g.licenseServerUri||f.licenseServerUri,
|
|
15
|
+
distinctiveIdentifierRequired:g.distinctiveIdentifierRequired||f.distinctiveIdentifierRequired,persistentStateRequired:g.persistentStateRequired||f.persistentStateRequired,videoRobustness:g.videoRobustness||f.videoRobustness,audioRobustness:g.audioRobustness||f.audioRobustness,serverCertificate:g.serverCertificate||f.serverCertificate,initData:h,keyIds:e.Uc,periodId:g.periodId});break}return c};_.Sv=function(a,b){return a.length&&b.length?0<_.Rv(a,b).length:!0};
|
|
16
|
+
Tv=function(a,b){for(var c=0,d=_.u(a),e=d.next();!e.done;e=d.next())c+=b(e.value)?1:0;return c};_.Uv=function(a){if(_.rq.has(a))return _.rq.get(a);if(window.ManagedMediaSource){var b=ManagedMediaSource.isTypeSupported(a);_.rq.set(a,b);return b}return window.MediaSource?(b=MediaSource.isTypeSupported(a),_.rq.set(a,b),b):!1};
|
|
17
|
+
Vv=function(){this.a=new muxjs.mp4.Transmuxer({keepOriginalTimestamps:!0,remux:!1});this.f=null;this.o=[];this.m=[];this.g=[];this.j=!1;this.a.on("data",this.A.bind(this));this.a.on("done",this.w.bind(this))};Wv=function(a,b){a.j=!0;a.f=new _.ci;a.o=[];a.m=[];a.g=[];var c=_.N(b);a.a.push(c);a.a.flush();a.j&&a.f.reject(new _.L(_.M,3,3018));return a.f};
|
|
18
|
+
Xv=function(a,b){var c=b.replace(/mp2t/i,_.Fd);a==_.kc&&(c=c.replace(_.Qe,_.kc));var d=/avc1\.(66|77|100)\.(\d+)/.exec(c);if(d){var e="avc1.",f=d[1],g=Number(d[2]);e=("66"==f?e+"4200":"77"==f?e+"4d00":e+"6400")+(g>>4).toString(16);e+=(g&15).toString(16);c=c.replace(d[0],e)}return c};
|
|
19
|
+
Yv=function(a,b){return!window.muxjs||"mp2t"!=a.toLowerCase().split(";")[0].split("/")[1]&&"aac"!=a.toLowerCase().split(";")[0].split("/")[1]?!1:b?_.Uv(Xv(b,a))||_.Uv(a.replace(/aac/i,_.Fd)):_.Uv(Xv(_.kc,a))||_.Uv(a.replace(/aac/i,_.Fd))||_.Uv(Xv(_.Qe,a))};
|
|
20
|
+
Zv=function(a,b){var c=new Map;c.set(a,b);try{var d=b.match(/"(.*?)"/)[0].replace(/"/g,"").split(","),e=new Map;if(1<d.length)for(var f=_.u(d),g=f.next();!g.done;g=f.next()){var h=g.value;h.startsWith("avc")?e.set(_.Qe,'video/mp4;codecs\x3d"'+h+'"'):h.startsWith("mp4a")&&e.set(_.kc,'audio/mp4;codecs\x3d"'+h+'"')}return 0<e.size?e:c}catch(l){return c}};$v=function(a){var b=[a.mimeType];_.sq.forEach(function(c,d){var e=a[d];e&&b.push(c+'\x3d"'+e+'"')});return b.join(";")};
|
|
21
|
+
_.aw=function(a){a=a.split(".");var b=a[0];a.pop();return[b,a.join(".")]};bw=function(a,b){for(var c=new _.Zj(void 0,void 0===b?"total":b),d=_.u(a),e=d.next();!e.done;e=d.next())c.a.push(e.value);c.length=a.length;return c};_.cw=function(a,b){return Array.prototype.filter.call(a.childNodes,function(c){return c instanceof Element&&c.tagName==b})};_.dw=function(a,b){var c=_.cw(a,b);return 1!=c.length?null:c[0]};
|
|
22
|
+
_.ew=function(a){return Array.prototype.every.call(a.childNodes,function(b){return b.nodeType==Node.TEXT_NODE||b.nodeType==Node.CDATA_SECTION_NODE})?a.textContent.trim():null};_.fw=function(a,b){var c=new DOMParser,d=null,e=null;try{e=c.parseFromString(a,_.De)}catch(f){}e&&e.documentElement.tagName==b&&(d=e.documentElement);return d&&0<d.getElementsByTagName("parsererror").length?null:d};
|
|
23
|
+
gw=function(a){var b=[];b.push(a[3]);b.push(a[2]);b.push(a[1]);b.push(a[0]);b.push(a[5]);b.push(a[4]);b.push(a[7]);b.push(a[6]);a=_.N(a);a.set(b,0);return a};hw=function(a,b,c,d,e,f){f=void 0===f?null:f;_.Al.call(this,a,b,d);this.version=e;this.g=c;this.m=f};_.jw=function(a,b){return b===a.version?a:_.iw(b,a.a,a.m||void 0,a.g||void 0)};
|
|
24
|
+
_.iw=function(a,b,c,d){var e=_.Nh(b);if(8!==e.byteLength)e="";else{var f=gw(e);e=_.Kh(f);b:switch(f=f.byteLength,_.Sf("Trying to create PlayReady header in version",a),a){case "4.0.0.0":e=[Xu+a+'"\x3e',"\x3cDATA\x3e\x3cPROTECTINFO\x3e","\x3cKEYLEN\x3e"+f+"\x3c/KEYLEN\x3e","\x3cALGID\x3eAESCTR\x3c/ALGID\x3e\x3c/PROTECTINFO\x3e","\x3cKID\x3e"+e+"\x3c/KID\x3e",c?"\x3cCHECKSUM\x3e"+c+"\x3c/CHECKSUM\x3e":"",d?Wu+d+Vu:"",Uu].join("");break b;case "4.1.0.0":e=[Xu+a+'"\x3e','\x3cDATA\x3e\x3cPROTECTINFO\x3e\x3cKID ALGID\x3d"AESCTR" ',
|
|
25
|
+
c?'CHECKSUM\x3d"'+c+'" ':"",'VALUE\x3d"'+e+'"',"\x3e\x3c/KID\x3e\x3c/PROTECTINFO\x3e",d?Wu+d+Vu:"",Uu].join("");break b;case "4.2.0.0":case "4.3.0.0":e=[Xu+a+'"\x3e','\x3cDATA\x3e\x3cPROTECTINFO\x3e\x3cKIDS\x3e\x3cKID ALGID\x3d"AESCTR" ',c?'CHECKSUM\x3d"'+c+'" ':"",'VALUE\x3d"'+e+'"',"\x3e\x3c/KID\x3e\x3c/KIDS\x3e\x3c/PROTECTINFO\x3e",d?Wu+d+Vu:"",Uu].join("");break b;default:_.F("Cannot create PlayReady header in version",a),e=""}}if(!e)return null;_.Sf("New payload",e);e=_.N(_.Ah(e,!0));return new hw(kw,
|
|
26
|
+
b,d||null,e,a,c)};lw=function(a){a=_.dw(a,"PROTECTINFO");if(!a)return null;var b=_.dw(a,"KID");if(!b)return null;a=b.getAttribute("VALUE");if(!a)return null;var c=b.getAttribute(Yu);b=b.getAttribute("ALGID");return{value:a,se:c,oh:b}};
|
|
27
|
+
mw=function(a){a=_.dw(a,"PROTECTINFO");if(!a)return null;a=_.dw(a,"KIDS");if(!a)return null;var b=_.cw(a,"KID");if(!b.length)return null;a=[];b=_.u(b);for(var c=b.next();!c.done;c=b.next()){var d=c.value;if(c=d.getAttribute("VALUE")){var e=d.getAttribute(Yu);d=d.getAttribute("ALGID");a.push({value:c,se:e,oh:d})}}return a.length?a:null};
|
|
28
|
+
_.nw=function(a){a:{a=new _.Fk(new DataView(a.buffer),!0);_.T(a);for(_.Jk(a);_.Gk(a);)if(1===_.Jk(a)){var b=_.Jk(a);a=_.Nk(a,b);break a}a=null}b=_.xh(a,!0);var c=_.fw(b,"WRMHEADER");b=c.getAttribute("version");var d=_.dw(c,"DATA");c=(c=_.dw(d,"LA_URL"))?_.ew(c):"";var e;if(e=_.dw(d,"KID"))if(e=_.ew(e)){var f=_.dw(d,Yu);e={value:e,se:f?f.textContent.trim():null}}else e=null;else e=null;d=e?[e]:(e=lw(d))?[e]:(d=mw(d))?d:null;e=d&&d[0]||{};d=e.se;e=_.Mh(void 0===e.value?"":e.value);e=gw(e);e=_.Oh(e);
|
|
29
|
+
return new hw(kw,e,c,a,b,d)};ow=function(a,b){return a.start-b.start};_.pw=function(a){this.m=a;this.log=new _.H("clpp.renditions");this.U=[];this.j=this.a=null;this.g=!1};qw=function(a){return a.U.map(function(b){return{start:b.start,end:b.end,width:b.width,height:b.height,bandwidth:b.bandwidth,rendition:b.rendition}})};rw=function(a){a.a&&a.a.trigger(new _.J(_.rc))};
|
|
30
|
+
sw=function(a){if(a.a){for(var b=!1,c={},d=0;d<a.U.length;d++){var e=a.U[d],f=e.width+"x"+e.height,g=c[f];if(g&&g!==e.bandwidth){b=!0;break}c[f]=e.bandwidth}b&&!a.g?(a.log.debug("Tracking timeupdates"),a.a.on(_.Ee,a.f,a),a.g=!0):!b&&a.g&&(a.log.debug("Stop tracking timeupdates"),a.a.off(_.Ee,a.f),a.g=!1)}};tw=function(a,b,c){a.U=a.U.filter(function(d){if(d.end<=b||d.start>=c)return!1;d.start=Math.max(d.start,b);d.end=Math.min(d.end,c);return!0});a.a&&a.a.trigger(new _.J(_.Te))};
|
|
31
|
+
uw=function(a,b){for(var c=null,d=_.u(a),e=d.next();!e.done;e=d.next())e=e.value,b>=e.startTime&&(c=e);return c};vw=function(a){var b=new Set;a.variants.forEach(function(c){c.audio&&b.add(c.audio);c.video&&(b.add(c.video),c.video.trickModeVideo&&b.add(c.video.trickModeVideo))});a.textStreams.forEach(function(c){return b.add(c)});a.thumbStreams.forEach(function(c){return b.add(c)});return b};ww=function(a,b){for(var c=0;c<a.length;c++)if(vw(a[c]).has(b))return c;return-1};
|
|
32
|
+
yw=function(a,b){Array.from(vw(a)).forEach(function(c){c.segmentIndex&&_.xw(c.segmentIndex,b)})};_.zw=function(a){this.g=Math.exp(Math.log(.5)/a);this.f=this.a=0};_.Aw=function(a,b,c){var d=Math.pow(a.g,b);c=c*(1-d)+d*a.a;isNaN(c)||(a.a=c,a.f+=b)};_.Bw=function(a){return a.a/(1-Math.pow(a.g,a.f))};
|
|
33
|
+
_.Cw=function(a,b,c,d,e,f,g,h){a=_.Yh(a);a.timeout=d.timeout;a.maxAttempts=d.maxAttempts;a.baseDelay=d.baseDelay;a.fuzzFactor=d.fuzzFactor;a.backoffFactor=d.backoffFactor;if(0!==b||null!=c)a.headers.Range=c?"bytes\x3d"+b+"-"+c:"bytes\x3d"+b+"-";e&&(a.startTime=e);f&&(a.endTime=f);g&&(a.contentType=g);h&&(a.timescale=h);return a};
|
|
34
|
+
_.Dw=function(a,b,c,d){var e=void 0===e?!1:e;this.A=a;this.F=b;this.m=this.f=Infinity;this.a=1;this.B=0;this.g=this.j=null;this.D=0;this.w=this.o=c;this.I=void 0===d?!0:d;this.h=new _.H("clpp.media.PresentationTimeline");this.H=e};_.Ew=function(a,b){a.o=b;a.w=b};Fw=function(a){return a.o?a.f:a.w?a.g:null};
|
|
35
|
+
_.Hw=function(a,b,c){if(0!=b.length){var d=b[b.length-1].endTime+c;_.Gw(a,b[0].startTime+c);a.a=b.reduce(function(e,f){return Math.max(e,f.endTime-f.startTime)},a.a);a.g=Math.max(a.g||0,d);null!=a.A&&a.I&&(a.A=(Date.now()+a.D)/1E3-(a.g||0)-a.a);a.h.debug("notifySegments: maxSegmentDuration\x3d"+a.a)}};_.Gw=function(a,b){a.j=null==a.j?b:Math.min(a.j,b)};_.Iw=function(a,b){a.a=Math.max(a.a,b);a.h.debug("notifyNewSegmentDuration: maxSegmentDuration\x3d"+a.a)};
|
|
36
|
+
_.Kw=function(a){return Infinity==a.m?0:Math.max(0,Jw(a)-a.m)};Jw=function(a){if(a.o)a=a.f;else if(a.w)a=a.g||0;else{var b=(Date.now()+a.D)/1E3;a=Math.min(a.H?Math.max(0,b-(a.a-a.B)-a.A):Math.max(0,b-a.a-a.A),a.f)}return a};Mw=function(a,b){var c=Math.max(a.j,0);return Infinity==a.m?Math.ceil(1E3*c)/1E3:Math.max(c,Math.min(Jw(a)-a.m+b,Lw(a)))};Lw=function(a){return Math.max(0,Jw(a)-(a.o||a.w?0:a.F))};Nw=function(){this.f=function(){};this.a=new Set};Ow=function(a,b){a.f=b};
|
|
37
|
+
Pw=function(a,b,c){this.g=a;this.a=b;this.f=c;this.h=new _.H("clpp.media.SegmentIterator")};Qw=function(a){var b=a.g.get(a.a);if(!b)return null;0<b.a.length&&b.Ka().length&&a.f>=b.a.length&&(a.a+=1,a.f=0,b=a.g.get(a.a));return b&&0<b.a.length?b.a[a.f]||null:b};_.Rw=function(a){this.a=a;this.h=new _.H("clpp.media.SegmentIndex")};_.Sw=function(a){return a.a.length?a.a[a.a.length-1].endTime:0};_.Tw=function(a,b){for(var c=0;c<a.a.length;++c)if(a.a[c].endTime>b)return a.a.splice(0,c);c=a.a;a.a=[];return c};
|
|
38
|
+
Uw=function(a,b){var c=a.Dc(b);c=null===c?-1:c-1;var d=a.get(c+1),e=-1;if(d&&0<d.a.length)for(var f=d.a.length-1;0<=f;--f){var g=d.a[f];if(b>=g.startTime&&b<g.endTime){for(;f&&!g.g;)--f,g=d.a[f];if(!g.g)break;c+=1;e=f-1;break}}return new Pw(a,c,e)};_.xw=function(a,b){for(;a.a.length;)if(0>=a.a[0].endTime)a.a.shift();else break;0==a.a.length||a.a[a.a.length-1].startTime>=b||(a.a[a.a.length-1].endTime=b)};Ww=function(a){var b=this;this.f=a;this.a=new Set;this.g=(new _.$i(function(){Vw(b,!1)})).cb(.25)};
|
|
39
|
+
Vw=function(a,b){for(var c=_.u(a.a),d=c.next();!d.done;d=c.next())d.value.o(a.f.currentTime,b)};
|
|
40
|
+
Xw=function(a){var b=this;this.m=a;this.j=new Map;this.a=function(){};this.f=function(){};this.g=function(){};this.w=[{pc:null,oc:2,dc:function(c,d){return b.a(c,d)}},{pc:1,oc:2,dc:function(c,d){return b.a(c,d)}},{pc:3,oc:2,dc:function(c,d){return b.a(c,d)}},{pc:2,oc:1,dc:function(c,d){return b.f(c,d)}},{pc:2,oc:3,dc:function(c,d){return b.f(c,d)}},{pc:1,oc:3,dc:function(c,d){return b.g(c,d)}},{pc:3,oc:1,dc:function(c,d){return b.g(c,d)}}]};Yw=function(a,b,c,d){a.a=b;a.f=c;a.g=d};
|
|
41
|
+
_.Zw=function(a){_.wp[a]&&delete _.wp[a]};_.$w=function(a){_.up[a]&&delete _.up[a]};ax=function(a,b){this.w=null;this.D=a;this.g=b;this.j=this.A=0;this.m=Infinity;this.f=this.a=null;this.B="";this.o=new Map};
|
|
42
|
+
bx=function(a,b,c,d){return Promise.resolve().then(function(){if(a.w&&a.g)if(null==c||null==d)a.w.parseInit(_.N(b));else{var e={periodStart:a.A,segmentStart:c,segmentEnd:d};e=a.w.parseMedia(_.N(b),e);var f=e.cues.filter(function(g){return g.startTime>=a.j&&g.startTime<a.m});a.g.append(f,e.styles);null==a.a&&(a.a=Math.max(c,a.j));a.f=Math.min(d,a.m)}})};
|
|
43
|
+
cx=function(a,b,c){a.B=b;if(b=a.o.get(b))for(var d=_.u(b.keys()),e=d.next();!e.done;e=d.next())if(e=b.get(e.value))e=e.filter(function(f){return f.endTime<=c}),a.g.append(e,[])};
|
|
44
|
+
dx=function(a,b,c,d,e){var f=c+" "+d,g=new Map;b=_.u(b);for(var h=b.next();!h.done;h=b.next()){var l=h.value;h=l.stream;g.has(h)||g.set(h,new Map);g.get(h).has(f)||g.get(h).set(f,[]);l.startTime+=e;l.endTime+=e;l.startTime>=a.j&&l.startTime<a.m&&(l=new _.yg(l.startTime,l.endTime,l.text),g.get(h).get(f).push(l),h==a.B&&a.g.append([l],[]))}e=_.u(g.keys());for(f=e.next();!f.done;f=e.next())for(f=f.value,a.o.has(f)||a.o.set(f,new Map),b=_.u(g.get(f).keys()),h=b.next();!h.done;h=b.next())h=h.value,l=g.get(f).get(h),
|
|
45
|
+
a.o.get(f).set(h,l);a.a=null==a.a?Math.max(c,a.j):Math.min(a.a,Math.max(c,a.j));a.f=Math.max(a.f,Math.min(d,a.m))};_.ex=function(a){a=a.toLowerCase();return _.Rp[a]||window.muxjs&&a==_.cc?!0:!1};fx=function(){this.a=new muxjs.mp4.CaptionParser;this.m=[];this.j={}};_.gx=function(){};
|
|
46
|
+
_.ix=function(a,b,c,d,e){this.j=a;this.B=c;this.f={};this.K=!1;this.a=null;this.g={};this.m=new _.dg;this.J=!1;this.A={};this.H=b;this.D=d;this.O=e;this.S=this.O.streaming.maxSegmentToMediaOffset||1;this.I=new _.ci;this.w="";this.F={};this.o=hx(this,this.I);this.L=!0;this.h=new _.H("clpp.mse.MediaSourceEngine")};jx=function(a){var b=_.Xi(a.mimeType,a.codecs),c=$v(a);return _.ex(b)||_.Uv(c)||Yv(b,a.type)};
|
|
47
|
+
hx=function(a,b){if(window.ManagedMediaSource){a.j.disableRemotePlayback=!0;var c=new ManagedMediaSource;a.m.one(c,"sourceopen",function(){URL.revokeObjectURL(a.w);b.resolve()});a.m.on(c,"startstreaming",function(){a.L=!0});a.m.on(c,"endstreaming",function(){a.L=!1});a.w=kx(c);a.j.src=a.w;return c}c=new MediaSource;a.w=kx(c);a.m.one(c,"sourceopen",function(){URL.revokeObjectURL(a.w);b.resolve()});a.j.src=a.w;return c};
|
|
48
|
+
lx=function(a,b){b.forEach(function(c,d){var e=a.o.addSourceBuffer(c);a.m.on(e,_.id,a.T.bind(a,d));a.m.on(e,"updateend",a.Qc.bind(a,d));a.f[d]=e;a.g[d]=[];a.F[d]=!1});a.K=b.has(_.kc)&&b.has(_.Qe)};mx=function(a,b){a.a||(a.a=new ax(a.O,a.B));var c=a.a;if(b!=_.cc){var d=_.Rp[b];if(!d)throw new _.L(_.M,2,2012,"Text parser is unavailable for "+b);c.w=new d(c.D)}};nx=function(a){return a.o?a.o.readyState==_.hd:!0};
|
|
49
|
+
px=function(a){var b={};b.total=new _.Zj(a.j.buffered,"total");b.audio=ox(a,_.kc);b.video=ox(a,_.Qe);var c=[];a.a&&(c=[{start:a.a.sb(),end:a.a.Ba()}]);b.text=bw(c,_.Be);return b};ox=function(a,b){try{return new _.Zj(a.f[b].buffered,b)}catch(c){return b in a.f&&a.h.error("failed to get buffered range for "+b,c),null}};qx=function(a,b){if(!a.f[b])return"";var c=ox(a,b);return c?c.toString():""};
|
|
50
|
+
sx=function(a,b,c,d,e,f,g,h){h=void 0===h?!1:h;var l=a.f[b],m=-1,n=0;l&&l.buffered&&(n=l.buffered.length);b===_.Qe&&null!==d&&null!==e&&h&&(m=0<n?l.buffered.end(n-1):-1);b==_.Be?c=bx(a.a,c,d,e):a.A[b]?c=Wv(a.A[b],c).then(function(p){p.captions&&0<p.captions.length&&(a.a||mx(a,_.Ce),dx(a.a,p.captions,d,e,a.f.video.timestampOffset));var q=[];0<p.audio.byteLength&&a.f.audio&&q.push(rx(a,_.kc,a.we.bind(a,_.kc,p.audio.buffer)));0<p.video.byteLength&&a.f.video&&q.push(rx(a,_.Qe,a.we.bind(a,_.Qe,p.video.buffer)));
|
|
51
|
+
return Promise.all(q)}):(f&&window.muxjs&&(a.a||mx(a,_.Ce),null==d&&null==e?a.H.init(c):a.H.g(c,function(p){p.length&&dx(a.a,p,d,e,a.f.video.timestampOffset)})),c=rx(a,b,a.we.bind(a,b,c)));return c.then(function(){if(b===_.Qe&&null!==d&&null!==e&&!h)a.D.append(d,e,g),null!==d&&null!==e&&a.h.debug("Appended video segment ",d,e,"Buffer:",qx(a,b));else if(b===_.kc&&null!==d&&null!==e)rw(a.D),null!==d&&null!==e&&a.h.debug("Appended audio segment ",d,e,"Buffer:",qx(a,b));else if(b===_.Qe&&null!==d&&null!==
|
|
52
|
+
e&&h){var p=l.buffered.length,q=0<p?l.buffered.end(p-1):-1;0>m&&0<p&&(m=l.buffered.start(0));0<=m&&0<q&&a.D.append(m,q,g)}if(!a.F[b]&&l&&1===l.buffered.length){p=l.buffered.start(0);var r=d-p;if(Math.abs(r)>a.S&&0===l.timestampOffset)return a.h.warn("Detected a delta of "+r+" between media times and segment times for "+(b+". The segment start time is ")+(d+" and the media start time is ")+(p+". Adjusting timestampOffset.")),p=rx(a,b,function(){a.Yg(b,r)}),q=rx(a,b,a.bg.bind(a,b,!1)),Promise.all([p,
|
|
53
|
+
q])}null!==d&&null!==e&&(a.F[b]=!0)})["catch"](function(p){throw p;})};tx=function(a,b){var c=a.Ba(_.Qe)||0;cx(a.a,b,c)};ux=function(a){a.a&&cx(a.a,"",0)};wx=function(a,b,c,d,e){if(b==_.Be)return a.a.A=c,a=a.a,a.j=d,a.m=e,Promise.resolve();b=vx(a,b,c,d,e);a.K&&(b=b.concat(vx(a,_.kc,c,d,e)));return Promise.all(b)};vx=function(a,b,c,d,e){return[rx(a,b,a.lh.bind(a,b)),rx(a,b,a.Yg.bind(a,b,c)),rx(a,b,a.Yk.bind(a,b,d,e))]};yx=function(a,b){xx(a,function(){a.o.duration=b})};
|
|
54
|
+
rx=function(a,b,c){if(a.J)return Promise.reject();c={start:c,p:new _.ci};a.g[b].push(c);1===a.g[b].length&&zx(a,b);return c.p};zx=function(a,b){var c=a.g[b][0];if(c)try{a.h.debug("Starting next operation for "+b),c.start()}catch(d){"QuotaExceededError"==d.name?c.p.reject(new _.L(_.M,3,3017,{type:b})):c.p.reject(new _.L(_.M,3,3015,{mediaError:d})),Ax(a,b)}else a.h.debug("No more scheduled operations for "+b)};
|
|
55
|
+
xx=function(a,b){if(a.J)return Promise.reject();var c=[],d;for(d in a.f){var e=new _.ci,f={start:function(g){g.resolve()}.bind(null,e),p:e};a.g[d].push(f);c.push(e);1==a.g[d].length&&f.start()}return Promise.all(c).then(function(){for(var g in a.f);try{b()}catch(m){var h=Promise.reject(new _.L(_.M,3,3015,{mediaError:m}))}for(var l in a.f)Ax(a,l);return h},function(){for(var g in a.f)a.g[g].length&&a.g[g].shift();return Promise.reject()})};Ax=function(a,b){a.g[b].shift();zx(a,b)};
|
|
56
|
+
Gx=function(a,b,c,d){var e=a.periods.flatMap(function(n){return n.variants});if(b.length||c.length)e=Bx(e,b,c);e=Cx(e,d);if(1<a.periods.length){var f=function(n){n=n.split(".");var p=n[0];1<n.length&&(p+="."+n[1]);return p.toLowerCase()};b=[];c=_.u(a.periods);for(var g=c.next();!g.done;g=c.next()){d=new Set;g=_.u(g.value.variants);for(var h=g.next();!h.done;h=g.next())h=h.value,null!==h.audio&&d.add(f(h.audio.codecs));b.push(d)}var l=b[0];c={};for(d=1;d<b.length;c={ge:c.ge},d++)c.ge=b[d],l=new Set(_.mf(l).concat().filter(function(n){return function(p){return n.ge.has(p)}}(c)));
|
|
57
|
+
e=e.filter(function(n){return 0===l.size&&null===n.audio?!0:0<l.size&&null===n.audio?!1:l.has(f(n.audio.codecs))})}e=Dx(e);var m=Ex(e);a=_.u(a.periods);for(e=a.next();!e.done;e=a.next())e=e.value,e.variants=e.variants.filter(function(n){if(Fx(n)===m)return!0;_.Sf("Dropping Variant (better codec available)",n);return!1})};Dx=function(a){var b=new _.Zf;a=_.u(a);for(var c=a.next();!c.done;c=a.next()){c=c.value;var d=Fx(c);b.push(d,c)}return b};
|
|
58
|
+
Bx=function(a,b,c){var d={};b=_.u(b);for(var e=b.next();!e.done;d={me:d.me},e=b.next())if(d.me=e.value,e=a.filter(function(f){return function(g){return g.video&&g.video.codecs.startsWith(f.me)}}(d)),e.length){a=e;break}d={};c=_.u(c);for(b=c.next();!b.done;d={ee:d.ee},b=c.next())if(d.ee=b.value,b=a.filter(function(f){return function(g){return g.audio&&g.audio.codecs.startsWith(f.ee)}}(d)),b.length){a=b;break}return a};
|
|
59
|
+
Ex=function(a){var b="",c=Infinity;zv(a,function(d,e){var f=e.reduce(function(g,h){return g+h.bandwidth||0},0)/e.length;_.Sf(_.Oc,d,"avg bandwidth",f);f<c&&(b=d,c=f)});return b};Fx=function(a){var b="";a.video&&(b=_.aw(a.video.codecs)[0]);var c="";a.audio&&(c=_.aw(a.audio.codecs)[0]);return b+"-"+c};
|
|
60
|
+
Hx=function(a,b,c){function d(f,g,h){return f>=g&&f<=h}var e=a.video;return e&&e.width&&e.height&&!(d(e.width,b.minWidth,Math.min(b.maxWidth,c.width))&&d(e.height,b.minHeight,Math.min(b.maxHeight,c.height))&&d(e.width*e.height,b.minPixels,b.maxPixels))||!d(a.bandwidth,b.minBandwidth,b.maxBandwidth)?!1:!0};Ix=function(a,b,c){var d=!1;a=_.u(a);for(var e=a.next();!e.done;e=a.next()){e=e.value;var f=e.allowedByApplication;e.allowedByApplication=Hx(e,b,c);f!=e.allowedByApplication&&(d=!0)}return d};
|
|
61
|
+
Lx=function(a,b,c,d){var e=!1;d.variants=d.variants.filter(function(m){if(a&&a.da&&!Gv(a,m))return _.Sf("Dropping variant - not compatible with key system",m),!1;var n=m.audio,p=m.video;if(n&&!jx(n)){var q=n.codecs;0<=n.codecs.indexOf("ec-3")?(_.Sf("Trying to use AC-3 for EC-3"),n.codecs=n.codecs.replace("ec-3","ac-3"),jx(n)?_.Rf("Using AC-3 instead of EC-3 for",Jx(n)):(n.codecs=q,_.Rf(fv,Jx(n)),m.audio=null,e=!0,n=null)):(_.Rf(fv,Jx(n)),m.audio=null,e=!0,n=null)}return p&&!jx(p)?(_.Rf("Dropping variant - video not compatible with platform",
|
|
62
|
+
Jx(p)),!1):n&&b&&!Kx(n,b)?(_.Rf("Dropping variant - not compatible with active audio","active audio",Jx(b),"variant.audio",Jx(n)),!1):p&&c&&!Kx(p,c)?(_.Rf("Dropping variant - not compatible with active video","active video",Jx(c),"variant.video",Jx(p)),!1):!0});if(e){for(var f=!1,g=!1,h=_.u(d.variants),l=h.next();!l.done;l=h.next())l=l.value,!f&&l.video&&l.audio&&(f=!0),g||l.audio||!l.video||(g=!0);f&&g&&(d.variants=d.variants.filter(function(m){return m.video&&!m.audio?(_.Rf("Dropping variant - not compatible with video + audio",
|
|
63
|
+
"variant.video",Jx(m.video)),!1):!0}))}d.textStreams=d.textStreams.filter(function(m){var n=_.ex(_.Xi(m.mimeType,m.codecs));n||_.Sf("Dropping text stream. Is not supported by the platform.",m);return n})};Kx=function(a,b){return a.mimeType!=b.mimeType||a.codecs.split(".")[0]!=b.codecs.split(".")[0]?!1:!0};
|
|
64
|
+
Mx=function(a){var b=a.audio,c=a.video,d=b?b.codecs:null,e=c?c.codecs:null,f=[];e&&f.push(e);d&&f.push(d);var g=c&&c.mimeType||null,h=b&&b.mimeType||null,l=[];b&&l.push(b.kind);c&&l.push(c.kind);l=l[0]||null;var m=new Set,n=new Set;if(b)for(var p=_.u(b.roles),q=p.next();!q.done;q=p.next())n.add(q.value);if(c)for(p=_.u(c.roles),q=p.next();!q.done;q=p.next())m.add(q.value);q=[c,b].map(function(r){return r?r.accessibility||[]:[]}).reduce(function(r,v){return r.concat(v)},[]);a={id:a.id,active:!1,type:"variant",
|
|
56
65
|
bandwidth:a.bandwidth,language:a.language,label:null,kind:l,width:null,height:null,frameRate:null,mimeType:g,audioMimeType:h,codecs:f.join(", "),audioCodec:d,videoCodec:e,primary:a.primary,roles:Array.from(m),audioRoles:Array.from(n),videoId:null,audioId:null,channelsCount:null,audioBandwidth:null,videoBandwidth:null,originalVideoId:null,originalAudioId:null,originalTextId:null,accessibility:q,keyId:c?c.keyId:b?b.keyId:null};c&&(a.videoId=c.id,a.originalVideoId=c.originalId,a.width=c.width||null,
|
|
57
66
|
a.height=c.height||null,a.frameRate=c.frameRate||null,a.videoBandwidth=c.bandwidth||null);b&&(a.audioId=b.id,a.originalAudioId=b.originalId,a.channelsCount=b.channelsCount,a.audioBandwidth=b.bandwidth||null,a.label=b.label,a.audioRoles=b.roles);return a};
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
_.
|
|
61
|
-
[]);return b.length?
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
d,null,["id","track"])}))||c.renditions.push(d);return a||d};
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
_.
|
|
70
|
-
c),
|
|
71
|
-
|
|
72
|
-
a.g=b}};
|
|
73
|
-
|
|
74
|
-
_
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
67
|
+
Nx=function(a){return{id:a.id,active:!1,type:_.Be,bandwidth:0,language:a.language,label:a.label,kind:a.kind||null,width:null,height:null,frameRate:null,mimeType:a.mimeType,audioMimeType:null,codecs:a.codecs||null,audioCodec:null,videoCodec:null,primary:a.primary,roles:a.roles,audioRoles:null,videoId:null,audioId:null,channelsCount:null,audioBandwidth:null,videoBandwidth:null,originalVideoId:null,originalAudioId:null,originalTextId:a.originalId,accessibility:a.accessibility,keyId:null}};
|
|
68
|
+
Ox=function(a){return a.allowedByApplication&&a.allowedByKeySystem};Cx=function(a,b){var c=a.filter(function(g){return g.audio&&g.audio.channelsCount}),d=new Map;c=_.u(c);for(var e=c.next();!e.done;e=c.next()){e=e.value;var f=e.audio.channelsCount;d.has(f)||d.set(f,[]);d.get(f).push(e)}c=Array.from(d.keys());if(0===c.length)return a;e=c.filter(function(g){return g<=b});return e.length?d.get(Math.max.apply(null,e)):d.get(Math.min.apply(null,c))};
|
|
69
|
+
_.Qx=function(a,b,c){b=_.Eg(b);var d=a,e=a.filter(function(g){return g.primary});e.length&&(d=e);var f=d.length?d[0].language:"";d=d.filter(function(g){return g.language===f});b.some(function(g){var h=_.Pv(_.fh(g),a.map(function(l){return l.language}));return h?(d=a.filter(function(l){return _.fh(l.language)===h}),!0):!1});if(c){b=Px(d,c);if(b.length)return b;_.F("No exact match for the text role could be found.")}else if(b=d.filter(function(g){return 0===g.roles.length}),b.length)return b;b=d.map(function(g){return g.roles}).reduce(_.Hv,
|
|
70
|
+
[]);return b.length?Px(d,b[0]):d};Px=function(a,b){return a.filter(function(c){return c.roles.includes(b)})};Rx=function(a,b,c){for(var d=0;d<c.length;d++)if(c[d].audio===a&&c[d].video===b)return c[d];return null};
|
|
71
|
+
Jx=function(a){var b=$v(a);return a.type===_.kc?"type\x3daudio mimeType\x3d"+a.mimeType+" codecs\x3d"+a.codecs+" codecInfo\x3d"+b+" bandwidth\x3d"+a.bandwidth+" channelsCount\x3d"+a.channelsCount:a.type===_.Qe?"type\x3dvideo mimeType\x3d"+a.mimeType+" codecs\x3d"+a.codecs+" codecInfo\x3d"+b+" bandwidth\x3d"+a.bandwidth+" frameRate\x3d"+a.frameRate+" width\x3d"+a.width+" height\x3d"+a.height:"unexpected stream type"};
|
|
72
|
+
Sx=function(a,b){var c=String(_.wi++);c=new _.ri(c,a);c.mimeType=_.si(b.mimeType);if(a===_.O||a===_.P)c.label=_.si(b.label),c.language=_.si(b.language);a===_.ti?(c.frameRate=b.frameRate,c.roles=b.roles):a===_.P?(c.channelsCount=b.channelsCount,c.roles=b.audioRoles||[],c.mimeType=_.si(b.audioMimeType)):(c.kind=_.si(b.kind),c.roles=b.roles);c.accessibility=a===_.ti||a===_.P?(b.accessibility||[]).filter(function(d){return d.type===a}):b.accessibility||[];return c};
|
|
73
|
+
Tx=function(a,b,c){var d=new _.zi(a===_.ti?""+b.videoId:a===_.P?""+b.audioId:""+b.id,c);switch(a){case _.ti:d.codec=_.si(b.videoCodec);d.bandwidth=b.videoBandwidth||b.bandwidth;d.width=b.width;d.height=b.height;d.originalId=b.originalVideoId;d.drm={keyId:b.keyId||void 0};break;case _.P:d.codec=_.si(b.audioCodec);d.bandwidth=b.audioBandwidth||b.bandwidth;d.originalId=b.originalAudioId;d.drm={keyId:b.keyId||void 0};break;default:d.codec=_.si(b.codecs),d.originalId=b.originalTextId}(a=c.renditions.find(function(e){return _.K.ya(e,
|
|
74
|
+
d,null,["id","track"])}))||c.renditions.push(d);return a||d};Ux=function(a,b){var c=a.reduce(function(d,e){b===_.ti?null===e.videoId||d[e.videoId]&&!e.active||(d[e.videoId]=e):b===_.P&&(null===e.audioId||d[e.audioId]&&!e.active||(d[e.audioId]=e));return d},{});return Object.values(c)};Vx=function(a,b){if(void 0!==b&&null!==b){var c=a.filter(function(d){return d.audio&&d.audio.id===b});if(0<c.length)return c}return a};
|
|
75
|
+
Wx=function(a,b,c){function d(f,g){return null==f?null==g:g.id==f}for(var e=0;e<c.length;e++)if(d(a,c[e].audio)&&d(b,c[e].video))return c[e];return null};Xx=function(){this.h=new _.H("cl.api.mse.TrackManager");this.l=null;this.g=[];this.a=new Map;this.f=new Map};Yx=function(a,b){return a.g.filter(function(c){return c.type===b})};Zx=function(a,b){var c=a.a.get(b)||null;return c&&c.track};ay=function(a,b,c){c&&Zx(a,c.type)===c&&!a.l.ka()||$x(a,b,c&&c.renditions[0])};
|
|
76
|
+
by=function(a,b){a.a.set(b.track.type,b);b===(a.f.get(b.track.type)||null)&&a.f.set(b.track.type,null)};
|
|
77
|
+
$x=function(a,b,c,d){d=void 0===d?!1:d;if(a.l&&((a.a.get(b)||null)!==c||a.l.ka())){var e=a.l;if(c){if(0>a.g.indexOf(c.track))throw Error("Unknown rendition with ID "+c.id);if(b!==c.track.type)throw Error("Types mismatch");a.h.debug("Activate rendition type\n "+b+" with ID: "+c.id);if(b===_.O){var f=e.ia().find(function(n){return n.id==c.id});f&&(a.f.set(b,c),by(a,c),e.trigger(new _.J(_.Uj)),cy(e,!0).then(function(){dy(e,f)})["catch"](function(n){a.h.warn("Error while activating track",n)}))}else if(b===
|
|
78
|
+
_.P)a.f.set(b,c),ey(e,parseInt(c.id,10));else if(b===_.ti){var g=a.a.get(_.P)||null,h=null;if(g){var l=fy(e).filter(function(n){return n.videoId==c.id});h=l.find(function(n){return n.audioId==g.id})||null;if(!h){a.h.debug("Unable to find exact variant. Searching for equivalent");var m=g.track.renditions.map(function(n){return n.id}).filter(function(n){return n!==g.id});h=l.find(function(n){return m.find(function(p){return p==n.audioId})})||null}}else h=fy(e).find(function(n){return n.videoId==c.id})||
|
|
79
|
+
null;h?(a.f.set(b,c),gy(e,h,d)):a.h.warn("Cannot find matching variant")}}else a.h.debug(_.Ca+b),Zx(a,b)&&(b===_.O?cy(e,!1).then(function(){a.a.set(b,null);e.trigger(new _.J(_.Uj))})["catch"](function(n){a.h.warn("Error while de-activating text tracks",n)}):b===_.P?a.h.info("Enabling ABR for audio is not supported"):gy(e,null,d))}};
|
|
80
|
+
jy=function(a){if(a.l){a.h.debug("Track list change detected, updating track list");for(var b=[],c=_.u(Object.values(_.qq)),d=c.next();!d.done;d=c.next())d=d.value,a.a.set(d,null),a.f.set(d,null);c={};d=_.u(a.l.ia());for(var e=d.next();!e.done;c={Xb:c.Xb},e=d.next()){e=e.value;c.Xb=Sx(_.O,e);var f=b.find(function(h){return function(l){return h.Xb.ya(l)}}(c));c.Xb=f||c.Xb;var g=Tx(_.O,e,c.Xb);e.active&&a.a.set(_.O,g);f||b.push(c.Xb)}hy(a.l)||a.a.set(_.O,null);c=fy(a.l);iy(a,b,c,_.ti);iy(a,b,c,_.P);
|
|
81
|
+
a.g=b}};iy=function(a,b,c,d){var e=Ux(c,d);c={};e=_.u(e);for(var f=e.next();!f.done;c={Yb:c.Yb},f=e.next()){f=f.value;c.Yb=Sx(d,f);var g=b.find(function(l){return function(m){return l.Yb.ya(m)}}(c));c.Yb=g||c.Yb;var h=Tx(d,f,c.Yb);f.active&&a.a.set(d,h);g||b.push(c.Yb)}};
|
|
82
|
+
ky=function(a,b,c){if(b){a.g.length||jy(a);for(var d=b.type,e=a.a.get(d)||null,f,g=_.u(Yx(a,d)),h=g.next();!h.done&&!(f=h.value.renditions.find(function(l){return l.id==b.id}));h=g.next());f&&e!==f&&(by(a,f),d===_.P?a.l.trigger(new _.J(_.Tj)):d===_.ti&&a.l.trigger(new _.J(_.Ue,{details:{width:f.width||0,height:f.height||0,bandwidth:f.bandwidth,track:f.track,abrSelection:c}})))}};ly=function(){this.f=new _.zw(2);this.g=new _.zw(5);this.a=0};my=function(a,b){return 128E3>a.a?b:Math.min(_.Bw(a.f),_.Bw(a.g))};
|
|
83
|
+
_.ny=function(){this.h=new _.H("clpp.abr");this.w=null;this.j=!1;this.f=new ly;this.o=[];this.m=1;this.B=this.A=!1;this.a=this.g=null};oy=function(a,b){a&&(b=b.filter(function(c){return Hx(c,a,{width:Infinity,height:Infinity})}));return b.sort(function(c,d){return c.bandwidth-d.bandwidth})};py=function(){this.a=new Map};ry=function(a,b){a.a.has(b)||a.a.set(b,new qy);return a.a.get(b)};qy=function(){this.text=this.variant=null};
|
|
84
|
+
sy=function(a,b){this.f=a;this.a=new Set([a]);b=b||[];for(var c=_.u(b),d=c.next();!d.done;d=c.next())this.add(d.value)};vy=function(a,b){var c;if(!(c=!!a.audio!=!!b.audio||!!a.video!=!!b.video||a.language!=b.language)&&(c=a.audio&&b.audio)){c=a.audio;var d=b.audio;c=!(c.channelsCount==d.channelsCount&&ty(c,d)&&uy(c.roles,d.roles))}!c&&(c=a.video&&b.video)&&(c=a.video,d=b.video,c=!(ty(c,d)&&uy(c.roles,d.roles)));return c?!1:!0};
|
|
85
|
+
ty=function(a,b){if(a.mimeType!=b.mimeType)return!1;var c=a.codecs.split(",").map(function(f){return _.aw(f)[0]}),d=b.codecs.split(",").map(function(f){return _.aw(f)[0]});if(c.length!=d.length)return!1;c.sort();d.sort();for(var e=0;e<c.length;e++)if(c[e]!=d[e])return!1;return!0};uy=function(a,b){var c=new Set(a),d=new Set(b);c["delete"]("main");d["delete"]("main");if(c.size!=d.size)return!1;c=_.u(c);for(var e=c.next();!e.done;e=c.next())if(!d.has(e.value))return!1;return!0};
|
|
86
|
+
xy=function(a){this.a=a;this.f=new wy(a.language,"",a.audio&&a.audio.channelsCount?a.audio.channelsCount:0)};wy=function(a,b,c){this.g=_.Eg(a);this.a=b;this.f=c};yy=function(a,b){var c=null;b.some(function(d){c=_.Pv(_.fh(d),a.map(function(e){return Ov(e)}));return!!c});return c?a.filter(function(d){return c===Ov(d)}):[]};zy=function(a,b){return a.filter(function(c){var d=c.audio;c=c.video;return d&&0<=d.roles.indexOf(b)||c&&0<=c.roles.indexOf(b)})};
|
|
87
|
+
Cy=function(a,b){this.a=Ay;this.f=(new Map).set(Ay,b).set(By,a)};
|
|
88
|
+
Ey=function(a){var b=this;this.C=a;this.a=a.getConfiguration().streaming;this.f=new _.dg;this.h=new _.H("clpp.mse.media.LiveEdgeObserver");Dy(this)&&(a=this.C.getSurface().getMedia(),this.f.on(a,_.Ee,function(){var c=b.C.getPosition(),d=b.C.getSeekRange().end;c=d-c;var e=b.C.getPlaybackRate(),f=b.a.stopChasingAt;1<=e&&c>=b.a.chaseJumpDistance?(b.h.debug("Too far from edge, jump to beginning."),b.C.setPlaybackRate(1),b.C.seek(d)):1===e&&c>=b.a.startChasingAt?(b.h.debug("Not on live edge, increase playback rate."),
|
|
80
89
|
b.C.setPlaybackRate(b.a.chasingRate)):1<e&&c<=f&&(b.h.debug("On live edge, reduce playback rate."),b.C.setPlaybackRate(1))}))};
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
b,a.a=d,a.m=c;d=b-a.j;d>=a.o&&c&&a.f(a.a,d)}}else if((0!=e||a.A)&&a.H&&(f=d.start(e),!(f>=
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
!g.g.paused){var h=
|
|
90
|
-
|
|
91
|
-
b;a.h.debug("Playhead outside safe region \x26 in unbuffered region.");return d};
|
|
92
|
-
|
|
90
|
+
Dy=function(a){return 1>=a.a.chasingRate?(a.h.warn("chasingRate must be greater than 1."),!1):a.a.chaseJumpDistance<=a.a.startChasingAt?(a.h.warn("chaseJumpDistance must be greater than startChasingAt."),!1):a.a.startChasingAt<=a.a.stopChasingAt?(a.h.warn("startChasingAt must be greater than stopChasingAt."),!1):0>a.a.stopChasingAt?(a.h.warn("stopChasingAt must be greater than or equal to 0."),!1):!0};Fy=function(a){this.g=a;this.a=null;this.f=function(){}};Gy=function(a,b){a.f=b};
|
|
91
|
+
Hy=function(a){var b=this;this.a=a;this.j=!1;this.g=this.a.Ge();this.f=new _.$i(function(){b.a.Kj(.25*b.g)})};Iy=function(a){a.f.stop();var b=a.j?0:a.g;0<=b?a.a.Ge()!=b&&a.a.Xg(b):(a.f.cb(.25),0!=a.a.Ge()&&a.a.Xg(0))};Ky=function(a,b){this.g=a;this.m=Jy(a);this.a=a.a.currentTime;this.j=Date.now()/1E3;this.o=b;this.f=function(){}};Ly=function(a,b){a.f=b};My=function(a){this.a=a};
|
|
92
|
+
Jy=function(a){if(a.a.paused||0==a.a.playbackRate||0===a.a.buffered.length)var b=!1;else a:{b=a.a.buffered;a=a.a.currentTime;for(var c=0;c<b.length;c++){var d=b.start(c),e=b.end(c);if(!(a<d-.1||a>e-(c+1===b.length?.5:.1))){b=!0;break a}}b=!1}return b};Oy=function(a,b,c,d,e){var f=this;this.a=a;this.F=b;this.m=c;this.D=e;this.g=new _.dg;this.B=!1;this.I=a.readyState;this.j=!1;this.f=d;this.o=this.H=this.A=!1;this.g.on(a,_.Ye,function(){return Ny(f)});this.w=(new _.$i(function(){Ny(f)})).cb(.25)};
|
|
93
|
+
Ny=function(a){if(0!=a.a.readyState){if(a.a.seeking){if(!a.B)return}else a.B=!1;if(!a.a.paused&&!a.o){a.a.readyState!=a.I&&(a.j=!1,a.I=a.a.readyState);var b=a.m.smallGapLimit,c=a.a.currentTime,d=a.a.buffered;a:{var e=new _.Zj(d);var f=a.m.gapDetectionThreshold;if(e.length&&!(1===e.length&&1E-6>e.end(0)-e.start(0)))for(var g=0;g<e.length;g++)if(e.start(g)>c&&(0===g||e.end(g-1)-c<=f)){e=g;break a}e=null}if(null==e){if(a.f){a=a.f;d=a.g;c=Jy(d);d=d.a.currentTime;b=Date.now()/1E3;if(a.a!=d||a.m!=c)a.j=
|
|
94
|
+
b,a.a=d,a.m=c;d=b-a.j;d>=a.o&&c&&a.f(a.a,d)}}else if((0!=e||a.A)&&a.H&&(f=d.start(e),!(f>=Lw(a.F)))){g=f-c;b=g<=b;var h=!1;if(!(.001>g)){if(!b&&!a.j){a.j=!0;var l=new _.J("largegap",{detail:{currentTime:c,gapSize:g}});l.cancelable=!0;a.D(l);a.m.jumpLargeGaps&&!l.defaultPrevented?h=!0:_.Rf("Ignoring large gap at",c,"size",g)}if(b||h)0==e?_.Rf(av,g,"seconds because of gap before start time of",f):_.Rf(av,g,"seconds because of gap starting at",d.end(e-1),"and ending at",f),a.a.currentTime=f}}}}};
|
|
95
|
+
Sy=function(a,b,c,d){this.a=a;this.j=b;this.o=d;this.A=c;this.m=!1;this.f=new _.dg;this.g=new Py(a);this.w=!1;0<a.readyState?Qy(this,c):Ry(this,c)};Ty=function(a){return a.m?a.a.currentTime:a.A};Vy=function(a,b){0<a.a.readyState?Uy(a.g,b):Ry(a,b)};Ry=function(a,b){a.A=b;a.f.off(a.a,_.wd);a.f.one(a.a,_.wd,function(){Qy(a,b)})};Qy=function(a,b){a.w||(a.w=!0,a.o&&a.o());.001>Math.abs(a.a.currentTime-b)?Wy(a):(a.f.one(a.a,_.le,function(){Wy(a)}),Uy(a.g,0==a.a.currentTime?b:a.a.currentTime))};
|
|
96
|
+
Wy=function(a){_.ej()&&!a.m&&a.j();a.m=!0;a.f.on(a.a,_.le,function(){return a.j()})};Py=function(a){var b=this;this.f=a;this.o=10;this.m=this.g=this.j=0;this.a=new _.$i(function(){0>=b.j?(_.F(["Failed to move playhead from",b.g,"to",b.m].join(" ")),b.a.stop()):b.f.currentTime!=b.g?b.a.stop():(b.f.currentTime=b.m,b.j--)})};Uy=function(a,b){a.g=a.f.currentTime;a.m=b;a.j=a.o;a.f.currentTime=b;a.a.cb(.1)};
|
|
97
|
+
$y=function(a,b,c,d,e,f){var g=this;this.g=a;this.a=b.presentationTimeline;this.B=b.minBufferTime||0;this.m=c;this.A=e;this.w=null;this.j=new Oy(a,b.presentationTimeline,c,Xy(this,a,c),f);this.f=new Sy(a,function(){a:{var h=g.j;h.B=!0;h.A=!1;h.j=!1;h=Ty(g.f);var l=Yy(g,h);if(.001<Math.abs(l-h)){var m=(new Date).getTime()/1E3;if(!g.w||g.w<m-1){g.w=m;Vy(g.f,l);h=void 0;break a}}g.h.debug("Seek to "+h);g.A();h=void 0}return h},Zy(this,d),function(){g.j.H=!0});this.o=(new _.$i(function(){if(0!=g.g.readyState&&
|
|
98
|
+
!g.g.paused){var h=Ty(g.f),l=Mw(g.a,0),m=Lw(g.a);3>m-l&&(l=m-3);h<l&&(l=Yy(g,h),g.h.info("Jumping forward "+(l-h)+" seconds to catch up with the seek range."),g.g.currentTime=l)}})).cb(.25);this.h=new _.H("clpp.mse.Playhead")};bz=function(a){var b=Ty(a.f);return 0<a.g.readyState&&!a.g.paused?az(a,b):b};Zy=function(a,b){null==b?b=Infinity>a.a.getDuration()?Mw(a.a,0):Lw(a.a):0>b&&(b=Lw(a.a)+b);return cz(a,az(a,b))};cz=function(a,b){var c=a.a.getDuration();return b>=c?c-a.m.durationBackoff:b};
|
|
99
|
+
Yy=function(a,b){var c=new _.Zj(a.g.buffered);c=c.fc.bind(c);var d=Math.max(a.B,a.m.rebufferingGoal),e=a.m.safeSeekOffset,f=Mw(a.a,0),g=Lw(a.a),h=a.a.getDuration();3>g-f&&(f=g-3);var l=Mw(a.a,d),m=Mw(a.a,e);d=Mw(a.a,d+e);if(b>=h)return a.h.debug("Playhead past duration."),cz(a,b);if(b>g)return a.h.debug("Playhead past end."),g;if(b<f){if(c(m))return a.h.debug("Playhead before start \x26 start is buffered"),m;a.h.debug("Playhead before start \x26 start is unbuffered");return d}if(b>=l||c(b))return a.h.debug("Playhead in safe region or in buffered region."),
|
|
100
|
+
b;a.h.debug("Playhead outside safe region \x26 in unbuffered region.");return d};az=function(a,b){var c=Mw(a.a,0);if(b<c)return c;c=Lw(a.a);return b>c?c:b};
|
|
101
|
+
Xy=function(a,b,c){if(!c.stallEnabled)return null;var d=c.gapDetectionThreshold,e=c.stallSkip;c=new Ky(new My(b),c.stallThreshold);Ly(c,function(f,g){a.h.warn("Stall detected at "+f+" for "+g+" seconds.");if(e){var h=new _.Zj(b.buffered),l;if(l=_.cj("Edge/")||_.cj("Trident/")||_.ji()||_.ej())a:{if(h.length&&!(1>=h.length))for(l=0;l<h.length-1;l++)if(f>h.start(l)&&f<h.end(l)){l=h.start(l+1)-h.end(l)>=d;break a}l=!1}if(l){a:{if(h.length&&!(1>=h.length))for(l=0;l<h.length-1;l++)if(f>h.start(l)&&f<h.end(l)){h=
|
|
93
102
|
h.start(l+1)-f;break a}h=null}h&&(e=Math.min(h+.1,e))}a.h.warn("Seeking forward "+e+" seconds to break stall.");b.currentTime+=e}else a.h.warn("Pausing and unpausing to break stall."),b.pause(),b.play()});return c};
|
|
94
|
-
|
|
95
|
-
a;if(0===g.length||!e)throw _.
|
|
96
|
-
|
|
97
|
-
b.start);b=_.
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
(
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
rz
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
(a
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
_.
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
a.C.
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
c);c
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
this.configuration.preferredAudioChannelCount);this.Ga=this.configuration.preferredTextLanguage;this.
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
{detail:{bufferedTimeMS:-1,reason:e}})):d===_.
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
a.J.destroy(),9);case 9:a.J=null;case 8:a.
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
isNaN(a.configuration.suggestedPresentationDelay)||(a.log.info("Apply suggested presentation delay of: "+a.configuration.suggestedPresentationDelay),a.f.presentationTimeline.F=a.configuration.suggestedPresentationDelay);a.f.presentationTimeline&&(a.f.presentationTimeline.H=!!a.configuration.lowLatencyMode);if(0==a.f.periods.length)throw new _.L(_.M,4,4014);
|
|
157
|
-
|
|
158
|
-
if(n.length){n=a.getPeriods();for(var q=0;q<n.length;q++)for(var r=n[q],v=_.u(r.variants),y=v.next();!y.done;y=v.next()){y=y.value;var A=[];y.audio&&A.push(y.audio);y.video&&A.push(y.video);A=_.u(A);for(var E=A.next();!E.done;E=A.next()){E=E.value;var
|
|
159
|
-
(E.keyId+"'. Applying restrictions to "+D)));r===l&&
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
r}});a.isLive()&&a.configuration.streaming.enableLiveEdgeChasing&&(a.
|
|
164
|
-
h.next();!l.done;l=h.next())m=l.value,
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
d,"buffered to end",b,"state",a.getState()),
|
|
169
|
-
|
|
170
|
-
a.g.disable())};
|
|
171
|
-
|
|
172
|
-
b.id});f?(a.
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
b).variant=c};
|
|
178
|
-
|
|
179
|
-
encrypted:!1,keyId:null,language:g.closedCaptions.get(l),label:null,type:_.
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
JA=function(a){var
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
_.
|
|
202
|
-
_.
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
_.
|
|
206
|
-
|
|
207
|
-
|
|
103
|
+
ez=function(a){function b(){d=!0}function c(m){f.push(m);_.Pk(m)}a=_.N(a);var d=!1,e,f=[],g=[];(new _.Ok).M(_.Ed,c).M(_.Fe,c).M(_.zd,c).M(_.Dd,c).M(_.te,c).X(_.ve,function(m){e=m;f.push(m);_.Qk(m)}).X("encv",b).X("enca",b).X("avc1",function(m){g.push({M:m,Pc:1701733238})}).X("avc3",function(m){g.push({M:m,Pc:1701733238})}).X("ac-3",function(m){g.push({M:m,Pc:1701733217})}).X("ec-3",function(m){g.push({M:m,Pc:1701733217})}).X("mp4a",function(m){g.push({M:m,Pc:1701733217})}).parse(a);if(d)return _.Rf("Init segment already indicates encryption."),
|
|
104
|
+
a;if(0===g.length||!e)throw _.Tf("Failed to find boxes needed to fake encryption!"),_.Tf("Failed init segment (hex):",_.Oh(a)),new _.L(_.M,3,14E3);g.reverse();for(var h=_.u(g),l=h.next();!l.done;l=h.next())l=l.value,_.Rf('Inserting "'+_.Tk(l.Pc)+'" box into init segment.'),a=dz(a,e,l.M,f,l.Pc);return a};
|
|
105
|
+
dz=function(a,b,c,d,e){var f=fz.value(),g=a.subarray(c.start,c.start+c.size),h=_.sh(g),l=new Uint8Array(c.size+f.byteLength);l.set(g,0);g=_.sh(l);g.setUint32(4,e);l.set(f,c.size);e=h.getUint32(4);g.setUint32(c.size+16,e);gz(l,0,l.byteLength);e=new Uint8Array(a.byteLength+l.byteLength);c=_.cj("Xbox One")||_.bj()?c.start:c.start+c.size;f=a.subarray(c);e.set(a.subarray(0,c));e.set(l,c);e.set(f,c+l.byteLength);a=_.u(d);for(d=a.next();!d.done;d=a.next())d=d.value,gz(e,d.start,d.size+l.byteLength);l=_.sh(e,
|
|
106
|
+
b.start);b=_.Uk(b);a=l.getUint32(b);l.setUint32(b,a+1);return e};gz=function(a,b,c){a=_.sh(a,b);b=a.getUint32(0);0!=b&&(1==b?(a.setUint32(8,c>>32),a.setUint32(12,c&4294967295)):a.setUint32(0,c))};_.hz=function(a,b){this.C=b;this.f=a;this.j=null;this.w=1;this.F=Promise.resolve();this.m=[];this.o=new Map;this.a=new Map;this.I=this.g=this.A=this.B=!1;this.H=0;this.h=new _.H("clpp.mse.Streaming");this.D=!1};
|
|
107
|
+
iz=function(a){var b=a.a.get(_.Qe);return b?a.f.periods[b.Bb]:(b=a.a.get(_.kc))?a.f.periods[b.Bb]:null};kz=function(a){return _.jz(a,_.kc)};lz=function(a){return _.jz(a,_.Qe)};
|
|
108
|
+
qz=function(a,b){var c,d,e,f,g,h,l,m,n,p;return _.B(function(q){switch(q.a){case 1:return c=_.mn,_.x(q,a.C.W.clear(c.TEXT),2);case 2:return a.H++,a.I=!1,d=a.H,e=a.C.W,f=new Map,g=new Set,f.set(c.TEXT,b),g.add(b),_.x(q,e.init(f,!1,a.j.disableAudioTracks),3);case 3:return a.g?q["return"]():_.x(q,mz(a,g),4);case 4:if(a.g)return q["return"]();l=(h=e.getTextDisplayer().isTextVisible())||a.j.alwaysStreamText;a.H!=d||a.a.has(c.TEXT)||a.I||!l||(m=a.C.xb(),n=nz(a,m),p=oz(b,n,0),a.a.set(c.TEXT,p),pz(a,p,0));
|
|
109
|
+
_.z(q)}})};tz=function(a){a.I=!0;var b=a.a.get(_.Be);b&&(rz(b),sz(b)["catch"](function(){}),a.a["delete"](_.Be))};vz=function(a,b,c,d){b.video&&_.uz(a,b.video,c,d);b.audio&&_.uz(a,b.audio,c,d)};
|
|
110
|
+
xz=function(a){function b(l){return a.C.W.fc(l,c,0)}var c=a.C.xb(),d=!1,e=nz(a,c);if(_.ih(a.a.values(),function(l){return l.Bb==e}))for(var f=_.u(a.a.keys()),g=f.next();!g.done;g=f.next()){g=g.value;var h=a.a.get(g);h.stream.segmentIterator=null;b(g)||(wz(a,h),d=!0)}else if(!_.ih(a.a.keys(),b)){a.h.debug("(all): seeked: unbuffered seek: clearing all buffers");d=_.u(a.a.values());for(f=d.next();!f.done;f=d.next())wz(a,f.value);d=!0}d||a.h.debug("(all): seeked: buffered seek: presentationTime\x3d"+
|
|
111
|
+
c)};Az=function(a,b){b=void 0===b?!1:b;if(a.g)a.h.error("Unable to retry after StreamingEngine is destroyed!");else if(a.A)a.h.error("Unable to retry after StreamingEngine encountered a fatal error!");else for(var c=_.u(a.a.values()),d=c.next();!d.done;d=c.next()){d=d.value;var e=yz(d);if(d.Lc||b&&zz(d))a.h.info(e,"Retrying after failure..."),d.Lc=!1,pz(a,d,.1)}};
|
|
112
|
+
Cz=function(a){var b,c,d,e;return _.B(function(f){b=[];c=_.u(a.a.values());for(d=c.next();!d.done;d=c.next())e=d.value,rz(e),e.Za&&e.Eb&&(e.Za=!1,b.push(e.Eb.abort())),e.Hb&&b.push(Bz(a,e,!0,0));return _.x(f,Promise.all(b),0)})};Dz=function(a,b,c){(a=a.a.get(b))&&c&&(rz(a),a.stream=c,a.Rb=c,a.ra&&(a.ra=c.getSegmentReference(a.ra.position)),a.ra||(a.Rb=null))};_.jz=function(a,b){var c=a.a.get(b);return c?c.Ub||c.stream:null};
|
|
113
|
+
_.uz=function(a,b,c,d){var e=a.a.get(b.type);if(!e&&b.type==_.Be&&a.j.ignoreTextStreamFailures)qz(a,b);else if(e){var f=Ez(a,b);if(c&&f!=e.Bb)for(a.h.debug("switch: switching to stream in another Period; clearing buffer and changing Periods"),b=_.u(a.a.values()),c=b.next();!c.done;c=b.next())wz(a,c.value);else{e.Ub&&(a.h.debug("switch during trick play mode",b),b.trickModeVideo?(e.Ub=b,b=b.trickModeVideo,a.h.debug("switch found trick play stream",b)):(e.Ub=null,a.h.debug("switch found no special trick play stream")));
|
|
114
|
+
var g=a.m[f];if(g&&g.Sc&&(g=a.o.get(b.id))&&g.Sc)if(e.stream!=b){g=a.f.presentationTimeline.getDuration();var h=a.C.xb();h=Fz(a,e,h);!c&&(e.endOfStream||h>=g)?a.h.debug(yv+yz(e)+" already buffered to the end. Not switching."):(b.type==_.Be&&mx(a.C.W,_.Xi(b.mimeType,b.codecs)),e.stream=b,e.stream.segmentIterator=null,e.rd=!0,a.h.debug("switch: switching to Stream "+yz(e)),Gz(a,e,f)&&(a.h.info("Aborting current segment request to switch."),e.Eb.abort()),c&&(e.Zb?e.ce=!0:e.Za?(e.Hb=!0,e.Hd=d,e.ce=!0):
|
|
115
|
+
(rz(e),Bz(a,e,!0,d)["catch"](function(l){if(a.C)a.C.onError(l)}))))}else a.h.debug(yv+yz(e)+" already active")}}};Gz=function(a,b,c){if(!b.Eb)return!1;var d=a.C.xb(),e=a.C.W.Ba(b.type);c=(c=Hz(a,b,d,e,c))?c.ea?c.ea-c.sa+1:null:null;if(null==c)return!1;var f=b.stream.initSegmentReference;f&&(c+=(f.ea?f.ea-f.sa+1:null)||0);f=a.C.Ce().getBandwidthEstimate();if(8*c/f<(null===e?0:e-d)-Math.max(a.f.minBufferTime||0,a.j.rebufferingGoal))return!0;a=b.Eb;a=a.j?a.j.bytesRemaining:-1;return 0>a||a>c?!0:!1};
|
|
116
|
+
wz=function(a,b){var c=yz(b);b.Zb?a.h.debug(c,"clear: already clearing the buffer"):b.Hb?a.h.debug(c,"clear: already waiting"):b.Za?(a.h.debug(c,"clear: currently updating"),b.Hb=!0,b.Hd=0):null==a.C.W.sb(b.type)?(a.h.debug(c,"clear: nothing buffered"),null==b.rb&&pz(a,b,0)):(a.h.debug(c,"clear: handling right now"),rz(b),Bz(a,b,!1,0)["catch"](function(d){if(a.C)a.C.onError(d)}))};
|
|
117
|
+
Jz=function(a,b,c,d,e){var f,g,h,l,m,n,p;return _.B(function(q){if(1==q.a)return f=a.C.xb(),g=nz(a,f),h=_.mn,l=new Map,m=new Set,b&&(l.set(h.AUDIO,b),m.add(b)),c&&(l.set(h.VIDEO,c),m.add(c)),d&&(l.set(h.TEXT,d),m.add(d)),n=a.C.W,p=a.j.forceNativeTS,_.x(q,n.init(l,p,a.j.disableAudioTracks),2);if(3!=q.a){if(a.g)return q["return"]();Iz(a);return _.x(q,mz(a,m),3)}if(a.g)return q["return"]();l.forEach(function(r,v){if(!a.a.has(v)){var y=oz(r,g,e);a.a.set(v,y);pz(a,y,0)}});_.z(q)})};
|
|
118
|
+
oz=function(a,b,c){return{stream:a,type:a.type,Rb:null,segmentIterator:null,ra:null,Ub:null,rd:!0,Bb:b,endOfStream:!1,Za:!1,rb:null,Hb:!1,Hd:0,ce:!1,Zb:!1,gf:!1,Lc:!1,Vg:c||0,Eb:null,Ld:!1,pg:0}};
|
|
119
|
+
Kz=function(a,b){var c=a.m[b];if(c)return a.h.debug("(all) Period "+b+Tu),c.P;a.h.debug("(all) setting up Period "+b);c={P:new _.ci,Sc:!1};a.m[b]=c;for(var d=new Set,e=_.u(a.f.periods[b].variants),f=e.next();!f.done;f=e.next())f=f.value,f.video&&d.add(f.video),f.video&&f.video.trickModeVideo&&d.add(f.video.trickModeVideo),f.audio&&d.add(f.audio);e=_.u(a.f.periods[b].textStreams);for(f=e.next();!f.done;f=e.next())d.add(f.value);a.F=a.F.then(function(){return a.g?null:mz(a,d)}).then(function(){a.g||
|
|
120
|
+
(a.m[b].P.resolve(),a.m[b].Sc=!0,a.h.debug("(all) setup Period "+b))})["catch"](function(g){a.g||(a.m[b].P["catch"](function(){}),a.m[b].P.reject(),delete a.m[b],a.h.warn("(all) failed to setup Period "+b),a.C.onError(g))});return c.P};
|
|
121
|
+
mz=function(a,b){var c,d,e,f,g,h,l,m,n,p,q;return _.B(function(r){switch(r.a){case 1:c=[];d=_.u(b);for(e=d.next();!e.done;e=d.next())f=e.value,(g=a.o.get(f.id))?(a.h.debug("(all) Stream "+f.id+Tu),c.push(g.P)):(a.h.debug("(all) setting up Stream "+f.id),a.o.set(f.id,{P:new _.ci,Sc:!1}),c.push(f.createSegmentIndex()));_.zf(r,2);return _.x(r,Promise.all(c),4);case 4:if(a.g)return r["return"]();_.Af(r,3);break;case 2:h=_.Bf(r);if(a.g)return r["return"]();l=_.u(b);for(e=l.next();!e.done;e=l.next())m=
|
|
122
|
+
e.value,a.o.get(m.id).P["catch"](function(){}),a.o.get(m.id).P.reject(),a.o["delete"](m.id);throw h;case 3:n=_.u(b);for(e=n.next();!e.done;e=n.next())p=e.value,q=a.o.get(p.id),q.Sc||(q.P.resolve(),q.Sc=!0,a.h.debug("(all) setup Stream "+p.id));_.z(r)}})};Iz=function(a){var b=a.f.presentationTimeline.getDuration();Infinity>b?yx(a.C.W,b):yx(a.C.W,Math.pow(2,32))};
|
|
123
|
+
Nz=function(a,b){function c(p){return p.type==_.Be&&p.stream.mimeType==_.cc}if(c(b))return tx(a.C.W,b.stream.originalId||""),null;b.type==_.Be&&ux(a.C.W);if(!a.C.W.L&&b.type!=_.Be)return a.j.bufferLimitUpdateInterval?a.j.bufferLimitUpdateInterval/2:.5;var d=yz(b),e=a.C.xb(),f=Fz(a,b,e);a.h.debug(d,"timeNeeded\x3d"+f);var g=Ez(a,b.stream),h=nz(a,f),l=a.C.W.Ha(b.type,e);a.h.debug(d,"update_:",sv+e,"bufferedAhead\x3d"+l);var m=Math.max(a.f.minBufferTime||0,a.j.rebufferingGoal,a.j.bufferingGoal)*a.w,
|
|
124
|
+
n=Fw(a.f.presentationTimeline);if(null!=n&&f>=n&&!b.Ld)return Lz(a,b),null;b.endOfStream=!1;b.Bb=h;if(h!=g)return a.h.debug(d,"need Period "+h,sv+e,"timeNeeded\x3d"+f,"currentPeriodIndex\x3d"+g),null;if(l>=m)return a.h.debug(d,"buffering goal met"),a.j.bufferLimitUpdateInterval||.5;h=a.C.W.Ba(b.type);h=Hz(a,b,e,h,g);if(!h)return a.f.presentationTimeline.isLive()||b.type===_.Be?a.j.bufferLimitUpdateInterval||1:(a.h.debug("Media state "+d+": no next segment found. Assuming EOS."),Lz(a,b),null);d=Infinity;
|
|
125
|
+
l=_.u(a.a.values());for(m=l.next();!m.done;m=l.next())m=m.value,c(m)||(m=Fz(a,m,e),d=Math.min(d,m));if(f>=d+a.f.presentationTimeline.a)return a.j.bufferLimitUpdateInterval||1;b.Vg=0;Mz(a,b,e,g,h)["catch"](function(){});return null};Lz=function(a,b){a.h.debug(yz(b),"buffered to end of presentation");b.endOfStream=!0;if(b.type==_.Qe){var c=a.a.get(_.Be);c&&c.stream.mimeType==_.cc&&(c.endOfStream=!0)}};
|
|
126
|
+
Fz=function(a,b,c){if(!b.Rb||!b.ra)return Math.max(c,b.Vg);c=Ez(a,b.Rb);return a.f.periods[c].startTime+b.ra.endTime};
|
|
127
|
+
Hz=function(a,b,c,d,e){if(b.stream.segmentLookupStrategy===Oz)b.stream.segmentIterator?a=Qw(b.stream.segmentIterator):b.ra||d?(e=b.ra?b.ra.endTime:d,a.h.info($u,"looking up segment from new stream endTime:",e),b.stream.segmentIterator=Uw(b.stream.segmentIndex,e),d=b.stream.segmentIterator.next().value,null===d&&(b.stream.segmentIterator=null,a.h.warn($u,lv,"endTime:",e,b.ra)),a=d):(e=Math.max(c,0),a.h.info($u,"looking up segment","lookupTime:",e,rv,c),d=null,d||(b.stream.segmentIterator=Uw(b.stream.segmentIndex,
|
|
128
|
+
c),d=b.stream.segmentIterator.next().value),null===d&&a.h.warn($u,lv,"lookupTime:",e,rv,c),a=d);else{var f=yz(b);b.ra&&b.stream==b.Rb?(d=b.ra.position+1,a.h.debug(f,"next position known:","position\x3d"+d),a=Pz(a,b,e,d)):(b.ra?(a.h.debug(f,"next position unknown: another Stream buffered"),c=Ez(a,b.Rb),c=Qz(a,b,a.f.periods[c].startTime+b.ra.endTime,e)):(a.h.debug(f,"next position unknown: nothing buffered"),c=Qz(a,b,d||c,e)),null==c?a=null:(f=null,null!=d||null!==a.j&&a.j.ignoreDrift||(f=Pz(a,b,e,
|
|
129
|
+
Math.max(0,c-1))),a=f||Pz(a,b,e,c)))}return a};Qz=function(a,b,c,d){var e=yz(b);d=a.f.periods[d];var f=Math.max(0,c-d.startTime);b=b.stream.findSegmentPosition(f);a.h.debug(e,"Looked up segment:",sv+c,"lookupTime\x3d"+f,nv+d.startTime,"Result: segment position\x3d"+b);null==b&&a.h.warn(e,"cannot find segment:",nv+d.startTime,"lookupTime\x3d"+f);return b};
|
|
130
|
+
Pz=function(a,b,c,d){var e=yz(b);c=a.f.periods[c];var f=b.stream.getSegmentReference(d);if(!f)return a.h.debug(e,"segment does not exist:",nv+c.startTime,"position\x3d"+d),null;var g=a.f.presentationTimeline;d=_.Kw(g);g=Jw(g);return!b.Ld&&(c.startTime+f.endTime<d||c.startTime+f.startTime>g)?(a.h.debug(e,"segment is not available:",nv+c.startTime,wv+f.startTime,uv+f.endTime,"availabilityStart\x3d"+d,"availabilityEnd\x3d"+g),null):f};
|
|
131
|
+
Mz=function(a,b,c,d,e){var f,g,h,l,m,n,p,q,r,v,y,A,E;return _.B(function(G){f=_.mn;g=yz(b);h=a.f.periods[d];a.h.debug(g,"fetchAndAppend_:",sv+c,nv+h.startTime,vv+e.position,wv+e.startTime,uv+e.endTime);l=b.stream;m=b.stream.segmentIterator;n=a.f.presentationTimeline.getDuration();p=a.f.periods[d+1];q=Math.max(0,h.startTime-.1);r=p?p.startTime+.01:n;v=Rz(a,b,d,q,r,e);b.Za=!0;b.rd=!1;a.h.debug(g,"fetching segment");y=!1;A=function(D,I){if(a.g||a.A)return null;y=!0;return Sz(a,b,c,h,l,e,D,I)};E=a.C.W.Ba(b.type)||
|
|
132
|
+
0;v.then(function(){return a.g||a.A?null:Tz(a,b,e,!1,function(D){return A(D.data,!0)})}).then(function(D){return a.g||a.A?null:y||null===D?(Uz(a,b,E,e,l),null):A(D,!1)}).then(function(){if(!a.g&&!a.A){Uz(a,b,E,e,l);b.Za=!1;b.gf=!1;b.Hb||a.C.Zd();if(m){var D=m.next().value;D&&a.h.debug("New iterated segment",D)}pz(a,b,0);Vz(a,b,l);a.h.debug(g,"finished fetch and append")}})["catch"](function(D){return _.B(function(I){if(a.g||a.A)return I["return"]();b.Za=!1;if(b.type==f.TEXT&&a.j.ignoreTextStreamFailures)return 1001==
|
|
133
|
+
D.code?a.h.warn(g,"Text stream failed to download. Proceeding without it."):a.h.warn(g,"Text stream failed to parse. Proceeding without it."),a.a["delete"](f.TEXT),I.G(0);if(7001==D.code)return b.Za=!1,b.rb=null,pz(a,b,0),I.G(0);if(3017===D.code)return Wz(a,b,D),I.G(0);if(1001===D.code&&D.data&&404===D.data[1])return a.h.warn(g,"request for segment failed","segment not available on server",vv+e.position,wv+e.startTime,uv+e.endTime,"error\x3d"+D),b.Za=!1,b.rb=null,pz(a,b,1),I.G(0);if(b.type===f.TEXT)return D instanceof
|
|
134
|
+
_.L&&D.a(1),rz(b),a.C.onError(new _.L(1,2,2010,D)),I.G(0);if(1001<=D.code&&1003>=D.code)return _.x(I,Xz(a,b,h,D),0);a.h.error(g,"failed fetch and append: code\x3d"+D.code);b.Lc=!0;D instanceof _.L&&D.a(_.M);return _.x(I,Yz(a,D),0)})});_.z(G)})};
|
|
135
|
+
Wz=function(a,b,c){var d=yz(b);if(Array.from(a.a.values()).some(function(f){return f!=b&&f.gf}))a.h.debug(d,bv,"waiting for another stream to recover...");else{var e=Math.round(100*a.w);if(20<e)a.w-=.2;else if(4<e)a.w-=.04;else{a.h.error(d,"MediaSource threw QuotaExceededError too many times");b.Lc=!0;a.A=!0;a.C.onError(c);return}a.h.warn(d,bv,"reducing buffering goals by "+(100-Math.round(100*a.w))+"%");b.gf=!0}pz(a,b,4)};
|
|
136
|
+
Xz=function(a,b,c,d){var e,f;return _.B(function(g){e=1001===d.code&&500<=d.data.status;f=!0;e||(f=!a.C.pe(b.stream,c));if(!f)return g.G(0);b.Lc=!0;d.a(_.M);return _.x(g,Yz(a,d),0)})};
|
|
137
|
+
Rz=function(a,b,c,d,e,f){c=a.f.periods[c].startTime-f.Na;if(!b.rd&&c===b.pg)return Promise.resolve();b.pg=c;var g=yz(b);a.h.debug(g,"setting timestamp offset to "+c);a.h.debug(g,"setting append window start to "+d);a.h.debug(g,"setting append window end to "+e);d=wx(a.C.W,b.type,c,d,e);if(!b.stream.initSegmentReference||!b.rd)return d;a.h.debug(g,"fetching init segment");e=Tz(a,b,b.stream.initSegmentReference,!0).then(function(h){if(a.g)return null;a.h.debug(g,"appending init segment");return Zz(a,
|
|
138
|
+
h,b).then(function(){return sx(a.C.W,b.type,h,null,null,!!b.stream.closedCaptions&&0<b.stream.closedCaptions.size)})})["catch"](function(h){b.rd=!0;return Promise.reject(h)});return Promise.all([d,e])};Zz=function(a,b,c){var d;return _.B(function(e){if(!a.j.patchEdgeWhenMixedContent||!_.bj())return e.G(0);d=ez(b);return _.x(e,sx(a.C.W,c.type,d.buffer,null,null,!!c.stream.closedCaptions&&0<c.stream.closedCaptions.size),0)})};
|
|
139
|
+
Sz=function(a,b,c,d,e,f,g,h){h=void 0===h?!1:h;var l,m,n,p,q,r,v,y,A;return _.B(function(E){switch(E.a){case 1:l=yz(b);if(!(e&&e.keyId&&a.C.jd)){E.G(2);break}m=Dv(a.C.jd,e.keyId);if(!m){a.h.warn("Unable to find DRM session for "+e.keyId);E.G(2);break}_.zf(E,4);return _.x(E,m,6);case 6:_.Af(E,2);break;case 4:n=_.Bf(E),a.h.warn("DRM session load failed!",n);case 2:if(!(e.encrypted&&e.keyId&&a.C.jd&&Fv(a.C.jd,e.keyId))){E.G(7);break}rz(b);p=Ez(a,e);q=$z(a,p);if(!q){E.G(8);break}return _.x(E,q,8);case 8:return r=
|
|
140
|
+
a.C.pe(e,d,pv),v=f.startTime+d.startTime,y=f.endTime+d.startTime,a.h.warn(l,"Blocked append for "+v+" - "+y+": "+r+". Stream with Key ID "+(e.keyId+" has restrictions.")),E["return"](Promise.resolve());case 7:return A=e.closedCaptions&&0<e.closedCaptions.size,null!=e.emsgSchemeIdUris&&0<e.emsgSchemeIdUris.length&&(new _.Ok).X("emsg",a.Dk.bind(a,d,f,e.emsgSchemeIdUris)).parse(g),E["return"](aA(a,b,c).then(function(){if(a.g)return null;var G=f.startTime+d.startTime,D=f.endTime+d.startTime;a.h.debug(l,
|
|
141
|
+
"Appending segment with "+(G.toFixed(3)+" - "+D.toFixed(3)+" KeyID: ")+(e.keyId+" Width: ")+(e.width+" Height: "+e.height+" Bitrate: ")+(_.Gh(e.bandwidth)+" Fragment: ")+h);return sx(a.C.W,b.type,g,G,D,A,e.id,h)}).then(function(){a.g||(a.h.debug(l,"appended media segment"),b.Rb=e,b.ra=f)}))}})};
|
|
142
|
+
Uz=function(a,b,c,d,e){if(!a.f.presentationTimeline.isLive()&&b.type!==_.Be){var f=yz(b),g=(a.C.W.Ba(b.type)||0)-c,h=d.endTime-d.startTime;c=g-h;if(Math.abs(c)>=Math.min(.01,h)&&Math.abs(c)<=Math.min(1,h))for(a.h.debug(f,"Adjusted segment",d.position,"with real duration",g,"and accounted for",c,"delta between segment duration and real duration"),b.Ld=!0,a=a.f.periods,e.adjustSegmentDurations(d.position,c),d=ww(a,e),b=a[d],e=e.getDuration(),yw(b,e),e=d+1;e<a.length;e++)a[e].startTime+=c}};
|
|
143
|
+
bA=function(a,b,c){(new _.Ok).M(_.Ed,_.Pk).M(_.Fe,_.Pk).M(_.zd,_.Pk).M(_.Dd,_.Pk).M(_.te,_.Pk).X(_.ve,_.Qk).M("encv",function(d){d.reader.skip(78);_.Pk(d)}).M(_.ne,_.Pk).M("schi",_.Pk).M("tenc",function(d){d.reader.skip(6);if(_.Ik(d.reader)){d.reader.skip(1);var e=_.Oh(_.Nk(d.reader,16));e!==b.stream.keyId&&(a.h.debug(yz(b),"Key id from tenc mismatches with key id from manifest. Switching from "+(b.stream.keyId+" to "+e+".")),b.stream.keyId=e)}d.parser.stop()}).parse(c)};
|
|
144
|
+
aA=function(a,b,c){if(a.g)return Promise.resolve();var d=yz(b);a.h.debug(d,"checking buffer length");var e=Math.max(a.j.bufferBehind,a.f.presentationTimeline.a),f=a.C.W.sb(b.type);if(null==f)return a.h.debug(d,"buffer behind okay because nothing buffered:",sv+c,iv+e),Promise.resolve();var g=c-f,h=g-e;if(.01>=h)return a.h.debug(d,"buffer behind okay:",sv+c,jv+g,iv+e,"underflow\x3d"+Math.abs(h)),Promise.resolve();a.h.debug(d,"buffer behind too large:",sv+c,jv+g,iv+e,"overflow\x3d"+h);return a.C.W.remove(b.type,
|
|
145
|
+
f,f+h).then(function(){a.g||a.h.debug(d,"evicted "+h+" seconds")})};Vz=function(a,b,c){if(!a.B){b=yz(b);var d=Array.from(a.a.values());1!=d.length||d[0].type!=_.Be?a.B=d.every(function(e){return e.type==_.Be||a.D?!0:!e.Hb&&!e.Zb&&e.ra}):a.D&&(a.B=!0);a.B&&(a.h.debug(b,"startup complete"),c=Ez(a,c),$z(a,c))}};
|
|
146
|
+
$z=function(a,b){var c=null;a.m[b]||(c=Kz(a,b).then(function(){a.g||(a.h.debug(kv),a.C.We())})["catch"](Iv));for(var d=0;d<a.f.periods.length;++d)Kz(a,d)["catch"](Iv);a.C.zk&&(a.h.debug("calling onStartupComplete()..."),a.C.zk());return c};
|
|
147
|
+
cA=function(a,b){var c=yz(b),d=Ez(a,b.stream);if(b.Bb!=d){var e=b.Bb,f=Array.from(a.a.values());f.every(function(g){return g.Bb==e})?f.every(zz)?(a.h.debug(c,"all need Period "+e),Kz(a,e).then(function(){if(!a.g)if(f.every(function(n){var p=zz(n),q=Ez(a,n.stream);return p&&n.Bb==e&&q!=e})){var g=a.f.periods[e];a.h.debug(c,"calling onChooseStreams()...");var h=a.C.Xe(g);a.D=!h.variant&&!!h.text;var l=new Map;h.variant&&h.variant.video&&l.set(_.Qe,h.variant.video);h.variant&&h.variant.audio&&l.set(_.kc,
|
|
148
|
+
h.variant.audio);h.text&&l.set(_.Be,h.text);var m=_.u(a.a.keys());for(h=m.next();!h.done;h=m.next())if(h=h.value,!l.has(h)&&h!=_.Be){a.h.error(c,"invalid Streams chosen: missing "+h+" Stream");a.C.onError(new _.L(_.M,5,5005));return}m=_.u(Array.from(l.keys()));for(h=m.next();!h.done;h=m.next())if(h=h.value,!a.a.has(h))if(h==_.Be)Jz(a,null,null,l.get(_.Be),g.startTime),l["delete"](h);else{a.h.error(c,"invalid Streams chosen: unusable "+h+" Stream");a.C.onError(new _.L(_.M,5,5005));return}g=_.u(Array.from(a.a.keys()));
|
|
149
|
+
for(h=g.next();!h.done;h=g.next())h=h.value,(m=l.get(h))?(_.uz(a,m,!1,0),pz(a,a.a.get(h),0)):a.a["delete"](h);a.h.debug(c,kv);a.C.We()}else a.h.debug(c,"ignoring transition to Period",e,"since another is happening")})["catch"](Iv)):a.h.debug(c,"all MediaStates need Period "+e+", but not all MediaStates are idle"):a.h.debug(c,"not all MediaStates need Period "+e)}};nz=function(a,b){var c=uw(a.f.periods,b+_.oq);return c?a.f.periods.indexOf(c):0};Ez=function(a,b){return ww(a.f.periods,b)};
|
|
150
|
+
Tz=function(a,b,c,d,e){d=void 0===d?!1:d;e=void 0===e?null:e;var f=_.Cw(c.Ka(),c.sa,c.ea,a.j.attemptParameters,c.startTime,c.endTime,b.type,c.timescale);f.type=2;f.onFragment=c.Fc?null:e;f.disableFragmentSupport=c.Fc||a.j.disableFragmentSupport;f.disableMergedFragments=a.j.disableMergedFragments;if(e=c.f())f.keyInfo=e,f.onFragment=null;d&&(f.responseModifiers.push(function(g){bA(a,b,g.data)}),b.type===_.Qe&&a.j.overridePasp&&f.responseModifiers.push(a.ll.bind(a)));a.h.debug("fetching: reference\x3d",
|
|
151
|
+
c);c=a.C.Cb.fetch(f);b.Eb=c;return c.P.then(function(g){var h=a.C.Ce(),l=g.timeMs,m=g.data.byteLength;l&&m&&!d&&h.segmentDownloaded(l,m);b.Eb=null;return g.data})};
|
|
152
|
+
Bz=function(a,b,c,d){var e,f,g,h;return _.B(function(l){if(1==l.a)return e=yz(b),b.Hb=!1,b.ce=!1,b.Hd=0,b.Zb=!0,b.stream.segmentIterator=null,a.h.debug(e,"clearing buffer"),d?(g=a.C.xb(),h=a.C.W.getDuration(),f=a.C.W.remove(b.type,g+d,h)):f=a.C.W.clear(b.type).then(function(){return!a.g&&c?a.C.W.flush(b.type):null}),_.x(l,f,2);if(a.g)return l["return"]();a.h.debug(e,"cleared buffer");b.Rb=null;b.ra=null;b.Zb=!1;b.endOfStream=!1;b.Ld=!1;pz(a,b,0);_.z(l)})};
|
|
153
|
+
pz=function(a,b,c){a.h.debug(yz(b),"updating in "+c+" seconds");b.rb=(new _.Yi(function(){var d;return _.B(function(e){if(1==e.a)return _.zf(e,2),_.x(e,a.Db(b),4);if(2!=e.a)return _.Af(e,0);d=_.Bf(e);if(a.C)a.C.onError(d);_.z(e)})})).$(c)};rz=function(a){null!=a.rb&&(a.rb.stop(),a.rb=null)};sz=function(a){return _.B(function(b){return a.Eb?_.x(b,a.Eb.abort(),0):b.G(0)})};
|
|
154
|
+
Yz=function(a,b){var c;return _.B(function(d){switch(d.a){case 1:if(a.g)return d["return"]();if(!a.C.Zg){d.G(2);break}_.zf(d,3);return _.x(d,a.C.Zg(b),5);case 5:_.Af(d,2);break;case 3:c=_.Bf(d),c.cause=b,b=c;case 2:if(!b.f)a.C.onError(b);_.z(d)}})};yz=function(a){return"("+a.type+":"+a.stream.id+")"};zz=function(a){return!a.Za&&null==a.rb&&!a.Hb&&!a.Zb};
|
|
155
|
+
fA=function(a){_.kk.call(this,mv);var b=this;this.F=dA;this.j=this.Sb=this.da=null;this.Re=0;this.ug=2;this.fd=null;this.Pe=!1;this.o=new _.dg;this.Va=this.Pd=this.zc=this.qc=this.A=this.J=this.m=null;this.Zc=!1;this.g=this.f=this.B=this.a=this.wc=this.H=null;this.Wg=1E9;this.Ud=new Set;this.V=!0;this.ma=null;this.Pg=!1;this.Ig=0;this.ga=null;this.O=new py;this.Qg={width:Infinity,height:Infinity};this.I=null;this.ha=_.Nm;this.xc=new wy(this.configuration.preferredAudioLanguage||[],this.configuration.preferredAudioRole,
|
|
156
|
+
this.configuration.preferredAudioChannelCount);this.Ga=this.configuration.preferredTextLanguage;this.S=this.yc=null;this.Ac=new Map;this.na=null;this.vc=this.configuration.preferredTextRole;a&&a(this);this.Qe=null;this.o.on(window,"online",function(){b.F===eA&&Az(b.a)})};
|
|
157
|
+
gA=function(a){return new _.pw(function(b){if(void 0===b||null===b)return null;var c=a.getTrackManager(),d=[];if(c){c=_.u(c.getVideoTracks());for(var e=c.next();!e.done;e=c.next())d.push.apply(d,_.mf(e.value.renditions))}return d.find(function(f){return f.id==b})||null})};
|
|
158
|
+
hA=function(a,b){if(a.ha!==b)if(a.ha===_.Ym&&b!==_.Nm)a.log.info(_.dv+Qv(b,_.Wm));else{var c=a.Re;c=0===c?0:Date.now()-c;var d=a.ha;a.ha=b;a.Re=Date.now();a.I&&_.ym(a.I.a,a.ha);b===_.Sm&&(a.ug=a.Oe?1:2);var e=a.ug,f={currentState:a.ha,previousState:d,timeSinceLastStateChangeMS:c,reason:b===_.Sm||d===_.Sm?e:void 0};a.log.info(_.fb+Qv(d,_.Wm)+" -\x3e "+(Qv(b,_.Wm)+(b!==_.Sm?"":"["+Qv(e,_.Vm)+"]")));a.trigger(new _.J(_.qe,{detail:f}));(b===_.Um||b===_.Ym)&&a.Va&&a.Va.stop();b===_.Sm?a.trigger(new _.J(_.wc,
|
|
159
|
+
{detail:{bufferedTimeMS:-1,reason:e}})):d===_.Sm&&a.trigger(new _.J(_.vc,{detail:{bufferedTimeMS:c,reason:e}}))}};nA=function(a){var b=!1;b=void 0===b?!0:b;var c,d;return _.B(function(e){switch(e.a){case 1:return a.F===iA?e["return"](Promise.reject(new _.L(_.M,7,7E3))):_.x(e,jA(a),2);case 2:return _.x(e,kA(a),3);case 3:c=_.ji(4)||_.ji(5);if(!b&&!c){e.G(0);break}d=a.getSurface().getMedia();return _.x(e,lA(a,d),5);case 5:return _.x(e,mA(a,d),0)}})};
|
|
160
|
+
lA=function(a,b){a.j||(a.o.on(b,_.id,function(){if(a.j.error){var c=a.j.error.code;if(1==c)c=null;else{var d=a.j.error.msExtendedCode;d&&(0>d&&(d+=Math.pow(2,32)),d=d.toString(16));c=new _.L(_.M,3,3016,{code:c,extendedError:d,message:a.j.error.message})}}else c=null;if(c)a.onError(c)}),a.j=b);return Promise.resolve()};kA=function(a){a.j&&(a.o.off(a.j,_.id),a.j=null);return Promise.resolve()};
|
|
161
|
+
jA=function(a){var b;return _.B(function(c){switch(c.a){case 1:a.F!==iA&&(a.F=dA);if(b=a.j)a.o.off(b,_.vd),a.o.off(b,_.Zd),a.o.off(b,_.Ud),a.o.off(b,_.hd),a.o.off(b,_.de),a.o.off(b,_.be);a.qc&&(a.qc.release(),a.qc=null);a.Va&&(a.Va.stop(),a.Va=null);if(!a.B){c.G(2);break}return _.x(c,a.B.stop(),3);case 3:a.B=null;case 2:if(!a.g){c.G(4);break}return _.x(c,a.g.stop(),4);case 4:if(!a.a){c.G(6);break}return _.x(c,a.a.destroy(),7);case 7:a.a=null;case 6:a.A&&(a.A.release(),a.A=null);if(!a.J){c.G(8);break}return _.x(c,
|
|
162
|
+
a.J.destroy(),9);case 9:a.J=null;case 8:a.Pd&&(a.Pd.release(),a.Pd=null);b&&b.src&&(b.removeAttribute("src"),b.load());if(!a.m){c.G(10);break}return _.x(c,a.m.destroy(),11);case 11:a.m=null;case 10:a.O.clear(),a.H=null,a.Ud.clear(),a.f=null,a.I=null,a.V=!0,a.Ac.clear(),a.Zc=!1,oA(a),_.z(c)}})};
|
|
163
|
+
mA=function(a,b){var c,d,e;return _.B(function(f){if(1==f.a)return c=window.muxjs?new fx:new _.gx,d=_.wm(a.configuration,["html","single-native"]),a.K=d.create(a),a.fd=gA(a),a.fd.track(a),e=new _.ix(b,c,a.K,a.fd,a.configuration),_.x(f,e.I,2);a.J=e;_.z(f)})};pA=function(a,b){var c,d;return _.B(function(e){if(1==e.a)return c=a.getNetworkEngine(),d=a,_.x(e,_.tp(b.url,c,a.configuration.manifest.attemptParameters,b.type||null),2);d.B=e.f;a.B.configure(a.configuration.manifest);_.z(e)})};
|
|
164
|
+
tA=function(a,b){var c;return _.B(function(d){a.wc=new Nw;Ow(a.wc,function(e){qA(a,_.og,e)});c=new _.di(Promise.resolve().then(function(){var e,f,g;return _.B(function(h){switch(h.a){case 1:if(a.f){h.G(3);break}_.zf(h,4);e=a;return _.x(h,a.B.start(b.url,rA(a)),6);case 6:e.f=h.f;_.Af(h,1);break;case 4:f=_.Bf(h);if(!a.uc)throw f;return _.x(h,a.uc(b.url,f),8);case 8:if(g=h.f)b.url=g;else throw f;h.G(1);break;case 3:!a.f.presentationTimeline||a.configuration.manifest.hlsLowLatency||_.K.R(a.configuration.suggestedPresentationDelay)||
|
|
165
|
+
isNaN(a.configuration.suggestedPresentationDelay)||(a.log.info("Apply suggested presentation delay of: "+a.configuration.suggestedPresentationDelay),a.f.presentationTimeline.F=a.configuration.suggestedPresentationDelay);a.f.presentationTimeline&&(a.f.presentationTimeline.H=!!a.configuration.lowLatencyMode);if(0==a.f.periods.length)throw new _.L(_.M,4,4014);sA(a.f.periods);_.z(h)}})}),function(){a.log.info("Aborting parser step...");return a.B.stop()});return _.x(d,c.P,0)})};
|
|
166
|
+
AA=function(a){var b,c,d,e,f;return _.B(function(g){switch(g.a){case 1:a.m=new _.Jl({Cb:a.getNetworkEngine(),onError:function(h){return a.onError(h)},Ze:function(h){if(a.a){var l=uA(a),m=!1,n=Object.keys(h);0===n.length&&a.log.warn("Got a key status event without any key statuses, so we don't know the real key statuses. If we don't have all the keys, you'll need to set restrictions so we don't select those tracks.");var p=1===n.length&&"00"===n[0];p&&a.log.warn("Got a synthetic key status event, so we don't know the real key statuses. If we don't have all the keys, you'll need to set restrictions so we don't select those tracks.");
|
|
167
|
+
if(n.length){n=a.getPeriods();for(var q=0;q<n.length;q++)for(var r=n[q],v=_.u(r.variants),y=v.next();!y.done;y=v.next()){y=y.value;var A=[];y.audio&&A.push(y.audio);y.video&&A.push(y.video);A=_.u(A);for(var E=A.next();!E.done;E=A.next()){E=E.value;var G=y.allowedByKeySystem;if(E.keyId){var D=h[p?"00":E.keyId];D=!!D&&!vA.includes(D);y.allowedByKeySystem=D}G!==y.allowedByKeySystem&&(D=E.type,E.type===_.Qe&&(D="video "+E.width+"x"+E.height+"@"+_.Gh(E.bandwidth)),a.log.warn("DRM Key not available for KID: '"+
|
|
168
|
+
(E.keyId+"'. Applying restrictions to "+D)));r===l&&G!==y.allowedByKeySystem&&(m=!0)}}}if(h=iz(a.a))if(p=kz(a.a),n=lz(a.a),p=Rx(p,n,h.variants),!p||p.allowedByKeySystem)a.log.info(Zu),wA(a),xA(a,h.variants);m&&h!==l&&(a.log.info(Zu),wA(a),xA(a,l.variants))}},onExpirationUpdated:function(h,l){if(a.B&&a.B.onExpirationUpdated)a.B.onExpirationUpdated(h,l);a.trigger(new _.J(_.$c,{expirationTime:l}))},onEvent:function(h){return a.ve(h)},getConfiguration:function(){return a.getConfiguration()},Kc:function(){return a.Kc()}});
|
|
169
|
+
yA(a);c=(b=a.configuration.drm)?b.offlineId||"":"";d=[];e=_.mp(a.f.periods);if(!c){g.G(2);break}f=_.mk(_.Vd);if(!f){g.G(2);break}return _.x(g,f.Nk(b,e,a.getNetworkEngine()),4);case 4:return _.x(g,f.fj(c),5);case 5:d=g.f;case 2:return _.x(g,_.Ol(a.m,e,d),6);case 6:a.f&&zA(a,a.f.periods),_.z(g)}})};
|
|
170
|
+
LA=function(a){var b,c,d,e,f,g,h,l,m,n,p;return _.B(function(q){if(1==q.a)return b=a.j,c=function(r){a.j&&a.H&&(r.type===_.le&&a.Vd?(a.H.a=By,oA(a)):r.type===_.Ye&&a.getState()===_.an&&.1>a.getBufferInfo().Ha(a.getPosition())?(a.H.a=By,oA(a)):a.H&&BA(a));CA(a)},d=function(){if(a.j){var r=a.j.playbackRate;0!=r&&a.zc.set(r)}},a.o.on(b,_.Zd,c),a.o.on(b,_.Ud,c),a.o.on(b,_.hd,c),a.o.on(b,_.le,c),a.o.on(b,_.ke,c),a.o.on(b,_.be,c),a.o.on(b,_.Ye,c),a.o.on(b,_.de,d),a.g||(a.g=new _.ny,a.g.configure(a.configuration.abr)),
|
|
171
|
+
DA(a,a.f.periods),a.xc=new wy(a.configuration.preferredAudioLanguage||[],a.configuration.preferredAudioRole,a.configuration.preferredAudioChannelCount),a.Ga=a.configuration.preferredTextLanguage,a.vc=a.configuration.preferredTextRole,_.x(q,_.am(a.m,b),2);if(3!=q.a){if(!a.m)throw new _.L(_.M,7,7001);a.g.init(function(r,v,y){!a.V&&EA(a,r,v,y)});a.A=FA(a,a.configuration.startTime);a.qc=GA(a);a.zc=new Hy({Ge:function(){return b.playbackRate},Xg:function(r){b.playbackRate=r},Kj:function(r){b.currentTime+=
|
|
172
|
+
r}});a.isLive()&&a.configuration.streaming.enableLiveEdgeChasing&&(a.Pd=new Ey(a));e=Math.max(1E-4,a.configuration.streaming.rebufferingGoal);HA(a,e);Gx(a.f,_.Eg(a.configuration.preferredVideoCodec),_.Eg(a.configuration.preferredAudioCodec),a.configuration.preferredAudioChannelCount);a.a=IA(a);a.a.j=a.configuration.streaming;a.F=eA;return _.x(q,a.a.start(),3)}if(!a.a)throw new _.L(_.M,7,7001);a.configuration.streaming.startAtSegmentBoundary&&(f=bz(a.A),g=JA(a,f),Vy(a.A.f,g));h=_.u(a.f.periods);for(l=
|
|
173
|
+
h.next();!l.done;l=h.next())m=l.value,KA(a,m);wA(a);n=uA(a)||a.f.periods[0];p=n.variants.some(function(r){return r.primary});a.configuration.preferredAudioLanguage||p||a.log.warn("No preferred audio language set. We will choose an arbitrary language initially");xA(a,n.variants);a.o.one(b,_.vd,function(){a.I.A=Date.now()/1E3-(null===a.Qe?0:a.Qe)});_.z(q)})};
|
|
174
|
+
sA=function(a){function b(d){return d.video&&d.audio||d.video&&d.video.codecs.includes(",")}if(a.some(function(d){return d.variants.some(b)})){_.Sf("Found variant with audio and video content, so filtering out audio-only content in all periods.");a=_.u(a);for(var c=a.next();!c.done;c=a.next())c=c.value,c.variants=c.variants.filter(b)}};FA=function(a,b){return new $y(a.j,a.f,a.configuration.streaming,b,function(){a.qc&&Vw(a.qc,!0);a.a&&xz(a.a)},function(c){return a.dispatchEvent(c)})};
|
|
175
|
+
GA=function(a){var b=new Fy(a.f);Gy(b,function(){wA(a)});var c=new Xw(a.wc);Yw(c,function(e){e.Yd&&e.Yd();qA(a,_.qg,e)},function(e){e.Ye&&e.Ye();qA(a,_.rg,e)},function(e,f){f||(e.Yd&&e.Yd(),qA(a,_.qg,e),e.Ye&&e.Ye(),qA(a,_.rg,e))});var d=new Ww(a.j);d.a.add(b);d.a.add(c);return d};HA=function(a,b){a.H=new Cy(b,Math.min(.5,b/2));a.H.a=By;oA(a);a.Va=(new _.$i(function(){BA(a)})).cb(.25)};
|
|
176
|
+
BA=function(a){switch(a.F){case eA:a:if(a.j.ended||nx(a.J))var b=!0;else{if(a.isLive()){b=Jw(a.f.presentationTimeline);var c=a.getBufferInfo();if(null!==c&&(c=c.Ba(),null!==c&&c>=b)){b=!0;break a}}b=!1}break;default:b=!1}if(a.J){var d=px(a.J);c=d.video;d=d.audio;var e=a.j.currentTime;c&&d?(c=c.Ha(e),d=d.Ha(e),c=Math.min(c,d)):c=c?c.Ha(e):d?d.Ha(e):0}else c=0;if(d=a.H){d=a.H;var f=b,g=d.f.get(d.a);e=d.a;c=f||c>=g?Ay:By;d.a=c;d=e!=c}c=d;d=MA(a);c||a.getState()===_.Sm&&!d?(a.log.debug("Buffering state changed. Is buffering",
|
|
177
|
+
d,"buffered to end",b,"state",a.getState()),oA(a)):a.Zc&&CA(a)};IA=function(a){var b={xb:function(){return bz(a.A)},W:a.J,Cb:a.getNetworkEngine(),Xe:a.ii.bind(a),We:a.hi.bind(a),onError:a.onError.bind(a),yg:a.gk.bind(a),onEvent:a.ve.bind(a),Dg:a.ji.bind(a),Zd:a.uk.bind(a),Ce:function(){return a.g},pe:a.th.bind(a),Zg:a.fl.bind(a),jd:a.m};return new _.hz(a.f,b)};yA=function(a){var b=_.xk(a.configuration.drm);a.m.g=b};
|
|
178
|
+
OA=function(a){a.B&&a.B.configure(a.configuration.manifest);a.m&&yA(a);if(a.a){a.a.j=a.configuration.streaming;try{for(var b=_.u(a.f.periods),c=b.next();!c.done;c=b.next())KA(a,c.value)}catch(e){a.onError(e)}c=kz(a.a);var d=lz(a.a);b=uA(a)||a.f.periods[0];c=Rx(c,d,b.variants);a.g&&c&&c.allowedByApplication&&c.allowedByKeySystem?xA(a,b.variants):(a.log.debug("Choosing new streams after changing configuration"),NA(a,b))}a.g&&(a.g.configure(a.configuration.abr),a.configuration.abr.enabled&&!a.V?a.g.enable():
|
|
179
|
+
a.g.disable())};fy=function(a){if(a.f&&a.A){var b=PA(a),c=[];a=_.u(QA(a));for(var d=a.next();!d.done;d=a.next()){d=d.value;var e=Mx(d);e.active=d==b;c.push(e)}return c}return[]};dy=function(a,b){if(a.f&&a.a){var c=uA(a),d=c.textStreams.find(function(e){return e.id==b.id});d?(RA(a,c,d,!1),SA(a,d),a.Ga=d.language):a.log.error(_.cv,b.id)}};
|
|
180
|
+
gy=function(a,b,c){var d=void 0===d?0:d;if(a.f&&a.a){var e=uA(a);if(a.configuration.abr.enabled&&b)a.log.info("Disable ABR and enable manual track selection to select "+(b.width+"x"+b.height+"@"+b.bandwidth)),a.configuration.abr.enabled=!1,a.g.disable();else if(!a.configuration.abr.enabled&&!b){a.log.info("Enable ABR Selection");a.configuration.abr.enabled=!0;a.g.enable();a.S=null;c=xA(a,e.variants);null!=a.na&&(a.xc=a.na,a.na=null);null==c||a.V||EA(a,c);return}if(b){a.S=b.id;var f=e.variants.find(function(g){return g.id==
|
|
181
|
+
b.id});f?(a.S=f.video.id,Ox(f)?(TA(a,e,f,!1),UA(a,f,c,d),null==a.na&&(a.na=a.xc),a.xc=new xy(f),xA(a,e.variants)):a.log.error("Unable to switch to restricted track",b.id)):a.log.error("No variant with id",b.id)}else a.S=null,null!=a.na&&(a.xc=a.na,a.na=null),c=xA(a,e.variants),null==c||a.V||EA(a,c)}};
|
|
182
|
+
ey=function(a,b){if(a.configuration.streaming.disableAudioTracks)Promise.reject(Error("Audio tracks are disabled by config."));else{if(a.a&&(a.f||a.A)){var c=lz(a.a),d=kz(a.a),e=uw(a.f.periods,bz(a.A)),f=a.f.periods[e?a.f.periods.indexOf(e):0].variants.filter(function(m){return m.audio.id===b&&Ox(m)});e=!1;var g=void 0;if(c){if(g=f.find(function(m){return m.video.id===c.id}),!g){a.log.debug("Cannot find exact variant, looking for anything else that matches with given audioId");e=!0;var h=a.getTrackManager().La();
|
|
183
|
+
if(h){var l=h.renditions.map(function(m){return m.id});g=f.find(function(m){return l.find(function(n){return n===String(m.video.id)})})}}}else g=f[0];if(g){if(d.codecs.split(".")[0]===g.audio.codecs.split(".")[0]){d=g.audio;a.yc=d.id;a.g.setVariants(f);f=uA(a);TA(a,f,g,!1);e||a.V?UA(a,g,!0,0):_.uz(a.a,d,!0,0);Promise.resolve();return}a.log.warn("Target audio codecs not compatible with active audio codecs.")}}Promise.reject()}};
|
|
184
|
+
hy=function(a){var b=a.Pe;return a.f?a.J.getTextDisplayer().isTextVisible():b};cy=function(a,b){var c,d,e,f;return _.B(function(g){c=a.Pe;d=b;if(c==d)return g["return"]();a.Pe=d;if(a.F!==eA)return g.G(0);a.J.getTextDisplayer().setTextVisibility(b);if(a.configuration.streaming.alwaysStreamText)return g.G(0);if(!b)return tz(a.a),g.G(0);e=uA(a);f=_.Qx(e.textStreams,a.Ga,a.vc);return 0<f.length?_.x(g,qz(a.a,f[0]),0):g.G(0)})};
|
|
185
|
+
TA=function(a,b,c,d){var e=a.getTrackManager();a.B.setCurrentVariant(c);if(e){var f=a.I.B;if(c.video){ky(e,c.video,d);var g=e.fa();f.j!==g&&(f.j=g,f.a.push({timestamp:Date.now()/1E3,id:g.id,trackId:g.track.id,type:g.track.type,fromAdaptation:d,width:g.width,height:g.height,bandwidth:g.bandwidth}))}c.audio&&(ky(e,c.audio,d),e=e.Ia(),f.f!==e&&(f.f=e,f.a.push({timestamp:Date.now()/1E3,id:e.id,trackId:e.track.id,type:e.track.type,fromAdaptation:d,width:null,height:null,bandwidth:e.bandwidth})))}ry(a.O,
|
|
186
|
+
b).variant=c};RA=function(a,b,c,d){ry(a.O,b).text=c;if(b=a.getTrackManager())ky(b,c,d),c=b.Ja(),a=a.I.B,a.g!==c&&(a.g=c,a.a.push({timestamp:Date.now()/1E3,id:c.id,trackId:c.track.id,type:c.track.type,fromAdaptation:d,width:null,height:null,bandwidth:null}))};
|
|
187
|
+
DA=function(a,b){for(var c=0;c<b.length;c++){for(var d=b[c],e=new Map,f=_.u(d.variants),g=f.next();!g.done;g=f.next())if(g=g.value,g.video&&g.video.closedCaptions){g=g.video;for(var h=_.u(g.closedCaptions.keys()),l=h.next();!l.done;l=h.next())if(l=l.value,!e.has(l)){var m={id:a.Wg++,originalId:l,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:function(){return null},getSegmentReference:function(){return null},initSegmentReference:null,Na:0,mimeType:_.cc,codecs:"",kind:"caption",
|
|
188
|
+
encrypted:!1,keyId:null,language:g.closedCaptions.get(l),label:null,type:_.Be,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:g.roles,channelsCount:null,closedCaptions:null};e.set(l,m)}}e=_.u(e.values());for(f=e.next();!f.done;f=e.next())d.textStreams.push(f.value)}};
|
|
189
|
+
zA=function(a,b){for(var c=a.a?kz(a.a):null,d=a.a?lz(a.a):null,e=_.u(b),f=e.next();!f.done;f=e.next())Lx(a.m,c,d,f.value);c=Tv(b,function(h){return h.variants.some(Ox)});if(a.configuration.streaming.disableAudioTracks)for(d=_.u(b),e=d.next();!e.done;e=d.next())for(f=_.u(e.value.variants),e=f.next();!e.done;e=f.next())delete e.value.audio;if(a.configuration.streaming.disableVideoTracks)for(d=_.u(b),e=d.next();!e.done;e=d.next())for(f=_.u(e.value.variants),e=f.next();!e.done;e=f.next()){e=e.value;var g=
|
|
190
|
+
e.video;!g||1<Zv(g.type,_.Xi(g.mimeType,g.codecs)).size||delete e.video}if(0===c)throw new _.L(_.M,4,4032);if(c<b.length)throw new _.L(_.M,4,4011);c=_.u(b);for(e=c.next();!e.done;e=c.next())d=e.value,Ix(d.variants,a.configuration.restrictions,a.Qg)&&a.a&&uA(a)==d&&wA(a),VA(a,d.variants)};
|
|
191
|
+
KA=function(a,b){var c=a.a?kz(a.a):null,d=a.a?lz(a.a):null;Lx(a.m,c,d,b);d=b.variants;if(!d.some(Ox))throw new _.L(_.M,4,4011);VA(a,b.variants);Ix(d,a.configuration.restrictions,a.Qg)&&a.a&&uA(a)==b&&wA(a);if(!_.ji(2)&&(c=a.m?a.m.getDrmInfo():null)){d=_.u(d);for(var e=d.next();!e.done;e=d.next()){e=_.u(e.value.drmInfos);for(var f=e.next();!f.done;f=e.next())if(f=f.value,f.keySystem===c.keySystem){f=_.u(f.initData||[]);for(var g=f.next();!g.done;g=f.next())g=g.value,_.dm(a.m,g.keyId,g.initData)||_.Vl(a.m,
|
|
192
|
+
g.initDataType,g.initData,g.keyId)}}}};UA=function(a,b,c,d){c=void 0===c?!1:c;d=void 0===d?0:d;a.V?(a.ma=b,a.Pg=c,a.Ig=d):vz(a.a,b,c,d)};SA=function(a,b){a.V?a.ga=b:_.uz(a.a,b,!0,0)};WA=function(a){if(a.a&&a.f){var b=iz(a.a),c=uA(a);null!=b&&b==c&&(kz(a.a),lz(a.a),_.jz(a.a,_.Be),ry(a.O,c),ry(a.O,c))}};
|
|
193
|
+
JA=function(a,b){function c(g,h){if(!g)return null;var l=g.findSegmentPosition(h-f.startTime);return null==l?null:(l=g.getSegmentReference(l))?l.startTime+f.startTime:null}var d=kz(a.a),e=lz(a.a),f=uA(a);d=c(d,b);e=c(e,b);return null!=e&&null!=d?Math.max(e,d):null!=e?e:null!=d?d:b};MA=function(a){return a.m&&a.m.D?!0:a.H?a.H.getState()===By:!1};oA=function(a){if(a.I&&a.H&&a.A){var b=XA(a)===_.Sm,c=a.zc;c.j=b;Iy(c);a.A.j.o=b;CA(a)}};CA=function(a){hA(a,XA(a))};
|
|
194
|
+
XA=function(a){var b=a.getDuration(),c=a.getPosition();return a.j&&a.j.ended||(a.Zc||a.ha===_.Um)&&1>=Math.abs(b-c)?_.Um:MA(a)||a.Vd?_.Sm:a.j&&a.j.paused?_.$m:_.an};
|
|
195
|
+
xA=function(a,b){try{VA(a,b)}catch(e){return a.onError(e),null}var c=b.filter(function(e){return Ox(e)});c=Vx(c,a.yc);var d=a.xc.create(c);d=Array.from(d.values());a.g.setVariants(d);if(null!==a.S&&null!==a.yc&&(d=d.find(function(e){return e.video.id==a.S&&e.audio.id==a.yc}),a.S=null,d))return d;if(a.configuration.abr.enabled||null===a.S)return a.g.chooseVariant();c=c.find(function(e){return null!==e.video&&e.video.id===a.S});return c?c:(a.log.warn("Selected video track not found. Falling back to ABR selection"),
|
|
196
|
+
a.g.chooseVariant())};NA=function(a,b,c){c=void 0===c?!0:c;var d=xA(a,b.variants);a.yc=d&&d.audio&&d.audio.id;d&&(TA(a,b,d,!0),UA(a,d,c));(c=_.Qx(b.textStreams,a.Ga,a.vc)[0]||null)&&(a.configuration.streaming.alwaysStreamText||hy(a))&&(RA(a,b,c,!0),SA(a,c))};
|
|
197
|
+
$A=function(a,b){a.V=!0;a.g.disable();a.log.debug("Choosing new streams after period changed");var c=xA(a,b.variants),d=_.Qx(b.textStreams,a.Ga,a.vc)[0]||null;a.ma&&(b.variants.includes(a.ma)&&(c=a.ma),a.ma=null);a.ga&&(b.textStreams.includes(a.ga)&&(d=a.ga),a.ga=null);c&&YA(a,b,function(){return TA(a,b,c,!0)});d&&(a.configuration.streaming.alwaysStreamText||hy(a))&&YA(a,b,function(){return RA(a,b,d,!0)});b===uA(a)&&ZA(a);return a.configuration.streaming.alwaysStreamText||hy(a)?{variant:c,text:d}:
|
|
198
|
+
{variant:c,text:null}};EA=function(a,b,c,d){c=void 0===c?!1:c;d=void 0===d?0:d;if(a.configuration.abr.enabled){a.log.debug("switch_");var e=aB(a,b);YA(a,e,function(){return TA(a,e,b,!0)});e===uA(a)&&ZA(a);a.a&&vz(a.a,b,c,d)}};wA=function(a){var b=a.getTrackManager();b&&a.F!==iA&&(b.l&&(jy(b),b.l.trigger(new _.J(_.tq))),ZA(a))};ZA=function(a){var b=uA(a);if(b){var c=a.Ac.get(b)||[];for(a.Ac["delete"](b);c.length;)c.shift()()}};YA=function(a,b,c){a.Ac.has(b)||a.Ac.set(b,[]);a.Ac.get(b).push(c)};
|
|
199
|
+
qA=function(a,b,c){a.trigger(new _.J(b,{detail:{schemeIdUri:c.schemeIdUri,value:c.value,startTime:c.startTime,endTime:c.endTime,id:c.id,eventElement:c.eventElement,type:c.type}}))};
|
|
200
|
+
VA=function(a,b){var c=a.m?_.K.Bf(a.m.ma):{},d=Object.keys(c);d=d.length&&"00"==d[0];for(var e=!1,f=!1,g=[],h=[],l=_.u(b),m=l.next();!m.done;m=l.next()){m=m.value;var n=[];m.audio&&n.push(m.audio);m.video&&n.push(m.video);n=_.u(n);for(var p=n.next();!p.done;p=n.next())if(p=p.value,p.keyId){var q=c[d?"00":p.keyId];q?vA.includes(q)&&(h.includes(q)||h.push(q)):g.includes(p.keyId)||g.push(p.keyId)}m.allowedByApplication?m.allowedByKeySystem&&(e=!0):f=!0}if(!e)throw new _.L(_.M,4,4012,{hasAppRestrictions:f,
|
|
201
|
+
missingKeys:g,restrictedKeyStatuses:h});};QA=function(a){var b=uA(a);if(null==b)return[];WA(a);return b.variants.filter(function(c){return Ox(c)})};bB=function(a){var b=uA(a);if(null==b)return[];WA(a);return b.textStreams.filter(function(c){return!a.Ud.has(c)})};uA=function(a){var b=bz(a.A),c=null;a=_.u(a.f.periods);for(var d=a.next();!d.done;d=a.next())d=d.value,d.startTime<=b&&(c=d);return c};PA=function(a){var b=uA(a);return b&&ry(a.O,b).variant};
|
|
202
|
+
aB=function(a,b){for(var c=_.u(a.f.periods),d=c.next();!d.done;d=c.next())if(d=d.value,d.variants.includes(b))return d;return null};
|
|
203
|
+
cB=function(a,b,c){var d,e,f,g,h,l,m,n,p,q,r,v,y,A,E,G,D,I,ja;return _.B(function(S){switch(S.a){case 1:return d=_.mn,_.zf(S,2),_.x(S,_.tp(b.url,a.getNetworkEngine(),a.configuration.manifest.attemptParameters,b.type||null),4);case 4:return e=S.f,e.configure(a.configuration.manifest),_.x(S,e.start(b.url,rA(a)),5);case 5:f=S.f;sA(f.periods);if(!f.periods.length)throw new _.L(_.M,4,4014);return _.x(S,a.B.stop(),6);case 6:a.B=e;g=c.audio&&c.audio.id;h=c.video&&c.video.id;a.f.periods=f.periods;l=uw(f.periods,
|
|
204
|
+
bz(a.A))||f.periods[0];Gx(a.f,_.Eg(a.configuration.preferredVideoCodec),_.Eg(a.configuration.preferredAudioCodec),a.configuration.preferredAudioChannelCount);m=Wx(g,h,l.variants);n=_.Qx(l.textStreams,a.Ga,a.vc)[0]||null;xA(a,l.variants);p=m&&m.video;q=m&&m.audio;r=[];v=new Set;y=_.u(l.variants);for(A=y.next();!A.done;A=y.next())E=A.value,E.video&&v.add(E.video),E.audio&&v.add(E.audio);G=_.u(_.mf(v).concat(_.mf(l.textStreams)));for(D=G.next();!D.done;D=G.next())I=D.value,r.push(I.createSegmentIndex());
|
|
205
|
+
return _.x(S,Promise.all(r),7);case 7:Dz(a.a,d.AUDIO,q);Dz(a.a,d.VIDEO,p);Dz(a.a,d.TEXT,n);m&&TA(a,l,m,!1);a.log.info("Switch CDN successful.");_.Af(S,0);break;case 2:ja=_.Bf(S);if(!e){S.G(8);break}return _.x(S,e.stop(),8);case 8:throw ja;}})};
|
|
206
|
+
rA=function(a){return{networkingEngine:a.getNetworkEngine(),filterNewPeriod:function(b){return KA(a,b)},filterAllPeriods:function(b){return zA(a,b)},onTimelineCueAdded:function(b){var c=a.wc;a:{var d=_.u(c.a);for(var e=d.next();!e.done;e=d.next())if(e=e.value,e.schemeIdUri===b.schemeIdUri&&e.startTime===b.startTime&&e.endTime===b.endTime){d=e;break a}d=null}null==d&&(c.a.add(b),c.f(b))},onEvent:function(b){return a.ve(b)},onError:function(b){return a.onError(b)}}};dB=function(){};
|
|
207
|
+
eB=function(){var a=MediaSource.prototype.addSourceBuffer;MediaSource.prototype.addSourceBuffer=function(b){for(var c=[],d=0;d<arguments.length;++d)c[d]=arguments[d];c=a.apply(this,c);c.abort=function(){};return c}};fB=function(){var a=SourceBuffer.prototype.remove;SourceBuffer.prototype.remove=function(b,c){return a.call(this,b,c-.001)}};gB=function(){var a=MediaSource.isTypeSupported;MediaSource.isTypeSupported=function(b){return"mp2t"==b.split(/ *; */)[0].split("/")[1].toLowerCase()?!1:a(b)}};
|
|
208
|
+
hB=function(){var a=MediaSource.isTypeSupported;MediaSource.isTypeSupported=function(b){return"opus"!=_.aw(b)[0]&&a(b)}};
|
|
209
|
+
iB=function(){var a=MediaSource.isTypeSupported,b=/^dv(?:h[e1]|a[v1])\./;MediaSource.isTypeSupported=function(c){var d=c.split(/ *; */),e=d.shift(),f={};d=_.u(d);for(var g=d.next();!g.done;g=d.next())g=g.value.split("\x3d"),f[g[0]]=g[1].replace(/"(.*)"/,"$1");d=f.codecs;if(!d)return a(c);var h=!1,l=!1;c=d.split(",").filter(function(n){b.test(n)&&(l=!0);/^(hev|hvc)1\.2/.test(n)&&(h=!0);return!0});l&&(h=!1);f.codecs=c.join(",");h&&(f.eotf="smpte2084");for(var m in f)e+="; "+m+'\x3d"'+f[m]+'"';return cast.__platform__.canDisplayType(e)}};
|
|
210
|
+
jB=function(a){_.aq.call(this,a);a=a.getSurface().getMedia();this.a=null;for(var b=0;b<a.textTracks.length;++b){var c=a.textTracks[b];c.mode=_.Yc;c.label===ev&&(this.a=c)}this.a||(this.a=a.addTextTrack(_.xv,ev));this.a.mode=_.md};kB=function(a,b){var c=a.mode;a.mode=c==_.me?_.me:_.md;for(var d=a.cues,e=d.length-1;0<=e;e--){var f=d[e];f&&b(f)&&a.removeCue(f)}a.mode=c};lB=function(){};Bv=[112,115,115,104,0,0,0,0];_.Lv.prototype.f=function(){return this.keyInfo};_.Mv.prototype.getPosition=function(){return this.position};
|
|
211
|
+
_.Mv.prototype.f=function(){return this.keyInfo};_.nB=function mB(a){var c,d,e,f,g,h;return _.Hf(mB,function(l){1==l.a&&(c=-1,e=d=void 0,f=_.u(a),g=f.next());if(5!=l.a){if(g.done)return-1===c?l.G(0):_.x(l,{Ie:c,Pk:d,item:e,next:void 0},0);h=g.value;return 0<=c?_.x(l,{Ie:c,item:e,Pk:d,next:h},5):l.G(5)}c++;d=e;e=h;g=f.next();return l.G(2)})};Vv.prototype.destroy=function(){this.a&&(this.a.dispose(),this.a=null);return Promise.resolve()};
|
|
212
|
+
Vv.prototype.A=function(a){this.g=a.captions;var b=new Uint8Array(a.data.byteLength+a.initSegment.byteLength);b.set(a.initSegment,0);b.set(a.data,a.initSegment.byteLength);a.type===_.Qe?this.o.push(b):a.type===_.kc&&this.m.push(b)};Vv.prototype.w=function(){var a={video:_.Qh.apply(_.Jh,_.mf(this.o)),captions:this.g,audio:_.Qh.apply(_.Jh,_.mf(this.m))};this.f.resolve(a);this.j=!1};var kw=[154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149];_.w(hw,_.Al);
|
|
213
|
+
_.pw.prototype.track=function(a){null!=this.a&&(this.a&&(this.a.off(_.ie,this.f),this.g&&this.a.off(_.Ee,this.f)),this.a=null);a&&(this.a=a,this.a.on(_.ie,this.f,this))};
|
|
214
|
+
_.pw.prototype.append=function(a,b,c){var d=this.m?this.m(c):null;d||this.log.debug("Unable to resolve rendition for id",c);c={start:a,end:b,rendition:d,width:d?d.width:0,height:d?d.height:0,bandwidth:d?d.bandwidth:0};var e=this.U.find(function(f){return f.start>=a&&f.end<=b});if(e)e.rendition=d,e.width=c.width,e.height=c.height,e.bandwidth=c.bandwidth,e.start=c.start,e.end=c.end;else{d=_.u(this.U);for(e=d.next();!e.done;e=d.next())e=e.value,a>=e.start&&a<e.end?e.end=a:b>=e.start&&b<e.end&&(e.start=
|
|
215
|
+
b);this.U.push(c);this.U.sort(ow)}sw(this);this.f();this.a&&this.a.trigger(new _.J(_.Te))};_.pw.prototype.clear=function(){this.U=[];sw(this);this.a&&(this.a.trigger(new _.J(_.Te)),this.a.trigger(new _.J(_.rc)))};
|
|
216
|
+
_.pw.prototype.f=function(){if(this.a){var a=this.a.getPosition();if(0<=a){a:{for(var b=this.U.length,c=Number.MAX_SAFE_INTEGER,d=0;d<b;d++){var e=this.U[d];c=Math.min(e.start,c);if(e.start<=a&&e.end>a){a=.1>e.end-a&&d<b-1?this.U[d+1].rendition:e.rendition;break a}if(e.start>a)break}a=0<b&&c>a&&.25>c-a?this.U[0].rendition:null}if(a&&this.j!==a&&(this.j=a,this.a)){c=b=-1;if(a)b=a.width||-1,c=a.height||-1;else if(d=this.a.getSurface().getMedia())b=d.videoWidth,c=d.videoHeight;this.a.trigger(new _.J(_.tc,
|
|
217
|
+
{detail:{width:b,height:c,bandwidth:a?a.bandwidth:null,rendition:a}}))}}}};_.Dw.prototype.getDuration=function(){return this.f};_.Dw.prototype.getPresentationStartTime=function(){return this.A};_.Dw.prototype.offset=function(a){null!=this.j&&(this.j+=a);null!=this.g&&(this.g+=a)};_.Dw.prototype.isLive=function(){return Infinity==this.f&&!this.o};Nw.prototype.release=function(){this.f=function(){};this.a.clear()};Nw.prototype.cues=function(){return this.a};
|
|
218
|
+
Pw.prototype.next=function(){var a=this.g.get(this.a);a&&0<a.a.length?(this.f+=1,a.Ka().length&&this.f===a.a.length&&(this.a+=1,this.f=0)):(this.a+=1,this.f=0);a=Qw(this);return{value:a,done:!a}};_.t=_.Rw.prototype;_.t.destroy=function(){this.a=[];return Promise.resolve()};
|
|
208
219
|
_.t.Dc=function(a){for(var b=this.a.length-1;0<=b;--b){var c=this.a[b];if(a>=c.startTime&&a<c.endTime)return c.position}if(this.a.length&&a<this.a[0].startTime)return this.a[0].position;this.h.warn("No Segment found for "+a+". We have "+this.a.length+" references");for(a=0;a<this.a.length;a++)b=this.a[a],this.h.debug("SegmentIndex Ref "+a+" start: "+b.startTime+" end: "+b.endTime+" pos: "+b.position);return null};
|
|
209
220
|
_.t.get=function(a){if(0==this.a.length)return null;a-=this.a[0].position;return 0>a||a>=this.a.length?null:this.a[a]};_.t.offset=function(a){this.h.info("Apply offset"+a+" to segment index");for(var b=_.u(this.a),c=b.next();!c.done;c=b.next())c=c.value,c.startTime+=a,c.endTime+=a,c.Na-=a};
|
|
210
|
-
_.t.
|
|
211
|
-
_.t.
|
|
212
|
-
b[b.length-1].position+1;e<a.length;)f=a[e++],f=new _.
|
|
213
|
-
a};_.t.replace=function(a){this.a=a};
|
|
214
|
-
|
|
215
|
-
_.t.remove=function(a,b){var c=this;return Promise.resolve().then(function(){!c.g||!c.g.remove(a,b)||null==c.a||b<=c.a||a>=c.f||(a<=c.a&&b>=c.f?c.a=c.f=null:a<=c.a&&b<c.f?c.a=b:a>c.a&&b>=c.f&&(c.f=a))})};_.t.
|
|
216
|
-
|
|
217
|
-
_.t.destroy=function(){var a=this;this.
|
|
218
|
-
|
|
219
|
-
_.t.
|
|
220
|
-
|
|
221
|
-
_.t.
|
|
222
|
-
_.t.
|
|
223
|
-
_.t.
|
|
224
|
-
_.t.
|
|
225
|
-
_.t
|
|
226
|
-
_.t.
|
|
227
|
-
_.t.
|
|
228
|
-
_.t.
|
|
229
|
-
_.t.
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
_.t.chooseVariant=function(){var a=ay(!this.B&&this.a.initialRestrictions?this.a.initialRestrictions:this.a.restrictions,this.o),b=Zx(this.f,this.a.defaultBandwidthEstimate);this.o.length&&!a.length&&(this.h.warn("No variants met the ABR restrictions. Choosing a variant by lowest bandwidth."),a=ay(null,this.o),a=[a[0]]);var c=a[0]||null;a=_.u(_.$A(a));for(var d=a.next();!d.done;d=a.next()){var e=d.value;d=e.item;var f=isNaN(this.m)||0===this.m?1:Math.abs(this.m),g=f*d.bandwidth,h=g/this.a.bandwidthDowngradeTarget;
|
|
221
|
+
_.t.Wc=function(a,b){var c=a-this.a[0].position;if(0<=c&&c<this.a.length)for(this.h.warn("Accounting for segment duration drift",b,"at",c),this.a[c].endTime+=b,c+=1;c<this.a.length;++c)this.a[c].startTime+=b,this.a[c].endTime+=b};_.t.getDuration=function(){return this.a[this.a.length-1].endTime-this.a[0].startTime};
|
|
222
|
+
_.t.ua=function(a){for(var b=[],c=[],d=0,e=0;d<this.a.length&&e<a.length;){var f=this.a[d],g=a[e];f.startTime<g.startTime?(b.push(f),d++):(f.startTime>g.startTime?0===d?c.push(g):this.h.info("Refusing to rewrite original references on update!"):(.1<Math.abs(f.endTime-g.endTime)?(f=new _.Mv(f.position,g.startTime,g.endTime,g.Ka,g.sa,g.ea,g.Na,g.keyInfo,g.Fc,g.timescale,g.horizontalTiles,g.verticalTiles,g.durationPerTile),b.push(f)):b.push(f),d++),e++)}for(;d<this.a.length;)b.push(this.a[d++]);if(b.length)for(d=
|
|
223
|
+
b[b.length-1].position+1;e<a.length;)f=a[e++],f=new _.Mv(d++,f.startTime,f.endTime,f.Ka,f.sa,f.ea,f.Na,f.keyInfo,f.Fc,f.timescale,f.horizontalTiles,f.verticalTiles,f.durationPerTile),b.push(f);else b=a;a=b;if(c.length&&b.length){a=[];e=b[0].position;d=c.length;c=_.u(c);for(f=c.next();!f.done;f=c.next())f=f.value,a.push(new _.Mv(e-d--,f.startTime,f.endTime,f.Ka,f.sa,f.ea,f.Na,f.keyInfo,f.Fc,f.timescale,f.horizontalTiles,f.verticalTiles,f.durationPerTile));b=_.u(b);for(f=b.next();!f.done;f=b.next())a.push(f.value)}this.a=
|
|
224
|
+
a};_.t.replace=function(a){this.a=a};Ww.prototype.release=function(){this.g.stop();for(var a=_.u(this.a),b=a.next();!b.done;b=a.next())b.value.release();this.a.clear()};Xw.prototype.release=function(){this.m=null;this.j.clear();this.a=function(){};this.f=function(){};this.g=function(){}};
|
|
225
|
+
Xw.prototype.o=function(a,b){for(var c={},d=_.u(this.m.cues()),e=d.next();!e.done;c={ke:c.ke,yd:c.yd},e=d.next()){e=e.value;c.ke=this.j.get(e)||null;c.yd=a<e.startTime?1:a>e.endTime?3:2;this.j.set(e,c.yd);var f=this.w.find(function(g){return function(h){return h.pc===g.ke&&h.oc===g.yd}}(c));f&&f.dc(e,b)}};_.t=ax.prototype;_.t.destroy=function(){this.g=this.w=null;this.o.clear();return Promise.resolve()};
|
|
226
|
+
_.t.remove=function(a,b){var c=this;return Promise.resolve().then(function(){!c.g||!c.g.remove(a,b)||null==c.a||b<=c.a||a>=c.f||(a<=c.a&&b>=c.f?c.a=c.f=null:a<=c.a&&b<c.f?c.a=b:a>c.a&&b>=c.f&&(c.f=a))})};_.t.sb=function(){return this.a};_.t.Ba=function(){return this.f};_.t.fc=function(a){return null==this.a||null==this.f?!1:a>=this.a&&a<this.f};_.t.Ha=function(a){return null==this.f||this.f<a?0:this.f-Math.max(a,this.a)};
|
|
227
|
+
fx.prototype.init=function(a){var b=muxjs.mp4.probe;a=_.N(a);this.m=b.videoTrackIds(a);this.j=b.timescale(a);this.a.init()};fx.prototype.g=function(a,b){var c=_.N(a);(c=this.a.parse(c,this.m,this.j))&&c.captions&&b(c.captions);this.a.clearParsedCaptions()};fx.prototype.f=function(){this.a.resetCaptionStream()};_.gx.prototype.init=function(){};_.gx.prototype.g=function(){};_.gx.prototype.f=function(){};_.t=_.ix.prototype;
|
|
228
|
+
_.t.destroy=function(){var a=this;this.J=!0;var b=[],c;for(c in this.g){var d=this.g[c],e=d[0];this.g[c]=d.slice(0,1);e&&b.push(e.p["catch"](Iv));for(e=1;e<d.length;++e)d[e].p["catch"](Iv),d[e].p.reject()}this.a&&b.push(this.a.destroy());this.B&&b.push(this.B.destroy());for(var f in this.A)b.push(this.A[f].destroy());return Promise.all(b).then(function(){a.m&&(a.m.release(),a.m=null);a.j&&(a.j.removeAttribute("src"),a.j.load(),a.j=null);a.w="";a.o=null;a.a=null;a.B=null;a.f={};a.A={};a.F={};a.H=null;
|
|
229
|
+
a.K=!1;for(var g in a.g);a.g={}})};_.t.init=function(a,b,c){c=void 0===c?!1:c;var d=this,e;return _.B(function(f){if(1==f.a)return e=_.mn,_.x(f,d.I,2);a.forEach(function(g,h){var l=_.Xi(g.mimeType,g.codecs);if(h==e.TEXT)mx(d,l);else{var m=new Map;m.set(h,l);_.Uv(l)&&b&&!g.keyInfo||!Yv(l,h)||(d.A[h]=new Vv,l="aac"==l.toLowerCase().split(";")[0].split("/")[1]?l.replace(/aac/i,_.Fd):Xv(h,l),m=Zv(h,l),c&&m["delete"](e.AUDIO));lx(d,m)}});_.z(f)})};
|
|
230
|
+
_.t.sb=function(a){return a===_.Be?this.a.sb():(a=ox(this,a))?a.sb():null};_.t.Ba=function(a){return a===_.Be?this.a.Ba():(a=ox(this,a))?a.Ba():null};_.t.fc=function(a,b,c){return a===_.Be?this.a.fc(b):(a=ox(this,a))?a.fc(b,!1,c):!1};_.t.Ha=function(a,b){if(a===_.Be)return this.a.Ha(b);var c=ox(this,a);return c?c.Ha(b):0};
|
|
231
|
+
_.t.remove=function(a,b,c){var d=this;return a===_.Be?this.a.remove(b,c):rx(this,a,this.Sg.bind(this,a,b,c)).then(function(){if(a===_.Qe){var e=d.sb(a),f=d.Ba(a);null!==e&&null!==f&&tw(d.D,e,f)}else a===_.kc&&(e=d.D,e.a&&e.a.trigger(new _.J(_.rc)))})};_.t.clear=function(a){if(a==_.Be){if(!this.a)return Promise.resolve();this.H.f();return this.a.remove(0,Infinity)}return rx(this,a,this.Sg.bind(this,a,0,this.o.duration))};
|
|
232
|
+
_.t.flush=function(a){return a==_.Be?Promise.resolve():rx(this,a,this.bg.bind(this,a))};_.t.endOfStream=function(a){var b=this;return xx(this,function(){nx(b)||(a?b.o.endOfStream(a):b.o.endOfStream())})};_.t.getDuration=function(){return this.o.duration};_.t.we=function(a,b){this.h.debug("Appending data to "+a+Su);try{this.f[a].appendBuffer(b)}catch(c){throw this.h.warn("Failed to append data for "+a,c),c;}this.h.debug("Done Appending data to "+a+Su)};
|
|
233
|
+
_.t.Sg=function(a,b,c){if(c<=b)this.Qc(a);else{this.h.debug("Removing data from "+a+" range:",b,c);try{this.f[a].remove(b,c)}catch(d){throw this.h.warn("Failed to remove data from "+a+" buffer. Range:",b,c,d),d;}this.h.debug("Done Removing data from "+a+" range:",b,c)}};
|
|
234
|
+
_.t.lh=function(a){try{this.h.debug("Aborting operations for "+a+Su);var b=this.f[a].appendWindowStart,c=this.f[a].appendWindowEnd;this.f[a].abort();this.f[a].appendWindowStart=b;this.f[a].appendWindowEnd=c}catch(d){throw this.h.warn("Failed to abort operations for "+a+Su,d),d;}this.h.debug("Done Aborting operations for "+a+Su);this.Qc(a)};
|
|
235
|
+
_.t.bg=function(a){try{this.j.readyState>HTMLMediaElement.HAVE_NOTHING?(this.h.debug("Flushing buffer for "+a),this.j.currentTime-=.001):this.h.warn("Skip buffer flush for "+a+" with element state: "+this.j.readyState)}catch(b){throw this.h.warn("Failed to flush buffer for "+a,b),b;}this.h.debug("Done Flushing buffer for "+a);this.Qc(a)};
|
|
236
|
+
_.t.Yg=function(a,b){0>b&&(b+=.001);try{this.h.debug("Setting timestamp offset for "+a,b),this.f[a].timestampOffset=b}catch(c){throw this.h.warn("Failed to set timestamp offset for "+a,b,c),c;}this.h.debug("Done Setting timestamp offset for "+a,b);this.Qc(a)};
|
|
237
|
+
_.t.Yk=function(a,b,c){try{this.h.debug("Setting append window for "+a,b,c),this.f[a].appendWindowStart=0,this.f[a].appendWindowEnd=c,this.f[a].appendWindowStart=b}catch(d){throw this.h.warn("Failed to set append window for "+a,b,c,d),d;}this.h.debug("Done Setting append window for "+a,b,c);this.Qc(a)};_.t.T=function(a){this.g[a][0].p.reject(new _.L(_.M,3,3014,{mediaError:this.j.error?this.j.error.code:0}))};
|
|
238
|
+
_.t.Qc=function(a){var b=this.g[a][0];b&&(b.p.resolve(),this.h.debug("Update-End received for "+a),Ax(this,a))};_.t.getTextDisplayer=function(){return this.B};var kx=window.URL.createObjectURL;_.w(Xx,_.Q);_.t=Xx.prototype;_.t.initialize=function(a){this.l=a};_.t.release=function(){this.g=[];this.a.clear();this.f.clear()};_.t.load=function(){};_.t.destroy=function(){this.release();this.l=null};_.t.getVideoTracks=function(){return Yx(this,_.ti)};_.t.getAudioTracks=function(){return Yx(this,_.P)};_.t.ia=function(){return Yx(this,_.O)};_.t.fa=function(){return this.a.get(_.ti)||null};_.t.Ia=function(){return this.a.get(_.P)||null};_.t.Ja=function(){return this.a.get(_.O)||null};
|
|
239
|
+
_.t.Xa=function(){return this.f.get(_.ti)||null};_.t.gb=function(){return this.f.get(_.P)||null};_.t.hb=function(){return this.f.get(_.O)||null};_.t.La=function(){return Zx(this,_.ti)};_.t.pa=function(){return Zx(this,_.P)};_.t.qa=function(){return Zx(this,_.O)};_.t.bb=function(a){ay(this,_.ti,a)};_.t.wa=function(a){ay(this,_.P,a)};_.t.Ea=function(a){ay(this,_.O,a)};_.t.ab=function(a,b){$x(this,_.ti,a,void 0===b?!1:b)};_.t.nb=function(a,b){$x(this,_.P,a,void 0===b?!1:b)};
|
|
240
|
+
_.t.ob=function(a,b){$x(this,_.O,a,void 0===b?!1:b)};_.t.addTextTrack=function(a){var b=this;return _.B(function(c){return b.l?_.x(c,b.l.addTextTrack(a.url,a.language,a.kind,a.mimeType,a.codec,a.label),0):c.G(0)})};_.t.ka=function(){return!!this.l&&this.l.ka()};Xx.prototype.isAbrEnabled=Xx.prototype.ka;Xx.prototype.addTextTrack=Xx.prototype.addTextTrack;Xx.prototype.setTextRendition=Xx.prototype.ob;Xx.prototype.setAudioRendition=Xx.prototype.nb;Xx.prototype.setVideoRendition=Xx.prototype.ab;
|
|
241
|
+
Xx.prototype.setTextTrack=Xx.prototype.Ea;Xx.prototype.setAudioTrack=Xx.prototype.wa;Xx.prototype.setVideoTrack=Xx.prototype.bb;Xx.prototype.getTextTrack=Xx.prototype.qa;Xx.prototype.getAudioTrack=Xx.prototype.pa;Xx.prototype.getVideoTrack=Xx.prototype.La;Xx.prototype.getLoadingTextRendition=Xx.prototype.hb;Xx.prototype.getLoadingAudioRendition=Xx.prototype.gb;Xx.prototype.getLoadingVideoRendition=Xx.prototype.Xa;Xx.prototype.getTextRendition=Xx.prototype.Ja;Xx.prototype.getAudioRendition=Xx.prototype.Ia;
|
|
242
|
+
Xx.prototype.getVideoRendition=Xx.prototype.fa;Xx.prototype.getTextTracks=Xx.prototype.ia;Xx.prototype.getAudioTracks=Xx.prototype.getAudioTracks;Xx.prototype.getVideoTracks=Xx.prototype.getVideoTracks;_.t=_.ny.prototype;_.t.stop=function(){this.w=null;this.j=!1;this.o=[];this.m=1;this.g=null;this.B=!1};_.t.init=function(a){this.w=a};
|
|
243
|
+
_.t.chooseVariant=function(){var a=oy(!this.B&&this.a.initialRestrictions?this.a.initialRestrictions:this.a.restrictions,this.o),b=my(this.f,this.a.defaultBandwidthEstimate);this.o.length&&!a.length&&(this.h.warn("No variants met the ABR restrictions. Choosing a variant by lowest bandwidth."),a=oy(null,this.o),a=[a[0]]);var c=a[0]||null;a=_.u(_.nB(a));for(var d=a.next();!d.done;d=a.next()){var e=d.value;d=e.item;var f=isNaN(this.m)||0===this.m?1:Math.abs(this.m),g=f*d.bandwidth,h=g/this.a.bandwidthDowngradeTarget;
|
|
234
244
|
e=f*(e.next||{bandwidth:Infinity}).bandwidth/this.a.bandwidthUpgradeTarget;this.h.debug("Bandwidth ranges:",(g/1E6).toFixed(3),(h/1E6).toFixed(3),(e/1E6).toFixed(3));b>=h&&b<=e&&(c=d)}this.g=Date.now();this.B=!0;return c};_.t.enable=function(){this.j=!0};_.t.disable=function(){this.j=!1};
|
|
235
|
-
_.t.segmentDownloaded=function(a,b){this.h.debug("Segment downloaded:","deltaTimeMs\x3d"+a,"numBytes\x3d"+b,"lastTimeChosenMs\x3d"+this.g,"enabled\x3d"+this.j);var c=this.f;if(!(16E3>b)){var d=8E3*b/a,e=a/1E3;c.a+=b;_.
|
|
236
|
-
break a}}else if(Date.now()-this.g<1E3*this.a.switchInterval){this.h.debug("Still within switch interval...");break a}c=this.chooseVariant();this.h.debug("Calling switch_(), bandwidth\x3d"+Math.round(
|
|
237
|
-
_.t.reset=function(){this.A=!1;this.f=new
|
|
238
|
-
|
|
239
|
-
_.t.start=function(){var a=this,b,c,d;return _.B(function(e){if(1==e.a){b=a.C.
|
|
240
|
-
_.t.Db=function(a){var b=this,c,d,e,f;return _.B(function(g){switch(g.a){case 1:if(b.g)return g["return"]();c=
|
|
241
|
-
f.every(function(h){return h.endOfStream})&&(b.h.debug(c,"calling endOfStream()..."),b.C.
|
|
242
|
-
_.t.
|
|
243
|
-
_.t.
|
|
244
|
-
_.t.unload=function(){var a=this;
|
|
245
|
-
_.t.release=function(){var a=this;return _.B(function(b){if(a.da)return b["return"](a.da);a.da=new Promise(function(c,d){try{var e=a.Sb;a.Sb=null;var f=e;e&&(f=e["catch"](function(){}));f?f=f.then(function(){return _.
|
|
246
|
-
_.t.getBufferInfo=function(a){if(this.J){var b=
|
|
247
|
-
_.t.getDuration=function(){return this.f?this.f.presentationTimeline.getDuration():Infinity};_.t.destroy=function(){var a=this;return _.B(function(b){if(1==b.a)return _.x(b,_.
|
|
248
|
-
_.t.load=function(a){var b=this,c,d,e,f,g,h,l,m;return _.B(function(n){switch(n.a){case 1:if(b.F===
|
|
249
|
-
_.
|
|
250
|
-
|
|
251
|
-
_.t.
|
|
252
|
-
_.t.setPlaybackRate=function(a){if(0===a)this.log.warn("A trick play rate of 0 is unsupported!");else if(this.F===
|
|
253
|
-
_.t.ia=function(){if(this.f&&this.A){var a=
|
|
254
|
-
_.t.getStats=function(){if(this.F!==
|
|
255
|
-
_.t.getTimelineCues=function(){return this.wc?_.
|
|
256
|
-
_.t.addTextTrack=function(a,b,c,d,e,f){var g=this,h,l,m,n,p,q,r,v,y;return _.B(function(A){if(1==A.a){if(g.F!==
|
|
257
|
-
findSegmentPosition:function(){return 1},getSegmentReference:function(E){return 1==E?r:null},adjustSegmentDurations:function(){},getDuration:function(){return q},segmentLookupStrategy:_.
|
|
258
|
-
y;g.
|
|
259
|
-
_.t.
|
|
260
|
-
_.t.
|
|
261
|
-
|
|
262
|
-
_.t
|
|
263
|
-
_.x(n,b.uc(f.url,a),10);case 10:if(m=n.f)f.url=m,h=!0;else throw l;case 6:h?n.G(4):(d&&b.g.enable(),
|
|
264
|
-
|
|
265
|
-
_.
|
|
266
|
-
_.
|
|
267
|
-
e.startTime
|
|
245
|
+
_.t.segmentDownloaded=function(a,b){this.h.debug("Segment downloaded:","deltaTimeMs\x3d"+a,"numBytes\x3d"+b,"lastTimeChosenMs\x3d"+this.g,"enabled\x3d"+this.j);var c=this.f;if(!(16E3>b)){var d=8E3*b/a,e=a/1E3;c.a+=b;_.Aw(c.f,e,d);_.Aw(c.g,e,d)}if(null!=this.g&&this.j)a:{this.h.debug("Suggesting Streams...");if(!this.A){if(!(128E3<=this.f.a)){this.h.debug("Still waiting for a good estimate...");break a}this.A=!0;if(this.a.useSwitchIntervalForInitialSwitch&&Date.now()-this.g<1E3*this.a.switchInterval){this.h.debug("Skipping initial estimation switch due to switch interval...");
|
|
246
|
+
break a}}else if(Date.now()-this.g<1E3*this.a.switchInterval){this.h.debug("Still within switch interval...");break a}c=this.chooseVariant();this.h.debug("Calling switch_(), bandwidth\x3d"+Math.round(my(this.f,this.a.defaultBandwidthEstimate)/1E3)+" kbps");c&&this.w(c)}};_.t.playbackRateChanged=function(a){this.m=a};_.t.getBandwidthEstimate=function(){return my(this.f,this.a.defaultBandwidthEstimate)};_.t.setVariants=function(a){this.o=a};_.t.configure=function(a){this.a=a};
|
|
247
|
+
_.t.reset=function(){this.A=!1;this.f=new ly;var a=this.chooseVariant();a&&this.w(a)};py.prototype.clear=function(){this.a.clear()};sy.prototype.add=function(a){if(vy(this.f,a))return this.a.add(a),!0;_.F("Rejecting variant - not compatible with root.");return!1};sy.prototype.values=function(){return this.a.values()};xy.prototype.create=function(a){var b=this,c=a.filter(function(d){return vy(b.a,d)});return c.length?new sy(c[0],c):this.f.create(a)};
|
|
248
|
+
wy.prototype.create=function(a){var b=yy(a,this.g);0<b.length&&(a=b);b=!1;if(this.a){var c=zy(a,this.a);0<c.length?(a=c,b=!0):_.F("No exact match for preferred variant role could be found. Role: "+this.a)}b||(b=a.filter(function(d){return d.primary}),0<b.length&&(a=b));this.f&&(b=Cx(a,this.f),b.length?a=b:_.F("No exact match for the channel count could be found."));b=new sy(a[0]);a=_.u(a);for(c=a.next();!c.done;c=a.next())c=c.value,vy(b.f,c)&&b.add(c);return b};Cy.prototype.getState=function(){return this.a};var By=0,Ay=1;Ey.prototype.release=function(){this.f.release()};Fy.prototype.release=function(){this.a=this.g=null;this.f=function(){}};Fy.prototype.o=function(a){var b=this.a,c=this.g.periods;a=uw(c,a)||c[0];b!=a&&this.f(a);this.a=a};Hy.prototype.release=function(){this.f&&(this.f.stop(),this.f=null);this.a=null};Hy.prototype.set=function(a){this.g=a;Iy(this)};Ky.prototype.release=function(){this.g=null;this.f=function(){}};Oy.prototype.release=function(){this.g&&(this.g.release(),this.g=null);null!=this.w&&(this.w.stop(),this.w=null);this.f&&(this.f.release(),this.f=null);this.a=this.F=this.D=null;this.o=!1};Oy.prototype.Zd=function(){this.A=!0;Ny(this)};Sy.prototype.release=function(){this.f&&(this.f.release(),this.f=null);null!=this.g&&(this.g.release(),this.g=null);this.j=function(){};this.a=null;this.o=function(){};this.w=!1};Py.prototype.release=function(){this.a&&(this.a.stop(),this.a=null);this.f=null};$y.prototype.release=function(){this.f&&(this.f.release(),this.f=null);this.j&&(this.j.release(),this.j=null);this.o&&(this.o.stop(),this.o=null);this.g=this.f=this.a=this.m=null;this.A=function(){}};var fz=new _.Km(function(){return new Uint8Array([0,0,0,80,115,105,110,102,0,0,0,12,102,114,109,97,0,0,0,0,0,0,0,20,115,99,104,109,0,0,0,0,99,101,110,99,0,1,0,0,0,0,0,40,115,99,104,105,0,0,0,32,116,101,110,99,0,0,0,0,0,0,1,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])});var Oz;_.t=_.hz.prototype;_.t.destroy=function(){var a=this,b,c,d,e;return _.B(function(f){if(1==f.a){b=[];c=_.u(a.a.values());for(d=c.next();!d.done;d=c.next())e=d.value,rz(e),b.push(sz(e));return _.x(f,Promise.all(b),2)}a.a.clear();a.o.clear();a.C=null;a.f=null;a.F=null;a.m=null;a.j=null;a.g=!0;_.z(f)})};
|
|
249
|
+
_.t.start=function(){var a=this,b,c,d;return _.B(function(e){if(1==e.a){b=a.C.xb();c=nz(a,b);d=a.C.Xe(a.f.periods[c]);if(!d.variant&&!d.text)throw a.h.error("start(): No streams chosen"),new _.L(_.M,5,5005);a.D=!d.variant&&!!d.text;return _.x(e,Jz(a,d.variant?d.variant.audio:null,d.variant?d.variant.video:null,d.text,b),2)}if(a.g)return e["return"]();a.h.debug("init: completed initial Stream setup");a.C&&a.C.ik&&(a.h.debug("init: calling onInitialStreamsSetup()..."),a.C.ik());_.z(e)})};
|
|
250
|
+
_.t.Db=function(a){var b=this,c,d,e,f;return _.B(function(g){switch(g.a){case 1:if(b.g)return g["return"]();c=yz(a);if(a.Za||null==a.rb||a.Zb)return g["return"]();a.rb=null;if(!a.Hb){g.G(2);break}b.h.debug(c,"skipping update and clearing the buffer");return _.x(g,Bz(b,a,a.ce,a.Hd),3);case 3:return g["return"]();case 2:_.zf(g,4);d=Nz(b,a);null!=d&&(pz(b,a,d),a.Lc=!1);_.Af(g,5);break;case 4:return e=_.Bf(g),_.x(g,Yz(b,e),6);case 6:return g["return"]();case 5:f=Array.from(b.a.values()),cA(b,a),b.B&&
|
|
251
|
+
f.every(function(h){return h.endOfStream})&&(b.h.debug(c,"calling endOfStream()..."),b.C.W.endOfStream().then(function(){if(!b.g){var h=b.C.W.getDuration();h<b.f.presentationTimeline.getDuration()&&(b.f.presentationTimeline.f=h)}}).then(function(){b.C.yg()})),_.z(g)}})};
|
|
252
|
+
_.t.Dk=function(a,b,c,d){var e=Av(d.reader),f=Av(d.reader),g=_.T(d.reader),h=_.T(d.reader),l=_.T(d.reader),m=_.T(d.reader);d=_.Nk(d.reader,d.reader.Ca()-d.reader.getPosition());a=a.startTime+b.startTime+h/g;if(c.includes(e))if("urn:mpeg:dash:event:2012"==e)this.C.Dg();else this.C.onEvent(new _.J("emsg",{detail:{startTime:a,endTime:a+l/g,schemeIdUri:e,value:f,timescale:g,presentationTimeDelta:h,eventDuration:l,id:m,messageData:d}}))};
|
|
253
|
+
_.t.ll=function(a){var b=this,c=!1,d=0;(new _.Ok).M(_.Ed,_.Pk).M(_.Fe,_.Pk).M(_.zd,_.Pk).M(_.Dd,_.Pk).M(_.te,_.Pk).X(_.ve,_.Qk).M("encv",function(e){e.reader.skip(78);_.Pk(e)}).M("pasp",function(e){d=e.start+e.headerSize;var f=_.T(e.reader),g=_.T(e.reader);c=f!==g;b.h.debug("hSpacing\x3d"+f+", vSpacing\x3d"+g+", updatePASP\x3d"+c);e.parser.stop()}).parse(a.data);c&&(a=new _.Ck(new DataView(a.data)),a.seek(d),_.R(a,1),_.R(a,1))};Oz="iterateSegmentReference";_.oB={ITERATOR:Oz,LOOKUP:_.ov};_.w(fA,_.kk);_.t=fA.prototype;_.t.init=function(a,b){var c=a.getMedia();_.kk.prototype.init.call(this,a,b);lA(this,c)};_.t.namespace=function(){return mv};_.t.Uf=function(){return new Xx};_.t.getState=function(){return this.ha};_.t.getDrmInfo=function(){return this.m?this.m.getDrmInfo():null};
|
|
254
|
+
_.t.unload=function(){var a=this;cy(this,!1);this.Zc=!1;if(this.w){var b=this.getTrackManager();b&&b.release();return this.F===iA?Promise.resolve():nA(this).then(function(){a.log.debug(_.jb,a.w);a.w=null;a.Re=0;a.yc=null;a.S=null})}return Promise.resolve()};
|
|
255
|
+
_.t.release=function(){var a=this;return _.B(function(b){if(a.da)return b["return"](a.da);a.da=new Promise(function(c,d){try{var e=a.Sb;a.Sb=null;var f=e;e&&(f=e["catch"](function(){}));f?f=f.then(function(){return _.kk.prototype.release.call(a)}):f=_.kk.prototype.release.call(a);f=f.then(function(){return a.unload()});f.then(function(){hA(a,_.Nm);a.da=null;c()})["catch"](function(g){a.da=null;d(g)})}catch(g){a.da=null,d(g)}});return b["return"](a.da)})};
|
|
256
|
+
_.t.getBufferInfo=function(a){if(this.J){var b=px(this.J),c=new _.Zj(void 0,a);switch(a){case _.ti:return b.video?b.video:c;case _.P:return b.audio?b.audio:c;case _.O:return b.text?b.text:c}return b.total?b.total:c}return this.fd?(b=qw(this.fd),bw(b,a)):_.kk.prototype.getBufferInfo.call(this,a)};_.t.getPosition=function(){return this.A?bz(this.A):_.kk.prototype.getPosition.call(this)};_.t.getPresentationStartTime=function(){return this.f?this.f.presentationTimeline.getPresentationStartTime():null};
|
|
257
|
+
_.t.getDuration=function(){return this.f?this.f.presentationTimeline.getDuration():Infinity};_.t.destroy=function(){var a=this;return _.B(function(b){if(1==b.a)return _.x(b,_.kk.prototype.destroy.call(a),2);if(3!=b.a){if(a.F===iA)return b["return"]();a.log.debug("Destroying player...");a.F=iA;return _.x(b,kA(a),3)}a.o&&(a.o.release(),a.o=null);a.g=null;_.z(b)})};
|
|
258
|
+
_.t.load=function(a){var b=this,c,d,e,f,g,h,l,m;return _.B(function(n){switch(n.a){case 1:if(b.F===iA)return n["return"](Promise.reject(new _.L(_.M,7,7E3)));c=new _.ci;d=function(){return b.Sb!==c};e=function(){b.log.info("Aborting current load");throw new _.L(_.M,7,7E3);};b.Sb=c;_.zf(n,2);d()&&e();if(!b.da){n.G(4);break}_.zf(n,5);return _.x(n,b.da,7);case 7:_.Af(n,6,2);break;case 5:_.Bf(n,2);case 6:d()&&e();case 4:return b.I=new _.Dm,b.Qe=Date.now()/1E3,hA(b,_.Zm),b.w=_.en(a),_.jk(a)&&(b.configuration=
|
|
259
|
+
_.ik(b.Md,a)),b.log.info(_.Ua,b.configuration),b.log.info(_.eb,b.w),(f=b.getTrackManager())&&f.load(),g=b.getSurface().getMedia(),g.loop=!!b.configuration.loop,_.K.R(b.configuration.volume)||b.setVolume(b.configuration.volume),_.K.R(b.configuration.muted)||b.setMuted(b.configuration.muted),OA(b),h=b.w[b.getSourceIndex()],d()&&e(),_.x(n,lA(b,g),8);case 8:return d()&&e(),_.x(n,mA(b,g),9);case 9:return d()&&e(),_.x(n,pA(b,h),10);case 10:return d()&&e(),_.x(n,tA(b,h),11);case 11:return d()&&e(),_.x(n,
|
|
260
|
+
AA(b),12);case 12:return d()&&e(),_.x(n,LA(b),13);case 13:d()&&e();c.resolve();_.Af(n,0);break;case 2:throw m=l=_.Bf(n),d()&&(m=new _.L(_.M,7,7E3)),c.reject(m),b.onError(m),m;}})};_.t.detach=function(){var a=this;return _.B(function(b){return 1==b.a?_.x(b,jA(a),2):b["return"](kA(a))})};_.t.isLive=function(){var a;this.f?(a=this.f.presentationTimeline.isLive())||(a=this.f.presentationTimeline,a=Infinity!=a.f&&!a.o):a=!1;return a};
|
|
261
|
+
_.t.Hg=function(){this.log.debug("User seeking finished");this.H&&BA(this);CA(this)};_.t.getSeekRange=function(){if(this.f){var a=this.f.presentationTimeline;return{start:Mw(a,0),end:Lw(a)}}return{start:0,end:0}};_.t.getPlaybackRate=function(){if(this.zc){var a=this.zc;a=a.j?0:a.g}else a=0;return a};
|
|
262
|
+
_.t.setPlaybackRate=function(a){if(0===a)this.log.warn("A trick play rate of 0 is unsupported!");else if(this.F===eA){this.zc.set(a);this.g.playbackRateChanged(a);var b=this.a,c=1<Math.abs(a);if(a=b.a.get(_.Qe)){var d=a.stream;if(d)if(b.h.debug("setTrickPlay",c),c)(c=d.trickModeVideo)&&!a.Ub&&(b.h.debug("Engaging trick mode stream",c),_.uz(b,c,!1,0),a.Ub=d);else if(d=a.Ub)b.h.debug("Restoring non-trick-mode stream",d),a.Ub=null,_.uz(b,d,!0,0)}}};
|
|
263
|
+
_.t.ia=function(){if(this.f&&this.A){var a=uA(this);if(null==a)a=null;else{if(!ry(this.O,a).text){var b=_.Qx(a.textStreams,this.Ga,this.vc);b.length&&(b=b[0],ry(this.O,a).text=b)}a=ry(this.O,a).text}b=[];for(var c=_.u(bB(this)),d=c.next();!d.done;d=c.next()){d=d.value;var e=Nx(d);e.active=d==a;b.push(e)}return b}return[]};_.t.getPeriods=function(){return this.f.periods};
|
|
264
|
+
_.t.getStats=function(){if(this.F!==eA)return _.Em();CA(this);var a=this.j;if(a.getVideoPlaybackQuality){a=a.getVideoPlaybackQuality();var b=this.I,c=Number(a.totalVideoFrames);b.m=Number(a.droppedVideoFrames);b.j=c}if(this.F===eA){if(a=PA(this))this.I.o=a.bandwidth;a&&a.video&&(b=this.I,c=a.video.height||NaN,b.w=a.video.width||NaN,b.g=c);a=this.g.getBandwidthEstimate();this.I.f=a}return this.I.getStats()};
|
|
265
|
+
_.t.getTimelineCues=function(){return this.wc?_.mf(this.wc.cues()).concat().map(function(a){return{schemeIdUri:a.schemeIdUri,value:a.value,startTime:a.startTime,endTime:a.endTime,id:a.id,eventElement:a.eventElement,type:a.type}}):[]};_.t.resetAbr=function(){this.g&&this.g.reset()};
|
|
266
|
+
_.t.addTextTrack=function(a,b,c,d,e,f){var g=this,h,l,m,n,p,q,r,v,y;return _.B(function(A){if(1==A.a){if(g.F!==eA)throw g.log.error("Must call load() and wait for it to resolve before adding text tracks."),Error("State error!");h=uA(g);l=_.mn;m=g.f.periods.indexOf(h);n=m+1;p=n>=g.f.periods.length?g.f.presentationTimeline.getDuration():g.f.periods[n].startTime;q=p-h.startTime;if(Infinity==q)throw new _.L(1,4,4040);r=new _.Mv(1,0,q,function(){return[a]},0,null,0);v={id:g.Wg++,originalId:null,createSegmentIndex:Promise.resolve.bind(Promise),
|
|
267
|
+
findSegmentPosition:function(){return 1},getSegmentReference:function(E){return 1==E?r:null},adjustSegmentDurations:function(){},getDuration:function(){return q},segmentLookupStrategy:_.ov,initSegmentReference:null,mimeType:d,codecs:e||"",kind:c,encrypted:!1,keyId:null,language:b,label:f||null,type:l.TEXT,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:null,closedCaptions:null};g.Ud.add(v);h.textStreams.push(v);return _.x(A,qz(g.a,v),2)}if(y=_.jz(g.a,_.Be))ry(g.O,h).text=
|
|
268
|
+
y;g.Ud["delete"](v);g.log.debug("Choosing new streams after adding a text stream");NA(g,h);wA(g);return A["return"](Nx(v))})};_.t.ii=function(a){this.log.debug(_.qv,a);try{this.log.debug("onChooseStreams_, choosing variant from ",a.variants);this.log.debug("onChooseStreams_, choosing text from ",a.textStreams);var b=$A(this,a);this.log.debug("onChooseStreams_, chose variant ",b.variant);this.log.debug("onChooseStreams_, chose text ",b.text);return b}catch(c){return this.onError(c),{variant:null,text:null}}};
|
|
269
|
+
_.t.hi=function(){this.log.debug("canSwitch_");this.V=!1;this.configuration.abr.enabled&&this.g.enable();this.ma&&(vz(this.a,this.ma,this.Pg,this.Ig),this.ma=null);this.ga&&(_.uz(this.a,this.ga,!0,0),this.ga=null)};_.t.ji=function(){this.B&&this.B.update&&this.B.update()};_.t.uk=function(){this.A&&this.A.j.Zd()};
|
|
270
|
+
_.t.th=function(a,b,c){if((void 0===c?"":c)===pv)return wA(this),this.ka()||(this.configuration.abr.enabled=!0,this.g.enable()),NA(this,b,!1),!0;if(c=b.variants.some(function(g){var h=!1,l=g[a.type];l&&(h=g.allowedByApplication&&l.id!==a.id,a.type===_.kc&&(h=h&&l.language===a.language));return h})&&this.ka()){for(var d=_.u(b.variants),e=d.next();!e.done;e=d.next()){e=e.value;var f=e[a.type];f&&f.id===a.id&&(e.allowedByApplication=!1)}wA(this);this.ka()||(this.configuration.abr.enabled=!0,this.g.enable());
|
|
271
|
+
NA(this,b)}return c};_.t.gk=function(){this.log.debug("endOfStream called by streaming engine");this.Zc=!0};_.t.onError=function(a){if(this.F!==iA&&7001!==a.code&&7E3!==a.code){var b=new _.J(_.id,{detail:a});a.severity===_.M&&hA(this,_.Ym);this.trigger(b);b.defaultPrevented&&(b.a=!0)}};_.t.ve=function(a){a.type===_.cd?this.dispatchEvent(a):"largegap"!==a.type&&(a.type===_.Ze?oA(this):"emsg"!==a.type&&(a instanceof _.J?this.dispatchEvent(a):this.log.debug(_.xb,a.type)))};_.t.ka=function(){return this.configuration.abr.enabled};
|
|
272
|
+
_.t.fl=function(a){var b=this,c,d,e,f,g,h,l,m;return _.B(function(n){switch(n.a){case 1:if(!b.uc)return n["return"]();b.log.info("Attempt to switch CDN.");c=b.getLoadedSource();d=b.ka();return _.x(n,b.uc(c.url,a),2);case 2:e=n.f;if(!e)return n["return"]();f=_.K.ua(b.getLoadedSource(),{url:e});d&&b.g.disable();return _.x(n,Cz(b.a),3);case 3:g=PA(b);case 4:return h=!1,_.zf(n,7),b.log.info("Switching CDN to "+f.url+"."),_.x(n,cB(b,f,g),9);case 9:_.Af(n,6);break;case 7:return l=_.Bf(n),b.log.info("Switch failed"),
|
|
273
|
+
_.x(n,b.uc(f.url,a),10);case 10:if(m=n.f)f.url=m,h=!0;else throw l;case 6:h?n.G(4):(d&&b.g.enable(),Az(b.a,!0),b.w[b.getSourceIndex()]=f,a.f=!0,b.trigger(new _.J(_.Bc,{newManifest:f.url})),_.z(n))}})};fA.prototype.detach=fA.prototype.detach;var iA=0,dA=1,eA=2,vA=[_.Td,_.od];dB.prototype.a=function(){return mv};
|
|
274
|
+
dB.prototype.canPlay=function(a,b){if(_.fj())return 0;var c=a.type||"",d=(window.ManagedMediaSource?!0:!1)||(window.MediaSource&&MediaSource.isTypeSupported?!0:!1),e=window.ManagedMediaSource||window.MediaSource&&MediaSource.isTypeSupported?c in _.up||_.vp(a.url)in _.wp?!0:!1:!1;if(d&&e){if(_.ji(2))return 1;if(_.gj()&&c===_.Kj){if(b.streaming.preferNativeHlsOnSafari)return 1;_.F("Support for MSE + FairPlay on Apple is experimental. In case of issues, consider using native HLS.")}return 2}return 0};
|
|
275
|
+
dB.prototype.create=function(){return new fA};_.Yf(new dB);_.Rn(function(){_.Sf("MediaSource.install");if(window.MediaSource)if(window.cast&&cast.__platform__&&cast.__platform__.canDisplayType)_.Rf("Patching Chromecast MSE bugs."),iB();else if(_.gj()){var a=navigator.appVersion;a=0<=a.indexOf("Version")?parseInt(a.match(/Version\/(\d+)/)[1],10):13;gB();10>=a?(_.Rf("Blacklisting MSE on Safari \x3c\x3d 10."),window.MediaSource=null):12>=a?(_.Rf("Patching Safari 11 \x26 12 MSE bugs."),eB(),fB()):(_.Rf("Patching Safari 13 MSE bugs."),eB())}else _.ji(2)||_.ji(3)||
|
|
276
|
+
_.ji(4)?hB():_.Rf("Using native MSE as-is.");else _.Rf("No MSE implementation available.")});_.w(jB,_.aq);_.t=jB.prototype;
|
|
277
|
+
_.t.append=function(a){function b(e){if(e.startTime>=e.endTime)_.F("Invalid cue times: "+e.startTime+" - "+e.endTime),e=null;else{var f=e.payload||"";f=f.replace(/<br\s*\/?>/igm,"\n");f=_.Ih(f);f=new VTTCue(e.startTime,e.endTime,f);f.line=-1;try{f.align=_.Dc}catch(g){f.align="middle"}e.writingMode===_.Oe?f.vertical="lr":e.writingMode===_.Pe&&(f.vertical="rl");e=f}e&&c.push(e)}var c=[],d=_.u(a);for(a=d.next();!a.done;a=d.next())b(a.value);a=c.slice().sort(function(e,f){return e.startTime!==f.startTime?
|
|
278
|
+
e.startTime-f.startTime:e.endTime!==f.endTime?e.endTime-f.startTime:c.indexOf(f)-c.indexOf(e)});d=_.u(a);for(a=d.next();!a.done;a=d.next())this.a.addCue(a.value)};_.t.remove=function(a,b){if(!this.a)return!1;kB(this.a,function(c){return c.startTime<b&&c.endTime>a});return!0};_.t.isTextVisible=function(){return this.a.mode==_.me};_.t.setTextVisibility=function(a){null!==this.a&&(this.a.mode=a?_.me:_.md)};_.t.destroy=function(){this.a&&kB(this.a,function(){return!0});this.a=null;return Promise.resolve()};lB.prototype.aa=function(){return!0};lB.prototype.create=function(a){return new jB(a)};_.vm("single-native",new lB);};
|
|
268
279
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
269
280
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
270
281
|
else{_=this.clpp._;(f.call(g,this));}
|