@castlabs/prestoplay 6.23.1 → 6.25.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 +35 -0
- package/cjs/cl.adobe.js +3 -3
- package/cjs/cl.airplay.js +3 -3
- package/cjs/cl.broadpeak.js +7 -7
- package/cjs/cl.cast.js +116 -116
- package/cjs/cl.conviva.js +32 -32
- package/cjs/cl.core.js +607 -591
- package/cjs/cl.crypto.js +9 -9
- package/cjs/cl.dash.js +88 -86
- package/cjs/cl.externs.js +105 -54
- package/cjs/cl.freewheel.js +25 -24
- package/cjs/cl.hls.js +77 -71
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +30 -30
- package/cjs/cl.ima.js +24 -23
- package/cjs/cl.mse.js +352 -342
- package/cjs/cl.muxdata.js +15 -15
- package/cjs/cl.onboard.js +3 -3
- package/cjs/cl.persistent.js +15 -14
- package/cjs/cl.playlist.js +6 -6
- package/cjs/cl.sessions.js +16 -16
- package/cjs/cl.simid.js +15 -15
- package/cjs/cl.smooth.js +72 -72
- package/cjs/cl.thumbnails.js +26 -26
- package/cjs/cl.tizen.js +72 -72
- package/cjs/cl.ttml.js +29 -29
- package/cjs/cl.verimatrix.js +5 -5
- package/cjs/cl.vimond.js +12 -12
- package/cjs/cl.vr.js +19 -19
- package/cjs/cl.vtt.js +14 -14
- package/cjs/cl.yospace.js +4 -4
- package/cjs/cl.youbora.js +37 -37
- package/cl.adobe.js +3 -3
- package/cl.airplay.js +3 -3
- package/cl.broadpeak.js +5 -5
- package/cl.cast.js +88 -88
- package/cl.conviva.js +27 -27
- package/cl.core.js +491 -478
- package/cl.crypto.js +9 -9
- package/cl.dash.js +82 -80
- package/cl.externs.js +105 -54
- package/cl.freewheel.js +19 -19
- package/cl.hls.js +79 -74
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +26 -26
- package/cl.ima.js +18 -17
- package/cl.mse.js +310 -306
- package/cl.muxdata.js +13 -13
- package/cl.onboard.js +4 -4
- package/cl.persistent.js +10 -10
- package/cl.playlist.js +5 -5
- package/cl.sessions.js +10 -10
- package/cl.simid.js +13 -13
- package/cl.smooth.js +60 -59
- package/cl.thumbnails.js +19 -19
- 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.yospace.js +3 -3
- package/cl.youbora.js +28 -28
- package/package.json +1 -1
- package/typings.d.ts +54 -25
package/cl.mse.js
CHANGED
|
@@ -1,310 +1,314 @@
|
|
|
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
|
-
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>`:"",
|
|
11
|
-
c?`CHECKSUM="${c}" `:"",`VALUE="${e}"`,"\x3e\x3c/KID\x3e\x3c/KIDS\x3e\x3c/PROTECTINFO\x3e",d?`<LA_URL>${d}</LA_URL>`:"",
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
_.
|
|
15
|
-
|
|
16
|
-
_.
|
|
17
|
-
_.
|
|
18
|
-
_.
|
|
19
|
-
d.licenseServerUriOrigin,distinctiveIdentifierRequired:f.distinctiveIdentifierRequired||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};_.
|
|
20
|
-
|
|
21
|
-
_.
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var zB,AB,BB,CB,DB,FB,GB,HB,IB,JB,KB,LB,MB,NB,OB,PB,QB,RB,SB,TB,UB,VB,WB,XB,YB,ZB,$B,aC,bC,cC,eC,fC,gC,hC,iC,jC,kC,lC,mC,nC,oC,pC,rC,sC,tC,uC,vC,xC,yC,AC,DC,EC,GC,HC,IC,JC,KC,LC,MC,PC,QC,RC,SC,XC,YC,ZC,$C,aD,bD,cD,dD,fD,iD,jD,oD,pD,qD,rD,sD,uD,vD,xD,zD,AD,BD,CD,DD,ED,FD,GD,HD,ID,JD,KD,MD,SD,VD,$D,bE,RD,cE,dE,eE,fE,gE,hE,nE,oE,pE,qE,rE,tE,uE,vE,wE,sE,zE,CE,BE,DE,AE,EE,FE,GE,HE,LE,QE,RE,NE,OE,PE,XE,ZE,$E,aF,bF,cF,dF,eF,fF,gF,iF,jF,kF,mF,lF,nF,oF,pF,qF,rF,sF,xF,BF,CF,GF,yF,uF,tF,EF,FF,JF,
|
|
2
|
+
KF,LF,NF,OF,PF,QF,SF,TF,VF,UF,RF,aG,WF,XF,YF,ZF,$F,bG,cG,dG,gG,eG,fG,hG,iG,jG,kG,mG,nG,oG,IF,qG,tG,rG,sG,AG,BG,CG,DG,FG,GG,HG,IG,KG,LG,NG,OG,QG,PG,JG,MG,RG,SG,VG,TG,UG,XG,WG,ZG,$G,aH,bH,cH,dH,jH,kH,lH,nH,oH,gH,eH,hH,iH,pH,qH,rH,AH,tH,BH,CH,fH,DH,EH,FH,GH,HH,yH,IH,JH,uH,vH,wH,xH,KH,NH,OH,RH,SH,TH,PH,QH,sH,LH,MH,UH,VH,WH,XH,YH,ZH,$H,aI,bI,cI,dI,fI,eI,gI,hI,vF,wF,tI,zF,AF,DF,wI,yI,zI,EI,FI,CI,AI,HI,II,MI,PI,TI,fJ,gJ,iJ,jJ,kJ,lJ,mJ,BI,DI,tJ,vJ,hJ,JI,LI,NI,OI,oJ,bJ,SI,UI,VI,lI,HF,rI,XI,YI,aJ,cJ,dJ,eJ,
|
|
3
|
+
RI,qI,CJ,zJ,QJ,iI,jI,kI,SJ,vI,mI,nI,oI,sI,UJ,wJ,WJ,TJ,AJ,RJ,yJ,NJ,OJ,VJ,XJ,EJ,FJ,DJ,YJ,xJ,ZJ,$J,aK,bK,cK,dK,TC,hK,KI,KJ,mE,xE,yE,kK,lK,mK,GJ,HJ,JJ,SE,uJ,nK;zB=" buffer";AB=" buffer. Range:";BB=" range:";CB=" with element state: ";DB="\x3c/DATA\x3e\x3c/WRMHEADER\x3e";_.EB="AUDIO";FB="Aborting operations for ";GB="Appended audio segment ";HB="Appended video segment ";IB="Appending data to ";JB="Buffer:";KB="Cannot get segment, period ID unknown";LB="Choosing new streams after key status change";
|
|
4
|
+
MB="Done Aborting operations for ";NB="Done Appending data to ";OB="Done Flushing buffer for ";PB="Done Removing data from ";QB="Done Setting append window for ";RB="Done Setting timestamp offset for ";SB="Failed to abort operations for ";TB="Failed to append data for ";UB="Failed to flush buffer for ";VB="Failed to remove data from ";WB="Failed to set append window for ";XB="Failed to set timestamp offset for ";YB="Flushing buffer for ";ZB="IterateSegmentReference";$B="Jumping forward";aC="MediaSource threw QuotaExceededError:";
|
|
5
|
+
bC="No more scheduled operations for ";cC="Period not found.";_.dC="Player is in ERROR state and can not switch to ";eC="PrestoPlay TextTrack";fC="QuotaExceededError";gC="Removing audio from variant - audio not compatible with platform";hC="Removing data from ";iC="Reset transmuxers.";jC="Setting append window for ";kC="Setting playback rate to\x3d";lC="Setting timestamp offset for ";mC="Skip buffer flush for ";nC="Starting next operation for ";oC="URI-REPLACEMENT";pC="Update-End received for ";
|
|
6
|
+
_.qC="Updating manifest...";rC="X-Playback-Session-Id";sC="bufferBehind\x3d";tC="bufferedBehind\x3d";uC="calling onCanSwitch()...";vC="cannot find segment";_.wC="caption";xC="clpp.mse.Player";yC="currentPeriod.startTime\x3d";_.zC="dashif:Laurl";AC="failed to get buffered range for ";_.BC="getSegmentNextReference";_.CC="iterateSegmentReference";DC="key-restriction";EC="manifest.start";_.FC="onChooseStreams_";GC="presentationTime:";HC="presentationTime\x3d";IC="reference.endTime\x3d";JC="reference.position\x3d";
|
|
7
|
+
KC="reference.startTime\x3d";LC="sourceopen";MC="startstreaming";_.NC="subtitle";_.OC="subtitles";PC="switch: Stream ";QC="updateend";RC=function(a,b){for(const c in a.a)b(c,a.a[c])};SC=function(a){const b=a.a+a.f.byteOffset;let c=void 0;for(;_.mm(a);)if(0===_.om(a)){c=a.a+a.f.byteOffset-1;break}a=a.f.buffer.slice(b,c);return _.ij(a)};
|
|
8
|
+
_.UC=function(a){const b=new Uint8Array(TC),c=4+b.byteLength+a.j.byteLength+4+a.f.byteLength,d=new _.Fm(c,!1);_.O(d,c);_.lm(d,b);_.lm(d,a.j);_.O(d,a.f.byteLength);_.lm(d,a.f);return _.K(d.buffer)};
|
|
9
|
+
_.VC=function(a,b,c,d){var e=_.Zl(b);if(8!==e.byteLength)e="";else{var f=_.Cn(e);e=_.Wl(f);b:switch(f=f.byteLength,_.Gh("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>`:"",DB].join("");break b;
|
|
10
|
+
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>`:"",DB].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" ',
|
|
11
|
+
c?`CHECKSUM="${c}" `:"",`VALUE="${e}"`,"\x3e\x3c/KID\x3e\x3c/KIDS\x3e\x3c/PROTECTINFO\x3e",d?`<LA_URL>${d}</LA_URL>`:"",DB].join("");break b;default:_.C("Cannot create PlayReady header in version",a),e=""}}if(!e)return null;_.Gh("New payload",e);e=_.K(_.nj(e,!0));return new _.Gn(_.Hn,b,d||null,e,a,c)};_.WC=function(a,b){return b===a.version?a:_.VC(b,a.a,a.l||void 0,a.h||void 0)};
|
|
12
|
+
XC=function(a,b){a:{if(b)for(const c of a.h.keys()){const d=a.h.get(c);for(let e=0;e<d.qb.length;e++)if(d.qb[e]===b){a=d;break a}}a=null}return a?a.kb:null};YC=function(a,b){if(_.Jk("Edge/"))return!0;b=b.toLowerCase();if(_.Kk()&&b.includes('codecs\x3d"ac-3"')){const c=b.replace("ac-3",_.ge);return a.J.has(b)||a.J.has(c)}return a.J.has(b)};ZC=function(a,b){a=a.o.get(b);return!(!a||a!==_.bf&&a!==_.se)};
|
|
13
|
+
$C=function(a,b){var c=b.audio,d=b.video;if(c&&c.encrypted&&(c=_.Sn(c),!YC(a,c))||d&&d.encrypted&&(d=_.Sn(d),!YC(a,d)))return!1;const e=a.keySystem();return 0===b.drmInfos.length||b.drmInfos.some(f=>f.keySystem===e)};aD=function(a,b,c){a.f!==b&&(a.f=b,a.a.push({timestamp:Date.now()/1E3,id:b.id,trackId:b.track.id,type:b.track.type,fromAdaptation:c,width:null,height:null,bandwidth:b.bandwidth}))};bD=function(a,b){return null==a.a?null:(a=a.a[a.a.length-1])?a[b]:null};
|
|
14
|
+
cD=function(a){a=bD(a,_.Dv);return null==a?null:a};dD=function(a,b){if(a.a.length)if(0>b)a.f=0;else{for(var c=0,d=a.a[c]||null;d&&b>d.Tb()+d.getDuration();)c+=1,d=a.a[c]||null;a.f=d?c:a.a.length-1}else a.f=-1};_.eD=function(a,b){return a.concat(b)};fD=function(){};_.gD=function(a,b){if(0===b.length)return a;const c=b.map(d=>new _.Ci(d));return a.map(d=>new _.Ci(d)).map(d=>c.map(d.resolve.bind(d))).reduce(_.eD,[]).map(d=>d.toString())};
|
|
15
|
+
_.hD=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:b||[],keyIds:[],periodId:c?c:null}};iD=function(a,b){a=_.Qi(a);b=_.Qi(b);a=a.split("-");b=b.split("-");return a[0]===b[0]&&1===a.length&&2===b.length};jD=function(a){return a.language?_.Qi(a.language):a.audio&&a.audio.language?_.Qi(a.audio.language):a.video&&a.video.language?_.Qi(a.video.language):_.tg};
|
|
16
|
+
_.kD=function(a,b){a=_.Qi(a);const c=new Set;for(var d of b)c.add(_.Qi(d));for(const e of c)if(e===a)return e;for(const e of c)if(iD(e,a))return e;for(const e of c)if(d=e,b=a,d=_.Qi(d),b=_.Qi(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(iD(a,e))return e;return null};
|
|
17
|
+
_.lD=function(a){if(typeof a!==_.cg)return null;var b=a.trim().match(/^(\d+)x(\d+)$/);if(!b)return null;a=parseInt(b[1],10);b=parseInt(b[2],10);return 0>=a||0>=b?null:{hd:a,Dd:b,wi:a*b}};
|
|
18
|
+
_.mD=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,licenseServerUriOrigin:f.licenseServerUriOrigin||
|
|
19
|
+
d.licenseServerUriOrigin,distinctiveIdentifierRequired:f.distinctiveIdentifierRequired||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};_.nD=function(a,b){return a.length&&b.length?0<_.mD(a,b).length:!0};
|
|
20
|
+
oD=function(a,b){for(const c in b)if(b[c]===a)return c;return""};pD=function(a,b){let c=0;for(const d of a)c+=b(d)?1:0;return c};qD=function(a,b){var c=_.Ak(b,a);if(!c)return!1;c=c();a=c.isMuxed(a,b);c.destroy();return a};rD=function(a){const b=[a.mimeType];for(const c of _.zu){const [d,e]=c;{const f=a[d];null!=f&&b.push(e.trim()+'\x3d"'+String(f).trim()+'"')}}return b.join(";").replace(/\s/g,"")};sD=function(a){return a.split(",").map(b=>b.trim()).filter(b=>0<b.length)};
|
|
21
|
+
_.tD=function(a){const b=[];for(const c of a.split(/\s*,\s*/)){{a=c.split(".");const d=a[0];a.shift();a=[d,a.join(".")]}b.push(a[0])}return b.sort().join(",")};uD=function(a,b="total"){b=new _.Bu(void 0,b);for(const c of a)b.a.push(c);b.length=a.length;return b};
|
|
22
|
+
vD=function(a){return-1===a.indexOf("\x26")?a:a.replace(/&(?:amp|lt|gt|quot|apos|nbsp|lrm|rlm|#[xX]?[0-9a-fA-F]+);/g,b=>{switch(b){case "\x26amp;":return"\x26";case "\x26lt;":return"\x3c";case "\x26gt;":return"\x3e";case "\x26quot;":return'"';case "\x26apos;":return"'";case "\x26nbsp;":return"\u00a0";case "\x26lrm;":return"\u200e";case "\x26rlm;":return"\u200f";default:return"#"===b[1]?(b="x"===b[2]||"X"===b[2]?parseInt(b.slice(3),16):parseInt(b.slice(2),10),String.fromCodePoint(b)):b}})};
|
|
23
|
+
xD=function(a){function b(h,k){return new _.wD(void 0===k?_.da:k,h,{},[],null,null,g)}function c(h){h=void 0===h?"":h;const k=[];for(;a[e];)if(60==a.charCodeAt(e)){if(47===a.charCodeAt(e+1)){var l=e+2;e=a.indexOf("\x3e",e);if(!a.startsWith(h,l))throw h=a.substring(0,e).split("\n"),Error("Unexpected close tag\nLine: "+(h.length-1)+"\nColumn: "+(h[h.length-1].length+1)+"\nChar: "+a[e]);e+1&&(e+=1);break}else if(63===a.charCodeAt(e+1)){e=a.indexOf("\x3e",e);e++;continue}else if(33===a.charCodeAt(e+1)){if(45==
|
|
24
24
|
a.charCodeAt(e+2)){for(;-1!==e&&(62!==a.charCodeAt(e)||45!=a.charCodeAt(e-1)||45!=a.charCodeAt(e-2)||-1==e);)e=a.indexOf("\x3e",e+1);-1===e&&(e=f)}else if(91===a.charCodeAt(e+2)&&91===a.charCodeAt(e+8)&&a.startsWith("CDATA",e+3)){l=a.indexOf("]]\x3e",e);-1==l?(k.push(b(a.substr(e+9),"#cdata")),e=f):(k.push(b(a.substring(e+9,l),"#cdata")),e=l+3);continue}else{l=e+1;e+=2;for(var m=!1;(62!==a.charCodeAt(e)||!0===m)&&a[e];)91===a.charCodeAt(e)?m=!0:!0===m&&93===a.charCodeAt(e)&&(m=!1),e++;k.push(b(a.substring(l,
|
|
25
|
-
e),"#doctype"))}e++;continue}{e++;m=l=d();let v=null;var n=l.indexOf(":");-1!==n&&(v=l.slice(0,n),m=l.slice(n+1));for(n={};62!==a.charCodeAt(e)&&a[e];){var
|
|
26
|
-
c(l));l=new _.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
_.
|
|
32
|
-
|
|
33
|
-
_.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
_.
|
|
39
|
-
_.
|
|
40
|
-
if(c.length)for(e=c[c.length-1].position+1;f<b.length;)g=b[f++],g=new _.
|
|
41
|
-
b};_.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
f<g.end(h)){f=g.start(h+1)-f;break a}f=null}f&&(e=Math.min(f+.1,e))}a.g.warn(`Seeking forward ${e} seconds to break stall.`);b.currentTime+=e}else a.g.warn("Pausing and unpausing to break stall."),b.pause(),b.play()});return c};
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return d}if(b>=k||c(b))return a.g.debug("Playhead in safe region or in buffered region."),b;a.g.debug("Playhead outside safe region \x26 in unbuffered region.");return d};
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
c.
|
|
57
|
-
|
|
58
|
-
a
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
HE=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.l))continue;const k=new _.Ft(h.startTime,h.endTime,h.text);g.get(b).get(f).push(k);b===a.B&&a.j.append([k],[])}for(const h of g.keys()){a.o.has(h)||a.o.set(h,new Map);for(const k of g.get(h).keys())e=g.get(h).get(k),a.o.get(h).set(k,e)}a.a=null==a.a?Math.max(c,a.h):Math.min(a.a,Math.max(c,a.h));
|
|
25
|
+
e),"#doctype"))}e++;continue}{e++;m=l=d();let v=null;var n=l.indexOf(":");-1!==n&&(v=l.slice(0,n),m=l.slice(n+1));for(n={};62!==a.charCodeAt(e)&&a[e];){var r=a.charCodeAt(e);if(64<r&&91>r||96<r&&123>r){r=d();var u="";let y=a.charCodeAt(e);for(;39!==y&&34!==y;)e++,y=a.charCodeAt(e);if(39===y||34===y){if(u=e+1,e=a.indexOf(a[e],u),u=a.slice(u,e),-1===e)throw Error("Missing closing quote");}else e--;n[r]=u;r=r.split(":");"xmlns"===r[0]&&r[1]&&g.set(u,r[1])}e++}r=[];u=a.charCodeAt(e-1);e++;47!==u&&(r=
|
|
26
|
+
c(l));l=new _.wD(l,null,n,r,v,m,g)}k.push(l)}else l=e,e=a.indexOf("\x3c",e)-1,-2===e&&(e=f),l=vD(a.slice(l,e+1)),l=l.trim(),0<l.length&&k.push(b(l)),e++;return k}function d(){const h=e;for(;-1==="\r\n\t\x3e/\x3d ".indexOf(a[e])&&a[e];)e++;return a.slice(h,e)}let e=0;const f=a.length,g=new Map;return new _.wD("#document",null,{},c(""),null,null,g)};
|
|
27
|
+
zD=function(a){switch(a){case _.Fl:_.lv.info("Select DOM parser for XML");_.Dn=new _.kv;break;case "txml":_.lv.info("Select TXML parser for XML");_.Dn=new _.yD;break;default:_.lv.warn("XML parser option unknown, using default "+`DOM parser. Option: ${a}`),_.Dn=new _.kv}};AD=function(){return!!window.SourceBuffer&&!!SourceBuffer.prototype&&!!SourceBuffer.prototype.changeType};BD=function(a,b){return a.start-b.start};
|
|
28
|
+
CD=function(a){return a.T.map(b=>({start:b.start,end:b.end,width:b.width,height:b.height,bandwidth:b.bandwidth,rendition:b.rendition}))};DD=function(a){a.player&&(a.player.off(_.Lf,a.a),a.f&&a.player.off(_.og,a.a));a.player=null};ED=function(a){a.player&&a.player.trigger(new _.D(_.Wc))};FD=function(a){a.player&&a.player.trigger(new _.D(_.Wc))};
|
|
29
|
+
GD=function(a){if(a.player){var b=!1,c={};for(let d=0;d<a.T.length;d++){const e=a.T[d],f=e.width+"x"+e.height,g=c[f];if(g&&g!==e.bandwidth){b=!0;break}c[f]=e.bandwidth}b&&!a.f?(a.log.debug("Tracking timeupdates"),a.player.on(_.og,a.a,a),a.f=!0):!b&&a.f&&(a.log.debug("Stop tracking timeupdates"),a.player.off(_.og,a.a),a.f=!1)}};HD=function(a,b,c){a.T=a.T.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.player&&a.player.trigger(new _.D(_.Jg))};
|
|
30
|
+
ID=function(a,b){let c=null;for(const d of a)b>=d.startTime&&(c=d);return c};JD=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};KD=function(a,b){for(let c=0;c<a.length;c++)if(JD(a[c]).has(b))return c;return-1};MD=function(a,b){Array.from(JD(a)).forEach(c=>{c.segmentIndex&&_.LD(c.segmentIndex,b)})};
|
|
31
|
+
_.ND=function(a,b,c){const d=Math.pow(a.h,b);c=c*(1-d)+d*a.a;isNaN(c)||(a.a=c,a.f+=b)};_.OD=function(a){return a.a/(1-Math.pow(a.h,a.f))};_.PD=function(a,b,c,d,e,f,g,h){a=_.Bj(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};_.QD=function(a,b,c){a.h=b;a.a=c};
|
|
32
|
+
SD=function(a){return 2===a.j.version?a.a.Tb():RD(a,0)};_.TD=function(a,b){a.K={offsetDateTime:b-SD(a),seekRangeStartDateTime:b}};_.UD=function(a,b){a.l=b;a.C=b;a.a.f=b};VD=function(a){return 2===a.j.version?a.a.f?a.a.a:null:a.l?a.f:a.C?a.o:null};_.WD=function(a,b){a.w=null==a.w?b:Math.min(a.w,b)};_.XD=function(a,b){a.o=Math.max(a.o||0,b)};
|
|
33
|
+
_.YD=function(a,b,c){if(0!==b.length){var d=b[b.length-1].endTime+c;_.WD(a,b[0].startTime+c);a.h=b.reduce((e,f)=>Math.max(e,f.endTime-f.startTime),a.h);_.XD(a,d);null!=a.F&&a.L&&(a.F=(Date.now()+a.H)/1E3-(a.o||0)-a.h);a.g.debug("notifySegments: maxSegmentDuration\x3d"+a.h)}};_.ZD=function(a,b){a.h=Math.max(a.h,b);a.g.debug("notifyNewSegmentDuration: maxSegmentDuration\x3d"+a.h)};
|
|
34
|
+
$D=function(a){if(2===a.j.version)a=a.a.a;else if(a.l)a=a.f;else if(a.C)a=a.o||0;else{if("startover"===a.B)var b=a.I||0;else b=(Date.now()+a.H)/1E3,b=a.M?Math.max(0,b-(a.h-a.G)-a.F):Math.max(0,b-a.h-a.F);a=Math.min(b,a.f)}return a};_.aE=function(a){return 2===a.j.version?a.a.Tb():Infinity===a.A?0:Math.max(0,$D(a)-a.A)};bE=function(a){const b=a.nd()&&!a.C?a.J:0;return 2===a.j.version?a.a.a-b:Math.max(0,$D(a)-b)};
|
|
35
|
+
RD=function(a,b){if(2===a.j.version)return a.a.Tb();const c=Math.max(a.w,0);return Infinity===a.A?Math.ceil(1E3*c)/1E3:Math.max(c,Math.min($D(a)-a.A+b,bE(a)))};cE=function(a,b=!1){b=b?a.offset:0;return{schemeIdUri:a.schemeIdUri,configurationId:a.configurationId,value:a.value,startTime:a.startTime+b,endTime:a.endTime+b,id:a.id,eventElement:a.eventElement,type:a.type,customAttributes:a.customAttributes}};dE=function(a,b,c){a.f=b;a.h=c};
|
|
36
|
+
eE=function(a,b){const c=[];let d=!1;for(const f of b)if(!a.a.has(f)){c.push(f);var e=Array.from(a.a.values()).some(g=>g.id===f.id);f.id&&e&&(d=!0)}e=a.a.size;a.a.clear();b.forEach(f=>a.a.add(f));b=a.a.size;c.forEach(f=>a.f(f));(d||0<c.length||e!==b)&&a.h()};fE=function(a,b=!1){return Array.from(a.a.values()).map(c=>cE(c,b)).sort((c,d)=>c.startTime-d.startTime)};
|
|
37
|
+
gE=function(a){const b=a.a.Qf(),c=a.h,d=b?b.id:null;(c?c.id:null)!==d&&b&&a.f(new _.D(_.Of,{id:d}));a.h=b;"basic"===a.o.timeline&&(a.j.a=b)};hE=function(a){let b=a.h.get(a.a);if(!b)return null;0<b.a.length&&b.ab().length&&a.f>=b.a.length&&(a.a+=1,a.f=0,b=a.h.get(a.a));return b&&0<b.a.length?b.a[a.f]||null:b};_.LD=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)};
|
|
38
|
+
_.iE=function(a){return a.a.length?a.a[a.a.length-1].endTime:0};
|
|
39
|
+
_.kE=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.g.info("Refusing to rewrite original references on update!"):(.1<Math.abs(g.endTime-h.endTime)?c.push(new _.jE(g.position,h.startTime,h.endTime,h.ab,h.za,h.qa,h.Fa,h.keyInfo,h.Kc,h.timescale,h.horizontalTiles,h.verticalTiles,h.durationPerTile,null,null,h.ud,h.Pa)):c.push(g),e++),f++)}for(;e<a.a.length;)c.push(a.a[e++]);
|
|
40
|
+
if(c.length)for(e=c[c.length-1].position+1;f<b.length;)g=b[f++],g=new _.jE(e++,g.startTime,g.endTime,g.ab,g.za,g.qa,g.Fa,g.keyInfo,g.Kc,g.timescale,g.horizontalTiles,g.verticalTiles,g.durationPerTile,null,null,g.ud,g.Pa),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 _.jE(f-e--,h.startTime,h.endTime,h.ab,h.za,h.qa,h.Fa,h.keyInfo,h.Kc,h.timescale,h.horizontalTiles,h.verticalTiles,h.durationPerTile,null,null,h.ud,h.Pa));for(const h of c)b.push(h)}a.a=
|
|
41
|
+
b};_.lE=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};nE=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.h;)--f,g=d.a[f];if(!g.h)break;c+=1;e=f-1;break}}return new mE(a,c,e)};oE=function(a,b){a.f=b};
|
|
42
|
+
pE=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};
|
|
43
|
+
qE=function(a){if(0!==a.a.readyState){if(a.a.seeking){if(!a.C)return}else a.C=!1;if(!a.a.paused&&!a.o){a.a.readyState!==a.I&&(a.l=!1,a.I=a.a.readyState);var b=a.h.smallGapLimit,c=a.a.currentTime,d=a.a.buffered,e=a.h.gapTolerance;a:{var f=new _.Bu(d);var g=a.h.gapDetectionThreshold;if(f.length&&!(1===f.length&&1E-6>f.end(0)-f.start(0)))for(var h=0;h<f.length;h++)if(f.start(h)>c&&(0===h||f.end(h-1)-c<=g)){f=h;break a}f=null}if(null==f){if(a.f){a=a.f;d=a.h;c=pE(d);d=d.a.currentTime;e=Date.now()/1E3;
|
|
44
|
+
if(a.a!==d||a.l!==c)a.j=e,a.a=d,a.l=c;d=e-a.j;d>=a.o&&c&&a.f(a.a,d)}}else if((0!==f||a.A)&&a.H&&(g=d.start(f),!(g>=bE(a.G)))){h=g-c;b=h<=b;var k=!1;h<e||(b||a.l||(a.l=!0,e=new _.D("largegap",{detail:{currentTime:c,gapSize:h}}),e.cancelable=!0,a.F(e),a.h.jumpLargeGaps&&!e.defaultPrevented?k=!0:_.Fh("Ignoring large gap at",c,"size",h)),!b&&!k)||(0===f?_.Fh($B,h,"seconds because of gap before start time of",g):_.Fh($B,h,"seconds because of gap starting at",d.end(f-1),"and ending at",g),a.B=!0,a.a.currentTime=
|
|
45
|
+
g)}}}};rE=function(a,b){a.h=a.f.currentTime;a.l=b;a.j=a.o;a.f.currentTime=b;a.a.Eb(.1)};tE=function(a,b){a.w||(a.w=!0,a.o&&a.o());.001>Math.abs(a.a.currentTime-b)?sE(a):(a.f.one(a.a,_.Sf,()=>{sE(a)}),rE(a.h,0===a.a.currentTime?b:a.a.currentTime))};uE=function(a,b){a.A=b;a.f.off(a.a,_.Fe);a.f.one(a.a,_.Fe,()=>{tE(a,b)})};vE=function(a){return a.l?a.a.currentTime:a.A};wE=function(a,b){0<a.a.readyState?rE(a.h,b):uE(a,b)};sE=function(a){_.Pk()&&!a.l&&a.j();a.l=!0;a.f.on(a.a,_.Sf,()=>a.j())};
|
|
46
|
+
zE=function(a,b,c){if(!c.stallEnabled)return null;const d=c.gapDetectionThreshold;let e=c.stallSkip;c=new xE(new yE(b),c.stallThreshold);oE(c,(f,g)=>{a.g.warn(`Stall detected at ${f} for ${g} seconds.`);if(e){g=new _.Bu(b.buffered);var h;if(h=_.Jk("Edge/")||_.Jk("Trident/")||_.Kk()||_.Pk())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)&&
|
|
47
|
+
f<g.end(h)){f=g.start(h+1)-f;break a}f=null}f&&(e=Math.min(f+.1,e))}a.g.warn(`Seeking forward ${e} seconds to break stall.`);b.currentTime+=e}else a.g.warn("Pausing and unpausing to break stall."),b.pause(),b.play()});return c};CE=function(a,b,c){null==b?b=Infinity>a.a.getDuration()||c?SD(a.a):bE(a.a):0>b&&(b=bE(a.a)+b);return AE(a,BE(a,b))};BE=function(a,b){const c=SD(a.a);if(b<c)return c;a=bE(a.a);return b>a?a:b};DE=function(a){const b=vE(a.f);return 0<a.h.readyState&&!a.h.paused?BE(a,b):b};
|
|
48
|
+
AE=function(a,b){const c=a.a.getDuration();return b>=c?c-a.l.durationBackoff:b};
|
|
49
|
+
EE=function(a,b){if("startover"===a.a.B)return b;var c=new _.Bu(a.h.buffered);c=c.Mb.bind(c);var d=Math.max(a.B,a.l.rebufferingGoal);const e=a.l.safeSeekOffset;let f=SD(a.a);const g=bE(a.a),h=a.a.getDuration();3>g-f&&(f=g-3);const k=RD(a.a,d),l=RD(a.a,e);d=RD(a.a,d+e);if(b>=h)return a.g.debug("Playhead past duration."),AE(a,b);if(b>g)return a.g.debug("Playhead past end."),g;if(b<f){if(c(l))return a.g.debug("Playhead before start \x26 start is buffered"),l;a.g.debug("Playhead before start \x26 start is unbuffered");
|
|
50
|
+
return d}if(b>=k||c(b))return a.g.debug("Playhead in safe region or in buffered region."),b;a.g.debug("Playhead outside safe region \x26 in unbuffered region.");return d};FE=function(a,b,c=0){for(const d of a.a)d.l(a.f.currentTime,b,c)};GE=function(a,b){const c=a.offset||0;return b<a.startTime+c?1:b>a.endTime+c?3:2};HE=function(a,b,c,d){a.a=b;a.f=c;a.h=d};_.IE=function(a){_.et[a]&&delete _.et[a]};_.JE=function(a){_.ct[a]&&delete _.ct[a]};
|
|
51
|
+
_.KE=function(a,b,c){if(!(16E3>c)){var d=8E3*c/b;b/=1E3;a.a+=c;_.ND(a.f,b,d);_.ND(a.h,b,d)}};LE=function(a,b){if(typeof a!==typeof b||a.length!==b.length)return!1;for(let c=0;c<a.length;c++)if(a[c].serviceLocationId!==b[c].serviceLocationId||a[c].uri!==b[c].uri||a[c].params!==b[c].params)return!1;return!0};_.ME=function(a,b){return a.la.map(c=>{const d=new URL(c.uri+b);if(c.params)for(const [e,f]of Object.entries(c.params))d.searchParams.set(e,f);return d.toString()})};
|
|
52
|
+
QE=function(a,b){return _.x(function*(){b=b||a.h.contentSteeringServerUri;var c=NE(a,b);a.g.info("Sending request to content steering server, "+`URI: ${c}`);c=_.Bj(c,a.A.attemptParameters);c.type=7;c=a.B.fetch(c);_.Mj(a.C,c);c=yield c.V;if(410===c.status)a.g.info(" Content steering server not available(HTTP response 410), stopping updates."),null!=a.a&&(a.a.stop(),a.a=null);else if(429===c.status){a.g.info("Content steering server overloaded (HTTP response 429).");var d=parseInt(c.headers["retry-after"],
|
|
53
|
+
10);d&&(a.g.info(`Will retry after ${d} s `+"based on Retry-After header."),a.f=d);OE(a,a.f)}else try{d=_.ij(c.data);const e=JSON.parse(d);1===e.VERSION?PE(a,e,c.uri):a.g.warn(`Received unsupported steering manifest version: ${e.VERSION}, ignoring it and stop requesting.`)}catch(e){a.g.error("requestInfo_: error parsing received steering manifest:",e),e&&7001===e.code||(null!=a.a&&(a.a.stop(),a.a=null),a.a=new _.Gk(()=>{QE(a)}),OE(a,a.f))}})};
|
|
54
|
+
RE=function(a,b){return _.x(function*(){null!=a.a&&(a.a.stop(),a.a=null);a.o.clear();a.l.clear();a.j.clear();a.w.clear();a.g.debug(`contentSteeringServerUri: ${b.contentSteeringServerUri}`);a.g.info(`queryBeforeStart: ${b.queryBeforeStart}`);a.h={manifestType:b.manifestType,contentSteeringServerUri:b.contentSteeringServerUri,queryBeforeStart:b.queryBeforeStart,If:b.defaultServiceLocation?b.defaultServiceLocation.split(","):[]};b.baseUriCollections.forEach(c=>{const d=[];if(a.h.If.length)for(const e of a.h.If){const f=
|
|
55
|
+
c.la.find(g=>g.serviceLocationId===e);f?d.push(f):a.g.warn("setManifestConfig: could not get default location:",`pathwayId: ${e} processedLocations:`,d)}d.length?a.l.set(c.id,d):a.l.set(c.id,c.la);a.o.set(c.id,c.la)});if(b.contentSteeringServerUri){if(a.h.queryBeforeStart)return QE(a);a.g.info(`defaultServiceLocations: ${b.defaultServiceLocation}`);QE(a)}})};_.TE=function(a,b){let c=a.j.get(b);c||(c={Xc:0,oe:new SE,wd:!1},a.j.set(b,c));return c};
|
|
56
|
+
_.VE=function(a,b){var c=a.l.get(b);if(!c)return a.g.warn(`getBaseUriCollectionById: invalid baseUriSetId:${b}.`),null;const d=Date.now();a.j.forEach((f,g)=>{f.Xc&&d>f.Xc&&(f.Xc=0,a.trigger(new _.D(_.Md,{detail:{serviceLocationId:g,banned:!1,bannedSeconds:0}})))});let e=c.filter(f=>0===_.TE(a,f.serviceLocationId).Xc);e.length||(e=c);e.length&&(c=a.w.get(b),LE(e,c)||(c={baseUriCollectionId:b,from:c||[],to:e},a.g.info(`Steering server update baseUriCollectionId: ${c.baseUriCollectionId} from: ${JSON.stringify(c.from)} to: ${JSON.stringify(c.to)}`),
|
|
57
|
+
a.trigger(new _.D(_.Ld,{detail:c})),a.w.set(b,e)));return new _.UE(b,e)};_.WE=function(a,b){const c=_.TE(a,b);c.Xc=Date.now()+1E3*a.f;c.wd=!1;a.g.info(`service location ${b} banned during ${a.f} seconds`);a.trigger(new _.D(_.Md,{detail:{serviceLocationId:b,banned:!0,bannedSeconds:a.f}}))};
|
|
58
|
+
NE=function(a,b){b=new URL(b);const c=[],d=[];a.j.forEach((e,f)=>{e.wd&&(c.push(f),d.push(parseInt(e.oe.getBandwidthEstimate(1E4),10)));e.wd=!1});c.length?a.h.manifestType===_.Kc?(b.searchParams.set("_DASH_pathway",`"${c.toString()}"`),b.searchParams.set("_DASH_throughput",d.toString())):a.h.manifestType===_.zl&&(b.searchParams.set("_HLS_pathway",`"${c.toString()}"`),b.searchParams.set("_HLS_throughput",d.toString())):a.g.debug("addQueryParams_: serviceLocations EMPTY");return b.toString()};
|
|
59
|
+
OE=function(a,b){a.g.info(`Scheduling next steering manifest update in ${b} s.`);a.a.ia(b)};PE=function(a,b,c){null!=a.a&&(a.a.stop(),a.a=null);const d=b["RELOAD-URI"]||c;a.a=new _.Gk(()=>{QE(a,d)});if(c=b.TTL)a.f=c;OE(a,a.f);const e=b["PATHWAY-PRIORITY"]||[],f=b["PATHWAY-CLONES"]||[];a.j.forEach((g,h)=>{e.includes(h)||a.j.delete(h)});a.o.forEach((g,h)=>{g=XE(a,h,e,f);a.l.set(h,g)})};
|
|
60
|
+
XE=function(a,b,c,d){const e=[],f=a.o.get(b)||[];if(!c.length)return a.l.get(b);for(const g of c)if(a=f.find(h=>h.serviceLocationId===g))e.push(a);else{const h=d.find(k=>k.ID===g);if(h&&(a=f.find(k=>k.serviceLocationId===h["BASE-ID"]))){const k={serviceLocationId:g,uri:a.uri,params:{}};h[oC]&&(h[oC].HOST&&(a=new URL(a.uri),a.hostname=h[oC].HOST,k.uri=a.toString()),h[oC].PARAMS&&Object.entries(h[oC].PARAMS).forEach(l=>{var [m,n]=l;k.params[m]=n}));e.push(k)}}return e};
|
|
61
|
+
_.YE=function(a){a=a.toLowerCase();return _.Ct[a]||window.muxjs&&a===_.Jc?!0:!1};ZE=function(a,b){if(b!==_.Jc){var c=_.Ct[b];if(!c)throw new _.I(_.F,2,2012,"Text parser is unavailable for "+b);a.w=new c(a.C)}};
|
|
62
|
+
$E=function(a,b,c,d){return Promise.resolve().then(()=>{if(a.w&&a.j)if(null==c||null==d)a.w.parseInit(_.K(b));else{var e={periodStart:a.A,segmentStart:c,segmentEnd:d};e=a.w.parseMedia(_.K(b),e);var f=e.cues.filter(g=>g.startTime>=a.h&&g.startTime<a.l);a.j.append(f,e.styles);null==a.a&&(a.a=Math.max(c,a.h));a.f=Math.min(d,a.l)}})};aF=function(a,b,c){a.B=b;if(b=a.o.get(b))for(const d of b.keys()){let e=b.get(d);e&&(e=e.filter(f=>f.endTime<=c),a.j.append(e,[]))}};
|
|
63
|
+
bF=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.l))continue;const k=new _.$t(h.startTime,h.endTime,h.text);g.get(b).get(f).push(k);b===a.B&&a.j.append([k],[])}for(const h of g.keys()){a.o.has(h)||a.o.set(h,new Map);for(const k of g.get(h).keys())e=g.get(h).get(k),a.o.get(h).set(k,e)}a.a=null==a.a?Math.max(c,a.h):Math.min(a.a,Math.max(c,a.h));
|
|
65
64
|
a.f=Math.max(a.f,Math.min(d,a.l))};
|
|
66
|
-
|
|
65
|
+
cF=function(a,b){var c=String(_.Wj++);c=new _.Xj(c,a);c.mimeType=_.Tj(b.mimeType);if(a===_.L||a===_.M)c.label=_.Tj(b.label),c.language=_.Tj(b.language),c.originalLanguage=_.Tj(b.originalLanguage);a===_.N?(c.frameRate=b.frameRate,c.roles=b.roles,c.trickPlay=b.trickPlay):a===_.M?(c.channelsCount=b.channelsCount,c.roles=b.audioRoles||[],c.mimeType=_.Tj(b.audioMimeType)):(c.kind=_.Tj(b.kind),c.roles=b.roles);c.accessibility=a===_.N||a===_.M?(b.accessibility||[]).filter(d=>d.type===a):b.accessibility||
|
|
67
66
|
[];return c};
|
|
68
|
-
|
|
69
|
-
d};
|
|
70
|
-
_.
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
b),
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
a
|
|
119
|
-
|
|
120
|
-
d=
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
a.
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
b.
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
(b
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
(
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
a.
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
a
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
_.
|
|
228
|
-
_.
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
_.
|
|
235
|
-
_.
|
|
236
|
-
a)
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
a);this.o
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
this.
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
d,this.
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
a=
|
|
269
|
-
b){this.
|
|
270
|
-
this.
|
|
271
|
-
a
|
|
272
|
-
|
|
273
|
-
|
|
67
|
+
dF=function(a,b,c){const d=new _.fk(a===_.N?`${b.videoId}`:a===_.M?`${b.audioId}`:`${b.id}`,c);switch(a){case _.N:d.codec=_.Tj(b.videoCodec);d.bandwidth=b.videoBandwidth||b.bandwidth;d.width=b.width;d.height=b.height;d.originalId=b.originalVideoId;break;case _.M:d.codec=_.Tj(b.audioCodec);d.bandwidth=b.audioBandwidth||b.bandwidth;d.originalId=b.originalAudioId;break;default:d.codec=_.Tj(b.codecs),d.originalId=b.originalTextId}(a=c.renditions.find(e=>_.uh(e,d,null,["id","track"])))||c.renditions.push(d);return a||
|
|
68
|
+
d};eF=function(a,b){a=a.reduce((c,d)=>{b===_.N?null===d.videoId||c[d.videoId]&&!d.activeVideo||(c[d.videoId]=d):b===_.M&&(null===d.audioId||c[d.audioId]&&!d.activeAudio||(c[d.audioId]=d));return c},{});return Object.values(a)};fF=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};gF=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};
|
|
69
|
+
_.hF=function(a,b){a.forEach(c=>{c.startTime+=b;c.endTime+=b})};iF=function(a){const b=a.periods[0].startTime;a=a.periods[a.periods.length-1].endTime;if(null==a)throw Error("Period end time must be known");return{start:b,end:a}};jF=function(a){return Object.assign({},a,{periods:a.periods.map(b=>Object.assign({},b))})};
|
|
70
|
+
kF=function(a,b){if(0===a.length)throw Error("Cannot concatenate 0 manifests");if(1===a.length)return a[0];a[0].cues.forEach(e=>{e.offset=0});var c=[...a[0].periods];for(var d=1;d<a.length;d++){const e=iF(a[d-1]).end;_.hF(a[d].periods,e);c.push(...a[d].periods);a[d].cues.forEach(f=>{f.offset=e})}d=a.flatMap(e=>e.cues);c={periods:c,presentationTimeline:b,minBufferTime:0,cues:d,alternativeVariants:a[0].alternativeVariants};d=iF(c).end;_.QD(b.a,0,d);(a=a[0].presentationTimeline.uc())&&_.TD(b,a.seekRangeStartDateTime);
|
|
71
|
+
return c};mF=function(a,b){try{if(1===a.length)return a[0];if(!a.every(lF))throw new _.zi("Period durations must be finite");return kF(a,b)}catch(c){throw new _.I(_.F,7,7003,"Failed to join manifests into a continuous playlist!",c);}};lF=function(a){return a.periods.every(b=>null!=b.endTime&&0<=b.endTime&&isFinite(b.endTime))};
|
|
72
|
+
nF=function(a,b){const c=b.periods[0].configurationId;var d=[...a.periods].filter(e=>e.configurationId!==c);a=a.presentationTimeline;d={periods:d,presentationTimeline:a,minBufferTime:0};_.UD(a,b.presentationTimeline.l);return mF([d,b],a)};oF=function(a){return{id:a.id,bandwidth:a.bandwidth,trickPlay:a.video?a.video.trickPlay:!1,width:a.video?a.video.width:void 0,height:a.video?a.video.height:void 0}};pF=function(a,b){return b.find(c=>c.id===a.id)||null};
|
|
73
|
+
qF=function(a,b){return a.h.filter(c=>c.type===b)};rF=function(a,b){return(a=a.a.get(b)||null)&&a.track};sF=function(a,b,c){if(!c||rF(a,c.type)!==c||a.m.ua())switch(c=c?c.renditions[0]||null:null,b){case _.N:a.nb(c);break;case _.M:a.Bb(c);break;case _.L:a.Cb(c);break;default:throw Error(`Unknown track type ${b}`);}};
|
|
74
|
+
xF=function(a,b,c){tF(a,b,_.N);if(uF(a,b,_.N)){var d=a.m;a.g.info(`Set video rendition with ID: ${b.id}`);var e=a.a.get(_.M)||null,f=null;if(e&&!e.a){const g=vF(d).filter(h=>h.videoId===parseInt(b.id,10));f=g.find(h=>h.audioId===parseInt(e.id,10))||null;if(!f){a.g.debug("Unable to find exact variant. Searching for equivalent");const h=e.track.renditions.map(k=>k.id).filter(k=>k!==e.id);f=g.find(k=>h.find(l=>l===k.audioId))||null}}else f=vF(d).find(g=>g.videoId===parseInt(b.id,10))||null;f?(a.f.set(_.N,
|
|
75
|
+
b),wF(d,f,c)):a.g.warn("Cannot find matching variant")}};BF=function(a,b){_.x(function*(){tF(a,b,_.L);if(uF(a,b,_.L)){var c=a.m.na().find(d=>d.id===parseInt(b.id,10));if(c){a.g.info(`Set text rendition with ID: ${b.id}`);a.f.set(_.L,b);try{yF(a,b),yield zF(a.m,!0),yield AF(a.m,c),a.m.trigger(new _.D(_.jg))}catch(d){a.g.warn("Failed to set text rendition",d)}}else a.g.warn(`Text rendition with ID: ${b.id} not found.`)}})};
|
|
76
|
+
CF=function(a){_.x(function*(){if(rF(a,_.L)){a.g.info("Unset text rendition.");try{yield zF(a.m,!1),a.a.set(_.L,null),a.m.trigger(new _.D(_.jg))}catch(b){a.g.warn("Failed to unset text rendition",b)}}})};
|
|
77
|
+
GF=function(a){if(a.m){a.g.debug("Track list change detected, updating track list");var b=[];for(var c of Object.values(_.xu))a.a.set(c,null),a.f.set(c,null);for(var d of a.m.na()){let e=cF(_.L,d);e=(c=b.find(g=>e.Mc(g)))||e;const f=dF(_.L,d,e);d.activeText&&a.a.set(_.L,f);c||b.push(e)}DF(a.m)||a.a.set(_.L,null);d=vF(a.m);EF(a,b,d,_.N);EF(a,b,d,_.M);FF(a,b);a.h=b}};yF=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)};
|
|
78
|
+
uF=function(a,b,c){return a.m.ua()?!0:(a.a.get(c)||null)===b?!1:!0};tF=function(a,b,c){if(0>a.h.indexOf(b.track))throw Error(`Unknown rendition with ID ${b.id}`);if(c!==b.track.type)throw Error("Types mismatch");};EF=function(a,b,c,d){c=eF(c,d);for(const e of c){let f=cF(d,e);f=(c=b.find(h=>f.Mc(h)))||f;const g=dF(d,e,f);(d===_.N&&e.activeVideo||d===_.M&&e.activeAudio)&&a.a.set(d,g);c||b.push(f)}};
|
|
79
|
+
FF=function(a,b){var c=a.m;if(c.f){var d=(d=HF(c))?IF(c.o,d).bb:null;c=c.f.muxedAudioTracks||[];if(d)for(e of c)e.active=d.id===e.id;var e=c}else e=[];for(const f of e)e=f,c=String(_.Wj++),c=new _.Xj(c,_.M),c.mimeType="",c.label=e.label,c.language=e.language,c.originalLanguage=e.language,c.channelsCount=e.channelsCount,c.roles=[],c.accessibility=[],d=new _.fk(`${e.id}`,c),d.codec="",d.bandwidth=0,d.originalId=e.label,d.a=!0,c.renditions.push(d),e=c,b.push(e),f.active&&a.a.set(_.M,e.renditions[0])};
|
|
80
|
+
JF=function(a,b,c){return qF(a,c).flatMap(d=>d.renditions).find(d=>parseInt(d.id,10)===b)||null};KF=function(a,b,c,d){a.h.length||GF(a);const e=a.a.get(c)||null;(b=JF(a,b,c))&&e!==b&&(yF(a,b),c===_.M?a.m.trigger(new _.D(_.Xc)):c===_.N&&a.m.trigger(new _.D(_.Kg,{details:{width:b.width||0,height:b.height||0,bandwidth:b.bandwidth,track:b.track,abrSelection:d}})))};LF=function(a){const b=_.Bk(a.mimeType,a.codecs),c=rD(a);return _.YE(b)||_.Is(c)||(_.Ak(b,a.type)?!0:!1)};
|
|
81
|
+
NF=function(a,b){if(window.ManagedMediaSource){a.j.disableRemotePlayback=!0;var c=new ManagedMediaSource;a.l.one(c,LC,()=>{URL.revokeObjectURL(a.B);b.resolve()});a.l.on(c,MC,()=>{a.S=!0});a.l.on(c,"endstreaming",()=>{a.S=!1});a.B=MF(c);a.j.src=a.B;return c}c=new MediaSource;a.B=MF(c);a.l.one(c,LC,()=>{URL.revokeObjectURL(a.B);b.resolve()});a.j.src=a.B;return c};
|
|
82
|
+
OF=function(a,b){b.forEach((c,d)=>{{const e=a.a[d];e&&(a.l.off(e,_.q),a.l.off(e,QC),a.o.removeSourceBuffer(e),delete a.a[d])}c=a.o.addSourceBuffer(c);a.l.on(c,_.q,a.Pb.bind(a,d));a.l.on(c,QC,a.C.bind(a,d));a.a[d]=c;a.h[d]=[];a.H[d]=!1})};PF=function(a,b){try{return new _.Bu(a.a[b].buffered,b)}catch(c){return b in a.a&&a.g.error(AC+b,c),null}};QF=function(a,b){return a.a[b]?(a=PF(a,b))?a.toString():"":""};
|
|
83
|
+
SF=function(a,b,c){if(a.J)return Promise.reject();c={start:c,p:new _.rn};a.h[b].push(c);1===a.h[b].length&&RF(a,b);return c.p};TF=function(a,b,c,d,e){return[SF(a,b,a.pb.bind(a,b)),SF(a,b,a.ha.bind(a,b,c)),SF(a,b,a.Qb.bind(a,b,d,e))]};
|
|
84
|
+
VF=function(a,b){return _.x(function*(){if(a.J)return Promise.reject();const c=[];for(const d in a.a){const e=new _.rn,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()}try{yield Promise.all(c)}catch(d){for(const e in a.a)a.h[e].length&&a.h[e].shift();return Promise.reject(d)}for(const d in a.a);try{yield b()}catch(d){return Promise.reject(new _.I(_.F,3,3015,{mediaError:d}))}finally{for(const d in a.a)UF(a,d)}})};
|
|
85
|
+
UF=function(a,b){a.h[b].shift();RF(a,b)};RF=function(a,b){const c=a.h[b][0];if(c)try{a.g.debug(nC+b),c.start()}catch(d){d.name===fC?c.p.reject(new _.I(_.F,3,3017,{type:b})):c.p.reject(new _.I(_.F,3,3015,{mediaError:d})),UF(a,b)}else a.g.debug(bC+b)};
|
|
86
|
+
aG=function(a,b,c,d){const e=a.periods.flatMap(k=>k.variants);var f=e;if(b.length||c.length)f=WF(f,b,c);f=XF(f,d);if(1<a.periods.length&&e.some(k=>null!=k.audio)){const k=m=>{m=m.split(".");let n=m[0];1<m.length&&(n+="."+m[1]);return n.toLowerCase()};b=[];for(var g of a.periods){c=new Set;for(const m of g.variants)null!==m.audio&&c.add(k(m.audio.codecs));b.push(c)}let l=b[0];for(g=1;g<b.length;g++){const m=b[g];l=new Set([...l].filter(n=>m.has(n)))}f=f.filter(m=>0===l.size&&null===m.audio?!0:0<l.size&&
|
|
87
|
+
null===m.audio?!1:l.has(k(m.audio.codecs)))}f=YF(f);const h=ZF(f);for(const k of a.periods)k.variants=k.variants.filter(l=>{if($F(l)===h)return!0;_.Gh("Dropping Variant (better codec available)",l);return!1})};
|
|
88
|
+
WF=function(a,b,c){if(!b.length&&!c.length)return a;const d=a.filter(g=>(g=g.audio)&&c.length&&(g=_.tD(g.codecs),c.includes(g))?!0:!1),e=a.filter(g=>(g=g.video)&&b.length&&(g=_.tD(g.codecs),b.includes(g))?!0:!1),f=a.filter(g=>d.length&&!e.length?d.includes(g):!d.length&&e.length?e.includes(g):d.includes(g)&&e.includes(g));return f.length?f:a};
|
|
89
|
+
XF=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))};YF=function(a){const b=new _.Ot;for(const c of a)a=$F(c),b.push(a,c);return b};
|
|
90
|
+
ZF=function(a){let b="",c=Infinity;RC(a,(d,e)=>{e=e.reduce((f,g)=>f+g.bandwidth||0,0)/e.length;_.Gh(_.Bd,d,"avg bandwidth",e);e<c&&(b=d,c=e)});return b};$F=function(a){let b="";a.video&&(b=_.tD(a.video.codecs));let c="";a.audio&&(c=_.tD(a.audio.codecs));return b+"-"+c};bG=function(a,b,c,d){let e=a.periods.flatMap(f=>f.variants);if(b.length||c.length)e=WF(e,b,c);e=XF(e,d);for(const f of a.periods)f.variants=f.variants.filter(g=>e.includes(g))};
|
|
91
|
+
cG=function(a,b){var c;if(!(c=!a.width||!a.height)){c=a.width;if(c=c>=b.minWidth&&c<=b.maxWidth)c=a.height,c=c>=b.minHeight&&c<=b.maxHeight;c&&(c=a.width*a.height,c=c>=b.minPixels&&c<=b.maxPixels)}c&&(a=a.bandwidth,c=a>=b.minBandwidth&&a<=b.maxBandwidth);return c?!0:!1};dG=function(a,b){let c=!1;for(const d of a)a=d.allowedByApplication,d.allowedByApplication=cG(d,b),a!==d.allowedByApplication&&(c=!0);return c};
|
|
92
|
+
gG=function(a,b,c,d,e){e=void 0===e?!0:e;let f=!1;d.variants=d.variants.filter(g=>{if(a&&a.S&&!$C(a,g))return _.Gh("Dropping variant - not compatible with key system",g),!1;let h=g.audio;const k=g.video;if(h&&!LF(h)){const l=h.codecs;0<=h.codecs.indexOf(_.ge)?(_.Gh("Trying to use AC-3 for EC-3"),h.codecs=h.codecs.replace(_.ge,"ac-3"),LF(h)?_.Fh("Using AC-3 instead of EC-3 for",eG(h)):(h.codecs=l,_.Fh(gC,eG(h)),g.audio=null,f=!0,h=null)):(_.Fh(gC,eG(h)),g.audio=null,f=!0,h=null)}return k&&!LF(k)?(_.Fh("Dropping variant - video not compatible with platform",
|
|
93
|
+
eG(k)),!1):h&&b&&!fG(h,b,e)?(_.Fh("Dropping variant - not compatible with active audio","active audio",eG(b),"variant.audio",eG(h)),!1):k&&c&&!fG(k,c,e)?(_.Fh("Dropping variant - not compatible with active video","active video",eG(c),"variant.video",eG(k)),!1):!0});if(f){let g=!1,h=!1;for(const k of d.variants)!g&&k.video&&k.audio&&(g=!0),h||k.audio||!k.video||(h=!0);g&&h&&(d.variants=d.variants.filter(k=>k.video&&!k.audio?(_.Fh("Dropping variant - not compatible with video + audio","variant.video",
|
|
94
|
+
eG(k.video)),!1):!0))}d.textStreams=d.textStreams.filter(g=>{const h=_.YE(_.Bk(g.mimeType,g.codecs));h||_.Gh("Dropping text stream. Is not supported by the platform.",g);return h})};
|
|
95
|
+
eG=function(a){const b=rD(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"};
|
|
96
|
+
fG=function(a,b,c){return a.mimeType!==b.mimeType||(void 0===c||c)&&a.codecs.split(".")[0]!==b.codecs.split(".")[0]?!1:!0};
|
|
97
|
+
hG=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 r of c.roles)l.add(r);n=[c,b].map(r=>r?r.accessibility||[]:[]).reduce((r,u)=>r.concat(u),[]);a={id:a.id,activeVideo:!1,activeAudio:!1,activeText:!1,type:"variant",bandwidth:a.bandwidth,language:a.language,originalLanguage:a.language,
|
|
98
|
+
label:null,kind:k,width:null,height:null,frameRate:null,trickPlay:!1,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,spatialAudio:!1,audioBandwidth:null,videoBandwidth:null,originalVideoId:null,originalAudioId:null,originalTextId:null,accessibility:n};c&&(a.videoId=c.id,a.originalVideoId=c.originalId,a.width=c.width||null,a.height=c.height||null,a.frameRate=c.frameRate||
|
|
99
|
+
null,a.trickPlay=!!c.trickPlay,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};
|
|
100
|
+
iG=function(a){return{id:a.id,activeVideo:!1,activeAudio:!1,activeText:!1,type:_.H,bandwidth:0,language:a.language,originalLanguage:a.originalLanguage,label:a.label,kind:a.kind||null,width:null,height:null,frameRate:null,trickPlay:!1,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,spatialAudio:!1,audioBandwidth:null,videoBandwidth:null,originalVideoId:null,originalAudioId:null,
|
|
101
|
+
originalTextId:a.originalId,accessibility:a.accessibility,keyId:null}};jG=function(a){return a.allowedByApplication&&a.allowedByKeySystem};
|
|
102
|
+
_.lG=function(a,b,c,d){b=_.pi(b);let e=a;const f=a.filter(h=>h.primary);f.length&&(e=f);const g=e.length?e[0].language:"";e=e.filter(h=>h.language===g);b.some(h=>{const k=_.kD(_.Qi(h),a.map(l=>l.language));return k?(e=a.filter(l=>_.Qi(l.language)===k),!0):!1});d&&e.some(h=>h.kind===_.le)&&(e=e.filter(h=>h.kind===_.le));if(c){b=kG(e,c);if(b.length)return b;_.C("No exact match for the text role could be found.")}else if(b=e.filter(h=>0===h.roles.length),b.length)return b;b=e.map(h=>h.roles).reduce(_.eD,
|
|
103
|
+
[]);return b.length?kG(e,b[0]):e};kG=function(a,b){return a.filter(c=>c.roles.includes(b))};mG=function(a,b,c){if(a.j&&a.a.useCmsd){const d=cD(a.j);null!==d&&(a.g.debug("Using CMSD maxSuggestedBitrateKbps:",d),c=c.filter(e=>e.bandwidth<=1E3*d))}a=c.filter(d=>!d.trickPlay);b&&(a=a.filter(d=>cG(d,b)));return a.sort((d,e)=>d.bandwidth-e.bandwidth)};nG=function(a){return new _.I(_.F,7,7E3,a.a?"Another load operation was started while a load operation was in progress.":"Player was released while a load operation was in progress.")};
|
|
104
|
+
oG=function(a,b){if(b&&(null==a.a||a.a!==b))throw nG(a);};IF=function(a,b){a.a.has(b)||a.a.set(b,new pG);return a.a.get(b)};qG=function(a,b,c){IF(a,b).text=c};
|
|
105
|
+
tG=function(a,b,c){c=void 0===c?!0:c;var d;if(!(d=!!a.audio!==!!b.audio||!!a.video!==!!b.video||a.language!==b.language)&&(d=a.audio&&b.audio)){d=a.audio;var e=b.audio;d=!(d.channelsCount===e.channelsCount&&(!c||rG(d,e))&&sG(d.roles,e.roles))}!d&&(d=a.video&&b.video)&&(a=a.video,b=b.video,d=!((!c||rG(a,b))&&sG(a.roles,b.roles)));return d?!1:!0};
|
|
106
|
+
rG=function(a,b){if(a.mimeType!==b.mimeType)return!1;a=sD(a.codecs).map(c=>_.tD(c));b=sD(b.codecs).map(c=>_.tD(c));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};sG=function(a,b){a=new Set(a);b=new Set(b);a.delete(_.He);b.delete(_.He);if(a.size!==b.size)return!1;for(const c of a)if(!b.has(c))return!1;return!0};AG=function(a,b){let c=null;b.some(d=>{c=_.kD(_.Qi(d),a.map(e=>jD(e)));return!!c});return c?a.filter(d=>c===jD(d)):[]};
|
|
107
|
+
BG=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)})};CG=function(a,b){return a.filter(c=>c.audio&&c.audio.spatialAudio!==b?!1:!0)};
|
|
108
|
+
DG=function(a){return 1>=a.a.chasingRate?(a.g.warn("chasingRate must be greater than 1."),!1):a.a.chaseJumpDistance<=a.a.startChasingAt?(a.g.warn("chaseJumpDistance must be greater than startChasingAt."),!1):a.a.startChasingAt<=a.a.stopChasingAt?(a.g.warn("startChasingAt must be greater than stopChasingAt."),!1):0>a.a.stopChasingAt?(a.g.warn("stopChasingAt must be greater than or equal to 0."),!1):!0};
|
|
109
|
+
FG=function(a,b){if(window.ManagedMediaSource){a.j.disableRemotePlayback=!0;var c=new ManagedMediaSource;a.l.one(c,LC,()=>{URL.revokeObjectURL(a.B);b.resolve()});a.l.on(c,MC,()=>{a.U=!0});a.l.on(c,"endstreaming",()=>{a.U=!1});a.B=EG(c);a.j.src=a.B;return c}c=new MediaSource;a.B=EG(c);a.l.one(c,LC,()=>{URL.revokeObjectURL(a.B);b.resolve()});a.j.src=a.B;return c};
|
|
110
|
+
GG=function(a,b){b.forEach((c,d)=>{const e=a.o.addSourceBuffer(c);a.l.on(e,_.q,a.pb.bind(a,d));a.l.on(e,QC,a.C.bind(a,d));a.a[d]=e;a.H[d]=c;a.h[d]=[];a.I[d]=!1});a.S=b.has(_.p)&&b.has(_.w)};HG=function(a,b){try{return new _.Bu(a.a[b].buffered,b)}catch(c){return b in a.a&&a.g.error(AC+b,c),null}};IG=function(a,b){return a.a[b]?(a=HG(a,b))?a.toString():"":""};KG=function(a,b,c){if(a.O)return Promise.reject();c={start:c,p:new _.rn};a.h[b].push(c);1===a.h[b].length&&JG(a,b);return c.p};
|
|
111
|
+
LG=function(a,b,c){0>c&&(c+=.001);try{a.g.debug(lC+b,c),a.a[b].timestampOffset=c}catch(d){throw a.g.warn(XB+b,c,d),d;}a.g.debug(RB+b,c);a.C(b)};NG=function(a,b,c,d){return _.x(function*(){const e=_.tD(_.Dk(a.H[b])),f=_.Ck(a.H[b]),g=_.Bk(c,d),h=_.tD(_.Dk(g)),k=_.Ck(g);if(e===h&&f===k)return!1;a.K.mediaSource.codecSwitchingStrategy===_.Xf&&AD()&&(yield MG(a,b,g));return!0})};
|
|
112
|
+
OG=function(a,b,c,d,e,f){return[f?Promise.resolve():KG(a,b,()=>{try{a.g.debug(FB+b+zB);const g=a.a[b].appendWindowStart,h=a.a[b].appendWindowEnd;a.a[b].abort();a.a[b].appendWindowStart=g;a.a[b].appendWindowEnd=h}catch(g){throw a.g.warn(SB+b+zB,g),g;}a.g.debug(MB+b+zB);a.C(b)}),KG(a,b,()=>LG(a,b,c)),KG(a,b,()=>{try{a.g.debug(jC+b,d,e),a.a[b].appendWindowStart=0,a.a[b].appendWindowEnd=e,a.a[b].appendWindowStart=d}catch(g){throw a.g.warn(WB+b,d,e,g),g;}a.g.debug(QB+b,d,e);a.C(b)})]};
|
|
113
|
+
QG=function(a,b){return _.x(function*(){if(a.O)return Promise.reject();const c=[];for(const d in a.a){const e=new _.rn,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()}try{yield Promise.all(c)}catch(d){for(const e in a.a)a.h[e].length&&a.h[e].shift();return Promise.reject(d)}for(const d in a.a);try{yield b()}catch(d){return Promise.reject(new _.I(_.F,3,3015,{mediaError:d}))}finally{for(const d in a.a)PG(a,d)}})};
|
|
114
|
+
PG=function(a,b){a.h[b].shift();JG(a,b)};JG=function(a,b){const c=a.h[b][0];if(c)try{a.g.debug(nC+b),c.start()}catch(d){d.name===fC?c.p.reject(new _.I(_.F,3,3017,{type:b})):c.p.reject(new _.I(_.F,3,3015,{mediaError:d})),PG(a,b)}else a.g.debug(bC+b)};MG=function(a,b,c){return KG(a,b,()=>{b===_.H?a.g.debug(`Change not supported for ${b}`):(a.g.debug(`Change Type: ${a.H[b]} -> ${c}`),AD()?(a.a[b].changeType(c),a.H[b]=c):a.g.debug("Change Type not supported"),a.C(b))})};RG=function(a,b){a.f=b};
|
|
115
|
+
SG=function(a,b){a.j=b;a.j.speedUpMode&&(a.w=a.j.speedUpMode)};VG=function(a,b){a.a.stop();a.l||(a.o=!1);const c=a.l?0:a.h;if((b?b:a.w)===_.Pd||0===c||1===c)try{TG(a,c)}catch(d){a.g.warn('Set playbackRate using "decoder" mode fails, due to unsupported range by platform. Fallback to "seek" mode.',d),UG(a)}else UG(a)};TG=function(a,b){if(a.f.Uf()!==b){a.g.debug(kC,b,' using native playbackRate "decoder" mode.');try{a.f.ni(b)}catch(c){throw c;}}};
|
|
116
|
+
UG=function(a){a.g.debug(kC,a.h,' using "seek" mode.');TG(a,0);a.o=!0;a.a.Eb(.25)};
|
|
117
|
+
XG=function(a){a=_.K(a);let b=!1,c;const d=[],e=h=>{d.push(h);_.wm(h)},f=()=>{b=!0},g=[];(new _.Dm).N(_.Oe,e).N(_.qg,e).N(_.Je,e).N(_.Ne,e).N(_.bg,e).ea(_.dg,h=>{c=h;d.push(h);_.xm(h)}).ea("encv",f).ea("enca",f).ea("avc1",h=>{g.push({N:h,Tc:1701733238})}).ea("avc3",h=>{g.push({N:h,Tc:1701733238})}).ea("ac-3",h=>{g.push({N:h,Tc:1701733217})}).ea(_.ge,h=>{g.push({N:h,Tc:1701733217})}).ea("mp4a",h=>{g.push({N:h,Tc:1701733217})}).parse(a);if(b)return _.Fh("Init segment already indicates encryption."),
|
|
118
|
+
a;if(0===g.length||!c)throw _.Hh("Failed to find boxes needed to fake encryption!"),_.Hh("Failed init segment (hex):",_.$l(a)),new _.I(_.F,3,14E3);g.reverse();for(const h of g)_.Fh(`Inserting "${_.vm(h.Tc)}" box into init segment.`),a=WG(a,c,h.N,d,h.Tc);return a};
|
|
119
|
+
WG=function(a,b,c,d,e){{var f=YG.value(),g=a.subarray(c.start,c.start+c.size);const k=_.fj(g);var h=new Uint8Array(c.size+f.byteLength);h.set(g,0);g=_.fj(h);g.setUint32(4,e);h.set(f,c.size);e=k.getUint32(4);g.setUint32(c.size+16,e);ZG(h,0,h.byteLength);e=h}h=new Uint8Array(a.byteLength+e.byteLength);c=_.Jk("Xbox One")||_.Ik()?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)ZG(h,k.start,k.size+e.byteLength);a=_.fj(h,b.start);b=_.zm(b);
|
|
120
|
+
d=a.getUint32(b);a.setUint32(b,d+1);return h};ZG=function(a,b,c){a=_.fj(a,b);b=a.getUint32(0);0!==b&&(1===b?(a.setUint32(8,c>>32),a.setUint32(12,c&4294967295)):a.setUint32(0,c))};$G=function(a){return"("+a.type+":"+a.stream.id+")"};aH=function(a){return!a.zb&&null==a.ob&&!a.bc&&!a.mc};bH=function(a){a.periods.every(b=>typeof b.id===_.cg)};cH=function(a){null!=a.ob&&(a.ob.stop(),a.ob=null)};dH=function(a){return _.x(function*(){a.Yb&&(yield a.Yb.abort())})};
|
|
121
|
+
jH=function(a,b,c,d,e){return _.x(function*(){var f=a.D.Jb();const g=eH(a,f);if(null==g)a.g.warn("Cannot initialize streams, period not found at",f);else{f=new Map;var h=new Set;b&&(f.set(_.p,b),h.add(b));c&&(f.set(_.w,c),h.add(c));d&&(f.set(_.H,d),h.add(d));yield a.D.aa.init(f,a.h.forceNativeTS,a.h.disableAudioTracks);a.f||(fH(a),yield gH(a,h),a.f||f.forEach((k,l)=>{a.a.has(l)||(k=hH(k,g,e),a.a.set(l,k),iH(a,k,0))}))}})};
|
|
122
|
+
kH=function(a,b){a=a.j.periods.find(c=>c.id===b)||null;if(!a)throw new _.I(_.F,5,5006,`Period ${b} not found`);return a};lH=function(a){var b=a.a.get(_.w);return b?kH(a,b.Wb):(b=a.a.get(_.p))?kH(a,b.Wb):null};_.mH=function(a,b){return(a=a.a.get(b))?a.gc||a.stream:null};nH=function(a){return _.mH(a,_.p)};oH=function(a){return _.mH(a,_.w)};
|
|
123
|
+
gH=function(a,b){return _.x(function*(){const c=[];for(const f of b){const g=a.w.get(f.id);g?(a.g.debug("(all) Stream "+f.id+" is being or has been set up"),c.push(g)):(a.g.debug("(all) setting up Stream "+f.id),a.w.set(f.id,new _.rn),c.push(f.createSegmentIndex(a.D.yb)))}try{if(yield Promise.all(c),a.f)return}catch(f){if(a.f)return;for(var d of b){var e=a.w.get(d.id);e&&(e.catch(()=>{}),e.reject(),a.w.delete(d.id))}throw f;}for(e of b)(d=a.w.get(e.id))&&!d.done&&(d.resolve(),a.g.debug("(all) setup Stream "+
|
|
124
|
+
e.id))})};eH=function(a,b){return(a=ID(a.j.periods,b+_.ku))?a.id:null};hH=function(a,b,c){return{stream:a,type:a.type,dc:null,segmentIterator:null,sa:null,gc:null,$d:!0,Wb:b,endOfStream:!1,zb:!1,ob:null,bc:!1,Jd:0,ke:!1,mc:!1,Ue:!1,Pc:!1,sg:c||0,Yb:null,Ld:!1,dg:0}};iH=function(a,b,c){a.g.debug($G(b),"updating in "+c+" seconds");b.ob=(new _.Mt(()=>_.x(function*(){try{yield a.Xb(b)}catch(d){if(a.D)a.D.onError(d)}}))).ia(c)};
|
|
125
|
+
pH=function(a,b){return _.x(function*(){yield a.D.aa.clear(_.H);a.H++;a.I=!1;var c=a.H,d=a.D.aa;const e=new Map,f=new Set;e.set(_.H,b);f.add(b);yield d.init(e,!1,a.h.disableAudioTracks);a.f||(yield gH(a,f),a.f||(d=d.getTextDisplayer().isTextVisible()||a.h.alwaysStreamText,a.H!==c||a.a.has(_.H)||a.I||!d||(c=a.D.Jb(),d=eH(a,c),null==d?a.g.warn("Cannot set up text media state, period not found at",c):(c=hH(b,d,0),a.a.set(_.H,c),iH(a,c,0)))))})};
|
|
126
|
+
qH=function(a){a.I=!0;const b=a.a.get(_.H);b&&(a.g.info("Unload text stream"),cH(b),dH(b).catch(()=>{}),a.a.delete(_.H))};rH=function(a){return _.x(function*(){const b=a.a.get(_.p);b&&(a.g.info("Unload audio stream"),cH(b),yield dH(b).catch(()=>{}),a.a.delete(_.p))})};
|
|
127
|
+
_.zH=function(a,b,c,d){const e=a.a.get(b.type);if(!e&&b.type===_.H&&a.h.ignoreTextStreamFailures)pH(a,b);else if(e){var f=sH(a,b).id;if(c&&f!==e.Wb){a.g.debug("switch: switching to stream in another Period; clearing buffer and changing Periods");for(var g of a.a.values())tH(a,g)}else if(e.gc&&(a.g.debug("switch during trick play mode",b),b.trickModeVideo?(e.gc=b,b=b.trickModeVideo,a.g.debug("switch found trick play stream",b)):(e.gc=null,a.g.debug("switch found no special trick play stream"))),uH(a,
|
|
128
|
+
f))if(vH(a,b.id)||gH(a,new Set([b])),e.stream!==b){g=a.j.presentationTimeline.getDuration();var h=a.D.Jb();h=wH(a,e,h);!c&&(e.endOfStream||h>=g)?a.g.debug(PC+$G(e)+" already buffered to the end. Not switching."):(b.type===_.H&&a.D.aa.A(_.Bk(b.mimeType,b.codecs)),e.stream=b,e.stream.segmentIterator=null,e.$d=!0,a.g.debug("switch: switching to Stream "+$G(e)),xH(a,e,f)&&(a.g.info("Aborting current segment request to switch."),e.Yb.abort()),c&&(e.mc?e.ke=!0:e.zb?(e.bc=!0,e.Jd=d,e.ke=!0):(cH(e),yH(a,
|
|
129
|
+
e,!0,d).catch(k=>{if(a.D)a.D.onError(k)}))))}else a.g.debug(PC+$G(e)+" already active")}};AH=function(a,b,c,d){b.video&&_.zH(a,b.video,c,d);b.audio&&_.zH(a,b.audio,c,d)};
|
|
130
|
+
tH=function(a,b){return _.x(function*(){const c=$G(b);b.mc?a.g.debug(c,"clear: already clearing the buffer"):b.bc?a.g.debug(c,"clear: already waiting"):b.zb?(a.g.debug(c,"clear: currently updating"),b.bc=!0,b.Jd=0):null==a.D.aa.Qa(b.type)?(a.g.debug(c,"clear: nothing buffered"),null==b.ob&&iH(a,b,0)):(a.g.debug(c,"clear: handling right now"),cH(b),yield yH(a,b,!1,0).catch(d=>{if(a.D)a.D.onError(d)}))})};BH=function(a){_.x(function*(){if(!a.A){a.A=!0;yield rH(a);var b=a.a.get(_.w);yield tH(a,b)}})};
|
|
131
|
+
CH=function(a,b){_.x(function*(){if(a.A){a.A=!1;const c=a.D.Jb();yield jH(a,b,null,null,c)}_.zH(a,b,!0,0)})};fH=function(a){const b=a.j.presentationTimeline.getDuration();Infinity>b?a.D.aa.Y(b):a.D.aa.Y(Math.pow(2,32))};DH=function(a,b){const c=a.j.periods.map(d=>d.id);a.g.debug(`Manifest updated, periods (${c.length}): `+`${c.join(", ")}`);a.j.periods=b.periods;bH(a.j);fH(a)};
|
|
132
|
+
EH=function(a){const b=a.D.Jb(),c=g=>a.D.aa.Mb(g,b,0);let d=!1;const e=eH(a,b);if(_.Yi(a.a.values(),g=>g.Wb===e))for(const g of a.a.keys()){var f=a.a.get(g);f.stream.segmentIterator=null;c(g)||(tH(a,f),d=!0)}else if(!_.Yi(a.a.keys(),c)){a.g.debug("(all): seeked: unbuffered seek: clearing all buffers");for(f of a.a.values())tH(a,f);d=!0}d||a.g.debug("(all): seeked: buffered seek: presentationTime\x3d"+b)};
|
|
133
|
+
FH=function(a,b){b=void 0===b?!1:b;if(a.f)a.g.error("Unable to retry after StreamingEngine is destroyed!");else if(a.o)a.g.error("Unable to retry after StreamingEngine encountered a fatal error!");else for(const c of a.a.values()){const d=$G(c);if(c.Pc||b&&aH(c))a.g.info(d,"Retrying after failure..."),c.Pc=!1,iH(a,c,.1)}};GH=function(a){return Array.from(a.a.values()).some(b=>null!==b.ob)};HH=function(a){const b=Array.from(a.a.values());return a.C&&b.every(c=>c.endOfStream)};
|
|
134
|
+
yH=function(a,b,c,d){return _.x(function*(){const e=$G(b);b.bc=!1;b.ke=!1;b.Jd=0;b.mc=!0;b.stream.segmentIterator=null;a.g.debug(e,"clearing buffer");if(d){var f=a.D.Jb();const g=a.D.aa.getDuration();f=a.D.aa.remove(b.type,f+d,g)}else f=a.D.aa.clear(b.type).then(()=>!a.f&&c?a.D.aa.flush(b.type):null);yield f;a.f||(a.g.debug(e,"cleared buffer"),b.dc=null,b.sa=null,b.mc=!1,b.endOfStream=!1,b.Ld=!1,iH(a,b,0))})};
|
|
135
|
+
IH=function(a){return _.x(function*(){const b=[];for(const c of a.a.values())cH(c),c.zb&&c.Yb&&(c.zb=!1,b.push(c.Yb.abort())),c.bc&&b.push(yH(a,c,!0,0));yield Promise.all(b)})};JH=function(a,b,c){(a=a.a.get(b))&&c&&(cH(a),a.stream=c,a.dc=c,a.sa&&(a.sa=c.getSegmentReference(a.sa.position)),a.sa||(a.dc=null))};uH=function(a,b){a=a.B.get(b);return!(!a||!a.he)};vH=function(a,b){a=a.w.get(b);return!(!a||!a.he)};wH=function(a,b,c){return b.dc&&b.sa?sH(a,b.dc).startTime+b.sa.endTime:Math.max(c,b.sg)};
|
|
136
|
+
xH=function(a,b,c){if(!b.Yb)return!1;const d=a.D.Jb(),e=a.D.aa.ma(b.type);c=(c=KH(a,b,d,e,c))?c.gd():null;if(null==c)return!1;var f=b.stream.initSegmentReference;f&&(c+=f.gd()||0);f=a.D.dd().getBandwidthEstimate();if(8*c/f<(null===e?0:e-d)-Math.max(a.j.minBufferTime||0,a.h.rebufferingGoal))return!0;a=b.Yb;a=a.j?a.j.bytesRemaining:-1;return 0>a||a>c?!0:!1};
|
|
137
|
+
KH=function(a,b,c,d,e){if(null==e)return a.g.warn(KB),null;if(b.stream.segmentLookupStrategy===_.CC)b.stream.segmentIterator?a=hE(b.stream.segmentIterator):b.sa||d?(c=b.sa?b.sa.endTime:d,a.g.info(ZB,"looking up segment from new stream endTime:",c),b.stream.segmentIterator=nE(b.stream.segmentIndex,c),e=b.stream.segmentIterator.next().value,null===e&&(b.stream.segmentIterator=null,a.g.warn(ZB,vC,"endTime:",c,b.sa)),a=e):(e=kH(a,e),e=Math.max(0,c-e.startTime),a.g.info(ZB,"looking up segment","lookupTime:",
|
|
138
|
+
e,GC,c),d=null,d||(b.stream.segmentIterator=nE(b.stream.segmentIndex,e),d=b.stream.segmentIterator.next().value),null===d&&a.g.warn(ZB,vC,"lookupTime:",e,GC,c),a=d);else{var f=$G(b);if(b.sa&&b.stream===b.dc)c=b.sa.position+1,a.g.debug(f,"next position known:","position\x3d"+c),a=LH(a,b,e,c);else{if(b.sa){a.g.debug(f,"next position unknown: another Stream buffered");f=sH(a,b.dc);var g=MH(a,b,f.startTime+b.sa.endTime,e)}else a.g.debug(f,"next position unknown: nothing buffered"),g=MH(a,b,d||c,e);if(null==
|
|
139
|
+
g)a=null;else if(f=LH(a,b,e,g),null==f)a=null;else{var h=null==a.h?!1:a.h.ignoreDrift;null==d&&!h&&f.Fa+f.startTime+2>c&&(a=LH(a,b,e,Math.max(0,g-1)))&&(f=a);a=f}}}return a};
|
|
140
|
+
NH=function(a,b){var c=a.B.get(b);if(c)return a.g.debug(`(all) Period ${b} is being or has been set up`),c;a.g.debug(`(all) setting up Period ${b}`);const d=new _.rn;a.B.set(b,d);const e=new Set;c=kH(a,b);for(const f of c.variants)f.video&&e.add(f.video),f.video&&f.video.trickModeVideo&&e.add(f.video.trickModeVideo),f.audio&&e.add(f.audio);for(const f of c.textStreams)e.add(f);a.G=a.G.then(()=>a.f?null:gH(a,e)).then(()=>{a.f||(d.resolve(),a.g.debug(`(all) setup Period ${b}`))}).catch(f=>{a.f||(d.catch(()=>
|
|
141
|
+
{}),d.reject(),a.B.delete(b),a.g.warn(`(all) failed to setup Period ${b}`),a.D.onError(f))});return d};OH=function(a){a.g.debug("(all) setupAllPeriods_");a.j.periods.map(b=>b.id).forEach(b=>{NH(a,b).catch(fD)})};
|
|
142
|
+
RH=function(a,b){if(b.type===_.H&&b.stream.mimeType===_.Jc)return a.D.aa.va(b.stream.originalId||""),null;b.type===_.H&&a.D.aa.da();if(!a.D.aa.Aa()&&b.type!==_.H)return a.h.bufferLimitUpdateInterval?a.h.bufferLimitUpdateInterval/2:.5;var c=$G(b);const d=a.D.Jb(),e=wH(a,b,d);a.g.debug(c,"timeNeeded\x3d"+e);var f=a.D.aa.Ca(b.type,d);a.g.debug(c,"update_:",HC+d,"bufferedAhead\x3d"+f);var g=Math.max(a.j.minBufferTime||0,a.h.rebufferingGoal,a.h.bufferingGoal)*a.l,h=VD(a.j.presentationTimeline);if(null!=
|
|
143
|
+
h&&e>=h&&!b.Ld)return PH(a,b),null;b.endOfStream=!1;h=sH(a,b.stream).id;const k=eH(a,e);null!=k&&(b.Wb=k);if(k!==h)return a.g.debug(c,"need Period "+k,HC+d,"timeNeeded\x3d"+e,"currentPeriodId\x3d"+h),null;if(f>=g)return a.g.debug(c,"buffering goal met"),a.h.bufferLimitUpdateInterval||.5;f=a.D.aa.ma(b.type);f=KH(a,b,d,f,h);if(!f)return a.j.presentationTimeline.isLive()||b.type===_.H?a.h.bufferLimitUpdateInterval||1:(a.g.debug("Media state "+c+": no next segment found. Assuming EOS."),PH(a,b),null);
|
|
144
|
+
c=Infinity;for(const l of a.a.values())if(l.type!==_.H||l.stream.mimeType!==_.Jc)g=wH(a,l,d),c=Math.min(c,g);if(e>=c+a.j.presentationTimeline.h)return a.h.bufferLimitUpdateInterval||1;b.sg=0;QH(a,b,d,h,f).catch(()=>{});return null};SH=function(a,b){return _.x(function*(){if(!a.f){if(a.D.vg)try{yield a.D.vg(b)}catch(c){c.cause=b,b=c}if(!b.f)a.D.onError(b)}})};
|
|
145
|
+
TH=function(a,b){const c=$G(b),d=sH(a,b.stream).id;if(b.Wb!==d){var e=b.Wb,f=Array.from(a.a.values());f.every(g=>g.Wb===e)?f.every(aH)?(a.g.debug(c,"all need Period "+e),NH(a,e).then(()=>{if(!a.f)if(a.D.aa.Ha(),f.every(l=>{const m=aH(l),n=sH(a,l.stream).id;return m&&l.Wb===e&&n!==e})){var g=kH(a,e);a.g.debug(c,"Streaming period",e,g);a.g.debug(c,"calling onChooseStreams()...");var h=a.D.Ke(g);a.F=!h.audio&&!h.video&&!!h.text;var k=new Map;h.video&&k.set(_.w,h.video);h.audio&&k.set(_.p,h.audio);h.text&&
|
|
146
|
+
k.set(_.H,h.text);for(const l of a.a.keys())if(!k.has(l)&&l!==_.H){a.g.error(c,"invalid Streams chosen: missing "+l+" Stream");a.D.onError(new _.I(_.F,5,5005));return}for(const l of Array.from(k.keys()))if(!a.a.has(l))if(l===_.H)jH(a,null,null,k.get(_.H),g.startTime),k.delete(l);else{a.g.error(c,"invalid Streams chosen: unusable "+l+" Stream");a.D.onError(new _.I(_.F,5,5005));return}for(const l of Array.from(a.a.keys()))(g=k.get(l))?(_.zH(a,g,!1,0),iH(a,a.a.get(l),0)):a.a.delete(l);a.g.debug(c,uC);
|
|
147
|
+
a.D.Je()}else a.g.debug(c,"ignoring transition to Period",e,"since another is happening")}).catch(fD)):a.g.debug(c,"all MediaStates need Period "+e+", but not all MediaStates are idle"):a.g.debug(c,"not all MediaStates need Period "+e)}};PH=function(a,b){a.g.debug($G(b),"buffered to end of presentation");b.endOfStream=!0;b.type===_.w&&(a=a.a.get(_.H))&&a.stream.mimeType===_.Jc&&(a.endOfStream=!0)};
|
|
148
|
+
QH=function(a,b,c,d,e){return _.x(function*(){const f=$G(b),g=kH(a,d);a.g.debug(f,"fetchAndAppend_:",HC+c,yC+g.startTime,JC+e.position,KC+e.startTime,IC+e.endTime);const h=b.stream,k=b.stream.segmentIterator;var l=a.j.presentationTimeline.getDuration();const m=UH(a,d);l=VH(a,b,g,Math.max(0,g.startTime-.1),m?m.startTime+.01:l,e);b.zb=!0;b.$d=!1;a.g.debug(f,"fetching segment");let n=!1;const r=(v,y)=>{if(a.f||a.o)return null;n=!0;return WH(a,b,c,g,h,e,v,y)},u=a.D.aa.ma(b.type)||0;l.then(()=>a.f||a.o?
|
|
149
|
+
null:XH(a,b,e,!1,v=>r(v.data,!0))).then(v=>a.f||a.o?null:n||null===v?(YH(a,b,u,e,h),null):r(v,!1)).then(()=>{if(!a.f&&!a.o){YH(a,b,u,e,h);b.zb=!1;b.Ue=!1;b.bc||a.D.ce();if(k){const v=k.next().value;v&&a.g.debug("New iterated segment",v)}iH(a,b,0);ZH(a,b,h);a.g.debug(f,"finished fetch and append")}}).catch(v=>_.x(function*(){a.f||a.o||(b.zb=!1,b.type===_.H&&a.h.ignoreTextStreamFailures?(1001===v.code?a.g.warn(f,"Text stream failed to download. Proceeding without it."):a.g.warn(f,"Text stream failed to parse. Proceeding without it."),
|
|
150
|
+
a.a.delete(_.H)):7001===v.code?(b.zb=!1,b.ob=null,iH(a,b,0)):3017===v.code?$H(a,b,v):1001===v.code&&v.data&&404===v.data[1]?(a.g.warn(f,"request for segment failed","segment not available on server",JC+e.position,KC+e.startTime,IC+e.endTime,"error\x3d"+v),b.zb=!1,b.ob=null,iH(a,b,1)):b.type===_.H?(v instanceof _.I&&v.a(1),cH(b),a.D.onError(new _.I(1,2,2010,v))):1001<=v.code&&1003>=v.code?yield aI(a,b,g,v):(a.g.error(f,"failed fetch and append: code\x3d"+v.code),b.Pc=!0,v instanceof _.I&&v.a(_.F),
|
|
151
|
+
yield SH(a,v)))}))})};sH=function(a,b){a=a.j.periods;const c=KD(a,b);a=a[c];if(!a)throw new _.I(_.F,5,5006,`No period found for stream with ID ${b.id}.`);return a};
|
|
152
|
+
LH=function(a,b,c,d){const e=$G(b);if(null==c)return a.g.warn(e,KB),null;c=kH(a,c);const f=b.stream.getSegmentReference(d);if(!f)return a.g.debug(e,"segment does not exist:",yC+c.startTime,"position\x3d"+d),null;var g=a.j.presentationTimeline;d=_.aE(g);g=$D(g);return!b.Ld&&(c.startTime+f.endTime<d||c.startTime+f.startTime>g)?(a.g.debug(e,"segment is not available:",yC+c.startTime,KC+f.startTime,IC+f.endTime,"availabilityStart\x3d"+d,"availabilityEnd\x3d"+g),null):f};
|
|
153
|
+
MH=function(a,b,c,d){const e=$G(b);d=kH(a,d);const f=Math.max(0,c-d.startTime);b=b.stream.findSegmentPosition(f);a.g.debug(e,"Looked up segment:",HC+c,"lookupTime\x3d"+f,yC+d.startTime,"Result: segment position\x3d"+b);null==b&&a.g.warn(e,"cannot find segment:",yC+d.startTime,"lookupTime\x3d"+f);return b};UH=function(a,b){const c=a.j.periods.findIndex(d=>d.id===b);return 0>c?null:a.j.periods[c+1]||null};
|
|
154
|
+
VH=function(a,b,c,d,e,f){return _.x(function*(){var g=c.startTime-f.Fa,h=b.$d||f.initSegment!==(b.sa&&b.sa.initSegment);if(!h&&g===b.dg)return Promise.resolve();b.dg=g;const k=$G(b);a.g.debug(k,"setting timestamp offset to "+g);a.g.debug(k,"setting append window start to "+d);a.g.debug(k,"setting append window end to "+e);g=a.D.aa.Za(b.type,g,d,e,b.stream.mimeType,b.stream.codecs);if(!b.stream.initSegmentReference||!h)return g;a.g.debug(k,"fetching init segment");h=XH(a,b,f&&f.initSegment||b.stream.initSegmentReference,
|
|
155
|
+
!0).then(l=>{if(a.f)return null;a.g.debug(k,"appending init segment");return bI(a,l,b).then(()=>a.D.aa.L(b.type,l,null,null,!!b.stream.closedCaptions&&0<b.stream.closedCaptions.size))}).catch(l=>{b.$d=!0;return Promise.reject(l)});return Promise.all([g,h])})};
|
|
156
|
+
WH=function(a,b,c,d,e,f,g,h){h=void 0===h?!1:h;return _.x(function*(){const k=$G(b);if(e&&e.keyId&&a.D.bd){var l=XC(a.D.bd,e.keyId);if(l)try{yield l}catch(n){a.g.warn("DRM session load failed, cannot append segment!")}else a.g.warn(`Unable to find DRM session for ${e.keyId}`)}if(e.encrypted&&e.keyId&&a.D.bd&&ZC(a.D.bd,e.keyId))return cH(b),l=sH(a,e).id,(l=cI(a,l))&&(yield l),l=a.D.pe(e,d,DC),a.g.warn(k,`Blocked append for ${f.startTime+d.startTime} - ${f.endTime+d.startTime}: ${l}. `+`Stream with Key ID ${e.keyId} has restrictions.`),
|
|
157
|
+
Promise.resolve();const m=e.closedCaptions&&0<e.closedCaptions.size;null!=e.emsgSchemeIdUris&&0<e.emsgSchemeIdUris.length&&(new _.Dm).ea("emsg",a.J.bind(a,d,f,e.emsgSchemeIdUris)).parse(g);return dI(a,b,c).then(()=>{if(a.f)return null;const n=f.startTime+d.startTime,r=f.endTime+d.startTime;a.g.debug(k,"Appending segment "+`with ${n.toFixed(3)} - ${r.toFixed(3)} `+`KeyID: ${e.keyId} `+`Width: ${e.width} Height: ${e.height} `+`Bitrate: ${_.tj(e.bandwidth)} `+`Fragment: ${h}`);return a.D.aa.L(b.type,
|
|
158
|
+
g,n,r,m,e.id,h,e.type===_.w&&null!=e.muxedAudioId&&!a.A)}).then(()=>{a.f||(a.g.debug(k,"appended media segment"),b.dc=e,b.sa=f)})})};
|
|
159
|
+
XH=function(a,b,c,d,e){d=void 0===d?!1:d;e=void 0===e?null:e;var f=[];const g=eI(a,c);g&&(f=_.ME(g,c.ud));f.length||(f=c.ab());f=_.PD(f,c.za,c.qa,a.h.attemptParameters,c.startTime,c.endTime,b.type,c.timescale);f.type=2;f.onFragment=c.Kc?null:e;f.disableFragmentSupport=c.Kc||a.h.disableFragmentSupport;f.disableMergedFragments=a.h.disableMergedFragments;if(e=c.f())f.keyInfo=e,f.onFragment=null;d&&(f.responseModifiers.push(h=>{fI(a,b,h.data)}),b.type===_.w&&a.h.overridePasp&&f.responseModifiers.push(a.K.bind(a)));
|
|
160
|
+
a.g.debug("fetching: reference\x3d",c);c=a.D.yb.fetch(f);b.Yb=c;return c.V.then(h=>{const k=a.D.dd(),l=h.timeMs,m=h.data.byteLength;l&&m&&!d&&k.segmentDownloaded(l,m);gI(a,g,h);b.Yb=null;return h.data}).catch(h=>{gI(a,g);throw h;})};
|
|
161
|
+
YH=function(a,b,c,d,e){if(!a.j.presentationTimeline.isLive()&&b.type!==_.H){var f=$G(b);const g=(a.D.aa.ma(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.g.debug(f,"Adjusted segment",d.position,"with real duration",g,"and accounted for",c,"delta between segment duration and real duration"),b.Ld=!0,a=a.j.periods,b=c,e.adjustSegmentDurations(d.position,b),d=KD(a,e),f=a[d],e=e.getDuration(),MD(f,e),e=d+1;e<a.length;e++)a[e].startTime+=b}};
|
|
162
|
+
ZH=function(a,b,c){if(!a.C){b=$G(b);var d=Array.from(a.a.values());1!==d.length||d[0].type!==_.H?a.C=d.every(e=>e.type===_.H||a.F?!0:!e.bc&&!e.mc&&e.sa):a.F&&(a.C=!0);a.C&&(a.g.debug(b,"startup complete"),c=sH(a,c).id,UH(a,c),cI(a,c))}};
|
|
163
|
+
$H=function(a,b,c){const d=$G(b);if(Array.from(a.a.values()).some(e=>e!==b&&e.Ue))a.g.debug(d,aC,"waiting for another stream to recover...");else{const e=Math.round(100*a.l);if(20<e)a.l-=.2;else if(4<e)a.l-=.04;else{a.g.error(d,"MediaSource threw QuotaExceededError too many times");b.Pc=!0;a.o=!0;a.D.onError(c);return}a.g.warn(d,aC,"reducing buffering goals by "+(100-Math.round(100*a.l))+"%");b.Ue=!0}iH(a,b,4)};
|
|
164
|
+
aI=function(a,b,c,d){return _.x(function*(){let e=!0;1001===d.code&&500<=d.data.status||(e=!a.D.pe(b.stream,c));e&&(b.Pc=!0,d.a(_.F),yield SH(a,d))})};bI=function(a,b,c){return _.x(function*(){if(a.h.patchEdgeWhenMixedContent&&_.Ik()){const d=XG(b);yield a.D.aa.L(c.type,d.buffer,null,null,!!c.stream.closedCaptions&&0<c.stream.closedCaptions.size)}})};
|
|
165
|
+
cI=function(a,b){let c=null;a.B.has(b)||(c=NH(a,b).then(()=>{a.f||(a.g.debug(uC),a.D.Je())}).catch(fD));OH(a);a.D.Th&&(a.g.debug("calling onStartupComplete()..."),a.D.Th());return c};
|
|
166
|
+
dI=function(a,b,c){if(a.f)return Promise.resolve();const d=$G(b);a.g.debug(d,"checking buffer length");const e=Math.max(a.h.bufferBehind,a.j.presentationTimeline.h),f=a.D.aa.Qa(b.type);if(null==f)return a.g.debug(d,"buffer behind okay because nothing buffered:",HC+c,sC+e),Promise.resolve();const g=c-f,h=g-e;if(.01>=h)return a.g.debug(d,"buffer behind okay:",HC+c,tC+g,sC+e,"underflow\x3d"+Math.abs(h)),Promise.resolve();a.g.debug(d,"buffer behind too large:",HC+c,tC+g,sC+e,"overflow\x3d"+h);return a.D.aa.remove(b.type,
|
|
167
|
+
f,f+h).then(()=>{a.f||a.g.debug(d,"evicted "+h+" seconds")})};fI=function(a,b,c){(new _.Dm).N(_.Oe,_.wm).N(_.qg,_.wm).N(_.Je,_.wm).N(_.Ne,_.wm).N(_.bg,_.wm).ea(_.dg,_.xm).N("encv",d=>{d.reader.skip(78);_.wm(d)}).N(_.Wf,_.wm).N("schi",_.wm).N("tenc",d=>{d.reader.skip(6);if(_.om(d.reader)){d.reader.skip(1);const e=_.$l(_.tm(d.reader,16));e!==b.stream.keyId&&(a.g.debug($G(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)};
|
|
168
|
+
eI=function(a,b){return a.D.Ic&&(b=b.Pa)?_.VE(a.D.Ic,b.id):null};gI=function(a,b,c){if(a.D.Ic&&b){c&&0===c.request.uriIndex||_.WE(a.D.Ic,b.la[0].serviceLocationId);const e=c.request;var d=c.timeMs;c=c.data.byteLength;d&&c&&(a=_.TE(a.D.Ic,b.la[e.uriIndex].serviceLocationId),_.KE(a.oe,d,c),a.wd=!0)}};
|
|
169
|
+
hI=function(a){const b=c=>c.video&&c.audio||c.video&&c.video.codecs.includes(",");if(a.some(c=>c.variants.some(b))){_.Gh("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)}};vF=function(a){if(!a.f||!a.C)return[];const b=iI(a),c=jI(a),d=[];for(const e of kI(a))a=hG(e),a.activeVideo=e.video===b,a.activeAudio=e.audio===c,d.push(a);return d};
|
|
170
|
+
wF=function(a,b,c){c=void 0===c?!1:c;var d=void 0===d?0:d;_.x(function*(){if(!a.f||!a.a)throw Error("Player not ready to select tracks.");var e=HF(a);if(!e)throw Error(cC);if(b){a.configuration.abr.enabled&&(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.h.disable());var f=lI(a).find(h=>h.id===b.id)||null;if(!f)throw a.log.error("No variant with id",b.id),Error("Variant not found.");if(!jG(f))throw a.log.error("Unable to switch to restricted track",
|
|
171
|
+
b.id),Error("Unable to switch to restricted track.");a.$=f.video.id;var g=yield a.j.loadVariant(f,e.id);IF(a.o,e).bb?g.video&&(mI(a,e,g.video,!1),_.zH(a.a,g.video,c,d)):(nI(a,e,g,!1),oI(a,g,c,d));null==a.oc&&(a.oc=a.nc);a.nc=new pI(f);qI(a,e.variants)}else a.$=null,null!=a.oc&&(a.nc=a.oc,a.oc=null),a.configuration.abr.enabled||(a.log.info("Enable ABR Selection"),a.configuration.abr.enabled=!0,a.h.enable()),e=qI(a,e.variants).variant,null==e||a.W||rI(a,e)})};
|
|
172
|
+
tI=function(a,b){_.x(function*(){if(a.configuration.streaming.disableAudioTracks)throw Error("Audio tracks are disabled by config.");if(!a.a||!a.f||!a.C)throw Error("Not ready to select audio track.");var c=(a.f.muxedAudioTracks||[]).find(k=>k.id===b);if(c)sI(a,c);else{var d=oH(a.a),e=nH(a.a);c=HF(a);if(!c)throw Error(cC);var f=lI(a).filter(k=>k.audio.id===b&&jG(k)),g=!1,h=void 0;if(d){if(h=f.find(k=>k.video.id===d.id),!h){a.log.debug("Cannot find exact variant, looking for anything else that matches with given audioId");
|
|
173
|
+
g=!0;const k=a.getTrackManager().Ia();if(k){const l=k.renditions.map(m=>m.id);h=f.find(m=>l.find(n=>n===String(m.video.id)))}}}else h=f[0];if(!h)throw Error("Variant with target audio track not found.");if(!IF(a.o,c).bb&&e.codecs.split(".")[0]!==h.audio.codecs.split(".")[0])throw a.log.warn("Cannot select audio track, codecs are not compatible with active track."),Error("Audio codecs not compatible with active audio.");e=yield a.j.loadVariant(h,c.id);h=e.audio;a.va=h.id;f=f.map(oF);a.h.setTracks(f);
|
|
174
|
+
nI(a,c,e,!1);g||a.W?oI(a,e,!0,0):CH(a.a,h)}})};zF=function(a,b){return _.x(function*(){if(a.Te!==b&&(a.Te=b,a.H===uI&&(a.L.getTextDisplayer().setTextVisibility(b),!a.configuration.streaming.alwaysStreamText)))if(b){var c=HF(a);c=_.lG(c.textStreams,a.Qb,a.Td,a.Pb);0<c.length&&(yield pH(a.a,c[0]))}else qH(a.a)})};
|
|
175
|
+
AF=function(a,b){return _.x(function*(){if(a.f&&a.a){var c=HF(a);const d=yield a.j.loadTextStream(b.id,c.id);yield pH(a.a,d);vI(a,c,d,!1);c=d;a.W?a.S=c:_.zH(a.a,c,!0,0);a.Qb=d.language;a.Pb=d.kind===_.le}})};DF=function(a){const b=a.Te;return a.f?a.L.getTextDisplayer().isTextVisible():b};
|
|
176
|
+
wI=function(a,b){a.l||(a.w.on(b,_.q,()=>{if(a.l.error){var c=a.l.error.code;if(1===c)c=null;else{var d=a.l.error.msExtendedCode;d&&(0>d&&(d+=Math.pow(2,32)),d=d.toString(16));c=new _.I(_.F,3,3016,{code:c,extendedError:d,message:a.l.error.message})}}else c=null;if(c)a.onError(c)}),a.l=b)};yI=function(a){return new _.xI(b=>{const c=a.getTrackManager(),d=[];if(c)for(const e of c.getVideoTracks())d.push(...e.renditions);return d.find(e=>e.id===b.toString())||null})};
|
|
177
|
+
zI=function(a,b){if(a.ha!==b)if(a.ha===_.ap&&b!==_.hp)b=oD(b,_.gp),a.log.info(_.dC+`${b}`);else{var c=a.jf;c=0===c?0:Date.now()-c;var d=a.ha;a.ha=b;a.jf=Date.now();null!==a.I&&(a.I.A=b===_.jp);a.G&&_.To(a.G.a,a.ha);b===_.dp&&(a.yg=a.Se?1:2);var e=a.yg,f={currentState:a.ha,previousState:d,timeSinceLastStateChangeMS:c,reason:b===_.dp||d===_.dp?e:void 0},g=oD(d,_.gp),h=oD(b,_.gp),k=b!==_.dp?"":`[${oD(e,_.fp)}]`;a.log.info(`Player state change: ${g} -> `+`${h}${k}`);a.trigger(new _.D(_.$f,{detail:f}));
|
|
178
|
+
(b===_.$o||b===_.ap)&&a.Aa&&a.Aa.stop();b===_.dp?a.trigger(new _.D(_.bd,{detail:{bufferedTimeMS:-1,reason:e}})):d===_.dp&&a.trigger(new _.D(_.ad,{detail:{bufferedTimeMS:c,reason:e}}))}};EI=function(a){return _.x(function*(){AI(a);yield BI(a);CI(a);if(_.Kk(4)||_.Kk(5)){const b=a.getSurface().getMedia();wI(a,b);yield DI(a,b)}a.configuration=a.ba})};
|
|
179
|
+
FI=function(a){return _.x(function*(){const b=a.A.a;b&&(yield b.catch(()=>{}));yield Object.getPrototypeOf(Object.getPrototypeOf(a)).release.call(a);yield a.unload();zI(a,_.hp)})};CI=function(a){a.l&&(a.w.off(a.l,_.q),a.l=null)};AI=function(a){if(a.H===GI)throw new _.I(_.F,7,7E3,"Player is destroyed.");};HI=function(a){return a.Y?a.Y.catch(()=>{}):Promise.resolve()};
|
|
180
|
+
II=function(a){const b=new _.Uv;(a=a.playlist)&&a.cropTimeline&&(a.startTime||a.endTime)&&(b.h={start:a.startTime||null,end:a.endTime||null});return b};MI=function(a,b){return _.x(function*(){a.G=new _.qv;zI(a,_.ip);const c=JI(a,a.configuration);yield DI(a,c);oG(a.A,b);a.K=new KI;dE(a.K,d=>{a.log.info("Timeline cue found",d);LI(a,_.kg,d)},()=>{a.log.info("Timeline cues changed");a.trigger(new _.D(_.ng))})})};
|
|
181
|
+
PI=function(a,b,c,d,e){return _.x(function*(){var f=_.np(b)[c];const g=yield NI(a,f);oG(a.A,d);_.Kn(EC);f=yield OI(a,g,f,b.id||"");oG(a.A,d);e&&f.presentationTimeline.l&&(yield g.stop(),oG(a.A,d));_.Kn("manifest.end");_.Mn("Fetch and parse manifest",EC,"manifest.end");return{parser:g,manifest:f}})};
|
|
182
|
+
TI=function(a,b,c){return _.x(function*(){_.Kn("initDrm.start");const d=new _.rp({yb:a.getNetworkEngine(),onError:h=>a.onError(h),Ne:h=>{if(a.a){var k=HF(a),l=!1,m=Object.keys(h);0===m.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 n=1===m.length&&"00"===m[0];n&&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.");
|
|
183
|
+
if(m.length){m=a.getPeriods();for(let A=0;A<m.length;A++){const E=m[A];for(var r of E.variants){var u=r;var v=[];u.audio&&v.push(u.audio);u.video&&v.push(u.video);u=v;for(var y of u)u=r.allowedByKeySystem,y.keyId&&(v=h[n?"00":y.keyId],v=!!v&&!QI.includes(v),r.allowedByKeySystem=v),u!==r.allowedByKeySystem&&(v=y.type,y.type===_.w&&(v=`video ${y.width}x${y.height}@`+`${_.tj(y.bandwidth)}`),a.log.warn("DRM Key not available for "+`KID: '${y.keyId}'. Applying restrictions to ${v}`)),E===k&&u!==r.allowedByKeySystem&&
|
|
184
|
+
(l=!0)}}}if(h=lH(a.a)){r=nH(a.a);y=oH(a.a);a:{n=h.variants;for(m=0;m<n.length;m++)if(n[m].audio===r&&n[m].video===y){n=n[m];break a}n=null}if(!n||n.allowedByKeySystem)a.log.info(LB),RI(a),qI(a,h.variants)}l&&h!==k&&(a.log.info(LB),RI(a),qI(a,k.variants))}},Me:(h,k)=>{a.trigger(new _.D(_.Xd,{expirationTime:k}))},onEvent:h=>a.ef(h),getConfiguration:()=>a.getConfiguration(),Oc:()=>a.Oc()});var e=b.periods.every(h=>h.variants.some(k=>k.drmInfos.some(l=>l.licenseServerUriOrigin===_.zC)));c.drmResolver&&
|
|
185
|
+
(c.drm=c.drmResolver({hasLaurl:e}));e=c.drm;var f=_.hm(e);d.f=f;e=e?e.offlineId||"":"";f=[];const g=_.$s(b.periods);if(e){const h=_.Ll(_.df);h&&(yield h.l(a,g),f=yield h.j(e))}yield _.ko(d,g,f);a.B=d;SI(a,b.periods);_.Kn("initDrm.end");_.Mn("Init DRM","initDrm.start","initDrm.end");return d})};
|
|
186
|
+
fJ=function(a,b){return _.x(function*(){const c=a.l;UI(a,c);VI(a,a.f.periods);a.nc=new WI(a.configuration.preferredAudioLanguage||[],a.configuration.preferredAudioRole,a.configuration.preferredAudioChannelCount,a.configuration.preferSpatialAudio,a.configuration.mediaSource.codecSwitchingStrategy);a.Qb=a.configuration.preferredTextLanguage;a.Td=a.configuration.preferredTextRole;a.Pb=a.configuration.preferForcedSubtitles;yield _.Co(a.B,c);oG(a.A,b);a.h.configure(a.configuration.abr);a.He&&a.h.setCmsdManager(a.He);
|
|
187
|
+
a.h.init((f,g,h)=>_.x(function*(){if(!a.W){var k=lI(a).find(l=>l.id===f.id)||null;if(k){const l=HF(a);k=yield a.j.loadVariant(k,l.id);rI(a,k,g,h)}else a.log.warn("No matching variant found for track switch")}}));a.C=XI(a,c,a.configuration.startTime);a.Ha=YI(a);a.I=new ZI({Uf:()=>c.playbackRate,ni:f=>{c.playbackRate=f},Qh:f=>{c.currentTime+=f}});SG(a.I,a.configuration.trickPlay);a.isLive()&&a.configuration.streaming.enableLiveEdgeChasing&&(a.Ud=new $I(a));aJ(a,Math.max(1E-4,a.configuration.streaming.rebufferingGoal));
|
|
188
|
+
bJ(a)?bG(a.f,_.pi(a.configuration.preferredVideoCodec),_.pi(a.configuration.preferredAudioCodec),a.configuration.preferredAudioChannelCount):aG(a.f,_.pi(a.configuration.preferredVideoCodec),_.pi(a.configuration.preferredAudioCodec),a.configuration.preferredAudioChannelCount);var d=cJ(a);d.h=a.configuration.streaming;a.a=d;a.H=uI;yield d.start();oG(a.A,b);a.configuration.streaming.startAtSegmentBoundary&&(d=dJ(a,DE(a.C)),wE(a.C.f,d));for(var e of a.f.periods)eJ(a,e);RI(a);e=lI(a);d=e.some(f=>f.primary);
|
|
189
|
+
a.configuration.preferredAudioLanguage||d||a.log.warn("No preferred audio language set. We will choose an arbitrary language initially");qI(a,e)})};
|
|
190
|
+
gJ=function(a,b){var c=a.getMediaPosition(),d=a.lc,e=b.periods,f=d.a;d.a=[];var g=null,h=null;for(var k of e)e=k.endTime-k.startTime,k.configurationId===g?h.a+=e:(g=k.configurationId||"",h=new _.Sv(g||"",k.startTime,e,!1),d.a.push(h));d.h&&(h=d.h.start,g=d.h.end,k=d.a[0],null!=h&&k&&h>=k.f&&h<=k.f+k.a&&(e=h-k.f,e<k.a&&(k.f=h,k.a-=e)),h=d.a[d.a.length-1],null!=g&&h&&g>=h.f&&g<=h.f+h.a&&(h.a=g-h.f));dD(d,c);a:if(c=f,d=d.a,c.length!==d.length)d=!1;else{for(f=0;f<c.length;f++)if(!c[f].Mc(d[f])){d=!1;
|
|
191
|
+
break a}d=!0}!d&&a.trigger(new _.D(_.Qf));gE(a.Wd);eE(a.K,b.cues)};iJ=function(a,b,c){b=hJ(a,b,c);c.catch(()=>{});c.reject(b);a.onError(b);throw b;};jJ=function(a,b){return _.x(function*(){const c=yield PI(a,b,0,null,!0);try{const d=[a.f,jF(c.manifest)],e=mF(d,a.f.presentationTimeline);return{parser:c.parser,manifest:e}}catch(d){throw new _.I(_.F,7,7003,"Failed to append load manifest");}})};
|
|
192
|
+
kJ=function(a,b){a.configuration.ads.hls.mockCuesFn?(b=a.configuration.ads.hls.mockCuesFn(a),eE(a.K,b)):eE(a.K,b)};lJ=function(a,b){return _.x(function*(){if(a.R===_.ma)kJ(a,b.cues);else if(a.R===_.rb){a.f=nF(a.f,jF(b));const c=a.configuration.playlist.endTime,d=a.f.presentationTimeline.a.a;c&&d>c&&(a.log.info("Reached end of playlist. Turning timeline static."),a.j.requestStop(),a.j=null,_.UD(a.f.presentationTimeline,!0),a.trigger(new _.D(_.Ce)));gJ(a,a.f)}else DH(a.a,b)})};
|
|
193
|
+
mJ=function(a){return _.x(function*(){a.j.requestStop();a.j=null;a.R===_.rb?a.trigger(new _.D(_.Pf)):a.trigger(new _.D(_.Ce))})};
|
|
194
|
+
BI=function(a){return _.x(function*(){a.H!==GI&&(a.H=nJ);const b=a.l;b&&(a.w.off(b,_.Ee),a.w.off(b,_.sf),a.w.off(b,_.cf),a.w.off(b,_.je),a.w.off(b,_.Gf),a.w.off(b,_.Ef));a.K&&(a.K.release(),a.K=null);a.Ha&&(a.Ha.release(),a.Ha=null);a.Aa&&(a.Aa.stop(),a.Aa=null);a.j&&(yield a.j.stop(),a.j=null);a.h&&(yield a.h.stop());a.a&&(yield a.a.destroy(),a.a=null);a.U&&(yield a.U.destroy(),a.U=null);a.C&&(a.C.release(),a.C=null);a.I&&(a.I.release(),a.I=null);a.L&&(yield a.L.destroy(),a.L=null);a.Oa&&(a.Oa.release(),
|
|
195
|
+
a.Oa=null);a.Ud&&(a.Ud.release(),a.Ud=null);b&&b.src&&(b.removeAttribute("src"),b.load());a.B&&(yield a.B.destroy(),a.B=null);a.o.clear();a.J=null;a.Vd.clear();a.f=null;a.G=null;a.W=!0;a.Za.clear();a.qc=!1;oJ(a)})};DI=function(a,b){return _.x(function*(){const c=window.muxjs?new pJ:new _.qJ,d=_.So(a.configuration,[_.qe,"single-native"]).create(a);a.O=d;const e=yI(a);e.track(a);a.Oa=e;let f=null;bJ(a)?f=new rJ(b,c,d,e,a.configuration):f=new _.sJ(b,c,d,e,a.configuration);yield f.open();a.L=f})};
|
|
196
|
+
tJ=function(a,b,c){c=void 0===c?!0:c;return _.x(function*(){const d=Date.now()/1E3,e=new _.rn;a.A.a=e;try{AI(a);yield HI(a);oG(a.A,e);a.ga=_.np(b);a.configuration=_.Il(a.ba,b);zD(a.configuration.xmlParser);a.Xe&&a.configuration.mse.sendPlaybackSessionIdHeader&&a.getNetworkEngine().headers.set(rC,a.Xe);a.log.info(_.cb,a.configuration);a.log.info(_.vb,a.ga);yield MI(a,e);oG(a.A,e);const f=yield PI(a,b,a.getSourceIndex(),e,!1);oG(a.A,e);a.j=f.parser;a.f=f.manifest;kJ(a,f.manifest.cues);a.B=yield TI(a,
|
|
197
|
+
a.f,a.configuration);oG(a.A,e);c&&(yield fJ(a,e),oG(a.A,e),a.w.one(a.l,_.Ee,()=>{const g=Date.now()/1E3-d;a.G&&(a.G.B=g)}));e.resolve()}catch(f){iJ(a,f,e)}})};vJ=function(a,b){return _.x(function*(){return a.configuration.contentSteering.enabled?(a.U||(a.U=new uJ(a.configuration.contentSteering,a.getNetworkEngine()),a.U.on(_.Ld,c=>{a.trigger(c)}),yield RE(a.U,b)),a.U):null})};
|
|
198
|
+
hJ=function(a,b,c){var d=a.A;return null!=d.a&&d.a===c||b instanceof _.I&&7E3===b.code?b instanceof _.I?b:new _.I(_.F,7,7003,"Unexpected error.",b):nG(a.A)};JI=function(a,b){const c=a.getSurface().getMedia();c.loop=!!b.loop;_.B(b.volume)||a.setVolume(b.volume);_.B(b.muted)||a.setMuted(b.muted);wI(a,c);return c};LI=function(a,b,c){a.trigger(new _.D(b,{detail:cE(c,wJ(a))}))};
|
|
199
|
+
NI=function(a,b){return _.x(function*(){var c=a.getNetworkEngine();c=yield _.bt(b.url,c,a.configuration.manifest.attemptParameters,b.type||null);c.configure(a.configuration.manifest);return c})};
|
|
200
|
+
OI=function(a,b,c,d){return(new _.vp(Promise.resolve().then(()=>_.x(function*(){let e=null;for(;!e;)try{{var f=b,g=c.url;const k=xJ(a,d);var h=f.start(g,k)}e=yield h}catch(k){if(a.Gc)if(f=yield a.Gc(c.url,k))c.url=f;else throw k;else throw k;}if(0===e.periods.length)throw new _.I(_.F,4,4014);hI(e.periods);return e})),()=>{a.log.info("Aborting parser step...");return b.stop()})).V};
|
|
201
|
+
oJ=function(a){if(a.G&&a.J&&a.C){var b=yJ(a)===_.dp,c=a.I;c.l=b;VG(c,c.o?"seek":void 0);a.C.j.o=b;zJ(a);a.Wd&&(c=1>Math.abs(a.getMediaDuration()-a.getMediaPosition()),a=a.Wd,b&&c&&(b=a.a,b.a[b.a.length-1]&&a.f(new _.D(_.Nf))))}};bJ=function(a){return a.configuration.mediaSource.codecSwitchingStrategy===_.Xf&&(_.Kk(2)||_.Kk(3)||_.Kk(4)||_.Kk(5)||_.Kk(6)||_.Nk()&&38===_.Ok().major||_.Nk()&&53===_.Ok().major||_.Nk()&&68===_.Ok().major?!1:!0)};
|
|
202
|
+
SI=function(a,b){var c=a.a?nH(a.a):null;const d=a.a?oH(a.a):null,e=!bJ(a);for(const g of b)gG(a.B,c,d,g,e);c=pD(b,g=>g.variants.some(jG));if(a.configuration.streaming.disableAudioTracks)for(var f of b)for(const g of f.variants)delete g.audio;if(a.configuration.streaming.disableVideoTracks)for(const g of b)for(const h of g.variants)(f=h.video)&&!qD(f.type,_.Bk(f.mimeType,f.codecs))&&delete h.video;if(0===c)throw new _.I(_.F,4,4032);if(c<b.length)throw new _.I(_.F,4,4011);for(const g of b)dG(g.variants,
|
|
203
|
+
a.configuration.restrictions)&&a.a&&HF(a)===g&&RI(a),AJ(a,g.variants)};UI=function(a,b){const c=d=>{a.l&&a.J&&(d.type===_.Sf&&a.jd?(a.J.a=BJ,oJ(a)):d.type===_.Og&&a.getState()===_.kp&&.1>a.getBufferInfo().Ca(a.getMediaPosition())?(a.J.a=BJ,oJ(a)):a.J&&CJ(a));zJ(a)};a.w.on(b,_.sf,c);a.w.on(b,_.cf,c);a.w.on(b,_.je,c);a.w.on(b,_.Sf,c);a.w.on(b,_.Rf,c);a.w.on(b,_.Ef,c);a.w.on(b,_.Og,c);a.w.on(b,_.Gf,()=>{if(a.l){var d=a.l.playbackRate;0!==d&&a.I.set(d)}})};
|
|
204
|
+
VI=function(a,b){for(let c=0;c<b.length;c++){const d=b[c],e=new Map;for(const f of lI(a))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.rf++,originalId:h,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:()=>null,getSegmentReference:()=>null,initSegmentReference:null,Fa:0,mimeType:_.Jc,codecs:"",kind:_.wC,encrypted:!1,keyId:null,language:g.closedCaptions.get(h),label:null,type:_.H,primary:!1,trickModeVideo:null,
|
|
205
|
+
emsgSchemeIdUris:null,roles:g.roles,channelsCount:null,spatialAudio:!1,closedCaptions:null};e.set(h,k)}}for(const f of e.values())d.textStreams.push(f)}};lI=function(a){return a.f.alternativeVariants&&0<a.f.alternativeVariants.length?a.f.alternativeVariants:a.C?HF(a).variants:a.f.periods[0].variants};HF=function(a){const b=DE(a.C);let c=null;for(const d of a.f.periods)d.startTime<=b&&(c=d);return c};
|
|
206
|
+
rI=function(a,b,c,d){c=void 0===c?!1:c;d=void 0===d?0:d;if(a.configuration.abr.enabled&&a.a){var e=DJ(a,b);if(IF(a.o,e).bb){const f=b.video;if(f){EJ(a,e,()=>mI(a,e,f,!0));e===HF(a)&&FJ(a);_.zH(a.a,f,c,d);return}}EJ(a,e,()=>{nI(a,e,b,!0)});e===HF(a)&&FJ(a);AH(a.a,b,c,d)}};XI=function(a,b,c){return new GJ(b,a.f,a.configuration.streaming,c,d=>{a.Ha&&FE(a.Ha,!0,d);a.a&&EH(a.a)},d=>a.dispatchEvent(d),a.R===_.rb)};
|
|
207
|
+
YI=function(a){const b=new HJ(a.l);var c=new IJ(a.f);RG(c,()=>{RI(a)});b.a.add(c);a.K&&(c=new JJ(a.K),HE(c,d=>{d.ae&&d.ae();LI(a,_.lg,d)},d=>{d.Le&&d.Le();LI(a,_.mg,d)},(d,e)=>{e||(d.ae&&d.ae(),LI(a,_.lg,d),d.Le&&d.Le(),LI(a,_.mg,d))}),b.a.add(c));a.R===_.rb&&(c=new KJ(a.lc,a.tc,d=>a.trigger(d),a.configuration.playlist),b.a.add(c),a.Wd=c);return b};aJ=function(a,b){a.J=new LJ(b,Math.min(.5,b/2));a.J.a=BJ;oJ(a);a.Aa=(new _.Gk(()=>{CJ(a)})).Eb(.25)};
|
|
208
|
+
cJ=function(a){const b={configuration:{Kh:a.R===_.rb},Jb:()=>DE(a.C),aa:a.L,yb:a.getNetworkEngine(),Ic:a.U,Ke:a.Eg.bind(a),Je:a.Dg.bind(a),onError:a.onError.bind(a),hg:a.Fg.bind(a),onEvent:a.ef.bind(a),lg:a.Jg.bind(a),ce:a.Gg.bind(a),dd:()=>a.h,pe:a.Cg.bind(a),vg:a.Ig.bind(a),bd:a.B};return new _.MJ(a.f,b)};
|
|
209
|
+
dJ=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=nH(a.a);var e=oH(a.a);const f=HF(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};
|
|
210
|
+
eJ=function(a,b){var c=a.a?nH(a.a):null;const d=a.a?oH(a.a):null,e=!bJ(a);gG(a.B,c,d,b,e);c=b.variants;if(a.configuration.streaming.disableAudioTracks)for(const f of c)delete f.audio;if(!c.some(jG))throw new _.I(_.F,4,4011);AJ(a,b.variants);dG(c,a.configuration.restrictions)&&a.a&&HF(a)===b&&RI(a);if(!_.Kk(2)&&(b=a.B?a.B.getDrmInfo():null))for(const f of c)for(const g of f.drmInfos)if(g.keySystem===b.keySystem)for(const h of g.initData||[])_.po(a.B,h.keyId,h.initData)||_.ro(a.B,h.initDataType,h.initData,
|
|
211
|
+
h.keyId)};RI=function(a){const b=a.getTrackManager();b&&a.H!==GI&&(b.m&&(GF(b),b.m.trigger(new _.D(_.pg))),FJ(a))};qI=function(a,b){b=NJ(a,b);if(!b)return{variant:null,bb:null};a=OJ(a,b);return{variant:b,bb:a}};
|
|
212
|
+
CJ=function(a){switch(a.H){case uI:a:if(a.l.ended||a.L.M())var b=!0;else{if(a.isLive()){b=$D(a.f.presentationTimeline);var c=a.getBufferInfo();if(null!==c&&(c=c.ma(),null!==c&&c>=b)){b=!0;break a}}b=!1}break;default:b=!1}if(a.L){var d=a.L.$();c=d.video;d=d.audio;var e=a.l.currentTime;c&&d?(c=c.Ca(e),d=d.Ca(e),c=Math.min(c,d)):c=c?c.Ca(e):d?d.Ca(e):0}else c=0;if(d=a.J){{d=a.J;var f=b;const g=d.f.get(d.a);e=d.a;c=f||c>=g?PJ:BJ;d.a=c;d=e!==c}}c=d;d=QJ(a);c||a.getState()===_.dp&&!d?(a.log.debug("Buffering state changed. Is buffering",
|
|
213
|
+
d,"buffered to end",b,"state",a.getState()),oJ(a)):a.qc&&zJ(a)};zJ=function(a){zI(a,yJ(a))};QJ=function(a){return a.B&&a.B.F?!0:a.J?a.J.getState()===BJ:!1};iI=function(a){const b=HF(a);return b?IF(a.o,b).video:null};jI=function(a){const b=HF(a);return b?IF(a.o,b).audio:null};kI=function(a){if(null==HF(a))return[];RJ(a);return lI(a).filter(b=>jG(b))};SJ=function(a){const b=HF(a);if(null==b)return[];RJ(a);return a.f.alternativeTextStreams?a.f.alternativeTextStreams:b.textStreams.filter(c=>!a.Vd.has(c))};
|
|
214
|
+
vI=function(a,b,c,d){qG(a.o,b,c);if(b=a.getTrackManager())KF(b,c.id,_.L,d),c=b.Va(),a=a.G.f,a.h!==c&&(a.h=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}))};
|
|
215
|
+
mI=function(a,b,c,d){const e=a.getTrackManager();if(e){var f=a.G.f;IF(a.o,b).video=c;KF(e,c.id,_.N,d);a=e.oa();f.j!==a&&(f.j=a,f.a.push({timestamp:Date.now()/1E3,id:a.id,trackId:a.track.id,type:a.track.type,fromAdaptation:d,width:a.width,height:a.height,bandwidth:a.bandwidth}))}};nI=function(a,b,c,d){a.j&&a.j.setCurrentVariant(c);c.video&&mI(a,b,c.video,d);c.audio&&TJ(a,b,c.audio,d)};oI=function(a,b,c,d){c=void 0===c?!1:c;d=void 0===d?0:d;a.W?(a.da=b,a.qf=c,a.Bg=d):AH(a.a,b,c,d)};
|
|
216
|
+
sI=function(a,b){const c=HF(a);if(!c)throw Error(cC);const d=c.variants.filter(g=>g.video&&g.video.muxedAudioId===b.groupId&&jG(g));if(0===d.length)throw Error("No variants containing muxed audio found.");let e=d[0];const f=oH(a.a);f&&(e=d.find(g=>g.video.id===f.id)||null);e&&e.video&&(a.va=b.id,a.log.info(`Select muxed audio track ${b.id}`),UJ(a,c,b,!1),BH(a.a))};UJ=function(a,b,c,d){b=IF(a.o,b);b.audio=null;b.bb=c;if(b=a.getTrackManager())a=a.G.f,KF(b,c.id,_.M,d),c=b.Ra(),aD(a,c,d)};
|
|
217
|
+
wJ=function(a){return a.R===_.rb&&"flat"===a.configuration.playlist.timeline};WJ=function(a,b,c){c=void 0===c?!0:c;_.x(function*(){var d=qI(a,b.variants).variant;a.va=d&&d.audio&&d.audio.id;d&&(d=yield a.j.loadVariant(d,b.id),nI(a,b,d,!0),oI(a,d,c));(d=VJ(a,b.textStreams))&&(a.configuration.streaming.alwaysStreamText||DF(a))&&(vI(a,b,d,!0),a.W?a.S=d:_.zH(a.a,d,!0,0))})};
|
|
218
|
+
TJ=function(a,b,c,d){const e=a.getTrackManager();if(e){var f=a.G.f;a=IF(a.o,b);a.audio=c;a.bb=null;KF(e,c.id,_.M,d);c=e.Ra();aD(f,c,d)}};
|
|
219
|
+
AJ=function(a,b){a=a.B?_.xh(a.B.Y):{};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])?QI.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 _.I(_.F,4,4012,{hasAppRestrictions:e,missingKeys:f,restrictedKeyStatuses:g});};
|
|
220
|
+
RJ=function(a){if(a.a&&a.f){var b=lH(a.a),c=HF(a);null!=b&&b===c&&(nH(a.a),oH(a.a),_.mH(a.a,_.H),IF(a.o,c),IF(a.o,c),IF(a.o,c),IF(a.o,c))}};yJ=function(a){if(a.jd)var b=!1;else if(a.l&&a.l.ended)b=!0;else{b=a.getMediaDuration();var c=a.getMediaPosition();b=a.qc&&0<=c&&b<=c?!0:!1}return b?_.$o:QJ(a)||a.jd?_.dp:a.l&&a.l.paused?_.jp:_.kp};
|
|
221
|
+
NJ=function(a,b){try{AJ(a,b)}catch(e){return a.onError(e),null}b=b.filter(e=>jG(e));var c=fF(b,a.va);b=a.nc.create(c);b=Array.from(b.values());var d=b.map(oF);a.h.setTracks(d);if(null!==a.$&&null!==a.va&&(d=b.find(e=>e.video.id===a.$&&e.audio.id===a.va),a.$=null,d))return d;if(a.configuration.abr.enabled||null===a.$)return c=a.h.chooseTrack(),pF(c,b);c=c.find(e=>null!==e.video&&e.video.id===a.$);return c?c:(a.log.warn("Selected video track not found. Falling back to ABR selection"),c=a.h.chooseTrack(),
|
|
222
|
+
pF(c,b))};OJ=function(a,b){return b&&b.video?(a=(a.f.muxedAudioTracks||[]).find(c=>c.groupId===b.video.muxedAudioId))&&a.primary?a:null:null};VJ=function(a,b){return _.lG(b,a.Qb,a.Td,a.Pb)[0]||null};
|
|
223
|
+
XJ=function(a,b){a.W=!0;a.h.disable();a.log.debug("Choosing new streams after period changed");var c=qI(a,b.variants);let d=c.variant;const e=c.bb;let f=VJ(a,b.textStreams);a.da&&(b.variants.includes(a.da)&&(d=a.da),a.da=null);a.S&&(b.textStreams.includes(a.S)&&(f=a.S),a.S=null);const g=d?d.video:null,h=d&&!e?d.audio:null;d&&a.j&&a.j.setCurrentVariant(d);g&&EJ(a,b,()=>mI(a,b,g,!0));h&&EJ(a,b,()=>TJ(a,b,h,!0));e&&EJ(a,b,()=>UJ(a,b,e,!0));f&&(a.configuration.streaming.alwaysStreamText||DF(a))&&EJ(a,
|
|
224
|
+
b,()=>vI(a,b,f,!0));b===HF(a)&&FJ(a);c=a.configuration.streaming.alwaysStreamText||DF(a)?f:null;return{video:g,audio:h,text:c,bb:e}};EJ=function(a,b,c){a.Za.has(b)||a.Za.set(b,[]);a.Za.get(b).push(c)};FJ=function(a){const b=HF(a);if(b){const c=a.Za.get(b)||[];for(a.Za.delete(b);c.length;)c.shift()()}};DJ=function(a,b){for(const c of a.f.periods)if(c.variants.some(d=>d.id===b.id))return c;return null};
|
|
225
|
+
YJ=function(a,b,c,d){return _.x(function*(){let e;try{e=yield _.bt(b.url,a.getNetworkEngine(),a.configuration.manifest.attemptParameters,b.type||null);e.configure(a.configuration.manifest);{var f=e,g=b.url;const G=xJ(a,a.configuration.id||"");var h=f.start(g,G)}const k=yield h;hI(k.periods);if(!k.periods.length)throw new _.I(_.F,4,4014);yield a.j.stop();a.j=e;const l=d&&d.id,m=c&&c.id;a.f.periods=k.periods;const n=ID(k.periods,DE(a.C))||k.periods[0];bJ(a)?bG(a.f,_.pi(a.configuration.preferredVideoCodec),
|
|
226
|
+
_.pi(a.configuration.preferredAudioCodec),a.configuration.preferredAudioChannelCount):aG(a.f,_.pi(a.configuration.preferredVideoCodec),_.pi(a.configuration.preferredAudioCodec),a.configuration.preferredAudioChannelCount);const r=gF(l,m,n.variants),u=VJ(a,n.textStreams);qI(a,n.variants);const v=r&&r.video,y=r&&r.audio;h=[];const A=new Set;for(const G of n.variants)G.video&&A.add(G.video),G.audio&&A.add(G.audio);const E=a.getNetworkEngine();for(const G of[...A,...n.textStreams])h.push(G.createSegmentIndex(E));
|
|
227
|
+
yield Promise.all(h);JH(a.a,_.p,y);JH(a.a,_.w,v);JH(a.a,_.H,u);r&&nI(a,n,r,!1);a.log.info("Switch CDN successful.")}catch(k){throw e&&(yield e.stop()),k;}})};xJ=function(a,b){return{networkingEngine:a.getNetworkEngine(),onContentSteeringInfoFound:c=>vJ(a,c),configurationId:b,filterNewPeriod:c=>eJ(a,c),filterAllPeriods:c=>SI(a,c),onEvent:c=>a.ef(c),onError:c=>a.onError(c),onUpdate:c=>lJ(a,c),onTurnedStatic:()=>mJ(a),dd:()=>a.h}};
|
|
228
|
+
ZJ=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)}};
|
|
229
|
+
$J=function(){const a=MediaSource.isTypeSupported;MediaSource.isTypeSupported=b=>"mp2t"===b.split(/ *; */)[0].split("/")[1].toLowerCase()?!1:a(b)};aK=function(){const a=MediaSource.prototype.addSourceBuffer;MediaSource.prototype.addSourceBuffer=function(...b){b=a.apply(this,b);b.abort=function(){};return b}};bK=function(){const a=SourceBuffer.prototype.remove;SourceBuffer.prototype.remove=function(b,c){return a.call(this,b,c-.001)}};
|
|
230
|
+
cK=function(){const a=MediaSource.isTypeSupported;MediaSource.isTypeSupported=b=>"opus"!==_.tD(b)&&a(b)};dK=function(a,b){const c=a.mode;a.mode=c===_.Tf?_.Tf:_.pe;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};TC=[112,115,115,104,0,0,0,0];_.eK=class{constructor(a,b,c,d,e,f="",g){this.ab=a;this.za=b;this.qa=c;this.keyInfo=d||null;this.Kc=_.B(e)?!1:!!e;this.ud=f;this.Pa=g}gd(){return this.qa?this.qa-this.za+1:null}f(){return this.keyInfo}};
|
|
231
|
+
_.jE=class{constructor(a,b,c,d,e,f,g,h=null,k=!1,l=null,m=null,n=null,r=null,u=[],v=null,y="",A){this.position=a;this.startTime=b;this.endTime=c;this.Fa=g;this.ab=d;this.za=e;this.qa=f;this.keyInfo=h||null;this.Kc=_.B(k)?!1:!!k;this.timescale=l;this.horizontalTiles=m;this.verticalTiles=n;this.durationPerTile=r;this.a=u||[];this.h=!1;this.initSegment=v;this.ud=y;this.Pa=A}getPosition(){return this.position}gd(){return this.qa?this.qa-this.za+1:null}f(){return this.keyInfo}};
|
|
232
|
+
_.wD=class{constructor(a,b,c,d,e,f,g){this.tagName=a;this.textContent=b;this.attributes=c;this.childNodes=d;this.localName=f;this.a=g}getAttribute(a){a=this.attributes[a];return null==a?null:a}};
|
|
233
|
+
_.yD=class{j(a,b){a=xD(a).childNodes[0];return b&&a.tagName!==b?null:a}h(a,b){a=this.a(a,b);return 1!==a.length?null:a[0]}a(a,b){return Array.from(a.childNodes).filter(c=>c.tagName===b)}f(a){return a.childNodes.every(b=>b.tagName===_.da||"#cdata"===b.tagName)?a.childNodes.map(b=>b.textContent).join(""):null}getAttributeNS(a,b,c){return(b=a.a.get(b))?a.attributes[`${b}:${c}`]||null:null}removeChild(a,b){a.childNodes=a.childNodes.filter(c=>c!==b)}};_.ah=_.yD.prototype;_.ah.Bd=_.ch(18);_.ah.ge=_.ch(16);
|
|
234
|
+
_.ah.Xd=_.ch(14);_.ah.Yd=_.ch(12);_.ah.fe=_.ch(10);_.ah.Hc=_.ch(8);_.ah.Nd=_.ch(6);_.ah.Z=_.ch(4);_.ah.rc=_.ch(2);_.ah.Rb=_.ch(0);_.fK=0;
|
|
235
|
+
_.xI=class{constructor(a=null){this.j=a;this.log=new _.S("clpp.renditions");this.T=[];this.h=this.player=null;this.f=!1}track(a){null!=this.player&&DD(this);a&&(this.player=a,this.player.on(_.Lf,this.a,this))}release(){DD(this);this.T=[];this.h=this.j=null}append(a,b,c=null){const d=this.j&&null!==c?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.T.find(f=>f.start>=a&&
|
|
236
|
+
f.end<=b);if(e)e.rendition=d,e.width=c.width,e.height=c.height,e.bandwidth=c.bandwidth,e.start=c.start,e.end=c.end;else{for(const f of this.T)a>=f.start&&a<f.end?f.end=a:b>=f.start&&b<f.end&&(f.start=b);this.T.push(c);this.T.sort(BD)}GD(this);this.a();this.player&&this.player.trigger(new _.D(_.Jg))}clear(){this.T=[];GD(this);this.player&&(this.player.trigger(new _.D(_.Jg)),this.player.trigger(new _.D(_.Wc)))}a(){if(this.player){var a=this.player.getMediaPosition();if(0<=a){a:{var b=this.T.length,
|
|
237
|
+
c=Number.MAX_SAFE_INTEGER;for(var d=0;d<b;d++){const e=this.T[d];c=Math.min(e.start,c);if(e.start<=a&&e.end>a){a=.1>e.end-a&&d<b-1?this.T[d+1].rendition:e.rendition;break a}if(e.start>a)break}a=0<b&&c>a&&.25>c-a?this.T[0].rendition:null}if(a&&this.h!==a&&(this.h=a,this.player)){c=b=-1;if(a)b=a.width||-1,c=a.height||-1;else if(d=this.player.getSurface().getMedia())b=d.videoWidth,c=d.videoHeight;this.player.trigger(new _.D(_.Zc,{detail:{width:b,height:c,bandwidth:a?a.bandwidth:null,rendition:a}}))}}}}};
|
|
238
|
+
_.gK=class{constructor(a){this.h=Math.exp(Math.log(.5)/a);this.f=this.a=0}};hK=class{constructor(a){this.a=this.h=0;this.f=a}Tb(){return this.h}getDuration(){return this.f?this.a-this.h:Infinity}};
|
|
239
|
+
_.iK=class{constructor(a,b,c,d,e,f){f=void 0===f?!1:f;this.j=a;this.F=b;this.J=c;this.A=this.f=Infinity;this.h=1;this.G=0;this.o=this.w=null;this.H=0;this.C=this.l=d;this.L=void 0===e?!0:e;this.g=new _.S("clpp.media.PresentationTimeline");this.M=f;this.K=null;this.a=new hK(d);this.I=null;this.B=this.j.type||null}uc(){return this.K}getDuration(){return 2===this.j.version?this.a.getDuration():this.f}getPresentationStartTime(){return this.F}offset(a){null!=this.w&&(this.w+=a);null!=this.o&&(this.o+=
|
|
240
|
+
a)}isLive(){return 2===this.j.version?!this.a.f:Infinity===this.f&&!this.l}nd(){return!this.l}};KI=class{constructor(){this.f=()=>{};this.h=()=>{};this.a=new Set}release(){this.f=()=>{};this.h=()=>{};this.a.clear()}cues(){return this.a}};KJ=class{constructor(a,b,c,d){this.a=a;this.h=null;this.j=b;this.f=c;this.o=d;"flat"===d.timeline&&d.cropTimeline&&(a=d.startTime||0,this.j.a=new _.Sv("crop",a,d.endTime?d.endTime-a:Infinity,!1))}release(){this.f=this.j=this.h=this.a=null}l(a){dD(this.a,a);gE(this)}};
|
|
241
|
+
mE=class{constructor(a,b,c){this.h=a;this.a=b;this.f=c;this.g=new _.S("clpp.media.SegmentIterator")}next(){var a=this.h.get(this.a);a&&0<a.a.length?(this.f+=1,a.ab().length&&this.f===a.a.length&&(this.a+=1,this.f=0)):(this.a+=1,this.f=0);a=hE(this);return{value:a,done:!a}}};
|
|
242
|
+
_.jK=class{constructor(a){this.a=a;this.g=new _.S("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.g.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.g.debug("SegmentIndex Ref "+a+" start: "+b.startTime+" end: "+b.endTime+" pos: "+
|
|
243
|
+
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.g.info("Apply offset"+a+" to segment index");for(const b of this.a)b.startTime+=a,b.endTime+=a,b.Fa-=a}h(a,b){a-=this.a[0].position;if(0<=a&&a<this.a.length)for(this.g.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 0===this.a.length?0:this.a[this.a.length-
|
|
244
|
+
1].endTime-this.a[0].startTime}replace(a){this.a=a}};xE=class{constructor(a,b){this.h=a;this.l=pE(a);this.a=a.a.currentTime;this.j=Date.now()/1E3;this.o=b;this.f=()=>{}}release(){this.h=null;this.f=()=>{}}};yE=class{constructor(a){this.a=a}};
|
|
245
|
+
kK=class{constructor(a,b,c,d,e){this.a=a;this.G=b;this.h=c;this.F=e;this.j=new _.St;this.C=!1;this.I=a.readyState;this.l=!1;this.f=d;this.B=this.o=this.H=this.A=!1;this.j.on(a,_.Og,()=>qE(this));this.w=(new _.Gk(()=>{qE(this)})).Eb(.25)}release(){this.j&&(this.j.release(),this.j=null);null!=this.w&&(this.w.stop(),this.w=null);this.f&&(this.f.release(),this.f=null);this.a=this.G=this.F=null;this.o=!1}ce(){this.A=!0;qE(this)}};
|
|
246
|
+
lK=class{constructor(a,b){this.f=a;this.o=b;this.l=this.h=this.j=0;this.a=new _.Gk(()=>{0>=this.j?(_.C(["Failed to move playhead from",this.h,"to",this.l].join(" ")),this.a.stop()):this.f.currentTime!==this.h?this.a.stop():(this.f.currentTime=this.l,this.j--)})}release(){this.a&&(this.a.stop(),this.a=null);this.f=null}};
|
|
247
|
+
mK=class{constructor(a,b,c,d){this.a=a;this.j=b;this.o=d;this.A=c;this.l=!1;this.f=new _.St;this.h=new lK(a,10);this.w=!1;0<a.readyState?tE(this,c):uE(this,c)}release(){this.f&&(this.f.release(),this.f=null);null!=this.h&&(this.h.release(),this.h=null);this.j=()=>{};this.a=null;this.o=()=>{};this.w=!1}};
|
|
248
|
+
GJ=class{constructor(a,b,c,d,e,f,g){this.h=a;this.a=b.presentationTimeline;this.B=b.minBufferTime||0;this.l=c;this.A=e;this.w=null;this.j=new kK(a,b.presentationTimeline,c,zE(this,a,c),f);this.f=new mK(a,()=>{a:{var h=this.j;var k=h.B;h.B=!1;h.C=!0;h.A=!1;h.l=!1;h=k;k=vE(this.f);const l=EE(this,k);if(Math.abs(l-k)>this.l.gapTolerance){const m=(new Date).getTime()/1E3;if(!this.w||this.w<m-1){this.w=m;wE(this.f,l);h=void 0;break a}}this.g.debug("Seek to "+k);this.A(h?1:0);h=void 0}return h},CE(this,
|
|
249
|
+
d,g),()=>{this.j.H=!0});this.o=(new _.Gk(()=>{if(0!==this.h.readyState&&!this.h.paused){var h=vE(this.f),k=SD(this.a),l=bE(this.a);3>l-k&&(k=l-3);h<k&&(k=EE(this,h),this.g.info("Jumping forward "+(k-h)+" seconds to catch up with the seek range."),this.h.currentTime=k)}})).Eb(.25);this.g=new _.S("clpp.mse.Playhead")}release(){this.f&&(this.f.release(),this.f=null);this.j&&(this.j.release(),this.j=null);this.o&&(this.o.stop(),this.o=null);this.h=this.f=this.a=this.l=null;this.A=()=>{}}};
|
|
250
|
+
HJ=class{constructor(a){this.f=a;this.a=new Set;this.h=(new _.Gk(()=>{FE(this,!1)})).Eb(.25)}release(){this.h.stop();for(const a of this.a)a.release();this.a.clear()}};
|
|
251
|
+
JJ=class{constructor(a){this.j=a;this.o=new Map;this.a=()=>{};this.f=()=>{};this.h=()=>{};this.w=[{Dc:null,Cc:2,vc:(b,c)=>this.a(b,c)},{Dc:1,Cc:2,vc:(b,c)=>this.a(b,c)},{Dc:3,Cc:2,vc:(b,c)=>this.a(b,c)},{Dc:2,Cc:1,vc:(b,c)=>this.f(b,c)},{Dc:2,Cc:3,vc:(b,c)=>this.f(b,c)},{Dc:1,Cc:3,vc:(b,c)=>this.h(b,c)},{Dc:3,Cc:1,vc:(b,c)=>this.h(b,c)}]}release(){this.j=null;this.o.clear();this.a=()=>{};this.f=()=>{};this.h=()=>{}}l(a,b,c){if(this.j)for(const d of this.j.cues()){const e=this.o.get(d)||null,f=GE(d,
|
|
252
|
+
a);this.o.set(d,f);const g=this.w.find(h=>h.Dc===e&&h.Cc===f);g&&g.vc(d,b&&0===c)}}};SE=class{constructor(){this.f=new _.gK(2);this.h=new _.gK(5);this.a=0}getBandwidthEstimate(a){return 128E3>this.a?a:Math.min(_.OD(this.f),_.OD(this.h))}};_.UE=class{constructor(a,b){this.id=a;this.la=b}};
|
|
253
|
+
uJ=class extends _.Cu{constructor(a,b){super();this.A=a;this.h=null;this.B=b;this.C=new _.vu;this.f=300;this.o=new Map;this.l=new Map;this.w=new Map;this.j=new Map;this.a=null;this.g=new _.S("clpp.net.ContentSteeringManager")}destroy(){this.B=this.h=this.A=null;this.o.clear();this.l.clear();this.j.clear();this.w.clear();null!=this.a&&(this.a.stop(),this.a=null);return this.C.destroy()}};
|
|
254
|
+
nK=class{constructor(a,b){this.w=null;this.C=a;this.j=b;this.h=this.A=0;this.l=Infinity;this.f=this.a=null;this.B="";this.o=new Map}destroy(){this.j=this.w=null;this.o.clear();return Promise.resolve()}remove(a,b){return Promise.resolve().then(()=>{!this.j||!this.j.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))})}Qa(){return this.a}ma(){return this.f}Mb(a){return null==this.a||null==this.f?!1:a>=
|
|
255
|
+
this.a&&a<this.f}Ca(a){return null==this.f||this.f<a?0:this.f-Math.max(a,this.a)}};var oK=class extends _.T{constructor(){super();this.g=new _.S("clpp.mse.TrackManager");this.m=null;this.h=[];this.a=new Map;this.f=new Map}initialize(a){this.m=a}release(){this.h=[];this.a.clear();this.f.clear()}load(){}destroy(){this.release();this.m=null}getVideoTracks(){return qF(this,_.N)}getAudioTracks(){return qF(this,_.M)}na(){return qF(this,_.L)}oa(){return this.a.get(_.N)||null}Ra(){return this.a.get(_.M)||null}Va(){return this.a.get(_.L)||null}vb(){return this.f.get(_.N)||null}Gb(){return this.f.get(_.M)||
|
|
256
|
+
null}Hb(){return this.f.get(_.L)||null}Ia(){return rF(this,_.N)}ra(){return rF(this,_.M)}xa(){return rF(this,_.L)}Db(a){this.m&&sF(this,_.N,a)}ya(a){this.m&&sF(this,_.M,a)}Xa(a){this.m&&sF(this,_.L,a)}nb(a,b){b=void 0===b?!1:b;if(this.m)if(a)xF(this,a,b);else if(a=b,b=rF(this,_.N))this.g.info("Unset video rendition."),b.trickPlay?this.g.info("Enabling ABR for trick play tracks is not supported"):(this.g.info("Enable ABR."),wF(this.m,null,a))}Bb(a){this.m&&(a?(tF(this,a,_.M),uF(this,a,_.M)&&(this.g.info(`Set audio rendition with ID: ${a.id}`),
|
|
257
|
+
this.f.set(_.M,a),tI(this.m,parseInt(a.id,10)))):this.g.info("Enabling ABR for audio is not supported"))}addTextTrack(a){const b=this;return _.x(function*(){b.m&&(yield b.m.addTextTrack(a.url,a.language,a.kind,a.mimeType,a.codec,a.label))})}ua(){return!!this.m&&this.m.ua()}Cb(a){if(this.m){var b=a;if(!a){const c=this.Va();if(c&&c.track.kind!==_.le){a=this.na().find(d=>d.kind===_.le&&d.language===c.track.language);if(!a){const d=this.ra();d&&(a=this.na().find(e=>e.kind===_.le&&e.language===d.language))}a&&
|
|
258
|
+
(b=a.renditions[0])}}b?BF(this,b):CF(this)}}};oK.prototype.setTextRendition=oK.prototype.Cb;oK.prototype.isAbrEnabled=oK.prototype.ua;oK.prototype.addTextTrack=oK.prototype.addTextTrack;oK.prototype.setAudioRendition=oK.prototype.Bb;oK.prototype.setVideoRendition=oK.prototype.nb;oK.prototype.setTextTrack=oK.prototype.Xa;oK.prototype.setAudioTrack=oK.prototype.ya;oK.prototype.setVideoTrack=oK.prototype.Db;oK.prototype.getTextTrack=oK.prototype.xa;oK.prototype.getAudioTrack=oK.prototype.ra;
|
|
259
|
+
oK.prototype.getVideoTrack=oK.prototype.Ia;oK.prototype.getLoadingTextRendition=oK.prototype.Hb;oK.prototype.getLoadingAudioRendition=oK.prototype.Gb;oK.prototype.getLoadingVideoRendition=oK.prototype.vb;oK.prototype.getTextRendition=oK.prototype.Va;oK.prototype.getAudioRendition=oK.prototype.Ra;oK.prototype.getVideoRendition=oK.prototype.oa;oK.prototype.getTextTracks=oK.prototype.na;oK.prototype.getAudioTracks=oK.prototype.getAudioTracks;oK.prototype.getVideoTracks=oK.prototype.getVideoTracks;var pJ;pJ=class{constructor(){this.a=new muxjs.mp4.CaptionParser;this.l=[];this.j={}}init(a){const b=muxjs.mp4.probe;a=_.K(a);this.l=b.videoTrackIds(a);this.j=b.timescale(a)||{};this.a.init()}h(a,b){a=_.K(a);(a=this.a.parse(a,this.l,this.j))&&a.captions&&b(a.captions);this.a.clearParsedCaptions()}f(){this.a.resetCaptionStream()}};_.qJ=class{init(){}h(){}f(){}};var MF;
|
|
260
|
+
_.sJ=class{constructor(a,b,c,d,e){this.j=a;this.G=c;this.a={};this.O=!1;this.f=null;this.h={};this.l=new _.St;this.J=!1;this.w={};this.I=b;this.F=d;this.R=e;this.Oa=this.R.streaming.maxSegmentToMediaOffset||1;this.K=new _.rn;this.B="";this.H={};this.o=NF(this,this.K);this.S=!0;this.g=new _.S("clpp.mse.MediaSourceEngine")}destroy(){window.ManagedMediaSource&&(this.j.disableRemotePlayback=!1);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(fD));for(b=
|
|
261
|
+
1;b<d.length;++b)d[b].p.catch(fD),d[b].p.reject()}this.f&&a.push(this.f.destroy());this.G&&a.push(this.G.destroy());for(const c in this.w)this.w[c].destroy(),delete this.w[c];return Promise.all(a).then(()=>{this.l&&(this.l.release(),this.l=null);this.j&&(this.j.removeAttribute("src"),this.j.load(),this.j=null);this.B="";this.G=this.f=this.o=null;this.a={};this.w={};this.H={};this.I=null;this.O=!1;for(const c in this.h);this.h={}})}open(){return this.K}init(a,b,c){c=void 0===c?!1:c;const d=this;return _.x(function*(){yield d.K;
|
|
262
|
+
a.forEach((e,f)=>{const g=_.Bk(e.mimeType,e.codecs);if(f===_.H)d.A(g);else{var h=new Map;h.set(f,g);_.Is(g)&&b&&!e.aesEncrypted||!_.Ak(g,f)||!(e=_.Ak(g))||(h=e(),d.w[f]=h,h=h.demuxMimeTypes(f,g),c&&h.delete(_.p));OF(d,h);d.O=h.has(_.p)&&h.has(_.w)}})})}Ha(){this.g.debug(iC);Object.values(this.w).forEach(a=>a.reset())}Aa(){return this.R.streaming.ignoreManagedMediaSourceStreamingHints?!0:this.S}A(a){this.f||(this.f=new nK(this.R,this.G));ZE(this.f,a)}M(){return this.o?this.o.readyState===_.je:!0}Qa(a){return a===
|
|
263
|
+
_.H?this.f.Qa():(a=PF(this,a))?a.Qa():null}ma(a){return a===_.H?this.f.ma():(a=PF(this,a))?a.ma():null}Mb(a,b,c){return a===_.H?this.f.Mb(b):(a=PF(this,a))?a.Mb(b,!1,c):!1}Ca(a,b){return a===_.H?this.f.Ca(b):(a=PF(this,a))?a.Ca(b):0}$(){const a={};a.total=new _.Bu(this.j.buffered,"total");a.audio=PF(this,_.p);a.video=PF(this,_.w);let b=[];this.f&&(b=[{start:this.f.Qa(),end:this.f.ma()}]);a.text=uD(b,_.H);return a}L(a,b,c,d,e,f,g,h){g=void 0===g?!1:g;h=void 0===h?!1:h;const k=this.a[a];let l=-1,m=
|
|
264
|
+
0;k&&k.buffered&&(m=k.buffered.length);a===_.w&&null!==c&&null!==d&&g&&(l=0<m?k.buffered.end(m-1):-1);a===_.H?h=$E(this.f,b,c,d):this.w[a]?(b=this.w[a].transmux(b),b.captions&&0<b.captions.length&&(this.f||this.A(_.hg),bF(this.f,b.captions,c,d,this.a.video.timestampOffset)),e=[],0<b.audio.byteLength&&this.a.audio&&!h&&e.push(SF(this,_.p,this.U.bind(this,_.p,b.audio.buffer))),0<b.video.byteLength&&this.a.video&&e.push(SF(this,_.w,this.U.bind(this,_.w,b.video.buffer))),h=Promise.all(e)):(e&&window.muxjs&&
|
|
265
|
+
(this.f||this.A(_.hg),null==c&&null==d?this.I.init(b):this.I.h(b,n=>{n.length&&bF(this.f,n,c,d,this.a.video.timestampOffset)})),h=SF(this,a,this.U.bind(this,a,b)));return h.then(()=>{if(a===_.w&&null!==c&&null!==d&&!g)this.F.append(c,d,f),null!==c&&null!==d&&this.g.debug(HB,c,d,JB,QF(this,a));else if(a===_.p&&null!==c&&null!==d)ED(this.F),null!==c&&null!==d&&this.g.debug(GB,c,d,JB,QF(this,a));else if(a===_.w&&null!==c&&null!==d&&g){var n=k.buffered.length,r=0<n?k.buffered.end(n-1):-1;0>l&&0<n&&(l=
|
|
266
|
+
k.buffered.start(0));0<=l&&0<r&&this.F.append(l,r,f)}if(!this.H[a]&&k&&1===k.buffered.length){n=k.buffered.start(0);const u=c-n;if(Math.abs(u)>this.Oa&&0===k.timestampOffset)return this.g.warn(`Detected a delta of ${u} between `+`media times and segment times for ${a}. `+`The segment start time is ${c} and the media start time `+`is ${n}. Adjusting timestampOffset.`),n=SF(this,a,()=>{this.ha(a,u)}),r=SF(this,a,this.W.bind(this,a,!1)),Promise.all([n,r])}null!==c&&null!==d&&(this.H[a]=!0)}).catch(n=>
|
|
267
|
+
{throw n;})}va(a){const b=this.ma(_.w)||0;aF(this.f,a,b)}da(){this.f&&aF(this.f,"",0)}remove(a,b,c){return a===_.H?this.f.remove(b,c):SF(this,a,this.ba.bind(this,a,b,c)).then(()=>{if(a===_.w){const d=this.Qa(a),e=this.ma(a);null!==d&&null!==e&&HD(this.F,d,e)}else a===_.p&&FD(this.F)})}clear(a){if(a===_.H){if(!this.f)return Promise.resolve();this.I.f();return this.f.remove(0,Infinity)}return SF(this,a,this.ba.bind(this,a,0,this.o.duration))}flush(a){return a===_.H?Promise.resolve():SF(this,a,this.W.bind(this,
|
|
268
|
+
a))}Za(a,b,c,d){const e=this;return _.x(function*(){if(a===_.H){e.f.A=b;var f=e.f;f.h=c;f.l=d}else f=TF(e,a,b,c,d),e.O&&(f=f.concat(TF(e,_.p,b,c,d))),yield Promise.all(f)})}endOfStream(a){return VF(this,()=>{this.M()||(a?this.o.endOfStream(a):this.o.endOfStream())})}Y(a){VF(this,()=>{this.o.duration=a})}getDuration(){return this.o.duration}U(a,b){this.g.debug(IB+a+zB);try{this.a[a].appendBuffer(b)}catch(c){throw this.g.warn(TB+a,c),c;}this.g.debug(NB+a+zB)}ba(a,b,c){if(c<=b)this.C(a);else{this.g.debug(hC+
|
|
269
|
+
a+BB,b,c);try{this.a[a].remove(b,c)}catch(d){throw this.g.warn(VB+a+AB,b,c,d),d;}this.g.debug(PB+a+BB,b,c)}}pb(a){try{this.g.debug(FB+a+zB);const b=this.a[a].appendWindowStart,c=this.a[a].appendWindowEnd;this.a[a].abort();this.a[a].appendWindowStart=b;this.a[a].appendWindowEnd=c}catch(b){throw this.g.warn(SB+a+zB,b),b;}this.g.debug(MB+a+zB);this.C(a)}W(a){try{this.j.readyState>HTMLMediaElement.HAVE_NOTHING?(this.g.debug(YB+a),this.j.currentTime-=.001):this.g.warn(mC+a+CB+this.j.readyState)}catch(b){throw this.g.warn(UB+
|
|
270
|
+
a,b),b;}this.g.debug(OB+a);this.C(a)}ha(a,b){0>b&&(b+=.001);try{this.g.debug(lC+a,b),this.a[a].timestampOffset=b}catch(c){throw this.g.warn(XB+a,b,c),c;}this.g.debug(RB+a,b);this.C(a)}Qb(a,b,c){try{this.g.debug(jC+a,b,c),this.a[a].appendWindowStart=0,this.a[a].appendWindowEnd=c,this.a[a].appendWindowStart=b}catch(d){throw this.g.warn(WB+a,b,c,d),d;}this.g.debug(QB+a,b,c);this.C(a)}Pb(a){this.h[a][0].p.reject(new _.I(_.F,3,3014,{mediaError:this.j.error?this.j.error.code:0}))}C(a){const b=this.h[a][0];
|
|
271
|
+
b&&(b.p.resolve(),this.g.debug(pC+a),UF(this,a))}getTextDisplayer(){return this.G}};MF=window.URL.createObjectURL;_.pK=class{constructor(){this.g=new _.S("clpp.abr");this.A=null;this.l=!1;this.w=new SE;this.f=[];this.o=1;this.C=this.B=!1;this.j=this.a=this.h=null}stop(){this.A=null;this.l=!1;this.f=[];this.o=1;this.h=null;this.C=!1}init(a){this.A=a}chooseTrack(){let a=mG(this,!this.C&&this.a.initialRestrictions?this.a.initialRestrictions:this.a.restrictions,this.f);var b=this.getBandwidthEstimate();this.f.length&&!a.length&&(this.g.warn("No tracks met the ABR restrictions. Choosing a track by lowest bandwidth."),
|
|
272
|
+
a=mG(this,null,this.f),a=[a[0]]);this.h=Date.now();this.C=!0;{var c=a;let e=c[0]||null;for(let f=0;f<c.length;f++){const g=c[f];var d=c[f+1];const h=isNaN(this.o)||0===this.o?1:Math.abs(this.o),k=h*g.bandwidth,l=k/this.a.bandwidthDowngradeTarget;d=h*(d?d.bandwidth:Infinity)/this.a.bandwidthUpgradeTarget;this.g.debug("Bandwidth ranges:",(k/1E6).toFixed(3),(l/1E6).toFixed(3),(d/1E6).toFixed(3));b>=l&&b<=d&&(e=g)}b=e}return b||a[0]||this.f[0]}enable(){this.l=!0}disable(){this.l=!1}segmentDownloaded(a,
|
|
273
|
+
b){this.g.debug("Segment downloaded:","deltaTimeMs\x3d"+a,"numBytes\x3d"+b,"lastTimeChosenMs\x3d"+this.h,"enabled\x3d"+this.l);_.KE(this.w,a,b);if(null!=this.h&&this.l)a:{this.g.debug("Suggesting Streams...");if(!this.B){if(!(128E3<=this.w.a)){this.g.debug("Still waiting for a good estimate...");break a}this.B=!0;if(this.a.useSwitchIntervalForInitialSwitch&&Date.now()-this.h<1E3*this.a.switchInterval){this.g.debug("Skipping initial estimation switch due to switch interval...");break a}}else if(Date.now()-
|
|
274
|
+
this.h<1E3*this.a.switchInterval){this.g.debug("Still within switch interval...");break a}a=this.chooseTrack();b=this.getBandwidthEstimate();this.g.debug("Calling switch_(), bandwidth\x3d"+Math.round(b/1E3)+" kbps");a&&this.A(a)}}playbackRateChanged(a){this.o=a}getBandwidthEstimate(){if(this.j&&this.a.useCmsd){var a=bD(this.j,_.ke);a=null==a?null:a;if(null!==a)return this.g.debug("Using CMSD estimatedThroughputKbps:",a),1E3*a}return this.w.getBandwidthEstimate(this.a.defaultBandwidthEstimate)}setTracks(a){this.f=
|
|
275
|
+
a}setCmsdManager(a){this.j=a}configure(a){this.a=a}reset(){this.B=!1;this.w=new SE;const a=this.chooseTrack();a&&this.A(a)}};var qK=class{constructor(){this.a=null}};var rK=class{constructor(){this.a=new Map}clear(){this.a.clear()}},pG=class{constructor(){this.text=this.video=this.bb=this.audio=null}};var sK=class{constructor(a,b){this.f=a;this.a=new Set([a]);b=b||[];for(const c of b)this.add(c)}add(a,b){b=void 0===b?!0:b;if(tG(this.f,a,void 0===b?!0:b))return this.a.add(a),!0;_.C("Dropping variant due to incompatible codecs for the current adaptation set. This may be because CodecSwitchingStrategy is set to PREVENT or SourceBuffer.changeType() is not available on this platform. Variant dropped:",a,"because it is not compatible with",this.f);return!1}values(){return this.a.values()}};var pI=class{constructor(a,b){b=void 0===b?_.Cf:b;this.f=a;this.a=b;this.h=new WI(a.language,"",a.audio&&a.audio.channelsCount?a.audio.channelsCount:0,!1,b)}create(a){const b=this.a===_.Xf&&AD(),c=a.filter(d=>tG(this.f,d,!b));return c.length?new sK(c[0],c):this.h.create(a)}},WI=class{constructor(a,b,c,d,e){this.j=_.pi(a);this.a=b;this.f=c;this.l=void 0===d?!1:d;this.h=void 0===e?_.Cf:e}create(a){var b=AG(a,this.j);0<b.length&&(a=b);b=!1;if(this.a){var c=BG(a,this.a);0<c.length?(a=c,b=!0):_.C("No exact match for preferred variant role could be "+
|
|
276
|
+
`found. Role: ${this.a}`)}b||(b=a.filter(d=>d.primary),0<b.length&&(a=b));this.f&&(b=XF(a,this.f),b.length?a=b:_.C("No exact match for the channel count could be found."));b=CG(a,this.l);b.length?a=b:_.C("No exact match for spatial audio could be found.");b=this.h===_.Xf&&AD();c=new sK(a[0]);for(const d of a)c.add(d,!b);return c}};var LJ=class{constructor(a,b){this.a=PJ;this.f=(new Map).set(PJ,b).set(BJ,a)}getState(){return this.a}},BJ=0,PJ=1;var $I=class{constructor(a){this.D=a;this.a=a.getConfiguration().streaming;this.f=new _.St;this.g=new _.S("clpp.mse.media.LiveEdgeObserver");DG(this)&&(a=this.D.getSurface().getMedia(),this.f.on(a,_.og,()=>{{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.g.debug("Too far from edge, jump to beginning."),this.D.setPlaybackRate(1),this.D.seek(c)):1===d&&b>=this.a.startChasingAt?(this.g.debug("Not on live edge, increase playback rate."),
|
|
277
|
+
this.D.setPlaybackRate(this.a.chasingRate,_.Pd)):1<d&&b<=e&&(this.g.debug("On live edge, reduce playback rate."),this.D.setPlaybackRate(1))}}))}release(){this.f.release()}};var rJ=class{constructor(a,b,c,d,e){this.j=a;this.G=c;this.a={};this.H={};this.S=!1;this.f=null;this.h={};this.l=new _.St;this.O=!1;this.w={};this.J=b;this.F=d;this.K=e;this.Oa=this.K.streaming.maxSegmentToMediaOffset||1;this.R=new _.rn;this.B="";this.I={};this.o=FG(this,this.R);this.U=!0;this.g=new _.S("clpp.mse.MediaSourceEngineSmooth")}destroy(){this.O=!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(fD));for(b=1;b<d.length;++b)d[b].p.catch(fD),
|
|
274
278
|
d[b].p.reject()}this.f&&a.push(this.f.destroy());this.G&&a.push(this.G.destroy());for(const c in this.w)this.w[c].destroy(),delete this.w[c];return Promise.all(a).then(()=>{this.l&&(this.l.release(),this.l=null);this.j&&(this.j.removeAttribute("src"),this.j.load(),this.j=null);this.B="";this.G=this.f=this.o=null;this.a={};this.w={};this.I={};this.J=null;this.S=!1;for(const c in this.h);this.h={}})}open(){return this.R}init(a,b,c){c=void 0===c?!1:c;const d=this;return _.x(function*(){yield d.R;a.forEach((e,
|
|
275
|
-
f)=>{const g=_.
|
|
276
|
-
(a=
|
|
277
|
-
a===_.w&&null!==c&&null!==d&&g&&(k=0<l?h.buffered.end(l-1):-1);a===_.
|
|
278
|
-
d?this.J.init(b):this.J.h(b,m=>{m.length&&
|
|
279
|
-
n,f)}if(!this.I[a]&&h&&1===h.buffered.length){m=h.buffered.start(0);const
|
|
280
|
-
a,b)}da(){this.f&&
|
|
281
|
-
_.
|
|
282
|
-
c)}catch(d){throw this.g.warn(
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
b.f||(c=b.D
|
|
286
|
-
messageData:d}}),this.D.onEvent(c)))}
|
|
287
|
-
this.configuration.preferredAudioChannelCount,this.configuration.preferSpatialAudio,this.configuration.mediaSource.codecSwitchingStrategy);this.
|
|
288
|
-
super.init(a,b);
|
|
289
|
-
return _.x(function*(){if(a.
|
|
290
|
-
super.getMediaPosition()}seek(a){if(this.
|
|
291
|
-
this,b=()=>Object.getPrototypeOf(Object.getPrototypeOf(this)).destroy;return _.x(function*(){yield b().call(a);a.
|
|
292
|
-
a);b.
|
|
293
|
-
}const k=new _.
|
|
294
|
-
a)}
|
|
295
|
-
|
|
296
|
-
a=a.l?0:a.h}else a=0;return a}setPlaybackRate(a,b){if(0===a)this.log.warn("A trick play rate of 0 is unsupported!");else if(this.
|
|
297
|
-
!c.
|
|
298
|
-
|
|
299
|
-
b,c,d,e,f){const g=this;return _.x(function*(){if(g.
|
|
300
|
-
1,getSegmentReference:
|
|
301
|
-
|
|
302
|
-
(
|
|
303
|
-
a.id&&(d.allowedByApplication=!1)}
|
|
304
|
-
this.log.debug(_.
|
|
305
|
-
c;a.f=!0;b.trigger(new _.
|
|
306
|
-
_.
|
|
307
|
-
a===_.
|
|
308
|
-
_.
|
|
309
|
-
"middle"}d.writingMode===_.
|
|
310
|
-
|
|
279
|
+
f)=>{const g=_.Bk(e.mimeType,e.codecs);if(f===_.H)d.A(g);else{var h=new Map;h.set(f,g);_.Is(g)&&b&&!e.aesEncrypted||!_.Ak(g,f)||!(e=_.Ak(g))||(h=e(),d.w[f]=h,h=h.demuxMimeTypes(f,g),c&&h.delete(_.p));GG(d,h)}d.h[f]=[]})})}Ha(){this.g.debug(iC);Object.values(this.w).forEach(a=>a.reset())}Aa(){return this.K.streaming.ignoreManagedMediaSourceStreamingHints?!0:this.U}A(a){this.f||(this.f=new nK(this.K,this.G));ZE(this.f,a)}M(){return this.o?this.o.readyState===_.je:!0}Qa(a){return a===_.H?this.f.Qa():
|
|
280
|
+
(a=HG(this,a))?a.Qa():null}ma(a){return a===_.H?this.f.ma():(a=HG(this,a))?a.ma():null}Mb(a,b,c){return a===_.H?this.f.Mb(b):(a=HG(this,a))?a.Mb(b,!1,c):!1}Ca(a,b){return a===_.H?this.f.Ca(b):(a=HG(this,a))?a.Ca(b):0}$(){const a={};a.total=new _.Bu(this.j.buffered,"total");a.audio=HG(this,_.p);a.video=HG(this,_.w);let b=[];this.f&&(b=[{start:this.f.Qa(),end:this.f.ma()}]);a.text=uD(b,_.H);return a}L(a,b,c,d,e,f,g){g=void 0===g?!1:g;const h=this.a[a];let k=-1,l=0;h&&h.buffered&&(l=h.buffered.length);
|
|
281
|
+
a===_.w&&null!==c&&null!==d&&g&&(k=0<l?h.buffered.end(l-1):-1);a===_.H?b=$E(this.f,b,c,d):this.w[a]?(b=this.w[a].transmux(b),b.captions&&0<b.captions.length&&(this.f||this.A(_.hg),bF(this.f,b.captions,c,d,this.a.video.timestampOffset)),e=[],0<b.audio.byteLength&&this.a.audio&&e.push(KG(this,_.p,this.W.bind(this,_.p,b.audio.buffer))),0<b.video.byteLength&&this.a.video&&e.push(KG(this,_.w,this.W.bind(this,_.w,b.video.buffer))),b=Promise.all(e)):(e&&window.muxjs&&(this.f||this.A(_.hg),null==c&&null==
|
|
282
|
+
d?this.J.init(b):this.J.h(b,m=>{m.length&&bF(this.f,m,c,d,this.a.video.timestampOffset)})),b=KG(this,a,this.W.bind(this,a,b)));return b.then(()=>{if(a===_.w&&null!==c&&null!==d&&!g)this.F.append(c,d,f),null!==c&&null!==d&&this.g.debug(HB,c,d,JB,IG(this,a));else if(a===_.p&&null!==c&&null!==d)ED(this.F),null!==c&&null!==d&&this.g.debug(GB,c,d,JB,IG(this,a));else if(a===_.w&&null!==c&&null!==d&&g){var m=h.buffered.length,n=0<m?h.buffered.end(m-1):-1;0>k&&0<m&&(k=h.buffered.start(0));0<=k&&0<n&&this.F.append(k,
|
|
283
|
+
n,f)}if(!this.I[a]&&h&&1===h.buffered.length){m=h.buffered.start(0);const r=c-m;if(Math.abs(r)>this.Oa&&0===h.timestampOffset)return this.g.warn(`Detected a delta of ${r} between `+`media times and segment times for ${a}. `+`The segment start time is ${c} and the media start time `+`is ${m}. Adjusting timestampOffset.`),m=KG(this,a,()=>{LG(this,a,r)}),n=KG(this,a,this.ba.bind(this,a,!1)),Promise.all([m,n])}null!==c&&null!==d&&(this.I[a]=!0)}).catch(m=>{throw m;})}va(a){const b=this.ma(_.w)||0;aF(this.f,
|
|
284
|
+
a,b)}da(){this.f&&aF(this.f,"",0)}remove(a,b,c){return a===_.H?this.f.remove(b,c):KG(this,a,this.ha.bind(this,a,b,c)).then(()=>{if(a===_.w){const d=this.Qa(a),e=this.ma(a);null!==d&&null!==e&&HD(this.F,d,e)}else a===_.p&&FD(this.F)})}clear(a){if(a===_.H){if(!this.f)return Promise.resolve();this.J.f();return this.f.remove(0,Infinity)}return KG(this,a,this.ha.bind(this,a,0,this.o.duration))}flush(a){return a===_.H?Promise.resolve():KG(this,a,this.ba.bind(this,a))}Za(a,b,c,d,e,f){const g=this;return _.x(function*(){if(a===
|
|
285
|
+
_.H){g.f.A=b;var h=g.f;h.h=c;h.l=d}else{h=yield NG(g,a,e,f);var k=OG(g,a,b,c,d,h);g.S&&(k=k.concat(OG(g,_.p,b,c,d,h)));yield Promise.all(k)}})}endOfStream(a){return QG(this,()=>{this.M()||(a?this.o.endOfStream(a):this.o.endOfStream())})}Y(a){QG(this,()=>{this.o.duration=a})}getDuration(){return this.o.duration}W(a,b){this.g.debug(IB+a+zB);try{this.a[a].appendBuffer(b)}catch(c){throw this.g.warn(TB+a,c),c;}this.g.debug(NB+a+zB)}ha(a,b,c){if(c<=b)this.C(a);else{this.g.debug(hC+a+BB,b,c);try{this.a[a].remove(b,
|
|
286
|
+
c)}catch(d){throw this.g.warn(VB+a+AB,b,c,d),d;}this.g.debug(PB+a+BB,b,c)}}ba(a){try{this.j.readyState>HTMLMediaElement.HAVE_NOTHING?(this.g.debug(YB+a),this.j.currentTime-=.001):this.g.warn(mC+a+CB+this.j.readyState)}catch(b){throw this.g.warn(UB+a,b),b;}this.g.debug(OB+a);this.C(a)}pb(a){this.h[a][0].p.reject(new _.I(_.F,3,3014,{mediaError:this.j.error?this.j.error.code:0}))}C(a){const b=this.h[a][0];b&&(b.p.resolve(),this.g.debug(pC+a),PG(this,a))}getTextDisplayer(){return this.G}},EG=window.URL.createObjectURL;var IJ=class{constructor(a){this.h=a;this.a=null;this.f=()=>{}}release(){this.a=this.h=null;this.f=()=>{}}l(a){const b=this.a;{const c=this.h.periods;a=ID(c,a)||c[0]}b!==a&&this.f(a);this.a=a}};var ZI=class{constructor(a){this.f=a;this.o=this.A=this.l=!1;this.h=this.f.Uf();this.w=_.Pd;this.j=null;this.a=new _.Gk(()=>{this.A||this.f.Qh(.25*this.h)});this.g=new _.S("clpp.mse.media.PlayRateController")}getConfiguration(){return this.j}release(){this.a&&(this.a.stop(),this.a=null);this.f=null}set(a,b){this.h=a;VG(this,b)}};var YG=new _.Ru(()=>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]));_.MJ=class{constructor(a,b){this.D=b;this.j=a;bH(a);this.h=null;this.l=1;this.G=Promise.resolve();this.B=new Map;this.w=new Map;this.a=new Map;this.I=this.f=this.o=this.C=!1;this.H=0;this.g=new _.S("clpp.mse.Streaming");this.A=this.F=!1}destroy(){const a=this;return _.x(function*(){const b=[];for(const c of a.a.values())cH(c),b.push(dH(c));yield Promise.all(b);a.a.clear();a.w.clear();a.D=null;a.j=null;a.G=null;a.B.clear();a.h=null;a.f=!0})}start(){const a=this;return _.x(function*(){const b=a.D.Jb();
|
|
287
|
+
var c=ID(a.j.periods,b+_.ku);if(!c)throw new _.I(_.F,5,5006,"No period found.");c=a.D.Ke(c);if(!c.video&&!c.audio&&!c.text)throw a.g.error("start(): No streams chosen"),new _.I(_.F,5,5005,"No streams chosen.");a.F=!c.video&&!c.audio&&!!c.text;a.A=!!c.bb;yield jH(a,c.audio,c.video,c.text,b);a.f||(a.g.debug("init: completed initial Stream setup"),a.D&&a.D.Sh&&(a.g.debug("init: calling onInitialStreamsSetup()..."),a.D.Sh()))})}resume(){if(!GH(this))for(const a of this.a.values())a.endOfStream=!1,iH(this,
|
|
288
|
+
a,0)}Xb(a){const b=this;return _.x(function*(){if(!b.f){var c=$G(a);if(!a.zb&&null!=a.ob&&!a.mc)if(a.ob=null,a.bc)b.g.debug(c,"skipping update and clearing the buffer"),yield yH(b,a,a.ke,a.Jd);else{try{const d=RH(b,a);null!=d&&(iH(b,a,d),a.Pc=!1)}catch(d){yield SH(b,d);return}TH(b,a);if(HH(b))if(b.D.configuration.Kh){b.g.debug("End of stream reached, keeping MediaSource open.");for(const d of b.a.values())d.ob=null}else b.g.debug("End of stream reached, calling ms.endOfStream()."),yield b.D.aa.endOfStream(),
|
|
289
|
+
b.f||(c=b.D.aa.getDuration(),c<b.j.presentationTimeline.getDuration()&&(b.j.presentationTimeline.f=c),b.D.hg())}}})}J(a,b,c,d){const e=SC(d.reader),f=SC(d.reader),g=_.P(d.reader),h=_.P(d.reader),k=_.P(d.reader),l=_.P(d.reader);d=_.tm(d.reader,d.reader.Sa()-d.reader.getPosition());a=a.startTime+b.startTime+h/g;c.includes(e)&&("urn:mpeg:dash:event:2012"===e?this.D.lg():(c=new _.D("emsg",{detail:{startTime:a,endTime:a+k/g,schemeIdUri:e,value:f,timescale:g,presentationTimeDelta:h,eventDuration:k,id:l,
|
|
290
|
+
messageData:d}}),this.D.onEvent(c)))}K(a){let b=!1,c=0;(new _.Dm).N(_.Oe,_.wm).N(_.qg,_.wm).N(_.Je,_.wm).N(_.Ne,_.wm).N(_.bg,_.wm).ea(_.dg,_.xm).N("encv",d=>{d.reader.skip(78);_.wm(d)}).N("pasp",d=>{c=d.start+d.headerSize;const e=_.P(d.reader),f=_.P(d.reader);b=e!==f;this.g.debug(`hSpacing=${e}, vSpacing=${f}, updatePASP=${b}`);d.parser.stop()}).parse(a.data);b&&(a=new _.Fm(new DataView(a.data)),a.seek(c),_.O(a,1),_.O(a,1))}};var tK=class{constructor(){this.a=null}};var uK=class extends _.Fu{constructor(){super(xC);this.H=nJ;this.l=this.Y=null;this.jf=0;this.yg=2;this.Oa=null;this.Te=!1;this.w=new _.St;this.Aa=this.mf=this.Ud=this.I=this.Ha=this.C=this.L=this.B=null;this.qc=!1;this.f=this.j=this.a=this.K=this.J=null;this.h=new _.pK;this.U=null;this.rf=1E9;this.Vd=new Set;this.W=!0;this.da=null;this.qf=!1;this.Bg=0;this.S=null;this.o=new rK;this.G=null;this.ha=_.hp;this.nc=new WI(this.configuration.preferredAudioLanguage||[],this.configuration.preferredAudioRole,
|
|
291
|
+
this.configuration.preferredAudioChannelCount,this.configuration.preferSpatialAudio,this.configuration.mediaSource.codecSwitchingStrategy);this.Qb=this.configuration.preferredTextLanguage;this.A=new qK;this.$=this.va=null;this.Za=new Map;this.oc=null;this.Td=this.configuration.preferredTextRole;this.Pb=this.configuration.preferForcedSubtitles;this.w.on(window,"online",()=>{this.H===uI&&FH(this.a)});this.Wd=this.lc=this.Zd=null;this.R=_.ma;this.tc=new tK;this.Xe=null}init(a,b){const c=a.getMedia();
|
|
292
|
+
super.init(a,b);wI(this,c)}namespace(){return xC}setSeekInterceptor(a){this.mf=a||null}setPlaybackSessionId(a){this.Xe=a}Ag(){return new oK}getState(){return this.ha}getDrmInfo(){return this.B?this.B.getDrmInfo():null}unload(){const a=this;return _.x(function*(){zF(a,!1);a.qc=!1;if(a.ga){a.log.debug("Unload player with source",a.ga);var b=a.getTrackManager();b&&b.release();a.H!==GI&&(yield EI(a),a.ga=null,a.jf=0,a.va=null,a.$=null,a.getNetworkEngine().headers.delete(rC))}})}release(){const a=this;
|
|
293
|
+
return _.x(function*(){if(a.Y)return a.Y;a.Y=FI(a);a.Y.finally(()=>{a.Y=null});return a.Y})}getBufferInfo(a){if(this.L){var b=this.L.$();const c=new _.Bu(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.Oa?(b=CD(this.Oa),uD(b,a)):super.getBufferInfo(a)}getPosition(){var a=this.tc,b=this.getMediaPosition();a.a&&(a=a.a,b-=a.f,b=0>b?0:b>a.a?a.a:b);return b}getMediaPosition(){return this.C?DE(this.C):
|
|
294
|
+
super.getMediaPosition()}seek(a,b){if(this.mf&&!this.mf(a,b))return Promise.resolve();b=this.tc;b=b.a?a+b.a.Tb():a;b!==a&&this.log.info(`Seeking to ${a} s corresponding to `+`media time of ${b} s.`);return super.seek(b)}getPresentationStartTime(){return this.f?this.f.presentationTimeline.getPresentationStartTime():null}getDuration(){var a=this.tc,b=this.getMediaDuration();return a.a?a.a.getDuration():b}getMediaDuration(){return this.f?this.f.presentationTimeline.getDuration():Infinity}destroy(){const a=
|
|
295
|
+
this,b=()=>Object.getPrototypeOf(Object.getPrototypeOf(this)).destroy;return _.x(function*(){yield b().call(a);a.H!==GI&&(a.log.debug("Destroying player..."),a.H=GI,CI(a),a.w&&(a.w.release(),a.w=null),a.lc=null,a.h=null)})}getTimeline(){return this.lc}setupPlaylist(a){const b=this;return _.x(function*(){const c=new _.rn;b.A.a=c;try{AI(b);b.R=_.rb;yield HI(b);oG(b.A,c);const d=a[0];d.playlist&&d.playlist.startTime&&(d.startTime=d.playlist.startTime);b.ga=_.np(d);b.configuration=_.Il(b.ba,d);b.log.info("Loading playlist configurations",
|
|
296
|
+
a);b.lc=II(b.configuration);yield MI(b,c);oG(b.A,c);const e=a.map(n=>PI(b,n,0,null,!0)),f=yield Promise.all(e),g=f.filter(n=>n.manifest.presentationTimeline.isLive()),h=g[0];h&&(b.j=h.parser);if(1<g.length)throw new _.I(_.F,7,7003,"Playlist of multiple live streams is not supported.");if(h){const n=b.configuration.playlist.content;if(n===_.Ub)throw new _.I(_.F,7,7003,"Cannot play live content in VOD mode.");if("IPR"===n&&h!==f[f.length-1])throw new _.I(_.F,7,7003,"Wrong order of playlist assets.");
|
|
297
|
+
}const k=new _.iK({version:2},null,0,null==h),l=f.map(n=>jF(n.manifest)),m=mF(l,k);b.f=m;b.B=yield TI(b,m,b.configuration);oG(b.A,c);yield fJ(b,c);oG(b.A,c);DH(b.a,m);gJ(b,m);c.resolve()}catch(d){b.j&&(yield b.j.stop(),b.j=null),iJ(b,d,c)}})}appendLoad(a){const b=this;return _.x(function*(){AI(b);if(b.R!==_.rb)throw new _.I(_.F,7,7003,"Cannot append-load to non-playlist player.");const c=yield jJ(b,a);b.f=c.manifest;b.j=c.parser;DH(b.a,c.manifest);HH(b.a)&&b.a.resume();gJ(b,c.manifest)})}seekWith(a){return this.seek(this.getPosition()+
|
|
298
|
+
a)}zg(){const a=this;return _.x(function*(){AI(a);a.Zd?(a.log.info("Loading preloaded asset",a.Zd),a.Zd=null,yield fJ(a,null)):a.log.warn("No preloaded asset found")})}preload(a){const b=this;return _.x(function*(){AI(b);_.Kn("preload.start");b.log.info("Preloading asset",a);yield tJ(b,a,!1);b.Zd=a;b.log.info("Preloaded asset",a);_.Kn("preload.end");_.Mn("preload","preload.start","preload.end")})}load(a){return tJ(this,a)}detach(){const a=this;return _.x(function*(){yield BI(a);a.configuration=a.ba;
|
|
299
|
+
CI(a)})}isLive(){var a;this.f?(a=this.f.presentationTimeline.isLive())||(a=this.f.presentationTimeline,a=Infinity!==a.f&&!a.l):a=!1;return a}tf(){this.log.debug("User seeking finished");this.J&&CJ(this);zJ(this)}getSeekRange(){var a={start:0,end:0};if(this.f){var b=this.f.presentationTimeline;a={start:SD(b),end:bE(b)}}b=this.tc;b.a?(b=b.a.getDuration(),b>a.end&&(b=a.end),b={start:0,end:b}):b=a;return b}uc(){return this.f?this.f.presentationTimeline.uc():null}getPlaybackRate(){if(this.I){var a=this.I;
|
|
300
|
+
a=a.l?0:a.h}else a=0;return a}setPlaybackRate(a,b){if(0===a)this.log.warn("A trick play rate of 0 is unsupported!");else if(this.H===uI){if(_.Kk()){this.log.warn("Pausing and unpausing to mitigate playbackRate platform issue.");var c=this.getSurface().getMedia();c.pause();this.I.set(a,b);c.play()}else this.I.set(a,b);if((b=this.I.getConfiguration())&&b.preferTrickPlayTracks){b=this.a;var d=1<Math.abs(a);if(c=b.a.get(_.w)){var e=c.stream;if(e)if(b.g.debug("setTrickPlay",d),d)(d=e.trickModeVideo)&&
|
|
301
|
+
!c.gc&&(b.g.debug("Engaging trick mode stream",d),_.zH(b,d,!1,0),c.gc=e);else if(e=c.gc)b.g.debug("Restoring non-trick-mode stream",e),c.gc=null,_.zH(b,e,!0,0)}}this.h.playbackRateChanged(a)}}na(){if(this.f&&this.C){var a=HF(this);if(null==a)a=null;else{if(!IF(this.o,a).text){var b=_.lG(a.textStreams,this.Qb,this.Td,this.Pb);b.length&&qG(this.o,a,b[0])}a=IF(this.o,a).text}b=[];for(const c of SJ(this)){const d=iG(c);d.activeText=c===a;b.push(d)}return b}return[]}getPeriods(){return this.f.periods}getStats(){if(this.H!==
|
|
302
|
+
uI)return _.Xo();zJ(this);var a=this.l;if(a.getVideoPlaybackQuality){var b=a.getVideoPlaybackQuality();a=this.G;var c=Number(b.totalVideoFrames);a.o=Number(b.droppedVideoFrames);a.l=c}if(this.H===uI){(c=HF(this))?(a=IF(this.o,c).video,c=IF(this.o,c).audio,a=(a.bandwidth||0)+(c.bandwidth||0)):a=null;a&&(this.G.w=a);if(b=iI(this))a=this.G,c=b.height||NaN,a.A=b.width||NaN,a.j=c;a=this.h.getBandwidthEstimate();this.G.h=a}return this.G.getStats()}getBandwidthEstimate(){return this.h.getBandwidthEstimate()}getCueTimeline(){return this.K}getTimelineCues(){return this.K?
|
|
303
|
+
fE(this.K,wJ(this)):[]}resetAbr(){this.h&&this.h.reset()}dd(){return this.h}addTextTrack(a,b,c,d,e,f){const g=this;return _.x(function*(){if(g.H!==uI)throw g.log.error("Must call load() and wait for it to resolve before adding text tracks."),Error("State error!");const h=HF(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 _.I(1,4,4040);const m=new _.jE(1,0,l,()=>[a],0,null,0);k={id:g.rf++,
|
|
304
|
+
originalId:null,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:()=>1,getSegmentReference:r=>1===r?m:null,adjustSegmentDurations:()=>{},getDuration:()=>l,segmentLookupStrategy:_.BC,initSegmentReference:null,mimeType:d,codecs:e||"",kind:c,encrypted:!1,keyId:null,language:b,originalLanguage:b,label:f||null,type:_.H,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:null,spatialAudio:!1,closedCaptions:null};g.Vd.add(k);h.textStreams.push(k);yield pH(g.a,
|
|
305
|
+
k);const n=_.mH(g.a,_.H);n&&qG(g.o,h,n);g.Vd.delete(k);g.log.debug("Choosing new streams after adding a text stream");WJ(g,h);RI(g);return iG(k)})}Eg(a){this.log.debug(_.FC,a);try{this.log.debug("onChooseStreams_, choosing variant from ",a.variants);this.log.debug("onChooseStreams_, choosing text from ",a.textStreams);const b=XJ(this,a);this.log.debug("onChooseStreams_, chose video ",b.video);this.log.debug("onChooseStreams_, chose audio ",b.audio);this.log.debug("onChooseStreams_, chose text ",b.text);
|
|
306
|
+
return b}catch(b){return this.onError(b),{audio:null,video:null,text:null,bb:null}}}Dg(){this.log.debug("canSwitch_");this.W=!1;this.configuration.abr.enabled&&this.h.enable();this.da&&(AH(this.a,this.da,this.qf,this.Bg),this.da=null);this.S&&(_.zH(this.a,this.S,!0,0),this.S=null)}Jg(){this.j&&this.j.update()}Gg(){this.C&&this.C.j.ce()}Cg(a,b,c){if((void 0===c?"":c)===DC)return RI(this),this.ua()||(this.configuration.abr.enabled=!0,this.h.enable()),WJ(this,b,!1),!0;if(c=b.variants.some(d=>{let e=
|
|
307
|
+
!1;const f=d[a.type];f&&(e=d.allowedByApplication&&f.id!==a.id,a.type===_.p&&(e=e&&f.language===a.language));return e})&&this.ua()){for(const d of b.variants){const e=d[a.type];e&&e.id===a.id&&(d.allowedByApplication=!1)}RI(this);this.ua()||(this.configuration.abr.enabled=!0,this.h.enable());WJ(this,b)}return c}Fg(){this.log.debug("endOfStream called by streaming engine");this.qc=!0}onError(a){if(this.H!==GI&&7001!==a.code&&7E3!==a.code){var b=new _.D(_.q,{detail:a});a.severity===_.F&&zI(this,_.ap);
|
|
308
|
+
this.trigger(b);b.defaultPrevented&&(b.a=!0)}}ef(a){a.type===_.de?this.dispatchEvent(a):"largegap"!==a.type&&(a.type===_.Pg?oJ(this):"emsg"!==a.type&&(a instanceof _.D?this.dispatchEvent(a):this.log.debug(_.Ob,a.type)))}ua(){return this.configuration.abr.enabled}Ig(a){const b=this;return _.x(function*(){if(b.Gc){b.log.info("Attempt to switch CDN.");var c=b.getLoadedSource(),d=b.ua();if(c=yield b.Gc(c.url,a)){c=_.lh(b.getLoadedSource(),{url:c});d&&b.h.disable();yield IH(b.a);var e=iI(b),f=jI(b);do{var g=
|
|
309
|
+
!1;try{b.log.info(`Switching CDN to ${c.url}.`),yield YJ(b,c,e,f)}catch(h){if(b.log.info("Switch failed"),g=yield b.Gc(c.url,a))c.url=g,g=!0;else throw h;}}while(g);d&&b.h.enable();FH(b.a,!0);b.ga[b.getSourceIndex()]=c;a.f=!0;b.trigger(new _.D(_.jd,{newManifest:c.url}))}}})}},GI=0,nJ=1,uI=2,QI=[_.bf,_.se];
|
|
310
|
+
_.Kh(new class{a(){return xC}canPlay(a,b){if(_.Tk())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 _.ct||_.dt(a.url)in _.et?!0:!1:!1;if(d&&a){if(_.Kk(2))return 1;if(_.Uk()&&c===_.zl){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}f(a){return a===
|
|
311
|
+
_.ma||a===_.rb}create(){return new uK}});_.mr(function(){_.Gh("MediaSource.install");if(window.MediaSource)if(window.cast&&cast.__platform__&&cast.__platform__.canDisplayType)_.Fh("Patching Chromecast MSE bugs."),ZJ();else if(_.Uk()){var a=navigator.appVersion;a=0<=a.indexOf("Version")?parseInt(a.match(/Version\/(\d+)/)[1],10):13;$J();10>=a?(_.Fh("Blacklisting MSE on Safari \x3c\x3d 10."),window.MediaSource=null):12>=a?(_.Fh("Patching Safari 11 \x26 12 MSE bugs."),aK(),bK()):(_.Fh("Patching Safari 13 MSE bugs."),aK())}else _.Kk(2)||_.Kk(3)||
|
|
312
|
+
_.Kk(4)?cK():_.Fh("Using native MSE as-is.");else _.Fh("No MSE implementation available.")});var vK=class extends _.Yv{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=_.Rd;c.label===eC&&(this.a=c)}this.a||(this.a=a.addTextTrack(_.OC,eC));this.a.mode=_.pe}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=_.vj(e);e=new VTTCue(d.startTime,d.endTime,e);e.line=-1;try{e.align=_.ld}catch(f){e.align=
|
|
313
|
+
"middle"}d.writingMode===_.Fg?e.vertical="lr":d.writingMode===_.Gg&&(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;dK(this.a,c=>c.startTime<b&&c.endTime>a);return!0}isTextVisible(){return this.a.mode===_.Tf}setTextVisibility(a){null!==this.a&&(this.a.mode=a?_.Tf:_.pe)}destroy(){this.a&&
|
|
314
|
+
dK(this.a,()=>!0);this.a=null;return Promise.resolve()}};_.Ro("single-native",new class{a(){return!0}create(a){return new vK(a)}});};f.call(g, window);
|