@castlabs/prestoplay 6.9.0 → 6.10.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 +39 -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 +105 -104
- package/cjs/cl.conviva.js +33 -33
- package/cjs/cl.core.js +420 -417
- package/cjs/cl.crypto.js +10 -9
- package/cjs/cl.dash.js +71 -71
- package/cjs/cl.externs.js +11 -12
- package/cjs/cl.freewheel.js +21 -21
- package/cjs/cl.hls.js +72 -71
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +29 -31
- package/cjs/cl.ima.js +22 -22
- package/cjs/cl.mse.js +273 -272
- package/cjs/cl.muxdata.js +14 -15
- 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 +71 -71
- package/cjs/cl.thumbnails.js +24 -24
- package/cjs/cl.tizen.js +68 -68
- 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 +16 -16
- package/cl.adobe.js +3 -3
- package/cl.airplay.js +3 -3
- package/cl.broadpeak.js +5 -5
- package/cl.cast.js +87 -87
- package/cl.conviva.js +27 -27
- package/cl.core.js +363 -359
- package/cl.crypto.js +9 -9
- package/cl.dash.js +67 -67
- package/cl.externs.js +11 -12
- package/cl.freewheel.js +17 -17
- package/cl.hls.js +61 -61
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +26 -25
- package/cl.ima.js +17 -17
- package/cl.mse.js +235 -236
- package/cl.muxdata.js +12 -12
- package/cl.onboard.js +4 -4
- package/cl.persistent.js +9 -9
- package/cl.playlist.js +5 -5
- package/cl.smooth.js +59 -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 +14 -14
- package/cl.vtt.js +12 -12
- package/cl.youbora.js +13 -13
- package/package.json +1 -1
- package/typings.d.ts +47 -2
package/cjs/cl.mse.js
CHANGED
|
@@ -1,281 +1,282 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
_.
|
|
6
|
-
_.
|
|
7
|
-
|
|
8
|
-
_.
|
|
9
|
-
_.
|
|
10
|
-
_.
|
|
11
|
-
|
|
12
|
-
_.
|
|
13
|
-
|
|
14
|
-
_.
|
|
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.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
_.
|
|
22
|
-
_.
|
|
23
|
-
|
|
24
|
-
_.
|
|
25
|
-
c?'CHECKSUM\x3d"'+c+'" ':"",'VALUE\x3d"'+e+'"',"\x3e\x3c/KID\x3e\x3c/PROTECTINFO\x3e",d?
|
|
26
|
-
b,d||null,e,a,c)};
|
|
27
|
-
|
|
28
|
-
_.
|
|
29
|
-
return new
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
_.
|
|
34
|
-
_.
|
|
35
|
-
_.
|
|
36
|
-
_.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
_.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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))};_.
|
|
46
|
-
_.
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return Promise.all(q)}):(f&&window.muxjs&&(a.a||
|
|
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.T&&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=
|
|
53
|
-
q])}null!==d&&null!==e&&(a.F[b]=!0)})["catch"](function(p){throw p;})};
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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=
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
"variant.video",
|
|
64
|
-
|
|
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,
|
|
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};
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
_.
|
|
70
|
-
[]);return b.length?
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
d,null,["id","track"])}))||c.renditions.push(d);return a||d};
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
_.
|
|
79
|
-
null;h?(a.f.set(b,c),
|
|
80
|
-
|
|
81
|
-
a.g=b}};
|
|
82
|
-
|
|
83
|
-
_.
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
2
|
+
var f=function(window){var Yu,Zu,$u,av,bv,cv,dv,ev,fv,gv,hv,kv,lv,ov,pv,qv,rv,sv,uv,wv,yv,zv,Av,Bv,Cv,Ev,Fv,Gv,Jv,Kv,Lv,Mv,Ov,Tv,Uv,Wv,Zv,aw,bw,cw,dw,ew,fw,hw,mw,nw,rw,sw,uw,ww,xw,yw,zw,Aw,Bw,Cw,Ew,Lw,Pw,Rw,Tw,Uw,Vw,Ww,$w,bx,ax,cx,dx,gx,hx,ix,jx,lx,px,nx,rx,sx,tx,ux,wx,vx,xx,zx,Ax,Bx,Dx,Cx,Fx,yx,Gx,Ex,Hx,Nx,Kx,Ix,Lx,Mx,Ox,Px,Sx,Rx,Tx,Ux,Vx,Jx,Wx,Yx,Qx,Zx,$x,ay,by,cy,dy,ey,fy,hy,iy,gy,qy,py,ry,sy,ty,vy,wy,yy,xy,zy,Cy,Ay,By,Ey,Dy,Fy,Gy,Jy,Ly,Ky,My,Ny,Oy,Py,Ry,Sy,Ty,Qy,Vy,Uy,Zy,$y,bz,Yy,Xy,cz,Wy,az,gz,iz,fz,jz,ez,hz,dz,lz,
|
|
3
|
+
kz,nz,pz,rz,sz,xz,Az,Cz,Ez,Hz,Jz,Kz,Nz,Dz,Qz,vz,Rz,tz,Pz,Uz,Sz,Mz,Oz,Xz,Wz,Tz,cA,dA,Yz,fA,Zz,aA,iA,hA,bA,gA,jA,uz,Lz,$z,Iz,wz,yz,zz,eA,Fz,Gz,mA,nA,oA,uA,sA,rA,qA,tA,wA,AA,HA,SA,zA,MA,NA,OA,IA,PA,FA,VA,my,ky,ny,ly,oy,jy,$A,YA,KA,GA,RA,aB,ZA,cB,QA,TA,vA,JA,dB,EA,UA,gB,LA,DA,fB,eB,xA,bB,XA,iB,BA,WA,hB,jB,yA,kB,lB,mB,nB,oB,pB,qB,rB,sB,Hv;Yu=" buffer";Zu=" is being or has been set up";$u="\x3c/DATA\x3e\x3c/WRMHEADER\x3e";av="\x3c/LA_URL\x3e";bv="\x3cLA_URL\x3e";cv='\x3cWRMHEADER xmlns\x3d"http://schemas.microsoft.com/DRM/2007/03/PlayReadyHeader" version\x3d"';
|
|
4
|
+
dv="CHECKSUM";ev="Choosing new streams after key status change";fv="IterateSegmentReference";gv="Jumping forward";hv="MediaSource threw QuotaExceededError:";_.iv="No stream with id";_.jv="Player is in ERROR state and can not switch to ";kv="PrestoPlay TextTrack";lv="Removing audio from variant - audio not compatible with platform";_.mv="Updating manifest...";_.nv="VOD";ov="bufferBehind\x3d";pv="bufferedBehind\x3d";qv="calling onCanSwitch()...";rv="cannot find segment";sv="clpp.mse.Player";uv="currentPeriod.startTime\x3d";
|
|
5
|
+
_.vv="getSegmentNextReference";wv="key-restriction";_.xv="onChooseStreams_";yv="presentationTime:";zv="presentationTime\x3d";Av="reference.endTime\x3d";Bv="reference.position\x3d";Cv="reference.startTime\x3d";_.Dv="subtitles";Ev="switch: Stream ";Fv=function(a,b){for(var c in a.a)b(c,a.a[c])};Gv=function(a){for(var b=a.a+a.f.byteOffset,c=void 0;_.Gk(a);)if(0===_.Ik(a)){c=a.a+a.f.byteOffset-1;break}a=a.f.buffer.slice(b,c);return _.yh(a)};
|
|
6
|
+
_.Iv=function(a){var b=new Uint8Array(Hv),c=4+b.byteLength+a.j.byteLength+4+a.f.byteLength,d=new _.Ck(c,!1);_.T(d,c);_.Ek(d,b);_.Ek(d,a.j);_.T(d,a.f.byteLength);_.Ek(d,a.f);return _.N(d.buffer)};Jv=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.gb.length;e++)if(d.gb[e]===b){c=d;break a}}}c=null}return c?c.Fa:null};Kv=function(a,b){return _.cj("Edge/")?!0:a.M.has(b)};
|
|
7
|
+
Lv=function(a,b){var c=a.m.get(b);return!(!c||c!==_.Ud&&c!==_.pd)};Mv=function(a,b){var c=b.audio,d=b.video;if(c&&c.encrypted&&!Kv(a,_.Xi(c.mimeType,c.codecs))||d&&d.encrypted&&!Kv(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})};_.Nv=function(a,b){return a.concat(b)};Ov=function(){};
|
|
8
|
+
_.Pv=function(a,b){if(0==b.length)return a;var c=b.map(function(d){return new _.Pg(d)});return a.map(function(d){return new _.Pg(d)}).map(function(d){return c.map(d.resolve.bind(d))}).reduce(_.Nv,[]).map(function(d){return d.toString()})};_.Qv=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:b||[],keyIds:[],periodId:c?c:null}};
|
|
9
|
+
_.Rv=function(a,b,c,d,e){this.Oa=a;this.ua=b;this.ea=c;this.keyInfo=d||null;this.Hc=_.K.R(e)?!1:!!e};
|
|
10
|
+
_.Sv=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.ta=g;this.Oa=d;this.ua=e;this.ea=f;this.keyInfo=(void 0===h?null:h)||null;this.Hc=_.K.R(l)?!1:!!l;this.timescale=m;this.horizontalTiles=n;this.verticalTiles=p;this.durationPerTile=q;this.a=r||[];this.g=!1};
|
|
11
|
+
Tv=function(a,b){a=_.ih(a);b=_.ih(b);var c=a.split("-"),d=b.split("-");return c[0]==d[0]&&1==c.length&&2==d.length};Uv=function(a){return a.language?_.ih(a.language):a.audio&&a.audio.language?_.ih(a.audio.language):a.video&&a.video.language?_.ih(a.video.language):_.Ie};
|
|
12
|
+
_.Vv=function(a,b){for(var c=_.ih(a),d=new Set,e=_.u(b),f=e.next();!f.done;f=e.next())d.add(_.ih(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,Tv(f,c))return f;e=_.u(d);for(f=e.next();!f.done;f=e.next()){var g=f=f.value,h=c;g=_.ih(g);h=_.ih(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,Tv(c,e))return e;return null};
|
|
13
|
+
Wv=function(a,b){for(var c in b)if(b[c]===a)return c;return""};
|
|
14
|
+
_.Xv=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={Wc:e.Wc},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.Wc=_.of(g.keyIds||[]).concat();f.keyIds&&f.keyIds.length&&f.keyIds.forEach(function(l){return function(m){l.Wc.includes(m)||l.Wc.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.Wc,periodId:g.periodId});break}return c};_.Yv=function(a,b){return a.length&&b.length?0<_.Xv(a,b).length:!0};
|
|
16
|
+
Zv=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};_.$v=function(a){if(_.tq.has(a))return _.tq.get(a);if(window.ManagedMediaSource){var b=ManagedMediaSource.isTypeSupported(a);_.tq.set(a,b);return b}return window.MediaSource?(b=MediaSource.isTypeSupported(a),_.tq.set(a,b),b):!1};
|
|
17
|
+
aw=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))};bw=function(a,b){a.j=!0;a.f=new _.fi;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
|
+
cw=function(a,b){var c=b.replace(/mp2t/i,_.Gd);a==_.mc&&(c=c.replace(_.Re,_.mc));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
|
+
dw=function(a,b){return!window.muxjs||"mp2t"!=a.toLowerCase().split(";")[0].split("/")[1]&&"aac"!=a.toLowerCase().split(";")[0].split("/")[1]?!1:b?_.$v(cw(b,a))||_.$v(a.replace(/aac/i,_.Gd)):_.$v(cw(_.mc,a))||_.$v(a.replace(/aac/i,_.Gd))||_.$v(cw(_.Re,a))};
|
|
20
|
+
ew=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(_.Re,'video/mp4;codecs\x3d"'+h+'"'):h.startsWith("mp4a")&&e.set(_.mc,'audio/mp4;codecs\x3d"'+h+'"')}return 0<e.size?e:c}catch(l){return c}};fw=function(a){var b=[a.mimeType];_.uq.forEach(function(c,d){var e=a[d];e&&b.push(c+'\x3d"'+e+'"')});return b.join(";")};
|
|
21
|
+
_.gw=function(a){a=a.split(".");var b=a[0];a.pop();return[b,a.join(".")]};hw=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};_.iw=function(a,b){return Array.prototype.filter.call(a.childNodes,function(c){return c instanceof Element&&c.tagName==b})};_.jw=function(a,b){var c=_.iw(a,b);return 1!=c.length?null:c[0]};
|
|
22
|
+
_.kw=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};_.lw=function(a,b){var c=new DOMParser,d=null,e=null;try{e=c.parseFromString(a,_.Ee)}catch(f){}e&&e.documentElement.tagName==b&&(d=e.documentElement);return d&&0<d.getElementsByTagName("parsererror").length?null:d};
|
|
23
|
+
mw=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};nw=function(a,b,c,d,e,f){f=void 0===f?null:f;_.Bl.call(this,a,b,d);this.version=e;this.g=c;this.m=f};_.pw=function(a,b){return b===a.version?a:_.ow(b,a.a,a.m||void 0,a.g||void 0)};
|
|
24
|
+
_.ow=function(a,b,c,d){var e=_.Qh(b);if(8!==e.byteLength)e="";else{var f=mw(e);e=_.Nh(f);b:switch(f=f.byteLength,_.Uf("Trying to create PlayReady header in version",a),a){case "4.0.0.0":e=[cv+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?bv+d+av:"",$u].join("");break b;case "4.1.0.0":e=[cv+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?bv+d+av:"",$u].join("");break b;case "4.2.0.0":case "4.3.0.0":e=[cv+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?bv+d+av:"",$u].join("");break b;default:_.G("Cannot create PlayReady header in version",a),e=""}}if(!e)return null;_.Uf("New payload",e);e=_.N(_.Dh(e,!0));return new nw(qw,
|
|
26
|
+
b,d||null,e,a,c)};rw=function(a){a=_.jw(a,"PROTECTINFO");if(!a)return null;var b=_.jw(a,"KID");if(!b)return null;a=b.getAttribute("VALUE");if(!a)return null;var c=b.getAttribute(dv);b=b.getAttribute("ALGID");return{value:a,xe:c,vh:b}};
|
|
27
|
+
sw=function(a){a=_.jw(a,"PROTECTINFO");if(!a)return null;a=_.jw(a,"KIDS");if(!a)return null;var b=_.iw(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(dv);d=d.getAttribute("ALGID");a.push({value:c,xe:e,vh:d})}}return a.length?a:null};
|
|
28
|
+
_.tw=function(a){a:{a=new _.Fk(new DataView(a.buffer),!0);_.U(a);for(_.Jk(a);_.Gk(a);)if(1===_.Jk(a)){var b=_.Jk(a);a=_.Nk(a,b);break a}a=null}b=_.Ah(a,!0);var c=_.lw(b,"WRMHEADER");b=c.getAttribute("version");var d=_.jw(c,"DATA");c=(c=_.jw(d,"LA_URL"))?_.kw(c):"";var e;if(e=_.jw(d,"KID"))if(e=_.kw(e)){var f=_.jw(d,dv);e={value:e,xe:f?f.textContent.trim():null}}else e=null;else e=null;d=e?[e]:(e=rw(d))?[e]:(d=sw(d))?d:null;e=d&&d[0]||{};d=e.xe;e=_.Ph(void 0===e.value?"":e.value);e=mw(e);e=_.Rh(e);
|
|
29
|
+
return new nw(qw,e,c,a,b,d)};uw=function(a,b){return a.start-b.start};_.vw=function(a){this.m=a;this.log=new _.I("clpp.renditions");this.S=[];this.j=this.a=null;this.g=!1};ww=function(a){return a.S.map(function(b){return{start:b.start,end:b.end,width:b.width,height:b.height,bandwidth:b.bandwidth,rendition:b.rendition}})};xw=function(a){a.a&&a.a.trigger(new _.J(_.rc))};
|
|
30
|
+
yw=function(a){if(a.a){for(var b=!1,c={},d=0;d<a.S.length;d++){var e=a.S[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(_.Fe,a.f,a),a.g=!0):!b&&a.g&&(a.log.debug("Stop tracking timeupdates"),a.a.off(_.Fe,a.f),a.g=!1)}};zw=function(a,b,c){a.S=a.S.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(_.Ue))};
|
|
31
|
+
Aw=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};Bw=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};Cw=function(a,b){for(var c=0;c<a.length;c++)if(Bw(a[c]).has(b))return c;return-1};
|
|
32
|
+
Ew=function(a,b){Array.from(Bw(a)).forEach(function(c){c.segmentIndex&&_.Dw(c.segmentIndex,b)})};_.Fw=function(a){this.g=Math.exp(Math.log(.5)/a);this.f=this.a=0};_.Gw=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)};_.Hw=function(a){return a.a/(1-Math.pow(a.g,a.f))};
|
|
33
|
+
_.Iw=function(a,b,c,d,e,f,g,h){a=_.ai(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
|
+
_.Jw=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.J=void 0===d?!0:d;this.h=new _.I("clpp.media.PresentationTimeline");this.H=e;this.I=null};_.Kw=function(a,b){a.o=b;a.w=b};Lw=function(a){return a.o?a.f:a.w?a.g:null};
|
|
35
|
+
_.Nw=function(a,b,c){if(0!=b.length){var d=b[b.length-1].endTime+c;_.Mw(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.J&&(a.A=(Date.now()+a.D)/1E3-(a.g||0)-a.a);a.h.debug("notifySegments: maxSegmentDuration\x3d"+a.a)}};_.Mw=function(a,b){a.j=null==a.j?b:Math.min(a.j,b)};_.Ow=function(a,b){a.a=Math.max(a.a,b);a.h.debug("notifyNewSegmentDuration: maxSegmentDuration\x3d"+a.a)};
|
|
36
|
+
_.Qw=function(a){return Infinity==a.m?0:Math.max(0,Pw(a)-a.m)};Pw=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};_.Sw=function(a,b){var c=Math.max(a.j,0);return Infinity==a.m?Math.ceil(1E3*c)/1E3:Math.max(c,Math.min(Pw(a)-a.m+b,Rw(a)))};Rw=function(a){return Math.max(0,Pw(a)-(a.o||a.w?0:a.F))};Tw=function(){this.f=function(){};this.a=new Set};Uw=function(a,b){a.f=b};
|
|
37
|
+
Vw=function(a,b,c){this.g=a;this.a=b;this.f=c;this.h=new _.I("clpp.media.SegmentIterator")};Ww=function(a){var b=a.g.get(a.a);if(!b)return null;0<b.a.length&&b.Oa().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};_.Xw=function(a){this.a=a;this.h=new _.I("clpp.media.SegmentIndex")};_.Yw=function(a){return a.a.length?a.a[a.a.length-1].endTime:0};_.Zw=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
|
+
$w=function(a,b){var c=a.Fc(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 Vw(a,c,e)};_.Dw=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)};bx=function(a){var b=this;this.f=a;this.a=new Set;this.g=(new _.$i(function(){ax(b,!1)})).fb(.25)};
|
|
39
|
+
ax=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
|
+
cx=function(a){var b=this;this.m=a;this.j=new Map;this.a=function(){};this.f=function(){};this.g=function(){};this.w=[{rc:null,qc:2,fc:function(c,d){return b.a(c,d)}},{rc:1,qc:2,fc:function(c,d){return b.a(c,d)}},{rc:3,qc:2,fc:function(c,d){return b.a(c,d)}},{rc:2,qc:1,fc:function(c,d){return b.f(c,d)}},{rc:2,qc:3,fc:function(c,d){return b.f(c,d)}},{rc:1,qc:3,fc:function(c,d){return b.g(c,d)}},{rc:3,qc:1,fc:function(c,d){return b.g(c,d)}}]};dx=function(a,b,c,d){a.a=b;a.f=c;a.g=d};
|
|
41
|
+
_.ex=function(a){_.yp[a]&&delete _.yp[a]};_.fx=function(a){_.wp[a]&&delete _.wp[a]};gx=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
|
+
hx=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
|
+
ix=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
|
+
jx=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 _.Eg(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))};_.kx=function(a){a=a.toLowerCase();return _.Tp[a]||window.muxjs&&a==_.ec?!0:!1};lx=function(){this.a=new muxjs.mp4.CaptionParser;this.m=[];this.j={}};_.mx=function(){};
|
|
46
|
+
_.ox=function(a,b,c,d,e){this.j=a;this.B=c;this.f={};this.M=!1;this.a=null;this.g={};this.m=new _.eg;this.J=!1;this.A={};this.H=b;this.D=d;this.K=e;this.T=this.K.streaming.maxSegmentToMediaOffset||1;this.I=new _.fi;this.w="";this.F={};this.o=nx(this,this.I);this.N=!0;this.h=new _.I("clpp.mse.MediaSourceEngine")};px=function(a){var b=_.Xi(a.mimeType,a.codecs),c=fw(a);return _.kx(b)||_.$v(c)||dw(b,a.type)};
|
|
47
|
+
nx=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.N=!0});a.m.on(c,"endstreaming",function(){a.N=!1});a.w=qx(c);a.j.src=a.w;return c}c=new MediaSource;a.w=qx(c);a.m.one(c,"sourceopen",function(){URL.revokeObjectURL(a.w);b.resolve()});a.j.src=a.w;return c};
|
|
48
|
+
rx=function(a,b){b.forEach(function(c,d){var e=a.o.addSourceBuffer(c);a.m.on(e,_.jd,a.U.bind(a,d));a.m.on(e,"updateend",a.Sc.bind(a,d));a.f[d]=e;a.g[d]=[];a.F[d]=!1});a.M=b.has(_.mc)&&b.has(_.Re)};sx=function(a){return a.K.streaming.ignoreManagedMediaSourceStreamingHints?!0:a.N};tx=function(a,b){a.a||(a.a=new gx(a.K,a.B));var c=a.a;if(b!=_.ec){var d=_.Tp[b];if(!d)throw new _.L(_.M,2,2012,"Text parser is unavailable for "+b);c.w=new d(c.D)}};ux=function(a){return a.o?a.o.readyState==_.id:!0};
|
|
49
|
+
wx=function(a){var b={};b.total=new _.Zj(a.j.buffered,"total");b.audio=vx(a,_.mc);b.video=vx(a,_.Re);var c=[];a.a&&(c=[{start:a.a.ub(),end:a.a.Da()}]);b.text=hw(c,_.Ce);return b};vx=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}};xx=function(a,b){if(!a.f[b])return"";var c=vx(a,b);return c?c.toString():""};
|
|
50
|
+
zx=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===_.Re&&null!==d&&null!==e&&h&&(m=0<n?l.buffered.end(n-1):-1);b==_.Ce?c=hx(a.a,c,d,e):a.A[b]?c=bw(a.A[b],c).then(function(p){p.captions&&0<p.captions.length&&(a.a||tx(a,_.De),jx(a.a,p.captions,d,e,a.f.video.timestampOffset));var q=[];0<p.audio.byteLength&&a.f.audio&&q.push(yx(a,_.mc,a.Be.bind(a,_.mc,p.audio.buffer)));0<p.video.byteLength&&a.f.video&&q.push(yx(a,_.Re,a.Be.bind(a,_.Re,p.video.buffer)));
|
|
51
|
+
return Promise.all(q)}):(f&&window.muxjs&&(a.a||tx(a,_.De),null==d&&null==e?a.H.init(c):a.H.g(c,function(p){p.length&&jx(a.a,p,d,e,a.f.video.timestampOffset)})),c=yx(a,b,a.Be.bind(a,b,c)));return c.then(function(){if(b===_.Re&&null!==d&&null!==e&&!h)a.D.append(d,e,g),null!==d&&null!==e&&a.h.debug("Appended video segment ",d,e,"Buffer:",xx(a,b));else if(b===_.mc&&null!==d&&null!==e)xw(a.D),null!==d&&null!==e&&a.h.debug("Appended audio segment ",d,e,"Buffer:",xx(a,b));else if(b===_.Re&&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.T&&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=yx(a,b,function(){a.hh(b,r)}),q=yx(a,b,a.ig.bind(a,b,!1)),Promise.all([p,
|
|
53
|
+
q])}null!==d&&null!==e&&(a.F[b]=!0)})["catch"](function(p){throw p;})};Ax=function(a,b){var c=a.Da(_.Re)||0;ix(a.a,b,c)};Bx=function(a){a.a&&ix(a.a,"",0)};Dx=function(a,b,c,d,e){if(b==_.Ce)return a.a.A=c,a=a.a,a.j=d,a.m=e,Promise.resolve();b=Cx(a,b,c,d,e);a.M&&(b=b.concat(Cx(a,_.mc,c,d,e)));return Promise.all(b)};Cx=function(a,b,c,d,e){return[yx(a,b,a.th.bind(a,b)),yx(a,b,a.hh.bind(a,b,c)),yx(a,b,a.il.bind(a,b,d,e))]};Fx=function(a,b){Ex(a,function(){a.o.duration=b})};
|
|
54
|
+
yx=function(a,b,c){if(a.J)return Promise.reject();c={start:c,p:new _.fi};a.g[b].push(c);1===a.g[b].length&&Gx(a,b);return c.p};Gx=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})),Hx(a,b)}else a.h.debug("No more scheduled operations for "+b)};
|
|
55
|
+
Ex=function(a,b){if(a.J)return Promise.reject();var c=[],d;for(d in a.f){var e=new _.fi,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)Hx(a,l);return h},function(){for(var g in a.f)a.g[g].length&&a.g[g].shift();return Promise.reject()})};Hx=function(a,b){a.g[b].shift();Gx(a,b)};
|
|
56
|
+
Nx=function(a,b,c,d){var e=a.periods.flatMap(function(n){return n.variants});if(b.length||c.length)e=Ix(e,b,c);e=Jx(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={le:c.le},d++)c.le=b[d],l=new Set(_.of(l).concat().filter(function(n){return function(p){return n.le.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=Kx(e);var m=Lx(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(Mx(n)===m)return!0;_.Uf("Dropping Variant (better codec available)",n);return!1})};Kx=function(a){var b=new _.ag;a=_.u(a);for(var c=a.next();!c.done;c=a.next()){c=c.value;var d=Mx(c);b.push(d,c)}return b};
|
|
58
|
+
Ix=function(a,b,c){var d={};b=_.u(b);for(var e=b.next();!e.done;d={qe:d.qe},e=b.next())if(d.qe=e.value,e=a.filter(function(f){return function(g){return g.video&&g.video.codecs.startsWith(f.qe)}}(d)),e.length){a=e;break}d={};c=_.u(c);for(b=c.next();!b.done;d={je:d.je},b=c.next())if(d.je=b.value,b=a.filter(function(f){return function(g){return g.audio&&g.audio.codecs.startsWith(f.je)}}(d)),b.length){a=b;break}return a};
|
|
59
|
+
Lx=function(a){var b="",c=Infinity;Fv(a,function(d,e){var f=e.reduce(function(g,h){return g+h.bandwidth||0},0)/e.length;_.Uf(_.Oc,d,"avg bandwidth",f);f<c&&(b=d,c=f)});return b};Mx=function(a){var b="";a.video&&(b=_.gw(a.video.codecs)[0]);var c="";a.audio&&(c=_.gw(a.audio.codecs)[0]);return b+"-"+c};
|
|
60
|
+
Ox=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};Px=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=Ox(e,b,c);f!=e.allowedByApplication&&(d=!0)}return d};
|
|
61
|
+
Sx=function(a,b,c,d){var e=!1;d.variants=d.variants.filter(function(m){if(a&&a.da&&!Mv(a,m))return _.Uf("Dropping variant - not compatible with key system",m),!1;var n=m.audio,p=m.video;if(n&&!px(n)){var q=n.codecs;0<=n.codecs.indexOf("ec-3")?(_.Uf("Trying to use AC-3 for EC-3"),n.codecs=n.codecs.replace("ec-3","ac-3"),px(n)?_.Tf("Using AC-3 instead of EC-3 for",Qx(n)):(n.codecs=q,_.Tf(lv,Qx(n)),m.audio=null,e=!0,n=null)):(_.Tf(lv,Qx(n)),m.audio=null,e=!0,n=null)}return p&&!px(p)?(_.Tf("Dropping variant - video not compatible with platform",
|
|
62
|
+
Qx(p)),!1):n&&b&&!Rx(n,b)?(_.Tf("Dropping variant - not compatible with active audio","active audio",Qx(b),"variant.audio",Qx(n)),!1):p&&c&&!Rx(p,c)?(_.Tf("Dropping variant - not compatible with active video","active video",Qx(c),"variant.video",Qx(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?(_.Tf("Dropping variant - not compatible with video + audio",
|
|
63
|
+
"variant.video",Qx(m.video)),!1):!0}))}d.textStreams=d.textStreams.filter(function(m){var n=_.kx(_.Xi(m.mimeType,m.codecs));n||_.Uf("Dropping text stream. Is not supported by the platform.",m);return n})};Rx=function(a,b){return a.mimeType!=b.mimeType||a.codecs.split(".")[0]!=b.codecs.split(".")[0]?!1:!0};
|
|
64
|
+
Tx=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",
|
|
65
|
+
bandwidth:a.bandwidth,language:a.language,originalLanguage: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,
|
|
66
|
+
a.width=c.width||null,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.originalLanguage=b.originalLanguage,a.channelsCount=b.channelsCount,a.audioBandwidth=b.bandwidth||null,a.label=b.label,a.audioRoles=b.roles);return a};
|
|
67
|
+
Ux=function(a){return{id:a.id,active:!1,type:_.Ce,bandwidth:0,language:a.language,originalLanguage:a.originalLanguage,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,
|
|
68
|
+
keyId:null}};Vx=function(a){return a.allowedByApplication&&a.allowedByKeySystem};Jx=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
|
+
_.Xx=function(a,b,c){b=_.tg(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=_.Vv(_.ih(g),a.map(function(l){return l.language}));return h?(d=a.filter(function(l){return _.ih(l.language)===h}),!0):!1});if(c){b=Wx(d,c);if(b.length)return b;_.G("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(_.Nv,
|
|
70
|
+
[]);return b.length?Wx(d,b[0]):d};Wx=function(a,b){return a.filter(function(c){return c.roles.includes(b)})};Yx=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
|
+
Qx=function(a){var b=fw(a);return a.type===_.mc?"type\x3daudio mimeType\x3d"+a.mimeType+" codecs\x3d"+a.codecs+" codecInfo\x3d"+b+" bandwidth\x3d"+a.bandwidth+" channelsCount\x3d"+a.channelsCount:a.type===_.Re?"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
|
+
Zx=function(a,b){var c=String(_.zi++);c=new _.ui(c,a);c.mimeType=_.vi(b.mimeType);if(a===_.P||a===_.R)c.label=_.vi(b.label),c.language=_.vi(b.language),c.originalLanguage=_.vi(b.originalLanguage);a===_.wi?(c.frameRate=b.frameRate,c.roles=b.roles):a===_.R?(c.channelsCount=b.channelsCount,c.roles=b.audioRoles||[],c.mimeType=_.vi(b.audioMimeType)):(c.kind=_.vi(b.kind),c.roles=b.roles);c.accessibility=a===_.wi||a===_.R?(b.accessibility||[]).filter(function(d){return d.type===a}):b.accessibility||[];return c};
|
|
73
|
+
$x=function(a,b,c){var d=new _.Ci(a===_.wi?""+b.videoId:a===_.R?""+b.audioId:""+b.id,c);switch(a){case _.wi:d.codec=_.vi(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 _.R:d.codec=_.vi(b.audioCodec);d.bandwidth=b.audioBandwidth||b.bandwidth;d.originalId=b.originalAudioId;d.drm={keyId:b.keyId||void 0};break;default:d.codec=_.vi(b.codecs),d.originalId=b.originalTextId}(a=c.renditions.find(function(e){return _.K.pa(e,
|
|
74
|
+
d,null,["id","track"])}))||c.renditions.push(d);return a||d};ay=function(a,b){var c=a.reduce(function(d,e){b===_.wi?null===e.videoId||d[e.videoId]&&!e.active||(d[e.videoId]=e):b===_.R&&(null===e.audioId||d[e.audioId]&&!e.active||(d[e.audioId]=e));return d},{});return Object.values(c)};by=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
|
+
cy=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};dy=function(){this.h=new _.I("cl.api.mse.TrackManager");this.l=null;this.g=[];this.a=new Map;this.f=new Map};ey=function(a,b){return a.g.filter(function(c){return c.type===b})};fy=function(a,b){var c=a.a.get(b)||null;return c&&c.track};hy=function(a,b,c){c&&fy(a,c.type)===c&&!a.l.ka()||gy(a,b,c&&c.renditions[0])};
|
|
76
|
+
iy=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
|
+
gy=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===_.P){var f=e.ia().find(function(n){return n.id==c.id});f&&(a.f.set(b,c),iy(a,c),e.trigger(new _.J(_.Uj)),jy(e,!0).then(function(){ky(e,f)})["catch"](function(n){a.h.warn("Error while activating track",n)}))}else if(b===
|
|
78
|
+
_.R)a.f.set(b,c),ly(e,parseInt(c.id,10));else if(b===_.wi){var g=a.a.get(_.R)||null,h=null;if(g){var l=my(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=my(e).find(function(n){return n.videoId==c.id})||
|
|
79
|
+
null;h?(a.f.set(b,c),ny(e,h,d)):a.h.warn("Cannot find matching variant")}}else a.h.debug(_.Ba+b),fy(a,b)&&(b===_.P?jy(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===_.R?a.h.info("Enabling ABR for audio is not supported"):ny(e,null,d))}};
|
|
80
|
+
qy=function(a){if(a.l){a.h.debug("Track list change detected, updating track list");for(var b=[],c=_.u(Object.values(_.sq)),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={Yb:c.Yb},e=d.next()){e=e.value;c.Yb=Zx(_.P,e);var f=b.find(function(h){return function(l){return h.Yb.pa(l)}}(c));c.Yb=f||c.Yb;var g=$x(_.P,e,c.Yb);e.active&&a.a.set(_.P,g);f||b.push(c.Yb)}oy(a.l)||a.a.set(_.P,null);c=my(a.l);py(a,b,c,_.wi);py(a,b,c,_.R);
|
|
81
|
+
a.g=b}};py=function(a,b,c,d){var e=ay(c,d);c={};e=_.u(e);for(var f=e.next();!f.done;c={Zb:c.Zb},f=e.next()){f=f.value;c.Zb=Zx(d,f);var g=b.find(function(l){return function(m){return l.Zb.pa(m)}}(c));c.Zb=g||c.Zb;var h=$x(d,f,c.Zb);f.active&&a.a.set(d,h);g||b.push(c.Zb)}};
|
|
82
|
+
ry=function(a,b,c){if(b){a.g.length||qy(a);for(var d=b.type,e=a.a.get(d)||null,f,g=_.u(ey(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&&(iy(a,f),d===_.R?a.l.trigger(new _.J(_.Tj)):d===_.wi&&a.l.trigger(new _.J(_.Ve,{details:{width:f.width||0,height:f.height||0,bandwidth:f.bandwidth,track:f.track,abrSelection:c}})))}};sy=function(){this.f=new _.Fw(2);this.g=new _.Fw(5);this.a=0};ty=function(a,b){return 128E3>a.a?b:Math.min(_.Hw(a.f),_.Hw(a.g))};
|
|
83
|
+
_.uy=function(){this.h=new _.I("clpp.abr");this.w=null;this.j=!1;this.f=new sy;this.o=[];this.m=1;this.B=this.A=!1;this.a=this.g=null};vy=function(a,b){a&&(b=b.filter(function(c){return Ox(c,a,{width:Infinity,height:Infinity})}));return b.sort(function(c,d){return c.bandwidth-d.bandwidth})};wy=function(){this.a=new Map};yy=function(a,b){a.a.has(b)||a.a.set(b,new xy);return a.a.get(b)};xy=function(){this.text=this.variant=null};
|
|
84
|
+
zy=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)};Cy=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&&Ay(c,d)&&By(c.roles,d.roles))}!c&&(c=a.video&&b.video)&&(c=a.video,d=b.video,c=!(Ay(c,d)&&By(c.roles,d.roles)));return c?!1:!0};
|
|
85
|
+
Ay=function(a,b){if(a.mimeType!=b.mimeType)return!1;var c=a.codecs.split(",").map(function(f){return _.gw(f)[0]}),d=b.codecs.split(",").map(function(f){return _.gw(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};By=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
|
+
Ey=function(a){this.a=a;this.f=new Dy(a.language,"",a.audio&&a.audio.channelsCount?a.audio.channelsCount:0)};Dy=function(a,b,c){this.g=_.tg(a);this.a=b;this.f=c};Fy=function(a,b){var c=null;b.some(function(d){c=_.Vv(_.ih(d),a.map(function(e){return Uv(e)}));return!!c});return c?a.filter(function(d){return c===Uv(d)}):[]};Gy=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
|
+
Jy=function(a,b){this.a=Hy;this.f=(new Map).set(Hy,b).set(Iy,a)};
|
|
88
|
+
Ly=function(a){var b=this;this.C=a;this.a=a.getConfiguration().streaming;this.f=new _.eg;this.h=new _.I("clpp.mse.media.LiveEdgeObserver");Ky(this)&&(a=this.C.getSurface().getMedia(),this.f.on(a,_.Fe,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."),
|
|
89
89
|
b.C.setPlaybackRate(b.a.chasingRate)):1<e&&c<=f&&(b.h.debug("On live edge, reduce playback rate."),b.C.setPlaybackRate(1))}))};
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
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>=
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
!g.g.paused){var h
|
|
99
|
-
|
|
100
|
-
b;a.h.debug("Playhead outside safe region \x26 in unbuffered region.");return d}
|
|
101
|
-
|
|
90
|
+
Ky=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};My=function(a){this.g=a;this.a=null;this.f=function(){}};Ny=function(a,b){a.f=b};
|
|
91
|
+
Oy=function(a){var b=this;this.a=a;this.j=!1;this.g=this.a.Ke();this.f=new _.$i(function(){b.a.Vj(.25*b.g)})};Py=function(a){a.f.stop();var b=a.j?0:a.g;0<=b?a.a.Ke()!=b&&a.a.gh(b):(a.f.fb(.25),0!=a.a.Ke()&&a.a.gh(0))};Ry=function(a,b){this.g=a;this.m=Qy(a);this.a=a.a.currentTime;this.j=Date.now()/1E3;this.o=b;this.f=function(){}};Sy=function(a,b){a.f=b};Ty=function(a){this.a=a};
|
|
92
|
+
Qy=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};Vy=function(a,b,c,d,e){var f=this;this.a=a;this.F=b;this.m=c;this.D=e;this.g=new _.eg;this.B=!1;this.I=a.readyState;this.j=!1;this.f=d;this.o=this.H=this.A=!1;this.g.on(a,_.Ze,function(){return Uy(f)});this.w=(new _.$i(function(){Uy(f)})).fb(.25)};
|
|
93
|
+
Uy=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=Qy(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>=Rw(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:_.Tf("Ignoring large gap at",c,"size",g)}if(b||h)0==e?_.Tf(gv,g,"seconds because of gap before start time of",f):_.Tf(gv,g,"seconds because of gap starting at",d.end(e-1),"and ending at",f),a.a.currentTime=f}}}}};
|
|
95
|
+
Zy=function(a,b,c,d){this.a=a;this.j=b;this.o=d;this.A=c;this.m=!1;this.f=new _.eg;this.g=new Wy(a);this.w=!1;0<a.readyState?Xy(this,c):Yy(this,c)};$y=function(a){return a.m?a.a.currentTime:a.A};bz=function(a,b){0<a.a.readyState?az(a.g,b):Yy(a,b)};Yy=function(a,b){a.A=b;a.f.off(a.a,_.xd);a.f.one(a.a,_.xd,function(){Xy(a,b)})};Xy=function(a,b){a.w||(a.w=!0,a.o&&a.o());.001>Math.abs(a.a.currentTime-b)?cz(a):(a.f.one(a.a,_.me,function(){cz(a)}),az(a.g,0==a.a.currentTime?b:a.a.currentTime))};
|
|
96
|
+
cz=function(a){_.ej()&&!a.m&&a.j();a.m=!0;a.f.on(a.a,_.me,function(){return a.j()})};Wy=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?(_.G(["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--)})};az=function(a,b){a.g=a.f.currentTime;a.m=b;a.j=a.o;a.f.currentTime=b;a.a.fb(.1)};
|
|
97
|
+
gz=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 Vy(a,b.presentationTimeline,c,dz(this,a,c),f);this.f=new Zy(a,function(){a:{var h=g.j;h.B=!0;h.A=!1;h.j=!1;h=$y(g.f);var l=ez(g,h);if(.001<Math.abs(l-h)){var m=(new Date).getTime()/1E3;if(!g.w||g.w<m-1){g.w=m;bz(g.f,l);h=void 0;break a}}g.h.debug("Seek to "+h);g.A();h=void 0}return h},fz(this,d),function(){g.j.H=!0});this.o=(new _.$i(function(){if(0!=g.g.readyState&&
|
|
98
|
+
!g.g.paused){var h=$y(g.f),l=_.Sw(g.a,0),m=Rw(g.a);3>m-l&&(l=m-3);h<l&&(l=ez(g,h),g.h.info("Jumping forward "+(l-h)+" seconds to catch up with the seek range."),g.g.currentTime=l)}})).fb(.25);this.h=new _.I("clpp.mse.Playhead")};iz=function(a){var b=$y(a.f);return 0<a.g.readyState&&!a.g.paused?hz(a,b):b};fz=function(a,b){null==b?b=Infinity>a.a.getDuration()?_.Sw(a.a,0):Rw(a.a):0>b&&(b=Rw(a.a)+b);return jz(a,hz(a,b))};jz=function(a,b){var c=a.a.getDuration();return b>=c?c-a.m.durationBackoff:b};
|
|
99
|
+
ez=function(a,b){var c=new _.Zj(a.g.buffered);c=c.hc.bind(c);var d=Math.max(a.B,a.m.rebufferingGoal),e=a.m.safeSeekOffset,f=_.Sw(a.a,0),g=Rw(a.a),h=a.a.getDuration();3>g-f&&(f=g-3);var l=_.Sw(a.a,d),m=_.Sw(a.a,e);d=_.Sw(a.a,d+e);if(b>=h)return a.h.debug("Playhead past duration."),jz(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};hz=function(a,b){var c=_.Sw(a.a,0);if(b<c)return c;c=Rw(a.a);return b>c?c:b};
|
|
101
|
+
dz=function(a,b,c){if(!c.stallEnabled)return null;var d=c.gapDetectionThreshold,e=c.stallSkip;c=new Ry(new Ty(b),c.stallThreshold);Sy(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/")||_.mi()||_.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=
|
|
102
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};
|
|
103
|
-
|
|
104
|
-
a;if(0===g.length||!e)throw _.
|
|
105
|
-
|
|
106
|
-
b.start);b=_.
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
_.y(q)}})};
|
|
110
|
-
|
|
111
|
-
c)};
|
|
112
|
-
|
|
113
|
-
_.
|
|
114
|
-
var g=a.m[f];if(g&&g.
|
|
115
|
-
(
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
(a.m[b].P.resolve(),a.m[b].
|
|
121
|
-
|
|
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.
|
|
123
|
-
|
|
124
|
-
n=
|
|
125
|
-
l=_.u(a.a.values());for(m=l.next();!m.done;m=l.next())m=m.value,c(m)||(m=
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
c),d=b.stream.segmentIterator.next().value),null===d&&a.h.warn(
|
|
129
|
-
Math.max(0,c-1))),a=f||
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
0;v.then(function(){return a.g||a.A?null
|
|
133
|
-
|
|
134
|
-
_.L&&
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
h,b).then(function(){return
|
|
139
|
-
|
|
140
|
-
a.C.
|
|
141
|
-
"Appending segment with "+(
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
f,f+h).then(function(){a.g||a.h.debug(d,"evicted "+h+" seconds")})};
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
h.variant.audio);h.text&&l.set(_.
|
|
149
|
-
for(h=g.next();!h.done;h=g.next())h=h.value,(m=l.get(h))?(_.
|
|
150
|
-
|
|
151
|
-
c);c=a.C.Db.fetch(f);b.Fb=c;return c.P.then(function(g){var h=a.C.
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
this.configuration.preferredAudioChannelCount);this.Ia=this.configuration.preferredTextLanguage;this.T=this.Ac=null;this.Cc=new Map;this.na=null;this.xc=this.configuration.preferredTextRole;a&&a(this);this.
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
{detail:{bufferedTimeMS:-1,reason:e}})):d===_.
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
a.J.destroy(),9);case 9:a.J=null;case 8:a.
|
|
163
|
-
|
|
164
|
-
|
|
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);
|
|
166
|
-
|
|
167
|
-
if(n.length){n=a.getPeriods();for(var q=0;q<n.length;q++)for(var r=n[q],v=_.u(r.variants),z=v.next();!z.done;z=v.next()){z=z.value;var A=[];z.audio&&A.push(z.audio);z.video&&A.push(z.video);A=_.u(A);for(var
|
|
168
|
-
(
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
r}});a.isLive()&&a.configuration.streaming.enableLiveEdgeChasing&&(a.
|
|
173
|
-
h.next();!l.done;l=h.next())m=l.value,
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
d,"buffered to end",b,"state",a.getState()),
|
|
178
|
-
|
|
179
|
-
a.g.disable())};
|
|
180
|
-
|
|
181
|
-
b.id});f?(a.T=f.video.id,
|
|
182
|
-
|
|
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.Ac=d.id;a.g.setVariants(f);f=
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
b).variant=c};
|
|
187
|
-
|
|
188
|
-
encrypted:!1,keyId:null,language:g.closedCaptions.get(l),label:null,type:_.
|
|
189
|
-
|
|
190
|
-
e.video;!g||1<
|
|
191
|
-
|
|
192
|
-
g.initDataType,g.initData,g.keyId)}}}};
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
a.g.chooseVariant())};
|
|
197
|
-
|
|
198
|
-
{variant:c,text:null}};
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
missingKeys:g,restrictedKeyStatuses:h});};
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
return _.x(
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
_.
|
|
212
|
-
|
|
213
|
-
_.
|
|
214
|
-
_.
|
|
215
|
-
b);this.S.push(c);this.S.sort(
|
|
216
|
-
_.
|
|
217
|
-
{detail:{width:b,height:c,bandwidth:a?a.bandwidth:null,rendition:a}}))}}}};_.
|
|
218
|
-
|
|
103
|
+
lz=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).L(_.Fd,c).L(_.Ge,c).L(_.Ad,c).L(_.Ed,c).L(_.ue,c).Y(_.we,function(m){e=m;f.push(m);_.Qk(m)}).Y("encv",b).Y("enca",b).Y("avc1",function(m){g.push({L:m,Rc:1701733238})}).Y("avc3",function(m){g.push({L:m,Rc:1701733238})}).Y("ac-3",function(m){g.push({L:m,Rc:1701733217})}).Y("ec-3",function(m){g.push({L:m,Rc:1701733217})}).Y("mp4a",function(m){g.push({L:m,Rc:1701733217})}).parse(a);if(d)return _.Tf("Init segment already indicates encryption."),
|
|
104
|
+
a;if(0===g.length||!e)throw _.Vf("Failed to find boxes needed to fake encryption!"),_.Vf("Failed init segment (hex):",_.Rh(a)),new _.L(_.M,3,14E3);g.reverse();for(var h=_.u(g),l=h.next();!l.done;l=h.next())l=l.value,_.Tf('Inserting "'+_.Tk(l.Rc)+'" box into init segment.'),a=kz(a,e,l.L,f,l.Rc);return a};
|
|
105
|
+
kz=function(a,b,c,d,e){var f=mz.value(),g=a.subarray(c.start,c.start+c.size),h=_.vh(g),l=new Uint8Array(c.size+f.byteLength);l.set(g,0);g=_.vh(l);g.setUint32(4,e);l.set(f,c.size);e=h.getUint32(4);g.setUint32(c.size+16,e);nz(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,nz(e,d.start,d.size+l.byteLength);l=_.vh(e,
|
|
106
|
+
b.start);b=_.Uk(b);a=l.getUint32(b);l.setUint32(b,a+1);return e};nz=function(a,b,c){a=_.vh(a,b);b=a.getUint32(0);0!=b&&(1==b?(a.setUint32(8,c>>32),a.setUint32(12,c&4294967295)):a.setUint32(0,c))};_.oz=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 _.I("clpp.mse.Streaming");this.D=!1};
|
|
107
|
+
pz=function(a){var b=a.a.get(_.Re);return b?a.f.periods[b.Cb]:(b=a.a.get(_.mc))?a.f.periods[b.Cb]:null};rz=function(a){return _.qz(a,_.mc)};sz=function(a){return _.qz(a,_.Re)};
|
|
108
|
+
xz=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=_.nn,_.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,tz(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.zb(),n=uz(a,m),p=vz(b,n,0),a.a.set(c.TEXT,p),wz(a,p,0));
|
|
109
|
+
_.y(q)}})};Az=function(a){a.I=!0;var b=a.a.get(_.Ce);b&&(yz(b),zz(b)["catch"](function(){}),a.a["delete"](_.Ce))};Cz=function(a,b,c,d){b.video&&_.Bz(a,b.video,c,d);b.audio&&_.Bz(a,b.audio,c,d)};
|
|
110
|
+
Ez=function(a){function b(l){return a.C.W.hc(l,c,0)}var c=a.C.zb(),d=!1,e=uz(a,c);if(_.lh(a.a.values(),function(l){return l.Cb==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)||(Dz(a,h),d=!0)}else if(!_.lh(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())Dz(a,f.value);d=!0}d||a.h.debug("(all): seeked: buffered seek: presentationTime\x3d"+
|
|
111
|
+
c)};Hz=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=Fz(d);if(d.Oc||b&&Gz(d))a.h.info(e,"Retrying after failure..."),d.Oc=!1,wz(a,d,.1)}};
|
|
112
|
+
Jz=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,yz(e),e.ab&&e.Fb&&(e.ab=!1,b.push(e.Fb.abort())),e.Ib&&b.push(Iz(a,e,!0,0));return _.x(f,Promise.all(b),0)})};Kz=function(a,b,c){(a=a.a.get(b))&&c&&(yz(a),a.stream=c,a.Rb=c,a.sa&&(a.sa=c.getSegmentReference(a.sa.position)),a.sa||(a.Rb=null))};_.qz=function(a,b){var c=a.a.get(b);return c?c.Vb||c.stream:null};
|
|
113
|
+
_.Bz=function(a,b,c,d){var e=a.a.get(b.type);if(!e&&b.type==_.Ce&&a.j.ignoreTextStreamFailures)xz(a,b);else if(e){var f=Lz(a,b);if(c&&f!=e.Cb)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())Dz(a,c.value);else{e.Vb&&(a.h.debug("switch during trick play mode",b),b.trickModeVideo?(e.Vb=b,b=b.trickModeVideo,a.h.debug("switch found trick play stream",b)):(e.Vb=null,a.h.debug("switch found no special trick play stream")));
|
|
114
|
+
var g=a.m[f];if(g&&g.Uc&&(g=a.o.get(b.id))&&g.Uc)if(e.stream!=b){g=a.f.presentationTimeline.getDuration();var h=a.C.zb();h=Mz(a,e,h);!c&&(e.endOfStream||h>=g)?a.h.debug(Ev+Fz(e)+" already buffered to the end. Not switching."):(b.type==_.Ce&&tx(a.C.W,_.Xi(b.mimeType,b.codecs)),e.stream=b,e.stream.segmentIterator=null,e.td=!0,a.h.debug("switch: switching to Stream "+Fz(e)),Nz(a,e,f)&&(a.h.info("Aborting current segment request to switch."),e.Fb.abort()),c&&(e.$b?e.ge=!0:e.ab?(e.Ib=!0,e.Ld=d,e.ge=!0):
|
|
115
|
+
(yz(e),Iz(a,e,!0,d)["catch"](function(l){if(a.C)a.C.onError(l)}))))}else a.h.debug(Ev+Fz(e)+" already active")}}};Nz=function(a,b,c){if(!b.Fb)return!1;var d=a.C.zb(),e=a.C.W.Da(b.type);c=(c=Oz(a,b,d,e,c))?c.ea?c.ea-c.ua+1:null:null;if(null==c)return!1;var f=b.stream.initSegmentReference;f&&(c+=(f.ea?f.ea-f.ua+1:null)||0);f=a.C.He().getBandwidthEstimate();if(8*c/f<(null===e?0:e-d)-Math.max(a.f.minBufferTime||0,a.j.rebufferingGoal))return!0;a=b.Fb;a=a.j?a.j.bytesRemaining:-1;return 0>a||a>c?!0:!1};
|
|
116
|
+
Dz=function(a,b){var c=Fz(b);b.$b?a.h.debug(c,"clear: already clearing the buffer"):b.Ib?a.h.debug(c,"clear: already waiting"):b.ab?(a.h.debug(c,"clear: currently updating"),b.Ib=!0,b.Ld=0):null==a.C.W.ub(b.type)?(a.h.debug(c,"clear: nothing buffered"),null==b.tb&&wz(a,b,0)):(a.h.debug(c,"clear: handling right now"),yz(b),Iz(a,b,!1,0)["catch"](function(d){if(a.C)a.C.onError(d)}))};
|
|
117
|
+
Qz=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.zb(),g=uz(a,f),h=_.nn,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"]();Pz(a);return _.x(q,tz(a,m),3)}if(a.g)return q["return"]();l.forEach(function(r,v){if(!a.a.has(v)){var z=vz(r,g,e);a.a.set(v,z);wz(a,z,0)}});_.y(q)})};
|
|
118
|
+
vz=function(a,b,c){return{stream:a,type:a.type,Rb:null,segmentIterator:null,sa:null,Vb:null,td:!0,Cb:b,endOfStream:!1,ab:!1,tb:null,Ib:!1,Ld:0,ge:!1,$b:!1,mf:!1,Oc:!1,eh:c||0,Fb:null,Od:!1,xg:0}};
|
|
119
|
+
Rz=function(a,b){var c=a.m[b];if(c)return a.h.debug("(all) Period "+b+Zu),c.P;a.h.debug("(all) setting up Period "+b);c={P:new _.fi,Uc:!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:tz(a,d)}).then(function(){a.g||
|
|
120
|
+
(a.m[b].P.resolve(),a.m[b].Uc=!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
|
+
tz=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+Zu),c.push(g.P)):(a.h.debug("(all) setting up Stream "+f.id),a.o.set(f.id,{P:new _.fi,Uc:!1}),c.push(f.createSegmentIndex()));_.Bf(r,2);return _.x(r,Promise.all(c),4);case 4:if(a.g)return r["return"]();_.Cf(r,3);break;case 2:h=_.Df(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.Uc||(q.P.resolve(),q.Uc=!0,a.h.debug("(all) setup Stream "+p.id));_.y(r)}})};Pz=function(a){var b=a.f.presentationTimeline.getDuration();Infinity>b?Fx(a.C.W,b):Fx(a.C.W,Math.pow(2,32))};
|
|
123
|
+
Uz=function(a,b){function c(p){return p.type==_.Ce&&p.stream.mimeType==_.ec}if(c(b))return Ax(a.C.W,b.stream.originalId||""),null;b.type==_.Ce&&Bx(a.C.W);if(!sx(a.C.W)&&b.type!=_.Ce)return a.j.bufferLimitUpdateInterval?a.j.bufferLimitUpdateInterval/2:.5;var d=Fz(b),e=a.C.zb(),f=Mz(a,b,e);a.h.debug(d,"timeNeeded\x3d"+f);var g=Lz(a,b.stream),h=uz(a,f),l=a.C.W.Ja(b.type,e);a.h.debug(d,"update_:",zv+e,"bufferedAhead\x3d"+l);var m=Math.max(a.f.minBufferTime||0,a.j.rebufferingGoal,a.j.bufferingGoal)*a.w,
|
|
124
|
+
n=Lw(a.f.presentationTimeline);if(null!=n&&f>=n&&!b.Od)return Sz(a,b),null;b.endOfStream=!1;b.Cb=h;if(h!=g)return a.h.debug(d,"need Period "+h,zv+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.Da(b.type);h=Oz(a,b,e,h,g);if(!h)return a.f.presentationTimeline.isLive()||b.type===_.Ce?a.j.bufferLimitUpdateInterval||1:(a.h.debug("Media state "+d+": no next segment found. Assuming EOS."),Sz(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=Mz(a,m,e),d=Math.min(d,m));if(f>=d+a.f.presentationTimeline.a)return a.j.bufferLimitUpdateInterval||1;b.eh=0;Tz(a,b,e,g,h)["catch"](function(){});return null};Sz=function(a,b){a.h.debug(Fz(b),"buffered to end of presentation");b.endOfStream=!0;if(b.type==_.Re){var c=a.a.get(_.Ce);c&&c.stream.mimeType==_.ec&&(c.endOfStream=!0)}};
|
|
126
|
+
Mz=function(a,b,c){if(!b.Rb||!b.sa)return Math.max(c,b.eh);c=Lz(a,b.Rb);return a.f.periods[c].startTime+b.sa.endTime};
|
|
127
|
+
Oz=function(a,b,c,d,e){if(b.stream.segmentLookupStrategy===Vz)b.stream.segmentIterator?a=Ww(b.stream.segmentIterator):b.sa||d?(e=b.sa?b.sa.endTime:d,a.h.info(fv,"looking up segment from new stream endTime:",e),b.stream.segmentIterator=$w(b.stream.segmentIndex,e),d=b.stream.segmentIterator.next().value,null===d&&(b.stream.segmentIterator=null,a.h.warn(fv,rv,"endTime:",e,b.sa)),a=d):(e=Math.max(c,0),a.h.info(fv,"looking up segment","lookupTime:",e,yv,c),d=null,d||(b.stream.segmentIterator=$w(b.stream.segmentIndex,
|
|
128
|
+
c),d=b.stream.segmentIterator.next().value),null===d&&a.h.warn(fv,rv,"lookupTime:",e,yv,c),a=d);else{var f=Fz(b);b.sa&&b.stream==b.Rb?(d=b.sa.position+1,a.h.debug(f,"next position known:","position\x3d"+d),a=Wz(a,b,e,d)):(b.sa?(a.h.debug(f,"next position unknown: another Stream buffered"),c=Lz(a,b.Rb),c=Xz(a,b,a.f.periods[c].startTime+b.sa.endTime,e)):(a.h.debug(f,"next position unknown: nothing buffered"),c=Xz(a,b,d||c,e)),null==c?a=null:(f=null,null!=d||null!==a.j&&a.j.ignoreDrift||(f=Wz(a,b,e,
|
|
129
|
+
Math.max(0,c-1))),a=f||Wz(a,b,e,c)))}return a};Xz=function(a,b,c,d){var e=Fz(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:",zv+c,"lookupTime\x3d"+f,uv+d.startTime,"Result: segment position\x3d"+b);null==b&&a.h.warn(e,"cannot find segment:",uv+d.startTime,"lookupTime\x3d"+f);return b};
|
|
130
|
+
Wz=function(a,b,c,d){var e=Fz(b);c=a.f.periods[c];var f=b.stream.getSegmentReference(d);if(!f)return a.h.debug(e,"segment does not exist:",uv+c.startTime,"position\x3d"+d),null;var g=a.f.presentationTimeline;d=_.Qw(g);g=Pw(g);return!b.Od&&(c.startTime+f.endTime<d||c.startTime+f.startTime>g)?(a.h.debug(e,"segment is not available:",uv+c.startTime,Cv+f.startTime,Av+f.endTime,"availabilityStart\x3d"+d,"availabilityEnd\x3d"+g),null):f};
|
|
131
|
+
Tz=function(a,b,c,d,e){var f,g,h,l,m,n,p,q,r,v,z,A,D;return _.B(function(F){f=_.nn;g=Fz(b);h=a.f.periods[d];a.h.debug(g,"fetchAndAppend_:",zv+c,uv+h.startTime,Bv+e.position,Cv+e.startTime,Av+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=Yz(a,b,d,q,r,e);b.ab=!0;b.td=!1;a.h.debug(g,"fetching segment");z=!1;A=function(E,H){if(a.g||a.A)return null;z=!0;return Zz(a,b,c,h,l,e,E,H)};D=a.C.W.Da(b.type)||
|
|
132
|
+
0;v.then(function(){return a.g||a.A?null:$z(a,b,e,!1,function(E){return A(E.data,!0)})}).then(function(E){return a.g||a.A?null:z||null===E?(aA(a,b,D,e,l),null):A(E,!1)}).then(function(){if(!a.g&&!a.A){aA(a,b,D,e,l);b.ab=!1;b.mf=!1;b.Ib||a.C.ce();if(m){var E=m.next().value;E&&a.h.debug("New iterated segment",E)}wz(a,b,0);bA(a,b,l);a.h.debug(g,"finished fetch and append")}})["catch"](function(E){return _.B(function(H){if(a.g||a.A)return H["return"]();b.ab=!1;if(b.type==f.TEXT&&a.j.ignoreTextStreamFailures)return 1001==
|
|
133
|
+
E.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),H.G(0);if(7001==E.code)return b.ab=!1,b.tb=null,wz(a,b,0),H.G(0);if(3017===E.code)return cA(a,b,E),H.G(0);if(1001===E.code&&E.data&&404===E.data[1])return a.h.warn(g,"request for segment failed","segment not available on server",Bv+e.position,Cv+e.startTime,Av+e.endTime,"error\x3d"+E),b.ab=!1,b.tb=null,wz(a,b,1),H.G(0);if(b.type===f.TEXT)return E instanceof
|
|
134
|
+
_.L&&E.a(1),yz(b),a.C.onError(new _.L(1,2,2010,E)),H.G(0);if(1001<=E.code&&1003>=E.code)return _.x(H,dA(a,b,h,E),0);a.h.error(g,"failed fetch and append: code\x3d"+E.code);b.Oc=!0;E instanceof _.L&&E.a(_.M);return _.x(H,eA(a,E),0)})});_.y(F)})};
|
|
135
|
+
cA=function(a,b,c){var d=Fz(b);if(Array.from(a.a.values()).some(function(f){return f!=b&&f.mf}))a.h.debug(d,hv,"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.Oc=!0;a.A=!0;a.C.onError(c);return}a.h.warn(d,hv,"reducing buffering goals by "+(100-Math.round(100*a.w))+"%");b.mf=!0}wz(a,b,4)};
|
|
136
|
+
dA=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.ue(b.stream,c));if(!f)return g.G(0);b.Oc=!0;d.a(_.M);return _.x(g,eA(a,d),0)})};
|
|
137
|
+
Yz=function(a,b,c,d,e,f){c=a.f.periods[c].startTime-f.ta;if(!b.td&&c===b.xg)return Promise.resolve();b.xg=c;var g=Fz(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=Dx(a.C.W,b.type,c,d,e);if(!b.stream.initSegmentReference||!b.td)return d;a.h.debug(g,"fetching init segment");e=$z(a,b,b.stream.initSegmentReference,!0).then(function(h){if(a.g)return null;a.h.debug(g,"appending init segment");return fA(a,
|
|
138
|
+
h,b).then(function(){return zx(a.C.W,b.type,h,null,null,!!b.stream.closedCaptions&&0<b.stream.closedCaptions.size)})})["catch"](function(h){b.td=!0;return Promise.reject(h)});return Promise.all([d,e])};fA=function(a,b,c){var d;return _.B(function(e){if(!a.j.patchEdgeWhenMixedContent||!_.bj())return e.G(0);d=lz(b);return _.x(e,zx(a.C.W,c.type,d.buffer,null,null,!!c.stream.closedCaptions&&0<c.stream.closedCaptions.size),0)})};
|
|
139
|
+
Zz=function(a,b,c,d,e,f,g,h){h=void 0===h?!1:h;var l,m,n,p,q,r,v,z,A;return _.B(function(D){switch(D.a){case 1:l=Fz(b);if(!(e&&e.keyId&&a.C.ld)){D.G(2);break}m=Jv(a.C.ld,e.keyId);if(!m){a.h.warn("Unable to find DRM session for "+e.keyId);D.G(2);break}_.Bf(D,4);return _.x(D,m,6);case 6:_.Cf(D,2);break;case 4:n=_.Df(D),a.h.warn("DRM session load failed!",n);case 2:if(!(e.encrypted&&e.keyId&&a.C.ld&&Lv(a.C.ld,e.keyId))){D.G(7);break}yz(b);p=Lz(a,e);q=gA(a,p);if(!q){D.G(8);break}return _.x(D,q,8);case 8:return r=
|
|
140
|
+
a.C.ue(e,d,wv),v=f.startTime+d.startTime,z=f.endTime+d.startTime,a.h.warn(l,"Blocked append for "+v+" - "+z+": "+r+". Stream with Key ID "+(e.keyId+" has restrictions.")),D["return"](Promise.resolve());case 7:return A=e.closedCaptions&&0<e.closedCaptions.size,null!=e.emsgSchemeIdUris&&0<e.emsgSchemeIdUris.length&&(new _.Ok).Y("emsg",a.Ok.bind(a,d,f,e.emsgSchemeIdUris)).parse(g),D["return"](hA(a,b,c).then(function(){if(a.g)return null;var F=f.startTime+d.startTime,E=f.endTime+d.startTime;a.h.debug(l,
|
|
141
|
+
"Appending segment with "+(F.toFixed(3)+" - "+E.toFixed(3)+" KeyID: ")+(e.keyId+" Width: ")+(e.width+" Height: "+e.height+" Bitrate: ")+(_.Jh(e.bandwidth)+" Fragment: ")+h);return zx(a.C.W,b.type,g,F,E,A,e.id,h)}).then(function(){a.g||(a.h.debug(l,"appended media segment"),b.Rb=e,b.sa=f)}))}})};
|
|
142
|
+
aA=function(a,b,c,d,e){if(!a.f.presentationTimeline.isLive()&&b.type!==_.Ce){var f=Fz(b),g=(a.C.W.Da(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.Od=!0,a=a.f.periods,e.adjustSegmentDurations(d.position,c),d=Cw(a,e),b=a[d],e=e.getDuration(),Ew(b,e),e=d+1;e<a.length;e++)a[e].startTime+=c}};
|
|
143
|
+
iA=function(a,b,c){(new _.Ok).L(_.Fd,_.Pk).L(_.Ge,_.Pk).L(_.Ad,_.Pk).L(_.Ed,_.Pk).L(_.ue,_.Pk).Y(_.we,_.Qk).L("encv",function(d){d.reader.skip(78);_.Pk(d)}).L(_.oe,_.Pk).L("schi",_.Pk).L("tenc",function(d){d.reader.skip(6);if(_.Ik(d.reader)){d.reader.skip(1);var e=_.Rh(_.Nk(d.reader,16));e!==b.stream.keyId&&(a.h.debug(Fz(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
|
+
hA=function(a,b,c){if(a.g)return Promise.resolve();var d=Fz(b);a.h.debug(d,"checking buffer length");var e=Math.max(a.j.bufferBehind,a.f.presentationTimeline.a),f=a.C.W.ub(b.type);if(null==f)return a.h.debug(d,"buffer behind okay because nothing buffered:",zv+c,ov+e),Promise.resolve();var g=c-f,h=g-e;if(.01>=h)return a.h.debug(d,"buffer behind okay:",zv+c,pv+g,ov+e,"underflow\x3d"+Math.abs(h)),Promise.resolve();a.h.debug(d,"buffer behind too large:",zv+c,pv+g,ov+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")})};bA=function(a,b,c){if(!a.B){b=Fz(b);var d=Array.from(a.a.values());1!=d.length||d[0].type!=_.Ce?a.B=d.every(function(e){return e.type==_.Ce||a.D?!0:!e.Ib&&!e.$b&&e.sa}):a.D&&(a.B=!0);a.B&&(a.h.debug(b,"startup complete"),c=Lz(a,c),gA(a,c))}};
|
|
146
|
+
gA=function(a,b){var c=null;a.m[b]||(c=Rz(a,b).then(function(){a.g||(a.h.debug(qv),a.C.af())})["catch"](Ov));for(var d=0;d<a.f.periods.length;++d)Rz(a,d)["catch"](Ov);a.C.Kk&&(a.h.debug("calling onStartupComplete()..."),a.C.Kk());return c};
|
|
147
|
+
jA=function(a,b){var c=Fz(b),d=Lz(a,b.stream);if(b.Cb!=d){var e=b.Cb,f=Array.from(a.a.values());f.every(function(g){return g.Cb==e})?f.every(Gz)?(a.h.debug(c,"all need Period "+e),Rz(a,e).then(function(){if(!a.g)if(f.every(function(n){var p=Gz(n),q=Lz(a,n.stream);return p&&n.Cb==e&&q!=e})){var g=a.f.periods[e];a.h.debug(c,"calling onChooseStreams()...");var h=a.C.bf(g);a.D=!h.variant&&!!h.text;var l=new Map;h.variant&&h.variant.video&&l.set(_.Re,h.variant.video);h.variant&&h.variant.audio&&l.set(_.mc,
|
|
148
|
+
h.variant.audio);h.text&&l.set(_.Ce,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!=_.Ce){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==_.Ce)Qz(a,null,null,l.get(_.Ce),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))?(_.Bz(a,m,!1,0),wz(a,a.a.get(h),0)):a.a["delete"](h);a.h.debug(c,qv);a.C.af()}else a.h.debug(c,"ignoring transition to Period",e,"since another is happening")})["catch"](Ov)):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)}};uz=function(a,b){var c=Aw(a.f.periods,b+_.qq);return c?a.f.periods.indexOf(c):0};Lz=function(a,b){return Cw(a.f.periods,b)};
|
|
150
|
+
$z=function(a,b,c,d,e){d=void 0===d?!1:d;e=void 0===e?null:e;var f=_.Iw(c.Oa(),c.ua,c.ea,a.j.attemptParameters,c.startTime,c.endTime,b.type,c.timescale);f.type=2;f.onFragment=c.Hc?null:e;f.disableFragmentSupport=c.Hc||a.j.disableFragmentSupport;f.disableMergedFragments=a.j.disableMergedFragments;if(e=c.f())f.keyInfo=e,f.onFragment=null;d&&(f.responseModifiers.push(function(g){iA(a,b,g.data)}),b.type===_.Re&&a.j.overridePasp&&f.responseModifiers.push(a.xl.bind(a)));a.h.debug("fetching: reference\x3d",
|
|
151
|
+
c);c=a.C.Db.fetch(f);b.Fb=c;return c.P.then(function(g){var h=a.C.He(),l=g.timeMs,m=g.data.byteLength;l&&m&&!d&&h.segmentDownloaded(l,m);b.Fb=null;return g.data})};
|
|
152
|
+
Iz=function(a,b,c,d){var e,f,g,h;return _.B(function(l){if(1==l.a)return e=Fz(b),b.Ib=!1,b.ge=!1,b.Ld=0,b.$b=!0,b.stream.segmentIterator=null,a.h.debug(e,"clearing buffer"),d?(g=a.C.zb(),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.sa=null;b.$b=!1;b.endOfStream=!1;b.Od=!1;wz(a,b,0);_.y(l)})};
|
|
153
|
+
wz=function(a,b,c){a.h.debug(Fz(b),"updating in "+c+" seconds");b.tb=(new _.Yi(function(){var d;return _.B(function(e){if(1==e.a)return _.Bf(e,2),_.x(e,a.Eb(b),4);if(2!=e.a)return _.Cf(e,0);d=_.Df(e);if(a.C)a.C.onError(d);_.y(e)})})).aa(c)};yz=function(a){null!=a.tb&&(a.tb.stop(),a.tb=null)};zz=function(a){return _.B(function(b){return a.Fb?_.x(b,a.Fb.abort(),0):b.G(0)})};
|
|
154
|
+
eA=function(a,b){var c;return _.B(function(d){switch(d.a){case 1:if(a.g)return d["return"]();if(!a.C.ih){d.G(2);break}_.Bf(d,3);return _.x(d,a.C.ih(b),5);case 5:_.Cf(d,2);break;case 3:c=_.Df(d),c.cause=b,b=c;case 2:if(!b.f)a.C.onError(b);_.y(d)}})};Fz=function(a){return"("+a.type+":"+a.stream.id+")"};Gz=function(a){return!a.ab&&null==a.tb&&!a.Ib&&!a.$b};
|
|
155
|
+
mA=function(a){_.kk.call(this,sv);var b=this;this.F=kA;this.j=this.Sb=this.da=null;this.We=0;this.Cg=2;this.hd=null;this.Ue=!1;this.o=new _.eg;this.Xa=this.Sd=this.Bc=this.sc=this.A=this.J=this.m=null;this.bd=!1;this.g=this.f=this.B=this.a=this.yc=this.H=null;this.fh=1E9;this.Xd=new Set;this.V=!0;this.ma=null;this.Yg=!1;this.Qg=0;this.ga=null;this.N=new wy;this.Zg={width:Infinity,height:Infinity};this.I=null;this.ha=_.Om;this.zc=new Dy(this.configuration.preferredAudioLanguage||[],this.configuration.preferredAudioRole,
|
|
156
|
+
this.configuration.preferredAudioChannelCount);this.Ia=this.configuration.preferredTextLanguage;this.T=this.Ac=null;this.Cc=new Map;this.na=null;this.xc=this.configuration.preferredTextRole;a&&a(this);this.Ve=null;this.o.on(window,"online",function(){b.F===lA&&Hz(b.a)})};
|
|
157
|
+
nA=function(a){return new _.vw(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,_.of(e.value.renditions))}return d.find(function(f){return f.id==b})||null})};
|
|
158
|
+
oA=function(a,b){if(a.ha!==b)if(a.ha===_.Zm&&b!==_.Om)a.log.info(_.jv+Wv(b,_.Xm));else{var c=a.We;c=0===c?0:Date.now()-c;var d=a.ha;a.ha=b;a.We=Date.now();a.I&&_.zm(a.I.a,a.ha);b===_.Tm&&(a.Cg=a.Te?1:2);var e=a.Cg,f={currentState:a.ha,previousState:d,timeSinceLastStateChangeMS:c,reason:b===_.Tm||d===_.Tm?e:void 0};a.log.info(_.eb+Wv(d,_.Xm)+" -\x3e "+(Wv(b,_.Xm)+(b!==_.Tm?"":"["+Wv(e,_.Wm)+"]")));a.trigger(new _.J(_.re,{detail:f}));(b===_.Vm||b===_.Zm)&&a.Xa&&a.Xa.stop();b===_.Tm?a.trigger(new _.J(_.wc,
|
|
159
|
+
{detail:{bufferedTimeMS:-1,reason:e}})):d===_.Tm&&a.trigger(new _.J(_.vc,{detail:{bufferedTimeMS:c,reason:e}}))}};uA=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===pA?e["return"](Promise.reject(new _.L(_.M,7,7E3))):_.x(e,qA(a),2);case 2:return _.x(e,rA(a),3);case 3:c=_.mi(4)||_.mi(5);if(!b&&!c){e.G(0);break}d=a.getSurface().getMedia();return _.x(e,sA(a,d),5);case 5:return _.x(e,tA(a,d),0)}})};
|
|
160
|
+
sA=function(a,b){a.j||(a.o.on(b,_.jd,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()};rA=function(a){a.j&&(a.o.off(a.j,_.jd),a.j=null);return Promise.resolve()};
|
|
161
|
+
qA=function(a){var b;return _.B(function(c){switch(c.a){case 1:a.F!==pA&&(a.F=kA);if(b=a.j)a.o.off(b,_.wd),a.o.off(b,_.$d),a.o.off(b,_.Vd),a.o.off(b,_.id),a.o.off(b,_.ee),a.o.off(b,_.ce);a.sc&&(a.sc.release(),a.sc=null);a.Xa&&(a.Xa.stop(),a.Xa=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.Sd&&(a.Sd.release(),a.Sd=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.N.clear(),a.H=null,a.Xd.clear(),a.f=null,a.I=null,a.V=!0,a.Cc.clear(),a.bd=!1,vA(a),_.y(c)}})};
|
|
163
|
+
tA=function(a,b){var c,d,e;return _.B(function(f){if(1==f.a)return c=window.muxjs?new lx:new _.mx,d=_.xm(a.configuration,["html","single-native"]),a.K=d.create(a),a.hd=nA(a),a.hd.track(a),e=new _.ox(b,c,a.K,a.hd,a.configuration),_.x(f,e.I,2);a.J=e;_.y(f)})};wA=function(a,b){var c,d;return _.B(function(e){if(1==e.a)return c=a.getNetworkEngine(),d=a,_.x(e,_.vp(b.url,c,a.configuration.manifest.attemptParameters,b.type||null),2);d.B=e.f;a.B.configure(a.configuration.manifest);_.y(e)})};
|
|
164
|
+
AA=function(a,b){var c;return _.B(function(d){a.yc=new Tw;Uw(a.yc,function(e){xA(a,_.pg,e)});c=new _.gi(Promise.resolve().then(function(){var e,f,g;return _.B(function(h){switch(h.a){case 1:if(a.f){h.G(3);break}_.Bf(h,4);e=a;return _.x(h,a.B.start(b.url,yA(a)),6);case 6:e.f=h.f;_.Cf(h,1);break;case 4:f=_.Df(h);if(!a.wc)throw f;return _.x(h,a.wc(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);zA(a.f.periods);_.y(h)}})}),function(){a.log.info("Aborting parser step...");return a.B.stop()});return _.x(d,c.P,0)})};
|
|
166
|
+
HA=function(a){var b,c,d,e,f;return _.B(function(g){switch(g.a){case 1:a.m=new _.Kl({Db:a.getNetworkEngine(),onError:function(h){return a.onError(h)},df:function(h){if(a.a){var l=BA(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),z=v.next();!z.done;z=v.next()){z=z.value;var A=[];z.audio&&A.push(z.audio);z.video&&A.push(z.video);A=_.u(A);for(var D=A.next();!D.done;D=A.next()){D=D.value;var F=z.allowedByKeySystem;if(D.keyId){var E=h[p?"00":D.keyId];E=!!E&&!CA.includes(E);z.allowedByKeySystem=E}F!==z.allowedByKeySystem&&(E=D.type,D.type===_.Re&&(E="video "+D.width+"x"+D.height+"@"+_.Jh(D.bandwidth)),a.log.warn("DRM Key not available for KID: '"+
|
|
168
|
+
(D.keyId+"'. Applying restrictions to "+E)));r===l&&F!==z.allowedByKeySystem&&(m=!0)}}}if(h=pz(a.a))if(p=rz(a.a),n=sz(a.a),p=Yx(p,n,h.variants),!p||p.allowedByKeySystem)a.log.info(ev),DA(a),EA(a,h.variants);m&&h!==l&&(a.log.info(ev),DA(a),EA(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.Ae(h)},getConfiguration:function(){return a.getConfiguration()},Mc:function(){return a.Mc()}});
|
|
169
|
+
FA(a);c=(b=a.configuration.drm)?b.offlineId||"":"";d=[];e=_.op(a.f.periods);if(!c){g.G(2);break}f=_.mk(_.Wd);if(!f){g.G(2);break}return _.x(g,f.Xk(b,e,a.getNetworkEngine()),4);case 4:return _.x(g,f.oj(c),5);case 5:d=g.f;case 2:return _.x(g,_.Pl(a.m,e,d),6);case 6:a.f&&GA(a,a.f.periods),_.y(g)}})};
|
|
170
|
+
SA=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===_.me&&a.Yd?(a.H.a=Iy,vA(a)):r.type===_.Ze&&a.getState()===_.bn&&.1>a.getBufferInfo().Ja(a.getPosition())?(a.H.a=Iy,vA(a)):a.H&&IA(a));JA(a)},d=function(){if(a.j){var r=a.j.playbackRate;0!=r&&a.Bc.set(r)}},a.o.on(b,_.$d,c),a.o.on(b,_.Vd,c),a.o.on(b,_.id,c),a.o.on(b,_.me,c),a.o.on(b,_.le,c),a.o.on(b,_.ce,c),a.o.on(b,_.Ze,c),a.o.on(b,_.ee,d),a.g||(a.g=new _.uy,a.g.configure(a.configuration.abr)),
|
|
171
|
+
KA(a,a.f.periods),a.zc=new Dy(a.configuration.preferredAudioLanguage||[],a.configuration.preferredAudioRole,a.configuration.preferredAudioChannelCount),a.Ia=a.configuration.preferredTextLanguage,a.xc=a.configuration.preferredTextRole,_.x(q,_.bm(a.m,b),2);if(3!=q.a){if(!a.m)throw new _.L(_.M,7,7001);a.g.init(function(r,v,z){!a.V&&LA(a,r,v,z)});a.A=MA(a,a.configuration.startTime);a.sc=NA(a);a.Bc=new Oy({Ke:function(){return b.playbackRate},gh:function(r){b.playbackRate=r},Vj:function(r){b.currentTime+=
|
|
172
|
+
r}});a.isLive()&&a.configuration.streaming.enableLiveEdgeChasing&&(a.Sd=new Ly(a));e=Math.max(1E-4,a.configuration.streaming.rebufferingGoal);OA(a,e);Nx(a.f,_.tg(a.configuration.preferredVideoCodec),_.tg(a.configuration.preferredAudioCodec),a.configuration.preferredAudioChannelCount);a.a=PA(a);a.a.j=a.configuration.streaming;a.F=lA;return _.x(q,a.a.start(),3)}if(!a.a)throw new _.L(_.M,7,7001);a.configuration.streaming.startAtSegmentBoundary&&(f=iz(a.A),g=QA(a,f),bz(a.A.f,g));h=_.u(a.f.periods);for(l=
|
|
173
|
+
h.next();!l.done;l=h.next())m=l.value,RA(a,m);DA(a);n=BA(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");EA(a,n.variants);a.o.one(b,_.wd,function(){a.I.A=Date.now()/1E3-(null===a.Ve?0:a.Ve)});_.y(q)})};
|
|
174
|
+
zA=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)})){_.Uf("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)}};MA=function(a,b){return new gz(a.j,a.f,a.configuration.streaming,b,function(){a.sc&&ax(a.sc,!0);a.a&&Ez(a.a)},function(c){return a.dispatchEvent(c)})};
|
|
175
|
+
NA=function(a){var b=new My(a.f);Ny(b,function(){DA(a)});var c=new cx(a.yc);dx(c,function(e){e.be&&e.be();xA(a,_.rg,e)},function(e){e.cf&&e.cf();xA(a,_.sg,e)},function(e,f){f||(e.be&&e.be(),xA(a,_.rg,e),e.cf&&e.cf(),xA(a,_.sg,e))});var d=new bx(a.j);d.a.add(b);d.a.add(c);return d};OA=function(a,b){a.H=new Jy(b,Math.min(.5,b/2));a.H.a=Iy;vA(a);a.Xa=(new _.$i(function(){IA(a)})).fb(.25)};
|
|
176
|
+
IA=function(a){switch(a.F){case lA:a:if(a.j.ended||ux(a.J))var b=!0;else{if(a.isLive()){b=Pw(a.f.presentationTimeline);var c=a.getBufferInfo();if(null!==c&&(c=c.Da(),null!==c&&c>=b)){b=!0;break a}}b=!1}break;default:b=!1}if(a.J){var d=wx(a.J);c=d.video;d=d.audio;var e=a.j.currentTime;c&&d?(c=c.Ja(e),d=d.Ja(e),c=Math.min(c,d)):c=c?c.Ja(e):d?d.Ja(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?Hy:Iy;d.a=c;d=e!=c}c=d;d=TA(a);c||a.getState()===_.Tm&&!d?(a.log.debug("Buffering state changed. Is buffering",
|
|
177
|
+
d,"buffered to end",b,"state",a.getState()),vA(a)):a.bd&&JA(a)};PA=function(a){var b={zb:function(){return iz(a.A)},W:a.J,Db:a.getNetworkEngine(),bf:a.ri.bind(a),af:a.pi.bind(a),onError:a.onError.bind(a),Gg:a.sk.bind(a),onEvent:a.Ae.bind(a),Lg:a.si.bind(a),ce:a.Fk.bind(a),He:function(){return a.g},ue:a.Ah.bind(a),ih:a.rl.bind(a),ld:a.m};return new _.oz(a.f,b)};FA=function(a){var b=_.xk(a.configuration.drm);a.m.g=b};
|
|
178
|
+
VA=function(a){a.B&&a.B.configure(a.configuration.manifest);a.m&&FA(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())RA(a,c.value)}catch(e){a.onError(e)}c=rz(a.a);var d=sz(a.a);b=BA(a)||a.f.periods[0];c=Yx(c,d,b.variants);a.g&&c&&c.allowedByApplication&&c.allowedByKeySystem?EA(a,b.variants):(a.log.debug("Choosing new streams after changing configuration"),UA(a,b))}a.g&&(a.g.configure(a.configuration.abr),a.configuration.abr.enabled&&!a.V?a.g.enable():
|
|
179
|
+
a.g.disable())};my=function(a){if(a.f&&a.A){var b=WA(a),c=[];a=_.u(XA(a));for(var d=a.next();!d.done;d=a.next()){d=d.value;var e=Tx(d);e.active=d==b;c.push(e)}return c}return[]};ky=function(a,b){if(a.f&&a.a){var c=BA(a),d=c.textStreams.find(function(e){return e.id==b.id});d?(YA(a,c,d,!1),ZA(a,d),a.Ia=d.language):a.log.error(_.iv,b.id)}};
|
|
180
|
+
ny=function(a,b,c){var d=void 0===d?0:d;if(a.f&&a.a){var e=BA(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.T=null;c=EA(a,e.variants);null!=a.na&&(a.zc=a.na,a.na=null);null==c||a.V||LA(a,c);return}if(b){a.T=b.id;var f=e.variants.find(function(g){return g.id==
|
|
181
|
+
b.id});f?(a.T=f.video.id,Vx(f)?($A(a,e,f,!1),aB(a,f,c,d),null==a.na&&(a.na=a.zc),a.zc=new Ey(f),EA(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.T=null,null!=a.na&&(a.zc=a.na,a.na=null),c=EA(a,e.variants),null==c||a.V||LA(a,c)}};
|
|
182
|
+
ly=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=sz(a.a),d=rz(a.a),e=Aw(a.f.periods,iz(a.A)),f=a.f.periods[e?a.f.periods.indexOf(e):0].variants.filter(function(m){return m.audio.id===b&&Vx(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().Pa();
|
|
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.Ac=d.id;a.g.setVariants(f);f=BA(a);$A(a,f,g,!1);e||a.V?aB(a,g,!0,0):_.Bz(a.a,d,!0,0);Promise.resolve();return}a.log.warn("Target audio codecs not compatible with active audio codecs.")}}Promise.reject()}};
|
|
184
|
+
oy=function(a){var b=a.Ue;return a.f?a.J.getTextDisplayer().isTextVisible():b};jy=function(a,b){var c,d,e,f;return _.B(function(g){c=a.Ue;d=b;if(c==d)return g["return"]();a.Ue=d;if(a.F!==lA)return g.G(0);a.J.getTextDisplayer().setTextVisibility(b);if(a.configuration.streaming.alwaysStreamText)return g.G(0);if(!b)return Az(a.a),g.G(0);e=BA(a);f=_.Xx(e.textStreams,a.Ia,a.xc);return 0<f.length?_.x(g,xz(a.a,f[0]),0):g.G(0)})};
|
|
185
|
+
$A=function(a,b,c,d){var e=a.getTrackManager();a.B.setCurrentVariant(c);if(e){var f=a.I.B;if(c.video){ry(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&&(ry(e,c.audio,d),e=e.La(),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})))}yy(a.N,
|
|
186
|
+
b).variant=c};YA=function(a,b,c,d){yy(a.N,b).text=c;if(b=a.getTrackManager())ry(b,c,d),c=b.Na(),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
|
+
KA=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.fh++,originalId:l,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:function(){return null},getSegmentReference:function(){return null},initSegmentReference:null,ta:0,mimeType:_.ec,codecs:"",kind:"caption",
|
|
188
|
+
encrypted:!1,keyId:null,language:g.closedCaptions.get(l),label:null,type:_.Ce,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
|
+
GA=function(a,b){for(var c=a.a?rz(a.a):null,d=a.a?sz(a.a):null,e=_.u(b),f=e.next();!f.done;f=e.next())Sx(a.m,c,d,f.value);c=Zv(b,function(h){return h.variants.some(Vx)});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<ew(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,Px(d.variants,a.configuration.restrictions,a.Zg)&&a.a&&BA(a)==d&&DA(a),bB(a,d.variants)};
|
|
191
|
+
RA=function(a,b){var c=a.a?rz(a.a):null,d=a.a?sz(a.a):null;Sx(a.m,c,d,b);d=b.variants;if(!d.some(Vx))throw new _.L(_.M,4,4011);bB(a,b.variants);Px(d,a.configuration.restrictions,a.Zg)&&a.a&&BA(a)==b&&DA(a);if(!_.mi(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,_.em(a.m,g.keyId,g.initData)||_.Wl(a.m,
|
|
192
|
+
g.initDataType,g.initData,g.keyId)}}}};aB=function(a,b,c,d){c=void 0===c?!1:c;d=void 0===d?0:d;a.V?(a.ma=b,a.Yg=c,a.Qg=d):Cz(a.a,b,c,d)};ZA=function(a,b){a.V?a.ga=b:_.Bz(a.a,b,!0,0)};cB=function(a){if(a.a&&a.f){var b=pz(a.a),c=BA(a);null!=b&&b==c&&(rz(a.a),sz(a.a),_.qz(a.a,_.Ce),yy(a.N,c),yy(a.N,c))}};
|
|
193
|
+
QA=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=rz(a.a),e=sz(a.a),f=BA(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};TA=function(a){return a.m&&a.m.D?!0:a.H?a.H.getState()===Iy:!1};vA=function(a){if(a.I&&a.H&&a.A){var b=dB(a)===_.Tm,c=a.Bc;c.j=b;Py(c);a.A.j.o=b;JA(a)}};JA=function(a){oA(a,dB(a))};
|
|
194
|
+
dB=function(a){var b=a.getDuration(),c=a.getPosition();return a.j&&a.j.ended||(a.bd||a.ha===_.Vm)&&1>=Math.abs(b-c)?_.Vm:TA(a)||a.Yd?_.Tm:a.j&&a.j.paused?_.an:_.bn};
|
|
195
|
+
EA=function(a,b){try{bB(a,b)}catch(e){return a.onError(e),null}var c=b.filter(function(e){return Vx(e)});c=by(c,a.Ac);var d=a.zc.create(c);d=Array.from(d.values());a.g.setVariants(d);if(null!==a.T&&null!==a.Ac&&(d=d.find(function(e){return e.video.id==a.T&&e.audio.id==a.Ac}),a.T=null,d))return d;if(a.configuration.abr.enabled||null===a.T)return a.g.chooseVariant();c=c.find(function(e){return null!==e.video&&e.video.id===a.T});return c?c:(a.log.warn("Selected video track not found. Falling back to ABR selection"),
|
|
196
|
+
a.g.chooseVariant())};UA=function(a,b,c){c=void 0===c?!0:c;var d=EA(a,b.variants);a.Ac=d&&d.audio&&d.audio.id;d&&($A(a,b,d,!0),aB(a,d,c));(c=_.Xx(b.textStreams,a.Ia,a.xc)[0]||null)&&(a.configuration.streaming.alwaysStreamText||oy(a))&&(YA(a,b,c,!0),ZA(a,c))};
|
|
197
|
+
gB=function(a,b){a.V=!0;a.g.disable();a.log.debug("Choosing new streams after period changed");var c=EA(a,b.variants),d=_.Xx(b.textStreams,a.Ia,a.xc)[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&&eB(a,b,function(){return $A(a,b,c,!0)});d&&(a.configuration.streaming.alwaysStreamText||oy(a))&&eB(a,b,function(){return YA(a,b,d,!0)});b===BA(a)&&fB(a);return a.configuration.streaming.alwaysStreamText||oy(a)?{variant:c,text:d}:
|
|
198
|
+
{variant:c,text:null}};LA=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=hB(a,b);eB(a,e,function(){return $A(a,e,b,!0)});e===BA(a)&&fB(a);a.a&&Cz(a.a,b,c,d)}};DA=function(a){var b=a.getTrackManager();b&&a.F!==pA&&(b.l&&(qy(b),b.l.trigger(new _.J(_.vq))),fB(a))};fB=function(a){var b=BA(a);if(b){var c=a.Cc.get(b)||[];for(a.Cc["delete"](b);c.length;)c.shift()()}};eB=function(a,b,c){a.Cc.has(b)||a.Cc.set(b,[]);a.Cc.get(b).push(c)};
|
|
199
|
+
xA=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
|
+
bB=function(a,b){var c=a.m?_.K.Gf(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?CA.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});};XA=function(a){var b=BA(a);if(null==b)return[];cB(a);return b.variants.filter(function(c){return Vx(c)})};iB=function(a){var b=BA(a);if(null==b)return[];cB(a);return b.textStreams.filter(function(c){return!a.Xd.has(c)})};BA=function(a){var b=iz(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};WA=function(a){var b=BA(a);return b&&yy(a.N,b).variant};
|
|
202
|
+
hB=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
|
+
jB=function(a,b,c){var d,e,f,g,h,l,m,n,p,q,r,v,z,A,D,F,E,H,Q;return _.B(function(O){switch(O.a){case 1:return d=_.nn,_.Bf(O,2),_.x(O,_.vp(b.url,a.getNetworkEngine(),a.configuration.manifest.attemptParameters,b.type||null),4);case 4:return e=O.f,e.configure(a.configuration.manifest),_.x(O,e.start(b.url,yA(a)),5);case 5:f=O.f;zA(f.periods);if(!f.periods.length)throw new _.L(_.M,4,4014);return _.x(O,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=Aw(f.periods,
|
|
204
|
+
iz(a.A))||f.periods[0];Nx(a.f,_.tg(a.configuration.preferredVideoCodec),_.tg(a.configuration.preferredAudioCodec),a.configuration.preferredAudioChannelCount);m=cy(g,h,l.variants);n=_.Xx(l.textStreams,a.Ia,a.xc)[0]||null;EA(a,l.variants);p=m&&m.video;q=m&&m.audio;r=[];v=new Set;z=_.u(l.variants);for(A=z.next();!A.done;A=z.next())D=A.value,D.video&&v.add(D.video),D.audio&&v.add(D.audio);F=_.u(_.of(v).concat(_.of(l.textStreams)));for(E=F.next();!E.done;E=F.next())H=E.value,r.push(H.createSegmentIndex());
|
|
205
|
+
return _.x(O,Promise.all(r),7);case 7:Kz(a.a,d.AUDIO,q);Kz(a.a,d.VIDEO,p);Kz(a.a,d.TEXT,n);m&&$A(a,l,m,!1);a.log.info("Switch CDN successful.");_.Cf(O,0);break;case 2:Q=_.Df(O);if(!e){O.G(8);break}return _.x(O,e.stop(),8);case 8:throw Q;}})};
|
|
206
|
+
yA=function(a){return{networkingEngine:a.getNetworkEngine(),filterNewPeriod:function(b){return RA(a,b)},filterAllPeriods:function(b){return GA(a,b)},onTimelineCueAdded:function(b){var c=a.yc;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.Ae(b)},onError:function(b){return a.onError(b)}}};kB=function(){};
|
|
207
|
+
lB=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}};mB=function(){var a=SourceBuffer.prototype.remove;SourceBuffer.prototype.remove=function(b,c){return a.call(this,b,c-.001)}};nB=function(){var a=MediaSource.isTypeSupported;MediaSource.isTypeSupported=function(b){return"mp2t"==b.split(/ *; */)[0].split("/")[1].toLowerCase()?!1:a(b)}};
|
|
208
|
+
oB=function(){var a=MediaSource.isTypeSupported;MediaSource.isTypeSupported=function(b){return"opus"!=_.gw(b)[0]&&a(b)}};
|
|
209
|
+
pB=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
|
+
qB=function(a){_.cq.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===kv&&(this.a=c)}this.a||(this.a=a.addTextTrack(_.Dv,kv));this.a.mode=_.nd};rB=function(a,b){var c=a.mode;a.mode=c==_.ne?_.ne:_.nd;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};sB=function(){};Hv=[112,115,115,104,0,0,0,0];_.Rv.prototype.f=function(){return this.keyInfo};_.Sv.prototype.getPosition=function(){return this.position};
|
|
211
|
+
_.Sv.prototype.f=function(){return this.keyInfo};_.uB=function tB(a){var c,d,e,f,g,h;return _.Jf(tB,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,{Me:c,Zk:d,item:e,next:void 0},0);h=g.value;return 0<=c?_.x(l,{Me:c,item:e,Zk:d,next:h},5):l.G(5)}c++;d=e;e=h;g=f.next();return l.G(2)})};aw.prototype.destroy=function(){this.a&&(this.a.dispose(),this.a=null);return Promise.resolve()};
|
|
212
|
+
aw.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===_.Re?this.o.push(b):a.type===_.mc&&this.m.push(b)};aw.prototype.w=function(){var a={video:_.Th.apply(_.Mh,_.of(this.o)),captions:this.g,audio:_.Th.apply(_.Mh,_.of(this.m))};this.f.resolve(a);this.j=!1};var qw=[154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149];_.w(nw,_.Bl);
|
|
213
|
+
_.vw.prototype.track=function(a){null!=this.a&&(this.a&&(this.a.off(_.je,this.f),this.g&&this.a.off(_.Fe,this.f)),this.a=null);a&&(this.a=a,this.a.on(_.je,this.f,this))};
|
|
214
|
+
_.vw.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.S.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.S);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.S.push(c);this.S.sort(uw)}yw(this);this.f();this.a&&this.a.trigger(new _.J(_.Ue))};_.vw.prototype.clear=function(){this.S=[];yw(this);this.a&&(this.a.trigger(new _.J(_.Ue)),this.a.trigger(new _.J(_.rc)))};
|
|
216
|
+
_.vw.prototype.f=function(){if(this.a){var a=this.a.getPosition();if(0<=a){a:{for(var b=this.S.length,c=Number.MAX_SAFE_INTEGER,d=0;d<b;d++){var e=this.S[d];c=Math.min(e.start,c);if(e.start<=a&&e.end>a){a=.1>e.end-a&&d<b-1?this.S[d+1].rendition:e.rendition;break a}if(e.start>a)break}a=0<b&&c>a&&.25>c-a?this.S[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}}))}}}};_.t=_.Jw.prototype;_.t.Nc=function(){return this.I};_.t.getDuration=function(){return this.f};_.t.getPresentationStartTime=function(){return this.A};_.t.offset=function(a){null!=this.j&&(this.j+=a);null!=this.g&&(this.g+=a)};_.t.isLive=function(){return Infinity==this.f&&!this.o};Tw.prototype.release=function(){this.f=function(){};this.a.clear()};Tw.prototype.cues=function(){return this.a};
|
|
218
|
+
Vw.prototype.next=function(){var a=this.g.get(this.a);a&&0<a.a.length?(this.f+=1,a.Oa().length&&this.f===a.a.length&&(this.a+=1,this.f=0)):(this.a+=1,this.f=0);a=Ww(this);return{value:a,done:!a}};_.t=_.Xw.prototype;_.t.destroy=function(){this.a=[];return Promise.resolve()};
|
|
219
219
|
_.t.Fc=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};
|
|
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.
|
|
221
|
-
_.t.
|
|
222
|
-
_.t.
|
|
223
|
-
b[b.length-1].position+1;e<a.length;)f=a[e++],f=new _.
|
|
224
|
-
a};_.t.replace=function(a){this.a=a};
|
|
225
|
-
|
|
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.ta-=a};
|
|
221
|
+
_.t.Yc=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.wa=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 _.Sv(f.position,g.startTime,g.endTime,g.Oa,g.ua,g.ea,g.ta,g.keyInfo,g.Hc,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 _.Sv(d++,f.startTime,f.endTime,f.Oa,f.ua,f.ea,f.ta,f.keyInfo,f.Hc,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 _.Sv(e-d--,f.startTime,f.endTime,f.Oa,f.ua,f.ea,f.ta,f.keyInfo,f.Hc,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};bx.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()};cx.prototype.release=function(){this.m=null;this.j.clear();this.a=function(){};this.f=function(){};this.g=function(){}};
|
|
225
|
+
cx.prototype.o=function(a,b){for(var c={},d=_.u(this.m.cues()),e=d.next();!e.done;c={oe:c.oe,Bd:c.Bd},e=d.next()){e=e.value;c.oe=this.j.get(e)||null;c.Bd=a<e.startTime?1:a>e.endTime?3:2;this.j.set(e,c.Bd);var f=this.w.find(function(g){return function(h){return h.rc===g.oe&&h.qc===g.Bd}}(c));f&&f.fc(e,b)}};_.t=gx.prototype;_.t.destroy=function(){this.g=this.w=null;this.o.clear();return Promise.resolve()};
|
|
226
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.ub=function(){return this.a};_.t.Da=function(){return this.f};_.t.hc=function(a){return null==this.a||null==this.f?!1:a>=this.a&&a<this.f};_.t.Ja=function(a){return null==this.f||this.f<a?0:this.f-Math.max(a,this.a)};
|
|
227
|
-
|
|
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"](
|
|
229
|
-
a.M=!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=_.
|
|
230
|
-
_.t.ub=function(a){return a===_.
|
|
231
|
-
_.t.remove=function(a,b,c){var d=this;return a===_.
|
|
232
|
-
_.t.flush=function(a){return a==_.
|
|
233
|
-
_.t.
|
|
234
|
-
_.t.
|
|
235
|
-
_.t.
|
|
236
|
-
_.t.
|
|
237
|
-
_.t.
|
|
238
|
-
_.t.
|
|
239
|
-
_.t.Za=function(){return this.f.get(_.
|
|
240
|
-
_.t.qb=function(a,b){
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
_.t.chooseVariant=function(){var a=
|
|
227
|
+
lx.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()};lx.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()};lx.prototype.f=function(){this.a.resetCaptionStream()};_.mx.prototype.init=function(){};_.mx.prototype.g=function(){};_.mx.prototype.f=function(){};_.t=_.ox.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"](Ov));for(e=1;e<d.length;++e)d[e].p["catch"](Ov),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.M=!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=_.nn,_.x(f,d.I,2);a.forEach(function(g,h){var l=_.Xi(g.mimeType,g.codecs);if(h==e.TEXT)tx(d,l);else{var m=new Map;m.set(h,l);_.$v(l)&&b&&!g.keyInfo||!dw(l,h)||(d.A[h]=new aw,l="aac"==l.toLowerCase().split(";")[0].split("/")[1]?l.replace(/aac/i,_.Gd):cw(h,l),m=ew(h,l),c&&m["delete"](e.AUDIO));rx(d,m)}});_.y(f)})};
|
|
230
|
+
_.t.ub=function(a){return a===_.Ce?this.a.ub():(a=vx(this,a))?a.ub():null};_.t.Da=function(a){return a===_.Ce?this.a.Da():(a=vx(this,a))?a.Da():null};_.t.hc=function(a,b,c){return a===_.Ce?this.a.hc(b):(a=vx(this,a))?a.hc(b,!1,c):!1};_.t.Ja=function(a,b){if(a===_.Ce)return this.a.Ja(b);var c=vx(this,a);return c?c.Ja(b):0};
|
|
231
|
+
_.t.remove=function(a,b,c){var d=this;return a===_.Ce?this.a.remove(b,c):yx(this,a,this.ah.bind(this,a,b,c)).then(function(){if(a===_.Re){var e=d.ub(a),f=d.Da(a);null!==e&&null!==f&&zw(d.D,e,f)}else a===_.mc&&(e=d.D,e.a&&e.a.trigger(new _.J(_.rc)))})};_.t.clear=function(a){if(a==_.Ce){if(!this.a)return Promise.resolve();this.H.f();return this.a.remove(0,Infinity)}return yx(this,a,this.ah.bind(this,a,0,this.o.duration))};
|
|
232
|
+
_.t.flush=function(a){return a==_.Ce?Promise.resolve():yx(this,a,this.ig.bind(this,a))};_.t.endOfStream=function(a){var b=this;return Ex(this,function(){ux(b)||(a?b.o.endOfStream(a):b.o.endOfStream())})};_.t.getDuration=function(){return this.o.duration};_.t.Be=function(a,b){this.h.debug("Appending data to "+a+Yu);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+Yu)};
|
|
233
|
+
_.t.ah=function(a,b,c){if(c<=b)this.Sc(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.th=function(a){try{this.h.debug("Aborting operations for "+a+Yu);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+Yu,d),d;}this.h.debug("Done Aborting operations for "+a+Yu);this.Sc(a)};
|
|
235
|
+
_.t.ig=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.Sc(a)};
|
|
236
|
+
_.t.hh=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.Sc(a)};
|
|
237
|
+
_.t.il=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.Sc(a)};_.t.U=function(a){this.g[a][0].p.reject(new _.L(_.M,3,3014,{mediaError:this.j.error?this.j.error.code:0}))};
|
|
238
|
+
_.t.Sc=function(a){var b=this.g[a][0];b&&(b.p.resolve(),this.h.debug("Update-End received for "+a),Hx(this,a))};_.t.getTextDisplayer=function(){return this.B};var qx=window.URL.createObjectURL;_.w(dy,_.S);_.t=dy.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 ey(this,_.wi)};_.t.getAudioTracks=function(){return ey(this,_.R)};_.t.ia=function(){return ey(this,_.P)};_.t.fa=function(){return this.a.get(_.wi)||null};_.t.La=function(){return this.a.get(_.R)||null};_.t.Na=function(){return this.a.get(_.P)||null};
|
|
239
|
+
_.t.Za=function(){return this.f.get(_.wi)||null};_.t.ib=function(){return this.f.get(_.R)||null};_.t.jb=function(){return this.f.get(_.P)||null};_.t.Pa=function(){return fy(this,_.wi)};_.t.qa=function(){return fy(this,_.R)};_.t.ra=function(){return fy(this,_.P)};_.t.eb=function(a){hy(this,_.wi,a)};_.t.ya=function(a){hy(this,_.R,a)};_.t.Ga=function(a){hy(this,_.P,a)};_.t.cb=function(a,b){gy(this,_.wi,a,void 0===b?!1:b)};_.t.pb=function(a,b){gy(this,_.R,a,void 0===b?!1:b)};
|
|
240
|
+
_.t.qb=function(a,b){gy(this,_.P,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()};dy.prototype.isAbrEnabled=dy.prototype.ka;dy.prototype.addTextTrack=dy.prototype.addTextTrack;dy.prototype.setTextRendition=dy.prototype.qb;dy.prototype.setAudioRendition=dy.prototype.pb;dy.prototype.setVideoRendition=dy.prototype.cb;
|
|
241
|
+
dy.prototype.setTextTrack=dy.prototype.Ga;dy.prototype.setAudioTrack=dy.prototype.ya;dy.prototype.setVideoTrack=dy.prototype.eb;dy.prototype.getTextTrack=dy.prototype.ra;dy.prototype.getAudioTrack=dy.prototype.qa;dy.prototype.getVideoTrack=dy.prototype.Pa;dy.prototype.getLoadingTextRendition=dy.prototype.jb;dy.prototype.getLoadingAudioRendition=dy.prototype.ib;dy.prototype.getLoadingVideoRendition=dy.prototype.Za;dy.prototype.getTextRendition=dy.prototype.Na;dy.prototype.getAudioRendition=dy.prototype.La;
|
|
242
|
+
dy.prototype.getVideoRendition=dy.prototype.fa;dy.prototype.getTextTracks=dy.prototype.ia;dy.prototype.getAudioTracks=dy.prototype.getAudioTracks;dy.prototype.getVideoTracks=dy.prototype.getVideoTracks;_.t=_.uy.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=vy(!this.B&&this.a.initialRestrictions?this.a.initialRestrictions:this.a.restrictions,this.o),b=ty(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=vy(null,this.o),a=[a[0]]);var c=a[0]||null;a=_.u(_.uB(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;
|
|
244
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};
|
|
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;_.
|
|
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(
|
|
247
|
-
_.t.reset=function(){this.A=!1;this.f=new
|
|
248
|
-
|
|
249
|
-
_.t.start=function(){var a=this,b,c,d;return _.B(function(e){if(1==e.a){b=a.C.zb();c=
|
|
250
|
-
_.t.Eb=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=
|
|
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.
|
|
252
|
-
_.t.
|
|
253
|
-
_.t.
|
|
254
|
-
_.t.unload=function(){var a=this;
|
|
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 _.
|
|
256
|
-
_.t.getBufferInfo=function(a){if(this.J){var b=
|
|
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,_.
|
|
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===
|
|
259
|
-
_.
|
|
260
|
-
|
|
261
|
-
_.t.
|
|
262
|
-
_.t.setPlaybackRate=function(a){if(0===a)this.log.warn("A trick play rate of 0 is unsupported!");else if(this.F===
|
|
263
|
-
_.t.ia=function(){if(this.f&&this.A){var a=
|
|
264
|
-
_.t.getStats=function(){if(this.F!==
|
|
265
|
-
_.t.getTimelineCues=function(){return this.yc?_.
|
|
266
|
-
_.t.addTextTrack=function(a,b,c,d,e,f){var g=this,h,l,m,n,p,q,r,v,z;return _.B(function(A){if(1==A.a){if(g.F!==
|
|
267
|
-
findSegmentPosition:function(){return 1},getSegmentReference:function(
|
|
268
|
-
z;g.
|
|
269
|
-
_.t.
|
|
270
|
-
_.t.
|
|
271
|
-
|
|
272
|
-
_.t.
|
|
273
|
-
_.x(n,b.wc(
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
_.
|
|
277
|
-
_.
|
|
278
|
-
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;_.Gw(c.f,e,d);_.Gw(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(ty(this.f,this.a.defaultBandwidthEstimate)/1E3)+" kbps");c&&this.w(c)}};_.t.playbackRateChanged=function(a){this.m=a};_.t.getBandwidthEstimate=function(){return ty(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 sy;var a=this.chooseVariant();a&&this.w(a)};wy.prototype.clear=function(){this.a.clear()};zy.prototype.add=function(a){if(Cy(this.f,a))return this.a.add(a),!0;_.G("Rejecting variant - not compatible with root.");return!1};zy.prototype.values=function(){return this.a.values()};Ey.prototype.create=function(a){var b=this,c=a.filter(function(d){return Cy(b.a,d)});return c.length?new zy(c[0],c):this.f.create(a)};
|
|
248
|
+
Dy.prototype.create=function(a){var b=Fy(a,this.g);0<b.length&&(a=b);b=!1;if(this.a){var c=Gy(a,this.a);0<c.length?(a=c,b=!0):_.G("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=Jx(a,this.f),b.length?a=b:_.G("No exact match for the channel count could be found."));b=new zy(a[0]);a=_.u(a);for(c=a.next();!c.done;c=a.next())c=c.value,Cy(b.f,c)&&b.add(c);return b};Jy.prototype.getState=function(){return this.a};var Iy=0,Hy=1;Ly.prototype.release=function(){this.f.release()};My.prototype.release=function(){this.a=this.g=null;this.f=function(){}};My.prototype.o=function(a){var b=this.a,c=this.g.periods;a=Aw(c,a)||c[0];b!=a&&this.f(a);this.a=a};Oy.prototype.release=function(){this.f&&(this.f.stop(),this.f=null);this.a=null};Oy.prototype.set=function(a){this.g=a;Py(this)};Ry.prototype.release=function(){this.g=null;this.f=function(){}};Vy.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};Vy.prototype.ce=function(){this.A=!0;Uy(this)};Zy.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};Wy.prototype.release=function(){this.a&&(this.a.stop(),this.a=null);this.f=null};gz.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 mz=new _.Lm(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 Vz;_.t=_.oz.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,yz(e),b.push(zz(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;_.y(f)})};
|
|
249
|
+
_.t.start=function(){var a=this,b,c,d;return _.B(function(e){if(1==e.a){b=a.C.zb();c=uz(a,b);d=a.C.bf(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,Qz(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.uk&&(a.h.debug("init: calling onInitialStreamsSetup()..."),a.C.uk());_.y(e)})};
|
|
250
|
+
_.t.Eb=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=Fz(a);if(a.ab||null==a.tb||a.$b)return g["return"]();a.tb=null;if(!a.Ib){g.G(2);break}b.h.debug(c,"skipping update and clearing the buffer");return _.x(g,Iz(b,a,a.ge,a.Ld),3);case 3:return g["return"]();case 2:_.Bf(g,4);d=Uz(b,a);null!=d&&(wz(b,a,d),a.Oc=!1);_.Cf(g,5);break;case 4:return e=_.Df(g),_.x(g,eA(b,e),6);case 6:return g["return"]();case 5:f=Array.from(b.a.values()),jA(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.Gg()})),_.y(g)}})};
|
|
252
|
+
_.t.Ok=function(a,b,c,d){var e=Gv(d.reader),f=Gv(d.reader),g=_.U(d.reader),h=_.U(d.reader),l=_.U(d.reader),m=_.U(d.reader);d=_.Nk(d.reader,d.reader.Ea()-d.reader.getPosition());a=a.startTime+b.startTime+h/g;if(c.includes(e))if("urn:mpeg:dash:event:2012"==e)this.C.Lg();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.xl=function(a){var b=this,c=!1,d=0;(new _.Ok).L(_.Fd,_.Pk).L(_.Ge,_.Pk).L(_.Ad,_.Pk).L(_.Ed,_.Pk).L(_.ue,_.Pk).Y(_.we,_.Qk).L("encv",function(e){e.reader.skip(78);_.Pk(e)}).L("pasp",function(e){d=e.start+e.headerSize;var f=_.U(e.reader),g=_.U(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),_.T(a,1),_.T(a,1))};Vz="iterateSegmentReference";_.vB={ITERATOR:Vz,LOOKUP:_.vv};_.w(mA,_.kk);_.t=mA.prototype;_.t.init=function(a,b){var c=a.getMedia();_.kk.prototype.init.call(this,a,b);sA(this,c)};_.t.namespace=function(){return sv};_.t.ag=function(){return new dy};_.t.getState=function(){return this.ha};_.t.getDrmInfo=function(){return this.m?this.m.getDrmInfo():null};
|
|
254
|
+
_.t.unload=function(){var a=this;jy(this,!1);this.bd=!1;if(this.w){var b=this.getTrackManager();b&&b.release();return this.F===pA?Promise.resolve():uA(this).then(function(){a.log.debug(_.ib,a.w);a.w=null;a.We=0;a.Ac=null;a.T=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(){oA(a,_.Om);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=wx(this.J),c=new _.Zj(void 0,a);switch(a){case _.wi:return b.video?b.video:c;case _.R:return b.audio?b.audio:c;case _.P:return b.text?b.text:c}return b.total?b.total:c}return this.hd?(b=ww(this.hd),hw(b,a)):_.kk.prototype.getBufferInfo.call(this,a)};_.t.getPosition=function(){return this.A?iz(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===pA)return b["return"]();a.log.debug("Destroying player...");a.F=pA;return _.x(b,rA(a),3)}a.o&&(a.o.release(),a.o=null);a.g=null;_.y(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===pA)return n["return"](Promise.reject(new _.L(_.M,7,7E3)));c=new _.fi;d=function(){return b.Sb!==c};e=function(){b.log.info("Aborting current load");throw new _.L(_.M,7,7E3);};b.Sb=c;_.Bf(n,2);d()&&e();if(!b.da){n.G(4);break}_.Bf(n,5);return _.x(n,b.da,7);case 7:_.Cf(n,6,2);break;case 5:_.Df(n,2);case 6:d()&&e();case 4:return b.I=new _.Em,b.Ve=Date.now()/1E3,oA(b,_.$m),b.w=_.fn(a),_.jk(a)&&(b.configuration=
|
|
259
|
+
_.ik(b.Pd,a)),b.log.info(_.Ta,b.configuration),b.log.info(_.db,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),VA(b),h=b.w[b.getSourceIndex()],d()&&e(),_.x(n,sA(b,g),8);case 8:return d()&&e(),_.x(n,tA(b,g),9);case 9:return d()&&e(),_.x(n,wA(b,h),10);case 10:return d()&&e(),_.x(n,AA(b,h),11);case 11:return d()&&e(),_.x(n,
|
|
260
|
+
HA(b),12);case 12:return d()&&e(),_.x(n,SA(b),13);case 13:d()&&e();c.resolve();_.Cf(n,0);break;case 2:throw m=l=_.Df(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,qA(a),2):b["return"](rA(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.Pg=function(){this.log.debug("User seeking finished");this.H&&IA(this);JA(this)};_.t.getSeekRange=function(){if(this.f){var a=this.f.presentationTimeline;return{start:_.Sw(a,0),end:Rw(a)}}return{start:0,end:0}};_.t.Nc=function(){return this.f?this.f.presentationTimeline.Nc():null};_.t.getPlaybackRate=function(){if(this.Bc){var a=this.Bc;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===lA){this.Bc.set(a);this.g.playbackRateChanged(a);var b=this.a,c=1<Math.abs(a);if(a=b.a.get(_.Re)){var d=a.stream;if(d)if(b.h.debug("setTrickPlay",c),c)(c=d.trickModeVideo)&&!a.Vb&&(b.h.debug("Engaging trick mode stream",c),_.Bz(b,c,!1,0),a.Vb=d);else if(d=a.Vb)b.h.debug("Restoring non-trick-mode stream",d),a.Vb=null,_.Bz(b,d,!0,0)}}};
|
|
263
|
+
_.t.ia=function(){if(this.f&&this.A){var a=BA(this);if(null==a)a=null;else{if(!yy(this.N,a).text){var b=_.Xx(a.textStreams,this.Ia,this.xc);b.length&&(b=b[0],yy(this.N,a).text=b)}a=yy(this.N,a).text}b=[];for(var c=_.u(iB(this)),d=c.next();!d.done;d=c.next()){d=d.value;var e=Ux(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!==lA)return _.Fm();JA(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===lA){if(a=WA(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.yc?_.of(this.yc.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,z;return _.B(function(A){if(1==A.a){if(g.F!==lA)throw g.log.error("Must call load() and wait for it to resolve before adding text tracks."),Error("State error!");h=BA(g);l=_.nn;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 _.Sv(1,0,q,function(){return[a]},0,null,0);v={id:g.fh++,originalId:null,createSegmentIndex:Promise.resolve.bind(Promise),
|
|
267
|
+
findSegmentPosition:function(){return 1},getSegmentReference:function(D){return 1==D?r:null},adjustSegmentDurations:function(){},getDuration:function(){return q},segmentLookupStrategy:_.vv,initSegmentReference:null,mimeType:d,codecs:e||"",kind:c,encrypted:!1,keyId:null,language:b,originalLanguage:b,label:f||null,type:l.TEXT,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:null,closedCaptions:null};g.Xd.add(v);h.textStreams.push(v);return _.x(A,xz(g.a,v),2)}if(z=_.qz(g.a,
|
|
268
|
+
_.Ce))yy(g.N,h).text=z;g.Xd["delete"](v);g.log.debug("Choosing new streams after adding a text stream");UA(g,h);DA(g);return A["return"](Ux(v))})};
|
|
269
|
+
_.t.ri=function(a){this.log.debug(_.xv,a);try{this.log.debug("onChooseStreams_, choosing variant from ",a.variants);this.log.debug("onChooseStreams_, choosing text from ",a.textStreams);var b=gB(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}}};
|
|
270
|
+
_.t.pi=function(){this.log.debug("canSwitch_");this.V=!1;this.configuration.abr.enabled&&this.g.enable();this.ma&&(Cz(this.a,this.ma,this.Yg,this.Qg),this.ma=null);this.ga&&(_.Bz(this.a,this.ga,!0,0),this.ga=null)};_.t.si=function(){this.B&&this.B.update&&this.B.update()};_.t.Fk=function(){this.A&&this.A.j.ce()};
|
|
271
|
+
_.t.Ah=function(a,b,c){if((void 0===c?"":c)===wv)return DA(this),this.ka()||(this.configuration.abr.enabled=!0,this.g.enable()),UA(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===_.mc&&(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)}DA(this);this.ka()||(this.configuration.abr.enabled=!0,this.g.enable());
|
|
272
|
+
UA(this,b)}return c};_.t.sk=function(){this.log.debug("endOfStream called by streaming engine");this.bd=!0};_.t.onError=function(a){if(this.F!==pA&&7001!==a.code&&7E3!==a.code){var b=new _.J(_.jd,{detail:a});a.severity===_.M&&oA(this,_.Zm);this.trigger(b);b.defaultPrevented&&(b.a=!0)}};_.t.Ae=function(a){a.type===_.cd?this.dispatchEvent(a):"largegap"!==a.type&&(a.type===_.$e?vA(this):"emsg"!==a.type&&(a instanceof _.J?this.dispatchEvent(a):this.log.debug(_.xb,a.type)))};_.t.ka=function(){return this.configuration.abr.enabled};
|
|
273
|
+
_.t.rl=function(a){var b=this,c,d,e,f,g,h,l,m;return _.B(function(n){switch(n.a){case 1:if(!b.wc)return n["return"]();b.log.info("Attempt to switch CDN.");c=b.getLoadedSource();d=b.ka();return _.x(n,b.wc(c.url,a),2);case 2:e=n.f;if(!e)return n["return"]();f=_.K.wa(b.getLoadedSource(),{url:e});d&&b.g.disable();return _.x(n,Jz(b.a),3);case 3:g=WA(b);case 4:return h=!1,_.Bf(n,7),b.log.info("Switching CDN to "+f.url+"."),_.x(n,jB(b,f,g),9);case 9:_.Cf(n,6);break;case 7:return l=_.Df(n),b.log.info("Switch failed"),
|
|
274
|
+
_.x(n,b.wc(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(),Hz(b.a,!0),b.w[b.getSourceIndex()]=f,a.f=!0,b.trigger(new _.J(_.Bc,{newManifest:f.url})),_.y(n))}})};mA.prototype.detach=mA.prototype.detach;var pA=0,kA=1,lA=2,CA=[_.Ud,_.pd];kB.prototype.a=function(){return sv};
|
|
275
|
+
kB.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 _.wp||_.xp(a.url)in _.yp?!0:!1:!1;if(d&&e){if(_.mi(2))return 1;if(_.gj()&&c===_.Kj){if(b.streaming.preferNativeHlsOnSafari)return 1;_.G("Support for MSE + FairPlay on Apple is experimental. In case of issues, consider using native HLS.")}return 2}return 0};
|
|
276
|
+
kB.prototype.create=function(){return new mA};_.$f(new kB);_.Sn(function(){_.Uf("MediaSource.install");if(window.MediaSource)if(window.cast&&cast.__platform__&&cast.__platform__.canDisplayType)_.Tf("Patching Chromecast MSE bugs."),pB();else if(_.gj()){var a=navigator.appVersion;a=0<=a.indexOf("Version")?parseInt(a.match(/Version\/(\d+)/)[1],10):13;nB();10>=a?(_.Tf("Blacklisting MSE on Safari \x3c\x3d 10."),window.MediaSource=null):12>=a?(_.Tf("Patching Safari 11 \x26 12 MSE bugs."),lB(),mB()):(_.Tf("Patching Safari 13 MSE bugs."),lB())}else _.mi(2)||_.mi(3)||
|
|
277
|
+
_.mi(4)?oB():_.Tf("Using native MSE as-is.");else _.Tf("No MSE implementation available.")});_.w(qB,_.cq);_.t=qB.prototype;
|
|
278
|
+
_.t.append=function(a){function b(e){if(e.startTime>=e.endTime)_.G("Invalid cue times: "+e.startTime+" - "+e.endTime),e=null;else{var f=e.payload||"";f=f.replace(/<br\s*\/?>/igm,"\n");f=_.Lh(f);f=new VTTCue(e.startTime,e.endTime,f);f.line=-1;try{f.align=_.Dc}catch(g){f.align="middle"}e.writingMode===_.Pe?f.vertical="lr":e.writingMode===_.Qe&&(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?
|
|
279
|
+
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;rB(this.a,function(c){return c.startTime<b&&c.endTime>a});return!0};_.t.isTextVisible=function(){return this.a.mode==_.ne};_.t.setTextVisibility=function(a){null!==this.a&&(this.a.mode=a?_.ne:_.nd)};_.t.destroy=function(){this.a&&rB(this.a,function(){return!0});this.a=null;return Promise.resolve()};sB.prototype.ba=function(){return!0};sB.prototype.create=function(a){return new qB(a)};_.wm("single-native",new sB);};
|
|
279
280
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
280
281
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
281
282
|
else{_=this.clpp._;(f.call(g,this));}
|