@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/cl.mse.js
CHANGED
|
@@ -1,242 +1,241 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
|
|
3
|
-
_.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
_.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
_.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
c
|
|
34
|
-
_.
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
a.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
px=function(a,b){var c=new _.Ro(a.h.buffered);c=c.Zb.bind(c);var d=Math.max(a.B,a.m.rebufferingGoal);const e=a.m.safeSeekOffset;let f=rv(a.a,0);const g=qv(a.a),h=a.a.getDuration();3>g-f&&(f=g-3);const k=rv(a.a,d),l=rv(a.a,e);d=rv(a.a,d+e);if(b>=h)return a.f.debug("Playhead past duration."),lx(a,b);if(b>g)return a.f.debug("Playhead past end."),g;if(b<f){if(c(l))return a.f.debug("Playhead before start \x26 start is buffered"),l;a.f.debug("Playhead before start \x26 start is unbuffered");return d}if(b>=
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Kt,Lt,Mt,Nt,Ot,Pt,Qt,Rt,Ut,Vt,Yt,Zt,$t,au,bu,cu,eu,gu,hu,iu,ju,ku,nu,ou,ru,su,tu,uu,wu,zu,Au,Du,Gu,Iu,Ju,Ku,Lu,Mu,Ou,Tu,Yu,Zu,av,bv,cv,dv,ev,fv,gv,hv,jv,ov,sv,vv,xv,yv,Ev,Fv,Gv,Kv,Lv,Mv,Nv,Pv,Rv,Sv,Tv,Uv,Vv,Wv,Xv,Zv,$v,aw,bw,cw,dw,fw,gw,ew,Yv,mw,hw,iw,jw,kw,lw,nw,ow,rw,pw,qw,sw,tw,uw,vw,xw,yw,zw,Aw,Bw,Cw,Dw,Ew,Gw,Fw,Hw,Pw,Ow,Qw,Rw,Sw,Uw,Vw,Yw,Ww,Xw,Zw,$w,ax,bx,cx,dx,ex,fx,ix,jx,kx,lx,gx,hx,ox,rx,qx,sx,px,tx,vx,ux,xx,yx,zx,Ax,Bx,Cx,Hx,Ix,Kx,Lx,Ex,Fx,Gx,Mx,Nx,Ux,Px,Vx,Wx,Sx,Xx,Yx,Ox,
|
|
2
|
+
Qx,Rx,Zx,Dx,cy,fy,gy,hy,dy,ey,ay,by,iy,jy,ky,ly,my,ny,oy,py,qy,ry,sy,ty,Iw,Jw,Kw,Lw,Mw,Nw,Fy,Hy,Iy,Ny,Ly,Ky,My,Wy,Xy,az,ez,sz,Py,Zy,$y,Ty,dz,gz,hz,jz,Dy,lz,mz,pz,qz,rz,Uy,cz,vy,Cy,wz,Vy,Ay,By,Nz,wy,xy,yy,zy,uz,Mz,tz,Oz,yz,Fz,xz,Pz,Qz,Rz,Sz,Tz,Uz,Vz,pu,Xz,Vu,Uu,Yy,Dv,Jz,Iz,Qv,Qy;Kt=" buffer";Lt=" is being or has been set up";Mt="\x3c/DATA\x3e\x3c/WRMHEADER\x3e";Nt="CHECKSUM";Ot="Choosing new streams after key status change";Pt="IterateSegmentReference";Qt="Jumping forward";Rt="MediaSource threw QuotaExceededError:";
|
|
3
|
+
_.St="No stream with id";_.Tt="Player is in ERROR state and can not switch to ";Ut="PrestoPlay TextTrack";Vt="Removing audio from variant - audio not compatible with platform";_.Wt="Updating manifest...";_.Xt="VOD";Yt="bufferBehind\x3d";Zt="bufferedBehind\x3d";$t="calling onCanSwitch()...";au="cannot find segment";bu="clpp.mse.Player";cu="currentPeriod.startTime\x3d";_.du="getSegmentNextReference";eu="key-restriction";_.fu="onChooseStreams_";gu="presentationTime:";hu="presentationTime\x3d";iu="reference.endTime\x3d";
|
|
4
|
+
ju="reference.position\x3d";ku="reference.startTime\x3d";_.lu="subtitle";_.mu="subtitles";nu="switch: Stream ";ou=function(a){const b=a.a+a.f.byteOffset;let c=void 0;for(;_.zj(a);)if(0===_.Bj(a)){c=a.a+a.f.byteOffset-1;break}a=a.f.buffer.slice(b,c);return _.Ig(a)};_.qu=function(a){const b=new Uint8Array(pu),c=4+b.byteLength+a.h.byteLength+4+a.f.byteLength,d=new _.Sj(c,!1);_.O(d,c);_.yj(d,b);_.yj(d,a.h);_.O(d,a.f.byteLength);_.yj(d,a.f);return _.K(d.buffer)};
|
|
5
|
+
ru=function(a,b){a:{if(b)for(const c of a.g.keys()){const d=a.g.get(c);for(let e=0;e<d.bb.length;e++)if(d.bb[e]===b){a=d;break a}}a=null}return a?a.Ca:null};su=function(a,b){return _.fi("Edge/")?!0:a.J.has(b)};tu=function(a,b){a=a.j.get(b);return!(!a||a!==_.Md&&a!==_.gd)};
|
|
6
|
+
uu=function(a,b){const c=b.audio,d=b.video;if(c&&c.encrypted&&!su(a,_.Zh(c.mimeType,c.codecs))||d&&d.encrypted&&!su(a,_.Zh(d.mimeType,d.codecs)))return!1;const e=a.keySystem();return 0==b.drmInfos.length||b.drmInfos.some(f=>f.keySystem==e)};_.vu=function(a,b){return a.concat(b)};wu=function(){};_.xu=function(a,b){if(0==b.length)return a;const c=b.map(d=>new _.ig(d));return a.map(d=>new _.ig(d)).map(d=>c.map(d.resolve.bind(d))).reduce(_.vu,[]).map(d=>d.toString())};
|
|
7
|
+
_.yu=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:b||[],keyIds:[],periodId:c?c:null}};zu=function(a,b){a=_.vg(a);b=_.vg(b);a=a.split("-");b=b.split("-");return a[0]==b[0]&&1==a.length&&2==b.length};Au=function(a){return a.language?_.vg(a.language):a.audio&&a.audio.language?_.vg(a.audio.language):a.video&&a.video.language?_.vg(a.video.language):_.Ae};
|
|
8
|
+
_.Bu=function(a,b){a=_.vg(a);const c=new Set;for(var d of b)c.add(_.vg(d));for(const e of c)if(e==a)return e;for(const e of c)if(zu(e,a))return e;for(const e of c)if(d=e,b=a,d=_.vg(d),b=_.vg(b),d=d.split("-"),b=b.split("-"),b=2==d.length&&2==b.length&&d[0]==b[0])return e;for(const e of c)if(zu(a,e))return e;return null};_.Cu=function*(a){let b=-1,c=void 0,d=void 0;for(const e of a)0<=b&&(yield{Fd:b,item:d,fg:c,next:e}),b++,c=d,d=e;-1!==b&&(yield{Fd:b,fg:c,item:d,next:void 0})};
|
|
9
|
+
Du=function(a,b){for(const c in b)if(b[c]===a)return c;return""};
|
|
10
|
+
_.Eu=function(a,b){if(!a.length)return b;if(!b.length)return a;const c=[];for(let e=0;e<a.length;e++)for(var d=0;d<b.length;d++)if(a[e].keySystem===b[d].keySystem&&a[e].periodId===b[d].periodId){const f=a[e];d=b[d];let g=[];g=g.concat(f.initData||[]);g=g.concat(d.initData||[]);const h=[...f.keyIds||[]];d.keyIds&&d.keyIds.length&&d.keyIds.forEach(k=>{h.includes(k)||h.push(k)});c.push({keySystem:f.keySystem,licenseServerUri:f.licenseServerUri||d.licenseServerUri,distinctiveIdentifierRequired:f.distinctiveIdentifierRequired||
|
|
11
|
+
d.distinctiveIdentifierRequired,persistentStateRequired:f.persistentStateRequired||d.persistentStateRequired,videoRobustness:f.videoRobustness||d.videoRobustness,audioRobustness:f.audioRobustness||d.audioRobustness,serverCertificate:f.serverCertificate||d.serverCertificate,initData:g,keyIds:h,periodId:f.periodId});break}return c};_.Fu=function(a,b){return a.length&&b.length?0<_.Eu(a,b).length:!0};Gu=function(a,b){let c=0;for(const d of a)c+=b(d)?1:0;return c};
|
|
12
|
+
_.Hu=function(a){if(_.So.has(a))return _.So.get(a);if(window.ManagedMediaSource){var b=ManagedMediaSource.isTypeSupported(a);_.So.set(a,b);return b}return window.MediaSource?(b=MediaSource.isTypeSupported(a),_.So.set(a,b),b):!1};Iu=function(a,b){b=b.replace(/mp2t/i,_.zd);a==_.p&&(b=b.replace(_.w,_.p));if(a=/avc1\.(66|77|100)\.(\d+)/.exec(b)){let d="avc1.";var c=a[1];d="66"==c?d+"4200":"77"==c?d+"4d00":d+"6400";c=Number(a[2]);d+=(c>>4).toString(16);d+=(c&15).toString(16);b=b.replace(a[0],d)}return b};
|
|
13
|
+
Ju=function(a,b){return!window.muxjs||"mp2t"!=a.toLowerCase().split(";")[0].split("/")[1]&&"aac"!=a.toLowerCase().split(";")[0].split("/")[1]?!1:b?_.Hu(Iu(b,a))||_.Hu(a.replace(/aac/i,_.zd)):_.Hu(Iu(_.p,a))||_.Hu(a.replace(/aac/i,_.zd))||_.Hu(Iu(_.w,a))};
|
|
14
|
+
Ku=function(a,b){const c=new Map;c.set(a,b);try{const d=b.match(/"(.*?)"/)[0].replace(/"/g,"").split(","),e=new Map;if(1<d.length)for(const f of d)f.startsWith("avc")?e.set(_.w,`video/mp4;codecs="${f}"`):f.startsWith("mp4a")&&e.set(_.p,`audio/mp4;codecs="${f}"`);return 0<e.size?e:c}catch(d){return c}};Lu=function(a,b){a.h=!0;a.f=new _.Sk;a.m=[];a.j=[];a.g=[];b=_.K(b);a.a.push(b);a.a.flush();a.h&&a.f.reject(new _.H(_.G,3,3018));return a.f};
|
|
15
|
+
Mu=function(a){const b=[a.mimeType];_.To.forEach((c,d)=>{(d=a[d])&&b.push(c+'\x3d"'+d+'"')});return b.join(";")};_.Nu=function(a){a=a.split(".");const b=a[0];a.pop();return[b,a.join(".")]};Ou=function(a,b="total"){b=new _.Xo(void 0,b);for(const c of a)b.a.push(c);b.length=a.length;return b};_.Pu=function(a,b){return Array.prototype.filter.call(a.childNodes,c=>c instanceof Element&&c.tagName==b)};_.Qu=function(a,b){a=_.Pu(a,b);return 1!=a.length?null:a[0]};
|
|
16
|
+
_.Ru=function(a){return Array.prototype.every.call(a.childNodes,b=>b.nodeType==Node.TEXT_NODE||b.nodeType==Node.CDATA_SECTION_NODE)?a.textContent.trim():null};_.Su=function(a,b){const c=new DOMParser;let d=null,e=null;try{e=c.parseFromString(a,_.we)}catch(f){}e&&e.documentElement.tagName==b&&(d=e.documentElement);return d&&0<d.getElementsByTagName("parsererror").length?null:d};
|
|
17
|
+
Tu=function(a){const 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=_.K(a);a.set(b,0);return a};
|
|
18
|
+
_.Wu=function(a,b,c,d){var e=_.ah(b);if(8!==e.byteLength)e="";else{var f=Tu(e);e=_.Yg(f);b:switch(f=f.byteLength,_.Hf("Trying to create PlayReady header in version",a),a){case "4.0.0.0":e=[`<WRMHEADER xmlns="${"http://schemas.microsoft.com/DRM/2007/03/PlayReadyHeader"}" version="${a}">`,"\x3cDATA\x3e\x3cPROTECTINFO\x3e",`<KEYLEN>${f}</KEYLEN>`,"\x3cALGID\x3eAESCTR\x3c/ALGID\x3e\x3c/PROTECTINFO\x3e",`<KID>${e}</KID>`,c?`<CHECKSUM>${c}</CHECKSUM>`:"",d?`<LA_URL>${d}</LA_URL>`:"",Mt].join("");break b;
|
|
19
|
+
case "4.1.0.0":e=[`<WRMHEADER xmlns="${"http://schemas.microsoft.com/DRM/2007/03/PlayReadyHeader"}" version="${a}">`,'\x3cDATA\x3e\x3cPROTECTINFO\x3e\x3cKID ALGID\x3d"AESCTR" ',c?`CHECKSUM="${c}" `:"",`VALUE="${e}"`,"\x3e\x3c/KID\x3e\x3c/PROTECTINFO\x3e",d?`<LA_URL>${d}</LA_URL>`:"",Mt].join("");break b;case "4.2.0.0":case "4.3.0.0":e=[`<WRMHEADER xmlns="${"http://schemas.microsoft.com/DRM/2007/03/PlayReadyHeader"}" version="${a}">`,'\x3cDATA\x3e\x3cPROTECTINFO\x3e\x3cKIDS\x3e\x3cKID ALGID\x3d"AESCTR" ',
|
|
20
|
+
c?`CHECKSUM="${c}" `:"",`VALUE="${e}"`,"\x3e\x3c/KID\x3e\x3c/KIDS\x3e\x3c/PROTECTINFO\x3e",d?`<LA_URL>${d}</LA_URL>`:"",Mt].join("");break b;default:_.C("Cannot create PlayReady header in version",a),e=""}}if(!e)return null;_.Hf("New payload",e);e=_.K(_.Ng(e,!0));return new Uu(Vu,b,d||null,e,a,c)};_.Xu=function(a,b){return b===a.version?a:_.Wu(b,a.a,a.j||void 0,a.g||void 0)};
|
|
21
|
+
Yu=function(a){a=_.Qu(a,"PROTECTINFO");if(!a)return null;var b=_.Qu(a,"KID");if(!b)return null;a=b.getAttribute("VALUE");if(!a)return null;const c=b.getAttribute(Nt);b=b.getAttribute("ALGID");return{value:a,ud:c,qf:b}};
|
|
22
|
+
Zu=function(a){a=_.Qu(a,"PROTECTINFO");if(!a)return null;a=_.Qu(a,"KIDS");if(!a)return null;var b=_.Pu(a,"KID");if(!b.length)return null;a=[];for(const c of b)if(b=c.getAttribute("VALUE")){const d=c.getAttribute(Nt),e=c.getAttribute("ALGID");a.push({value:b,ud:d,qf:e})}return a.length?a:null};
|
|
23
|
+
_.$u=function(a){a:{a=new _.wk(new DataView(a.buffer),!0);_.P(a);for(_.Cj(a);_.zj(a);)if(1===_.Cj(a)){var b=_.Cj(a);a=_.Gj(a,b);break a}a=null}b=_.Kg(a,!0);var c=_.Su(b,"WRMHEADER");b=c.getAttribute("version");var d=_.Qu(c,"DATA");c=(c=_.Qu(d,"LA_URL"))?_.Ru(c):"";var e;if(e=_.Qu(d,"KID"))if(e=_.Ru(e)){var f=_.Qu(d,Nt);e={value:e,ud:f?f.textContent.trim():null}}else e=null;else e=null;d=e?[e]:(e=Yu(d))?[e]:(d=Zu(d))?d:null;const {value:g="",ud:h}=d&&d[0]||{};d=_.$g(g);d=Tu(d);d=_.bh(d);return new Uu(Vu,
|
|
24
|
+
d,c,a,b,h)};av=function(a,b){return a.start-b.start};bv=function(a){return a.S.map(b=>({start:b.start,end:b.end,width:b.width,height:b.height,bandwidth:b.bandwidth,rendition:b.rendition}))};cv=function(a){a.a&&a.a.trigger(new _.F(_.ec))};
|
|
25
|
+
dv=function(a){if(a.a){var b=!1,c={};for(let d=0;d<a.S.length;d++){const 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(_.xe,a.f,a),a.g=!0):!b&&a.g&&(a.log.debug("Stop tracking timeupdates"),a.a.off(_.xe,a.f),a.g=!1)}};ev=function(a,b,c){a.S=a.S.filter(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 _.F(_.Le))};
|
|
26
|
+
fv=function(a,b){let c=null;for(const d of a)b>=d.startTime&&(c=d);return c};gv=function(a){const b=new Set;a.variants.forEach(c=>{c.audio&&b.add(c.audio);c.video&&(b.add(c.video),c.video.trickModeVideo&&b.add(c.video.trickModeVideo))});a.textStreams.forEach(c=>b.add(c));a.thumbStreams.forEach(c=>b.add(c));return b};hv=function(a,b){for(let c=0;c<a.length;c++)if(gv(a[c]).has(b))return c;return-1};jv=function(a,b){Array.from(gv(a)).forEach(c=>{c.segmentIndex&&_.iv(c.segmentIndex,b)})};
|
|
27
|
+
_.kv=function(a,b,c){const d=Math.pow(a.g,b);c=c*(1-d)+d*a.a;isNaN(c)||(a.a=c,a.f+=b)};_.lv=function(a){return a.a/(1-Math.pow(a.g,a.f))};_.mv=function(a,b,c,d,e,f,g,h){a=_.nh(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};_.nv=function(a,b){a.m=b;a.o=b};
|
|
28
|
+
ov=function(a){return a.m?a.f:a.o?a.g:null};_.pv=function(a,b){a.h=null==a.h?b:Math.min(a.h,b)};_.qv=function(a,b,c){if(0!=b.length){var d=b[b.length-1].endTime+c;_.pv(a,b[0].startTime+c);a.a=b.reduce((e,f)=>Math.max(e,f.endTime-f.startTime),a.a);a.g=Math.max(a.g||0,d);null!=a.w&&a.I&&(a.w=(Date.now()+a.B)/1E3-(a.g||0)-a.a);a.C.debug("notifySegments: maxSegmentDuration\x3d"+a.a)}};_.rv=function(a,b){a.a=Math.max(a.a,b);a.C.debug("notifyNewSegmentDuration: maxSegmentDuration\x3d"+a.a)};
|
|
29
|
+
sv=function(a){if(a.m)a=a.f;else if(a.o)a=a.g||0;else{var b=(Date.now()+a.B)/1E3;b=a.G?Math.max(0,b-(a.a-a.A)-a.w):Math.max(0,b-a.a-a.w);a=Math.min(b,a.f)}return a};_.uv=function(a){return Infinity==a.j?0:Math.max(0,sv(a)-a.j)};vv=function(a){return Math.max(0,sv(a)-(a.m||a.o?0:a.F))};_.wv=function(a,b){const c=Math.max(a.h,0);return Infinity==a.j?Math.ceil(1E3*c)/1E3:Math.max(c,Math.min(sv(a)-a.j+b,vv(a)))};xv=function(a,b){a.f=b};
|
|
30
|
+
yv=function(a){let b=a.g.get(a.a);if(!b)return null;0<b.a.length&&b.Ia().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};_.iv=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)};_.zv=function(a){return a.a.length?a.a[a.a.length-1].endTime:0};
|
|
31
|
+
_.Bv=function(a,b){let c=[];const d=[];for(var e=0,f=0;e<a.a.length&&f<b.length;){var g=a.a[e];const h=b[f];g.startTime<h.startTime?(c.push(g),e++):(g.startTime>h.startTime?0===e?d.push(h):a.h.info("Refusing to rewrite original references on update!"):(.1<Math.abs(g.endTime-h.endTime)?c.push(new _.Av(g.position,h.startTime,h.endTime,h.Ia,h.ua,h.ha,h.sa,h.keyInfo,h.lc,h.timescale,h.horizontalTiles,h.verticalTiles,h.durationPerTile)):c.push(g),e++),f++)}for(;e<a.a.length;)c.push(a.a[e++]);if(c.length)for(e=
|
|
32
|
+
c[c.length-1].position+1;f<b.length;)g=b[f++],g=new _.Av(e++,g.startTime,g.endTime,g.Ia,g.ua,g.ha,g.sa,g.keyInfo,g.lc,g.timescale,g.horizontalTiles,g.verticalTiles,g.durationPerTile),c.push(g);else c=b;b=c;if(d.length&&c.length){b=[];f=c[0].position;e=d.length;for(const h of d)b.push(new _.Av(f-e--,h.startTime,h.endTime,h.Ia,h.ua,h.ha,h.sa,h.keyInfo,h.lc,h.timescale,h.horizontalTiles,h.verticalTiles,h.durationPerTile));for(const h of c)b.push(h)}a.a=b};
|
|
33
|
+
_.Cv=function(a,b){for(let c=0;c<a.a.length;++c)if(a.a[c].endTime>b)return a.a.splice(0,c);b=a.a;a.a=[];return b};Ev=function(a,b){let c=a.f(b);c=null===c?-1:c-1;const d=a.get(c+1);let e=-1;if(d&&0<d.a.length)for(let f=d.a.length-1;0<=f;--f){let 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 Dv(a,c,e)};Fv=function(a,b){for(const c of a.a)c.m(a.f.currentTime,b)};Gv=function(a,b,c,d){a.a=b;a.f=c;a.g=d};_.Hv=function(a){_.Fn[a]&&delete _.Fn[a]};
|
|
34
|
+
_.Iv=function(a){_.Dn[a]&&delete _.Dn[a]};_.Jv=function(a){a=a.toLowerCase();return _.co[a]||window.muxjs&&a==_.Tb?!0:!1};Kv=function(a,b,c,d){return Promise.resolve().then(()=>{if(a.o&&a.g)if(null==c||null==d)a.o.parseInit(_.K(b));else{var e={periodStart:a.w,segmentStart:c,segmentEnd:d};e=a.o.parseMedia(_.K(b),e);var f=e.cues.filter(g=>g.startTime>=a.h&&g.startTime<a.j);a.g.append(f,e.styles);null==a.a&&(a.a=Math.max(c,a.h));a.f=Math.min(d,a.j)}})};
|
|
35
|
+
Lv=function(a,b,c){a.A=b;if(b=a.m.get(b))for(const d of b.keys()){let e=b.get(d);e&&(e=e.filter(f=>f.endTime<=c),a.g.append(e,[]))}};
|
|
36
|
+
Mv=function(a,b,c,d,e){const f=c+" "+d,g=new Map;for(const h of b){b=h.stream;g.has(b)||g.set(b,new Map);g.get(b).has(f)||g.get(b).set(f,[]);h.startTime+=e;h.endTime+=e;if(!(h.startTime>=a.h&&h.startTime<a.j))continue;const k=new _.xo(h.startTime,h.endTime,h.text);g.get(b).get(f).push(k);b==a.A&&a.g.append([k],[])}for(const h of g.keys()){a.m.has(h)||a.m.set(h,new Map);for(const k of g.get(h).keys())e=g.get(h).get(k),a.m.get(h).set(k,e)}a.a=null==a.a?Math.max(c,a.h):Math.min(a.a,Math.max(c,a.h));
|
|
37
|
+
a.f=Math.max(a.f,Math.min(d,a.j))};Nv=function(a){const b=_.Zh(a.mimeType,a.codecs),c=Mu(a);return _.Jv(b)||_.Hu(c)||Ju(b,a.type)};
|
|
38
|
+
Pv=function(a,b){if(window.ManagedMediaSource){a.j.disableRemotePlayback=!0;var c=new ManagedMediaSource;a.m.one(c,"sourceopen",()=>{URL.revokeObjectURL(a.w);b.resolve()});a.m.on(c,"startstreaming",()=>{a.R=!0});a.m.on(c,"endstreaming",()=>{a.R=!1});a.w=Ov(c);a.j.src=a.w;return c}c=new MediaSource;a.w=Ov(c);a.m.one(c,"sourceopen",()=>{URL.revokeObjectURL(a.w);b.resolve()});a.j.src=a.w;return c};
|
|
39
|
+
Rv=function(a,b){a.f||(a.f=new Qv(a.K,a.C));a=a.f;if(b!=_.Tb){var c=_.co[b];if(!c)throw new _.H(_.G,2,2012,"Text parser is unavailable for "+b);a.o=new c(a.B)}};Sv=function(a,b){b.forEach((c,d)=>{c=a.o.addSourceBuffer(c);a.m.on(c,_.ad,a.U.bind(a,d));a.m.on(c,"updateend",a.A.bind(a,d));a.g[d]=c;a.h[d]=[];a.G[d]=!1});a.N=b.has(_.p)&&b.has(_.w)};Tv=function(a){return a.K.streaming.ignoreManagedMediaSourceStreamingHints?!0:a.R};Uv=function(a){return a.o?a.o.readyState==_.$c:!0};
|
|
40
|
+
Vv=function(a,b){try{return new _.Xo(a.g[b].buffered,b)}catch(c){return b in a.g&&a.a.error("failed to get buffered range for "+b,c),null}};Wv=function(a){const b={};b.total=new _.Xo(a.j.buffered,"total");b.audio=Vv(a,_.p);b.video=Vv(a,_.w);let c=[];a.f&&(c=[{start:a.f.ob(),end:a.f.Aa()}]);b.text=Ou(c,_.u);return b};Xv=function(a,b){return a.g[b]?(a=Vv(a,b))?a.toString():"":""};Zv=function(a,b,c){if(a.J)return Promise.reject();c={start:c,p:new _.Sk};a.h[b].push(c);1===a.h[b].length&&Yv(a,b);return c.p};
|
|
41
|
+
$v=function(a,b,c,d,e,f,g,h){h=void 0===h?!1:h;const k=a.g[b];let l=-1,m=0;k&&k.buffered&&(m=k.buffered.length);b===_.w&&null!==d&&null!==e&&h&&(l=0<m?k.buffered.end(m-1):-1);b==_.u?c=Kv(a.f,c,d,e):a.B[b]?c=Lu(a.B[b],c).then(n=>{n.captions&&0<n.captions.length&&(a.f||Rv(a,_.ve),Mv(a.f,n.captions,d,e,a.g.video.timestampOffset));const q=[];0<n.audio.byteLength&&a.g.audio&&q.push(Zv(a,_.p,a.M.bind(a,_.p,n.audio.buffer)));0<n.video.byteLength&&a.g.video&&q.push(Zv(a,_.w,a.M.bind(a,_.w,n.video.buffer)));
|
|
42
|
+
return Promise.all(q)}):(f&&window.muxjs&&(a.f||Rv(a,_.ve),null==d&&null==e?a.H.init(c):a.H.g(c,n=>{n.length&&Mv(a.f,n,d,e,a.g.video.timestampOffset)})),c=Zv(a,b,a.M.bind(a,b,c)));return c.then(()=>{if(b===_.w&&null!==d&&null!==e&&!h)a.F.append(d,e,g),null!==d&&null!==e&&a.a.debug("Appended video segment ",d,e,"Buffer:",Xv(a,b));else if(b===_.p&&null!==d&&null!==e)cv(a.F),null!==d&&null!==e&&a.a.debug("Appended audio segment ",d,e,"Buffer:",Xv(a,b));else if(b===_.w&&null!==d&&null!==e&&h){var n=k.buffered.length,
|
|
43
|
+
q=0<n?k.buffered.end(n-1):-1;0>l&&0<n&&(l=k.buffered.start(0));0<=l&&0<q&&a.F.append(l,q,g)}if(!a.G[b]&&k&&1===k.buffered.length){n=k.buffered.start(0);const t=d-n;if(Math.abs(t)>a.aa&&0===k.timestampOffset)return a.a.warn(`Detected a delta of ${t} between `+`media times and segment times for ${b}. `+`The segment start time is ${d} and the media start time `+`is ${n}. Adjusting timestampOffset.`),n=Zv(a,b,()=>{a.W(b,t)}),q=Zv(a,b,a.T.bind(a,b,!1)),Promise.all([n,q])}null!==d&&null!==e&&(a.G[b]=!0)}).catch(n=>
|
|
44
|
+
{throw n;})};aw=function(a,b){const c=a.Aa(_.w)||0;Lv(a.f,b,c)};bw=function(a){a.f&&Lv(a.f,"",0)};cw=function(a,b,c,d,e){return[Zv(a,b,a.Y.bind(a,b)),Zv(a,b,a.W.bind(a,b,c)),Zv(a,b,a.ba.bind(a,b,d,e))]};dw=function(a,b,c,d,e){if(b==_.u)return a.f.w=c,a=a.f,a.h=d,a.j=e,Promise.resolve();b=cw(a,b,c,d,e);a.N&&(b=b.concat(cw(a,_.p,c,d,e)));return Promise.all(b)};
|
|
45
|
+
fw=function(a,b){if(a.J)return Promise.reject();const c=[];for(const d in a.g){const e=new _.Sk,f={start:function(g){g.resolve()}.bind(null,e),p:e};a.h[d].push(f);c.push(e);1==a.h[d].length&&f.start()}return Promise.all(c).then(()=>{for(const e in a.g);let d;try{b()}catch(e){d=Promise.reject(new _.H(_.G,3,3015,{mediaError:e}))}for(const e in a.g)ew(a,e);return d},()=>{for(const d in a.g)a.h[d].length&&a.h[d].shift();return Promise.reject()})};gw=function(a,b){fw(a,()=>{a.o.duration=b})};
|
|
46
|
+
ew=function(a,b){a.h[b].shift();Yv(a,b)};Yv=function(a,b){const c=a.h[b][0];if(c)try{a.a.debug("Starting next operation for "+b),c.start()}catch(d){"QuotaExceededError"==d.name?c.p.reject(new _.H(_.G,3,3017,{type:b})):c.p.reject(new _.H(_.G,3,3015,{mediaError:d})),ew(a,b)}else a.a.debug("No more scheduled operations for "+b)};
|
|
47
|
+
mw=function(a,b,c,d){var e=a.periods.flatMap(h=>h.variants);if(b.length||c.length)e=hw(e,b,c);e=iw(e,d);if(1<a.periods.length){const h=l=>{l=l.split(".");let m=l[0];1<l.length&&(m+="."+l[1]);return m.toLowerCase()};b=[];for(var f of a.periods){c=new Set;for(const l of f.variants)null!==l.audio&&c.add(h(l.audio.codecs));b.push(c)}let k=b[0];for(f=1;f<b.length;f++){const l=b[f];k=new Set([...k].filter(m=>l.has(m)))}e=e.filter(l=>0===k.size&&null===l.audio?!0:0<k.size&&null===l.audio?!1:k.has(h(l.audio.codecs)))}e=
|
|
48
|
+
jw(e);const g=kw(e);for(const h of a.periods)h.variants=h.variants.filter(k=>{if(lw(k)===g)return!0;_.Hf("Dropping Variant (better codec available)",k);return!1})};hw=function(a,b,c){for(const d of b)if(b=a.filter(e=>e.video&&e.video.codecs.startsWith(d)),b.length){a=b;break}for(const d of c)if(c=a.filter(e=>e.audio&&e.audio.codecs.startsWith(d)),c.length){a=c;break}return a};
|
|
49
|
+
iw=function(a,b){var c=a.filter(f=>f.audio&&f.audio.channelsCount);const d=new Map;for(var e of c)c=e.audio.channelsCount,d.has(c)||d.set(c,[]),d.get(c).push(e);e=Array.from(d.keys());if(0===e.length)return a;a=e.filter(f=>f<=b);return a.length?d.get(Math.max.apply(null,a)):d.get(Math.min.apply(null,e))};jw=function(a){const b=new _.lo;for(const c of a)a=lw(c),b.push(a,c);return b};
|
|
50
|
+
kw=function(a){let b="",c=Infinity;a.forEach((d,e)=>{e=e.reduce((f,g)=>f+g.bandwidth||0,0)/e.length;_.Hf(_.Gc,d,"avg bandwidth",e);e<c&&(b=d,c=e)});return b};lw=function(a){let b="";a.video&&(b=_.Nu(a.video.codecs)[0]);let c="";a.audio&&(c=_.Nu(a.audio.codecs)[0]);return b+"-"+c};
|
|
51
|
+
nw=function(a,b,c){var d=a.video,e;if(e=d&&d.width&&d.height){e=d.width;if(e=e>=b.minWidth&&e<=Math.min(b.maxWidth,c.width))e=d.height,e=e>=b.minHeight&&e<=Math.min(b.maxHeight,c.height);if(c=e)d=d.width*d.height,c=d>=b.minPixels&&d<=b.maxPixels;e=!c}(d=e)||(a=a.bandwidth,d=!(a>=b.minBandwidth&&a<=b.maxBandwidth));return d?!1:!0};ow=function(a,b,c){let d=!1;for(const e of a)a=e.allowedByApplication,e.allowedByApplication=nw(e,b,c),a!=e.allowedByApplication&&(d=!0);return d};
|
|
52
|
+
rw=function(a,b,c,d){let e=!1;d.variants=d.variants.filter(f=>{if(a&&a.R&&!uu(a,f))return _.Hf("Dropping variant - not compatible with key system",f),!1;let g=f.audio;const h=f.video;if(g&&!Nv(g)){const k=g.codecs;0<=g.codecs.indexOf("ec-3")?(_.Hf("Trying to use AC-3 for EC-3"),g.codecs=g.codecs.replace("ec-3","ac-3"),Nv(g)?_.Cf("Using AC-3 instead of EC-3 for",pw(g)):(g.codecs=k,_.Cf(Vt,pw(g)),f.audio=null,e=!0,g=null)):(_.Cf(Vt,pw(g)),f.audio=null,e=!0,g=null)}return h&&!Nv(h)?(_.Cf("Dropping variant - video not compatible with platform",
|
|
53
|
+
pw(h)),!1):g&&b&&!qw(g,b)?(_.Cf("Dropping variant - not compatible with active audio","active audio",pw(b),"variant.audio",pw(g)),!1):h&&c&&!qw(h,c)?(_.Cf("Dropping variant - not compatible with active video","active video",pw(c),"variant.video",pw(h)),!1):!0});if(e){let f=!1,g=!1;for(const h of d.variants)!f&&h.video&&h.audio&&(f=!0),g||h.audio||!h.video||(g=!0);f&&g&&(d.variants=d.variants.filter(h=>h.video&&!h.audio?(_.Cf("Dropping variant - not compatible with video + audio","variant.video",pw(h.video)),
|
|
54
|
+
!1):!0))}d.textStreams=d.textStreams.filter(f=>{const g=_.Jv(_.Zh(f.mimeType,f.codecs));g||_.Hf("Dropping text stream. Is not supported by the platform.",f);return g})};
|
|
55
|
+
pw=function(a){const b=Mu(a);return a.type===_.p?"type\x3daudio mimeType\x3d"+a.mimeType+" codecs\x3d"+a.codecs+" codecInfo\x3d"+b+" bandwidth\x3d"+a.bandwidth+" channelsCount\x3d"+a.channelsCount:a.type===_.w?"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"};
|
|
56
|
+
qw=function(a,b){return a.mimeType!=b.mimeType||a.codecs.split(".")[0]!=b.codecs.split(".")[0]?!1:!0};
|
|
57
|
+
sw=function(a){const 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);const g=c&&c.mimeType||null,h=b&&b.mimeType||null;var k=[];b&&k.push(b.kind);c&&k.push(c.kind);k=k[0]||null;const l=new Set,m=new Set;if(b)for(var n of b.roles)m.add(n);if(c)for(const q of c.roles)l.add(q);n=[c,b].map(q=>q?q.accessibility||[]:[]).reduce((q,t)=>q.concat(t),[]);a={id:a.id,active:!1,type:"variant",bandwidth:a.bandwidth,language:a.language,originalLanguage:a.language,label:null,
|
|
58
|
+
kind:k,width:null,height:null,frameRate:null,mimeType:g,audioMimeType:h,codecs:f.join(", "),audioCodec:d,videoCodec:e,primary:a.primary,roles:Array.from(l),audioRoles:Array.from(m),videoId:null,audioId:null,channelsCount:null,audioBandwidth:null,videoBandwidth:null,originalVideoId:null,originalAudioId:null,originalTextId:null,accessibility:n,keyId:c?c.keyId:b?b.keyId:null};c&&(a.videoId=c.id,a.originalVideoId=c.originalId,a.width=c.width||null,a.height=c.height||null,a.frameRate=c.frameRate||null,
|
|
59
|
+
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};
|
|
60
|
+
tw=function(a){return{id:a.id,active:!1,type:_.u,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,
|
|
61
|
+
keyId:null}};uw=function(a){return a.allowedByApplication&&a.allowedByKeySystem};
|
|
62
|
+
_.ww=function(a,b,c){b=_.Yf(b);let d=a;const e=a.filter(g=>g.primary);e.length&&(d=e);const f=d.length?d[0].language:"";d=d.filter(g=>g.language===f);b.some(g=>{const h=_.Bu(_.vg(g),a.map(k=>k.language));return h?(d=a.filter(k=>_.vg(k.language)===h),!0):!1});if(c){b=vw(d,c);if(b.length)return b;_.C("No exact match for the text role could be found.")}else if(b=d.filter(g=>0===g.roles.length),b.length)return b;b=d.map(g=>g.roles).reduce(_.vu,[]);return b.length?vw(d,b[0]):d};
|
|
63
|
+
vw=function(a,b){return a.filter(c=>c.roles.includes(b))};xw=function(a,b,c){for(let d=0;d<c.length;d++)if(c[d].audio===a&&c[d].video===b)return c[d];return null};
|
|
64
|
+
yw=function(a,b){var c=String(_.Bh++);c=new _.Ch(c,a);c.mimeType=_.yh(b.mimeType);if(a===_.L||a===_.M)c.label=_.yh(b.label),c.language=_.yh(b.language),c.originalLanguage=_.yh(b.originalLanguage);a===_.N?(c.frameRate=b.frameRate,c.roles=b.roles):a===_.M?(c.channelsCount=b.channelsCount,c.roles=b.audioRoles||[],c.mimeType=_.yh(b.audioMimeType)):(c.kind=_.yh(b.kind),c.roles=b.roles);c.accessibility=a===_.N||a===_.M?(b.accessibility||[]).filter(d=>d.type===a):b.accessibility||[];return c};
|
|
65
|
+
zw=function(a,b,c){const d=new _.Kh(a===_.N?`${b.videoId}`:a===_.M?`${b.audioId}`:`${b.id}`,c);switch(a){case _.N:d.codec=_.yh(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 _.M:d.codec=_.yh(b.audioCodec);d.bandwidth=b.audioBandwidth||b.bandwidth;d.originalId=b.originalAudioId;d.drm={keyId:b.keyId||void 0};break;default:d.codec=_.yh(b.codecs),d.originalId=b.originalTextId}(a=c.renditions.find(e=>
|
|
66
|
+
_.sf(e,d,null,["id","track"])))||c.renditions.push(d);return a||d};Aw=function(a,b){a=a.reduce((c,d)=>{b===_.N?null===d.videoId||c[d.videoId]&&!d.active||(c[d.videoId]=d):b===_.M&&(null===d.audioId||c[d.audioId]&&!d.active||(c[d.audioId]=d));return c},{});return Object.values(a)};Bw=function(a,b){if(void 0!==b&&null!==b){const c=a.filter(d=>d.audio&&d.audio.id===b);if(0<c.length)return c}return a};
|
|
67
|
+
Cw=function(a,b,c){function d(e,f){return null==e?null==f:f.id==e}for(let e=0;e<c.length;e++)if(d(a,c[e].audio)&&d(b,c[e].video))return c[e];return null};Dw=function(a,b){return a.h.filter(c=>c.type===b)};Ew=function(a,b){return(a=a.a.get(b)||null)&&a.track};Gw=function(a,b,c){c&&Ew(a,c.type)===c&&!a.l.la()||Fw(a,b,c&&c.renditions[0])};
|
|
68
|
+
Fw=function(a,b,c,d){d=void 0===d?!1:d;if(a.l&&((a.a.get(b)||null)!==c||a.l.la())){var e=a.l;if(c){if(0>a.h.indexOf(c.track))throw Error(`Unknown rendition with ID ${c.id}`);if(b!==c.track.type)throw Error("Types mismatch");a.g.debug(`Activate rendition type
|
|
69
|
+
${b} with ID: ${c.id}`);if(b===_.L){const f=e.ja().find(g=>g.id==c.id);f&&(a.f.set(b,c),Hw(a,c),e.trigger(new _.F(_.Vi)),Iw(e,!0).then(()=>{Jw(e,f)}).catch(g=>{a.g.warn("Error while activating track",g)}))}else if(b===_.M)a.f.set(b,c),Kw(e,parseInt(c.id,10));else if(b===_.N){const f=a.a.get(_.M)||null;let g=null;if(f){const h=Lw(e).filter(k=>k.videoId==c.id);g=h.find(k=>k.audioId==f.id)||null;if(!g){a.g.debug("Unable to find exact variant. Searching for equivalent");const k=f.track.renditions.map(l=>
|
|
70
|
+
l.id).filter(l=>l!==f.id);g=h.find(l=>k.find(m=>m==l.audioId))||null}}else g=Lw(e).find(h=>h.videoId==c.id)||null;g?(a.f.set(b,c),Mw(e,g,d)):a.g.warn("Cannot find matching variant")}}else a.g.debug(_.va+b),Ew(a,b)&&(b===_.L?Iw(e,!1).then(()=>{a.a.set(b,null);e.trigger(new _.F(_.Vi))}).catch(f=>{a.g.warn("Error while de-activating text tracks",f)}):b===_.M?a.g.info("Enabling ABR for audio is not supported"):Mw(e,null,d))}};
|
|
71
|
+
Hw=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)};Pw=function(a){if(a.l){a.g.debug("Track list change detected, updating track list");var b=[];for(var c of Object.values(_.Qo))a.a.set(c,null),a.f.set(c,null);for(var d of a.l.ja()){let e=yw(_.L,d);e=(c=b.find(g=>e.bd(g)))||e;const f=zw(_.L,d,e);d.active&&a.a.set(_.L,f);c||b.push(e)}Nw(a.l)||a.a.set(_.L,null);d=Lw(a.l);Ow(a,b,d,_.N);Ow(a,b,d,_.M);a.h=b}};
|
|
72
|
+
Ow=function(a,b,c,d){c=Aw(c,d);for(const e of c){let f=yw(d,e);f=(c=b.find(h=>f.bd(h)))||f;const g=zw(d,e,f);e.active&&a.a.set(d,g);c||b.push(f)}};Qw=function(a,b,c){if(b){a.h.length||Pw(a);var d=b.type,e=a.a.get(d)||null,f;for(const g of Dw(a,d))if(f=g.renditions.find(h=>h.id==b.id))break;f&&e!==f&&(Hw(a,f),d===_.M?a.l.trigger(new _.F(_.Ui)):d===_.N&&a.l.trigger(new _.F(_.Me,{details:{width:f.width||0,height:f.height||0,bandwidth:f.bandwidth,track:f.track,abrSelection:c}})))}};
|
|
73
|
+
Rw=function(a,b){return 128E3>a.a?b:Math.min(_.lv(a.f),_.lv(a.g))};Sw=function(a,b){a&&(b=b.filter(c=>nw(c,a,{width:Infinity,height:Infinity})));return b.sort((c,d)=>c.bandwidth-d.bandwidth)};Uw=function(a,b){a.a.has(b)||a.a.set(b,new Tw);return a.a.get(b)};Vw=function(a,b,c){Uw(a,b).text=c};
|
|
74
|
+
Yw=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&&Ww(c,d)&&Xw(c.roles,d.roles))}!c&&(c=a.video&&b.video)&&(a=a.video,b=b.video,c=!(Ww(a,b)&&Xw(a.roles,b.roles)));return c?!1:!0};
|
|
75
|
+
Ww=function(a,b){if(a.mimeType!=b.mimeType)return!1;a=a.codecs.split(",").map(c=>_.Nu(c)[0]);b=b.codecs.split(",").map(c=>_.Nu(c)[0]);if(a.length!=b.length)return!1;a.sort();b.sort();for(let c=0;c<a.length;c++)if(a[c]!=b[c])return!1;return!0};Xw=function(a,b){a=new Set(a);b=new Set(b);a.delete("main");b.delete("main");if(a.size!=b.size)return!1;for(const c of a)if(!b.has(c))return!1;return!0};
|
|
76
|
+
Zw=function(a,b){let c=null;b.some(d=>{c=_.Bu(_.vg(d),a.map(e=>Au(e)));return!!c});return c?a.filter(d=>c===Au(d)):[]};$w=function(a,b){return a.filter(c=>{const d=c.audio;c=c.video;return d&&0<=d.roles.indexOf(b)||c&&0<=c.roles.indexOf(b)})};
|
|
77
|
+
ax=function(a){return 1>=a.a.chasingRate?(a.f.warn("chasingRate must be greater than 1."),!1):a.a.chaseJumpDistance<=a.a.startChasingAt?(a.f.warn("chaseJumpDistance must be greater than startChasingAt."),!1):a.a.startChasingAt<=a.a.stopChasingAt?(a.f.warn("startChasingAt must be greater than stopChasingAt."),!1):0>a.a.stopChasingAt?(a.f.warn("stopChasingAt must be greater than or equal to 0."),!1):!0};bx=function(a,b){a.f=b};
|
|
78
|
+
cx=function(a){a.f.stop();const b=a.h?0:a.g;0<=b?a.a.Dd()!=b&&a.a.bf(b):(a.f.Xa(.25),0!=a.a.Dd()&&a.a.bf(0))};dx=function(a,b){a.f=b};ex=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(let c=0;c<b.length;c++){const 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};
|
|
79
|
+
fx=function(a){if(0!=a.a.readyState){if(a.a.seeking){if(!a.A)return}else a.A=!1;if(!a.a.paused&&!a.m){a.a.readyState!=a.G&&(a.h=!1,a.G=a.a.readyState);var b=a.j.smallGapLimit,c=a.a.currentTime,d=a.a.buffered;a:{var e=new _.Xo(d);var f=a.j.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=ex(d);d=d.a.currentTime;b=Date.now()/1E3;if(a.a!=d||a.j!=c)a.h=
|
|
80
|
+
b,a.a=d,a.j=c;d=b-a.h;d>=a.m&&c&&a.f(a.a,d)}}else if((0!=e||a.w)&&a.F&&(f=d.start(e),!(f>=vv(a.C)))){g=f-c;b=g<=b;var h=!1;if(!(.001>g)){if(!b&&!a.h){a.h=!0;const k=new _.F("largegap",{detail:{currentTime:c,gapSize:g}});k.cancelable=!0;a.B(k);a.j.jumpLargeGaps&&!k.defaultPrevented?h=!0:_.Cf("Ignoring large gap at",c,"size",g)}if(b||h)0==e?_.Cf(Qt,g,"seconds because of gap before start time of",f):_.Cf(Qt,g,"seconds because of gap starting at",d.end(e-1),"and ending at",f),a.a.currentTime=f}}}}};
|
|
81
|
+
ix=function(a,b){a.o||(a.o=!0,a.m&&a.m());.001>Math.abs(a.a.currentTime-b)?gx(a):(a.f.one(a.a,_.he,()=>{gx(a)}),hx(a.g,0==a.a.currentTime?b:a.a.currentTime))};jx=function(a,b){a.w=b;a.f.off(a.a,_.qd);a.f.one(a.a,_.qd,()=>{ix(a,b)})};kx=function(a){return a.j?a.a.currentTime:a.w};lx=function(a,b){0<a.a.readyState?hx(a.g,b):jx(a,b)};gx=function(a){_.li()&&!a.j&&a.h();a.j=!0;a.f.on(a.a,_.he,()=>a.h())};hx=function(a,b){a.g=a.f.currentTime;a.j=b;a.h=a.m;a.f.currentTime=b;a.a.Xa(.1)};
|
|
82
|
+
ox=function(a,b,c){if(!c.stallEnabled)return null;const d=c.gapDetectionThreshold;let e=c.stallSkip;c=new mx(new nx(b),c.stallThreshold);dx(c,(f,g)=>{a.f.warn(`Stall detected at ${f} for ${g} seconds.`);if(e){g=new _.Xo(b.buffered);var h;if(h=_.fi("Edge/")||_.fi("Trident/")||_.gi()||_.li())a:{h=g;if(h.length&&!(1>=h.length))for(let k=0;k<h.length-1;k++)if(f>h.start(k)&&f<h.end(k)){h=h.start(k+1)-h.end(k)>=d;break a}h=!1}if(h){a:{if(g.length&&!(1>=g.length))for(h=0;h<g.length-1;h++)if(f>g.start(h)&&
|
|
83
|
+
f<g.end(h)){f=g.start(h+1)-f;break a}f=null}f&&(e=Math.min(f+.1,e))}a.f.warn(`Seeking forward ${e} seconds to break stall.`);b.currentTime+=e}else a.f.warn("Pausing and unpausing to break stall."),b.pause(),b.play()});return c};rx=function(a,b){null==b?b=Infinity>a.a.getDuration()?_.wv(a.a,0):vv(a.a):0>b&&(b=vv(a.a)+b);return px(a,qx(a,b))};qx=function(a,b){const c=_.wv(a.a,0);if(b<c)return c;a=vv(a.a);return b>a?a:b};sx=function(a){const b=kx(a.g);return 0<a.h.readyState&&!a.h.paused?qx(a,b):b};
|
|
84
|
+
px=function(a,b){const c=a.a.getDuration();return b>=c?c-a.m.durationBackoff:b};
|
|
85
|
+
tx=function(a,b){var c=new _.Xo(a.h.buffered);c=c.Zb.bind(c);var d=Math.max(a.B,a.m.rebufferingGoal);const e=a.m.safeSeekOffset;let f=_.wv(a.a,0);const g=vv(a.a),h=a.a.getDuration();3>g-f&&(f=g-3);const k=_.wv(a.a,d),l=_.wv(a.a,e);d=_.wv(a.a,d+e);if(b>=h)return a.f.debug("Playhead past duration."),px(a,b);if(b>g)return a.f.debug("Playhead past end."),g;if(b<f){if(c(l))return a.f.debug("Playhead before start \x26 start is buffered"),l;a.f.debug("Playhead before start \x26 start is unbuffered");return d}if(b>=
|
|
87
86
|
k||c(b))return a.f.debug("Playhead in safe region or in buffered region."),b;a.f.debug("Playhead outside safe region \x26 in unbuffered region.");return d};
|
|
88
|
-
|
|
89
|
-
g.length||!c)throw _.
|
|
90
|
-
|
|
91
|
-
d=a.getUint32(b);a.setUint32(b,d+1);return h};
|
|
92
|
-
|
|
93
|
-
_.
|
|
94
|
-
|
|
95
|
-
d.id))})};
|
|
96
|
-
|
|
97
|
-
_.
|
|
98
|
-
g.
|
|
99
|
-
{if(a.D)a.D.onError(k)}))))}else a.a.debug(
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
c),d=b.stream.segmentIterator.next().value),null===d&&a.a.warn(
|
|
108
|
-
Math.max(0,c-1))),a=f||
|
|
109
|
-
|
|
87
|
+
vx=function(a){a=_.K(a);let b=!1,c;const d=[],e=h=>{d.push(h);_.Jj(h)},f=()=>{b=!0},g=[];(new _.Qj).L(_.yd,e).L(_.ye,e).L(_.td,e).L(_.xd,e).L(_.oe,e).Z(_.qe,h=>{c=h;d.push(h);_.Kj(h)}).Z("encv",f).Z("enca",f).Z("avc1",h=>{g.push({L:h,xc:1701733238})}).Z("avc3",h=>{g.push({L:h,xc:1701733238})}).Z("ac-3",h=>{g.push({L:h,xc:1701733217})}).Z("ec-3",h=>{g.push({L:h,xc:1701733217})}).Z("mp4a",h=>{g.push({L:h,xc:1701733217})}).parse(a);if(b)return _.Cf("Init segment already indicates encryption."),a;if(0===
|
|
88
|
+
g.length||!c)throw _.If("Failed to find boxes needed to fake encryption!"),_.If("Failed init segment (hex):",_.bh(a)),new _.H(_.G,3,14E3);g.reverse();for(const h of g)_.Cf(`Inserting "${_.Ij(h.xc)}" box into init segment.`),a=ux(a,c,h.L,d,h.xc);return a};
|
|
89
|
+
ux=function(a,b,c,d,e){{var f=wx.value(),g=a.subarray(c.start,c.start+c.size);const k=_.Fg(g);var h=new Uint8Array(c.size+f.byteLength);h.set(g,0);g=_.Fg(h);g.setUint32(4,e);h.set(f,c.size);e=k.getUint32(4);g.setUint32(c.size+16,e);xx(h,0,h.byteLength);e=h}h=new Uint8Array(a.byteLength+e.byteLength);c=_.fi("Xbox One")||_.ei()?c.start:c.start+c.size;f=a.subarray(c);h.set(a.subarray(0,c));h.set(e,c);h.set(f,c+e.byteLength);for(const k of d)xx(h,k.start,k.size+e.byteLength);a=_.Fg(h,b.start);b=_.Mj(b);
|
|
90
|
+
d=a.getUint32(b);a.setUint32(b,d+1);return h};xx=function(a,b,c){a=_.Fg(a,b);b=a.getUint32(0);0!=b&&(1==b?(a.setUint32(8,c>>32),a.setUint32(12,c&4294967295)):a.setUint32(0,c))};yx=function(a){return"("+a.type+":"+a.stream.id+")"};zx=function(a){return!a.Ta&&null==a.nb&&!a.Cb&&!a.Tb};Ax=function(a){null!=a.nb&&(a.nb.stop(),a.nb=null)};Bx=function(a){return _.y(function*(){a.zb&&(yield a.zb.abort())})};Cx=function(a,b){return(b=fv(a.g.periods,b+_.Io))?a.g.periods.indexOf(b):0};
|
|
91
|
+
Hx=function(a,b,c,d,e){return _.y(function*(){var f=a.D.tb();const g=Cx(a,f);f=new Map;const h=new Set;b&&(f.set(_.p,b),h.add(b));c&&(f.set(_.w,c),h.add(c));d&&(f.set(_.u,d),h.add(d));yield a.D.X.init(f,a.j.forceNativeTS,a.j.disableAudioTracks);a.h||(Dx(a),yield Ex(a,h),a.h||f.forEach((k,l)=>{a.f.has(l)||(k=Fx(k,g,e),a.f.set(l,k),Gx(a,k,0))}))})};Ix=function(a){var b=a.f.get(_.w);return b?a.g.periods[b.wb]:(b=a.f.get(_.p))?a.g.periods[b.wb]:null};
|
|
92
|
+
_.Jx=function(a,b){return(a=a.f.get(b))?a.Nb||a.stream:null};Kx=function(a){return _.Jx(a,_.p)};Lx=function(a){return _.Jx(a,_.w)};
|
|
93
|
+
Ex=function(a,b){return _.y(function*(){var c=[];for(const d of b){const e=a.o.get(d.id);e?(a.a.debug("(all) Stream "+d.id+Lt),c.push(e.P)):(a.a.debug("(all) setting up Stream "+d.id),a.o.set(d.id,{P:new _.Sk,zc:!1}),c.push(d.createSegmentIndex()))}try{if(yield Promise.all(c),a.h)return}catch(d){if(a.h)return;for(const e of b)a.o.get(e.id).P.catch(()=>{}),a.o.get(e.id).P.reject(),a.o.delete(e.id);throw d;}for(const d of b)c=a.o.get(d.id),c.zc||(c.P.resolve(),c.zc=!0,a.a.debug("(all) setup Stream "+
|
|
94
|
+
d.id))})};Fx=function(a,b,c){return{stream:a,type:a.type,Lb:null,segmentIterator:null,qa:null,Nb:null,Nc:!0,wb:b,endOfStream:!1,Ta:!1,nb:null,Cb:!1,Yc:0,od:!1,Tb:!1,$d:!1,uc:!1,$e:c||0,zb:null,$c:!1,Je:0}};Gx=function(a,b,c){a.a.debug(yx(b),"updating in "+c+" seconds");b.nb=(new _.Uo(()=>_.y(function*(){try{yield a.yb(b)}catch(d){if(a.D)a.D.onError(d)}}))).da(c)};
|
|
95
|
+
Mx=function(a,b){return _.y(function*(){yield a.D.X.clear(_.u);a.G++;a.H=!1;var c=a.G,d=a.D.X;const e=new Map,f=new Set;e.set(_.u,b);f.add(b);yield d.init(e,!1,a.j.disableAudioTracks);a.h||(yield Ex(a,f),a.h||(d=d.getTextDisplayer().isTextVisible()||a.j.alwaysStreamText,a.G!=c||a.f.has(_.u)||a.H||!d||(c=a.D.tb(),c=Cx(a,c),c=Fx(b,c,0),a.f.set(_.u,c),Gx(a,c,0))))})};Nx=function(a){a.H=!0;const b=a.f.get(_.u);b&&(Ax(b),Bx(b).catch(()=>{}),a.f.delete(_.u))};
|
|
96
|
+
_.Tx=function(a,b,c,d){const e=a.f.get(b.type);if(!e&&b.type==_.u&&a.j.ignoreTextStreamFailures)Mx(a,b);else if(e){var f=Ox(a,b);if(c&&f!=e.wb){a.a.debug("switch: switching to stream in another Period; clearing buffer and changing Periods");for(var g of a.f.values())Px(a,g)}else if(e.Nb&&(a.a.debug("switch during trick play mode",b),b.trickModeVideo?(e.Nb=b,b=b.trickModeVideo,a.a.debug("switch found trick play stream",b)):(e.Nb=null,a.a.debug("switch found no special trick play stream"))),(g=a.m[f])&&
|
|
97
|
+
g.zc&&(g=a.o.get(b.id))&&g.zc)if(e.stream!=b){g=a.g.presentationTimeline.getDuration();var h=a.D.tb();h=Qx(a,e,h);!c&&(e.endOfStream||h>=g)?a.a.debug(nu+yx(e)+" already buffered to the end. Not switching."):(b.type==_.u&&Rv(a.D.X,_.Zh(b.mimeType,b.codecs)),e.stream=b,e.stream.segmentIterator=null,e.Nc=!0,a.a.debug("switch: switching to Stream "+yx(e)),Rx(a,e,f)&&(a.a.info("Aborting current segment request to switch."),e.zb.abort()),c&&(e.Tb?e.od=!0:e.Ta?(e.Cb=!0,e.Yc=d,e.od=!0):(Ax(e),Sx(a,e,!0,d).catch(k=>
|
|
98
|
+
{if(a.D)a.D.onError(k)}))))}else a.a.debug(nu+yx(e)+" already active")}};Ux=function(a,b,c,d){b.video&&_.Tx(a,b.video,c,d);b.audio&&_.Tx(a,b.audio,c,d)};
|
|
99
|
+
Px=function(a,b){const c=yx(b);b.Tb?a.a.debug(c,"clear: already clearing the buffer"):b.Cb?a.a.debug(c,"clear: already waiting"):b.Ta?(a.a.debug(c,"clear: currently updating"),b.Cb=!0,b.Yc=0):null==a.D.X.ob(b.type)?(a.a.debug(c,"clear: nothing buffered"),null==b.nb&&Gx(a,b,0)):(a.a.debug(c,"clear: handling right now"),Ax(b),Sx(a,b,!1,0).catch(d=>{if(a.D)a.D.onError(d)}))};
|
|
100
|
+
Vx=function(a){const b=a.D.tb(),c=g=>a.D.X.Zb(g,b,0);let d=!1;const e=Cx(a,b);if(_.xg(a.f.values(),g=>g.wb==e))for(const g of a.f.keys()){var f=a.f.get(g);f.stream.segmentIterator=null;c(g)||(Px(a,f),d=!0)}else if(!_.xg(a.f.keys(),c)){a.a.debug("(all): seeked: unbuffered seek: clearing all buffers");for(f of a.f.values())Px(a,f);d=!0}d||a.a.debug("(all): seeked: buffered seek: presentationTime\x3d"+b)};
|
|
101
|
+
Wx=function(a,b){b=void 0===b?!1:b;if(a.h)a.a.error("Unable to retry after StreamingEngine is destroyed!");else if(a.A)a.a.error("Unable to retry after StreamingEngine encountered a fatal error!");else for(const c of a.f.values()){const d=yx(c);if(c.uc||b&&zx(c))a.a.info(d,"Retrying after failure..."),c.uc=!1,Gx(a,c,.1)}};
|
|
102
|
+
Sx=function(a,b,c,d){return _.y(function*(){const e=yx(b);b.Cb=!1;b.od=!1;b.Yc=0;b.Tb=!0;b.stream.segmentIterator=null;a.a.debug(e,"clearing buffer");if(d){var f=a.D.tb();const g=a.D.X.getDuration();f=a.D.X.remove(b.type,f+d,g)}else f=a.D.X.clear(b.type).then(()=>!a.h&&c?a.D.X.flush(b.type):null);yield f;a.h||(a.a.debug(e,"cleared buffer"),b.Lb=null,b.qa=null,b.Tb=!1,b.endOfStream=!1,b.$c=!1,Gx(a,b,0))})};
|
|
103
|
+
Xx=function(a){return _.y(function*(){const b=[];for(const c of a.f.values())Ax(c),c.Ta&&c.zb&&(c.Ta=!1,b.push(c.zb.abort())),c.Cb&&b.push(Sx(a,c,!0,0));yield Promise.all(b)})};Yx=function(a,b,c){(a=a.f.get(b))&&c&&(Ax(a),a.stream=c,a.Lb=c,a.qa&&(a.qa=c.getSegmentReference(a.qa.position)),a.qa||(a.Lb=null))};Ox=function(a,b){return hv(a.g.periods,b)};Qx=function(a,b,c){if(!b.Lb||!b.qa)return Math.max(c,b.$e);c=Ox(a,b.Lb);return a.g.periods[c].startTime+b.qa.endTime};
|
|
104
|
+
Rx=function(a,b,c){if(!b.zb)return!1;const d=a.D.tb(),e=a.D.X.Aa(b.type);c=(c=Zx(a,b,d,e,c))?c.ha?c.ha-c.ua+1:null:null;if(null==c)return!1;var f=b.stream.initSegmentReference;f&&(c+=(f.ha?f.ha-f.ua+1:null)||0);f=a.D.Bd().getBandwidthEstimate();if(8*c/f<(null===e?0:e-d)-Math.max(a.g.minBufferTime||0,a.j.rebufferingGoal))return!0;a=b.zb;a=a.h?a.h.bytesRemaining:-1;return 0>a||a>c?!0:!1};
|
|
105
|
+
Zx=function(a,b,c,d,e){if(b.stream.segmentLookupStrategy===_.$x)b.stream.segmentIterator?a=yv(b.stream.segmentIterator):b.qa||d?(e=b.qa?b.qa.endTime:d,a.a.info(Pt,"looking up segment from new stream endTime:",e),b.stream.segmentIterator=Ev(b.stream.segmentIndex,e),d=b.stream.segmentIterator.next().value,null===d&&(b.stream.segmentIterator=null,a.a.warn(Pt,au,"endTime:",e,b.qa)),a=d):(e=Math.max(c,0),a.a.info(Pt,"looking up segment","lookupTime:",e,gu,c),d=null,d||(b.stream.segmentIterator=Ev(b.stream.segmentIndex,
|
|
106
|
+
c),d=b.stream.segmentIterator.next().value),null===d&&a.a.warn(Pt,au,"lookupTime:",e,gu,c),a=d);else{var f=yx(b);b.qa&&b.stream==b.Lb?(d=b.qa.position+1,a.a.debug(f,"next position known:","position\x3d"+d),a=ay(a,b,e,d)):(b.qa?(a.a.debug(f,"next position unknown: another Stream buffered"),c=Ox(a,b.Lb),c=by(a,b,a.g.periods[c].startTime+b.qa.endTime,e)):(a.a.debug(f,"next position unknown: nothing buffered"),c=by(a,b,d||c,e)),null==c?a=null:(f=null,null!=d||null!==a.j&&a.j.ignoreDrift||(f=ay(a,b,e,
|
|
107
|
+
Math.max(0,c-1))),a=f||ay(a,b,e,c)))}return a};Dx=function(a){const b=a.g.presentationTimeline.getDuration();Infinity>b?gw(a.D.X,b):gw(a.D.X,Math.pow(2,32))};
|
|
108
|
+
cy=function(a,b){let c=a.m[b];if(c)return a.a.debug("(all) Period "+b+Lt),c.P;a.a.debug("(all) setting up Period "+b);c={P:new _.Sk,zc:!1};a.m[b]=c;const d=new Set;for(const e of a.g.periods[b].variants)e.video&&d.add(e.video),e.video&&e.video.trickModeVideo&&d.add(e.video.trickModeVideo),e.audio&&d.add(e.audio);for(const e of a.g.periods[b].textStreams)d.add(e);a.F=a.F.then(()=>a.h?null:Ex(a,d)).then(()=>{a.h||(a.m[b].P.resolve(),a.m[b].zc=!0,a.a.debug("(all) setup Period "+b))}).catch(e=>{a.h||
|
|
110
109
|
(a.m[b].P.catch(()=>{}),a.m[b].P.reject(),delete a.m[b],a.a.warn("(all) failed to setup Period "+b),a.D.onError(e))});return c.P};
|
|
111
|
-
|
|
112
|
-
if(null!=l&&e>=l&&!b
|
|
113
|
-
_.
|
|
114
|
-
|
|
115
|
-
k.set(_.
|
|
116
|
-
a.D.
|
|
117
|
-
|
|
118
|
-
a.h||a.A?null:
|
|
119
|
-
a.f.delete(_.
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
Promise.resolve();const m=e.closedCaptions&&0<e.closedCaptions.size;null!=e.emsgSchemeIdUris&&0<e.emsgSchemeIdUris.length&&(new _.
|
|
110
|
+
fy=function(a,b){if(b.type==_.u&&b.stream.mimeType==_.Tb)return aw(a.D.X,b.stream.originalId||""),null;b.type==_.u&&bw(a.D.X);if(!Tv(a.D.X)&&b.type!=_.u)return a.j.bufferLimitUpdateInterval?a.j.bufferLimitUpdateInterval/2:.5;var c=yx(b);const d=a.D.tb(),e=Qx(a,b,d);a.a.debug(c,"timeNeeded\x3d"+e);const f=Ox(a,b.stream);var g=Cx(a,e),h=a.D.X.Ea(b.type,d);a.a.debug(c,"update_:",hu+d,"bufferedAhead\x3d"+h);const k=Math.max(a.g.minBufferTime||0,a.j.rebufferingGoal,a.j.bufferingGoal)*a.w,l=ov(a.g.presentationTimeline);
|
|
111
|
+
if(null!=l&&e>=l&&!b.$c)return dy(a,b),null;b.endOfStream=!1;b.wb=g;if(g!=f)return a.a.debug(c,"need Period "+g,hu+d,"timeNeeded\x3d"+e,"currentPeriodIndex\x3d"+f),null;if(h>=k)return a.a.debug(c,"buffering goal met"),a.j.bufferLimitUpdateInterval||.5;g=a.D.X.Aa(b.type);g=Zx(a,b,d,g,f);if(!g)return a.g.presentationTimeline.isLive()||b.type===_.u?a.j.bufferLimitUpdateInterval||1:(a.a.debug("Media state "+c+": no next segment found. Assuming EOS."),dy(a,b),null);c=Infinity;for(const m of a.f.values())if(m.type!=
|
|
112
|
+
_.u||m.stream.mimeType!=_.Tb)h=Qx(a,m,d),c=Math.min(c,h);if(e>=c+a.g.presentationTimeline.a)return a.j.bufferLimitUpdateInterval||1;b.$e=0;ey(a,b,d,f,g).catch(()=>{});return null};gy=function(a,b){return _.y(function*(){if(!a.h){if(a.D.cf)try{yield a.D.cf(b)}catch(c){c.cause=b,b=c}if(!b.f)a.D.onError(b)}})};
|
|
113
|
+
hy=function(a,b){const c=yx(b),d=Ox(a,b.stream);if(b.wb!=d){var e=b.wb,f=Array.from(a.f.values());f.every(g=>g.wb==e)?f.every(zx)?(a.a.debug(c,"all need Period "+e),cy(a,e).then(()=>{if(!a.h)if(f.every(l=>{const m=zx(l),n=Ox(a,l.stream);return m&&l.wb==e&&n!=e})){var g=a.g.periods[e];a.a.debug(c,"calling onChooseStreams()...");var h=a.D.Vd(g);a.C=!h.variant&&!!h.text;var k=new Map;h.variant&&h.variant.video&&k.set(_.w,h.variant.video);h.variant&&h.variant.audio&&k.set(_.p,h.variant.audio);h.text&&
|
|
114
|
+
k.set(_.u,h.text);for(const l of a.f.keys())if(!k.has(l)&&l!=_.u){a.a.error(c,"invalid Streams chosen: missing "+l+" Stream");a.D.onError(new _.H(_.G,5,5005));return}for(const l of Array.from(k.keys()))if(!a.f.has(l))if(l==_.u)Hx(a,null,null,k.get(_.u),g.startTime),k.delete(l);else{a.a.error(c,"invalid Streams chosen: unusable "+l+" Stream");a.D.onError(new _.H(_.G,5,5005));return}for(const l of Array.from(a.f.keys()))(g=k.get(l))?(_.Tx(a,g,!1,0),Gx(a,a.f.get(l),0)):a.f.delete(l);a.a.debug(c,$t);
|
|
115
|
+
a.D.Ud()}else a.a.debug(c,"ignoring transition to Period",e,"since another is happening")}).catch(wu)):a.a.debug(c,"all MediaStates need Period "+e+", but not all MediaStates are idle"):a.a.debug(c,"not all MediaStates need Period "+e)}};dy=function(a,b){a.a.debug(yx(b),"buffered to end of presentation");b.endOfStream=!0;b.type==_.w&&(a=a.f.get(_.u))&&a.stream.mimeType==_.Tb&&(a.endOfStream=!0)};
|
|
116
|
+
ey=function(a,b,c,d,e){return _.y(function*(){const f=yx(b),g=a.g.periods[d];a.a.debug(f,"fetchAndAppend_:",hu+c,cu+g.startTime,ju+e.position,ku+e.startTime,iu+e.endTime);const h=b.stream,k=b.stream.segmentIterator;var l=a.g.presentationTimeline.getDuration();const m=a.g.periods[d+1];l=iy(a,b,d,Math.max(0,g.startTime-.1),m?m.startTime+.01:l,e);b.Ta=!0;b.Nc=!1;a.a.debug(f,"fetching segment");let n=!1;const q=(v,x)=>{if(a.h||a.A)return null;n=!0;return jy(a,b,c,g,h,e,v,x)},t=a.D.X.Aa(b.type)||0;l.then(()=>
|
|
117
|
+
a.h||a.A?null:ky(a,b,e,!1,v=>q(v.data,!0))).then(v=>a.h||a.A?null:n||null===v?(ly(a,b,t,e,h),null):q(v,!1)).then(()=>{if(!a.h&&!a.A){ly(a,b,t,e,h);b.Ta=!1;b.$d=!1;b.Cb||a.D.kd();if(k){const v=k.next().value;v&&a.a.debug("New iterated segment",v)}Gx(a,b,0);my(a,b,h);a.a.debug(f,"finished fetch and append")}}).catch(v=>_.y(function*(){a.h||a.A||(b.Ta=!1,b.type==_.u&&a.j.ignoreTextStreamFailures?(1001==v.code?a.a.warn(f,"Text stream failed to download. Proceeding without it."):a.a.warn(f,"Text stream failed to parse. Proceeding without it."),
|
|
118
|
+
a.f.delete(_.u)):7001==v.code?(b.Ta=!1,b.nb=null,Gx(a,b,0)):3017===v.code?ny(a,b,v):1001===v.code&&v.data&&404===v.data[1]?(a.a.warn(f,"request for segment failed","segment not available on server",ju+e.position,ku+e.startTime,iu+e.endTime,"error\x3d"+v),b.Ta=!1,b.nb=null,Gx(a,b,1)):b.type===_.u?(v instanceof _.H&&v.a(1),Ax(b),a.D.onError(new _.H(1,2,2010,v))):1001<=v.code&&1003>=v.code?yield oy(a,b,g,v):(a.a.error(f,"failed fetch and append: code\x3d"+v.code),b.uc=!0,v instanceof _.H&&v.a(_.G),yield gy(a,
|
|
119
|
+
v)))}))})};ay=function(a,b,c,d){const e=yx(b);c=a.g.periods[c];const f=b.stream.getSegmentReference(d);if(!f)return a.a.debug(e,"segment does not exist:",cu+c.startTime,"position\x3d"+d),null;var g=a.g.presentationTimeline;d=_.uv(g);g=sv(g);return!b.$c&&(c.startTime+f.endTime<d||c.startTime+f.startTime>g)?(a.a.debug(e,"segment is not available:",cu+c.startTime,ku+f.startTime,iu+f.endTime,"availabilityStart\x3d"+d,"availabilityEnd\x3d"+g),null):f};
|
|
120
|
+
by=function(a,b,c,d){const e=yx(b);d=a.g.periods[d];const f=Math.max(0,c-d.startTime);b=b.stream.findSegmentPosition(f);a.a.debug(e,"Looked up segment:",hu+c,"lookupTime\x3d"+f,cu+d.startTime,"Result: segment position\x3d"+b);null==b&&a.a.warn(e,"cannot find segment:",cu+d.startTime,"lookupTime\x3d"+f);return b};
|
|
121
|
+
iy=function(a,b,c,d,e,f){c=a.g.periods[c].startTime-f.sa;if(!b.Nc&&c===b.Je)return Promise.resolve();b.Je=c;const g=yx(b);a.a.debug(g,"setting timestamp offset to "+c);a.a.debug(g,"setting append window start to "+d);a.a.debug(g,"setting append window end to "+e);d=dw(a.D.X,b.type,c,d,e);if(!b.stream.initSegmentReference||!b.Nc)return d;a.a.debug(g,"fetching init segment");e=ky(a,b,b.stream.initSegmentReference,!0).then(h=>{if(a.h)return null;a.a.debug(g,"appending init segment");return py(a,h,b).then(()=>
|
|
122
|
+
$v(a.D.X,b.type,h,null,null,!!b.stream.closedCaptions&&0<b.stream.closedCaptions.size))}).catch(h=>{b.Nc=!0;return Promise.reject(h)});return Promise.all([d,e])};
|
|
123
|
+
jy=function(a,b,c,d,e,f,g,h){h=void 0===h?!1:h;return _.y(function*(){const k=yx(b);if(e&&e.keyId&&a.D.Fc){var l=ru(a.D.Fc,e.keyId);if(l)try{yield l}catch(n){a.a.warn("DRM session load failed!",n)}else a.a.warn(`Unable to find DRM session for ${e.keyId}`)}if(e.encrypted&&e.keyId&&a.D.Fc&&tu(a.D.Fc,e.keyId))return Ax(b),l=Ox(a,e),(l=qy(a,l))&&(yield l),l=a.D.rd(e,d,eu),a.a.warn(k,`Blocked append for ${f.startTime+d.startTime} - ${f.endTime+d.startTime}: ${l}. `+`Stream with Key ID ${e.keyId} has restrictions.`),
|
|
124
|
+
Promise.resolve();const m=e.closedCaptions&&0<e.closedCaptions.size;null!=e.emsgSchemeIdUris&&0<e.emsgSchemeIdUris.length&&(new _.Qj).Z("emsg",a.I.bind(a,d,f,e.emsgSchemeIdUris)).parse(g);return ry(a,b,c).then(()=>{if(a.h)return null;const n=f.startTime+d.startTime,q=f.endTime+d.startTime;a.a.debug(k,"Appending segment "+`with ${n.toFixed(3)} - ${q.toFixed(3)} `+`KeyID: ${e.keyId} `+`Width: ${e.width} Height: ${e.height} `+`Bitrate: ${_.Tg(e.bandwidth)} `+`Fragment: ${h}`);return $v(a.D.X,b.type,
|
|
126
125
|
g,n,q,m,e.id,h)}).then(()=>{a.h||(a.a.debug(k,"appended media segment"),b.Lb=e,b.qa=f)})})};
|
|
127
|
-
|
|
128
|
-
a.D.xb.fetch(f);b.zb=c;return c.P.then(g=>{const h=a.D.
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
f,f+h).then(()=>{a.h||a.a.debug(d,"evicted "+h+" seconds")})};
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
l.id);g=f.find(l=>k.find(m=>m===String(l.video.id)))}}}else g=f[0];if(g){if(d.codecs.split(".")[0]===g.audio.codecs.split(".")[0]){d=g.audio;a.Za=d.id;a.g.setVariants(f);f=
|
|
140
|
-
|
|
141
|
-
g.id==b.id);e?(a.M=e.video.id,
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
b===_.
|
|
146
|
-
|
|
147
|
-
null);a.K.clear();a.F=null;a.qc.clear();a.f=null;a.G=null;a.N=!0;a.Db.clear();a.Rb=!1;
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
a.f.presentationTimeline.F=a.configuration.suggestedPresentationDelay);a.f.presentationTimeline&&(a.f.presentationTimeline.G=!!a.configuration.lowLatencyMode);if(0==a.f.periods.length)throw new _.H(_.G,4,4014);
|
|
152
|
-
|
|
153
|
-
if(k.length){k=a.getPeriods();for(let t=0;t<k.length;t++){const
|
|
154
|
-
(h=!0)}}}if(f=
|
|
155
|
-
f&&(yield f.o(b,e,a.getNetworkEngine()),d=yield f.m(c))}yield _.
|
|
156
|
-
|
|
157
|
-
[],a.configuration.preferredAudioRole,a.configuration.preferredAudioChannelCount);a.aa=a.configuration.preferredTextLanguage;a.ma=a.configuration.preferredTextRole;yield _.
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
a.configuration.restrictions,a.
|
|
163
|
-
|
|
164
|
-
d,"buffered to end",b,"state",a.getState()),
|
|
165
|
-
|
|
166
|
-
emsgSchemeIdUris:null,roles:g.roles,channelsCount:null,closedCaptions:null};e.set(h,k)}}for(const f of e.values())d.textStreams.push(f)}};
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
b).variant=c};
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
a.configuration.preferredAudioChannelCount);const k=
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
_.
|
|
187
|
-
|
|
188
|
-
{video:_
|
|
189
|
-
_.
|
|
190
|
-
d,e.width=c.width,e.height=c.height,e.bandwidth=c.bandwidth,e.start=c.start,e.end=c.end;else{for(const f of this.S)a>=f.start&&a<f.end?f.end=a:b>=f.start&&b<f.end&&(f.start=b);this.S.push(c);this.S.sort(
|
|
191
|
-
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.h!==a&&(this.h=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 _.F(_.
|
|
192
|
-
_.
|
|
193
|
-
|
|
194
|
-
_
|
|
126
|
+
ky=function(a,b,c,d,e){d=void 0===d?!1:d;e=void 0===e?null:e;const f=_.mv(c.Ia(),c.ua,c.ha,a.j.attemptParameters,c.startTime,c.endTime,b.type,c.timescale);f.type=2;f.onFragment=c.lc?null:e;f.disableFragmentSupport=c.lc||a.j.disableFragmentSupport;f.disableMergedFragments=a.j.disableMergedFragments;if(e=c.f())f.keyInfo=e,f.onFragment=null;d&&(f.responseModifiers.push(g=>{sy(a,b,g.data)}),b.type===_.w&&a.j.overridePasp&&f.responseModifiers.push(a.J.bind(a)));a.a.debug("fetching: reference\x3d",c);c=
|
|
127
|
+
a.D.xb.fetch(f);b.zb=c;return c.P.then(g=>{const h=a.D.Bd(),k=g.timeMs,l=g.data.byteLength;k&&l&&!d&&h.segmentDownloaded(k,l);b.zb=null;return g.data})};
|
|
128
|
+
ly=function(a,b,c,d,e){if(!a.g.presentationTimeline.isLive()&&b.type!==_.u){var f=yx(b);const g=(a.D.X.Aa(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.a.debug(f,"Adjusted segment",d.position,"with real duration",g,"and accounted for",c,"delta between segment duration and real duration"),b.$c=!0,a=a.g.periods,b=c,e.adjustSegmentDurations(d.position,b),d=hv(a,e),f=a[d],e=e.getDuration(),jv(f,e),e=d+1;e<a.length;e++)a[e].startTime+=b}};
|
|
129
|
+
my=function(a,b,c){if(!a.B){b=yx(b);var d=Array.from(a.f.values());1!=d.length||d[0].type!=_.u?a.B=d.every(e=>e.type==_.u||a.C?!0:!e.Cb&&!e.Tb&&e.qa):a.C&&(a.B=!0);a.B&&(a.a.debug(b,"startup complete"),c=Ox(a,c),qy(a,c))}};
|
|
130
|
+
ny=function(a,b,c){const d=yx(b);if(Array.from(a.f.values()).some(e=>e!=b&&e.$d))a.a.debug(d,Rt,"waiting for another stream to recover...");else{const e=Math.round(100*a.w);if(20<e)a.w-=.2;else if(4<e)a.w-=.04;else{a.a.error(d,"MediaSource threw QuotaExceededError too many times");b.uc=!0;a.A=!0;a.D.onError(c);return}a.a.warn(d,Rt,"reducing buffering goals by "+(100-Math.round(100*a.w))+"%");b.$d=!0}Gx(a,b,4)};
|
|
131
|
+
oy=function(a,b,c,d){return _.y(function*(){let e=!0;1001===d.code&&500<=d.data.status||(e=!a.D.rd(b.stream,c));e&&(b.uc=!0,d.a(_.G),yield gy(a,d))})};py=function(a,b,c){return _.y(function*(){if(a.j.patchEdgeWhenMixedContent&&_.ei()){const d=vx(b);yield $v(a.D.X,c.type,d.buffer,null,null,!!c.stream.closedCaptions&&0<c.stream.closedCaptions.size)}})};
|
|
132
|
+
qy=function(a,b){let c=null;a.m[b]||(c=cy(a,b).then(()=>{a.h||(a.a.debug($t),a.D.Ud())}).catch(wu));for(b=0;b<a.g.periods.length;++b)cy(a,b).catch(wu);a.D.eg&&(a.a.debug("calling onStartupComplete()..."),a.D.eg());return c};
|
|
133
|
+
ry=function(a,b,c){if(a.h)return Promise.resolve();const d=yx(b);a.a.debug(d,"checking buffer length");const e=Math.max(a.j.bufferBehind,a.g.presentationTimeline.a),f=a.D.X.ob(b.type);if(null==f)return a.a.debug(d,"buffer behind okay because nothing buffered:",hu+c,Yt+e),Promise.resolve();const g=c-f,h=g-e;if(.01>=h)return a.a.debug(d,"buffer behind okay:",hu+c,Zt+g,Yt+e,"underflow\x3d"+Math.abs(h)),Promise.resolve();a.a.debug(d,"buffer behind too large:",hu+c,Zt+g,Yt+e,"overflow\x3d"+h);return a.D.X.remove(b.type,
|
|
134
|
+
f,f+h).then(()=>{a.h||a.a.debug(d,"evicted "+h+" seconds")})};sy=function(a,b,c){(new _.Qj).L(_.yd,_.Jj).L(_.ye,_.Jj).L(_.td,_.Jj).L(_.xd,_.Jj).L(_.oe,_.Jj).Z(_.qe,_.Kj).L("encv",d=>{d.reader.skip(78);_.Jj(d)}).L(_.je,_.Jj).L("schi",_.Jj).L("tenc",d=>{d.reader.skip(6);if(_.Bj(d.reader)){d.reader.skip(1);const e=_.bh(_.Gj(d.reader,16));e!==b.stream.keyId&&(a.a.debug(yx(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)};
|
|
135
|
+
ty=function(a){const b=c=>c.video&&c.audio||c.video&&c.video.codecs.includes(",");if(a.some(c=>c.variants.some(b))){_.Hf("Found variant with audio and video content, so filtering out audio-only content in all periods.");for(const c of a)c.variants=c.variants.filter(b)}};
|
|
136
|
+
Iw=function(a,b){return _.y(function*(){if(a.Ld!=b&&(a.Ld=b,a.C===uy&&(a.H.getTextDisplayer().setTextVisibility(b),!a.configuration.streaming.alwaysStreamText)))if(b){var c=vy(a);c=_.ww(c.textStreams,a.aa,a.ma);0<c.length&&(yield Mx(a.a,c[0]))}else Nx(a.a)})};Jw=function(a,b){if(a.f&&a.a){const c=vy(a),d=c.textStreams.find(e=>e.id==b.id);d?(wy(a,c,d,!1),xy(a,d),a.aa=d.language):a.log.error(_.St,b.id)}};
|
|
137
|
+
Kw=function(a,b){if(a.configuration.streaming.disableAudioTracks)Promise.reject(Error("Audio tracks are disabled by config."));else{if(a.a&&(a.f||a.w)){var c=Lx(a.a),d=Kx(a.a),e=fv(a.f.periods,sx(a.w)),f=a.f.periods[e?a.f.periods.indexOf(e):0].variants.filter(h=>h.audio.id===b&&uw(h));e=!1;var g=void 0;if(c){if(g=f.find(h=>h.video.id===c.id),!g){a.log.debug("Cannot find exact variant, looking for anything else that matches with given audioId");e=!0;const h=a.getTrackManager().Ja();if(h){const k=h.renditions.map(l=>
|
|
138
|
+
l.id);g=f.find(l=>k.find(m=>m===String(l.video.id)))}}}else g=f[0];if(g){if(d.codecs.split(".")[0]===g.audio.codecs.split(".")[0]){d=g.audio;a.Za=d.id;a.g.setVariants(f);f=vy(a);yy(a,f,g,!1);e||a.N?zy(a,g,!0,0):_.Tx(a.a,d,!0,0);Promise.resolve();return}a.log.warn("Target audio codecs not compatible with active audio codecs.")}}Promise.reject()}};Lw=function(a){if(a.f&&a.w){const b=Ay(a),c=[];for(const d of By(a))a=sw(d),a.active=d==b,c.push(a);return c}return[]};
|
|
139
|
+
Mw=function(a,b,c){var d=void 0===d?0:d;if(a.f&&a.a){const f=vy(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.M=null;c=Cy(a,f.variants);null!=a.Y&&(a.Ya=a.Y,a.Y=null);null==c||a.N||Dy(a,c);return}if(b){a.M=b.id;var e=f.variants.find(g=>
|
|
140
|
+
g.id==b.id);e?(a.M=e.video.id,uw(e)?(yy(a,f,e,!1),zy(a,e,c,d),null==a.Y&&(a.Y=a.Ya),a.Ya=new Ey(e),Cy(a,f.variants)):a.log.error("Unable to switch to restricted track",b.id)):a.log.error("No variant with id",b.id)}else a.M=null,null!=a.Y&&(a.Ya=a.Y,a.Y=null),c=Cy(a,f.variants),null==c||a.N||Dy(a,c)}};Nw=function(a){const b=a.Ld;return a.f?a.H.getTextDisplayer().isTextVisible():b};
|
|
141
|
+
Fy=function(a,b){a.h||(a.m.on(b,_.ad,()=>{if(a.h.error){var c=a.h.error.code;if(1==c)c=null;else{var d=a.h.error.msExtendedCode;d&&(0>d&&(d+=Math.pow(2,32)),d=d.toString(16));c=new _.H(_.G,3,3016,{code:c,extendedError:d,message:a.h.error.message})}}else c=null;if(c)a.onError(c)}),a.h=b);return Promise.resolve()};
|
|
142
|
+
Hy=function(a){return new _.Gy(b=>{if(void 0===b||null===b)return null;const c=a.getTrackManager(),d=[];if(c)for(const e of c.getVideoTracks())d.push(...e.renditions);return d.find(e=>e.id==b)||null})};
|
|
143
|
+
Iy=function(a,b){if(a.V!==b)if(a.V===_.Jl&&b!==_.Kl)b=Du(b,_.Il),a.log.info(_.Tt+`${b}`);else{var c=a.Od;c=0===c?0:Date.now()-c;var d=a.V;a.V=b;a.Od=Date.now();a.G&&_.tl(a.G.a,a.V);b===_.Fl&&(a.Ne=a.Gd?1:2);var e=a.Ne,f={currentState:a.V,previousState:d,timeSinceLastStateChangeMS:c,reason:b===_.Fl||d===_.Fl?e:void 0},g=Du(d,_.Il),h=Du(b,_.Il),k=b!==_.Fl?"":`[${Du(e,_.Hl)}]`;a.log.info(`Player state change: ${g} -> `+`${h}${k}`);a.trigger(new _.F(_.me,{detail:f}));(b===_.Cl||b===_.Jl)&&a.ba&&a.ba.stop();
|
|
144
|
+
b===_.Fl?a.trigger(new _.F(_.oc,{detail:{bufferedTimeMS:-1,reason:e}})):d===_.Fl&&a.trigger(new _.F(_.kc,{detail:{bufferedTimeMS:c,reason:e}}))}};Ny=function(a){var b=!1;b=void 0===b?!0:b;return _.y(function*(){if(a.C===Jy)return Promise.reject(new _.H(_.G,7,7E3));yield Ky(a);yield Ly(a);var c=_.gi(4)||_.gi(5);if(b||c)c=a.getSurface().getMedia(),yield Fy(a,c),yield My(a,c)})};Ly=function(a){a.h&&(a.m.off(a.h,_.ad),a.h=null);return Promise.resolve()};
|
|
145
|
+
Ky=function(a){return _.y(function*(){a.C!==Jy&&(a.C=Oy);const b=a.h;b&&(a.m.off(b,_.pd),a.m.off(b,_.Vd),a.m.off(b,_.Nd),a.m.off(b,_.$c),a.m.off(b,_.$d),a.m.off(b,_.Yd));a.ab&&(a.ab.release(),a.ab=null);a.ba&&(a.ba.stop(),a.ba=null);a.A&&(yield a.A.stop(),a.A=null);a.g&&(yield a.g.stop());a.a&&(yield a.a.destroy(),a.a=null);a.w&&(a.w.release(),a.w=null);a.H&&(yield a.H.destroy(),a.H=null);a.pc&&(a.pc.release(),a.pc=null);b&&b.src&&(b.removeAttribute("src"),b.load());a.j&&(yield a.j.destroy(),a.j=
|
|
146
|
+
null);a.K.clear();a.F=null;a.qc.clear();a.f=null;a.G=null;a.N=!0;a.Db.clear();a.Rb=!1;Py(a)})};My=function(a,b){return _.y(function*(){var c=window.muxjs?new Qy:new _.Ry;const d=_.sl(a.configuration,["html","single-native"]);a.I=d.create(a);a.Sb=Hy(a);a.Sb.track(a);c=new _.Sy(b,c,a.I,a.Sb,a.configuration);yield c.I;a.H=c})};
|
|
147
|
+
Wy=function(a){a.A&&a.A.configure(a.configuration.manifest);a.j&&Ty(a);if(a.a){a.a.j=a.configuration.streaming;try{for(var b of a.f.periods)Uy(a,b)}catch(e){a.onError(e)}var c=Kx(a.a);const d=Lx(a.a);b=vy(a)||a.f.periods[0];c=xw(c,d,b.variants);a.g&&c&&c.allowedByApplication&&c.allowedByKeySystem?Cy(a,b.variants):(a.log.debug("Choosing new streams after changing configuration"),Vy(a,b))}a.g&&(a.g.configure(a.configuration.abr),a.configuration.abr.enabled&&!a.N?a.g.enable():a.g.disable())};
|
|
148
|
+
Xy=function(a,b){return _.y(function*(){const c=a.getNetworkEngine();a.A=yield _.Cn(b.url,c,a.configuration.manifest.attemptParameters,b.type||null);a.A.configure(a.configuration.manifest)})};
|
|
149
|
+
az=function(a,b){return _.y(function*(){a.Na=new Yy;xv(a.Na,c=>{Zy(a,_.Sf,c)});yield(new _.Zl(Promise.resolve().then(()=>_.y(function*(){for(;!a.f;)try{a.f=yield a.A.start(b.url,$y(a))}catch(c){if(a.ga){const d=yield a.ga(b.url,c);if(d)b.url=d;else throw c;}else throw c;}!a.f.presentationTimeline||a.configuration.manifest.hlsLowLatency||_.B(a.configuration.suggestedPresentationDelay)||isNaN(a.configuration.suggestedPresentationDelay)||(a.log.info("Apply suggested presentation delay of: "+a.configuration.suggestedPresentationDelay),
|
|
150
|
+
a.f.presentationTimeline.F=a.configuration.suggestedPresentationDelay);a.f.presentationTimeline&&(a.f.presentationTimeline.G=!!a.configuration.lowLatencyMode);if(0==a.f.periods.length)throw new _.H(_.G,4,4014);ty(a.f.periods)})),()=>{a.log.info("Aborting parser step...");return a.A.stop()})).P})};
|
|
151
|
+
ez=function(a){return _.y(function*(){a.j=new _.Wl({xb:a.getNetworkEngine(),onError:f=>a.onError(f),Xd:f=>{if(a.a){var g=vy(a),h=!1,k=Object.keys(f);0===k.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 l=1===k.length&&"00"===k[0];l&&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.");
|
|
152
|
+
if(k.length){k=a.getPeriods();for(let t=0;t<k.length;t++){const v=k[t];for(var m of v.variants){var n=m;var q=[];n.audio&&q.push(n.audio);n.video&&q.push(n.video);n=q;for(const x of n)n=m.allowedByKeySystem,x.keyId&&(q=f[l?"00":x.keyId],q=!!q&&!bz.includes(q),m.allowedByKeySystem=q),n!==m.allowedByKeySystem&&(q=x.type,x.type===_.w&&(q=`video ${x.width}x${x.height}@`+`${_.Tg(x.bandwidth)}`),a.log.warn("DRM Key not available for "+`KID: '${x.keyId}'. Applying restrictions to ${q}`)),v===g&&n!==m.allowedByKeySystem&&
|
|
153
|
+
(h=!0)}}}if(f=Ix(a.a))if(l=Kx(a.a),m=Lx(a.a),l=xw(l,m,f.variants),!l||l.allowedByKeySystem)a.log.info(Ot),cz(a),Cy(a,f.variants);h&&f!==g&&(a.log.info(Ot),cz(a),Cy(a,g.variants))}},onExpirationUpdated:(f,g)=>{if(a.A&&a.A.onExpirationUpdated)a.A.onExpirationUpdated(f,g);a.trigger(new _.F(_.Sc,{expirationTime:g}))},onEvent:f=>a.Nd(f),getConfiguration:()=>a.getConfiguration(),sc:()=>a.sc()});Ty(a);const b=a.configuration.drm,c=b?b.offlineId||"":"";let d=[];const e=_.An(a.f.periods);if(c){const f=_.jj(_.Od);
|
|
154
|
+
f&&(yield f.o(b,e,a.getNetworkEngine()),d=yield f.m(c))}yield _.Rk(a.j,e,d);a.f&&dz(a,a.f.periods)})};
|
|
155
|
+
sz=function(a){return _.y(function*(){const b=a.h;var c=e=>{a.h&&a.F&&(e.type===_.he&&a.gd?(a.F.a=fz,Py(a)):e.type===_.Qe&&a.getState()===_.Nl&&.1>a.getBufferInfo().Ea(a.getPosition())?(a.F.a=fz,Py(a)):a.F&&gz(a));hz(a)};a.m.on(b,_.Vd,c);a.m.on(b,_.Nd,c);a.m.on(b,_.$c,c);a.m.on(b,_.he,c);a.m.on(b,_.ge,c);a.m.on(b,_.Yd,c);a.m.on(b,_.Qe,c);a.m.on(b,_.$d,()=>{if(a.h){var e=a.h.playbackRate;0!=e&&a.$a.set(e)}});a.g||(a.g=new _.iz,a.g.configure(a.configuration.abr));jz(a,a.f.periods);a.Ya=new kz(a.configuration.preferredAudioLanguage||
|
|
156
|
+
[],a.configuration.preferredAudioRole,a.configuration.preferredAudioChannelCount);a.aa=a.configuration.preferredTextLanguage;a.ma=a.configuration.preferredTextRole;yield _.hl(a.j,b);if(!a.j)throw new _.H(_.G,7,7001);a.g.init((e,f,g)=>{!a.N&&Dy(a,e,f,g)});a.w=lz(a,a.configuration.startTime);a.ab=mz(a);a.$a=new nz({Dd:()=>b.playbackRate,bf:e=>{b.playbackRate=e},cg:e=>{b.currentTime+=e}});a.isLive()&&a.configuration.streaming.enableLiveEdgeChasing&&(a.pc=new oz(a));pz(a,Math.max(1E-4,a.configuration.streaming.rebufferingGoal));
|
|
157
|
+
mw(a.f,_.Yf(a.configuration.preferredVideoCodec),_.Yf(a.configuration.preferredAudioCodec),a.configuration.preferredAudioChannelCount);a.a=qz(a);a.a.j=a.configuration.streaming;a.C=uy;yield a.a.start();if(!a.a)throw new _.H(_.G,7,7001);a.configuration.streaming.startAtSegmentBoundary&&(c=rz(a,sx(a.w)),lx(a.w.g,c));for(var d of a.f.periods)Uy(a,d);cz(a);d=vy(a)||a.f.periods[0];c=d.variants.some(e=>e.primary);a.configuration.preferredAudioLanguage||c||a.log.warn("No preferred audio language set. We will choose an arbitrary language initially");
|
|
158
|
+
Cy(a,d.variants);a.m.one(b,_.pd,()=>{a.G.w=Date.now()/1E3-(null===a.Md?0:a.Md)})})};Py=function(a){if(a.G&&a.F&&a.w){const c=tz(a)===_.Fl;var b=a.$a;b.h=c;cx(b);a.w.j.m=c;hz(a)}};Zy=function(a,b,c){a.trigger(new _.F(b,{detail:{schemeIdUri:c.schemeIdUri,value:c.value,startTime:c.startTime,endTime:c.endTime,id:c.id,eventElement:c.eventElement,type:c.type}}))};
|
|
159
|
+
$y=function(a){return{networkingEngine:a.getNetworkEngine(),filterNewPeriod:b=>Uy(a,b),filterAllPeriods:b=>dz(a,b),onTimelineCueAdded:b=>{var c=a.Na;a:{for(d of c.a)if(d.schemeIdUri===b.schemeIdUri&&d.startTime===b.startTime&&d.endTime===b.endTime)break a;var d=null}null==d&&(c.a.add(b),c.f(b))},onEvent:b=>a.Nd(b),onError:b=>a.onError(b)}};Ty=function(a){const b=_.tj(a.configuration.drm);a.j.h=b};
|
|
160
|
+
dz=function(a,b){var c=a.a?Kx(a.a):null;const d=a.a?Lx(a.a):null;for(const f of b)rw(a.j,c,d,f);c=Gu(b,f=>f.variants.some(uw));if(a.configuration.streaming.disableAudioTracks)for(var e of b)for(const f of e.variants)delete f.audio;if(a.configuration.streaming.disableVideoTracks)for(const f of b)for(const g of f.variants)e=g.video,!e||1<Ku(e.type,_.Zh(e.mimeType,e.codecs)).size||delete g.video;if(0===c)throw new _.H(_.G,4,4032);if(c<b.length)throw new _.H(_.G,4,4011);for(const f of b)ow(f.variants,
|
|
161
|
+
a.configuration.restrictions,a.af)&&a.a&&vy(a)==f&&cz(a),uz(a,f.variants)};
|
|
162
|
+
gz=function(a){switch(a.C){case uy:a:if(a.h.ended||Uv(a.H))var b=!0;else{if(a.isLive()){b=sv(a.f.presentationTimeline);var c=a.getBufferInfo();if(null!==c&&(c=c.Aa(),null!==c&&c>=b)){b=!0;break a}}b=!1}break;default:b=!1}if(a.H){var d=Wv(a.H);c=d.video;d=d.audio;var e=a.h.currentTime;c&&d?(c=c.Ea(e),d=d.Ea(e),c=Math.min(c,d)):c=c?c.Ea(e):d?d.Ea(e):0}else c=0;if(d=a.F){{d=a.F;var f=b;const g=d.f.get(d.a);e=d.a;c=f||c>=g?vz:fz;d.a=c;d=e!=c}}c=d;d=wz(a);c||a.getState()===_.Fl&&!d?(a.log.debug("Buffering state changed. Is buffering",
|
|
163
|
+
d,"buffered to end",b,"state",a.getState()),Py(a)):a.Rb&&hz(a)};hz=function(a){Iy(a,tz(a))};
|
|
164
|
+
jz=function(a,b){for(let c=0;c<b.length;c++){const d=b[c],e=new Map;for(const f of d.variants)if(f.video&&f.video.closedCaptions){const g=f.video;for(const h of g.closedCaptions.keys())if(!e.has(h)){const k={id:a.df++,originalId:h,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:()=>null,getSegmentReference:()=>null,initSegmentReference:null,sa:0,mimeType:_.Tb,codecs:"",kind:"caption",encrypted:!1,keyId:null,language:g.closedCaptions.get(h),label:null,type:_.u,primary:!1,trickModeVideo:null,
|
|
165
|
+
emsgSchemeIdUris:null,roles:g.roles,channelsCount:null,closedCaptions:null};e.set(h,k)}}for(const f of e.values())d.textStreams.push(f)}};Dy=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=xz(a,b);yz(a,e,()=>yy(a,e,b,!0));e===vy(a)&&Fz(a);a.a&&Ux(a.a,b,c,d)}};lz=function(a,b){return new Gz(a.h,a.f,a.configuration.streaming,b,()=>{a.ab&&Fv(a.ab,!0);a.a&&Vx(a.a)},c=>a.dispatchEvent(c))};
|
|
166
|
+
mz=function(a){const b=new Hz(a.f);bx(b,()=>{cz(a)});const c=new Iz(a.Na);Gv(c,e=>{e.jd&&e.jd();Zy(a,_.Uf,e)},e=>{e.Wd&&e.Wd();Zy(a,_.Vf,e)},(e,f)=>{f||(e.jd&&e.jd(),Zy(a,_.Uf,e),e.Wd&&e.Wd(),Zy(a,_.Vf,e))});const d=new Jz(a.h);d.a.add(b);d.a.add(c);return d};pz=function(a,b){a.F=new Kz(b,Math.min(.5,b/2));a.F.a=fz;Py(a);a.ba=(new _.ci(()=>{gz(a)})).Xa(.25)};
|
|
167
|
+
qz=function(a){const b={tb:()=>sx(a.w),X:a.H,xb:a.getNetworkEngine(),Vd:a.zg.bind(a),Ud:a.yg.bind(a),onError:a.onError.bind(a),Oe:a.kf.bind(a),onEvent:a.Nd.bind(a),Se:a.Ag.bind(a),kd:a.lf.bind(a),Bd:()=>a.g,rd:a.xg.bind(a),cf:a.nf.bind(a),Fc:a.j};return new _.Lz(a.f,b)};
|
|
168
|
+
rz=function(a,b){function c(g,h){if(!g)return null;h=g.findSegmentPosition(h-f.startTime);return null==h?null:(g=g.getSegmentReference(h))?g.startTime+f.startTime:null}const d=Kx(a.a);var e=Lx(a.a);const f=vy(a);a=c(d,b);e=c(e,b);return null!=e&&null!=a?Math.max(e,a):null!=e?e:null!=a?a:b};
|
|
169
|
+
Uy=function(a,b){var c=a.a?Kx(a.a):null;const d=a.a?Lx(a.a):null;rw(a.j,c,d,b);c=b.variants;if(!c.some(uw))throw new _.H(_.G,4,4011);uz(a,b.variants);ow(c,a.configuration.restrictions,a.af)&&a.a&&vy(a)==b&&cz(a);if(!_.gi(2)&&(b=a.j?a.j.getDrmInfo():null))for(const e of c)for(const f of e.drmInfos)if(f.keySystem===b.keySystem)for(const g of f.initData||[])_.Vk(a.j,g.keyId,g.initData)||_.Xk(a.j,g.initDataType,g.initData,g.keyId)};
|
|
170
|
+
cz=function(a){const b=a.getTrackManager();b&&a.C!==Jy&&(b.l&&(Pw(b),b.l.trigger(new _.F(_.Wo))),Fz(a))};vy=function(a){const b=sx(a.w);let c=null;for(const d of a.f.periods)d.startTime<=b&&(c=d);return c};
|
|
171
|
+
Cy=function(a,b){try{uz(a,b)}catch(d){return a.onError(d),null}b=b.filter(d=>uw(d));b=Bw(b,a.Za);var c=a.Ya.create(b);c=Array.from(c.values());a.g.setVariants(c);if(null!==a.M&&null!==a.Za&&(c=c.find(d=>d.video.id==a.M&&d.audio.id==a.Za),a.M=null,c))return c;if(a.configuration.abr.enabled||null===a.M)return a.g.chooseVariant();b=b.find(d=>null!==d.video&&d.video.id===a.M);return b?b:(a.log.warn("Selected video track not found. Falling back to ABR selection"),a.g.chooseVariant())};
|
|
172
|
+
wz=function(a){return a.j&&a.j.B?!0:a.F?a.F.getState()===fz:!1};Vy=function(a,b,c){c=void 0===c?!0:c;const d=Cy(a,b.variants);a.Za=d&&d.audio&&d.audio.id;d&&(yy(a,b,d,!0),zy(a,d,c));(c=_.ww(b.textStreams,a.aa,a.ma)[0]||null)&&(a.configuration.streaming.alwaysStreamText||Nw(a))&&(wy(a,b,c,!0),xy(a,c))};Ay=function(a){const b=vy(a);return b&&Uw(a.K,b).variant};By=function(a){const b=vy(a);if(null==b)return[];Mz(a);return b.variants.filter(c=>uw(c))};
|
|
173
|
+
Nz=function(a){const b=vy(a);if(null==b)return[];Mz(a);return b.textStreams.filter(c=>!a.qc.has(c))};wy=function(a,b,c,d){Vw(a.K,b,c);if(b=a.getTrackManager())Qw(b,c,d),c=b.Ha(),a=a.G.A,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}))};xy=function(a,b){a.N?a.T=b:_.Tx(a.a,b,!0,0)};
|
|
174
|
+
yy=function(a,b,c,d){var e=a.getTrackManager();a.A.setCurrentVariant(c);if(e){var f=a.G.A;if(c.video){Qw(e,c.video,d);var g=e.ia(),h=f;h.h!==g&&(h.h=g,h.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&&(Qw(e,c.audio,d),e=e.Ga(),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})))}Uw(a.K,
|
|
175
|
+
b).variant=c};zy=function(a,b,c,d){c=void 0===c?!1:c;d=void 0===d?0:d;a.N?(a.W=b,a.Xe=c,a.We=d):Ux(a.a,b,c,d)};
|
|
176
|
+
uz=function(a,b){a=a.j?_.vf(a.j.W):{};var c=Object.keys(a);c=c.length&&"00"==c[0];let d=!1,e=!1;const f=[],g=[];for(const h of b){b=[];h.audio&&b.push(h.audio);h.video&&b.push(h.video);for(const k of b)k.keyId&&((b=a[c?"00":k.keyId])?bz.includes(b)&&(g.includes(b)||g.push(b)):f.includes(k.keyId)||f.push(k.keyId));h.allowedByApplication?h.allowedByKeySystem&&(d=!0):e=!0}if(!d)throw new _.H(_.G,4,4012,{hasAppRestrictions:e,missingKeys:f,restrictedKeyStatuses:g});};
|
|
177
|
+
Mz=function(a){if(a.a&&a.f){var b=Ix(a.a),c=vy(a);null!=b&&b==c&&(Kx(a.a),Lx(a.a),_.Jx(a.a,_.u),Uw(a.K,c),Uw(a.K,c))}};tz=function(a){const b=a.getDuration(),c=a.getPosition();return a.h&&a.h.ended||(a.Rb||a.V===_.Cl)&&1>=Math.abs(b-c)?_.Cl:wz(a)||a.gd?_.Fl:a.h&&a.h.paused?_.Ml:_.Nl};
|
|
178
|
+
Oz=function(a,b){a.N=!0;a.g.disable();a.log.debug("Choosing new streams after period changed");let c=Cy(a,b.variants),d=_.ww(b.textStreams,a.aa,a.ma)[0]||null;a.W&&(b.variants.includes(a.W)&&(c=a.W),a.W=null);a.T&&(b.textStreams.includes(a.T)&&(d=a.T),a.T=null);c&&yz(a,b,()=>yy(a,b,c,!0));d&&(a.configuration.streaming.alwaysStreamText||Nw(a))&&yz(a,b,()=>wy(a,b,d,!0));b===vy(a)&&Fz(a);return a.configuration.streaming.alwaysStreamText||Nw(a)?{variant:c,text:d}:{variant:c,text:null}};
|
|
179
|
+
yz=function(a,b,c){a.Db.has(b)||a.Db.set(b,[]);a.Db.get(b).push(c)};Fz=function(a){const b=vy(a);if(b){const c=a.Db.get(b)||[];for(a.Db.delete(b);c.length;)c.shift()()}};xz=function(a,b){for(const c of a.f.periods)if(c.variants.includes(b))return c;return null};
|
|
180
|
+
Pz=function(a,b,c){return _.y(function*(){let d;try{d=yield _.Cn(b.url,a.getNetworkEngine(),a.configuration.manifest.attemptParameters,b.type||null);d.configure(a.configuration.manifest);var e=yield d.start(b.url,$y(a));ty(e.periods);if(!e.periods.length)throw new _.H(_.G,4,4014);yield a.A.stop();a.A=d;const f=c.audio&&c.audio.id,g=c.video&&c.video.id;a.f.periods=e.periods;const h=fv(e.periods,sx(a.w))||e.periods[0];mw(a.f,_.Yf(a.configuration.preferredVideoCodec),_.Yf(a.configuration.preferredAudioCodec),
|
|
181
|
+
a.configuration.preferredAudioChannelCount);const k=Cw(f,g,h.variants),l=_.ww(h.textStreams,a.aa,a.ma)[0]||null;Cy(a,h.variants);const m=k&&k.video,n=k&&k.audio;e=[];const q=new Set;for(const t of h.variants)t.video&&q.add(t.video),t.audio&&q.add(t.audio);for(const t of[...q,...h.textStreams])e.push(t.createSegmentIndex());yield Promise.all(e);Yx(a.a,_.p,n);Yx(a.a,_.w,m);Yx(a.a,_.u,l);k&&yy(a,h,k,!1);a.log.info("Switch CDN successful.")}catch(f){throw d&&(yield d.stop()),f;}})};
|
|
182
|
+
Qz=function(){const a=MediaSource.isTypeSupported,b=/^dv(?:h[e1]|a[v1])\./;MediaSource.isTypeSupported=c=>{var d=c.split(/ *; */),e=d.shift();const f={};for(var g of d)d=g.split("\x3d"),f[d[0]]=d[1].replace(/"(.*)"/,"$1");g=f.codecs;if(!g)return a(c);let h=!1,k=!1;c=g.split(",").filter(l=>{b.test(l)&&(k=!0);/^(hev|hvc)1\.2/.test(l)&&(h=!0);return!0});k&&(h=!1);f.codecs=c.join(",");h&&(f.eotf="smpte2084");for(const l in f)e+="; "+l+'\x3d"'+f[l]+'"';return cast.__platform__.canDisplayType(e)}};
|
|
183
|
+
Rz=function(){const a=MediaSource.isTypeSupported;MediaSource.isTypeSupported=b=>"mp2t"==b.split(/ *; */)[0].split("/")[1].toLowerCase()?!1:a(b)};Sz=function(){const a=MediaSource.prototype.addSourceBuffer;MediaSource.prototype.addSourceBuffer=function(...b){b=a.apply(this,b);b.abort=function(){};return b}};Tz=function(){const a=SourceBuffer.prototype.remove;SourceBuffer.prototype.remove=function(b,c){return a.call(this,b,c-.001)}};
|
|
184
|
+
Uz=function(){const a=MediaSource.isTypeSupported;MediaSource.isTypeSupported=b=>"opus"!=_.Nu(b)[0]&&a(b)};Vz=function(a,b){const c=a.mode;a.mode=c==_.ie?_.ie:_.ed;const d=a.cues;for(let e=d.length-1;0<=e;e--){const f=d[e];f&&b(f)&&a.removeCue(f)}a.mode=c};pu=[112,115,115,104,0,0,0,0];_.Wz=class{constructor(a,b,c,d,e){this.Ia=a;this.ua=b;this.ha=c;this.keyInfo=d||null;this.lc=_.B(e)?!1:!!e}f(){return this.keyInfo}};
|
|
185
|
+
_.Av=class{constructor(a,b,c,d,e,f,g,h=null,k=!1,l=null,m=null,n=null,q=null,t=[]){this.position=a;this.startTime=b;this.endTime=c;this.sa=g;this.Ia=d;this.ua=e;this.ha=f;this.keyInfo=h||null;this.lc=_.B(k)?!1:!!k;this.timescale=l;this.horizontalTiles=m;this.verticalTiles=n;this.durationPerTile=q;this.a=t||[];this.g=!1}getPosition(){return this.position}f(){return this.keyInfo}};
|
|
186
|
+
Xz=class{constructor(){this.a=new muxjs.mp4.Transmuxer({keepOriginalTimestamps:!0,remux:!1});this.f=null;this.m=[];this.j=[];this.g=[];this.h=!1;this.a.on("data",this.w.bind(this));this.a.on("done",this.o.bind(this))}destroy(){this.a&&(this.a.dispose(),this.a=null);return Promise.resolve()}w(a){this.g=a.captions;const b=new Uint8Array(a.data.byteLength+a.initSegment.byteLength);b.set(a.initSegment,0);b.set(a.data,a.initSegment.byteLength);a.type===_.w?this.m.push(b):a.type===_.p&&this.j.push(b)}o(){const a=
|
|
187
|
+
{video:_.dh(...this.m),captions:this.g,audio:_.dh(...this.j)};this.f.resolve(a);this.h=!1}};Vu=[154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149];Uu=class extends _.mp{constructor(a,b,c,d,e,f){f=void 0===f?null:f;super(a,b,d);this.version=e;this.g=c;this.j=f}};
|
|
188
|
+
_.Gy=class{constructor(a){this.j=a;this.log=new _.Q("clpp.renditions");this.S=[];this.h=this.a=null;this.g=!1}track(a){null!=this.a&&(this.a&&(this.a.off(_.ee,this.f),this.g&&this.a.off(_.xe,this.f)),this.a=null);a&&(this.a=a,this.a.on(_.ee,this.f,this))}append(a,b,c){const d=this.j?this.j(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};const e=this.S.find(f=>f.start>=a&&f.end<=b);if(e)e.rendition=
|
|
189
|
+
d,e.width=c.width,e.height=c.height,e.bandwidth=c.bandwidth,e.start=c.start,e.end=c.end;else{for(const f of this.S)a>=f.start&&a<f.end?f.end=a:b>=f.start&&b<f.end&&(f.start=b);this.S.push(c);this.S.sort(av)}dv(this);this.f();this.a&&this.a.trigger(new _.F(_.Le))}clear(){this.S=[];dv(this);this.a&&(this.a.trigger(new _.F(_.Le)),this.a.trigger(new _.F(_.ec)))}f(){if(this.a){var a=this.a.getPosition();if(0<=a){a:{var b=this.S.length,c=Number.MAX_SAFE_INTEGER;for(var d=0;d<b;d++){const e=this.S[d];c=
|
|
190
|
+
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.h!==a&&(this.h=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 _.F(_.gc,{detail:{width:b,height:c,bandwidth:a?a.bandwidth:null,rendition:a}}))}}}}};_.Yz=class{constructor(a){this.g=Math.exp(Math.log(.5)/a);this.f=this.a=0}};
|
|
191
|
+
_.Zz=class{constructor(a,b,c,d,e){e=void 0===e?!1:e;this.w=a;this.F=b;this.j=this.f=Infinity;this.a=1;this.A=0;this.g=this.h=null;this.B=0;this.o=this.m=c;this.I=void 0===d?!0:d;this.C=new _.Q("clpp.media.PresentationTimeline");this.G=e;this.H=null}tc(){return this.H}getDuration(){return this.f}getPresentationStartTime(){return this.w}offset(a){null!=this.h&&(this.h+=a);null!=this.g&&(this.g+=a)}isLive(){return Infinity==this.f&&!this.m}};
|
|
192
|
+
Yy=class{constructor(){this.f=()=>{};this.a=new Set}release(){this.f=()=>{};this.a.clear()}cues(){return this.a}};Dv=class{constructor(a,b,c){this.g=a;this.a=b;this.f=c;new _.Q("clpp.media.SegmentIterator")}next(){var a=this.g.get(this.a);a&&0<a.a.length?(this.f+=1,a.Ia().length&&this.f===a.a.length&&(this.a+=1,this.f=0)):(this.a+=1,this.f=0);a=yv(this);return{value:a,done:!a}}};
|
|
193
|
+
_.$z=class{constructor(a){this.a=a;this.h=new _.Q("clpp.media.SegmentIndex")}destroy(){this.a=[];return Promise.resolve()}f(a){for(var b=this.a.length-1;0<=b;--b){const 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: "+
|
|
195
194
|
b.position);return null}get(a){if(0==this.a.length)return null;a-=this.a[0].position;return 0>a||a>=this.a.length?null:this.a[a]}offset(a){this.h.info("Apply offset"+a+" to segment index");for(const b of this.a)b.startTime+=a,b.endTime+=a,b.sa-=a}g(a,b){a-=this.a[0].position;if(0<=a&&a<this.a.length)for(this.h.warn("Accounting for segment duration drift",b,"at",a),this.a[a].endTime+=b,a+=1;a<this.a.length;++a)this.a[a].startTime+=b,this.a[a].endTime+=b}getDuration(){return this.a[this.a.length-1].endTime-
|
|
196
|
-
this.a[0].startTime}replace(a){this.a=a}};
|
|
197
|
-
|
|
195
|
+
this.a[0].startTime}replace(a){this.a=a}};Jz=class{constructor(a){this.f=a;this.a=new Set;this.g=(new _.ci(()=>{Fv(this,!1)})).Xa(.25)}release(){this.g.stop();for(const a of this.a)a.release();this.a.clear()}};
|
|
196
|
+
Iz=class{constructor(a){this.j=a;this.h=new Map;this.a=()=>{};this.f=()=>{};this.g=()=>{};this.o=[{hc:null,gc:2,Xb:(b,c)=>this.a(b,c)},{hc:1,gc:2,Xb:(b,c)=>this.a(b,c)},{hc:3,gc:2,Xb:(b,c)=>this.a(b,c)},{hc:2,gc:1,Xb:(b,c)=>this.f(b,c)},{hc:2,gc:3,Xb:(b,c)=>this.f(b,c)},{hc:1,gc:3,Xb:(b,c)=>this.g(b,c)},{hc:3,gc:1,Xb:(b,c)=>this.g(b,c)}]}release(){this.j=null;this.h.clear();this.a=()=>{};this.f=()=>{};this.g=()=>{}}m(a,b){for(const c of this.j.cues()){const d=this.h.get(c)||null,e=a<c.startTime?1:
|
|
198
197
|
a>c.endTime?3:2;this.h.set(c,e);const f=this.o.find(g=>g.hc===d&&g.gc===e);f&&f.Xb(c,b)}}};
|
|
199
|
-
|
|
200
|
-
this.a&&a<this.f}Ea(a){return null==this.f||this.f<a?0:this.f-Math.max(a,this.a)}};
|
|
201
|
-
_.
|
|
202
|
-
a.push(this.f.destroy());this.C&&a.push(this.C.destroy());for(const c in this.B)a.push(this.B[c].destroy());return Promise.all(a).then(()=>{this.m&&(this.m.release(),this.m=null);this.j&&(this.j.removeAttribute("src"),this.j.load(),this.j=null);this.w="";this.C=this.f=this.o=null;this.g={};this.B={};this.G={};this.H=null;this.N=!1;for(const c in this.h);this.h={}})}init(a,b,c){c=void 0===c?!1:c;const d=this;return _.y(function*(){yield d.I;a.forEach((e,f)=>{let g=_.
|
|
203
|
-
g);else{let h=new Map;h.set(f,g);_.
|
|
204
|
-
c):
|
|
205
|
-
b){this.a.debug("Appending data to "+a+
|
|
206
|
-
c=this.g[a].appendWindowEnd;this.g[a].abort();this.g[a].appendWindowStart=b;this.g[a].appendWindowEnd=c}catch(b){throw this.a.warn("Failed to abort operations for "+a+
|
|
198
|
+
Qv=class{constructor(a,b){this.o=null;this.B=a;this.g=b;this.h=this.w=0;this.j=Infinity;this.f=this.a=null;this.A="";this.m=new Map}destroy(){this.g=this.o=null;this.m.clear();return Promise.resolve()}remove(a,b){return Promise.resolve().then(()=>{!this.g||!this.g.remove(a,b)||null==this.a||b<=this.a||a>=this.f||(a<=this.a&&b>=this.f?this.a=this.f=null:a<=this.a&&b<this.f?this.a=b:a>this.a&&b>=this.f&&(this.f=a))})}ob(){return this.a}Aa(){return this.f}Zb(a){return null==this.a||null==this.f?!1:a>=
|
|
199
|
+
this.a&&a<this.f}Ea(a){return null==this.f||this.f<a?0:this.f-Math.max(a,this.a)}};Qy=class{constructor(){this.a=new muxjs.mp4.CaptionParser;this.j=[];this.h={}}init(a){const b=muxjs.mp4.probe;a=_.K(a);this.j=b.videoTrackIds(a);this.h=b.timescale(a);this.a.init()}g(a,b){a=_.K(a);(a=this.a.parse(a,this.j,this.h))&&a.captions&&b(a.captions);this.a.clearParsedCaptions()}f(){this.a.resetCaptionStream()}};_.Ry=class{init(){}g(){}f(){}};var Ov;
|
|
200
|
+
_.Sy=class{constructor(a,b,c,d,e){this.j=a;this.C=c;this.g={};this.N=!1;this.f=null;this.h={};this.m=new _.po;this.J=!1;this.B={};this.H=b;this.F=d;this.K=e;this.aa=this.K.streaming.maxSegmentToMediaOffset||1;this.I=new _.Sk;this.w="";this.G={};this.o=Pv(this,this.I);this.R=!0;this.a=new _.Q("clpp.mse.MediaSourceEngine")}destroy(){this.J=!0;const a=[];for(const c in this.h){const d=this.h[c];var b=d[0];this.h[c]=d.slice(0,1);b&&a.push(b.p.catch(wu));for(b=1;b<d.length;++b)d[b].p.catch(wu),d[b].p.reject()}this.f&&
|
|
201
|
+
a.push(this.f.destroy());this.C&&a.push(this.C.destroy());for(const c in this.B)a.push(this.B[c].destroy());return Promise.all(a).then(()=>{this.m&&(this.m.release(),this.m=null);this.j&&(this.j.removeAttribute("src"),this.j.load(),this.j=null);this.w="";this.C=this.f=this.o=null;this.g={};this.B={};this.G={};this.H=null;this.N=!1;for(const c in this.h);this.h={}})}init(a,b,c){c=void 0===c?!1:c;const d=this;return _.y(function*(){yield d.I;a.forEach((e,f)=>{let g=_.Zh(e.mimeType,e.codecs);if(f==_.u)Rv(d,
|
|
202
|
+
g);else{let h=new Map;h.set(f,g);_.Hu(g)&&b&&!e.keyInfo||!Ju(g,f)||(d.B[f]=new Xz,g="aac"==g.toLowerCase().split(";")[0].split("/")[1]?g.replace(/aac/i,_.zd):Iu(f,g),h=Ku(f,g),c&&h.delete(_.p));Sv(d,h)}})})}ob(a){return a===_.u?this.f.ob():(a=Vv(this,a))?a.ob():null}Aa(a){return a===_.u?this.f.Aa():(a=Vv(this,a))?a.Aa():null}Zb(a,b,c){return a===_.u?this.f.Zb(b):(a=Vv(this,a))?a.Zb(b,!1,c):!1}Ea(a,b){return a===_.u?this.f.Ea(b):(a=Vv(this,a))?a.Ea(b):0}remove(a,b,c){return a===_.u?this.f.remove(b,
|
|
203
|
+
c):Zv(this,a,this.V.bind(this,a,b,c)).then(()=>{if(a===_.w){var d=this.ob(a);const e=this.Aa(a);null!==d&&null!==e&&ev(this.F,d,e)}else a===_.p&&(d=this.F,d.a&&d.a.trigger(new _.F(_.ec)))})}clear(a){if(a==_.u){if(!this.f)return Promise.resolve();this.H.f();return this.f.remove(0,Infinity)}return Zv(this,a,this.V.bind(this,a,0,this.o.duration))}flush(a){return a==_.u?Promise.resolve():Zv(this,a,this.T.bind(this,a))}endOfStream(a){return fw(this,()=>{Uv(this)||(a?this.o.endOfStream(a):this.o.endOfStream())})}getDuration(){return this.o.duration}M(a,
|
|
204
|
+
b){this.a.debug("Appending data to "+a+Kt);try{this.g[a].appendBuffer(b)}catch(c){throw this.a.warn("Failed to append data for "+a,c),c;}this.a.debug("Done Appending data to "+a+Kt)}V(a,b,c){if(c<=b)this.A(a);else{this.a.debug("Removing data from "+a+" range:",b,c);try{this.g[a].remove(b,c)}catch(d){throw this.a.warn("Failed to remove data from "+a+" buffer. Range:",b,c,d),d;}this.a.debug("Done Removing data from "+a+" range:",b,c)}}Y(a){try{this.a.debug("Aborting operations for "+a+Kt);const b=this.g[a].appendWindowStart,
|
|
205
|
+
c=this.g[a].appendWindowEnd;this.g[a].abort();this.g[a].appendWindowStart=b;this.g[a].appendWindowEnd=c}catch(b){throw this.a.warn("Failed to abort operations for "+a+Kt,b),b;}this.a.debug("Done Aborting operations for "+a+Kt);this.A(a)}T(a){try{this.j.readyState>HTMLMediaElement.HAVE_NOTHING?(this.a.debug("Flushing buffer for "+a),this.j.currentTime-=.001):this.a.warn("Skip buffer flush for "+a+" with element state: "+this.j.readyState)}catch(b){throw this.a.warn("Failed to flush buffer for "+a,
|
|
207
206
|
b),b;}this.a.debug("Done Flushing buffer for "+a);this.A(a)}W(a,b){0>b&&(b+=.001);try{this.a.debug("Setting timestamp offset for "+a,b),this.g[a].timestampOffset=b}catch(c){throw this.a.warn("Failed to set timestamp offset for "+a,b,c),c;}this.a.debug("Done Setting timestamp offset for "+a,b);this.A(a)}ba(a,b,c){try{this.a.debug("Setting append window for "+a,b,c),this.g[a].appendWindowStart=0,this.g[a].appendWindowEnd=c,this.g[a].appendWindowStart=b}catch(d){throw this.a.warn("Failed to set append window for "+
|
|
208
|
-
a,b,c,d),d;}this.a.debug("Done Setting append window for "+a,b,c);this.A(a)}U(a){this.h[a][0].p.reject(new _.H(_.G,3,3014,{mediaError:this.j.error?this.j.error.code:0}))}A(a){const b=this.h[a][0];b&&(b.p.resolve(),this.a.debug("Update-End received for "+a),
|
|
209
|
-
null}fb(){return this.f.get(_.
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
a=
|
|
213
|
-
"deltaTimeMs\x3d"+a,"numBytes\x3d"+b,"lastTimeChosenMs\x3d"+this.h,"enabled\x3d"+this.j);var c=this.g;if(!(16E3>b)){var d=8E3*b/a;a/=1E3;c.a+=b;_.
|
|
214
|
-
break a}}else if(Date.now()-this.h<1E3*this.a.switchInterval){this.f.debug("Still within switch interval...");break a}b=this.chooseVariant();this.f.debug("Calling switch_(), bandwidth\x3d"+Math.round(
|
|
215
|
-
(a=b));this.f&&(b=
|
|
216
|
-
this.D.setPlaybackRate(this.a.chasingRate)):1<d&&b<=e&&(this.f.debug("On live edge, reduce playback rate."),this.D.setPlaybackRate(1))}}))}release(){this.g.release()}};var
|
|
217
|
-
this.g?this.a.stop():(this.f.currentTime=this.j,this.h--)})}release(){this.a&&(this.a.stop(),this.a=null);this.f=null}};var
|
|
218
|
-
{if(0!=this.h.readyState&&!this.h.paused){var g=
|
|
219
|
-
if(!c.variant&&!c.text)throw a.a.error("start(): No streams chosen"),new _.H(_.G,5,5005);a.C=!c.variant&&!!c.text;yield
|
|
220
|
-
a,a.
|
|
221
|
-
d.reader.getPosition());a=a.startTime+b.startTime+h/g;c.includes(e)&&("urn:mpeg:dash:event:2012"==e?this.D.
|
|
222
|
-
b=e!==f;this.a.debug(`hSpacing=${e}, vSpacing=${f}, updatePASP=${b}`);d.parser.stop()}).parse(a.data);b&&(a=new _.
|
|
223
|
-
this.configuration.preferredAudioChannelCount);this.aa=this.configuration.preferredTextLanguage;this.M=this.Za=null;this.Db=new Map;this.Y=null;this.ma=this.configuration.preferredTextRole;a&&a(this);this.
|
|
224
|
-
a&&a.release();return this.C===
|
|
225
|
-
d(g)})}catch(e){a.R=null,d(e)}});return a.R})}getBufferInfo(a){if(this.H){var b=
|
|
226
|
-
this.f.presentationTimeline.getDuration():Infinity}destroy(){const a=this,b=()=>Object.getPrototypeOf(Object.getPrototypeOf(this)).destroy;return _.y(function*(){yield b().call(a);a.C!==
|
|
227
|
-
if(b.R){try{yield b.R}catch(h){}b.ra!==c&&d()}b.G=new _.
|
|
228
|
-
d();yield
|
|
229
|
-
|
|
230
|
-
c),_.
|
|
231
|
-
a.getVideoPlaybackQuality();a=this.G;var c=Number(b.totalVideoFrames);a.j=Number(b.droppedVideoFrames);a.h=c}if(this.C===
|
|
232
|
-
this.g.reset()}addTextTrack(a,b,c,d,e,f){const g=this;return _.y(function*(){if(g.C!==
|
|
233
|
-
findSegmentPosition:()=>1,getSegmentReference:q=>1==q?m:null,adjustSegmentDurations:()=>{},getDuration:()=>l,segmentLookupStrategy:_.
|
|
234
|
-
|
|
235
|
-
(
|
|
236
|
-
e&&e.id===a.id&&(d.allowedByApplication=!1)}
|
|
237
|
-
this.log.debug(_.
|
|
238
|
-
c;a.f=!0;b.trigger(new _.F(_.
|
|
239
|
-
_.
|
|
240
|
-
_.
|
|
241
|
-
"middle"}d.writingMode===_.
|
|
242
|
-
|
|
207
|
+
a,b,c,d),d;}this.a.debug("Done Setting append window for "+a,b,c);this.A(a)}U(a){this.h[a][0].p.reject(new _.H(_.G,3,3014,{mediaError:this.j.error?this.j.error.code:0}))}A(a){const b=this.h[a][0];b&&(b.p.resolve(),this.a.debug("Update-End received for "+a),ew(this,a))}getTextDisplayer(){return this.C}};Ov=window.URL.createObjectURL;var V=class extends _.R{constructor(){super();this.g=new _.Q("cl.api.mse.TrackManager");this.l=null;this.h=[];this.a=new Map;this.f=new Map}initialize(a){this.l=a}release(){this.h=[];this.a.clear();this.f.clear()}load(){}destroy(){this.release();this.l=null}getVideoTracks(){return Dw(this,_.N)}getAudioTracks(){return Dw(this,_.M)}ja(){return Dw(this,_.L)}ia(){return this.a.get(_.N)||null}Ga(){return this.a.get(_.M)||null}Ha(){return this.a.get(_.L)||null}Ra(){return this.f.get(_.N)||null}eb(){return this.f.get(_.M)||
|
|
208
|
+
null}fb(){return this.f.get(_.L)||null}Ja(){return Ew(this,_.N)}na(){return Ew(this,_.M)}oa(){return Ew(this,_.L)}Wa(a){Gw(this,_.N,a)}ta(a){Gw(this,_.M,a)}Da(a){Gw(this,_.L,a)}Va(a,b){Fw(this,_.N,a,void 0===b?!1:b)}kb(a,b){Fw(this,_.M,a,void 0===b?!1:b)}lb(a,b){Fw(this,_.L,a,void 0===b?!1:b)}addTextTrack(a){const b=this;return _.y(function*(){b.l&&(yield b.l.addTextTrack(a.url,a.language,a.kind,a.mimeType,a.codec,a.label))})}la(){return!!this.l&&this.l.la()}};V.prototype.isAbrEnabled=V.prototype.la;
|
|
209
|
+
V.prototype.addTextTrack=V.prototype.addTextTrack;V.prototype.setTextRendition=V.prototype.lb;V.prototype.setAudioRendition=V.prototype.kb;V.prototype.setVideoRendition=V.prototype.Va;V.prototype.setTextTrack=V.prototype.Da;V.prototype.setAudioTrack=V.prototype.ta;V.prototype.setVideoTrack=V.prototype.Wa;V.prototype.getTextTrack=V.prototype.oa;V.prototype.getAudioTrack=V.prototype.na;V.prototype.getVideoTrack=V.prototype.Ja;V.prototype.getLoadingTextRendition=V.prototype.fb;
|
|
210
|
+
V.prototype.getLoadingAudioRendition=V.prototype.eb;V.prototype.getLoadingVideoRendition=V.prototype.Ra;V.prototype.getTextRendition=V.prototype.Ha;V.prototype.getAudioRendition=V.prototype.Ga;V.prototype.getVideoRendition=V.prototype.ia;V.prototype.getTextTracks=V.prototype.ja;V.prototype.getAudioTracks=V.prototype.getAudioTracks;V.prototype.getVideoTracks=V.prototype.getVideoTracks;var aA=class{constructor(){this.f=new _.Yz(2);this.g=new _.Yz(5);this.a=0}};_.iz=class{constructor(){this.f=new _.Q("clpp.abr");this.w=null;this.j=!1;this.g=new aA;this.o=[];this.m=1;this.B=this.A=!1;this.a=this.h=null}stop(){this.w=null;this.j=!1;this.o=[];this.m=1;this.h=null;this.B=!1}init(a){this.w=a}chooseVariant(){var a=Sw(!this.B&&this.a.initialRestrictions?this.a.initialRestrictions:this.a.restrictions,this.o);const b=Rw(this.g,this.a.defaultBandwidthEstimate);this.o.length&&!a.length&&(this.f.warn("No variants met the ABR restrictions. Choosing a variant by lowest bandwidth."),
|
|
211
|
+
a=Sw(null,this.o),a=[a[0]]);let c=a[0]||null;for(const {item:e,next:f}of _.Cu(a)){var d=isNaN(this.m)||0===this.m?1:Math.abs(this.m);a=d*e.bandwidth;const g=a/this.a.bandwidthDowngradeTarget;d=d*(f||{bandwidth:Infinity}).bandwidth/this.a.bandwidthUpgradeTarget;this.f.debug("Bandwidth ranges:",(a/1E6).toFixed(3),(g/1E6).toFixed(3),(d/1E6).toFixed(3));b>=g&&b<=d&&(c=e)}this.h=Date.now();this.B=!0;return c}enable(){this.j=!0}disable(){this.j=!1}segmentDownloaded(a,b){this.f.debug("Segment downloaded:",
|
|
212
|
+
"deltaTimeMs\x3d"+a,"numBytes\x3d"+b,"lastTimeChosenMs\x3d"+this.h,"enabled\x3d"+this.j);var c=this.g;if(!(16E3>b)){var d=8E3*b/a;a/=1E3;c.a+=b;_.kv(c.f,a,d);_.kv(c.g,a,d)}if(null!=this.h&&this.j)a:{this.f.debug("Suggesting Streams...");if(!this.A){if(!(128E3<=this.g.a)){this.f.debug("Still waiting for a good estimate...");break a}this.A=!0;if(this.a.useSwitchIntervalForInitialSwitch&&Date.now()-this.h<1E3*this.a.switchInterval){this.f.debug("Skipping initial estimation switch due to switch interval...");
|
|
213
|
+
break a}}else if(Date.now()-this.h<1E3*this.a.switchInterval){this.f.debug("Still within switch interval...");break a}b=this.chooseVariant();this.f.debug("Calling switch_(), bandwidth\x3d"+Math.round(Rw(this.g,this.a.defaultBandwidthEstimate)/1E3)+" kbps");b&&this.w(b)}}playbackRateChanged(a){this.m=a}getBandwidthEstimate(){return Rw(this.g,this.a.defaultBandwidthEstimate)}setVariants(a){this.o=a}configure(a){this.a=a}reset(){this.A=!1;this.g=new aA;const a=this.chooseVariant();a&&this.w(a)}};var bA=class{constructor(){this.a=new Map}clear(){this.a.clear()}},Tw=class{constructor(){this.text=this.variant=null}};var cA=class{constructor(a,b){this.f=a;this.a=new Set([a]);b=b||[];for(const c of b)this.add(c)}add(a){if(Yw(this.f,a))return this.a.add(a),!0;_.C("Rejecting variant - not compatible with root.");return!1}values(){return this.a.values()}};var Ey=class{constructor(a){this.a=a;this.f=new kz(a.language,"",a.audio&&a.audio.channelsCount?a.audio.channelsCount:0)}create(a){const b=a.filter(c=>Yw(this.a,c));return b.length?new cA(b[0],b):this.f.create(a)}},kz=class{constructor(a,b,c){this.g=_.Yf(a);this.a=b;this.f=c}create(a){var b=Zw(a,this.g);0<b.length&&(a=b);b=!1;if(this.a){const c=$w(a,this.a);0<c.length?(a=c,b=!0):_.C("No exact match for preferred variant role could be "+`found. Role: ${this.a}`)}b||(b=a.filter(c=>c.primary),0<b.length&&
|
|
214
|
+
(a=b));this.f&&(b=iw(a,this.f),b.length?a=b:_.C("No exact match for the channel count could be found."));b=new cA(a[0]);for(const c of a)Yw(b.f,c)&&b.add(c);return b}};var Kz=class{constructor(a,b){this.a=vz;this.f=(new Map).set(vz,b).set(fz,a)}getState(){return this.a}},fz=0,vz=1;var oz=class{constructor(a){this.D=a;this.a=a.getConfiguration().streaming;this.g=new _.po;this.f=new _.Q("clpp.mse.media.LiveEdgeObserver");ax(this)&&(a=this.D.getSurface().getMedia(),this.g.on(a,_.xe,()=>{{var b=this.D.getPosition();const c=this.D.getSeekRange().end;b=c-b;const d=this.D.getPlaybackRate(),e=this.a.stopChasingAt;1<=d&&b>=this.a.chaseJumpDistance?(this.f.debug("Too far from edge, jump to beginning."),this.D.setPlaybackRate(1),this.D.seek(c)):1===d&&b>=this.a.startChasingAt?(this.f.debug("Not on live edge, increase playback rate."),
|
|
215
|
+
this.D.setPlaybackRate(this.a.chasingRate)):1<d&&b<=e&&(this.f.debug("On live edge, reduce playback rate."),this.D.setPlaybackRate(1))}}))}release(){this.g.release()}};var Hz=class{constructor(a){this.g=a;this.a=null;this.f=()=>{}}release(){this.a=this.g=null;this.f=()=>{}}m(a){const b=this.a;{const c=this.g.periods;a=fv(c,a)||c[0]}b!=a&&this.f(a);this.a=a}};var nz=class{constructor(a){this.a=a;this.h=!1;this.g=this.a.Dd();this.f=new _.ci(()=>{this.a.cg(.25*this.g)})}release(){this.f&&(this.f.stop(),this.f=null);this.a=null}set(a){this.g=a;cx(this)}};var mx=class{constructor(a,b){this.g=a;this.j=ex(a);this.a=a.a.currentTime;this.h=Date.now()/1E3;this.m=b;this.f=()=>{}}release(){this.g=null;this.f=()=>{}}},nx=class{constructor(a){this.a=a}};var dA=class{constructor(a,b,c,d,e){this.a=a;this.C=b;this.j=c;this.B=e;this.g=new _.po;this.A=!1;this.G=a.readyState;this.h=!1;this.f=d;this.m=this.F=this.w=!1;this.g.on(a,_.Qe,()=>fx(this));this.o=(new _.ci(()=>{fx(this)})).Xa(.25)}release(){this.g&&(this.g.release(),this.g=null);null!=this.o&&(this.o.stop(),this.o=null);this.f&&(this.f.release(),this.f=null);this.a=this.C=this.B=null;this.m=!1}kd(){this.w=!0;fx(this)}};var fA=class{constructor(a,b,c,d){this.a=a;this.h=b;this.m=d;this.w=c;this.j=!1;this.f=new _.po;this.g=new eA(a,10);this.o=!1;0<a.readyState?ix(this,c):jx(this,c)}release(){this.f&&(this.f.release(),this.f=null);null!=this.g&&(this.g.release(),this.g=null);this.h=()=>{};this.a=null;this.m=()=>{};this.o=!1}},eA=class{constructor(a,b){this.f=a;this.m=b;this.j=this.g=this.h=0;this.a=new _.ci(()=>{0>=this.h?(_.C(["Failed to move playhead from",this.g,"to",this.j].join(" ")),this.a.stop()):this.f.currentTime!=
|
|
216
|
+
this.g?this.a.stop():(this.f.currentTime=this.j,this.h--)})}release(){this.a&&(this.a.stop(),this.a=null);this.f=null}};var Gz=class{constructor(a,b,c,d,e,f){this.h=a;this.a=b.presentationTimeline;this.B=b.minBufferTime||0;this.m=c;this.A=e;this.w=null;this.j=new dA(a,b.presentationTimeline,c,ox(this,a,c),f);this.g=new fA(a,()=>{a:{var g=this.j;g.A=!0;g.w=!1;g.h=!1;g=kx(this.g);const h=tx(this,g);if(.001<Math.abs(h-g)){const k=(new Date).getTime()/1E3;if(!this.w||this.w<k-1){this.w=k;lx(this.g,h);g=void 0;break a}}this.f.debug("Seek to "+g);this.A();g=void 0}return g},rx(this,d),()=>{this.j.F=!0});this.o=(new _.ci(()=>
|
|
217
|
+
{if(0!=this.h.readyState&&!this.h.paused){var g=kx(this.g),h=_.wv(this.a,0),k=vv(this.a);3>k-h&&(h=k-3);g<h&&(h=tx(this,g),this.f.info("Jumping forward "+(h-g)+" seconds to catch up with the seek range."),this.h.currentTime=h)}})).Xa(.25);this.f=new _.Q("clpp.mse.Playhead")}release(){this.g&&(this.g.release(),this.g=null);this.j&&(this.j.release(),this.j=null);this.o&&(this.o.stop(),this.o=null);this.h=this.g=this.a=this.m=null;this.A=()=>{}}};var wx=new _.rp(()=>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]));_.Lz=class{constructor(a,b){this.D=b;this.g=a;this.j=null;this.w=1;this.F=Promise.resolve();this.m=[];this.o=new Map;this.f=new Map;this.H=this.h=this.A=this.B=!1;this.G=0;this.a=new _.Q("clpp.mse.Streaming");this.C=!1}destroy(){const a=this;return _.y(function*(){const b=[];for(const c of a.f.values())Ax(c),b.push(Bx(c));yield Promise.all(b);a.f.clear();a.o.clear();a.D=null;a.g=null;a.F=null;a.m=null;a.j=null;a.h=!0})}start(){const a=this;return _.y(function*(){const b=a.D.tb();var c=Cx(a,b);c=a.D.Vd(a.g.periods[c]);
|
|
218
|
+
if(!c.variant&&!c.text)throw a.a.error("start(): No streams chosen"),new _.H(_.G,5,5005);a.C=!c.variant&&!!c.text;yield Hx(a,c.variant?c.variant.audio:null,c.variant?c.variant.video:null,c.text,b);a.h||(a.a.debug("init: completed initial Stream setup"),a.D&&a.D.dg&&(a.a.debug("init: calling onInitialStreamsSetup()..."),a.D.dg()))})}yb(a){const b=this;return _.y(function*(){if(!b.h){var c=yx(a);if(!a.Ta&&null!=a.nb&&!a.Tb)if(a.nb=null,a.Cb)b.a.debug(c,"skipping update and clearing the buffer"),yield Sx(b,
|
|
219
|
+
a,a.od,a.Yc);else{try{var d=fy(b,a);null!=d&&(Gx(b,a,d),a.uc=!1)}catch(e){yield gy(b,e);return}d=Array.from(b.f.values());hy(b,a);b.B&&d.every(e=>e.endOfStream)&&(b.a.debug(c,"calling endOfStream()..."),b.D.X.endOfStream().then(()=>{if(!b.h){var e=b.D.X.getDuration();e<b.g.presentationTimeline.getDuration()&&(b.g.presentationTimeline.f=e)}}).then(()=>{b.D.Oe()}))}}})}I(a,b,c,d){const e=ou(d.reader),f=ou(d.reader),g=_.P(d.reader),h=_.P(d.reader),k=_.P(d.reader),l=_.P(d.reader);d=_.Gj(d.reader,d.reader.Ba()-
|
|
220
|
+
d.reader.getPosition());a=a.startTime+b.startTime+h/g;c.includes(e)&&("urn:mpeg:dash:event:2012"==e?this.D.Se():(c=new _.F("emsg",{detail:{startTime:a,endTime:a+k/g,schemeIdUri:e,value:f,timescale:g,presentationTimeDelta:h,eventDuration:k,id:l,messageData:d}}),this.D.onEvent(c)))}J(a){let b=!1,c=0;(new _.Qj).L(_.yd,_.Jj).L(_.ye,_.Jj).L(_.td,_.Jj).L(_.xd,_.Jj).L(_.oe,_.Jj).Z(_.qe,_.Kj).L("encv",d=>{d.reader.skip(78);_.Jj(d)}).L("pasp",d=>{c=d.start+d.headerSize;const e=_.P(d.reader),f=_.P(d.reader);
|
|
221
|
+
b=e!==f;this.a.debug(`hSpacing=${e}, vSpacing=${f}, updatePASP=${b}`);d.parser.stop()}).parse(a.data);b&&(a=new _.Sj(new DataView(a.data)),a.seek(c),_.O(a,1),_.O(a,1))}};_.$x="iterateSegmentReference";var gA=class extends _.ap{constructor(a){super(bu);this.C=Oy;this.h=this.ra=this.R=null;this.Od=0;this.Ne=2;this.Sb=null;this.Ld=!1;this.m=new _.po;this.ba=this.pc=this.$a=this.ab=this.w=this.H=this.j=null;this.Rb=!1;this.g=this.f=this.A=this.a=this.Na=this.F=null;this.df=1E9;this.qc=new Set;this.N=!0;this.W=null;this.Xe=!1;this.We=0;this.T=null;this.K=new bA;this.af={width:Infinity,height:Infinity};this.G=null;this.V=_.Kl;this.Ya=new kz(this.configuration.preferredAudioLanguage||[],this.configuration.preferredAudioRole,
|
|
222
|
+
this.configuration.preferredAudioChannelCount);this.aa=this.configuration.preferredTextLanguage;this.M=this.Za=null;this.Db=new Map;this.Y=null;this.ma=this.configuration.preferredTextRole;a&&a(this);this.Md=null;this.m.on(window,"online",()=>{this.C===uy&&Wx(this.a)})}init(a,b){const c=a.getMedia();super.init(a,b);Fy(this,c)}namespace(){return bu}Te(){return new V}getState(){return this.V}getDrmInfo(){return this.j?this.j.getDrmInfo():null}unload(){Iw(this,!1);this.Rb=!1;if(this.o){const a=this.getTrackManager();
|
|
223
|
+
a&&a.release();return this.C===Jy?Promise.resolve():Ny(this).then(()=>{this.log.debug(_.$a,this.o);this.o=null;this.Od=0;this.M=this.Za=null})}return Promise.resolve()}release(){const a=this,b=()=>Object.getPrototypeOf(Object.getPrototypeOf(this)).release;return _.y(function*(){if(a.R)return a.R;a.R=new Promise((c,d)=>{try{const e=a.ra;a.ra=null;let f=e;e&&(f=e.catch(()=>{}));f?f=f.then(()=>b().call(a)):f=b().call(a);f=f.then(()=>a.unload());f.then(()=>{Iy(a,_.Kl);a.R=null;c()}).catch(g=>{a.R=null;
|
|
224
|
+
d(g)})}catch(e){a.R=null,d(e)}});return a.R})}getBufferInfo(a){if(this.H){var b=Wv(this.H);const c=new _.Xo(void 0,a);switch(a){case _.N:return b.video?b.video:c;case _.M:return b.audio?b.audio:c;case _.L:return b.text?b.text:c}return b.total?b.total:c}return this.Sb?(b=bv(this.Sb),Ou(b,a)):super.getBufferInfo(a)}getPosition(){return this.w?sx(this.w):super.getPosition()}getPresentationStartTime(){return this.f?this.f.presentationTimeline.getPresentationStartTime():null}getDuration(){return this.f?
|
|
225
|
+
this.f.presentationTimeline.getDuration():Infinity}destroy(){const a=this,b=()=>Object.getPrototypeOf(Object.getPrototypeOf(this)).destroy;return _.y(function*(){yield b().call(a);a.C!==Jy&&(a.log.debug("Destroying player..."),a.C=Jy,yield Ly(a),a.m&&(a.m.release(),a.m=null),a.g=null)})}load(a){const b=this;return _.y(function*(){if(b.C===Jy)return Promise.reject(new _.H(_.G,7,7E3));const c=new _.Sk;var d=()=>{b.log.info("Aborting current load");throw new _.H(_.G,7,7E3);};b.ra=c;try{b.ra!==c&&d();
|
|
226
|
+
if(b.R){try{yield b.R}catch(h){}b.ra!==c&&d()}b.G=new _.qp;b.Md=Date.now()/1E3;Iy(b,_.Ll);b.o=_.Ql(a);_.hj(a)&&(b.configuration=_.gj(b.kc,a));b.log.info(_.Ja,b.configuration);b.log.info(_.Wa,b.o);const e=b.getTrackManager();e&&e.load();const f=b.getSurface().getMedia();f.loop=!!b.configuration.loop;_.B(b.configuration.volume)||b.setVolume(b.configuration.volume);_.B(b.configuration.muted)||b.setMuted(b.configuration.muted);Wy(b);const g=b.o[b.getSourceIndex()];b.ra!==c&&d();yield Fy(b,f);b.ra!==c&&
|
|
227
|
+
d();yield My(b,f);b.ra!==c&&d();yield Xy(b,g);b.ra!==c&&d();yield az(b,g);b.ra!==c&&d();yield ez(b);b.ra!==c&&d();yield sz(b);b.ra!==c&&d();c.resolve()}catch(e){throw d=e,b.ra!==c&&(d=new _.H(_.G,7,7E3)),c.reject(d),b.onError(d),d;}})}detach(){const a=this;return _.y(function*(){yield Ky(a);return Ly(a)})}isLive(){var a;this.f?(a=this.f.presentationTimeline.isLive())||(a=this.f.presentationTimeline,a=Infinity!=a.f&&!a.m):a=!1;return a}gf(){this.log.debug("User seeking finished");this.F&&gz(this);
|
|
228
|
+
hz(this)}getSeekRange(){if(this.f){const a=this.f.presentationTimeline;return{start:_.wv(a,0),end:vv(a)}}return{start:0,end:0}}tc(){return this.f?this.f.presentationTimeline.tc():null}getPlaybackRate(){if(this.$a){var a=this.$a;a=a.h?0:a.g}else a=0;return a}setPlaybackRate(a){if(0===a)this.log.warn("A trick play rate of 0 is unsupported!");else if(this.C===uy){this.$a.set(a);this.g.playbackRateChanged(a);var b=this.a,c=1<Math.abs(a);if(a=b.f.get(_.w)){var d=a.stream;if(d)if(b.a.debug("setTrickPlay",
|
|
229
|
+
c),c)(c=d.trickModeVideo)&&!a.Nb&&(b.a.debug("Engaging trick mode stream",c),_.Tx(b,c,!1,0),a.Nb=d);else if(d=a.Nb)b.a.debug("Restoring non-trick-mode stream",d),a.Nb=null,_.Tx(b,d,!0,0)}}}ja(){if(this.f&&this.w){var a=vy(this);if(null==a)a=null;else{if(!Uw(this.K,a).text){var b=_.ww(a.textStreams,this.aa,this.ma);b.length&&Vw(this.K,a,b[0])}a=Uw(this.K,a).text}b=[];for(const c of Nz(this)){const d=tw(c);d.active=c==a;b.push(d)}return b}return[]}getPeriods(){return this.f.periods}getStats(){if(this.C!==
|
|
230
|
+
uy)return _.xl();hz(this);var a=this.h;if(a.getVideoPlaybackQuality){var b=a.getVideoPlaybackQuality();a=this.G;var c=Number(b.totalVideoFrames);a.j=Number(b.droppedVideoFrames);a.h=c}if(this.C===uy){if(b=Ay(this))this.G.m=b.bandwidth;b&&b.video&&(a=this.G,c=b.video.height||NaN,a.o=b.video.width||NaN,a.g=c);a=this.g.getBandwidthEstimate();this.G.f=a}return this.G.getStats()}getTimelineCues(){return this.Na?[...this.Na.cues()].map(a=>({schemeIdUri:a.schemeIdUri,value:a.value,startTime:a.startTime,
|
|
231
|
+
endTime:a.endTime,id:a.id,eventElement:a.eventElement,type:a.type})):[]}resetAbr(){this.g&&this.g.reset()}addTextTrack(a,b,c,d,e,f){const g=this;return _.y(function*(){if(g.C!==uy)throw g.log.error("Must call load() and wait for it to resolve before adding text tracks."),Error("State error!");const h=vy(g);var k=g.f.periods.indexOf(h)+1;const l=(k>=g.f.periods.length?g.f.presentationTimeline.getDuration():g.f.periods[k].startTime)-h.startTime;if(Infinity==l)throw new _.H(1,4,4040);const m=new _.Av(1,
|
|
232
|
+
0,l,()=>[a],0,null,0);k={id:g.df++,originalId:null,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:()=>1,getSegmentReference:q=>1==q?m:null,adjustSegmentDurations:()=>{},getDuration:()=>l,segmentLookupStrategy:_.du,initSegmentReference:null,mimeType:d,codecs:e||"",kind:c,encrypted:!1,keyId:null,language:b,originalLanguage:b,label:f||null,type:_.u,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:null,closedCaptions:null};g.qc.add(k);h.textStreams.push(k);
|
|
233
|
+
yield Mx(g.a,k);const n=_.Jx(g.a,_.u);n&&Vw(g.K,h,n);g.qc.delete(k);g.log.debug("Choosing new streams after adding a text stream");Vy(g,h);cz(g);return tw(k)})}zg(a){this.log.debug(_.fu,a);try{this.log.debug("onChooseStreams_, choosing variant from ",a.variants);this.log.debug("onChooseStreams_, choosing text from ",a.textStreams);const b=Oz(this,a);this.log.debug("onChooseStreams_, chose variant ",b.variant);this.log.debug("onChooseStreams_, chose text ",b.text);return b}catch(b){return this.onError(b),
|
|
234
|
+
{variant:null,text:null}}}yg(){this.log.debug("canSwitch_");this.N=!1;this.configuration.abr.enabled&&this.g.enable();this.W&&(Ux(this.a,this.W,this.Xe,this.We),this.W=null);this.T&&(_.Tx(this.a,this.T,!0,0),this.T=null)}Ag(){this.A&&this.A.update&&this.A.update()}lf(){this.w&&this.w.j.kd()}xg(a,b,c){if((void 0===c?"":c)===eu)return cz(this),this.la()||(this.configuration.abr.enabled=!0,this.g.enable()),Vy(this,b,!1),!0;if(c=b.variants.some(d=>{let e=!1;const f=d[a.type];f&&(e=d.allowedByApplication&&
|
|
235
|
+
f.id!==a.id,a.type===_.p&&(e=e&&f.language===a.language));return e})&&this.la()){for(const d of b.variants){const e=d[a.type];e&&e.id===a.id&&(d.allowedByApplication=!1)}cz(this);this.la()||(this.configuration.abr.enabled=!0,this.g.enable());Vy(this,b)}return c}kf(){this.log.debug("endOfStream called by streaming engine");this.Rb=!0}onError(a){if(this.C!==Jy&&7001!==a.code&&7E3!==a.code){var b=new _.F(_.ad,{detail:a});a.severity===_.G&&Iy(this,_.Jl);this.trigger(b);b.defaultPrevented&&(b.a=!0)}}Nd(a){a.type===
|
|
236
|
+
_.Vc?this.dispatchEvent(a):"largegap"!==a.type&&(a.type===_.Re?Py(this):"emsg"!==a.type&&(a instanceof _.F?this.dispatchEvent(a):this.log.debug(_.nb,a.type)))}la(){return this.configuration.abr.enabled}nf(a){const b=this;return _.y(function*(){if(b.ga){b.log.info("Attempt to switch CDN.");var c=b.getLoadedSource(),d=b.la();if(c=yield b.ga(c.url,a)){c=_.kf(b.getLoadedSource(),{url:c});d&&b.g.disable();yield Xx(b.a);var e=Ay(b);do{var f=!1;try{b.log.info(`Switching CDN to ${c.url}.`),yield Pz(b,c,e)}catch(g){if(b.log.info("Switch failed"),
|
|
237
|
+
f=yield b.ga(c.url,a))c.url=f,f=!0;else throw g;}}while(f);d&&b.g.enable();Wx(b.a,!0);b.o[b.getSourceIndex()]=c;a.f=!0;b.trigger(new _.F(_.tc,{newManifest:c.url}))}}})}};gA.prototype.detach=gA.prototype.detach;var Jy=0,Oy=1,uy=2,bz=[_.Md,_.gd];
|
|
238
|
+
_.Lf(new class{a(){return bu}canPlay(a,b){if(_.pi())return 0;const c=a.type||"",d=(window.ManagedMediaSource?!0:!1)||(window.MediaSource&&MediaSource.isTypeSupported?!0:!1);a=window.ManagedMediaSource||window.MediaSource&&MediaSource.isTypeSupported?c in _.Dn||_.En(a.url)in _.Fn?!0:!1:!1;if(d&&a){if(_.gi(2))return 1;if(_.qi()&&c===_.Zi){if(b.streaming.preferNativeHlsOnSafari)return 1;_.C("Support for MSE + FairPlay on Apple is experimental. In case of issues, consider using native HLS.")}return 2}return 0}create(){return new gA}});_.vm(function(){_.Hf("MediaSource.install");if(window.MediaSource)if(window.cast&&cast.__platform__&&cast.__platform__.canDisplayType)_.Cf("Patching Chromecast MSE bugs."),Qz();else if(_.qi()){var a=navigator.appVersion;a=0<=a.indexOf("Version")?parseInt(a.match(/Version\/(\d+)/)[1],10):13;Rz();10>=a?(_.Cf("Blacklisting MSE on Safari \x3c\x3d 10."),window.MediaSource=null):12>=a?(_.Cf("Patching Safari 11 \x26 12 MSE bugs."),Sz(),Tz()):(_.Cf("Patching Safari 13 MSE bugs."),Sz())}else _.gi(2)||_.gi(3)||
|
|
239
|
+
_.gi(4)?Uz():_.Cf("Using native MSE as-is.");else _.Cf("No MSE implementation available.")});var hA=class extends _.eq{constructor(a){super(a);a=a.getSurface().getMedia();this.a=null;for(let b=0;b<a.textTracks.length;++b){const c=a.textTracks[b];c.mode=_.Qc;c.label===Ut&&(this.a=c)}this.a||(this.a=a.addTextTrack(_.mu,Ut));this.a.mode=_.ed}append(a){const b=[],c=d=>{if(d.startTime>=d.endTime)_.C("Invalid cue times: "+d.startTime+" - "+d.endTime),d=null;else{var e=d.payload||"";e=e.replace(/<br\s*\/?>/igm,"\n");e=_.Xg(e);e=new VTTCue(d.startTime,d.endTime,e);e.line=-1;try{e.align=_.vc}catch(f){e.align=
|
|
240
|
+
"middle"}d.writingMode===_.He?e.vertical="lr":d.writingMode===_.Ie&&(e.vertical="rl");d=e}d&&b.push(d)};for(const d of a)c(d);a=b.slice().sort((d,e)=>d.startTime!==e.startTime?d.startTime-e.startTime:d.endTime!==e.endTime?d.endTime-e.startTime:b.indexOf(e)-b.indexOf(d));for(const d of a)this.a.addCue(d)}remove(a,b){if(!this.a)return!1;Vz(this.a,c=>c.startTime<b&&c.endTime>a);return!0}isTextVisible(){return this.a.mode==_.ie}setTextVisibility(a){null!==this.a&&(this.a.mode=a?_.ie:_.ed)}destroy(){this.a&&
|
|
241
|
+
Vz(this.a,()=>!0);this.a=null;return Promise.resolve()}};_.rl("single-native",new class{ea(){return!0}create(a){return new hA(a)}});};f.call(g, window);
|