@castlabs/prestoplay 6.33.0 → 6.34.0-beta.1
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 +16 -0
- package/cjs/cl.adobe.js +3 -3
- package/cjs/cl.airplay.js +3 -3
- package/cjs/cl.broadpeak.js +19 -19
- package/cjs/cl.cast.js +129 -129
- package/cjs/cl.conviva.js +32 -32
- package/cjs/cl.core.js +633 -624
- package/cjs/cl.crypto.js +9 -9
- package/cjs/cl.dash.js +101 -101
- package/cjs/cl.externs.js +48 -72
- package/cjs/cl.freewheel.js +26 -26
- package/cjs/cl.hls.js +76 -76
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +30 -30
- package/cjs/cl.ima.js +26 -26
- package/cjs/cl.mediatailor.js +3 -3
- package/cjs/cl.mse.js +357 -353
- package/cjs/cl.muxdata.js +14 -14
- package/cjs/cl.onboard.js +4 -5
- package/cjs/cl.persistent.js +14 -14
- package/cjs/cl.playlist.js +6 -6
- package/cjs/cl.simid.js +16 -16
- package/cjs/cl.smooth.js +71 -71
- package/cjs/cl.thumbnails.js +26 -26
- package/cjs/cl.tizen.js +73 -73
- 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 +36 -36
- package/cl.adobe.js +3 -3
- package/cl.airplay.js +3 -3
- package/cl.broadpeak.js +14 -14
- package/cl.cast.js +100 -100
- package/cl.conviva.js +27 -27
- package/cl.core.js +510 -502
- package/cl.crypto.js +9 -9
- package/cl.dash.js +90 -90
- package/cl.externs.js +51 -63
- package/cl.freewheel.js +20 -20
- package/cl.hls.js +82 -82
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +26 -26
- package/cl.ima.js +20 -20
- package/cl.mediatailor.js +2 -2
- package/cl.mse.js +308 -306
- package/cl.muxdata.js +13 -13
- package/cl.onboard.js +5 -5
- package/cl.persistent.js +10 -10
- package/cl.playlist.js +5 -5
- package/cl.simid.js +14 -14
- package/cl.smooth.js +61 -61
- 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 +31 -31
- package/package.json +1 -1
- package/typings.d.ts +33 -46
package/cl.mse.js
CHANGED
|
@@ -1,309 +1,311 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var gA,hA,jA,
|
|
2
|
-
kE,
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
_.
|
|
8
|
-
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>`:"",
|
|
9
|
-
c?`CHECKSUM="${c}" `:"",`VALUE="${e}"`,"\x3e\x3c/KID\x3e\x3c/KIDS\x3e\x3c/PROTECTINFO\x3e",d?`<LA_URL>${d}</LA_URL>`:"",
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
a.a.
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var bA,cA,eA,fA,gA,hA,iA,jA,lA,mA,nA,oA,qA,rA,sA,tA,vA,wA,xA,yA,AA,DA,EA,GA,HA,IA,JA,KA,NA,OA,PA,QA,VA,WA,XA,YA,ZA,$A,aB,cB,fB,gB,lB,mB,nB,oB,qB,rB,uB,sB,tB,vB,wB,yB,AB,BB,CB,DB,EB,FB,GB,HB,IB,JB,KB,MB,RB,SB,TB,WB,ZB,dC,fC,VB,gC,hC,iC,jC,kC,lC,mC,oC,pC,qC,rC,sC,uC,vC,wC,tC,zC,BC,AC,CC,DC,EC,FC,IC,KC,OC,PC,RC,LC,MC,NC,SC,UC,VC,WC,XC,YC,ZC,aD,bD,cD,eD,dD,fD,gD,hD,iD,jD,kD,oD,sD,tD,xD,pD,mD,lD,vD,wD,AD,BD,CD,ED,GD,ID,JD,HD,KD,MD,ND,OD,PD,QD,RD,SD,TD,UD,VD,WD,YD,ZD,XD,LD,eE,$D,aE,bE,cE,dE,
|
|
2
|
+
fE,gE,hE,kE,iE,jE,lE,mE,nE,oE,qE,rE,sE,tE,uE,vE,wE,zD,yE,BE,zE,AE,CE,DE,EE,FE,GE,HE,KE,IE,JE,ME,LE,OE,PE,QE,RE,SE,TE,$E,aF,bF,dF,eF,XE,UE,YE,ZE,fF,gF,hF,nF,oF,pF,jF,qF,rF,sF,WE,uF,vF,wF,xF,yF,zF,mF,GF,HF,kF,IF,lF,VE,LF,MF,PF,QF,RF,NF,OF,iF,JF,KF,SF,TF,UF,VF,YF,ZF,$F,eG,fG,XF,dG,gG,WF,hG,iG,aG,bG,cG,jG,nD,tG,qD,rD,uD,xG,zG,EG,FG,CG,AG,HG,IG,MG,PG,TG,fH,gH,hH,jH,kH,lH,mH,nH,oH,BG,DG,vH,xH,uH,iH,JG,LG,NG,OG,qH,SG,UG,VG,qG,kG,yD,rG,XG,YG,aH,bH,cH,dH,eH,RG,pG,GH,CH,BH,UH,VH,XH,YH,vG,wG,lG,mG,nG,sG,$H,
|
|
3
|
+
zH,bI,ZH,DH,EH,WH,RH,SH,aI,cI,IH,JH,HH,dI,AH,eI,fI,gI,hI,iI,jI,RA,TC,yH,FD,oI,KG,OH,nC,xC,yC,rI,sI,tI,KH,LH,NH,QC,wH;bA=" buffer";cA="\x3c/DATA\x3e\x3c/WRMHEADER\x3e";_.dA="AUDIO";eA="Cannot get segment, period ID unknown";fA="Choosing new streams after key status change";gA="IterateSegmentReference";hA="Jumping forward";iA="MediaSource threw QuotaExceededError:";jA="Period not found.";_.kA="Player is in ERROR state and can not switch to ";lA="PrestoPlay TextTrack";mA="Removing audio from variant - audio not compatible with platform";
|
|
4
|
+
nA="Setting playback rate to\x3d";oA="URI-REPLACEMENT";_.pA="Updating manifest...";qA="X-Playback-Session-Id";rA="bufferBehind\x3d";sA="bufferedBehind\x3d";tA="cannot find segment";_.uA="caption";vA="clpp.mse.Player";wA="content-steering-change";xA="content-steering-location-ban-update";yA="currentPeriod.startTime\x3d";_.zA="dashif:Laurl";AA="fetching init segment";_.BA="getSegmentNextReference";_.CA="iterateSegmentReference";DA="key-restriction";EA="manifest.start";_.FA="onChooseStreams_ period";
|
|
5
|
+
GA="presentationTime:";HA="presentationTime\x3d";IA="reference.endTime\x3d";JA="reference.position\x3d";KA="reference.startTime\x3d";_.LA="subtitle";_.MA="subtitles";NA="switch: Stream ";OA=function(a,b){a.a=a.a.filter(c=>c!==b)};PA=function(a,b,c=0){if(!a.length||1===a.length&&1E-6>a.end(0)-a.start(0))return null;for(let d=0;d<a.length;d++)if(a.start(d)>b&&(0===d||a.end(d-1)-b<=c))return d;return null};
|
|
6
|
+
QA=function(a){const b=a.a+a.f.byteOffset;let c=void 0;for(;_.Km(a);)if(0===_.Mm(a)){c=a.a+a.f.byteOffset-1;break}a=a.f.buffer.slice(b,c);return _.vi(a)};_.SA=function(a){const b=new Uint8Array(RA),c=4+b.byteLength+a.j.byteLength+4+a.f.byteLength,d=new _.cn(c,!1);_.O(d,c);_.Jm(d,b);_.Jm(d,a.j);_.O(d,a.f.byteLength);_.Jm(d,a.f);return _.E(d.buffer)};
|
|
7
|
+
_.TA=function(a,b,c,d){var e=_.Mk(b);if(8!==e.byteLength)e="";else{var f=_.Jn(e);e=_.Jk(f);b:switch(f=f.byteLength,_.rh("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>`:"",cA].join("");break b;
|
|
8
|
+
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>`:"",cA].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" ',
|
|
9
|
+
c?`CHECKSUM="${c}" `:"",`VALUE="${e}"`,"\x3e\x3c/KID\x3e\x3c/KIDS\x3e\x3c/PROTECTINFO\x3e",d?`<LA_URL>${d}</LA_URL>`:"",cA].join("");break b;default:_.A("Cannot create PlayReady header in version",a),e=""}}if(!e)return null;_.rh("New payload",e);e=_.E(_.Ai(e,!0));return new _.Nn(_.On,b,d||null,e,a,c)};_.UA=function(a,b){return b===a.version?a:_.TA(b,a.a,a.l||void 0,a.h||void 0)};
|
|
10
|
+
VA=function(a,b){if(_.Oh("Edge/"))return!0;b=b.toLowerCase();if(_.Ph()&&b.includes('codecs\x3d"ac-3"')){const c=b.replace("ac-3",_.Od);return a.J.has(b)||a.J.has(c)}return a.J.has(b)};WA=function(a,b){var c=b.audio,d=b.video;if(c&&c.encrypted&&(c=_.Zn(c),!VA(a,c))||d&&d.encrypted&&(d=_.Zn(d),!VA(a,d)))return!1;const e=a.keySystem();return 0===b.drmInfos.length||b.drmInfos.some(f=>f.keySystem===e)};
|
|
11
|
+
XA=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}))};YA=function(a,b){return null==a.a?null:(a=a.a[a.a.length-1])?a[b]:null};ZA=function(a){a=YA(a,_.ev);return null==a?null:a};$A=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.Xb()+d.getDuration();)c+=1,d=a.a[c]||null;a.f=d?c:a.a.length-1}else a.f=-1};
|
|
12
|
+
aB=function(a){return 1001===a||1002===a||1003===a};_.bB=function(a,b){return a.concat(b)};cB=function(){};_.dB=function(a,b){return 0===b.length?a:a.map(c=>b.map(d=>_.Cj(d,c))).reduce(_.bB,[])};_.eB=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:b||[],keyIds:[],periodId:c?c:null}};
|
|
13
|
+
fB=function(a,b){a=_.Tj(a);b=_.Tj(b);a=a.split("-");b=b.split("-");return a[0]===b[0]&&1===a.length&&2===b.length};gB=function(a){return a.language?_.Tj(a.language):a.audio&&a.audio.language?_.Tj(a.audio.language):a.video&&a.video.language?_.Tj(a.video.language):_.eg};
|
|
14
|
+
_.hB=function(a,b){a=_.Tj(a);const c=new Set;for(var d of b)c.add(_.Tj(d));for(const e of c)if(e===a)return e;for(const e of c)if(fB(e,a))return e;for(const e of c)if(d=e,b=a,d=_.Tj(d),b=_.Tj(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(fB(a,e))return e;return null};
|
|
15
|
+
_.iB=function(a){if(typeof a!==_.Nf)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:{Jd:a,ae:b,dj:a*b}};
|
|
16
|
+
_.jB=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||
|
|
17
|
+
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};_.kB=function(a,b){return a.length&&b.length?0<_.jB(a,b).length:!0};
|
|
18
|
+
lB=function(a,b){let c=0;for(const d of a)c+=b(d)?1:0;return c};mB=function(a,b){var c=_.Fl(b,a);if(!c)return!1;c=c();a=c.isMuxed(a,b);c.destroy();return a};nB=function(a){const b=[a.mimeType],c=(d,e)=>{null!=d&&b.push(`${e}="${String(d).trim()}"`)};c(a.codecs,_.md);c(a.frameRate,"framerate");c(a.bandwidth,"bitrate");c(a.width,_.Gg);c(a.height,_.Xd);c(a.channelsCount,"channels");return b.join(";").replace(/\s/g,"")};oB=function(a){return a.split(",").map(b=>b.trim()).filter(b=>0<b.length)};
|
|
19
|
+
_.pB=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(",")};qB=function(a,b){const c=_.pB(_.Il(a));a=_.Hl(a);const d=_.pB(_.Il(b));return a===_.Hl(b)&&c===d};
|
|
20
|
+
rB=function(a){var b=k=>Math.round(k),c=k=>100*Math.round(k/100);b={br:b,d:b,bl:c,dl:c,mtp:c,nor:k=>encodeURIComponent(k),rtp:c,tb:b,Qj:b,Rj:b};var d={Object:["br","d","ot","tb"],Request:"bl dl mtp nor nrr su".split(" "),Session:"cid pr sf sid st v".split(" "),Status:["bs","rtp"]};c=["nor","nrr","sid","cid"];const e=["ot","sf","st"],f=["mtp"],g={};for(const k of Object.entries(d)){const [l,m]=k;d=[];for(const n of m){let p=a[n];if(void 0!==p&&null!==p){var h=b[n];h&&(p=h(p));h=`${n}=${p}`;f.includes(n)&&
|
|
21
|
+
0===p&&(h="");e.includes(n)?h=`${n}=${p}`:c.includes(n)?h=`${n}="${p}"`:typeof p===_.Mc&&(h=p?`${n}`:"");h&&d.push(h)}}0<d.length&&(g[l]=d.join(","))}return g};
|
|
22
|
+
uB=function(a){return(b,c)=>{if(!a.a||!a.a.enabled||!c)return Promise.resolve(b);{var d=a.f.getBandwidthEstimate,e=a.f.getBufferInfo,f=a.f.getLoadedSource,g=a.f.getMediaPosition,h=a.f.getPlaybackRate,k=a.f.getPlayerState,l=a.f.bd;var m=c.stream;var n=c.segment;const G=c.objectType;var p=c.nextSegment;c=c.streamType;h=h();k=k();const D=h||1;d=d();f=(f=f())?sB(f):void 0;e=1E3*e().Oa(g());g=["a","v","av"].includes(G)?e:void 0;var u="v"===G||"av"===G;var x=!1;a.h&&u&&(x=!0,a.h=!1);u=x;l=tB(l,G);x=p;if(n&&
|
|
23
|
+
x&&n!==x){var y=n.Da()[0];{var B=x.Da()[0];x=new URL(B);const ka=new URL(y);if(x.origin!==ka.origin)x=B;else{y=x.pathname.split("/").slice(1);for(B=ka.pathname.split("/").slice(1,-1);y[0]===B[0];)y.shift(),B.shift();for(;B.length;)B.shift(),y.unshift("..");x=y.join("/")+x.search+x.hash}}}else x=void 0;n&&p&&(p.na||p.ka)&&(n.na!==p.na||n.ka!==p.ka)?(y=p.na+"-",p.ka&&(y+=p.ka),p=y):p=void 0;a:{if(n&&m&&(y=m.bandwidth)){y=y*(n.endTime-n.startTime)/1E3/((e/1E3||500)/(D||1)/1E3);y=a.a.rtpMultiplier?y*
|
|
24
|
+
a.a.rtpMultiplier:y;break a}y=void 0}(B=a.a.contentId)&&64<B.length&&(a.g.warn(`CMCD contentId: ${B} is longer than 64 characters,
|
|
20
25
|
it will be ignored.
|
|
21
|
-
Refer to the CMCD spec for more details.`),
|
|
22
|
-
b.uris[m]=n.toString()}else{m=
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
xB=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}})};
|
|
27
|
-
zB=function(a){function b(h,k){return new _.yB(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==
|
|
26
|
+
Refer to the CMCD spec for more details.`),B=void 0);m=Object.assign({},m&&{br:m.bandwidth},n&&{d:n.endTime-n.startTime},G&&{ot:G},l&&{tb:l},g&&{bl:g},{dl:e/D},d&&{mtp:d/1E3},x&&{nor:x},p&&{nrr:p},{su:6===k},B&&{cid:B},1!==h&&{pr:h},f&&{sf:f},{sid:a.a.sessionId},c&&{st:c},1!==a.a.version&&{v:a.a.version},{bs:u},y&&{rtp:y})}if("query"===a.a.deliveryMode){var F=rB(m);if((F=Object.values(F).join(","))&&b.uris)for(m=0;m<b.uris.length;m++)n=new _.Dj(b.uris[m]),n.a.searchParams.set("CMCD",F),
|
|
27
|
+
b.uris[m]=n.toString()}else{m=rB(m);n={};for(F of Object.entries(m)){const [G,D]=F;n[`CMCD-${G}`]=D}F=n;b.headers=Object.assign({},b.headers||{},F)}return Promise.resolve(b)}};sB=function(a){switch(a.type){case _.tc:return"d";case _.fm:return"h";case _.Bc:return"s";default:return"o"}};tB=function(a,b){a=a();if(0!==a.length)switch(a=a.reduce((c,d)=>c&&c.bandwidth>d.bandwidth?c:d),b){case "a":return a.fe||void 0;case "v":return a.Ie||void 0;default:return a.bandwidth}};
|
|
28
|
+
vB=function(a,b="total"){b=new _.iu(void 0,b);for(const c of a)b.a.push(c);b.length=a.length;return b};
|
|
29
|
+
wB=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}})};
|
|
30
|
+
yB=function(a){function b(h,k){return new _.xB(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==
|
|
28
31
|
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,
|
|
29
32
|
e),"#doctype"))}e++;continue}{e++;m=l=d();let x=null;var n=l.indexOf(":");-1!==n&&(x=l.slice(0,n),m=l.slice(n+1));for(n={};62!==a.charCodeAt(e)&&a[e];){var p=a.charCodeAt(e);if(64<p&&91>p||96<p&&123>p){p=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[p]=u;p=p.split(":");"xmlns"===p[0]&&p[1]&&g.set(u,p[1])}e++}p=[];u=a.charCodeAt(e-1);e++;47!==u&&(p=
|
|
30
|
-
c(l));l=new _.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
rC=function(a
|
|
48
|
-
|
|
49
|
-
uC=function(a){
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
CC=function(a,b
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
return
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
VC=function(a,b,c
|
|
64
|
-
|
|
65
|
-
YC=function(a,b
|
|
66
|
-
ZC=function(a,b){
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
wD=function(a){
|
|
77
|
-
AD=function(a){
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
lE(
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
LE=function(a){
|
|
117
|
-
a;
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
a.g.
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
lF=function(a,b,c,d){return
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
for(const l of a.a.
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
a
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
dG=function(a,b,c){return _.v(function*(){
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
_.
|
|
185
|
-
|
|
186
|
-
a.
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
(a.
|
|
196
|
-
uH=function(a,b
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
ZH=function(a,b,c,d){
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
_.
|
|
235
|
-
_.
|
|
236
|
-
_.
|
|
237
|
-
_.
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
a)
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
this.
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
null
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
(b=a.
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
a
|
|
273
|
-
a)
|
|
274
|
-
a,
|
|
275
|
-
a
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
a.
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
b.
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
c
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
g.
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
d
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
_.
|
|
308
|
-
_.
|
|
309
|
-
_.Li(4)?hI():_.sh("Using native MSE as-is.");else _.sh("No MSE implementation available.")});};f.call(g, window);
|
|
33
|
+
c(l));l=new _.xB(l,null,n,p,x,m,g)}k.push(l)}else l=e,e=a.indexOf("\x3c",e)-1,-2===e&&(e=f),l=wB(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 _.xB("#document",null,{},c(""),null,null,g)};
|
|
34
|
+
AB=function(a){switch(a){case _.km:_.Pu.info("Select DOM parser for XML");_.Kn=new _.Ou;break;case "txml":_.Pu.info("Select TXML parser for XML");_.Kn=new _.zB;break;default:_.Pu.warn("XML parser option unknown, using default "+`DOM parser. Option: ${a}`),_.Kn=new _.Ou}};BB=function(){return!!window.SourceBuffer&&!!SourceBuffer.prototype&&!!SourceBuffer.prototype.changeType};CB=function(a,b){return a.start-b.start};
|
|
35
|
+
DB=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}))};EB=function(a){a.player&&(a.player.off(_.vf,a.a),a.f&&a.player.off(_.$f,a.a));a.player=null};FB=function(a){a.player&&a.player.trigger(new _.H(_.Ic))};
|
|
36
|
+
GB=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(_.$f,a.a,a),a.f=!0):!b&&a.f&&(a.log.debug("Stop tracking timeupdates"),a.player.off(_.$f,a.a),a.f=!1)}};HB=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 _.H(_.rg))};
|
|
37
|
+
IB=function(a,b){let c=null;for(const d of a)b>=d.startTime&&(c=d);return c};JB=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};KB=function(a,b){for(let c=0;c<a.length;c++)if(JB(a[c]).has(b))return c;return-1};MB=function(a,b){Array.from(JB(a)).forEach(c=>{c.segmentIndex&&_.LB(c.segmentIndex,b)})};
|
|
38
|
+
_.NB=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)};_.OB=function(a){return a.a/(1-Math.pow(a.h,a.f))};_.PB=function(a,b,c,d,e,f,g,h){a=_.ck(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};
|
|
39
|
+
_.QB=function(a){a=a.toLowerCase();return _.kt[a]||window.muxjs&&a===_.sc?!0:!1};RB=function(a,b,c,d){return Promise.resolve().then(()=>{if(a.w&&a.h)if(null==c||null==d)a.w.parseInit(_.E(b));else{var e={periodStart:a.A,segmentStart:c,segmentEnd:d};e=a.w.parseMedia(_.E(b),e);var f=e.cues.filter(g=>g.startTime>=a.j&&g.startTime<a.l);a.h.append(f,e.styles);null==a.a&&(a.a=Math.max(c,a.j));a.f=Math.min(d,a.l)}})};
|
|
40
|
+
SB=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.h.append(e,[]))}};
|
|
41
|
+
TB=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.j&&h.startTime<a.l))continue;const k=new _.Pt(h.startTime,h.endTime,h.text);g.get(b).get(f).push(k);b===a.B&&a.h.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.j):Math.min(a.a,Math.max(c,a.j));
|
|
42
|
+
a.f=Math.max(a.f,Math.min(d,a.l))};_.UB=function(a,b,c){a.h=b;a.a=c};WB=function(a){return 2===a.j.version?a.a.Xb():VB(a,0)};_.XB=function(a,b){a.K={offsetDateTime:b-WB(a),seekRangeStartDateTime:b}};_.YB=function(a,b){a.o=b;a.C=b;a.a.f=b};ZB=function(a){return 2===a.j.version?a.a.f?a.a.a:null:a.o?a.f:a.C?a.w:null};_.aC=function(a,b,c){var d=b.nc;a.l=null==a.l?d:Math.min(a.l,d);a.h=Math.max(a.h,b.bc);_.$B(a,b.ac);null!=a.F&&a.L&&(a.F=(Date.now()+a.H)/1E3-(a.w||0)-a.h);a.g.debug(`${c}: maxSegmentDuration=${a.h}`)};
|
|
43
|
+
_.bC=function(a,b,c){if(0!==b.length){var d=b[0].startTime+c;c=b[b.length-1].endTime+c;b=b.reduce((e,f)=>Math.max(e,f.endTime-f.startTime),a.h);_.aC(a,{nc:d,ac:c,bc:b},"notifySegments")}};_.$B=function(a,b){a.w=Math.max(a.w||0,b)};_.cC=function(a,b){a.h=Math.max(a.h,b);a.g.debug("notifyNewSegmentDuration: maxSegmentDuration\x3d"+a.h)};
|
|
44
|
+
dC=function(a){if(2===a.j.version)a=a.a.a;else if(a.o)a=a.f;else if(a.C)a=a.w||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};_.eC=function(a){return 2===a.j.version?a.a.Xb():Infinity===a.A?0:Math.max(0,dC(a)-a.A)};fC=function(a){const b=a.Nd()&&!a.C?a.J:0;return 2===a.j.version?a.a.a-b:Math.max(0,dC(a)-b)};
|
|
45
|
+
VB=function(a,b){if(2===a.j.version)return a.a.Xb();const c=Math.max(a.l,0);return Infinity===a.A?Math.ceil(1E3*c)/1E3:Math.max(c,Math.min(dC(a)-a.A+b,fC(a)))};gC=function(a,b){var c=WB(a);if(b<c)return c;c=fC(a);2===a.j.version&&(c=a.a.a);return b>c?c:b};hC=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}};
|
|
46
|
+
iC=function(a,b,c){a.f=b;a.h=c};jC=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()};kC=function(a,b=!1){return Array.from(a.a.values()).map(c=>hC(c,b)).sort((c,d)=>c.startTime-d.startTime)};
|
|
47
|
+
lC=function(a){const b=a.a.ng(),c=a.h,d=b?b.id:null;(c?c.id:null)!==d&&b&&a.f(new _.H(_.yf,{id:d}));a.h=b;"basic"===a.o.timeline&&(a.j.a=b)};mC=function(a){let b=a.h.get(a.a);if(!b)return null;0<b.a.length&&b.Da().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};_.LB=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)};
|
|
48
|
+
oC=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 nC(a,c,e)};pC=function(a,b){a.f=b};
|
|
49
|
+
qC=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};
|
|
50
|
+
rC=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,f=PA(new _.iu(d),c,a.h.gapDetectionThreshold);if(null==f){if(a.f){a=a.f;d=a.h;c=qC(d);d=d.a.currentTime;f=Date.now()/1E3;if(a.a!==d||a.l!==c)a.j=f,a.a=d,a.l=c;d=f-a.j;d>=a.o&&c&&a.f(a.a,d)}}else if((0!==f||a.A)&&a.H){var g=d.start(f);if(!(g>=fC(a.G))){var h=g-c;b=h<=b;var k=
|
|
51
|
+
!1;h<e||(b||a.l||(a.l=!0,e=new _.H("largegap",{detail:{currentTime:c,gapSize:h}}),e.cancelable=!0,a.F(e),a.h.jumpLargeGaps&&!e.defaultPrevented?k=!0:_.qh("Ignoring large gap at",c,"size",h)),!b&&!k)||(0===f?_.qh(hA,h,"seconds because of gap before start time of",g):_.qh(hA,h,"seconds because of gap starting at",d.end(f-1),"and ending at",g),a.B=!0,a.a.currentTime=g)}}}}};sC=function(a,b){a.h=a.f.currentTime;a.l=b;a.j=a.o;a.f.currentTime=b;a.a.Gb(.1)};
|
|
52
|
+
uC=function(a,b){a.w||(a.w=!0,a.o&&a.o());.001>Math.abs(a.a.currentTime-b)?tC(a):(a.f.one(a.a,_.Cf,()=>{tC(a)}),sC(a.h,0===a.a.currentTime?b:a.a.currentTime))};vC=function(a,b){a.A=b;a.f.off(a.a,_.le);a.f.one(a.a,_.le,()=>{uC(a,b)})};wC=function(a,b){0<a.a.readyState?sC(a.h,b):vC(a,b)};tC=function(a){_.Sh()&&79===_.Wh().major&&!a.l&&a.j();a.l=!0;a.f.on(a.a,_.Cf,()=>a.j())};
|
|
53
|
+
zC=function(a,b,c){if(!c.stallEnabled)return null;const d=c.gapDetectionThreshold;let e=c.stallSkip;c=new xC(new yC(b),c.stallThreshold);pC(c,(f,g)=>{a.g.warn(`Stall detected at ${f} for ${g} seconds.`);if(e){g=new _.iu(b.buffered);var h;if(h=_.Oh("Edge/")||_.Ph()||_.Sh()&&79===_.Wh().major)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)&&
|
|
54
|
+
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};BC=function(a,b,c){null==b?b=Infinity>a.a.getDuration()||c?WB(a.a):fC(a.a):0>b&&(b=fC(a.a)+b);return AC(a,gC(a.a,b))};AC=function(a,b){const c=a.a.getDuration();return b>=c?c-a.l.durationBackoff:b};
|
|
55
|
+
CC=function(a,b){if("startover"===a.a.Fc())return b;var c=new _.iu(a.h.buffered);c=c.mc.bind(c);var d=Math.max(a.B,a.l.rebufferingGoal);const e=a.l.safeSeekOffset;let f=WB(a.a);const g=fC(a.a),h=a.a.getDuration();3>g-f&&(f=g-3);const k=VB(a.a,d),l=VB(a.a,e);d=VB(a.a,d+e);if(b>=h)return a.g.debug("Playhead past duration."),AC(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");
|
|
56
|
+
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};DC=function(a,b,c=0){for(const d of a.a)d.l(a.f.currentTime,b,c)};EC=function(a,b){const c=a.offset||0;return b<a.startTime+c?1:b>a.endTime+c?3:2};FC=function(a,b,c,d){a.a=b;a.f=c;a.h=d};_.GC=function(a){_.wt[a]&&delete _.wt[a]};_.HC=function(a){_.vt[a]&&delete _.vt[a]};
|
|
57
|
+
IC=function(a,b,c){if(!(16E3>c)){var d=8E3*c/b;b/=1E3;a.a+=c;_.NB(a.f,b,d);_.NB(a.h,b,d)}};_.JC=function(a,b){return a.qa.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()})};KC=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};
|
|
58
|
+
OC=function(a,b){return _.v(function*(){b=b||a.h.contentSteeringServerUri;var c=LC(a,b);a.g.info("Sending request to content steering server, "+`URI: ${c}`);c=_.ck(c,a.A.attemptParameters);c.type=7;c=a.B.fetch(c);_.tk(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"],
|
|
59
|
+
10);d&&(a.g.info(`Will retry after ${d} s `+"based on Retry-After header."),a.f=d);MC(a,a.f)}else try{d=_.vi(c.data);const e=JSON.parse(d);1===e.VERSION?NC(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 _.Jh(()=>{OC(a)}),MC(a,a.f))}})};
|
|
60
|
+
PC=function(a,b){return _.v(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,fg:b.defaultServiceLocation?b.defaultServiceLocation.split(","):[]};b.baseUriCollections.forEach(c=>{const d=[];if(a.h.fg.length)for(const e of a.h.fg){const f=
|
|
61
|
+
c.qa.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.qa);a.o.set(c.id,c.qa)});if(b.contentSteeringServerUri){if(a.h.queryBeforeStart)return OC(a);a.g.info(`defaultServiceLocations: ${b.defaultServiceLocation}`);OC(a)}})};RC=function(a,b){let c=a.j.get(b);c||(c={vd:0,Xf:new QC,Ge:!1},a.j.set(b,c));return c};
|
|
62
|
+
LC=function(a,b){b=new URL(b);const c=[],d=[];a.j.forEach((e,f)=>{e.Ge&&(c.push(f),d.push(parseInt(e.Xf.getBandwidthEstimate(1E4),10)));e.Ge=!1});c.length?a.h.manifestType===_.tc?(b.searchParams.set("_DASH_pathway",`"${c.toString()}"`),b.searchParams.set("_DASH_throughput",d.toString())):a.h.manifestType===_.fm&&(b.searchParams.set("_HLS_pathway",`"${c.toString()}"`),b.searchParams.set("_HLS_throughput",d.toString())):a.g.debug("addQueryParams_: serviceLocations EMPTY");return b.toString()};
|
|
63
|
+
MC=function(a,b){a.g.info(`Scheduling next steering manifest update in ${b} s.`);a.a.la(b)};NC=function(a,b,c){null!=a.a&&(a.a.stop(),a.a=null);const d=b["RELOAD-URI"]||c;a.a=new _.Jh(()=>{OC(a,d)});if(c=b.TTL)a.f=c;MC(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=SC(a,h,e,f);a.l.set(h,g)})};
|
|
64
|
+
SC=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[oA]&&(h[oA].HOST&&(a=new URL(a.uri),a.hostname=h[oA].HOST,k.uri=a.toString()),h[oA].PARAMS&&Object.entries(h[oA].PARAMS).forEach(l=>{var [m,n]=l;k.params[m]=n}));e.push(k)}}return e};
|
|
65
|
+
UC=function(a,b){var c=String(TC++);c=new _.jl(c,a);c.mimeType=_.gl(b.mimeType);if(a===_.L||a===_.M)c.label=_.gl(b.label),c.language=_.gl(b.language),c.originalLanguage=_.gl(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.Ne||[],c.mimeType=_.gl(b.audioMimeType)):(c.kind=_.gl(b.kind),c.roles=b.roles);c.accessibility=a===_.N||a===_.M?(b.accessibility||[]).filter(d=>d.type===a):b.accessibility||[];return c};
|
|
66
|
+
VC=function(a,b,c){const d=new _.nl(a===_.N?`${b.hc}`:a===_.M?`${b.kc}`:`${b.id}`,c);switch(a){case _.N:d.codec=_.gl(b.bh);d.bandwidth=b.Ie||b.bandwidth;d.width=b.width;d.height=b.height;d.originalId=b.kf;break;case _.M:d.codec=_.gl(b.audioCodec);d.bandwidth=b.fe||b.bandwidth;d.originalId=b.jf;break;default:d.codec=_.gl(b.codecs),d.originalId=b.Jg}(a=c.renditions.find(e=>_.fh(e,d,null,["id","track"])))||c.renditions.push(d);return a||d};
|
|
67
|
+
WC=function(a,b){a=a.reduce((c,d)=>{b===_.N?null===d.hc||c[d.hc]&&!d.ee||(c[d.hc]=d):b===_.M&&(null===d.kc||c[d.kc]&&!d.de||(c[d.kc]=d));return c},{});return Object.values(a)};XC=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};
|
|
68
|
+
YC=function(a,b){if(a.a!==b)if(3===a.a&&0!==b)b=_.Hi(b,_.Ri),a.g.info(_.kA+`${b}`);else{var c=a.h;c=0===c?0:Date.now()-c;var d=a.a;a.a=b;a.h=Date.now();a.D.xi(b);6===b&&(a.D.isSeeking()?a.f=1:a.f=2);var e=a.f;{let f=void 0;if(6===b||6===d)f=e;a.D.trigger(new _.H(_.af,{detail:{currentState:b,previousState:d,timeSinceLastStateChangeMS:c,reason:f}}))}11!==b&&3!==b||a.D.Di();6===b?a.D.trigger(new _.H(_.Oc,{detail:{bufferedTimeMS:-1,reason:e}})):6===d&&a.D.trigger(new _.H(_.Nc,{detail:{bufferedTimeMS:c,
|
|
69
|
+
reason:e}}))}};ZC=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};_.$C=function(a,b){a.forEach(c=>{c.startTime+=b;c.endTime+=b})};aD=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}};bD=function(a){return Object.assign({},a,{periods:a.periods.map(b=>Object.assign({},b))})};
|
|
70
|
+
cD=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=aD(a[d-1]).end;_.$C(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=aD(c).end;_.UB(b.a,0,d);(a=a[0].presentationTimeline.Ec())&&_.XB(b,a.seekRangeStartDateTime);
|
|
71
|
+
return c};eD=function(a,b){try{if(1===a.length)return a[0];if(!a.every(dD))throw new _.vj("Period durations must be finite");return cD(a,b)}catch(c){throw new _.J(_.C,7,7003,"Failed to join manifests into a continuous playlist!",c);}};dD=function(a){return a.periods.every(b=>null!=b.endTime&&0<=b.endTime&&isFinite(b.endTime))};
|
|
72
|
+
fD=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};_.YB(a,b.presentationTimeline.o);return eD([d,b],a)};gD=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}};hD=function(a,b){return b.find(c=>c.id===a.id)||null};
|
|
73
|
+
iD=function(a,b){return a.h.filter(c=>c.type===b)};jD=function(a,b){return(a=a.a.get(b)||null)&&a.track};kD=function(a,b,c){if(!c||jD(a,c.type)!==c||a.m.va())switch(c=c?c.renditions[0]||null:null,b){case _.N:a.rb(c);break;case _.M:a.Db(c);break;case _.L:a.Eb(c);break;default:throw Error(`Unknown track type ${b}`);}};
|
|
74
|
+
oD=function(a,b,c){lD(a,b,_.N);if(mD(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=d.bd().filter(h=>h.hc===parseInt(b.id,10));f=g.find(h=>h.kc===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.kc))||null}}else f=d.bd().find(g=>g.hc===parseInt(b.id,10))||null;f?(a.f.set(_.N,b),nD(d,f,c)):
|
|
75
|
+
a.g.warn("Cannot find matching variant")}};sD=function(a,b){_.v(function*(){lD(a,b,_.L);if(mD(a,b,_.L)){var c=a.m.sa().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{pD(a,b),yield qD(a.m,!0),yield rD(a.m,c),a.m.trigger(new _.H(_.Vf))}catch(d){a.g.warn("Failed to set text rendition",d)}}else a.g.warn(`Text rendition with ID: ${b.id} not found.`)}})};
|
|
76
|
+
tD=function(a){_.v(function*(){if(jD(a,_.L)){a.g.info("Unset text rendition.");try{yield qD(a.m,!1),a.a.set(_.L,null),a.m.trigger(new _.H(_.Vf))}catch(b){a.g.warn("Failed to unset text rendition",b)}}})};
|
|
77
|
+
xD=function(a){if(a.m){a.g.debug("Track list change detected, updating track list");var b=[];for(var c of Object.values(_.fu))a.a.set(c,null),a.f.set(c,null);for(var d of a.m.sa()){let e=UC(_.L,d);e=(c=b.find(g=>e.Xc(g)))||e;const f=VC(_.L,d,e);d.Le&&a.a.set(_.L,f);c||b.push(e)}uD(a.m)||a.a.set(_.L,null);d=a.m.bd();vD(a,b,d,_.N);vD(a,b,d,_.M);wD(a,b);a.h=b}};pD=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
|
+
mD=function(a,b,c){return a.m.va()?!0:(a.a.get(c)||null)===b?!1:!0};lD=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");};vD=function(a,b,c,d){c=WC(c,d);for(const e of c){let f=UC(d,e);f=(c=b.find(h=>f.Xc(h)))||f;const g=VC(d,e,f);(d===_.N&&e.ee||d===_.M&&e.de)&&a.a.set(d,g);c||b.push(f)}};
|
|
79
|
+
wD=function(a,b){var c=a.m;if(c.f){var d=(d=yD(c))?zD(c.l,d).ib: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(TC++),c=new _.jl(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 _.nl(`${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
|
+
AD=function(a,b,c){return iD(a,c).flatMap(d=>d.renditions).find(d=>parseInt(d.id,10)===b)||null};BD=function(a,b,c,d){a.h.length||xD(a);const e=a.a.get(c)||null;(b=AD(a,b,c))&&e!==b&&(pD(a,b),c===_.M?a.m.trigger(new _.H(_.Jc)):c===_.N&&a.m.trigger(new _.H(_.sg,{details:{width:b.width||0,height:b.height||0,bandwidth:b.bandwidth,track:b.track,abrSelection:d}})))};CD=function(a){const b=_.Gl(a.mimeType,a.codecs),c=nB(a);return _.QB(b)||_.Js(c)||(_.Fl(b,a.type)?!0:!1)};
|
|
81
|
+
ED=function(a,b){if(window.ManagedMediaSource){a.j.disableRemotePlayback=!0;var c=new ManagedMediaSource;a.l.one(c,"sourceopen",()=>{URL.revokeObjectURL(a.A);b.resolve()});a.l.on(c,"startstreaming",()=>{a.R=!0});a.l.on(c,"endstreaming",()=>{a.R=!1});a.A=DD(c);a.j.src=a.A;return c}c=new MediaSource;a.A=DD(c);a.l.one(c,"sourceopen",()=>{URL.revokeObjectURL(a.A);b.resolve()});a.j.src=a.A;return c};
|
|
82
|
+
GD=function(a,b){a.f||(a.f=new FD(a.I,a.C));a=a.f;if(b!==_.sc){var c=_.kt[b];if(!c)throw new _.J(_.C,2,2012,"Text parser is unavailable for "+b);a.w=new c(a.C)}};ID=function(a,b){return _.v(function*(){for(const d of b){const [e,f]=d;{const g=e;var c=a.a[g];c?yield HD(a,g,c):(c=a.o.addSourceBuffer(f),a.l.on(c,_.Sd,a.ca.bind(a,g)),a.l.on(c,"updateend",a.B.bind(a,g)),a.a[g]=c);a.J[g]=f;a.h[g]=[];a.G[g]=!1}}})};JD=function(a){a.g.debug("Reset transmuxers.");Object.values(a.w).forEach(b=>b.reset())};
|
|
83
|
+
HD=function(a,b,c){return _.v(function*(){yield KD(a,b,()=>{c.remove(0,Infinity)})})};KD=function(a,b,c){if(a.K)return Promise.reject();c={start:c,p:new _.uk};a.h[b].push(c);1===a.h[b].length&&LD(a,b);return c.p};MD=function(a){return a.I.streaming.ignoreManagedMediaSourceStreamingHints?!0:a.R};ND=function(a){return a.o?a.o.readyState===_.Rd:!0};OD=function(a,b){try{return new _.iu(a.a[b].buffered,b)}catch(c){return b in a.a&&a.g.error("failed to get buffered range for "+b,c),null}};
|
|
84
|
+
PD=function(a){const b={};b.total=new _.iu(a.j.buffered,"total");b.audio=OD(a,_.q);b.video=OD(a,_.t);let c=[];a.f&&(c=[{start:a.f.Vb(),end:a.f.Na()}]);b.text=vB(c,_.I);return b};QD=function(a,b){return a.a[b]?(a=OD(a,b))?a.toString():"":""};
|
|
85
|
+
RD=function(a,b,c,d,e,f,g,h,k){h=void 0===h?!1:h;k=void 0===k?!1:k;const l=a.a[b];let m=-1,n=0;l&&l.buffered&&(n=l.buffered.length);b===_.t&&null!==d&&null!==e&&h&&(m=0<n?l.buffered.end(n-1):-1);b===_.I?k=RB(a.f,c,d,e):a.w[b]?(c=a.w[b].transmux(c),c.captions&&0<c.captions.length&&(a.f||GD(a,_.Tf),TB(a.f,c.captions,d,e,a.a.video.timestampOffset)),f=[],0<c.audio.byteLength&&a.a.audio&&!k&&f.push(KD(a,_.q,a.L.bind(a,_.q,c.audio.buffer))),0<c.video.byteLength&&a.a.video&&f.push(KD(a,_.t,a.L.bind(a,_.t,
|
|
86
|
+
c.video.buffer))),k=Promise.all(f)):(f&&window.muxjs&&(a.f||GD(a,_.Tf),null==d&&null==e?a.H.init(c):a.H.h(c,p=>{p.length&&TB(a.f,p,d,e,a.a.video.timestampOffset)})),k=KD(a,b,a.L.bind(a,b,c)));return k.then(()=>{if(b===_.t&&null!==d&&null!==e&&!h)a.F.append(d,e,g),null!==d&&null!==e&&a.g.debug("Appended video segment ",d,e,"Buffer:",QD(a,b));else if(b===_.q&&null!==d&&null!==e)FB(a.F),null!==d&&null!==e&&a.g.debug("Appended audio segment ",d,e,"Buffer:",QD(a,b));else if(b===_.t&&null!==d&&null!==e&&
|
|
87
|
+
h){var p=l.buffered.length,u=0<p?l.buffered.end(p-1):-1;0>m&&0<p&&(m=l.buffered.start(0));0<=m&&0<u&&a.F.append(m,u,g)}if(!a.G[b]&&l&&1===l.buffered.length){p=l.buffered.start(0);const x=d-p;if(Math.abs(x)>a.da&&0===l.timestampOffset)return a.g.warn(`Detected a delta of ${x} between `+`media times and segment times for ${b}. `+`The segment start time is ${d} and the media start time `+`is ${p}. Adjusting timestampOffset.`),p=KD(a,b,()=>{a.W(b,x)}),u=KD(a,b,a.S.bind(a,b,!1)),Promise.all([p,u])}null!==
|
|
88
|
+
d&&null!==e&&(a.G[b]=!0)}).catch(p=>{throw p;})};SD=function(a,b){const c=a.Na(_.t)||0;SB(a.f,b,c)};TD=function(a){a.f&&SB(a.f,"",0)};UD=function(a,b,c,d){return _.v(function*(){if(b!==_.I&&BB()&&a.I.mediaSource.codecSwitchingStrategy===_.Hf){var e=_.Gl(c,d);qB(a.J[b],e)||(yield KD(a,b,()=>{a.g.info(`Change MIME type of ${b} to ${e}`);a.a[b].changeType(e);a.J[b]=e;a.B(b)}))}})};VD=function(a,b,c,d,e){return[KD(a,b,a.Z.bind(a,b)),KD(a,b,a.W.bind(a,b,c)),KD(a,b,a.ja.bind(a,b,d,e))]};
|
|
89
|
+
WD=function(a,b,c,d,e,f,g){return _.v(function*(){if(b===_.I){a.f.A=c;var h=a.f;h.j=d;h.l=e}else yield UD(a,b,f,g),h=VD(a,b,c,d,e),a.P&&(h=h.concat(VD(a,_.q,c,d,e))),yield Promise.all(h)})};
|
|
90
|
+
YD=function(a,b){return _.v(function*(){if(a.K)return Promise.reject();const c=[];for(const d in a.a){const e=new _.uk,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 _.J(_.C,3,3015,{mediaError:d}))}finally{for(const d in a.a)XD(a,d)}})};
|
|
91
|
+
ZD=function(a,b){YD(a,()=>{a.o.duration=b})};XD=function(a,b){a.h[b].shift();LD(a,b)};LD=function(a,b){const c=a.h[b][0];if(c)try{a.g.debug("Starting next operation for "+b),c.start()}catch(d){"QuotaExceededError"===d.name?c.p.reject(new _.J(_.C,3,3017,{type:b})):c.p.reject(new _.J(_.C,3,3015,{mediaError:d})),XD(a,b)}else a.g.debug("No more scheduled operations for "+b)};
|
|
92
|
+
eE=function(a,b,c,d){const e=a.periods.flatMap(k=>k.variants);var f=e;if(b.length||c.length)f=$D(f,b,c);f=aE(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&&
|
|
93
|
+
null===m.audio?!1:l.has(k(m.audio.codecs)))}f=bE(f);const h=cE(f);for(const k of a.periods)k.variants=k.variants.filter(l=>{if(dE(l)===h)return!0;_.rh("Dropping Variant (better codec available)",l);return!1})};
|
|
94
|
+
$D=function(a,b,c){if(!b.length&&!c.length)return a;const d=a.filter(g=>(g=g.audio)&&c.length&&(g=_.pB(g.codecs),c.includes(g))?!0:!1),e=a.filter(g=>(g=g.video)&&b.length&&(g=_.pB(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};
|
|
95
|
+
aE=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))};bE=function(a){const b=new _.Ct;for(const c of a)a=dE(c),b.push(a,c);return b};
|
|
96
|
+
cE=function(a){let b="",c=Infinity;a.forEach((d,e)=>{e=e.reduce((f,g)=>f+g.bandwidth||0,0)/e.length;_.rh(_.md,d,"avg bandwidth",e);e<c&&(b=d,c=e)});return b};dE=function(a){let b="";a.video&&(b=_.pB(a.video.codecs));let c="";a.audio&&(c=_.pB(a.audio.codecs));return b+"-"+c};fE=function(a,b,c,d){let e=a.periods.flatMap(f=>f.variants);if(b.length||c.length)e=$D(e,b,c);e=aE(e,d);for(const f of a.periods)f.variants=f.variants.filter(g=>e.includes(g))};
|
|
97
|
+
gE=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};hE=function(a,b){let c=!1;for(const d of a)a=d.allowedByApplication,d.allowedByApplication=gE(d,b),a!==d.allowedByApplication&&(c=!0);return c};
|
|
98
|
+
kE=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&&!WA(a,g))return _.rh("Dropping variant - not compatible with key system",g),!1;let h=g.audio;const k=g.video;if(h&&!CD(h)){const l=h.codecs;0<=h.codecs.indexOf(_.Od)?(_.rh("Trying to use AC-3 for EC-3"),h.codecs=h.codecs.replace(_.Od,"ac-3"),CD(h)?_.qh("Using AC-3 instead of EC-3 for",iE(h)):(h.codecs=l,_.qh(mA,iE(h)),g.audio=null,f=!0,h=null)):(_.qh(mA,iE(h)),g.audio=null,f=!0,h=null)}return k&&!CD(k)?(_.qh("Dropping variant - video not compatible with platform",
|
|
99
|
+
iE(k)),!1):h&&b&&!jE(h,b,e)?(_.qh("Dropping variant - not compatible with active audio","active audio",iE(b),"variant.audio",iE(h)),!1):k&&c&&!jE(k,c,e)?(_.qh("Dropping variant - not compatible with active video","active video",iE(c),"variant.video",iE(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?(_.qh("Dropping variant - not compatible with video + audio","variant.video",
|
|
100
|
+
iE(k.video)),!1):!0))}d.textStreams=d.textStreams.filter(g=>{const h=_.QB(_.Gl(g.mimeType,g.codecs));h||_.rh("Dropping text stream. Is not supported by the platform.",g);return h})};
|
|
101
|
+
iE=function(a){const b=nB(a);return a.type===_.q?"type\x3daudio mimeType\x3d"+a.mimeType+" codecs\x3d"+a.codecs+" codecInfo\x3d"+b+" bandwidth\x3d"+a.bandwidth+" channelsCount\x3d"+a.channelsCount:a.type===_.t?"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"};
|
|
102
|
+
jE=function(a,b,c){return a.mimeType!==b.mimeType||(void 0===c||c)&&a.codecs.split(".")[0]!==b.codecs.split(".")[0]?!1:!0};
|
|
103
|
+
lE=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 p of c.roles)l.add(p);n=[c,b].map(p=>p?p.accessibility||[]:[]).reduce((p,u)=>p.concat(u),[]);a={id:a.id,ee:!1,de:!1,Le:!1,type:"variant",bandwidth:a.bandwidth,language:a.language,originalLanguage:a.language,label:null,
|
|
104
|
+
kind:k,width:null,height:null,frameRate:null,trickPlay:!1,mimeType:g,audioMimeType:h,codecs:f.join(", "),audioCodec:d,bh:e,primary:a.primary,roles:Array.from(l),Ne:Array.from(m),hc:null,kc:null,channelsCount:null,spatialAudio:!1,fe:null,Ie:null,kf:null,jf:null,Jg:null,accessibility:n};c&&(a.hc=c.id,a.kf=c.originalId,a.width=c.width||null,a.height=c.height||null,a.frameRate=c.frameRate||null,a.trickPlay=!!c.trickPlay,a.Ie=c.bandwidth||null);b&&(a.kc=b.id,a.jf=b.originalId,a.originalLanguage=b.originalLanguage,
|
|
105
|
+
a.channelsCount=b.channelsCount,a.fe=b.bandwidth||null,a.label=b.label,a.Ne=b.roles);return a};
|
|
106
|
+
mE=function(a){return{id:a.id,ee:!1,de:!1,Le:!1,type:_.I,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,bh:null,primary:a.primary,roles:a.roles,Ne:null,hc:null,kc:null,channelsCount:null,spatialAudio:!1,fe:null,Ie:null,kf:null,jf:null,Jg:a.originalId,accessibility:a.accessibility,keyId:null}};
|
|
107
|
+
nE=function(a){return a.allowedByApplication&&a.allowedByKeySystem};
|
|
108
|
+
_.pE=function(a,b,c,d){b=_.kj(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=_.hB(_.Tj(h),a.map(l=>l.language));return k?(e=a.filter(l=>_.Tj(l.language)===k),!0):!1});d&&e.some(h=>h.kind===_.Ud)&&(e=e.filter(h=>h.kind===_.Ud));if(c){b=oE(e,c);if(b.length)return b;_.A("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(_.bB,
|
|
109
|
+
[]);return b.length?oE(e,b[0]):e};oE=function(a,b){return a.filter(c=>c.roles.includes(b))};qE=function(a,b,c){if(a.A&&a.a.useCmsd){const d=ZA(a.A);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=>gE(d,b)));return a.sort((d,e)=>d.bandwidth-e.bandwidth)};
|
|
110
|
+
rE=function(a,b,c,d){if(a.l&&!c.stopped&&!b.a){var e=Date.now()-c.$i,f=b.f?b.f.bytesLoaded||0:0,g=b.f?b.f.bytesRemaining:-1;if(0>=f||e<d)c.Gf=setTimeout(()=>rE(a,b,c,d),500);else{var h=a.f.find(l=>l.id===a.j);h=h?h.bandwidth:a.getBandwidthEstimate();var k=8E3*f/e;sE(a,k,h,0<=g?8E3*g/k:Infinity)&&tE(a,h)?(IC(a.w,e,f),c.stop(),b.abort(),uE(a,k)):c.Gf=setTimeout(()=>rE(a,b,c,d),500)}}};sE=function(a,b,c,d){return 0===b||Infinity===d||300>d?!1:b<c/(a.a.bandwidthDowngradeTarget||1)};
|
|
111
|
+
tE=function(a,b){return qE(a,a.a.restrictions||null,a.f).filter(c=>c.bandwidth<b).pop()||null};uE=function(a,b){b=tE(a,b)||a.f[0];a.h=Date.now();a.o(b)};vE=function(a){return new _.J(_.C,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.")};wE=function(a,b){if(b&&(null==a.a||a.a!==b))throw vE(a);};zD=function(a,b){a.a.has(b)||a.a.set(b,new xE);return a.a.get(b)};yE=function(a,b,c){zD(a,b).text=c};
|
|
112
|
+
BE=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||zE(d,e))&&AE(d.roles,e.roles))}!d&&(d=a.video&&b.video)&&(a=a.video,b=b.video,d=!((!c||zE(a,b))&&AE(a.roles,b.roles)));return d?!1:!0};
|
|
113
|
+
zE=function(a,b){if(a.mimeType!==b.mimeType)return!1;a=oB(a.codecs).map(c=>_.pB(c));b=oB(b.codecs).map(c=>_.pB(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};AE=function(a,b){a=new Set(a);b=new Set(b);a.delete(_.ne);b.delete(_.ne);if(a.size!==b.size)return!1;for(const c of a)if(!b.has(c))return!1;return!0};CE=function(a,b){let c=null;b.some(d=>{c=_.hB(_.Tj(d),a.map(e=>gB(e)));return!!c});return c?a.filter(d=>c===gB(d)):[]};
|
|
114
|
+
DE=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)})};EE=function(a,b){return a.filter(c=>c.audio&&c.audio.spatialAudio!==b?!1:!0)};
|
|
115
|
+
FE=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};GE=function(a,b){a.f=b};HE=function(a,b){a.j=b;a.j.speedUpMode&&(a.A=a.j.speedUpMode)};
|
|
116
|
+
KE=function(a,b){a.a.stop();a.l||(a.o=!1);const c=a.l?0:a.h;if((b?b:a.A)===_.xd||0===c||1===c)try{IE(a,c)}catch(d){a.g.warn('Set playbackRate using "decoder" mode fails, due to unsupported range by platform. Fallback to "seek" mode.',d),JE(a)}else JE(a)};IE=function(a,b){if(a.f.lc()!==b){a.g.debug(nA,b,' using native playbackRate "decoder" mode.');try{a.f.qd(b)}catch(c){throw c;}}};JE=function(a){a.g.debug(nA,a.h,' using "seek" mode.');IE(a,0);a.o=!0;a.a.Gb(.25)};
|
|
117
|
+
ME=function(a){a=_.E(a);let b=!1,c;const d=[],e=h=>{d.push(h);_.Um(h)},f=()=>{b=!0},g=[];(new _.an).N(_.ue,e).N(_.bg,e).N(_.pe,e).N(_.te,e).N(_.Mf,e).fa(_.Of,h=>{c=h;d.push(h);_.Vm(h)}).fa("encv",f).fa("enca",f).fa("avc1",h=>{g.push({N:h,nd:1701733238})}).fa("avc3",h=>{g.push({N:h,nd:1701733238})}).fa("ac-3",h=>{g.push({N:h,nd:1701733217})}).fa(_.Od,h=>{g.push({N:h,nd:1701733217})}).fa("mp4a",h=>{g.push({N:h,nd:1701733217})}).parse(a);if(b)return _.qh("Init segment already indicates encryption."),
|
|
118
|
+
a;if(0===g.length||!c)throw _.sh("Failed to find boxes needed to fake encryption!"),_.sh("Failed init segment (hex):",_.Nk(a)),new _.J(_.C,3,14E3);g.reverse();for(const h of g)_.qh(`Inserting "${_.Tm(h.nd)}" box into init segment.`),a=LE(a,c,h.N,d,h.nd);return a};
|
|
119
|
+
LE=function(a,b,c,d,e){{var f=NE.value(),g=a.subarray(c.start,c.start+c.size);const k=_.si(g);var h=new Uint8Array(c.size+f.byteLength);h.set(g,0);g=_.si(h);g.setUint32(4,e);h.set(f,c.size);e=k.getUint32(4);g.setUint32(c.size+16,e);OE(h,0,h.byteLength);e=h}h=new Uint8Array(a.byteLength+e.byteLength);c=_.Oh("Xbox One")||_.Lh()?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)OE(h,k.start,k.size+e.byteLength);a=_.si(h,b.start);b=_.Xm(b);
|
|
120
|
+
d=a.getUint32(b);a.setUint32(b,d+1);return h};OE=function(a,b,c){a=_.si(a,b);b=a.getUint32(0);0!==b&&(1===b?(a.setUint32(8,c>>32),a.setUint32(12,c&4294967295)):a.setUint32(0,c))};PE=function(a){return"("+a.type+":"+a.stream.id+")"};QE=function(a){return!a.Cb&&null==a.sb&&!a.ic&&!a.xc};RE=function(a){a.periods.every(b=>typeof b.id===_.Nf)};SE=function(a){null!=a.sb&&(a.sb.stop(),a.sb=null)};TE=function(a){return _.v(function*(){a.Rb&&(yield a.Rb.abort())})};
|
|
121
|
+
$E=function(a,b,c){return _.v(function*(){var d=a.D.xb();const e=UE(a,d);null==e?a.g.warn("Cannot initialize streams, period not found at",d):(d=VE(b),yield a.D.$.init(d,a.h.forceNativeTS,a.h.disableAudioTracks),a.f||(WE(a),yield XE(a,new Set(d.values())),a.f||d.forEach((f,g)=>{a.a.has(g)||(f=YE(f,e,c),a.a.set(g,f),ZE(a,f,0))})))})};aF=function(a,b){a=a.j.periods.find(c=>c.id===b)||null;if(!a)throw new _.J(_.C,5,5006,`Period ${b} not found`);return a};
|
|
122
|
+
bF=function(a){var b=a.a.get(_.t);return b?aF(a,b.cc):(b=a.a.get(_.q))?aF(a,b.cc):null};_.cF=function(a,b){return(a=a.a.get(b))?a.qc||a.stream:null};dF=function(a){return _.cF(a,_.q)};eF=function(a){return _.cF(a,_.t)};
|
|
123
|
+
XE=function(a,b){return _.v(function*(){const c=[];for(const f of b){const g=a.o.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.o.set(f.id,new _.uk),c.push(f.createSegmentIndex(a.D.Bb,a.h.attemptParameters)))}try{if(yield Promise.all(c),a.f)return}catch(f){if(a.f)return;for(var d of b){var e=a.o.get(d.id);e&&(e.catch(()=>{}),e.reject(),a.o.delete(d.id))}throw f;}for(e of b)(d=a.o.get(e.id))&&!d.done&&(d.resolve(),
|
|
124
|
+
a.g.debug("(all) finished setting up stream "+e.id))})};UE=function(a,b){return(a=IB(a.j.periods,b+_.Xt))?a.id:null};YE=function(a,b,c){return{stream:a,type:a.type,$b:null,segmentIterator:null,oa:null,qc:null,ve:!0,cc:b,endOfStream:!1,Cb:!1,sb:null,ic:!1,ie:0,Je:!1,xc:!1,rf:!1,dd:!1,Ug:c||0,Rb:null,le:!1,Ag:0}};ZE=function(a,b,c){a.g.debug(PE(b),"updating in "+c+" seconds");b.sb=(new _.zt(()=>_.v(function*(){try{yield a.dc(b)}catch(d){if(a.D)a.D.onError(d)}}))).la(c)};
|
|
125
|
+
fF=function(a,b){return _.v(function*(){yield a.D.$.clear(_.I);a.I++;a.J=!1;var c=a.I,d=a.D.$;const e=new Map,f=new Set;e.set(_.I,b);f.add(b);yield d.init(e,!1,a.h.disableAudioTracks);a.f||(yield XE(a,f),a.f||(d=d.getTextDisplayer().isTextVisible()||a.h.alwaysStreamText,a.I!==c||a.a.has(_.I)||a.J||!d||(c=a.D.xb(),d=UE(a,c),null==d?a.g.warn("Cannot set up text media state, period not found at",c):(c=YE(b,d,0),a.a.set(_.I,c),ZE(a,c,0)))))})};
|
|
126
|
+
gF=function(a){a.J=!0;const b=a.a.get(_.I);b&&(a.g.info("Unload text stream"),SE(b),TE(b).catch(()=>{}),a.a.delete(_.I))};hF=function(a){return _.v(function*(){const b=a.a.get(_.q);b&&(a.g.info("Unload audio stream"),SE(b),yield TE(b).catch(()=>{}),a.a.delete(_.q))})};
|
|
127
|
+
nF=function(a,b,c,d){return _.v(function*(){const e=a.a.get(b.type);if(!e&&b.type===_.I&&a.h.ignoreTextStreamFailures)yield fF(a,b);else if(e){var f=iF(a,b).id;if(c&&f!==e.cc){a.g.debug("switch: switching to stream in another Period; clearing buffer and changing Periods");for(var g of a.a.values())jF(a,g)}else if(e.qc&&(a.g.debug("switch during trick play mode",b),b.trickModeVideo?(e.qc=b,b=b.trickModeVideo,a.g.debug("switch found trick play stream",b)):(e.qc=null,a.g.debug("switch found no special trick play stream"))),
|
|
128
|
+
g=a.B.get(f),g=!(!g||!g.uf))if(g=a.o.get(b.id),(g=!(!g||!g.uf))||(yield XE(a,new Set([b]))),e.stream!==b){g=a.j.presentationTimeline.getDuration();var h=a.D.xb();h=kF(a,e,h);if(!c&&(e.endOfStream||h>=g))a.g.debug(NA+PE(e)+" already buffered to the end. Not switching.");else{b.type===_.I&&GD(a.D.$,_.Gl(b.mimeType,b.codecs));e.stream=b;e.stream.segmentIterator=null;e.ve=!0;a.g.debug("switch: switching to Stream "+PE(e));if(e.Rb)if(g=a.D.xb(),h=a.D.$.Na(e.type),f=(f=lF(a,e,g,h,f))?f.Gd():null,null==
|
|
129
|
+
f)f=!1;else{var k=e.stream.initSegmentReference;k&&(f+=k.Gd()||0);k=a.D.Dd().getBandwidthEstimate();8*f/k<(null===h?0:h-g)-Math.max(a.j.minBufferTime||0,a.h.rebufferingGoal)?f=!0:(g=e.Rb,g=g.f?g.f.bytesRemaining:-1,f=0>g||g>f?!0:!1)}else f=!1;f&&(a.g.info("Aborting current segment request to switch."),e.Rb.abort());if(c)if(e.xc)e.Je=!0;else if(e.Cb)e.ic=!0,e.ie=d,e.Je=!0;else{SE(e);try{yield mF(a,e,!0,d)}catch(l){if(a.D)a.D.onError(l)}}}}else a.g.debug(NA+PE(e)+" already active")}})};
|
|
130
|
+
oF=function(a,b){_.v(function*(){const c=a.a.get(_.t);if(c){var d=c.stream;if(d)if(b){const e=d.trickModeVideo;e&&!c.qc&&(a.g.debug("Switching to trick mode",e),yield nF(a,e,!1,0),c.qc=d)}else if(d=c.qc)a.g.debug("Switching back from trick mode",d),c.qc=null,yield nF(a,d,!0,0)}})};pF=function(a,b,c,d){return _.v(function*(){b.video&&(yield nF(a,b.video,c,d));b.audio&&(yield nF(a,b.audio,c,d))})};
|
|
131
|
+
jF=function(a,b){return _.v(function*(){const c=PE(b);if(b.xc)a.g.debug(c,"clear: already clearing the buffer");else if(b.ic)a.g.debug(c,"clear: already waiting");else if(b.Cb)a.g.debug(c,"clear: currently updating"),b.ic=!0,b.ie=0;else if(null==a.D.$.Vb(b.type))a.g.debug(c,"clear: nothing buffered"),null==b.sb&&ZE(a,b,0);else{a.g.debug(c,"clear: handling right now");SE(b);try{yield mF(a,b,!1,0)}catch(d){if(a.D)a.D.onError(d)}}})};
|
|
132
|
+
qF=function(a){return _.v(function*(){if(!a.A){a.A=!0;yield hF(a);var b=a.a.get(_.t);yield jF(a,b)}})};rF=function(a,b,c,d){return _.v(function*(){yield nF(a,b,c,d)})};sF=function(a,b){return _.v(function*(){if(a.A){a.A=!1;const c=a.D.xb();yield $E(a,{audio:b},c)}yield nF(a,b,!0,0)})};_.tF=function(a,b){return _.v(function*(){yield nF(a,b,!0,0)})};WE=function(a){const b=a.j.presentationTimeline.getDuration();Infinity>b?ZD(a.D.$,b):ZD(a.D.$,Math.pow(2,32))};
|
|
133
|
+
uF=function(a){for(const b of a.a.values()){a=b.oa;const c=b.$b;a&&c&&(a=c.getSegmentReference(a.position))&&(b.oa=a)}};vF=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;RE(a.j);WE(a);uF(a)};
|
|
134
|
+
wF=function(a){const b=a.D.xb();let c=!1;const d=UE(a,b);if(Array.from(a.a.values()).every(f=>f.cc===d))for(const f of a.a.keys()){var e=a.a.get(f);e.stream.segmentIterator=null;a.D.$.mc(f,b,0)||(jF(a,e),c=!0)}else if(!Array.from(a.a.keys()).every(f=>a.D.$.mc(f,b,0))){a.g.debug("(all): seeked: unbuffered seek: clearing all buffers");for(e of a.a.values())jF(a,e);c=!0}c||a.g.debug("(all): seeked: buffered seek: presentationTime\x3d"+b)};
|
|
135
|
+
xF=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.w)a.g.error("Unable to retry after StreamingEngine encountered a fatal error!");else for(const c of a.a.values()){const d=PE(c);if(c.dd||b&&QE(c))a.g.info(d,"Retrying after failure..."),c.dd=!1,ZE(a,c,.1)}};yF=function(a){return Array.from(a.a.values()).some(b=>null!==b.sb)};zF=function(a){const b=Array.from(a.a.values());return a.C&&b.every(c=>c.endOfStream)};
|
|
136
|
+
mF=function(a,b,c,d){return _.v(function*(){const e=PE(b);b.ic=!1;b.Je=!1;b.ie=0;b.xc=!0;b.stream.segmentIterator=null;a.g.debug(e,"clearing buffer");if(d){var f=a.D.xb();const g=a.D.$.getDuration();f=a.D.$.remove(b.type,f+d,g)}else f=a.D.$.clear(b.type).then(()=>!a.f&&c?a.D.$.flush(b.type):null);yield f;a.f||(a.g.debug(e,"cleared buffer"),b.$b=null,b.oa=null,b.xc=!1,b.endOfStream=!1,b.le=!1,ZE(a,b,0))})};
|
|
137
|
+
GF=function(a){return _.v(function*(){const b=[];for(const c of a.a.values())SE(c),c.Cb&&c.Rb&&(c.Cb=!1,b.push(c.Rb.abort())),c.ic&&b.push(mF(a,c,!0,0));yield Promise.all(b)})};HF=function(a,b,c){(a=a.a.get(b))&&c&&(SE(a),a.stream=c,a.$b=c,a.oa&&(a.oa=c.getSegmentReference(a.oa.position)),a.oa||(a.$b=null))};kF=function(a,b,c){return b.$b&&b.oa?iF(a,b.$b).startTime+b.oa.endTime:Math.max(c,b.Ug)};IF=function(a){a.F=!0;a.g.debug("calling onCanSwitch()...");a.D.Eg()};
|
|
138
|
+
lF=function(a,b,c,d,e){if(null==e)return a.g.warn(eA),null;if(b.stream.segmentLookupStrategy===_.CA)b.stream.segmentIterator?a=mC(b.stream.segmentIterator):b.oa||d?(c=b.oa?b.oa.endTime:d,a.g.info(gA,"looking up segment from new stream endTime:",c),b.stream.segmentIterator=oC(b.stream.segmentIndex,c),e=b.stream.segmentIterator.next().value,null===e&&(b.stream.segmentIterator=null,a.g.warn(gA,tA,"endTime:",c,b.oa)),a=e):(e=aF(a,e),e=Math.max(0,c-e.startTime),a.g.info(gA,"looking up segment","lookupTime:",
|
|
139
|
+
e,GA,c),b.stream.segmentIterator=oC(b.stream.segmentIndex,e),b=b.stream.segmentIterator.next().value,null===b&&a.g.warn(gA,tA,"lookupTime:",e,GA,c),a=b);else{var f=PE(b);if(b.oa&&b.stream===b.$b)c=b.oa.position+1,a.g.debug(f,"next position known:","position\x3d"+c),a=JF(a,b,e,c);else{if(b.oa){a.g.debug(f,"next position unknown: another Stream buffered");f=iF(a,b.$b);var g=KF(a,b,f.startTime+b.oa.endTime,e)}else a.g.debug(f,"next position unknown: nothing buffered"),g=KF(a,b,d||c,e);if(null==g)a=null;
|
|
140
|
+
else if(f=JF(a,b,e,g),null==f)a=null;else{var h=null==a.h?!1:a.h.ignoreDrift;null==d&&!h&&f.Ka+f.startTime+2>c&&(a=JF(a,b,e,Math.max(0,g-1)))&&(f=a);a=f}}}return a};VE=function(a){const b=new Map;a.audio&&b.set(_.q,a.audio);a.video&&b.set(_.t,a.video);a.text&&b.set(_.I,a.text);return b};
|
|
141
|
+
LF=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 _.uk;a.B.set(b,d);c=aF(a,b);const e=new Set;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(()=>{if(!a.f)return XE(a,e)}).then(()=>{a.f||(d.resolve(),a.g.debug(`(all) setup Period ${b}`))}).catch(f=>{a.f||
|
|
142
|
+
(d.catch(()=>{}),d.reject(),a.B.delete(b),a.g.warn(`(all) failed to setup Period ${b}`),a.D.onError(f))});return d};MF=function(a){a.g.debug("(all) setupAllPeriods_");a.j.periods.map(b=>b.id).forEach(b=>{LF(a,b).catch(cB)})};
|
|
143
|
+
PF=function(a,b){if(b.type===_.I&&b.stream.mimeType===_.sc)return SD(a.D.$,b.stream.originalId||""),null;b.type===_.I&&TD(a.D.$);if(!MD(a.D.$)&&b.type!==_.I)return a.h.bufferLimitUpdateInterval?a.h.bufferLimitUpdateInterval/2:.5;var c=PE(b);const d=a.D.xb(),e=kF(a,b,d);a.g.debug(c,"timeNeeded\x3d"+e);var f=a.D.$.Oa(b.type,d);a.g.debug(c,"update_:",HA+d,"bufferedAhead\x3d"+f);var g=Math.max(a.j.minBufferTime||0,a.h.rebufferingGoal,a.h.bufferingGoal)*a.l,h=ZB(a.j.presentationTimeline);if(null!=h&&e>=
|
|
144
|
+
h&&!b.le)return NF(a,b),null;b.endOfStream=!1;h=iF(a,b.stream).id;const k=UE(a,e);null!=k&&(b.cc=k);if(k!==h)return a.g.debug(c,"need Period "+k,HA+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.$.Na(b.type);f=lF(a,b,d,f,h);if(!f)return a.j.presentationTimeline.isLive()||b.type===_.I?a.h.bufferLimitUpdateInterval||1:(a.g.debug("Media state "+c+": no next segment found. Assuming EOS."),NF(a,b),null);c=Infinity;
|
|
145
|
+
for(const l of a.a.values())if(l.type!==_.I||l.stream.mimeType!==_.sc)g=kF(a,l,d),c=Math.min(c,g);if(e>=c+a.j.presentationTimeline.h)return a.h.bufferLimitUpdateInterval||1;b.Ug=0;OF(a,b,d,h,f).catch(()=>{});return null};QF=function(a,b){return _.v(function*(){if(!a.f){if(a.D.Yg)try{yield a.D.Yg(b)}catch(c){c.cause=b,b=c}if(!b.f)a.D.onError(b)}})};
|
|
146
|
+
RF=function(a,b){_.v(function*(){const c=PE(b);var d=iF(a,b.stream).id;if(b.cc!==d){var e=b.cc;d=Array.from(a.a.values());if(d.every(l=>l.cc===e))if(d.every(QE)){a.g.debug(c,"all need Period "+e);try{if(yield LF(a,e),!a.f)if(JD(a.D.$),d.every(l=>{const m=QE(l),n=iF(a,l.stream).id;return m&&l.cc===e&&n!==e})){var f=aF(a,e);a.g.debug(c,"Streaming period",e,f);a.F=!1;a.g.debug(c,"calling onChooseStreams()...");var g=a.D.ef(f);a.H=!g.audio&&!g.video&&!!g.text;var h=VE(g);for(const l of a.a.keys())if(!h.has(l)&&
|
|
147
|
+
l!==_.I){a.g.error(c,"invalid Streams chosen: missing "+l+" Stream");a.D.onError(new _.J(_.C,5,5005));return}for(const l of Array.from(h.keys()))if(!a.a.has(l))if(l===_.I)$E(a,{text:h.get(_.I)},f.startTime),h.delete(l);else{a.g.error(c,"invalid Streams chosen: unusable "+l+" Stream");a.D.onError(new _.J(_.C,5,5005));return}var k=Array.from(a.a.keys()).map(l=>_.v(function*(){const m=h.get(l);m?(yield nF(a,m,!1,0),ZE(a,a.a.get(l),0)):a.a.delete(l)}));yield Promise.all(k);a.f||IF(a)}else a.g.debug(c,
|
|
148
|
+
"ignoring transition to Period",e,"since another is happening")}catch(l){}}else a.g.debug(c,"all MediaStates need Period "+e+", but not all MediaStates are idle");else a.g.debug(c,"not all MediaStates need Period "+e)}})};NF=function(a,b){a.g.debug(PE(b),"buffered to end of presentation");b.endOfStream=!0;b.type===_.t&&(a=a.a.get(_.I))&&a.stream.mimeType===_.sc&&(a.endOfStream=!0)};
|
|
149
|
+
OF=function(a,b,c,d,e){return _.v(function*(){const f=PE(b),g=aF(a,d);a.g.debug(f,"fetchAndAppend_:",HA+c,yA+g.startTime,JA+e.position,KA+e.startTime,IA+e.endTime);const h=b.stream,k=b.stream.segmentIterator;var l=a.j.presentationTimeline.getDuration();const m=SF(a,d);l=TF(a,b,g,Math.max(0,g.startTime-.1),m?m.startTime+.01:l,e);b.Cb=!0;b.ve=!1;a.g.debug(f,"fetching segment");const n=a.D.$.Na(b.type)||0;l.then(()=>a.f||a.w?null:UF(a,b,e,(p,u)=>a.f||a.w?null:VF(a,b,c,g,h,e,p,u))).then(()=>{if(!a.f&&
|
|
150
|
+
!a.w){if(!a.j.presentationTimeline.isLive()&&b.type!==_.I){var p=PE(b),u=(a.D.$.Na(b.type)||0)-n,x=e.endTime-e.startTime,y=u-x;if(Math.abs(y)>=Math.min(.01,x)&&Math.abs(y)<=Math.min(1,x)){a.g.debug(p,"Adjusted segment",e.position,"with real duration",u,"and accounted for",y,"delta between segment duration and real duration");b.le=!0;{p=a.j.periods;h.adjustSegmentDurations(e.position,y);u=KB(p,h);x=p[u];const B=h.getDuration();MB(x,B);for(u+=1;u<p.length;u++)p[u].startTime+=y}}}b.Cb=!1;b.rf=!1;b.ic||
|
|
151
|
+
a.D.ze();k&&(p=k.next().value)&&a.g.debug("New iterated segment",p);ZE(a,b,0);a.C?p=!1:(a.C=WF(a),p=a.C);p&&(a.g.debug("startup complete"),p=iF(a,h).id,XF(a,p),a.D.Ci&&(a.g.debug("calling onStartupComplete()..."),a.D.Ci()));a.g.debug(f,"finished fetch and append")}}).catch(p=>_.v(function*(){if(!a.f&&!a.w)if(b.Cb=!1,b.type===_.I&&a.h.ignoreTextStreamFailures)1001===p.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."),
|
|
152
|
+
a.a.delete(_.I);else if(7001===p.code)b.Cb=!1,b.sb=null,ZE(a,b,0);else if(3017===p.code)YF(a,b,p);else if(1001===p.code&&p.data&&404===p.data[1])a.g.warn(f,"request for segment failed","segment not available on server",JA+e.position,KA+e.startTime,IA+e.endTime,"error\x3d"+p),b.Cb=!1,b.sb=null,ZE(a,b,1);else if(b.type===_.I){if(p instanceof _.J)if(SE(b),aB(p.code))a.D.onError(new _.J(1,2,2010,p,void 0,p.svtaCode));else a.D.onError(new _.J(1,2,2010,p,void 0,5001))}else aB(p.code)?yield ZF(a,b,g,p):
|
|
153
|
+
(a.g.error(f,"failed fetch and append: code\x3d"+p.code),b.dd=!0,p instanceof _.J&&p.a(_.C),yield QF(a,p))}))})};iF=function(a,b){a=a.j.periods;const c=KB(a,b);a=a[c];if(!a)throw new _.J(_.C,5,5006,`No period found for stream with ID ${b.id}.`);return a};
|
|
154
|
+
JF=function(a,b,c,d){const e=PE(b);if(null==c)return a.g.warn(e,eA),null;c=aF(a,c);const f=b.stream.getSegmentReference(d);if(!f)return a.g.debug(e,"segment does not exist:",yA+c.startTime,"position\x3d"+d),null;var g=a.j.presentationTimeline;d=_.eC(g);g=dC(g);return!b.le&&(c.startTime+f.endTime<d||c.startTime+f.startTime>g)?(a.g.debug(e,"segment is not available:",yA+c.startTime,KA+f.startTime,IA+f.endTime,"availabilityStart\x3d"+d,"availabilityEnd\x3d"+g),null):f};
|
|
155
|
+
KF=function(a,b,c,d){const e=PE(b);d=aF(a,d);const f=Math.max(0,c-d.startTime);b=b.stream.findSegmentPosition(f);a.g.debug(e,"Looked up segment:",HA+c,"lookupTime\x3d"+f,yA+d.startTime,"Result: segment position\x3d"+b);null==b&&a.g.warn(e,"cannot find segment:",yA+d.startTime,"lookupTime\x3d"+f);return b};SF=function(a,b){const c=a.j.periods.findIndex(d=>d.id===b);return 0>c?null:a.j.periods[c+1]||null};
|
|
156
|
+
TF=function(a,b,c,d,e,f){return _.v(function*(){var g=c.startTime-f.Ka,h=b.ve||f.initSegment!==(b.oa&&b.oa.initSegment);if(h||g!==b.Ag){b.Ag=g;var k=PE(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=WD(a.D.$,b.type,g,d,e,b.stream.mimeType,b.stream.codecs);if(!b.stream.initSegmentReference||!h)return g;a.g.debug(k,AA);h=$F(a,b,f&&f.initSegment||b.stream.initSegmentReference,k);return Promise.all([g,
|
|
157
|
+
h])}})};UF=function(a,b,c,d){return _.v(function*(){var e=aG(a,c,b.type),f=c.f();let g=!1;e.onFragment=c.Vc||a.h.disableFragmentSupport||f?null:l=>{g=!0;return d(l.data,!0)};e.disableMergedFragments=a.h.disableMergedFragments;a.g.debug("fetching media segment",c);f=bG(a,b,c,!1);f=cG(a,e,b,c,f);e=a.D.Dd();var h=b.Rb;h&&a.h.enableStalledSegmentAbort&&e.beginSegmentMonitor(h,1E3*a.h.rebufferingGoal);f=yield f;h=f.timeMs;const k=f.data.byteLength;h&&k&&e.segmentDownloaded(h,k);g||(yield d(f.data,!1))})};
|
|
158
|
+
VF=function(a,b,c,d,e,f,g,h){h=void 0===h?!1:h;return _.v(function*(){const k=PE(b);if(e&&e.keyId&&a.D.zd){a:{var l=a.D.zd;var m=e.keyId;if(m)for(var n of l.h.keys()){const p=l.h.get(n);for(let u=0;u<p.ub.length;u++)if(p.ub[u]===m){l=p;break a}}l=null}if(l=l?l.qb:null)try{yield l}catch(p){a.g.warn("DRM session load failed, cannot append segment!")}else a.g.warn(`Unable to find DRM session for ${e.keyId}`)}if(l=e.encrypted&&e.keyId&&a.D.zd)l=a.D.zd.o.get(e.keyId),l=!(!l||l!==_.Le&&l!==_.be);l?(SE(b),
|
|
159
|
+
l=iF(a,e).id,(l=XF(a,l))&&(yield l),l=a.D.Pe(e,d,DA),a.g.warn(k,`Blocked append for ${f.startTime+d.startTime} - ${f.endTime+d.startTime}: ${l}. `+`Stream with Key ID ${e.keyId} has restrictions.`)):(l=e.closedCaptions&&0<e.closedCaptions.size,null!=e.emsgSchemeIdUris&&0<e.emsgSchemeIdUris.length&&(new _.an).fa("emsg",a.K.bind(a,d,f,e.emsgSchemeIdUris)).parse(g),yield dG(a,b,c),a.f||(m=f.startTime+d.startTime,n=f.endTime+d.startTime,a.g.debug(k,"Appending segment "+`with ${m.toFixed(3)} - ${n.toFixed(3)} `+
|
|
160
|
+
`KeyID: ${e.keyId} `+`Width: ${e.width} Height: ${e.height} `+`Bitrate: ${_.Gi(e.bandwidth)} `+`Fragment: ${h}`),yield RD(a.D.$,b.type,g,m,n,l,e.id,h,e.type===_.t&&null!=e.muxedAudioId&&!a.A),a.f||(a.g.debug(k,"appended media segment"),b.$b=e,b.oa=f)))})};
|
|
161
|
+
YF=function(a,b,c){const d=PE(b);if(Array.from(a.a.values()).some(e=>e!==b&&e.rf))a.g.debug(d,iA,"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.dd=!0;a.w=!0;a.D.onError(c);return}a.g.warn(d,iA,"reducing buffering goals by "+(100-Math.round(100*a.l))+"%");b.rf=!0}ZE(a,b,4)};
|
|
162
|
+
ZF=function(a,b,c,d){return _.v(function*(){let e=!0;1001===d.code&&500<=d.data.status||(e=!a.D.Pe(b.stream,c));e&&(b.dd=!0,d.a(_.C),yield QF(a,d))})};$F=function(a,b,c,d){return _.v(function*(){try{const e=yield eG(a,b,c);a.f||(a.g.debug(d,"appending init segment"),yield fG(a,e,b),yield RD(a.D.$,b.type,e,null,null,!!b.stream.closedCaptions&&0<b.stream.closedCaptions.size))}catch(e){throw b.ve=!0,e;}})};
|
|
163
|
+
eG=function(a,b,c){return _.v(function*(){const d=aG(a,c,b.type);d.responseModifiers.push(f=>{gG(a,b,f.data)});b.type===_.t&&a.h.overridePasp&&d.responseModifiers.push(a.L.bind(a));a.g.debug(AA,c);const e=bG(a,b,c,!0);return(yield cG(a,d,b,c,e)).data})};fG=function(a,b,c){return _.v(function*(){if(a.h.patchEdgeWhenMixedContent&&_.Lh()){const d=ME(b);yield RD(a.D.$,c.type,d.buffer,null,null,!!c.stream.closedCaptions&&0<c.stream.closedCaptions.size)}})};
|
|
164
|
+
XF=function(a,b){let c=null;a.B.has(b)||(c=LF(a,b).then(()=>{a.f||IF(a)}).catch(cB));MF(a);return c};
|
|
165
|
+
dG=function(a,b,c){return _.v(function*(){if(!a.f){var d=PE(b);a.g.debug(d,"checking buffer length");var e=Math.max(a.h.bufferBehind,a.j.presentationTimeline.h),f=a.D.$.Vb(b.type);if(null==f)a.g.debug(d,"buffer behind okay because nothing buffered:",HA+c,rA+e);else{var g=c-f,h=g-e;.01>=h?a.g.debug(d,"buffer behind okay:",HA+c,sA+g,rA+e,"underflow\x3d"+Math.abs(h)):(a.g.debug(d,"buffer behind too large:",HA+c,sA+g,rA+e,"overflow\x3d"+h),yield a.D.$.remove(b.type,f,f+h),a.f||a.g.debug(d,"evicted "+
|
|
166
|
+
h+" seconds"))}}})};gG=function(a,b,c){(new _.an).N(_.ue,_.Um).N(_.bg,_.Um).N(_.pe,_.Um).N(_.te,_.Um).N(_.Mf,_.Um).fa(_.Of,_.Vm).N("encv",d=>{d.reader.skip(78);_.Um(d)}).N(_.Gf,_.Um).N("schi",_.Um).N("tenc",d=>{d.reader.skip(6);if(_.Mm(d.reader)){d.reader.skip(1);const e=_.Nk(_.Rm(d.reader,16));e!==b.stream.keyId&&(a.g.debug(PE(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)};
|
|
167
|
+
WF=function(a){return a.H?!0:Array.from(a.a.values()).filter(b=>b.type!==_.I).every(b=>!b.ic&&!b.xc&&b.oa)};hG=function(a,b){return a.D.Tc&&(b=b.Ga)?a.D.Tc.getBaseUriCollectionById(b.id):null};iG=function(a,b,c){if(a.D.Tc&&b){c&&0===c.request.uriIndex||a.D.Tc.banLocation(b.qa[0].serviceLocationId);const d=c.request,e=c.timeMs;c=c.data.byteLength;e&&c&&a.D.Tc.notifyThroughput(b.qa[d.uriIndex].serviceLocationId,e,c)}};
|
|
168
|
+
aG=function(a,b,c){var d=[];const e=hG(a,b);e&&(d=b.$c(),d=_.JC(e,d));d.length||(d=b.Da());a=_.PB(d,b.na,b.ka,a.h.attemptParameters,b.startTime,b.endTime,c,b.timescale);a.type=2;if(b=b.f())a.keyInfo=b;return a};
|
|
169
|
+
bG=function(a,b,c,d){const e=lF(a,b,a.D.xb(),c.endTime,iF(a,b.stream).id);if(d)var f="i";else a:{if(f=b.stream){var g=f.type;if(g===_.t){f=mB(f.type,_.Gl(f.mimeType,f.codecs))?"av":"v";break a}if(g===_.q){f="a";break a}if(g===_.Sf){f=f.mimeType===_.uc?"tt":"c";break a}}f=void 0}return{stream:b.stream,segment:d?void 0:c,nextSegment:e?e:void 0,streamType:a.j.presentationTimeline.isLive()?"l":"v",objectType:f}};
|
|
170
|
+
cG=function(a,b,c,d,e){const f=hG(a,d);b=_.dl(a.D.Bb,b,e);c.Rb=b;return b.V.then(g=>{iG(a,f,g);c.Rb=null;return g}).catch(g=>{iG(a,f);throw g;})};jG=function(a){const b=c=>c.video&&c.audio||c.video&&c.video.codecs.includes(",");if(a.some(c=>c.variants.some(b))){_.rh("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)}};
|
|
171
|
+
nD=function(a,b,c){c=void 0===c?!1:c;var d=void 0===d?0:d;_.v(function*(){if(!a.f||!a.a)throw Error("Player not ready to select tracks.");var e=yD(a);if(!e)throw Error(jA);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=kG(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(!nE(f))throw a.log.error("Unable to switch to restricted track",
|
|
172
|
+
b.id),Error("Unable to switch to restricted track.");a.ca=f.video.id;var g=yield e.parser.loadVariant(f,e.id);zD(a.l,e).ib?g.video&&(lG(a,e,g.video,!1),yield rF(a.a,g.video,c,d)):(mG(a,e,g,!1),yield nG(a,g,c,d));null==a.Gc&&(a.Gc=a.Dc);a.Dc=new oG(f);pG(a,e.variants)}else a.ca=null,null!=a.Gc&&(a.Dc=a.Gc,a.Gc=null),a.configuration.abr.enabled||(a.log.info("Enable ABR Selection"),a.configuration.abr.enabled=!0,a.h.enable()),e=pG(a,e.variants).variant,null!=e&&qG(a)&&rG(a,e)})};
|
|
173
|
+
tG=function(a,b){_.v(function*(){if(a.configuration.streaming.disableAudioTracks)throw Error("Audio tracks are disabled by config.");if(!a.a||!a.f||!a.B)throw Error("Not ready to select audio track.");var c=(a.f.muxedAudioTracks||[]).find(k=>k.id===b);if(c)yield sG(a,c);else{var d=eF(a.a),e=dF(a.a);c=yD(a);if(!c)throw Error(jA);var f=kG(a).filter(k=>k.audio.id===b&&nE(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");
|
|
174
|
+
g=!0;const k=a.getTrackManager().Ha();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(!zD(a.l,c).ib&&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 c.parser.loadVariant(h,c.id);h=e.audio;a.Aa=h.id;f=f.map(gD);a.h.setTracks(f);
|
|
175
|
+
mG(a,c,e,!1);g||!qG(a)?yield nG(a,e,!0,0):yield sF(a.a,h)}})};qD=function(a,b){return _.v(function*(){if(a.vf!==b&&(a.vf=b,a.G===uG&&(a.K.getTextDisplayer().setTextVisibility(b),!a.configuration.streaming.alwaysStreamText)))if(b){var c=yD(a);c=_.pE(c.textStreams,a.yc,a.gd,a.wc);0<c.length&&(yield fF(a.a,c[0]))}else gF(a.a)})};
|
|
176
|
+
rD=function(a,b){return _.v(function*(){if(a.f&&a.a){const c=yD(a),d=yield c.parser.loadTextStream(b.id,c.id);yield fF(a.a,d);vG(a,c,d,!1);yield wG(a,d);a.yc=d.language;a.wc=d.kind===_.Ud}})};uD=function(a){const b=a.vf;return a.f?a.K.getTextDisplayer().isTextVisible():b};
|
|
177
|
+
xG=function(a,b){a.j||(a.o.on(b,_.Sd,()=>{if(a.j.error){var c=a.j.error.code;if(1===c)c=null;else{var d=a.j.error.msExtendedCode;d&&(0>d&&(d+=Math.pow(2,32)),d=d.toString(16));c=new _.J(_.C,3,3016,{code:c,extendedError:d,message:a.j.error.message})}}else c=null;if(c)a.onError(c)}),a.j=b)};zG=function(a){return new _.yG(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})};
|
|
178
|
+
EG=function(a){return _.v(function*(){AG(a);yield BG(a);CG(a);if(_.Ph(4)||_.Ph(5)){const b=a.getSurface().getMedia();xG(a,b);yield DG(a,b)}a.configuration=a.ja})};FG=function(a){return _.v(function*(){const b=a.w.a;b&&(yield b.catch(()=>{}));a.cb&&(a.cb.release(),a.cb=null);yield Object.getPrototypeOf(Object.getPrototypeOf(a)).release.call(a);yield a.unload();YC(a.bb,0)})};CG=function(a){a.j&&(a.o.off(a.j,_.Sd),a.j=null);a.R&&(a.R.stop(),a.R=null)};
|
|
179
|
+
AG=function(a){if(a.G===GG)throw new _.J(_.C,7,7E3,"Player is destroyed.");};HG=function(a){return a.Z?a.Z.catch(()=>{}):Promise.resolve()};IG=function(a){const b=new _.Gv;(a=a.playlist)&&a.cropTimeline&&(a.startTime||a.endTime)&&(b.h={start:a.startTime||null,end:a.endTime||null});return b};
|
|
180
|
+
MG=function(a,b){return _.v(function*(){a.F=new _.Uu;YC(a.bb,2);const c=JG(a,a.configuration);yield DG(a,c);wE(a.w,b);a.J=new KG;iC(a.J,d=>{a.log.info("Timeline cue found",d);LG(a,_.Wf,d)},()=>{a.log.info("Timeline cues changed");a.trigger(new _.H(_.Zf))})})};
|
|
181
|
+
PG=function(a,b,c,d,e){return _.v(function*(){var f=_.gp(b)[c];const g=yield NG(a,f);wE(a.w,d);_.Rn(EA);f=yield OG(a,g,f,b.id||"");wE(a.w,d);f.periods.forEach(h=>{h.parser=g});e&&f.presentationTimeline.o&&(yield g.stop(),wE(a.w,d));_.Rn("manifest.end");_.Tn("Fetch and parse manifest",EA,"manifest.end");return{parser:g,manifest:f}})};
|
|
182
|
+
TG=function(a,b,c){return _.v(function*(){_.Rn("initDrm.start");const d=new _.kp({Bb:a.getNetworkEngine(),onError:h=>a.onError(h),hf:h=>{if(a.a){var k=yD(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&&!a.configuration.disableRestrictions){m=a.getPeriods();for(let B=0;B<m.length;B++){const F=m[B];for(var p of F.variants){var u=p;var x=[];u.audio&&x.push(u.audio);u.video&&x.push(u.video);u=x;for(var y of u)u=p.allowedByKeySystem,y.keyId&&(x=h[n?"00":y.keyId],x=!!x&&!QG.includes(x),p.allowedByKeySystem=x),u!==p.allowedByKeySystem&&(x=y.type,y.type===_.t&&(x=`video ${y.width}x${y.height}@`+`${_.Gi(y.bandwidth)}`),a.log.warn("DRM Key not available for "+`KID: '${y.keyId}'. Applying restrictions to ${x}`)),
|
|
184
|
+
F===k&&u!==p.allowedByKeySystem&&(l=!0)}}}if(h=bF(a.a)){p=dF(a.a);y=eF(a.a);a:{n=h.variants;for(m=0;m<n.length;m++)if(n[m].audio===p&&n[m].video===y){n=n[m];break a}n=null}if(!n||n.allowedByKeySystem)a.log.info(fA),RG(a),pG(a,h.variants)}l&&h!==k&&(a.log.info(fA),RG(a),pG(a,k.variants))}},gf:(h,k)=>{a.trigger(new _.H(_.Fd,{expirationTime:k}))},onEvent:h=>a.Df(h),getConfiguration:()=>a.getConfiguration(),Zc:()=>a.Zc()});var e=b.periods.every(h=>h.variants.some(k=>k.drmInfos.some(l=>l.licenseServerUriOrigin===
|
|
185
|
+
_.zA)));c.drmResolver&&(e=c.drmResolver({hasLaurl:e}),(c.drm=e)&&_.zm(c.drm));e=c.drm;var f=_.mk(e);d.f=f;e=e?e.offlineId||"":"";f=[];const g=_.jt(b.periods);if(e){const h=_.sm(_.Ne);h&&(yield h.f(a,g),f=yield h.a(e))}yield _.ro(d,g,f);a.A=d;SG(a,b.periods);_.Rn("initDrm.end");_.Tn("Init DRM","initDrm.start","initDrm.end");return d})};
|
|
186
|
+
fH=function(a,b){return _.v(function*(){const c=a.j;UG(a,c);VG(a,a.f.periods);a.Dc=new WG(a.configuration.preferredAudioLanguage||[],a.configuration.preferredAudioRole,a.configuration.preferredAudioChannelCount,a.configuration.preferSpatialAudio,a.configuration.mediaSource.codecSwitchingStrategy);a.yc=a.configuration.preferredTextLanguage;a.gd=a.configuration.preferredTextRole;a.wc=a.configuration.preferForcedSubtitles;yield _.Io(a.A,c);wE(a.w,b);a.h.configure(a.configuration.abr);a.pf&&a.h.setCmsdManager(a.pf);
|
|
187
|
+
a.h.init((f,g,h)=>_.v(function*(){if(qG(a)){a.log.info(`ABR switch to ${f.width}x${f.height}`);var k=kG(a).find(l=>l.id===f.id)||null;if(k){const l=yD(a);k=yield l.parser.loadVariant(k,l.id);rG(a,k,g,h)}else a.log.warn("No matching variant found for track switch")}}));a.B=XG(a,c,a.configuration.startTime);a.lb=YG(a);a.H=new ZG({lc:()=>c.playbackRate,qd:f=>{c.playbackRate=f},si:f=>{c.currentTime+=f}});HE(a.H,a.configuration.trickPlay);a.isLive()&&a.configuration.streaming.enableLiveEdgeChasing&&(a.kd=
|
|
188
|
+
new $G(a));aH(a,Math.max(1E-4,a.configuration.streaming.rebufferingGoal));bH(a)?fE(a.f,_.kj(a.configuration.preferredVideoCodec),_.kj(a.configuration.preferredAudioCodec),a.configuration.preferredAudioChannelCount):eE(a.f,_.kj(a.configuration.preferredVideoCodec),_.kj(a.configuration.preferredAudioCodec),a.configuration.preferredAudioChannelCount);var d=cH(a);d.h=a.configuration.streaming;a.a=d;a.G=uG;yield d.start();wE(a.w,b);a.configuration.streaming.startAtSegmentBoundary&&(d=dH(a,a.B.getTime()),
|
|
189
|
+
wC(a.B.f,d));for(var e of a.f.periods)eH(a,e);RG(a);e=kG(a);d=e.some(f=>f.primary);a.configuration.preferredAudioLanguage||d||a.log.warn("No preferred audio language set. We will choose an arbitrary language initially");pG(a,e)})};
|
|
190
|
+
gH=function(a,b){var c=a.getMediaPosition(),d=a.Bc,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 _.Ev(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));$A(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].Xc(d[f])){d=!1;
|
|
191
|
+
break a}d=!0}!d&&a.trigger(new _.H(_.Af));lC(a.we);jC(a.J,b.cues)};hH=function(a){return _.v(function*(){yield Promise.all(a.M.map(b=>b.stop()));a.M=[]})};jH=function(a,b,c){b=iH(a,b,c);c.catch(()=>{});c.reject(b);a.onError(b);throw b;};kH=function(a){a.M.map(b=>b.requestStop())};
|
|
192
|
+
lH=function(a,b){return _.v(function*(){const c=yield PG(a,b,0,null,!0);try{const d=[a.f,bD(c.manifest)],e=eD(d,a.f.presentationTimeline);return{parser:c.parser,manifest:e}}catch(d){throw new _.J(_.C,7,7003,"Failed to append load manifest");}})};mH=function(a,b){a.configuration.ads.hls.mockCuesFn?(b=a.configuration.ads.hls.mockCuesFn(a),jC(a.J,b)):jC(a.J,b)};
|
|
193
|
+
nH=function(a,b){return _.v(function*(){const c=a.M[a.M.length-1];b.periods.forEach(d=>{d.parser=c});if(a.S===_.oa)mH(a,b.cues),vF(a.a,b);else if(a.S===_.ab){a.f=fD(a.f,bD(b));const d=a.configuration.playlist.endTime,e=a.f.presentationTimeline.a.a;d&&e>d&&(a.log.info("Reached end of playlist. Turning timeline static."),kH(a),a.M=[],_.YB(a.f.presentationTimeline,!0),a.trigger(new _.H(_.ie)));gH(a,a.f);vF(a.a,a.f)}})};
|
|
194
|
+
oH=function(a){return _.v(function*(){kH(a);a.M=[];a.S===_.ab?a.trigger(new _.H(_.zf)):a.trigger(new _.H(_.ie))})};
|
|
195
|
+
BG=function(a){return _.v(function*(){a.G!==GG&&(a.G=pH);const b=a.j;b&&(a.o.off(b,_.ke),a.o.off(b,_.bf),a.o.off(b,_.Me),a.o.off(b,_.Rd),a.o.off(b,_.qf),a.o.off(b,_.nf));a.J&&(a.J.release(),a.J=null);a.lb&&(a.lb.release(),a.lb=null);a.R&&(a.R.stop(),a.R=null);yield hH(a);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.B&&(a.B.release(),a.B=null);a.H&&(a.H.release(),a.H=null);a.K&&(yield a.K.destroy(),a.K=null);a.Hb&&(a.Hb.release(),a.Hb=null);a.kd&&
|
|
196
|
+
(a.kd.release(),a.kd=null);b&&b.src&&(b.removeAttribute("src"),b.load());a.A&&(yield a.A.destroy(),a.A=null);a.l.clear();a.I=null;a.md.clear();a.f=null;a.F=null;a.Ib.clear();a.Hc=!1;qH(a)})};DG=function(a,b){return _.v(function*(){var c=window.muxjs?new rH:new _.sH;const d=_.Yo(a.configuration,[_.Zd,"single-native"]).create(a);a.P=d;const e=zG(a);e.track(a);a.Hb=e;c=new _.tH(b,c,d,e,a.configuration);yield c.open();a.K=c})};
|
|
197
|
+
vH=function(a,b,c){c=void 0===c?!0:c;return _.v(function*(){const d=Date.now()/1E3,e=new _.uk;a.w.a=e;uH(a,b);try{AG(a);yield HG(a);wE(a.w,e);a.ia=_.gp(b);a.configuration=_.nm([a.ja,b]);AB(a.configuration.xmlParser);a.zc&&a.configuration.mse.sendPlaybackSessionIdHeader&&a.getNetworkEngine().headers.set(qA,a.zc);a.log.info(_.Na,a.configuration);a.log.info(_.eb,a.ia);yield MG(a,e);wE(a.w,e);const f=yield PG(a,b,a.getSourceIndex(),e,!1);wE(a.w,e);a.M=[f.parser];a.f=f.manifest;mH(a,f.manifest.cues);a.A=
|
|
198
|
+
yield TG(a,a.f,a.configuration);wE(a.w,e);c&&(yield fH(a,e),wE(a.w,e),a.o.one(a.j,_.ke,()=>{const g=Date.now()/1E3-d;a.F&&(a.F.B=g)}));e.resolve()}catch(f){jH(a,f,e)}})};xH=function(a,b){return _.v(function*(){return a.configuration.contentSteering.enabled?(a.U||(a.U=new wH(a.configuration.contentSteering,a.getNetworkEngine()),a.U.on(wA,c=>{a.trigger(c)}),yield PC(a.U,b)),a.U):null})};
|
|
199
|
+
uH=function(a,b){b.cmcd&&b.cmcd.enabled&&(b.cmcd.sessionId||(b.cmcd.sessionId=a.zc?a.zc:void 0),a.cb=new yH(a.getNetworkEngine(),b.cmcd,{getBandwidthEstimate:()=>{try{return a.getBandwidthEstimate()}catch(c){return null}},getBufferInfo:a.getBufferInfo.bind(a),getLoadedSource:a.getLoadedSource.bind(a),getMediaPosition:a.getMediaPosition.bind(a),getPlaybackRate:a.getPlaybackRate.bind(a),getPlayerState:a.getState.bind(a),bd:a.bd.bind(a)}))};
|
|
200
|
+
iH=function(a,b,c){var d=a.w;return null!=d.a&&d.a===c||b instanceof _.J&&7E3===b.code?b instanceof _.J?b:new _.J(_.C,7,7003,"Unexpected error.",b):vE(a.w)};JG=function(a,b){const c=a.getSurface().getMedia();c.loop=!!b.loop;_.z(b.volume)||a.setVolume(b.volume);_.z(b.muted)||a.setMuted(b.muted);xG(a,c);return c};LG=function(a,b,c){a.trigger(new _.H(b,{detail:hC(c,zH(a))}))};
|
|
201
|
+
NG=function(a,b){return _.v(function*(){var c=a.getNetworkEngine();c=yield _.ut(b.url,c,a.configuration.manifest.attemptParameters,b.type||null);c.configure(a.configuration.manifest);return c})};
|
|
202
|
+
OG=function(a,b,c,d){return(new _.op(Promise.resolve().then(()=>_.v(function*(){let e=null;for(;!e;)try{{var f=b,g=c.url;const k=AH(a,d);var h=f.start(g,k)}e=yield h}catch(k){if(a.Rc)if(f=yield a.Rc(c.url,k))c.url=f;else throw k;else throw k;}if(0===e.periods.length)throw new _.J(_.C,4,4014);jG(e.periods);return e})),()=>{a.log.info("Aborting parser step...");return b.stop()})).V};
|
|
203
|
+
qH=function(a){if(a.F&&a.I&&a.B){var b=BH(a)||a.Jb,c=a.H;c.l=b;KE(c,c.o?"seek":void 0);a.B.j.o=b;CH(a);a.we&&(c=1>Math.abs(a.getMediaDuration()-a.getMediaPosition()),a=a.we,b&&c&&(b=a.a,b.a[b.a.length-1]&&a.f(new _.H(_.xf))))}};
|
|
204
|
+
SG=function(a,b){DH(a,b);var c=a.a?dF(a.a):null;const d=a.a?eF(a.a):null,e=!bH(a);for(const f of b)kE(a.A,c,d,f,e);c=lB(b,f=>f.variants.some(nE));if(0===c)throw new _.J(_.C,4,4032);if(c<b.length)throw new _.J(_.C,4,4011);for(const f of b)hE(f.variants,a.configuration.restrictions)&&a.a&&yD(a)===f&&RG(a),EH(a,f.variants)};
|
|
205
|
+
UG=function(a,b){const c=d=>{a.j&&a.I&&(d.type===_.Cf&&a.Jb?(a.I.a=FH,qH(a)):d.type===_.zg&&8===a.getState()&&.1>a.getBufferInfo().Oa(a.getMediaPosition())?(a.I.a=FH,qH(a)):a.I&&GH(a));CH(a)};a.o.on(b,_.bf,c);a.o.on(b,_.Me,c);a.o.on(b,_.Rd,c);a.o.on(b,_.Cf,c);a.o.on(b,_.Bf,c);a.o.on(b,_.nf,c);a.o.on(b,_.zg,c);a.o.on(b,_.qf,()=>{if(a.j){var d=a.j.playbackRate;0!==d&&a.H.set(d)}})};
|
|
206
|
+
VG=function(a,b){for(let c=0;c<b.length;c++){const d=b[c],e=new Map;for(const f of kG(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.gh++,originalId:h,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:()=>null,getSegmentReference:()=>null,initSegmentReference:null,Ka:0,mimeType:_.sc,codecs:"",kind:_.uA,encrypted:!1,keyId:null,language:g.closedCaptions.get(h),label:null,type:_.I,primary:!1,trickModeVideo:null,
|
|
207
|
+
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)}};qG=function(a){return a.a?a.a.F:!1};kG=function(a){return a.f.alternativeVariants&&0<a.f.alternativeVariants.length?a.f.alternativeVariants:a.B?yD(a).variants:a.f.periods[0].variants};yD=function(a){const b=a.B.getTime();let c=null;for(const d of a.f.periods)d.startTime<=b&&(c=d);return c};
|
|
208
|
+
rG=function(a,b,c,d){c=void 0===c?!1:c;d=void 0===d?0:d;_.v(function*(){if(a.configuration.abr.enabled&&a.a){var e=HH(a,b);if(zD(a.l,e).ib){const f=b.video;if(f){IH(a,e,()=>lG(a,e,f,!0));e===yD(a)&&JH(a);yield rF(a.a,f,c,d);return}}IH(a,e,()=>{mG(a,e,b,!0)});e===yD(a)&&JH(a);pF(a.a,b,c,d)}})};XG=function(a,b,c){return new KH(b,a.f,a.configuration.streaming,c,d=>{a.lb&&DC(a.lb,!0,d);a.a&&wF(a.a)},d=>a.dispatchEvent(d),a.S===_.ab)};
|
|
209
|
+
YG=function(a){const b=new LH(a.j);var c=new MH(a.f);GE(c,()=>{RG(a)});b.a.add(c);a.J&&(c=new NH(a.J),FC(c,d=>{d.xe&&d.xe();LG(a,_.Xf,d)},d=>{d.ff&&d.ff();LG(a,_.Yf,d)},(d,e)=>{e||(d.xe&&d.xe(),LG(a,_.Xf,d),d.ff&&d.ff(),LG(a,_.Yf,d))}),b.a.add(c));a.S===_.ab&&(c=new OH(a.Bc,a.Jc,d=>a.trigger(d),a.configuration.playlist),b.a.add(c),a.we=c);return b};aH=function(a,b){a.I=new PH(b,Math.min(.5,b/2));a.I.a=FH;qH(a);a.R=(new _.Jh(()=>{GH(a)})).Gb(.25)};
|
|
210
|
+
bH=function(a){return a.configuration.mediaSource.codecSwitchingStrategy===_.Hf&&(_.Ph(2)||_.Ph(3)||_.Ph(4)||_.Ph(5)||_.Ph(6)||_.Sh()&&38===_.Wh().major||_.Sh()&&53===_.Wh().major||_.Sh()&&68===_.Wh().major?!1:!0)};
|
|
211
|
+
cH=function(a){const b={configuration:{li:a.S===_.ab},xb:()=>a.B.getTime(),$:a.K,Bb:a.getNetworkEngine(),Tc:a.U,ef:a.ih.bind(a),Eg:a.jh.bind(a),onError:a.onError.bind(a),Fg:a.kh.bind(a),onEvent:a.Df.bind(a),Ig:a.oh.bind(a),ze:a.lh.bind(a),Dd:()=>a.h,Pe:a.hh.bind(a),Yg:a.nh.bind(a),zd:a.A};return new _.QH(a.f,b)};
|
|
212
|
+
dH=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=dF(a.a);var e=eF(a.a);const f=yD(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};
|
|
213
|
+
eH=function(a,b){DH(a,[b]);const c=b.variants,d=a.a?dF(a.a):null,e=a.a?eF(a.a):null,f=!bH(a);kE(a.A,d,e,b,f);if(!c.some(nE))throw new _.J(_.C,4,4011);EH(a,b.variants);hE(c,a.configuration.restrictions)&&a.a&&yD(a)===b&&RG(a);if(!_.Ph(2)&&(b=a.A?a.A.getDrmInfo():null))for(const g of c)for(const h of g.drmInfos)if(h.keySystem===b.keySystem)for(const k of h.initData||[])_.wo(a.A,k.keyId,k.initData)||_.yo(a.A,k.initDataType,k.initData,k.keyId)};
|
|
214
|
+
RG=function(a){const b=a.getTrackManager();b&&a.G!==GG&&(b.m&&(xD(b),b.m.trigger(new _.H(_.ag))),JH(a))};pG=function(a,b){b=RH(a,b);if(!b)return{variant:null,ib:null};a=SH(a,b);return{variant:b,ib:a}};
|
|
215
|
+
GH=function(a){if(a.j){switch(a.G){case uG:a:if(a.j.ended||ND(a.K))var b=!0;else{if(a.isLive()){b=dC(a.f.presentationTimeline);var c=a.getBufferInfo();if(null!==c&&(c=c.Na(),null!==c&&c>=b)){b=!0;break a}}b=!1}break;default:b=!1}if(a.K){var d=PD(a.K);c=d.video;d=d.audio;var e=a.j.currentTime;c&&d?(c=c.Oa(e),d=d.Oa(e),d=Math.min(c,d)):d=c?c.Oa(e):d?d.Oa(e):0}else d=0;if(c=a.I){{c=a.I;e=d;var f=b;const g=c.f.get(c.a);d=c.a;e=f||e>=g?TH:FH;c.a=e;c=d!==e}}(d=BH(a))&&a.cb&&(a.cb.h=!0);c||6===a.getState()&&
|
|
216
|
+
!d?(a.log.debug("Buffering state changed. Is buffering",d,"buffered to end",b,"state",a.getState()),qH(a)):a.Hc&&CH(a)}};CH=function(a){var b=a.bb;if(a.Jb)var c=!1;else if(a.j&&a.j.ended)c=!0;else{c=a.getMediaDuration();var d=a.getMediaPosition();c=a.Hc&&0<=d&&c<=d?!0:!1}a=c?11:BH(a)||a.Jb?6:a.j&&a.j.paused?10:8;YC(b,a)};BH=function(a){return a.A&&a.A.F?!0:a.I?a.I.getState()===FH:!1};UH=function(a){const b=yD(a);return b?zD(a.l,b).video:null};
|
|
217
|
+
VH=function(a){const b=yD(a);return b?zD(a.l,b).audio:null};XH=function(a){if(null==yD(a))return[];WH(a);return kG(a).filter(b=>nE(b))};YH=function(a){const b=yD(a);if(null==b)return[];WH(a);return a.f.alternativeTextStreams?a.f.alternativeTextStreams:b.textStreams.filter(c=>!a.md.has(c))};
|
|
218
|
+
vG=function(a,b,c,d){yE(a.l,b,c);if(b=a.getTrackManager())BD(b,c.id,_.L,d),c=b.Wa(),a=a.F.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}))};wG=function(a,b){return _.v(function*(){qG(a)?yield _.tF(a.a,b):a.W=b})};
|
|
219
|
+
lG=function(a,b,c,d){const e=a.getTrackManager();if(e){var f=a.F.f;zD(a.l,b).video=c;BD(e,c.id,_.N,d);a=e.ta();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}))}};mG=function(a,b,c,d){b.parser&&b.parser.setCurrentVariant(c);c.video&&lG(a,b,c.video,d);c.audio&&ZH(a,b,c.audio,d)};
|
|
220
|
+
nG=function(a,b,c,d){c=void 0===c?!1:c;d=void 0===d?0:d;return _.v(function*(){qG(a)?yield pF(a.a,b,c,d):(a.da=b,a.fh=c,a.eh=d)})};
|
|
221
|
+
sG=function(a,b){return _.v(function*(){const c=yD(a);if(!c)throw Error(jA);const d=c.variants.filter(g=>g.video&&g.video.muxedAudioId===b.groupId&&nE(g));if(0===d.length)throw Error("No variants containing muxed audio found.");let e=d[0];const f=eF(a.a);f&&(e=d.find(g=>g.video.id===f.id)||null);e&&e.video&&(a.Aa=b.id,a.log.info(`Select muxed audio track ${b.id}`),$H(a,c,b,!1),yield qF(a.a))})};
|
|
222
|
+
$H=function(a,b,c,d){b=zD(a.l,b);b.audio=null;b.ib=c;if(b=a.getTrackManager())a=a.F.f,BD(b,c.id,_.M,d),c=b.Pa(),XA(a,c,d)};zH=function(a){return a.S===_.ab&&"flat"===a.configuration.playlist.timeline};bI=function(a,b,c){c=void 0===c?!0:c;_.v(function*(){var d=pG(a,b.variants).variant;a.Aa=d&&d.audio&&d.audio.id;d&&(d=yield b.parser.loadVariant(d,b.id),mG(a,b,d,!0),yield nG(a,d,c));(d=aI(a,b.textStreams))&&(a.configuration.streaming.alwaysStreamText||uD(a))&&(vG(a,b,d,!0),yield wG(a,d))})};
|
|
223
|
+
ZH=function(a,b,c,d){const e=a.getTrackManager();if(e){var f=a.F.f;a=zD(a.l,b);a.audio=c;a.ib=null;BD(e,c.id,_.M,d);c=e.Pa();XA(f,c,d)}};DH=function(a,b){if(a.configuration.streaming.disableAudioTracks){for(const c of b)for(const d of c.variants)delete d.audio;a.log.debug("Audio removed due to disableAudioTracks")}if(a.configuration.streaming.disableVideoTracks){for(const c of b)for(const d of c.variants)(b=d.video)&&!mB(b.type,_.Gl(b.mimeType,b.codecs))&&delete d.video;a.log.debug("Video removed due to disableVideoTracks")}};
|
|
224
|
+
EH=function(a,b){a=a.A?_.ih(a.A.Z):{};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])?QG.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 _.J(_.C,4,4012,{hasAppRestrictions:e,missingKeys:f,restrictedKeyStatuses:g});};
|
|
225
|
+
WH=function(a){if(a.a&&a.f){var b=bF(a.a),c=yD(a);null!=b&&b===c&&(dF(a.a),eF(a.a),_.cF(a.a,_.I),zD(a.l,c),zD(a.l,c),zD(a.l,c),zD(a.l,c))}};
|
|
226
|
+
RH=function(a,b){try{EH(a,b)}catch(e){return a.onError(e),null}b=b.filter(e=>nE(e));var c=XC(b,a.Aa);b=a.Dc.create(c);b=Array.from(b.values());var d=b.map(gD);a.h.setTracks(d);if(null!==a.ca&&null!==a.Aa&&(d=b.find(e=>e.video.id===a.ca&&e.audio.id===a.Aa),a.ca=null,d))return d;if(a.configuration.abr.enabled||null===a.ca)return c=a.h.chooseTrack(),hD(c,b);c=c.find(e=>null!==e.video&&e.video.id===a.ca);return c?c:(a.log.warn("Selected video track not found. Falling back to ABR selection"),c=a.h.chooseTrack(),
|
|
227
|
+
hD(c,b))};SH=function(a,b){return b&&b.video?(a=(a.f.muxedAudioTracks||[]).find(c=>c.groupId===b.video.muxedAudioId))&&a.primary?a:null:null};aI=function(a,b){return _.pE(b,a.yc,a.gd,a.wc)[0]||null};
|
|
228
|
+
cI=function(a,b){a.h.disable();a.log.debug("Choosing new streams after period changed");var c=pG(a,b.variants);let d=c.variant;const e=c.ib;let f=aI(a,b.textStreams);a.da&&(b.variants.includes(a.da)&&(d=a.da),a.da=null);a.W&&(b.textStreams.includes(a.W)&&(f=a.W),a.W=null);const g=d?d.video:null,h=d&&!e?d.audio:null;d&&b.parser&&b.parser.setCurrentVariant(d);g&&IH(a,b,()=>lG(a,b,g,!0));h&&IH(a,b,()=>ZH(a,b,h,!0));e&&IH(a,b,()=>$H(a,b,e,!0));f&&(a.configuration.streaming.alwaysStreamText||uD(a))&&IH(a,
|
|
229
|
+
b,()=>vG(a,b,f,!0));b===yD(a)&&JH(a);c=a.configuration.streaming.alwaysStreamText||uD(a)?f:null;return{video:g,audio:h,text:c,ib:e}};IH=function(a,b,c){a.Ib.has(b)||a.Ib.set(b,[]);a.Ib.get(b).push(c)};JH=function(a){const b=yD(a);if(b){const c=a.Ib.get(b)||[];for(a.Ib.delete(b);c.length;)c.shift()()}};HH=function(a,b){for(const c of a.f.periods)if(c.variants.some(d=>d.id===b.id))return c;return null};
|
|
230
|
+
dI=function(a,b,c,d){return _.v(function*(){let e;try{e=yield _.ut(b.url,a.getNetworkEngine(),a.configuration.manifest.attemptParameters,b.type||null);e.configure(a.configuration.manifest);{var f=e,g=b.url;const G=AH(a,a.configuration.id||"");var h=f.start(g,G)}const k=yield h;jG(k.periods);if(!k.periods.length)throw new _.J(_.C,4,4014);yield hH(a);a.M=[e];const l=d&&d.id,m=c&&c.id;a.f.periods=k.periods;const n=IB(k.periods,a.B.getTime())||k.periods[0];bH(a)?fE(a.f,_.kj(a.configuration.preferredVideoCodec),
|
|
231
|
+
_.kj(a.configuration.preferredAudioCodec),a.configuration.preferredAudioChannelCount):eE(a.f,_.kj(a.configuration.preferredVideoCodec),_.kj(a.configuration.preferredAudioCodec),a.configuration.preferredAudioChannelCount);const p=ZC(l,m,n.variants),u=aI(a,n.textStreams);pG(a,n.variants);const x=p&&p.video,y=p&&p.audio;h=[];const B=new Set;for(const G of n.variants)G.video&&B.add(G.video),G.audio&&B.add(G.audio);const F=a.getNetworkEngine();for(const G of[...B,...n.textStreams])h.push(G.createSegmentIndex(F,
|
|
232
|
+
a.configuration.streaming.attemptParameters));yield Promise.all(h);HF(a.a,_.q,y);HF(a.a,_.t,x);HF(a.a,_.I,u);p&&mG(a,n,p,!1);a.log.info("Switch CDN successful.")}catch(k){throw e&&(yield e.stop()),k;}})};AH=function(a,b){return{networkingEngine:a.getNetworkEngine(),onContentSteeringInfoFound:c=>xH(a,c),configurationId:b,filterNewPeriod:c=>eH(a,c),filterAllPeriods:c=>SG(a,c),onEvent:c=>a.Df(c),onError:c=>a.onError(c),onUpdate:c=>nH(a,c),onTurnedStatic:()=>oH(a),Dd:()=>a.h}};
|
|
233
|
+
eI=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)}};
|
|
234
|
+
fI=function(){const a=MediaSource.isTypeSupported;MediaSource.isTypeSupported=b=>"mp2t"===b.split(/ *; */)[0].split("/")[1].toLowerCase()?!1:a(b)};gI=function(){const a=MediaSource.prototype.addSourceBuffer;MediaSource.prototype.addSourceBuffer=function(...b){b=a.apply(this,b);b.abort=function(){};return b}};hI=function(){const a=SourceBuffer.prototype.remove;SourceBuffer.prototype.remove=function(b,c){return a.call(this,b,c-.001)}};
|
|
235
|
+
iI=function(){const a=MediaSource.isTypeSupported;MediaSource.isTypeSupported=b=>"opus"!==_.pB(b)&&a(b)};jI=function(a,b){const c=a.mode;a.mode=c===_.Df?_.Df:_.Yd;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};RA=[112,115,115,104,0,0,0,0];_.kI=class{constructor(a,b,c,d,e,f=()=>"",g){this.Da=a;this.na=b;this.ka=c;this.keyInfo=d||null;this.Vc=_.z(e)?!1:!!e;this.$c=f?f:()=>"";this.Ga=g}Gd(){return this.ka?this.ka-this.na+1:null}f(){return this.keyInfo}};
|
|
236
|
+
_.lI=class{constructor(a,b,c,d,e,f,g,h=null,k=!1,l=null,m=null,n=null,p=null,u=[],x=null,y=()=>"",B){this.position=a;this.startTime=b;this.endTime=c;this.Ka=g;this.Da=d;this.na=e;this.ka=f;this.keyInfo=h||null;this.Vc=_.z(k)?!1:!!k;this.timescale=l;this.horizontalTiles=m;this.verticalTiles=n;this.durationPerTile=p;this.a=u||[];this.h=!1;this.initSegment=x;this.$c=y?y:()=>"";this.Ga=B}getPosition(){return this.position}Gd(){return this.ka?this.ka-this.na+1:null}f(){return this.keyInfo}};TC=1;
|
|
237
|
+
yH=class{constructor(a,b,c){this.j=a;this.a=b;this.g=new _.S("clpp.net.CmcdManager");this.l=uB(this);this.j.a.push(this.l);this.f=c;this.h=!1}release(){OA(this.j,this.l)}};_.xB=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}};
|
|
238
|
+
_.zB=class{j(a,b){a=yB(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)}};_.Mg=_.zB.prototype;_.Mg.Zd=_.Og(18);_.Mg.Ee=_.Og(16);
|
|
239
|
+
_.Mg.te=_.Og(14);_.Mg.ue=_.Og(12);_.Mg.De=_.Og(10);_.Mg.Sc=_.Og(8);_.Mg.pe=_.Og(6);_.Mg.aa=_.Og(4);_.Mg.Cc=_.Og(2);_.Mg.Wb=_.Og(0);_.mI=0;
|
|
240
|
+
_.yG=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&&EB(this);a&&(this.player=a,this.player.on(_.vf,this.a,this))}release(){EB(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&&
|
|
241
|
+
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(CB)}GB(this);this.a();this.player&&this.player.trigger(new _.H(_.rg))}clear(){this.T=[];GB(this);this.player&&(this.player.trigger(new _.H(_.rg)),this.player.trigger(new _.H(_.Ic)))}a(){if(this.player){var a=this.player.getMediaPosition();if(0<=a){a:{var b=this.T.length,
|
|
242
|
+
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 _.H(_.Lc,{detail:{width:b,height:c,bandwidth:a?a.bandwidth:null,rendition:a}}))}}}}};
|
|
243
|
+
_.nI=class{constructor(a){this.h=Math.exp(Math.log(.5)/a);this.f=this.a=0}};
|
|
244
|
+
FD=class{constructor(a,b){this.w=null;this.C=a;this.h=b;this.j=this.A=0;this.l=Infinity;this.f=this.a=null;this.B="";this.o=new Map}destroy(){this.h=this.w=null;this.o.clear();return Promise.resolve()}remove(a,b){return Promise.resolve().then(()=>{!this.h||!this.h.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))})}Vb(){return this.a}Na(){return this.f}mc(a){return null==this.a||null==this.f?!1:a>=
|
|
245
|
+
this.a&&a<this.f}Oa(a){return null==this.f||this.f<a?0:this.f-Math.max(a,this.a)}};oI=class{constructor(a){this.a=this.h=0;this.f=a}Xb(){return this.h}getDuration(){return this.f?this.a-this.h:Infinity}};
|
|
246
|
+
_.pI=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.w=this.l=null;this.H=0;this.C=this.o=d;this.L=void 0===e?!0:e;this.g=new _.S("clpp.media.PresentationTimeline");this.M=f;this.K=null;this.a=new oI(d);this.I=null;this.B=this.j.type||null}Ec(){return this.K}getDuration(){return 2===this.j.version?this.a.getDuration():this.f}getPresentationStartTime(){return this.F}offset(a){null!=this.l&&(this.l+=a);null!=this.w&&(this.w+=
|
|
247
|
+
a)}isLive(){return 2===this.j.version?!this.a.f:Infinity===this.f&&!this.o}Nd(){return!this.o}Fc(){return this.B}};KG=class{constructor(){this.f=()=>{};this.h=()=>{};this.a=new Set}release(){this.f=()=>{};this.h=()=>{};this.a.clear()}cues(){return this.a}};
|
|
248
|
+
OH=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 _.Ev("crop",a,d.endTime?d.endTime-a:Infinity,!1))}release(){this.f=this.j=this.h=this.a=null}l(a){$A(this.a,a);lC(this)}};
|
|
249
|
+
nC=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.Da().length&&this.f===a.a.length&&(this.a+=1,this.f=0)):(this.a+=1,this.f=0);a=mC(this);return{value:a,done:!a}}};
|
|
250
|
+
_.qI=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: "+
|
|
251
|
+
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.Ka-=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-
|
|
252
|
+
1].endTime-this.a[0].startTime}replace(a){this.a=a}};xC=class{constructor(a,b){this.h=a;this.l=qC(a);this.a=a.a.currentTime;this.j=Date.now()/1E3;this.o=b;this.f=()=>{}}release(){this.h=null;this.f=()=>{}}};yC=class{constructor(a){this.a=a}};
|
|
253
|
+
rI=class{constructor(a,b,c,d,e){this.a=a;this.G=b;this.h=c;this.F=e;this.j=new _.Et;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,_.zg,()=>rC(this));this.w=(new _.Jh(()=>{rC(this)})).Gb(.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}ze(){this.A=!0;rC(this)}};
|
|
254
|
+
sI=class{constructor(a,b){this.f=a;this.o=b;this.l=this.h=this.j=0;this.a=new _.Jh(()=>{0>=this.j?(_.A(["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}};
|
|
255
|
+
tI=class{constructor(a,b,c,d){this.a=a;this.j=b;this.o=d;this.A=c;this.l=!1;this.f=new _.Et;this.h=new sI(a,10);this.w=!1;0<a.readyState?uC(this,c):vC(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}getTime(){return this.l?this.a.currentTime:this.A}};
|
|
256
|
+
KH=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 rI(a,b.presentationTimeline,c,zC(this,a,c),f);this.f=new tI(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=this.f.getTime();const l=CC(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;wC(this.f,l);h=void 0;break a}}this.g.debug("Seek to "+k);this.A(h?1:0);h=void 0}return h},BC(this,
|
|
257
|
+
d,g),()=>{this.j.H=!0});this.o=(new _.Jh(()=>{if(0!==this.h.readyState&&!this.h.paused){var h=this.f.getTime(),k=WB(this.a),l=fC(this.a);3>l-k&&(k=l-3);h<k&&(k=CC(this,h),this.g.info("Jumping forward "+(k-h)+" seconds to catch up with the seek range."),this.h.currentTime=k)}})).Gb(.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=()=>{}}getTime(){const a=
|
|
258
|
+
this.f.getTime();return 0<this.h.readyState&&!this.h.paused?gC(this.a,a):a}};LH=class{constructor(a){this.f=a;this.a=new Set;this.h=(new _.Jh(()=>{DC(this,!1)})).Gb(.25)}release(){this.h.stop();for(const a of this.a)a.release();this.a.clear()}};
|
|
259
|
+
NH=class{constructor(a){this.j=a;this.o=new Map;this.a=()=>{};this.f=()=>{};this.h=()=>{};this.w=[{Pc:null,Oc:2,Ic:(b,c)=>this.a(b,c)},{Pc:1,Oc:2,Ic:(b,c)=>this.a(b,c)},{Pc:3,Oc:2,Ic:(b,c)=>this.a(b,c)},{Pc:2,Oc:1,Ic:(b,c)=>this.f(b,c)},{Pc:2,Oc:3,Ic:(b,c)=>this.f(b,c)},{Pc:1,Oc:3,Ic:(b,c)=>this.h(b,c)},{Pc:3,Oc:1,Ic:(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=EC(d,
|
|
260
|
+
a);this.o.set(d,f);const g=this.w.find(h=>h.Pc===e&&h.Oc===f);g&&g.Ic(d,b&&0===c)}}};QC=class{constructor(){this.f=new _.nI(2);this.h=new _.nI(5);this.a=0}getBandwidthEstimate(a){return 128E3>this.a?a:Math.min(_.OB(this.f),_.OB(this.h))}};_.uI=class{constructor(a,b){this.id=a;this.qa=b}};
|
|
261
|
+
wH=class extends _.lu{constructor(a,b){super();this.A=a;this.h=null;this.B=b;this.C=new _.au;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()}getBaseUriCollectionById(a){var b=this.l.get(a);if(!b)return this.g.warn(`getBaseUriCollectionById: invalid baseUriSetId:${a}.`),
|
|
262
|
+
null;const c=Date.now();this.j.forEach((e,f)=>{e.vd&&c>e.vd&&(e.vd=0,this.trigger(new _.H(xA,{detail:{serviceLocationId:f,banned:!1,bannedSeconds:0}})))});let d=b.filter(e=>0===RC(this,e.serviceLocationId).vd);d.length||(d=b);d.length&&(b=this.w.get(a),KC(d,b)||(b={baseUriCollectionId:a,from:b||[],to:d},this.g.info(`Steering server update baseUriCollectionId: ${b.baseUriCollectionId} from: ${JSON.stringify(b.from)} to: ${JSON.stringify(b.to)}`),this.trigger(new _.H(wA,{detail:b})),this.w.set(a,d)));
|
|
263
|
+
return new _.uI(a,d)}notifyThroughput(a,b,c){a=RC(this,a);IC(a.Xf,b,c);a.Ge=!0}banLocation(a){const b=RC(this,a);b.vd=Date.now()+1E3*this.f;b.Ge=!1;this.g.info(`service location ${a} banned during ${this.f} seconds`);this.trigger(new _.H(xA,{detail:{serviceLocationId:a,banned:!0,bannedSeconds:this.f}}))}};var vI=class{constructor(a){this.D=a;this.g=new _.S("clpp.mse.StateManager");this.h=this.a=0;this.f=2}getState(){return this.a}};var wI=class extends _.U{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 iD(this,_.N)}getAudioTracks(){return iD(this,_.M)}sa(){return iD(this,_.L)}ta(){return this.a.get(_.N)||null}Pa(){return this.a.get(_.M)||null}Wa(){return this.a.get(_.L)||null}wb(){return this.f.get(_.N)||null}Nb(){return this.f.get(_.M)||
|
|
264
|
+
null}Ob(){return this.f.get(_.L)||null}Ha(){return jD(this,_.N)}ra(){return jD(this,_.M)}ua(){return jD(this,_.L)}Fb(a){this.m&&kD(this,_.N,a)}za(a){this.m&&kD(this,_.M,a)}$a(a){this.m&&kD(this,_.L,a)}rb(a,b){b=void 0===b?!1:b;if(this.m)if(a)oD(this,a,b);else if(a=b,b=jD(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."),nD(this.m,null,a))}Db(a){this.m&&(a?(lD(this,a,_.M),mD(this,a,_.M)&&(this.g.info(`Set audio rendition with ID: ${a.id}`),
|
|
265
|
+
this.f.set(_.M,a),tG(this.m,parseInt(a.id,10)))):this.g.info("Enabling ABR for audio is not supported"))}addTextTrack(a){const b=this;return _.v(function*(){b.m&&(yield b.m.addTextTrack(a.url,a.language,a.kind,a.mimeType,a.codec,a.label))})}va(){return!!this.m&&this.m.va()}Eb(a){if(this.m){var b=a;if(!a){const c=this.Wa();if(c&&c.track.kind!==_.Ud){a=this.sa().find(d=>d.kind===_.Ud&&d.language===c.track.language);if(!a){const d=this.ra();d&&(a=this.sa().find(e=>e.kind===_.Ud&&e.language===d.language))}a&&
|
|
266
|
+
(b=a.renditions[0])}}b?sD(this,b):tD(this)}}detach(){}};wI.prototype.setTextRendition=wI.prototype.Eb;wI.prototype.isAbrEnabled=wI.prototype.va;wI.prototype.addTextTrack=wI.prototype.addTextTrack;wI.prototype.setAudioRendition=wI.prototype.Db;wI.prototype.setVideoRendition=wI.prototype.rb;wI.prototype.setTextTrack=wI.prototype.$a;wI.prototype.setAudioTrack=wI.prototype.za;wI.prototype.setVideoTrack=wI.prototype.Fb;wI.prototype.getTextTrack=wI.prototype.ua;wI.prototype.getAudioTrack=wI.prototype.ra;
|
|
267
|
+
wI.prototype.getVideoTrack=wI.prototype.Ha;wI.prototype.getLoadingTextRendition=wI.prototype.Ob;wI.prototype.getLoadingAudioRendition=wI.prototype.Nb;wI.prototype.getLoadingVideoRendition=wI.prototype.wb;wI.prototype.getTextRendition=wI.prototype.Wa;wI.prototype.getAudioRendition=wI.prototype.Pa;wI.prototype.getVideoRendition=wI.prototype.ta;wI.prototype.getTextTracks=wI.prototype.sa;wI.prototype.getAudioTracks=wI.prototype.getAudioTracks;wI.prototype.getVideoTracks=wI.prototype.getVideoTracks;var rH;rH=class{constructor(){this.a=new muxjs.mp4.CaptionParser;this.l=[];this.j={}}init(a){const b=muxjs.mp4.probe;a=_.E(a);this.l=b.videoTrackIds(a);this.j=b.timescale(a)||{};this.a.init()}h(a,b){a=_.E(a);(a=this.a.parse(a,this.l,this.j))&&a.captions&&b(a.captions);this.a.clearParsedCaptions()}f(){this.a.resetCaptionStream()}};_.sH=class{init(){}h(){}f(){}};var DD;
|
|
268
|
+
_.tH=class{constructor(a,b,c,d,e){this.j=a;this.C=c;this.a={};this.J={};this.P=!1;this.f=null;this.h={};this.l=new _.Et;this.K=!1;this.w={};this.H=b;this.F=d;this.I=e;this.da=this.I.streaming.maxSegmentToMediaOffset||1;this.M=new _.uk;this.A="";this.G={};this.o=ED(this,this.M);this.R=!0;this.g=new _.S("clpp.mse.MediaSourceEngine")}destroy(){window.ManagedMediaSource&&(this.j.disableRemotePlayback=!1);this.K=!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&&
|
|
269
|
+
a.push(b.p.catch(cB));for(b=1;b<d.length;++b)d[b].p.catch(cB),d[b].p.reject()}this.f&&a.push(this.f.destroy());this.C&&a.push(this.C.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.A="";this.C=this.f=this.o=null;this.a={};this.J={};this.w={};this.G={};this.H=null;this.P=!1;for(const c in this.h);this.h={}})}open(){return this.M}init(a,
|
|
270
|
+
b,c){c=void 0===c?!1:c;const d=this;return _.v(function*(){yield d.M;for(const g of a){const [h,k]=g;{var e=k;const l=h,m=_.Gl(e.mimeType,e.codecs);if(l===_.I)GD(d,m);else{var f=new Map;f.set(l,m);_.Js(m)&&b&&!e.aesEncrypted||!_.Fl(m,l)||!(e=_.Fl(m))||(f=e(),d.w[l]=f,f=f.demuxMimeTypes(l,m),c&&f.delete(_.q));yield ID(d,f);d.P=f.has(_.q)&&f.has(_.t)}}}})}Vb(a){return a===_.I?this.f.Vb():(a=OD(this,a))?a.Vb():null}Na(a){return a===_.I?this.f.Na():(a=OD(this,a))?a.Na():null}mc(a,b,c){return a===_.I?
|
|
271
|
+
this.f.mc(b):(a=OD(this,a))?a.mc(b,!1,c):!1}Oa(a,b){return a===_.I?this.f.Oa(b):(a=OD(this,a))?a.Oa(b):0}remove(a,b,c){return a===_.I?this.f.remove(b,c):KD(this,a,this.U.bind(this,a,b,c)).then(()=>{if(a===_.t){var d=this.Vb(a);const e=this.Na(a);null!==d&&null!==e&&HB(this.F,d,e)}else a===_.q&&(d=this.F,d.player&&d.player.trigger(new _.H(_.Ic)))})}clear(a){if(a===_.I){if(!this.f)return Promise.resolve();this.H.f();return this.f.remove(0,Infinity)}return KD(this,a,this.U.bind(this,a,0,this.o.duration))}flush(a){return a===
|
|
272
|
+
_.I?Promise.resolve():KD(this,a,this.S.bind(this,a))}endOfStream(a){return YD(this,()=>{ND(this)||(a?this.o.endOfStream(a):this.o.endOfStream())})}getDuration(){return this.o.duration}L(a,b){this.g.debug("Appending data to "+a+bA);try{this.a[a].appendBuffer(b)}catch(c){throw this.g.warn("Failed to append data for "+a,c),c;}this.g.debug("Done Appending data to "+a+bA)}U(a,b,c){if(c<=b)this.B(a);else{this.g.debug("Removing data from "+a+" range:",b,c);try{this.a[a].remove(b,c)}catch(d){throw this.g.warn("Failed to remove data from "+
|
|
273
|
+
a+" buffer. Range:",b,c,d),d;}this.g.debug("Done Removing data from "+a+" range:",b,c)}}Z(a){try{this.g.debug("Aborting operations for "+a+bA);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("Failed to abort operations for "+a+bA,b),b;}this.g.debug("Done Aborting operations for "+a+bA);this.B(a)}S(a){try{this.j.readyState>HTMLMediaElement.HAVE_NOTHING?(this.g.debug("Flushing buffer for "+
|
|
274
|
+
a),this.j.currentTime-=.001):this.g.warn("Skip buffer flush for "+a+" with element state: "+this.j.readyState)}catch(b){throw this.g.warn("Failed to flush buffer for "+a,b),b;}this.g.debug("Done Flushing buffer for "+a);this.B(a)}W(a,b){0>b&&(b+=.001);try{this.g.debug("Setting timestamp offset for "+a,b),this.a[a].timestampOffset=b}catch(c){throw this.g.warn("Failed to set timestamp offset for "+a,b,c),c;}this.g.debug("Done Setting timestamp offset for "+a,b);this.B(a)}ja(a,b,c){try{this.g.debug("Setting append window for "+
|
|
275
|
+
a,b,c),this.a[a].appendWindowStart=0,this.a[a].appendWindowEnd=c,this.a[a].appendWindowStart=b}catch(d){throw this.g.warn("Failed to set append window for "+a,b,c,d),d;}this.g.debug("Done Setting append window for "+a,b,c);this.B(a)}ca(a){a:switch(a){case _.q:var b=2008;break a;case _.t:b=2007;break a;default:b=5001}this.h[a][0].p.reject(new _.J(_.C,3,3014,{mediaError:this.j.error?this.j.error.code:0},void 0,b))}B(a){const b=this.h[a][0];b&&(b.p.resolve(),this.g.debug("Update-End received for "+a),
|
|
276
|
+
XD(this,a))}getTextDisplayer(){return this.C}};DD=window.URL.createObjectURL;_.xI=class{constructor(){this.g=new _.S("clpp.abr");this.o=null;this.l=!1;this.w=new QC;this.f=[];this.B=1;this.G=this.F=!1;this.A=this.a=this.h=this.j=null;this.C=new Set}stop(){this.o=null;this.l=!1;this.f=[];this.B=1;this.h=null;this.G=!1;this.j=null;for(const a of this.C)a();this.C.clear()}init(a){this.o=a}chooseTrack(){var a=qE(this,!this.G&&this.a.initialRestrictions?this.a.initialRestrictions:this.a.restrictions,this.f),b=this.getBandwidthEstimate();this.f.length&&!a.length&&(this.g.warn("No tracks met the ABR restrictions. Choosing a track by lowest bandwidth."),
|
|
277
|
+
a=qE(this,null,this.f),a=[a[0]]);this.h=Date.now();this.G=!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.B)||0===this.B?1:Math.abs(this.B),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}this.j=(a=b||a[0]||this.f[0])?a.id:null;return a}enable(){this.l=!0}disable(){this.l=
|
|
278
|
+
!1}segmentDownloaded(a,b){this.g.debug("Segment downloaded:","deltaTimeMs\x3d"+a,"numBytes\x3d"+b,"lastTimeChosenMs\x3d"+this.h,"enabled\x3d"+this.l);IC(this.w,a,b);if(null!=this.h&&this.l)a:{this.g.debug("Suggesting Streams...");if(!this.F){if(!(128E3<=this.w.a)){this.g.debug("Still waiting for a good estimate...");break a}this.F=!0;if(this.a.useSwitchIntervalForInitialSwitch&&Date.now()-this.h<1E3*this.a.switchInterval){this.g.debug("Skipping initial estimation switch due to switch interval...");
|
|
279
|
+
break a}}else if(Date.now()-this.h<1E3*this.a.switchInterval){this.g.debug("Still within switch interval...");break a}b=this.j;a=this.chooseTrack();a&&a.id===b||(b=this.getBandwidthEstimate(),this.g.debug("Calling switch_(), bandwidth\x3d"+Math.round(b/1E3)+" kbps"),a&&this.o(a))}}playbackRateChanged(a){this.B=a}getBandwidthEstimate(){if(this.A&&this.a.useCmsd){var a=YA(this.A,_.Td);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=
|
|
280
|
+
a;this.j=null}setCmsdManager(a){this.A=a}configure(a){this.a=a}reset(){this.F=!1;this.w=new QC;const a=this.j,b=this.chooseTrack();b&&b.id!==a&&this.o(b)}beginSegmentMonitor(a,b){if(this.o){var c={$i:Date.now(),Gf:null,stopped:!1,stop:()=>{c.stopped||(c.stopped=!0,clearTimeout(c.Gf),this.C.delete(c.stop))}};a.V.finally(c.stop).catch(()=>{});this.C.add(c.stop);rE(this,a,c,b)}}};var yI=class{constructor(){this.a=null}};var zI=class{constructor(){this.a=new Map}clear(){this.a.clear()}},xE=class{constructor(){this.text=this.video=this.ib=this.audio=null}};var AI=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(BE(this.f,a,void 0===b?!0:b))return this.a.add(a),!0;_.A("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 oG=class{constructor(a,b){b=void 0===b?_.lf:b;this.f=a;this.a=b;this.h=new WG(a.language,"",a.audio&&a.audio.channelsCount?a.audio.channelsCount:0,!1,b)}create(a){const b=this.a===_.Hf&&BB(),c=a.filter(d=>BE(this.f,d,!b));return c.length?new AI(c[0],c):this.h.create(a)}},WG=class{constructor(a,b,c,d,e){this.j=_.kj(a);this.a=b;this.f=c;this.l=void 0===d?!1:d;this.h=void 0===e?_.lf:e}create(a){var b=CE(a,this.j);0<b.length&&(a=b);b=!1;if(this.a){var c=DE(a,this.a);0<c.length?(a=c,b=!0):_.A("No exact match for preferred variant role could be "+
|
|
281
|
+
`found. Role: ${this.a}`)}b||(b=a.filter(d=>d.primary),0<b.length&&(a=b));this.f&&(b=aE(a,this.f),b.length?a=b:_.A("No exact match for the channel count could be found."));b=EE(a,this.l);b.length?a=b:_.A("No exact match for spatial audio could be found.");b=this.h===_.Hf&&BB();c=new AI(a[0]);for(const d of a)c.add(d,!b);return c}};var PH=class{constructor(a,b){this.a=TH;this.f=(new Map).set(TH,b).set(FH,a)}getState(){return this.a}},FH=0,TH=1;var $G=class{constructor(a){this.D=a;this.a=a.getConfiguration().streaming;this.f=new _.Et;this.g=new _.S("clpp.mse.media.LiveEdgeObserver");FE(this)&&(a=this.D.getSurface().getMedia(),this.f.on(a,_.$f,()=>{{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."),
|
|
282
|
+
this.D.setPlaybackRate(this.a.chasingRate,_.xd)):1<d&&b<=e&&(this.g.debug("On live edge, reduce playback rate."),this.D.setPlaybackRate(1))}}))}release(){this.f.release()}};var MH=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=IB(c,a)||c[0]}b!==a&&this.f(a);this.a=a}};var ZG=class{constructor(a){this.f=a;this.o=this.w=this.l=!1;this.h=this.f.lc();this.A=_.xd;this.j=null;this.a=new _.Jh(()=>{this.w||this.f.si(.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;KE(this,b)}};var NE=new _.xu(()=>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]));_.QH=class{constructor(a,b){this.D=b;this.j=a;RE(a);this.h=null;this.l=1;this.G=Promise.resolve();this.B=new Map;this.o=new Map;this.a=new Map;this.J=this.f=this.w=this.C=!1;this.I=0;this.g=new _.S("clpp.mse.Streaming");this.F=this.A=this.H=!1}destroy(){const a=this;return _.v(function*(){const b=[];for(const c of a.a.values())SE(c),b.push(TE(c));yield Promise.all(b);a.a.clear();a.o.clear();a.D=null;a.j=null;a.G=null;a.B.clear();a.h=null;a.f=!0})}start(){const a=this;return _.v(function*(){const b=
|
|
283
|
+
a.D.xb();var c=IB(a.j.periods,b+_.Xt);if(!c)throw new _.J(_.C,5,5006,"No period found.");c=a.D.ef(c);if(!c.video&&!c.audio&&!c.text)throw a.g.error("start(): No streams chosen"),new _.J(_.C,5,5005,"No streams chosen.");a.H=!c.video&&!c.audio&&!!c.text;a.A=!!c.ib;yield $E(a,c,b);a.f||(a.g.debug("init: completed initial Stream setup"),a.D.yi&&a.D.yi())})}resume(){if(!yF(this))for(const a of this.a.values())a.endOfStream=!1,ZE(this,a,0)}dc(a){const b=this;return _.v(function*(){if(!b.f){var c=PE(a);
|
|
284
|
+
if(!a.Cb&&null!=a.sb&&!a.xc)if(a.sb=null,a.ic)b.g.debug(c,"skipping update and clearing the buffer"),yield mF(b,a,a.Je,a.ie);else{try{const d=PF(b,a);null!=d&&(ZE(b,a,d),a.dd=!1)}catch(d){yield QF(b,d);return}RF(b,a);if(zF(b))if(b.D.configuration.li){b.g.debug("End of stream reached, keeping MediaSource open.");for(const d of b.a.values())d.sb=null}else b.g.debug("End of stream reached, calling ms.endOfStream()."),yield b.D.$.endOfStream(),b.f||(c=b.D.$.getDuration(),c<b.j.presentationTimeline.getDuration()&&
|
|
285
|
+
(b.j.presentationTimeline.f=c),b.D.Fg())}}})}K(a,b,c,d){const e=d.version;let f,g,h,k,l,m,n;if(0===e)f=QA(d.reader),g=QA(d.reader),h=_.P(d.reader),k=_.P(d.reader),m=_.P(d.reader),n=_.P(d.reader);else if(1===e)h=_.P(d.reader),l=_.Pm(d.reader),m=_.P(d.reader),n=_.P(d.reader),f=QA(d.reader),g=QA(d.reader);else{this.g.warn(`Ignoring EMSG box with unsupported version ${e}.`);return}0===h?this.g.warn("Ignoring EMSG box with invalid timescale 0."):(d=_.Rm(d.reader,d.reader.Sa()-d.reader.getPosition()),a=
|
|
286
|
+
0===e?a.startTime+b.startTime+k/h:a.startTime+l/h,c.includes(f)&&("urn:mpeg:dash:event:2012"===f?this.D.Ig():(c=new _.H("emsg",{detail:{startTime:a,endTime:a+m/h,schemeIdUri:f,value:g,version:e,timescale:h,presentationTimeDelta:k,presentationTime:l,eventDuration:m,id:n,messageData:d}}),this.D.onEvent(c))))}L(a){let b=!1,c=0;(new _.an).N(_.ue,_.Um).N(_.bg,_.Um).N(_.pe,_.Um).N(_.te,_.Um).N(_.Mf,_.Um).fa(_.Of,_.Vm).N("encv",d=>{d.reader.skip(78);_.Um(d)}).N("pasp",d=>{c=d.start+d.headerSize;const e=
|
|
287
|
+
_.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 _.cn(new DataView(a.data)),a.seek(c),_.O(a,1),_.O(a,1))}};var BI=class{constructor(){this.a=null}};var CI=class extends _.ou{constructor(){super(vA);this.G=pH;this.Hb=this.j=this.Z=null;this.vf=!1;this.o=new _.Et;this.R=this.If=this.kd=this.H=this.lb=this.B=this.K=this.A=null;this.Hc=!1;this.a=this.J=this.I=null;this.M=[];this.f=null;this.h=new _.xI;this.U=this.cb=null;this.gh=1E9;this.md=new Set;this.da=null;this.fh=!1;this.eh=0;this.W=null;this.l=new zI;this.F=null;this.bb=new vI({isSeeking:()=>this.qf,xi:a=>{null!==this.H&&(this.H.w=10===a);this.F&&_.$o(this.F.a,a)},Di:()=>{this.R&&this.R.stop()},
|
|
288
|
+
trigger:a=>this.trigger(a)});this.Dc=new WG(this.configuration.preferredAudioLanguage||[],this.configuration.preferredAudioRole,this.configuration.preferredAudioChannelCount,this.configuration.preferSpatialAudio,this.configuration.mediaSource.codecSwitchingStrategy);this.yc=this.configuration.preferredTextLanguage;this.w=new yI;this.ca=this.Aa=null;this.Ib=new Map;this.Gc=null;this.gd=this.configuration.preferredTextRole;this.wc=this.configuration.preferForcedSubtitles;this.o.on(window,"online",()=>
|
|
289
|
+
{this.G===uG&&xF(this.a)});this.we=this.Bc=this.Be=null;this.S=_.oa;this.Jc=new BI;this.zc=null}init(a,b){const c=a.getMedia();super.init(a,b);xG(this,c)}namespace(){return vA}setSeekInterceptor(a){this.If=a||null}setPlaybackSessionId(a){this.zc=a}dh(){return new wI}getState(){return this.bb.getState()}getDrmInfo(){return this.A?this.A.getDrmInfo():null}unload(){const a=this;return _.v(function*(){qD(a,!1);a.Hc=!1;if(a.ia){a.log.debug("Unload player with source",a.ia);var b=a.getTrackManager();b&&
|
|
290
|
+
b.release();a.G!==GG&&(yield EG(a),a.ia=null,a.bb.h=0,a.Aa=null,a.ca=null,a.getNetworkEngine().headers.delete(qA))}})}release(){const a=this;return _.v(function*(){if(a.Z)return a.Z;a.Z=FG(a);a.Z.finally(()=>{a.Z=null});return a.Z})}getBufferInfo(a){if(this.K){var b=PD(this.K);const c=new _.iu(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.Hb?(b=DB(this.Hb),vB(b,a)):super.getBufferInfo(a)}getPosition(){var a=
|
|
291
|
+
this.Jc,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.B?this.B.getTime():super.getMediaPosition()}seek(a,b){if(this.If&&!this.If(a,b))return Promise.resolve();b=this.Jc;b=b.a?a+b.a.Xb():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.Jc,b=this.getMediaDuration();
|
|
292
|
+
return a.a?a.a.getDuration():b}getMediaDuration(){return this.f?this.f.presentationTimeline.getDuration():Infinity}destroy(){const a=this,b=()=>Object.getPrototypeOf(Object.getPrototypeOf(this)).destroy;return _.v(function*(){yield b().call(a);a.G!==GG&&(a.log.debug("Destroying player..."),a.G=GG,CG(a),a.o&&(a.o.release(),a.o=null),a.Bc=null,a.h=null)})}getTimeline(){return this.Bc}setupPlaylist(a){const b=this;return _.v(function*(){const c=new _.uk;b.w.a=c;try{AG(b);b.S=_.ab;yield HG(b);wE(b.w,
|
|
293
|
+
c);const d=a[0];d.playlist&&d.playlist.startTime&&(d.startTime=d.playlist.startTime);b.ia=_.gp(d);b.configuration=_.nm([b.ja,d]);b.log.info("Loading playlist configurations",a);b.Bc=IG(b.configuration);yield MG(b,c);wE(b.w,c);const e=a.map(n=>PG(b,n,0,null,!0)),f=yield Promise.all(e);b.M=f.map(n=>n.parser).filter(n=>null!=n);const g=f.filter(n=>n.manifest.presentationTimeline.isLive()),h=g[0];if(1<g.length)throw new _.J(_.C,7,7003,"Playlist of multiple live streams is not supported.");if(h){const n=
|
|
294
|
+
b.configuration.playlist.content;if(n===_.Db)throw new _.J(_.C,7,7003,"Cannot play live content in VOD mode.");if("IPR"===n&&h!==f[f.length-1])throw new _.J(_.C,7,7003,"Wrong order of playlist assets.");}const k=new _.pI({version:2},null,0,null==h),l=f.map(n=>bD(n.manifest)),m=eD(l,k);b.f=m;b.A=yield TG(b,m,b.configuration);wE(b.w,c);yield fH(b,c);wE(b.w,c);vF(b.a,m);gH(b,m);c.resolve()}catch(d){yield hH(b),jH(b,d,c)}})}appendLoad(a){const b=this;return _.v(function*(){AG(b);if(b.S!==_.ab)throw new _.J(_.C,
|
|
295
|
+
7,7003,"Cannot append-load to non-playlist player.");const c=yield lH(b,a);b.f=c.manifest;c.parser&&b.M.push(c.parser);vF(b.a,c.manifest);zF(b.a)&&b.a.resume();gH(b,c.manifest)})}seekWith(a){return this.seek(this.getPosition()+a)}ah(){const a=this;return _.v(function*(){AG(a);a.Be?(a.log.info("Loading preloaded asset",a.Be),a.Be=null,yield fH(a,null)):a.log.warn("No preloaded asset found")})}preload(a){const b=this;return _.v(function*(){AG(b);_.Rn("preload.start");b.log.info("Preloading asset",a);
|
|
296
|
+
yield vH(b,a,!1);b.Be=a;b.log.info("Preloaded asset",a);_.Rn("preload.end");_.Tn("preload","preload.start","preload.end")})}load(a){return vH(this,a)}detach(){const a=this;return _.v(function*(){yield BG(a);a.configuration=a.ja;CG(a)})}isLive(){var a;this.f?(a=this.f.presentationTimeline.isLive())||(a=this.f.presentationTimeline,a=Infinity!==a.f&&!a.o):a=!1;return a}Nf(){this.log.debug("User seeking finished");this.I&&GH(this);CH(this)}getSeekRange(){var a={start:0,end:0};if(this.f){var b=this.f.presentationTimeline;
|
|
297
|
+
a={start:WB(b),end:fC(b)}}b=this.Jc;b.a?(b=b.a.getDuration(),b>a.end&&(b=a.end),b={start:0,end:b}):b=a;return b}Ec(){return this.f?this.f.presentationTimeline.Ec():null}getPlaybackRate(){if(this.H){var a=this.H;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.G===uG){if(_.Ph()){this.log.warn("Pausing and unpausing to mitigate playbackRate platform issue.");const c=this.getSurface().getMedia();c.pause();this.H.set(a,b);
|
|
298
|
+
c.play()}else this.H.set(a,b);(b=this.H.getConfiguration())&&b.preferTrickPlayTracks&&oF(this.a,1<Math.abs(a));this.h.playbackRateChanged(a)}}bd(){if(!this.f||!this.B)return[];const a=UH(this),b=VH(this),c=[];for(const d of XH(this)){const e=lE(d);e.ee=d.video===a;e.de=d.audio===b;c.push(e)}return c}sa(){if(this.f&&this.B){var a=yD(this);if(null==a)a=null;else{if(!zD(this.l,a).text){var b=_.pE(a.textStreams,this.yc,this.gd,this.wc);b.length&&yE(this.l,a,b[0])}a=zD(this.l,a).text}b=[];for(const c of YH(this)){const d=
|
|
299
|
+
mE(c);d.Le=c===a;b.push(d)}return b}return[]}getPeriods(){return this.f.periods}getStats(){if(this.G!==uG)return _.dp();CH(this);var a=this.j;if(a.getVideoPlaybackQuality){var b=a.getVideoPlaybackQuality();a=this.F;var c=Number(b.totalVideoFrames);a.o=Number(b.droppedVideoFrames);a.l=c}if(this.G===uG){(c=yD(this))?(a=zD(this.l,c).video,c=zD(this.l,c).audio,a=((a?a.bandwidth:0)||0)+((c?c.bandwidth:0)||0)):a=null;a&&(this.F.w=a);if(b=UH(this))a=this.F,c=b.height||NaN,a.A=b.width||NaN,a.j=c;a=this.h.getBandwidthEstimate();
|
|
300
|
+
this.F.h=a}return this.F.getStats()}getBandwidthEstimate(){return this.h.getBandwidthEstimate()}getCueTimeline(){return this.J}getTimelineCues(){return this.J?kC(this.J,zH(this)):[]}resetAbr(){this.h&&this.h.reset()}Dd(){return this.h}addTextTrack(a,b,c,d,e,f){const g=this;return _.v(function*(){if(g.G!==uG)throw g.log.error("Must call load() and wait for it to resolve before adding text tracks."),Error("State error!");const h=yD(g);var k=g.f.periods.indexOf(h)+1;const l=(k>=g.f.periods.length?g.f.presentationTimeline.getDuration():
|
|
301
|
+
g.f.periods[k].startTime)-h.startTime;if(Infinity===l)throw new _.J(1,4,4040);const m=new _.lI(1,0,l,()=>[a],0,null,0);k={id:g.gh++,originalId:null,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:()=>1,getSegmentReference:p=>1===p?m:null,adjustSegmentDurations:()=>{},getDuration:()=>l,segmentLookupStrategy:_.BA,initSegmentReference:null,mimeType:d,codecs:e||"",kind:c,encrypted:!1,keyId:null,language:b,originalLanguage:b,label:f||null,type:_.I,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,
|
|
302
|
+
roles:[],channelsCount:null,spatialAudio:!1,closedCaptions:null};g.md.add(k);h.textStreams.push(k);yield fF(g.a,k);const n=_.cF(g.a,_.I);n&&yE(g.l,h,n);g.md.delete(k);g.log.debug("Choosing new streams after adding a text stream");bI(g,h);RG(g);return mE(k)})}ih(a){this.log.debug(_.FA,a.id);try{this.log.debug("onChooseStreams_, choosing variant from ",a.variants);this.log.debug("onChooseStreams_, choosing text from ",a.textStreams);const b=cI(this,a);this.log.debug("onChooseStreams_, chose video ",
|
|
303
|
+
b.video);this.log.debug("onChooseStreams_, chose audio ",b.audio);this.log.debug("onChooseStreams_, chose text ",b.text);return b}catch(b){return this.onError(b),{audio:null,video:null,text:null,ib:null}}}jh(){const a=this;return _.v(function*(){a.log.debug("onCanSwitch_");a.configuration.abr.enabled&&a.h.enable();a.da&&(yield pF(a.a,a.da,a.fh,a.eh),a.da=null);a.W&&(yield _.tF(a.a,a.W),a.W=null)})}oh(){const a=yD(this);a&&a.parser&&a.parser.update()}lh(){this.B&&this.B.j.ze()}hh(a,b,c){if((void 0===
|
|
304
|
+
c?"":c)===DA)return RG(this),this.va()||(this.configuration.abr.enabled=!0,this.h.enable()),bI(this,b,!1),!0;if(c=b.variants.some(d=>{let e=!1;const f=d[a.type];f&&(e=d.allowedByApplication&&f.id!==a.id,a.type===_.q&&(e=e&&f.language===a.language));return e})&&this.va()){for(const d of b.variants){const e=d[a.type];e&&e.id===a.id&&(d.allowedByApplication=!1)}RG(this);this.va()||(this.configuration.abr.enabled=!0,this.h.enable());bI(this,b)}return c}kh(){this.log.debug("endOfStream called by streaming engine");
|
|
305
|
+
this.Hc=!0}onError(a){if(this.G!==GG&&7001!==a.code&&7E3!==a.code){var b=new _.H(_.Sd,{detail:a});a.severity===_.C&&YC(this.bb,3);this.trigger(b);b.defaultPrevented&&(b.a=!0)}}Df(a){a.type===_.Kd?this.dispatchEvent(a):"largegap"!==a.type&&(a.type===_.Ag?qH(this):"emsg"!==a.type&&(a instanceof _.H?this.dispatchEvent(a):this.log.debug(_.xb,a.type)))}va(){return this.configuration.abr.enabled}nh(a){const b=this;return _.v(function*(){if(b.Rc){b.log.info("Attempt to switch CDN.");var c=b.getLoadedSource(),
|
|
306
|
+
d=b.va();if(c=yield b.Rc(c.url,a)){c=_.Xg(b.getLoadedSource(),{url:c});d&&b.h.disable();yield GF(b.a);var e=UH(b),f=VH(b);do{var g=!1;try{b.log.info(`Switching CDN to ${c.url}.`),yield dI(b,c,e,f)}catch(h){if(b.log.info("Switch failed"),g=yield b.Rc(c.url,a))c.url=g,g=!0;else throw h;}}while(g);d&&b.h.enable();xF(b.a,!0);b.ia[b.getSourceIndex()]=c;a.f=!0;b.trigger(new _.H(_.Uc,{newManifest:c.url}))}}})}},GG=0,pH=1,uG=2,QG=[_.Le,_.be];var DI=class extends _.Bv{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=_.zd;c.label===lA&&(this.a=c)}this.a||(this.a=a.addTextTrack(_.MA,lA));this.a.mode=_.Yd}append(a){const b=[],c=d=>{if(d.startTime>=d.endTime)_.A("Invalid cue times: "+d.startTime+" - "+d.endTime),d=null;else{var e=d.payload||"";e=e.replace(/<br\s*\/?>/igm,"\n");e=_.Ji(e);e=new VTTCue(d.startTime,d.endTime,e);e.line=-1;try{e.align=_.Wc}catch(f){e.align=
|
|
307
|
+
"middle"}d.writingMode===_.ng?e.vertical="lr":d.writingMode===_.og&&(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;jI(this.a,c=>c.startTime<b&&c.endTime>a);return!0}isTextVisible(){return this.a.mode===_.Df}setTextVisibility(a){null!==this.a&&(this.a.mode=a?_.Df:_.Yd)}destroy(){this.a&&
|
|
308
|
+
jI(this.a,()=>!0);this.a=null;return Promise.resolve()}};var EI=class{a(){return!0}create(a){return new DI(a)}};_.vh(new class{a(){return vA}canPlay(a,b){if(_.Xh())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 _.vt||_.Ej(a.url)in _.wt?!0:!1:!1;if(d&&a){if(_.Ph(2))return 1;if(_.Yh()&&c===_.fm){if(b.streaming.preferNativeHlsOnSafari)return 1;_.A("Support for MSE + FairPlay on Apple is experimental. In case of issues, consider using native HLS.")}return 2}return 0}f(a){return a===
|
|
309
|
+
_.oa||a===_.ab}create(){return new CI}});_.Xo("single-native",new EI);
|
|
310
|
+
_.jr(function(){_.rh("MediaSource.install");if(window.MediaSource)if(window.cast&&cast.__platform__&&cast.__platform__.canDisplayType)_.qh("Patching Chromecast MSE bugs."),eI();else if(_.Yh()){var a=navigator.appVersion;a=0<=a.indexOf("Version")?parseInt(a.match(/Version\/(\d+)/)[1],10):13;fI();10>=a?(_.qh("Blacklisting MSE on Safari \x3c\x3d 10."),window.MediaSource=null):12>=a?(_.qh("Patching Safari 11 \x26 12 MSE bugs."),gI(),hI()):(_.qh("Patching Safari 13 MSE bugs."),gI())}else _.Ph(2)||_.Ph(3)||
|
|
311
|
+
_.Ph(4)?iI():_.qh("Using native MSE as-is.");else _.qh("No MSE implementation available.")});};f.call(g, window);
|