@castlabs/prestoplay 6.34.0 → 6.35.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/cjs/cl.adobe.js +3 -3
- package/cjs/cl.airplay.js +3 -3
- package/cjs/cl.broadpeak.js +18 -18
- package/cjs/cl.cast.js +125 -125
- package/cjs/cl.conviva.js +31 -31
- package/cjs/cl.core.js +579 -577
- package/cjs/cl.crypto.js +9 -9
- package/cjs/cl.dash.js +100 -100
- 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 +25 -25
- package/cjs/cl.mediatailor.js +3 -3
- package/cjs/cl.mse.js +345 -345
- package/cjs/cl.muxdata.js +13 -13
- package/cjs/cl.onboard.js +4 -4
- package/cjs/cl.persistent.js +14 -14
- package/cjs/cl.playlist.js +5 -5
- package/cjs/cl.simid.js +16 -16
- package/cjs/cl.smooth.js +70 -70
- package/cjs/cl.thumbnails.js +25 -25
- package/cjs/cl.tizen.js +67 -67
- package/cjs/cl.ttml.js +29 -29
- package/cjs/cl.verimatrix.js +5 -5
- package/cjs/cl.vimond.js +8 -8
- package/cjs/cl.vr.js +19 -19
- package/cjs/cl.vtt.js +14 -14
- package/cjs/cl.yospace.js +3 -3
- package/cjs/cl.youbora.js +38 -38
- package/cl.adobe.js +3 -3
- package/cl.airplay.js +3 -3
- package/cl.broadpeak.js +14 -14
- package/cl.cast.js +97 -97
- package/cl.conviva.js +28 -27
- package/cl.core.js +463 -462
- package/cl.crypto.js +8 -8
- package/cl.dash.js +89 -89
- 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 +19 -19
- package/cl.mediatailor.js +2 -2
- package/cl.mse.js +299 -299
- package/cl.muxdata.js +11 -11
- 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 +60 -60
- package/cl.thumbnails.js +17 -17
- package/cl.tizen.js +55 -55
- package/cl.ttml.js +22 -22
- package/cl.verimatrix.js +4 -4
- package/cl.vimond.js +7 -7
- 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/cl.mse.js
CHANGED
|
@@ -1,309 +1,309 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
_.
|
|
8
|
-
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
|
-
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};_.
|
|
16
|
-
|
|
17
|
-
_.
|
|
18
|
-
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var uA,vA,xA,yA,zA,AA,BA,CA,EA,FA,GA,HA,JA,KA,LA,MA,OA,PA,QA,RA,TA,WA,XA,ZA,$A,aB,bB,cB,dB,gB,hB,iB,jB,oB,pB,qB,rB,sB,tB,uB,wB,zB,DB,EB,FB,GB,IB,JB,MB,KB,LB,NB,OB,QB,SB,TB,UB,VB,WB,XB,YB,ZB,$B,aC,bC,dC,iC,jC,kC,nC,qC,vC,xC,mC,yC,zC,AC,BC,CC,DC,EC,GC,HC,IC,JC,KC,MC,NC,OC,LC,RC,TC,SC,UC,VC,WC,XC,$C,bD,fD,gD,iD,cD,dD,eD,jD,kD,lD,mD,nD,oD,pD,rD,sD,tD,vD,uD,wD,xD,yD,zD,AD,BD,FD,JD,KD,OD,GD,DD,CD,MD,ND,RD,SD,TD,VD,XD,ZD,$D,YD,aE,cE,dE,eE,fE,gE,hE,iE,jE,kE,lE,mE,oE,pE,nE,bE,vE,qE,rE,sE,tE,uE,
|
|
2
|
+
wE,xE,yE,BE,zE,AE,CE,DE,EE,FE,HE,IE,JE,KE,LE,ME,NE,QD,PE,SE,QE,RE,TE,UE,VE,WE,XE,YE,aF,ZE,$E,cF,bF,eF,fF,gF,hF,iF,jF,qF,rF,sF,uF,vF,nF,kF,oF,pF,wF,xF,yF,EF,FF,GF,AF,HF,IF,JF,mF,LF,MF,NF,UF,VF,WF,DF,XF,YF,BF,ZF,CF,lF,bG,cG,fG,gG,hG,dG,eG,zF,$F,aG,iG,jG,kG,lG,oG,pG,qG,vG,wG,nG,uG,xG,mG,yG,zG,rG,sG,tG,AG,ED,KG,HD,ID,LD,OG,QG,VG,WG,TG,RG,YG,ZG,cH,fH,jH,wH,xH,yH,AH,BH,CH,DH,EH,FH,SG,UG,MH,OH,LH,zH,$G,bH,dH,eH,HH,iH,kH,lH,HG,BG,PD,IG,nH,oH,rH,sH,tH,uH,vH,hH,GG,XH,TH,SH,kI,lI,nI,oI,MG,NG,CG,DG,EG,JG,qI,
|
|
3
|
+
QH,sI,pI,UH,VH,mI,hI,iI,rI,tI,ZH,$H,YH,uI,RH,vI,wI,xI,yI,zI,AI,kB,PH,WD,FI,aH,eI,FC,PC,QC,II,JI,KI,aI,bI,dI,hD,NH;uA=" buffer";vA="\x3c/DATA\x3e\x3c/WRMHEADER\x3e";_.wA="AUDIO";xA="Cannot get segment, period ID unknown";yA="Choosing new streams after key status change";zA="IterateSegmentReference";AA="Jumping forward";BA="MediaSource threw QuotaExceededError:";CA="Period not found.";_.DA="Player is in ERROR state and can not switch to ";EA="PrestoPlay TextTrack";FA="Removing audio from variant - audio not compatible with platform";
|
|
4
|
+
GA="Setting playback rate to\x3d";HA="URI-REPLACEMENT";_.IA="Updating manifest...";JA="X-Playback-Session-Id";KA="bufferBehind\x3d";LA="bufferedBehind\x3d";MA="cannot find segment";_.NA="caption";OA="clpp.mse.Player";PA="content-steering-change";QA="content-steering-location-ban-update";RA="currentPeriod.startTime\x3d";_.SA="dashif:Laurl";TA="fetching init segment";_.UA="getSegmentNextReference";_.VA="iterateSegmentReference";WA="key-restriction";XA="manifest.start";_.YA="onChooseStreams_ period";
|
|
5
|
+
ZA="presentationTime:";$A="presentationTime\x3d";aB="reference.endTime\x3d";bB="reference.position\x3d";cB="reference.startTime\x3d";dB="single-native";_.eB="subtitle";_.fB="subtitles";gB="switch: Stream ";hB=function(a,b){a.a=a.a.filter(c=>c!==b)};iB=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
|
+
jB=function(a){const b=a.a+a.f.byteOffset;let c=void 0;for(;_.Cm(a);)if(0===_.Em(a)){c=a.a+a.f.byteOffset-1;break}a=a.f.buffer.slice(b,c);return _.wi(a)};_.lB=function(a){const b=new Uint8Array(kB),c=4+b.byteLength+a.j.byteLength+4+a.f.byteLength,d=new _.Ym(c,!1);_.O(d,c);_.Bm(d,b);_.Bm(d,a.j);_.O(d,a.f.byteLength);_.Bm(d,a.f);return _.E(d.buffer)};
|
|
7
|
+
_.mB=function(a,b,c,d){var e=_.Qk(b);if(8!==e.byteLength)e="";else{var f=_.Fn(e);e=_.Nk(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>`:"",vA].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>`:"",vA].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>`:"",vA].join("");break b;default:_.A("Cannot create PlayReady header in version",a),e=""}}if(!e)return null;_.rh("New payload",e);e=_.E(_.Bi(e,!0));return new _.Jn(_.Kn,b,d||null,e,a,c)};_.nB=function(a,b){return b===a.version?a:_.mB(b,a.a,a.l||void 0,a.h||void 0)};
|
|
10
|
+
oB=function(a,b){if(_.Ph("Edge/"))return!0;b=b.toLowerCase();if(_.Qh()&&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)};pB=function(a,b){var c=b.audio,d=b.video;if(c&&c.encrypted&&(c=_.Vn(c),!oB(a,c))||d&&d.encrypted&&(d=_.Vn(d),!oB(a,d)))return!1;const e=a.keySystem();return 0===b.drmInfos.length||b.drmInfos.some(f=>f.keySystem===e)};
|
|
11
|
+
qB=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}))};rB=function(a,b){return null==a.a?null:(a=a.a[a.a.length-1])?a[b]:null};sB=function(a){a=rB(a,_.xv);return null==a?null:a};tB=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.Yb()+d.getDuration();)c+=1,d=a.a[c]||null;a.f=d?c:a.a.length-1}else a.f=-1};
|
|
12
|
+
uB=function(a){return 1001===a||1002===a||1003===a};_.vB=function(a,b){return a.concat(b)};wB=function(){};_.xB=function(a,b){return 0===b.length?a:a.map(c=>b.map(d=>_.Dj(d,c))).reduce(_.vB,[])};_.yB=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:b||[],keyIds:[],periodId:c?c:null}};
|
|
13
|
+
zB=function(a){return a.language?_.Uj(a.language):a.audio&&a.audio.language?_.Uj(a.audio.language):a.video&&a.video.language?_.Uj(a.video.language):_.eg};_.AB=function(a){if(typeof a!==_.Of)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}};
|
|
14
|
+
_.BB=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||
|
|
15
|
+
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};_.CB=function(a,b){return a.length&&b.length?0<_.BB(a,b).length:!0};
|
|
16
|
+
DB=function(a,b){let c=0;for(const d of a)c+=b(d)?1:0;return c};EB=function(a,b){var c=_.Jl(b,a);if(!c)return!1;c=c();a=c.isMuxed(a,b);c.destroy();return a};FB=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,"")};GB=function(a){return a.split(",").map(b=>b.trim()).filter(b=>0<b.length)};
|
|
17
|
+
_.HB=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(",")};IB=function(a,b){const c=_.HB(_.Ml(a));a=_.Ll(a);const d=_.HB(_.Ml(b));return a===_.Ll(b)&&c===d};
|
|
18
|
+
JB=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,Rj:b,Sj: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)&&
|
|
19
19
|
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};
|
|
20
|
-
|
|
20
|
+
MB=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())?KB(f):void 0;e=1E3*e().Ra(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=LB(l,G);x=p;if(n&&
|
|
21
21
|
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*
|
|
22
22
|
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,
|
|
23
23
|
it will be ignored.
|
|
24
|
-
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=
|
|
25
|
-
b.uris[m]=n.toString()}else{m=
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
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=JB(m);if((F=Object.values(F).join(","))&&b.uris)for(m=0;m<b.uris.length;m++)n=new _.Ej(b.uris[m]),n.a.searchParams.set("CMCD",F),
|
|
25
|
+
b.uris[m]=n.toString()}else{m=JB(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)}};KB=function(a){switch(a.type){case _.tc:return"d";case _.lm:return"h";case _.Bc:return"s";default:return"o"}};LB=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}};
|
|
26
|
+
NB=function(a,b="total"){b=new _.Au(void 0,b);for(const c of a)b.a.push(c);b.length=a.length;return b};
|
|
27
|
+
OB=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}})};
|
|
28
|
+
QB=function(a){function b(h,k){return new _.PB(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==
|
|
29
29
|
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,
|
|
30
30
|
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=
|
|
31
|
-
c(l));l=new _.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
_.
|
|
37
|
-
_.
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
a.f=Math.max(a.f,Math.min(d,a.l))};_.
|
|
41
|
-
_.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
!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(
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
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};
|
|
53
|
-
|
|
54
|
-
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};
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
10);d&&(a.g.info(`Will retry after ${d} s `+"based on Retry-After header."),a.f=d);
|
|
58
|
-
|
|
59
|
-
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
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
reason:e}}))}};
|
|
68
|
-
|
|
69
|
-
return c};
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
a.g.warn("Cannot find matching variant")}};
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
c.video.buffer))),k=Promise.all(f)):(f&&window.muxjs&&(a.f||
|
|
85
|
-
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
|
|
86
|
-
d&&null!==e&&(a.G[b]=!0)}).catch(p=>{throw p;})};
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
null===m.audio?!1:l.has(k(m.audio.codecs)))}f=
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
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),
|
|
31
|
+
c(l));l=new _.PB(l,null,n,p,x,m,g)}k.push(l)}else l=e,e=a.indexOf("\x3c",e)-1,-2===e&&(e=f),l=OB(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 _.PB("#document",null,{},c(""),null,null,g)};
|
|
32
|
+
SB=function(a){switch(a){case _.rm:_.gv.info("Select DOM parser for XML");_.Gn=new _.fv;break;case "txml":_.gv.info("Select TXML parser for XML");_.Gn=new _.RB;break;default:_.gv.warn("XML parser option unknown, using default "+`DOM parser. Option: ${a}`),_.Gn=new _.fv}};TB=function(){return!!window.SourceBuffer&&!!SourceBuffer.prototype&&!!SourceBuffer.prototype.changeType};UB=function(a,b){return a.start-b.start};
|
|
33
|
+
VB=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}))};WB=function(a){a.player&&(a.player.off(_.wf,a.a),a.f&&a.player.off(_.$f,a.a));a.player=null};XB=function(a){a.player&&a.player.trigger(new _.H(_.Ic))};
|
|
34
|
+
YB=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)}};ZB=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))};
|
|
35
|
+
$B=function(a,b){let c=null;for(const d of a)b>=d.startTime&&(c=d);return c};aC=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};bC=function(a,b){for(let c=0;c<a.length;c++)if(aC(a[c]).has(b))return c;return-1};dC=function(a,b){Array.from(aC(a)).forEach(c=>{c.segmentIndex&&_.cC(c.segmentIndex,b)})};
|
|
36
|
+
_.eC=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)};_.fC=function(a){return a.a/(1-Math.pow(a.h,a.f))};_.gC=function(a,b,c,d,e,f,g,h){a=_.fk(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};
|
|
37
|
+
_.hC=function(a){a=a.toLowerCase();return _.Bt[a]||window.muxjs&&a===_.sc?!0:!1};iC=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)}})};
|
|
38
|
+
jC=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,[]))}};
|
|
39
|
+
kC=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 _.fu(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));
|
|
40
|
+
a.f=Math.max(a.f,Math.min(d,a.l))};_.lC=function(a,b,c){a.h=b;a.a=c};nC=function(a){return 2===a.j.version?a.a.Yb():mC(a,0)};_.oC=function(a,b){a.K={offsetDateTime:b-nC(a),seekRangeStartDateTime:b}};_.pC=function(a,b){a.o=b;a.C=b;a.a.f=b};qC=function(a){return 2===a.j.version?a.a.f?a.a.a:null:a.o?a.f:a.C?a.w:null};_.sC=function(a,b,c){var d=b.oc;a.l=null==a.l?d:Math.min(a.l,d);a.h=Math.max(a.h,b.cc);_.rC(a,b.bc);null!=a.F&&a.L&&(a.F=(Date.now()+a.H)/1E3-(a.w||0)-a.h);a.g.debug(`${c}: maxSegmentDuration=${a.h}`)};
|
|
41
|
+
_.tC=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);_.sC(a,{oc:d,bc:c,cc:b},"notifySegments")}};_.rC=function(a,b){a.w=Math.max(a.w||0,b)};_.uC=function(a,b){a.h=Math.max(a.h,b);a.g.debug("notifyNewSegmentDuration: maxSegmentDuration\x3d"+a.h)};
|
|
42
|
+
vC=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};_.wC=function(a){return 2===a.j.version?a.a.Yb():Infinity===a.A?0:Math.max(0,vC(a)-a.A)};xC=function(a){const b=a.Nd()&&!a.C?a.J:0;return 2===a.j.version?a.a.a-b:Math.max(0,vC(a)-b)};
|
|
43
|
+
mC=function(a,b){if(2===a.j.version)return a.a.Yb();const c=Math.max(a.l,0);return Infinity===a.A?Math.ceil(1E3*c)/1E3:Math.max(c,Math.min(vC(a)-a.A+b,xC(a)))};yC=function(a,b){var c=nC(a);if(b<c)return c;c=xC(a);2===a.j.version&&(c=a.a.a);return b>c?c:b};zC=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}};
|
|
44
|
+
AC=function(a,b,c){a.f=b;a.h=c};BC=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()};CC=function(a,b=!1){return Array.from(a.a.values()).map(c=>zC(c,b)).sort((c,d)=>c.startTime-d.startTime)};
|
|
45
|
+
DC=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(_.zf,{id:d}));a.h=b;"basic"===a.o.timeline&&(a.j.a=b)};EC=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};_.cC=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)};
|
|
46
|
+
GC=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 FC(a,c,e)};HC=function(a,b){a.f=b};
|
|
47
|
+
IC=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};
|
|
48
|
+
JC=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=iB(new _.Au(d),c,a.h.gapDetectionThreshold);if(null==f){if(a.f){a=a.f;d=a.h;c=IC(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>=xC(a.G))){var h=g-c;b=h<=b;var k=
|
|
49
|
+
!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(AA,h,"seconds because of gap before start time of",g):_.qh(AA,h,"seconds because of gap starting at",d.end(f-1),"and ending at",g),a.B=!0,a.a.currentTime=g)}}}}};KC=function(a,b){a.h=a.f.currentTime;a.l=b;a.j=a.o;a.f.currentTime=b;a.a.Hb(.1)};
|
|
50
|
+
MC=function(a,b){a.w||(a.w=!0,a.o&&a.o());.001>Math.abs(a.a.currentTime-b)?LC(a):(a.f.one(a.a,_.Df,()=>{LC(a)}),KC(a.h,0===a.a.currentTime?b:a.a.currentTime))};NC=function(a,b){a.A=b;a.f.off(a.a,_.le);a.f.one(a.a,_.le,()=>{MC(a,b)})};OC=function(a,b){0<a.a.readyState?KC(a.h,b):NC(a,b)};LC=function(a){_.Th()&&79===_.Xh().major&&!a.l&&a.j();a.l=!0;a.f.on(a.a,_.Df,()=>a.j())};
|
|
51
|
+
RC=function(a,b,c){if(!c.stallEnabled)return null;const d=c.gapDetectionThreshold;let e=c.stallSkip;c=new PC(new QC(b),c.stallThreshold);HC(c,(f,g)=>{a.g.warn(`Stall detected at ${f} for ${g} seconds.`);if(e){g=new _.Au(b.buffered);var h;if(h=_.Ph("Edge/")||_.Qh()||_.Th()&&79===_.Xh().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)&&
|
|
52
|
+
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};TC=function(a,b,c){null==b?b=Infinity>a.a.getDuration()||c?nC(a.a):xC(a.a):0>b&&(b=xC(a.a)+b);return SC(a,yC(a.a,b))};SC=function(a,b){const c=a.a.getDuration();return b>=c?c-a.l.durationBackoff:b};
|
|
53
|
+
UC=function(a,b){if("startover"===a.a.Gc())return b;var c=new _.Au(a.h.buffered);c=c.nc.bind(c);var d=Math.max(a.B,a.l.rebufferingGoal);const e=a.l.safeSeekOffset;let f=nC(a.a);const g=xC(a.a),h=a.a.getDuration();3>g-f&&(f=g-3);const k=mC(a.a,d),l=mC(a.a,e);d=mC(a.a,d+e);if(b>=h)return a.g.debug("Playhead past duration."),SC(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");
|
|
54
|
+
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};VC=function(a,b,c=0){for(const d of a.a)d.l(a.f.currentTime,b,c)};WC=function(a,b){const c=a.offset||0;return b<a.startTime+c?1:b>a.endTime+c?3:2};XC=function(a,b,c,d){a.a=b;a.f=c;a.h=d};_.YC=function(a){_.Nt[a]&&delete _.Nt[a]};_.ZC=function(a){_.Mt[a]&&delete _.Mt[a]};
|
|
55
|
+
$C=function(a,b,c){if(!(16E3>c)){var d=8E3*c/b;b/=1E3;a.a+=c;_.eC(a.f,b,d);_.eC(a.h,b,d)}};_.aD=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()})};bD=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};
|
|
56
|
+
fD=function(a,b){return _.v(function*(){b=b||a.h.contentSteeringServerUri;var c=cD(a,b);a.g.info("Sending request to content steering server, "+`URI: ${c}`);c=_.fk(c,a.A.attemptParameters);c.type=7;c=a.B.fetch(c);_.wk(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"],
|
|
57
|
+
10);d&&(a.g.info(`Will retry after ${d} s `+"based on Retry-After header."),a.f=d);dD(a,a.f)}else try{d=_.wi(c.data);const e=JSON.parse(d);1===e.VERSION?eD(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 _.Kh(()=>{fD(a)}),dD(a,a.f))}})};
|
|
58
|
+
gD=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=
|
|
59
|
+
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 fD(a);a.g.info(`defaultServiceLocations: ${b.defaultServiceLocation}`);fD(a)}})};iD=function(a,b){let c=a.j.get(b);c||(c={vd:0,Xf:new hD,Ge:!1},a.j.set(b,c));return c};
|
|
60
|
+
cD=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===_.lm&&(b.searchParams.set("_HLS_pathway",`"${c.toString()}"`),b.searchParams.set("_HLS_throughput",d.toString())):a.g.debug("addQueryParams_: serviceLocations EMPTY");return b.toString()};
|
|
61
|
+
dD=function(a,b){a.g.info(`Scheduling next steering manifest update in ${b} s.`);a.a.la(b)};eD=function(a,b,c){null!=a.a&&(a.a.stop(),a.a=null);const d=b["RELOAD-URI"]||c;a.a=new _.Kh(()=>{fD(a,d)});if(c=b.TTL)a.f=c;dD(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=jD(a,h,e,f);a.l.set(h,g)})};
|
|
62
|
+
jD=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[HA]&&(h[HA].HOST&&(a=new URL(a.uri),a.hostname=h[HA].HOST,k.uri=a.toString()),h[HA].PARAMS&&Object.entries(h[HA].PARAMS).forEach(l=>{var [m,n]=l;k.params[m]=n}));e.push(k)}}return e};
|
|
63
|
+
kD=function(a,b){var c=String(_.wu++);c=new _.nl(c,a);c.mimeType=_.kl(b.mimeType);if(a===_.L||a===_.M)c.label=_.kl(b.label),c.language=_.kl(b.language),c.originalLanguage=_.kl(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=_.kl(b.audioMimeType)):(c.kind=_.kl(b.kind),c.roles=b.roles);c.accessibility=a===_.N||a===_.M?(b.accessibility||[]).filter(d=>d.type===a):b.accessibility||[];return c};
|
|
64
|
+
lD=function(a,b,c){const d=new _.rl(a===_.N?`${b.ic}`:a===_.M?`${b.lc}`:`${b.id}`,c);switch(a){case _.N:d.codec=_.kl(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=_.kl(b.audioCodec);d.bandwidth=b.fe||b.bandwidth;d.originalId=b.jf;break;default:d.codec=_.kl(b.codecs),d.originalId=b.Jg}(a=c.renditions.find(e=>_.fh(e,d,null,["id","track"])))||c.renditions.push(d);return a||d};
|
|
65
|
+
mD=function(a,b){a=a.reduce((c,d)=>{b===_.N?null===d.ic||c[d.ic]&&!d.ee||(c[d.ic]=d):b===_.M&&(null===d.lc||c[d.lc]&&!d.de||(c[d.lc]=d));return c},{});return Object.values(a)};nD=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};
|
|
66
|
+
oD=function(a,b){if(a.a!==b)if(3===a.a&&0!==b)b=_.Ii(b,_.Si),a.g.info(_.DA+`${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(_.bf,{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,
|
|
67
|
+
reason:e}}))}};pD=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};_.qD=function(a,b){a.forEach(c=>{c.startTime+=b;c.endTime+=b})};rD=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}};sD=function(a){return Object.assign({},a,{periods:a.periods.map(b=>Object.assign({},b))})};
|
|
68
|
+
tD=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=rD(a[d-1]).end;_.qD(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=rD(c).end;_.lC(b.a,0,d);(a=a[0].presentationTimeline.Fc())&&_.oC(b,a.seekRangeStartDateTime);
|
|
69
|
+
return c};vD=function(a,b){try{if(1===a.length)return a[0];if(!a.every(uD))throw new _.wj("Period durations must be finite");return tD(a,b)}catch(c){throw new _.J(_.C,7,7003,"Failed to join manifests into a continuous playlist!",c);}};uD=function(a){return a.periods.every(b=>null!=b.endTime&&0<=b.endTime&&isFinite(b.endTime))};
|
|
70
|
+
wD=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};_.pC(a,b.presentationTimeline.o);return vD([d,b],a)};xD=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}};yD=function(a,b){return b.find(c=>c.id===a.id)||null};
|
|
71
|
+
zD=function(a,b){return a.h.filter(c=>c.type===b)};AD=function(a,b){return(a=a.a.get(b)||null)&&a.track};BD=function(a,b,c){if(!c||AD(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.Eb(c);break;case _.L:a.Fb(c);break;default:throw Error(`Unknown track type ${b}`);}};
|
|
72
|
+
FD=function(a,b,c){CD(a,b,_.N);if(DD(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.ic===parseInt(b.id,10));f=g.find(h=>h.lc===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.lc))||null}}else f=d.bd().find(g=>g.ic===parseInt(b.id,10))||null;f?(a.f.set(_.N,b),ED(d,f,c)):
|
|
73
|
+
a.g.warn("Cannot find matching variant")}};JD=function(a,b){_.v(function*(){CD(a,b,_.L);if(DD(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{GD(a,b),yield HD(a.m,!0),yield ID(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.`)}})};
|
|
74
|
+
KD=function(a){_.v(function*(){if(AD(a,_.L)){a.g.info("Unset text rendition.");try{yield HD(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)}}})};
|
|
75
|
+
OD=function(a){if(a.m){a.g.debug("Track list change detected, updating track list");var b=[];for(var c of Object.values(_.xu))a.a.set(c,null),a.f.set(c,null);for(var d of a.m.sa()){let e=kD(_.L,d);e=(c=b.find(g=>e.Xc(g)))||e;const f=lD(_.L,d,e);d.Le&&a.a.set(_.L,f);c||b.push(e)}LD(a.m)||a.a.set(_.L,null);d=a.m.bd();MD(a,b,d,_.N);MD(a,b,d,_.M);ND(a,b);a.h=b}};GD=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)};
|
|
76
|
+
DD=function(a,b,c){return a.m.va()?!0:(a.a.get(c)||null)===b?!1:!0};CD=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");};MD=function(a,b,c,d){c=mD(c,d);for(const e of c){let f=kD(d,e);f=(c=b.find(h=>f.Xc(h)))||f;const g=lD(d,e,f);(d===_.N&&e.ee||d===_.M&&e.de)&&a.a.set(d,g);c||b.push(f)}};
|
|
77
|
+
ND=function(a,b){var c=a.m;if(c.f){var d=(d=PD(c))?QD(c.l,d).kb: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(_.wu++),c=new _.nl(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 _.rl(`${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])};
|
|
78
|
+
RD=function(a,b,c){return zD(a,c).flatMap(d=>d.renditions).find(d=>parseInt(d.id,10)===b)||null};SD=function(a,b,c,d){a.h.length||OD(a);const e=a.a.get(c)||null;(b=RD(a,b,c))&&e!==b&&(GD(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}})))};TD=function(a){const b=_.Kl(a.mimeType,a.codecs),c=FB(a);return _.hC(b)||_.Rs(c)||(_.Jl(b,a.type)?!0:!1)};
|
|
79
|
+
VD=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=UD(c);a.j.src=a.A;return c}c=new MediaSource;a.A=UD(c);a.l.one(c,"sourceopen",()=>{URL.revokeObjectURL(a.A);b.resolve()});a.j.src=a.A;return c};
|
|
80
|
+
XD=function(a,b){a.f||(a.f=new WD(a.I,a.C));a=a.f;if(b!==_.sc){var c=_.Bt[b];if(!c)throw new _.J(_.C,2,2012,"Text parser is unavailable for "+b);a.w=new c(a.C)}};ZD=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 YD(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}}})};$D=function(a){a.g.debug("Reset transmuxers.");Object.values(a.w).forEach(b=>b.reset())};
|
|
81
|
+
YD=function(a,b,c){return _.v(function*(){yield aE(a,b,()=>{c.remove(0,Infinity)})})};aE=function(a,b,c){if(a.K)return Promise.reject();c={start:c,p:new _.xk};a.h[b].push(c);1===a.h[b].length&&bE(a,b);return c.p};cE=function(a){return a.I.streaming.ignoreManagedMediaSourceStreamingHints?!0:a.R};dE=function(a){return a.o?a.o.readyState===_.Rd:!0};eE=function(a,b){try{return new _.Au(a.a[b].buffered,b)}catch(c){return b in a.a&&a.g.error("failed to get buffered range for "+b,c),null}};
|
|
82
|
+
fE=function(a){const b={};b.total=new _.Au(a.j.buffered,"total");b.audio=eE(a,_.q);b.video=eE(a,_.t);let c=[];a.f&&(c=[{start:a.f.Wb(),end:a.f.Qa()}]);b.text=NB(c,_.I);return b};gE=function(a,b){return a.a[b]?(a=eE(a,b))?a.toString():"":""};
|
|
83
|
+
hE=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=iC(a.f,c,d,e):a.w[b]?(c=a.w[b].transmux(c),c.captions&&0<c.captions.length&&(a.f||XD(a,_.Tf),kC(a.f,c.captions,d,e,a.a.video.timestampOffset)),f=[],0<c.audio.byteLength&&a.a.audio&&!k&&f.push(aE(a,_.q,a.L.bind(a,_.q,c.audio.buffer))),0<c.video.byteLength&&a.a.video&&f.push(aE(a,_.t,a.L.bind(a,_.t,
|
|
84
|
+
c.video.buffer))),k=Promise.all(f)):(f&&window.muxjs&&(a.f||XD(a,_.Tf),null==d&&null==e?a.H.init(c):a.H.h(c,p=>{p.length&&kC(a.f,p,d,e,a.a.video.timestampOffset)})),k=aE(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:",gE(a,b));else if(b===_.q&&null!==d&&null!==e)XB(a.F),null!==d&&null!==e&&a.g.debug("Appended audio segment ",d,e,"Buffer:",gE(a,b));else if(b===_.t&&null!==d&&null!==e&&
|
|
85
|
+
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=aE(a,b,()=>{a.W(b,x)}),u=aE(a,b,a.S.bind(a,b,!1)),Promise.all([p,u])}null!==
|
|
86
|
+
d&&null!==e&&(a.G[b]=!0)}).catch(p=>{throw p;})};iE=function(a,b){const c=a.Qa(_.t)||0;jC(a.f,b,c)};jE=function(a){a.f&&jC(a.f,"",0)};kE=function(a,b,c,d){return _.v(function*(){if(b!==_.I&&TB()&&a.I.mediaSource.codecSwitchingStrategy===_.If){var e=_.Kl(c,d);IB(a.J[b],e)||(yield aE(a,b,()=>{a.g.info(`Change MIME type of ${b} to ${e}`);a.a[b].changeType(e);a.J[b]=e;a.B(b)}))}})};lE=function(a,b,c,d,e){return[aE(a,b,a.Z.bind(a,b)),aE(a,b,a.W.bind(a,b,c)),aE(a,b,a.ja.bind(a,b,d,e))]};
|
|
87
|
+
mE=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 kE(a,b,f,g),h=lE(a,b,c,d,e),a.P&&(h=h.concat(lE(a,_.q,c,d,e))),yield Promise.all(h)})};
|
|
88
|
+
oE=function(a,b){return _.v(function*(){if(a.K)return Promise.reject();const c=[];for(const d in a.a){const e=new _.xk,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)nE(a,d)}})};
|
|
89
|
+
pE=function(a,b){oE(a,()=>{a.o.duration=b})};nE=function(a,b){a.h[b].shift();bE(a,b)};bE=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})),nE(a,b)}else a.g.debug("No more scheduled operations for "+b)};
|
|
90
|
+
vE=function(a,b,c,d){const e=a.periods.flatMap(k=>k.variants);var f=e;if(b.length||c.length)f=qE(f,b,c);f=rE(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&&
|
|
91
|
+
null===m.audio?!1:l.has(k(m.audio.codecs)))}f=sE(f);const h=tE(f);for(const k of a.periods)k.variants=k.variants.filter(l=>{if(uE(l)===h)return!0;_.rh("Dropping Variant (better codec available)",l);return!1})};
|
|
92
|
+
qE=function(a,b,c){if(!b.length&&!c.length)return a;const d=a.filter(g=>(g=g.audio)&&c.length&&(g=_.HB(g.codecs),c.includes(g))?!0:!1),e=a.filter(g=>(g=g.video)&&b.length&&(g=_.HB(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};
|
|
93
|
+
rE=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))};sE=function(a){const b=new _.St;for(const c of a)a=uE(c),b.push(a,c);return b};
|
|
94
|
+
tE=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};uE=function(a){let b="";a.video&&(b=_.HB(a.video.codecs));let c="";a.audio&&(c=_.HB(a.audio.codecs));return b+"-"+c};wE=function(a,b,c,d){let e=a.periods.flatMap(f=>f.variants);if(b.length||c.length)e=qE(e,b,c);e=rE(e,d);for(const f of a.periods)f.variants=f.variants.filter(g=>e.includes(g))};
|
|
95
|
+
xE=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};yE=function(a,b){let c=!1;for(const d of a)a=d.allowedByApplication,d.allowedByApplication=xE(d,b),a!==d.allowedByApplication&&(c=!0);return c};
|
|
96
|
+
BE=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&&!pB(a,g))return _.rh("Dropping variant - not compatible with key system",g),!1;let h=g.audio;const k=g.video;if(h&&!TD(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"),TD(h)?_.qh("Using AC-3 instead of EC-3 for",zE(h)):(h.codecs=l,_.qh(FA,zE(h)),g.audio=null,f=!0,h=null)):(_.qh(FA,zE(h)),g.audio=null,f=!0,h=null)}return k&&!TD(k)?(_.qh("Dropping variant - video not compatible with platform",
|
|
97
|
+
zE(k)),!1):h&&b&&!AE(h,b,e)?(_.qh("Dropping variant - not compatible with active audio","active audio",zE(b),"variant.audio",zE(h)),!1):k&&c&&!AE(k,c,e)?(_.qh("Dropping variant - not compatible with active video","active video",zE(c),"variant.video",zE(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",
|
|
98
|
+
zE(k.video)),!1):!0))}d.textStreams=d.textStreams.filter(g=>{const h=_.hC(_.Kl(g.mimeType,g.codecs));h||_.rh("Dropping text stream. Is not supported by the platform.",g);return h})};
|
|
99
|
+
zE=function(a){const b=FB(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"};
|
|
100
|
+
AE=function(a,b,c){return a.mimeType!==b.mimeType||(void 0===c||c)&&a.codecs.split(".")[0]!==b.codecs.split(".")[0]?!1:!0};
|
|
101
|
+
CE=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,
|
|
102
|
+
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),ic:null,lc:null,channelsCount:null,spatialAudio:!1,fe:null,Ie:null,kf:null,jf:null,Jg:null,accessibility:n};c&&(a.ic=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.lc=b.id,a.jf=b.originalId,a.originalLanguage=b.originalLanguage,
|
|
103
103
|
a.channelsCount=b.channelsCount,a.fe=b.bandwidth||null,a.label=b.label,a.Ne=b.roles);return a};
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
_.
|
|
107
|
-
[]);return b.length?
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
a;if(0===g.length||!c)throw _.sh("Failed to find boxes needed to fake encryption!"),_.sh("Failed init segment (hex):",_.
|
|
117
|
-
|
|
118
|
-
d=a.getUint32(b);a.setUint32(b,d+1);return h};
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
a.g.debug("(all) finished setting up stream "+e.id))})};
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
g=a.B.get(f),g=!(!g||!g.uf))if(g=a.o.get(b.id),(g=!(!g||!g.uf))||(yield
|
|
127
|
-
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.
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
e,
|
|
138
|
-
else if(f
|
|
139
|
-
|
|
140
|
-
(d.catch(()=>{}),d.reject(),a.B.delete(b),a.g.warn(`(all) failed to setup Period ${b}`),a.D.onError(f))});return d};
|
|
141
|
-
|
|
142
|
-
h&&!b.le)return
|
|
143
|
-
for(const l of a.a.values())if(l.type!==_.I||l.stream.mimeType!==_.sc)g=
|
|
144
|
-
|
|
145
|
-
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)
|
|
146
|
-
"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)}})};
|
|
147
|
-
|
|
148
|
-
!a.w){if(!a.j.presentationTimeline.isLive()&&b.type!==_.I){var p=
|
|
149
|
-
a.D.ze();k&&(p=k.next().value)&&a.g.debug("New iterated segment",p);
|
|
150
|
-
a.a.delete(_.I);else if(7001===p.code)b.
|
|
151
|
-
(a.g.error(f,"failed fetch and append: code\x3d"+p.code),b.dd=!0,p instanceof _.J&&p.a(_.C),yield
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
h])}})};
|
|
156
|
-
|
|
157
|
-
l=
|
|
158
|
-
`KeyID: ${e.keyId} `+`Width: ${e.width} Height: ${e.height} `+`Bitrate: ${_.
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
h+" seconds"))}}})};
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
b.id),Error("Unable to switch to restricted track.");a.ca=f.video.id;var g=yield e.parser.loadVariant(f,e.id);
|
|
171
|
-
|
|
172
|
-
g=!0;const k=a.getTrackManager().
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
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&&!
|
|
182
|
-
F===k&&u!==p.allowedByKeySystem&&(l=!0)}}}if(h=
|
|
183
|
-
_.
|
|
184
|
-
|
|
185
|
-
a.h.init((f,g,h)=>_.v(function*(){if(
|
|
186
|
-
new
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
break a}d=!0}!d&&a.trigger(new _.H(_.Bf));
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
(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.
|
|
195
|
-
|
|
196
|
-
yield
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
emsgSchemeIdUris:null,roles:g.roles,channelsCount:null,spatialAudio:!1,closedCaptions:null};e.set(h,k)}}for(const f of e.values())d.textStreams.push(f)}};
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
!d?(a.log.debug("Buffering state changed. Is buffering",d,"buffered to end",b,"state",a.getState()),
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
b,()=>
|
|
228
|
-
|
|
229
|
-
_.
|
|
230
|
-
a.configuration.streaming.attemptParameters));yield Promise.all(h);
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
_.
|
|
235
|
-
|
|
236
|
-
_.
|
|
237
|
-
_.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.
|
|
238
|
-
_.
|
|
239
|
-
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(
|
|
104
|
+
DE=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,ic:null,lc:null,channelsCount:null,spatialAudio:!1,fe:null,Ie:null,kf:null,jf:null,Jg:a.originalId,accessibility:a.accessibility,keyId:null}};
|
|
105
|
+
EE=function(a){return a.allowedByApplication&&a.allowedByKeySystem};
|
|
106
|
+
_.GE=function(a,b,c,d){b=_.lj(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=_.Xj(_.Uj(h),a.map(l=>l.language));return k?(e=a.filter(l=>_.Uj(l.language)===k),!0):!1});d&&e.some(h=>h.kind===_.Ud)&&(e=e.filter(h=>h.kind===_.Ud));if(c){b=FE(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(_.vB,
|
|
107
|
+
[]);return b.length?FE(e,b[0]):e};FE=function(a,b){return a.filter(c=>c.roles.includes(b))};HE=function(a,b,c){if(a.A&&a.a.useCmsd){const d=sB(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=>xE(d,b)));return a.sort((d,e)=>d.bandwidth-e.bandwidth)};
|
|
108
|
+
IE=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(()=>IE(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;JE(a,k,h,0<=g?8E3*g/k:Infinity)&&KE(a,h)?($C(a.w,e,f),c.stop(),b.abort(),LE(a,k)):c.Gf=setTimeout(()=>IE(a,b,c,d),500)}}};JE=function(a,b,c,d){return 0===b||Infinity===d||300>d?!1:b<c/(a.a.bandwidthDowngradeTarget||1)};
|
|
109
|
+
KE=function(a,b){return HE(a,a.a.restrictions||null,a.f).filter(c=>c.bandwidth<b).pop()||null};LE=function(a,b){b=KE(a,b)||a.f[0];a.h=Date.now();a.o(b)};ME=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.")};NE=function(a,b){if(b&&(null==a.a||a.a!==b))throw ME(a);};QD=function(a,b){a.a.has(b)||a.a.set(b,new OE);return a.a.get(b)};PE=function(a,b,c){QD(a,b).text=c};
|
|
110
|
+
SE=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||QE(d,e))&&RE(d.roles,e.roles))}!d&&(d=a.video&&b.video)&&(a=a.video,b=b.video,d=!((!c||QE(a,b))&&RE(a.roles,b.roles)));return d?!1:!0};
|
|
111
|
+
QE=function(a,b){if(a.mimeType!==b.mimeType)return!1;a=GB(a.codecs).map(c=>_.HB(c));b=GB(b.codecs).map(c=>_.HB(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};RE=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};TE=function(a,b){let c=null;b.some(d=>{c=_.Xj(_.Uj(d),a.map(e=>zB(e)));return!!c});return c?a.filter(d=>c===zB(d)):[]};
|
|
112
|
+
UE=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)})};VE=function(a,b){return a.filter(c=>c.audio&&c.audio.spatialAudio!==b?!1:!0)};
|
|
113
|
+
WE=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};XE=function(a,b){a.f=b};YE=function(a,b){a.j=b;a.j.speedUpMode&&(a.A=a.j.speedUpMode)};
|
|
114
|
+
aF=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{ZE(a,c)}catch(d){a.g.warn('Set playbackRate using "decoder" mode fails, due to unsupported range by platform. Fallback to "seek" mode.',d),$E(a)}else $E(a)};ZE=function(a,b){if(a.f.mc()!==b){a.g.debug(GA,b,' using native playbackRate "decoder" mode.');try{a.f.qd(b)}catch(c){throw c;}}};$E=function(a){a.g.debug(GA,a.h,' using "seek" mode.');ZE(a,0);a.o=!0;a.a.Hb(.25)};
|
|
115
|
+
cF=function(a){a=_.E(a);let b=!1,c;const d=[],e=h=>{d.push(h);_.Pm(h)},f=()=>{b=!0},g=[];(new _.Wm).N(_.ue,e).N(_.bg,e).N(_.pe,e).N(_.te,e).N(_.Nf,e).fa(_.Pf,h=>{c=h;d.push(h);_.Qm(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."),
|
|
116
|
+
a;if(0===g.length||!c)throw _.sh("Failed to find boxes needed to fake encryption!"),_.sh("Failed init segment (hex):",_.Rk(a)),new _.J(_.C,3,14E3);g.reverse();for(const h of g)_.qh(`Inserting "${_.Om(h.nd)}" box into init segment.`),a=bF(a,c,h.N,d,h.nd);return a};
|
|
117
|
+
bF=function(a,b,c,d,e){{var f=dF.value(),g=a.subarray(c.start,c.start+c.size);const k=_.ti(g);var h=new Uint8Array(c.size+f.byteLength);h.set(g,0);g=_.ti(h);g.setUint32(4,e);h.set(f,c.size);e=k.getUint32(4);g.setUint32(c.size+16,e);eF(h,0,h.byteLength);e=h}h=new Uint8Array(a.byteLength+e.byteLength);c=_.Ph("Xbox One")||_.Oh()?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)eF(h,k.start,k.size+e.byteLength);a=_.ti(h,b.start);b=_.Sm(b);
|
|
118
|
+
d=a.getUint32(b);a.setUint32(b,d+1);return h};eF=function(a,b,c){a=_.ti(a,b);b=a.getUint32(0);0!==b&&(1===b?(a.setUint32(8,c>>32),a.setUint32(12,c&4294967295)):a.setUint32(0,c))};fF=function(a){return"("+a.type+":"+a.stream.id+")"};gF=function(a){return!a.Db&&null==a.sb&&!a.jc&&!a.yc};hF=function(a){a.periods.every(b=>typeof b.id===_.Of)};iF=function(a){null!=a.sb&&(a.sb.stop(),a.sb=null)};jF=function(a){return _.v(function*(){a.Sb&&(yield a.Sb.abort())})};
|
|
119
|
+
qF=function(a,b,c){return _.v(function*(){var d=a.D.xb();const e=kF(a,d);null==e?a.g.warn("Cannot initialize streams, period not found at",d):(d=lF(b),yield a.D.$.init(d,a.h.forceNativeTS,a.h.disableAudioTracks),a.f||(mF(a),yield nF(a,new Set(d.values())),a.f||d.forEach((f,g)=>{a.a.has(g)||(f=oF(f,e,c),a.a.set(g,f),pF(a,f,0))})))})};rF=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};
|
|
120
|
+
sF=function(a){var b=a.a.get(_.t);return b?rF(a,b.dc):(b=a.a.get(_.q))?rF(a,b.dc):null};_.tF=function(a,b){return(a=a.a.get(b))?a.rc||a.stream:null};uF=function(a){return _.tF(a,_.q)};vF=function(a){return _.tF(a,_.t)};
|
|
121
|
+
nF=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 _.xk),c.push(f.createSegmentIndex(a.D.Cb,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(),
|
|
122
|
+
a.g.debug("(all) finished setting up stream "+e.id))})};kF=function(a,b){return(a=$B(a.j.periods,b+_.nu))?a.id:null};oF=function(a,b,c){return{stream:a,type:a.type,ac:null,segmentIterator:null,oa:null,rc:null,ve:!0,dc:b,endOfStream:!1,Db:!1,sb:null,jc:!1,ie:0,Je:!1,yc:!1,rf:!1,dd:!1,Ug:c||0,Sb:null,le:!1,Ag:0}};pF=function(a,b,c){a.g.debug(fF(b),"updating in "+c+" seconds");b.sb=(new _.Vt(()=>_.v(function*(){try{yield a.ec(b)}catch(d){if(a.D)a.D.onError(d)}}))).la(c)};
|
|
123
|
+
wF=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 nF(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=kF(a,c),null==d?a.g.warn("Cannot set up text media state, period not found at",c):(c=oF(b,d,0),a.a.set(_.I,c),pF(a,c,0)))))})};
|
|
124
|
+
xF=function(a){a.J=!0;const b=a.a.get(_.I);b&&(a.g.info("Unload text stream"),iF(b),jF(b).catch(()=>{}),a.a.delete(_.I))};yF=function(a){return _.v(function*(){const b=a.a.get(_.q);b&&(a.g.info("Unload audio stream"),iF(b),yield jF(b).catch(()=>{}),a.a.delete(_.q))})};
|
|
125
|
+
EF=function(a,b,c,d){return _.v(function*(){const e=a.a.get(b.type);if(!e&&b.type===_.I&&a.h.ignoreTextStreamFailures)yield wF(a,b);else if(e){var f=zF(a,b).id;if(c&&f!==e.dc){a.g.debug("switch: switching to stream in another Period; clearing buffer and changing Periods");for(var g of a.a.values())AF(a,g)}else if(e.rc&&(a.g.debug("switch during trick play mode",b),b.trickModeVideo?(e.rc=b,b=b.trickModeVideo,a.g.debug("switch found trick play stream",b)):(e.rc=null,a.g.debug("switch found no special trick play stream"))),
|
|
126
|
+
g=a.B.get(f),g=!(!g||!g.uf))if(g=a.o.get(b.id),(g=!(!g||!g.uf))||(yield nF(a,new Set([b]))),e.stream!==b){g=a.j.presentationTimeline.getDuration();var h=a.D.xb();h=BF(a,e,h);if(!c&&(e.endOfStream||h>=g))a.g.debug(gB+fF(e)+" already buffered to the end. Not switching.");else{b.type===_.I&&XD(a.D.$,_.Kl(b.mimeType,b.codecs));e.stream=b;e.stream.segmentIterator=null;e.ve=!0;a.g.debug("switch: switching to Stream "+fF(e));if(e.Sb)if(g=a.D.xb(),h=a.D.$.Qa(e.type),f=(f=CF(a,e,g,h,f))?f.Gd():null,null==
|
|
127
|
+
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.Sb,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.Sb.abort());if(c)if(e.yc)e.Je=!0;else if(e.Db)e.jc=!0,e.ie=d,e.Je=!0;else{iF(e);try{yield DF(a,e,!0,d)}catch(l){if(a.D)a.D.onError(l)}}}}else a.g.debug(gB+fF(e)+" already active")}})};
|
|
128
|
+
FF=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.rc&&(a.g.debug("Switching to trick mode",e),yield EF(a,e,!1,0),c.rc=d)}else if(d=c.rc)a.g.debug("Switching back from trick mode",d),c.rc=null,yield EF(a,d,!0,0)}})};GF=function(a,b,c,d){return _.v(function*(){b.video&&(yield EF(a,b.video,c,d));b.audio&&(yield EF(a,b.audio,c,d))})};
|
|
129
|
+
AF=function(a,b){return _.v(function*(){const c=fF(b);if(b.yc)a.g.debug(c,"clear: already clearing the buffer");else if(b.jc)a.g.debug(c,"clear: already waiting");else if(b.Db)a.g.debug(c,"clear: currently updating"),b.jc=!0,b.ie=0;else if(null==a.D.$.Wb(b.type))a.g.debug(c,"clear: nothing buffered"),null==b.sb&&pF(a,b,0);else{a.g.debug(c,"clear: handling right now");iF(b);try{yield DF(a,b,!1,0)}catch(d){if(a.D)a.D.onError(d)}}})};
|
|
130
|
+
HF=function(a){return _.v(function*(){if(!a.A){a.A=!0;yield yF(a);var b=a.a.get(_.t);yield AF(a,b)}})};IF=function(a,b,c,d){return _.v(function*(){yield EF(a,b,c,d)})};JF=function(a,b){return _.v(function*(){if(a.A){a.A=!1;const c=a.D.xb();yield qF(a,{audio:b},c)}yield EF(a,b,!0,0)})};_.KF=function(a,b){return _.v(function*(){yield EF(a,b,!0,0)})};mF=function(a){const b=a.j.presentationTimeline.getDuration();Infinity>b?pE(a.D.$,b):pE(a.D.$,Math.pow(2,32))};
|
|
131
|
+
LF=function(a){for(const b of a.a.values()){a=b.oa;const c=b.ac;a&&c&&(a=c.getSegmentReference(a.position))&&(b.oa=a)}};MF=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;hF(a.j);mF(a);LF(a)};
|
|
132
|
+
NF=function(a){const b=a.D.xb();let c=!1;const d=kF(a,b);if(Array.from(a.a.values()).every(f=>f.dc===d))for(const f of a.a.keys()){var e=a.a.get(f);e.stream.segmentIterator=null;a.D.$.nc(f,b,0)||(AF(a,e),c=!0)}else if(!Array.from(a.a.keys()).every(f=>a.D.$.nc(f,b,0))){a.g.debug("(all): seeked: unbuffered seek: clearing all buffers");for(e of a.a.values())AF(a,e);c=!0}c||a.g.debug("(all): seeked: buffered seek: presentationTime\x3d"+b)};
|
|
133
|
+
UF=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=fF(c);if(c.dd||b&&gF(c))a.g.info(d,"Retrying after failure..."),c.dd=!1,pF(a,c,.1)}};VF=function(a){return Array.from(a.a.values()).some(b=>null!==b.sb)};WF=function(a){const b=Array.from(a.a.values());return a.C&&b.every(c=>c.endOfStream)};
|
|
134
|
+
DF=function(a,b,c,d){return _.v(function*(){const e=fF(b);b.jc=!1;b.Je=!1;b.ie=0;b.yc=!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.ac=null,b.oa=null,b.yc=!1,b.endOfStream=!1,b.le=!1,pF(a,b,0))})};
|
|
135
|
+
XF=function(a){return _.v(function*(){const b=[];for(const c of a.a.values())iF(c),c.Db&&c.Sb&&(c.Db=!1,b.push(c.Sb.abort())),c.jc&&b.push(DF(a,c,!0,0));yield Promise.all(b)})};YF=function(a,b,c){(a=a.a.get(b))&&c&&(iF(a),a.stream=c,a.ac=c,a.oa&&(a.oa=c.getSegmentReference(a.oa.position)),a.oa||(a.ac=null))};BF=function(a,b,c){return b.ac&&b.oa?zF(a,b.ac).startTime+b.oa.endTime:Math.max(c,b.Ug)};ZF=function(a){a.F=!0;a.g.debug("calling onCanSwitch()...");a.D.Eg()};
|
|
136
|
+
CF=function(a,b,c,d,e){if(null==e)return a.g.warn(xA),null;if(b.stream.segmentLookupStrategy===_.VA)b.stream.segmentIterator?a=EC(b.stream.segmentIterator):b.oa||d?(c=b.oa?b.oa.endTime:d,a.g.info(zA,"looking up segment from new stream endTime:",c),b.stream.segmentIterator=GC(b.stream.segmentIndex,c),e=b.stream.segmentIterator.next().value,null===e&&(b.stream.segmentIterator=null,a.g.warn(zA,MA,"endTime:",c,b.oa)),a=e):(e=rF(a,e),e=Math.max(0,c-e.startTime),a.g.info(zA,"looking up segment","lookupTime:",
|
|
137
|
+
e,ZA,c),b.stream.segmentIterator=GC(b.stream.segmentIndex,e),b=b.stream.segmentIterator.next().value,null===b&&a.g.warn(zA,MA,"lookupTime:",e,ZA,c),a=b);else{var f=fF(b);if(b.oa&&b.stream===b.ac)c=b.oa.position+1,a.g.debug(f,"next position known:","position\x3d"+c),a=$F(a,b,e,c);else{if(b.oa){a.g.debug(f,"next position unknown: another Stream buffered");f=zF(a,b.ac);var g=aG(a,b,f.startTime+b.oa.endTime,e)}else a.g.debug(f,"next position unknown: nothing buffered"),g=aG(a,b,d||c,e);if(null==g)a=null;
|
|
138
|
+
else if(f=$F(a,b,e,g),null==f)a=null;else{var h=null==a.h?!1:a.h.ignoreDrift;null==d&&!h&&f.Na+f.startTime+2>c&&(a=$F(a,b,e,Math.max(0,g-1)))&&(f=a);a=f}}}return a};lF=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};
|
|
139
|
+
bG=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 _.xk;a.B.set(b,d);c=rF(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 nF(a,e)}).then(()=>{a.f||(d.resolve(),a.g.debug(`(all) setup Period ${b}`))}).catch(f=>{a.f||
|
|
140
|
+
(d.catch(()=>{}),d.reject(),a.B.delete(b),a.g.warn(`(all) failed to setup Period ${b}`),a.D.onError(f))});return d};cG=function(a){a.g.debug("(all) setupAllPeriods_");a.j.periods.map(b=>b.id).forEach(b=>{bG(a,b).catch(wB)})};
|
|
141
|
+
fG=function(a,b){if(b.type===_.I&&b.stream.mimeType===_.sc)return iE(a.D.$,b.stream.originalId||""),null;b.type===_.I&&jE(a.D.$);if(!cE(a.D.$)&&b.type!==_.I)return a.h.bufferLimitUpdateInterval?a.h.bufferLimitUpdateInterval/2:.5;var c=fF(b);const d=a.D.xb(),e=BF(a,b,d);a.g.debug(c,"timeNeeded\x3d"+e);var f=a.D.$.Ra(b.type,d);a.g.debug(c,"update_:",$A+d,"bufferedAhead\x3d"+f);var g=Math.max(a.j.minBufferTime||0,a.h.rebufferingGoal,a.h.bufferingGoal)*a.l,h=qC(a.j.presentationTimeline);if(null!=h&&e>=
|
|
142
|
+
h&&!b.le)return dG(a,b),null;b.endOfStream=!1;h=zF(a,b.stream).id;const k=kF(a,e);null!=k&&(b.dc=k);if(k!==h)return a.g.debug(c,"need Period "+k,$A+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.$.Qa(b.type);f=CF(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."),dG(a,b),null);c=Infinity;
|
|
143
|
+
for(const l of a.a.values())if(l.type!==_.I||l.stream.mimeType!==_.sc)g=BF(a,l,d),c=Math.min(c,g);if(e>=c+a.j.presentationTimeline.h)return a.h.bufferLimitUpdateInterval||1;b.Ug=0;eG(a,b,d,h,f).catch(()=>{});return null};gG=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)}})};
|
|
144
|
+
hG=function(a,b){_.v(function*(){const c=fF(b);var d=zF(a,b.stream).id;if(b.dc!==d){var e=b.dc;d=Array.from(a.a.values());if(d.every(l=>l.dc===e))if(d.every(gF)){a.g.debug(c,"all need Period "+e);try{if(yield bG(a,e),!a.f)if($D(a.D.$),d.every(l=>{const m=gF(l),n=zF(a,l.stream).id;return m&&l.dc===e&&n!==e})){var f=rF(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=lF(g);for(const l of a.a.keys())if(!h.has(l)&&
|
|
145
|
+
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)qF(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 EF(a,m,!1,0),pF(a,a.a.get(l),0)):a.a.delete(l)}));yield Promise.all(k);a.f||ZF(a)}else a.g.debug(c,
|
|
146
|
+
"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)}})};dG=function(a,b){a.g.debug(fF(b),"buffered to end of presentation");b.endOfStream=!0;b.type===_.t&&(a=a.a.get(_.I))&&a.stream.mimeType===_.sc&&(a.endOfStream=!0)};
|
|
147
|
+
eG=function(a,b,c,d,e){return _.v(function*(){const f=fF(b),g=rF(a,d);a.g.debug(f,"fetchAndAppend_:",$A+c,RA+g.startTime,bB+e.position,cB+e.startTime,aB+e.endTime);const h=b.stream,k=b.stream.segmentIterator;var l=a.j.presentationTimeline.getDuration();const m=iG(a,d);l=jG(a,b,g,Math.max(0,g.startTime-.1),m?m.startTime+.01:l,e);b.Db=!0;b.ve=!1;a.g.debug(f,"fetching segment");const n=a.D.$.Qa(b.type)||0;l.then(()=>a.f||a.w?null:kG(a,b,e,(p,u)=>a.f||a.w?null:lG(a,b,c,g,h,e,p,u))).then(()=>{if(!a.f&&
|
|
148
|
+
!a.w){if(!a.j.presentationTimeline.isLive()&&b.type!==_.I){var p=fF(b),u=(a.D.$.Qa(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=bC(p,h);x=p[u];const B=h.getDuration();dC(x,B);for(u+=1;u<p.length;u++)p[u].startTime+=y}}}b.Db=!1;b.rf=!1;b.jc||
|
|
149
|
+
a.D.ze();k&&(p=k.next().value)&&a.g.debug("New iterated segment",p);pF(a,b,0);a.C?p=!1:(a.C=mG(a),p=a.C);p&&(a.g.debug("startup complete"),p=zF(a,h).id,nG(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.Db=!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."),
|
|
150
|
+
a.a.delete(_.I);else if(7001===p.code)b.Db=!1,b.sb=null,pF(a,b,0);else if(3017===p.code)oG(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",bB+e.position,cB+e.startTime,aB+e.endTime,"error\x3d"+p),b.Db=!1,b.sb=null,pF(a,b,1);else if(b.type===_.I){if(p instanceof _.J)if(iF(b),uB(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 uB(p.code)?yield pG(a,b,g,p):
|
|
151
|
+
(a.g.error(f,"failed fetch and append: code\x3d"+p.code),b.dd=!0,p instanceof _.J&&p.a(_.C),yield gG(a,p))}))})};zF=function(a,b){a=a.j.periods;const c=bC(a,b);a=a[c];if(!a)throw new _.J(_.C,5,5006,`No period found for stream with ID ${b.id}.`);return a};
|
|
152
|
+
$F=function(a,b,c,d){const e=fF(b);if(null==c)return a.g.warn(e,xA),null;c=rF(a,c);const f=b.stream.getSegmentReference(d);if(!f)return a.g.debug(e,"segment does not exist:",RA+c.startTime,"position\x3d"+d),null;var g=a.j.presentationTimeline;d=_.wC(g);g=vC(g);return!b.le&&(c.startTime+f.endTime<d||c.startTime+f.startTime>g)?(a.g.debug(e,"segment is not available:",RA+c.startTime,cB+f.startTime,aB+f.endTime,"availabilityStart\x3d"+d,"availabilityEnd\x3d"+g),null):f};
|
|
153
|
+
aG=function(a,b,c,d){const e=fF(b);d=rF(a,d);const f=Math.max(0,c-d.startTime);b=b.stream.findSegmentPosition(f);a.g.debug(e,"Looked up segment:",$A+c,"lookupTime\x3d"+f,RA+d.startTime,"Result: segment position\x3d"+b);null==b&&a.g.warn(e,"cannot find segment:",RA+d.startTime,"lookupTime\x3d"+f);return b};iG=function(a,b){const c=a.j.periods.findIndex(d=>d.id===b);return 0>c?null:a.j.periods[c+1]||null};
|
|
154
|
+
jG=function(a,b,c,d,e,f){return _.v(function*(){var g=c.startTime-f.Na,h=b.ve||f.initSegment!==(b.oa&&b.oa.initSegment);if(h||g!==b.Ag){b.Ag=g;var k=fF(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=mE(a.D.$,b.type,g,d,e,b.stream.mimeType,b.stream.codecs);if(!b.stream.initSegmentReference||!h)return g;a.g.debug(k,TA);h=qG(a,b,f&&f.initSegment||b.stream.initSegmentReference,k);return Promise.all([g,
|
|
155
|
+
h])}})};kG=function(a,b,c,d){return _.v(function*(){var e=rG(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=sG(a,b,c,!1);f=tG(a,e,b,c,f);e=a.D.Dd();var h=b.Sb;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))})};
|
|
156
|
+
lG=function(a,b,c,d,e,f,g,h){h=void 0===h?!1:h;return _.v(function*(){const k=fF(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!==_.Me&&l!==_.be);l?(iF(b),
|
|
157
|
+
l=zF(a,e).id,(l=nG(a,l))&&(yield l),l=a.D.Pe(e,d,WA),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 _.Wm).fa("emsg",a.K.bind(a,d,f,e.emsgSchemeIdUris)).parse(g),yield uG(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)} `+
|
|
158
|
+
`KeyID: ${e.keyId} `+`Width: ${e.width} Height: ${e.height} `+`Bitrate: ${_.Hi(e.bandwidth)} `+`Fragment: ${h}`),yield hE(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.ac=e,b.oa=f)))})};
|
|
159
|
+
oG=function(a,b,c){const d=fF(b);if(Array.from(a.a.values()).some(e=>e!==b&&e.rf))a.g.debug(d,BA,"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,BA,"reducing buffering goals by "+(100-Math.round(100*a.l))+"%");b.rf=!0}pF(a,b,4)};
|
|
160
|
+
pG=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 gG(a,d))})};qG=function(a,b,c,d){return _.v(function*(){try{const e=yield vG(a,b,c);a.f||(a.g.debug(d,"appending init segment"),yield wG(a,e,b),yield hE(a.D.$,b.type,e,null,null,!!b.stream.closedCaptions&&0<b.stream.closedCaptions.size))}catch(e){throw b.ve=!0,e;}})};
|
|
161
|
+
vG=function(a,b,c){return _.v(function*(){const d=rG(a,c,b.type);d.responseModifiers.push(f=>{xG(a,b,f.data)});b.type===_.t&&a.h.overridePasp&&d.responseModifiers.push(a.L.bind(a));a.g.debug(TA,c);const e=sG(a,b,c,!0);return(yield tG(a,d,b,c,e)).data})};wG=function(a,b,c){return _.v(function*(){if(a.h.patchEdgeWhenMixedContent&&_.Oh()){const d=cF(b);yield hE(a.D.$,c.type,d.buffer,null,null,!!c.stream.closedCaptions&&0<c.stream.closedCaptions.size)}})};
|
|
162
|
+
nG=function(a,b){let c=null;a.B.has(b)||(c=bG(a,b).then(()=>{a.f||ZF(a)}).catch(wB));cG(a);return c};
|
|
163
|
+
uG=function(a,b,c){return _.v(function*(){if(!a.f){var d=fF(b);a.g.debug(d,"checking buffer length");var e=Math.max(a.h.bufferBehind,a.j.presentationTimeline.h),f=a.D.$.Wb(b.type);if(null==f)a.g.debug(d,"buffer behind okay because nothing buffered:",$A+c,KA+e);else{var g=c-f,h=g-e;.01>=h?a.g.debug(d,"buffer behind okay:",$A+c,LA+g,KA+e,"underflow\x3d"+Math.abs(h)):(a.g.debug(d,"buffer behind too large:",$A+c,LA+g,KA+e,"overflow\x3d"+h),yield a.D.$.remove(b.type,f,f+h),a.f||a.g.debug(d,"evicted "+
|
|
164
|
+
h+" seconds"))}}})};xG=function(a,b,c){(new _.Wm).N(_.ue,_.Pm).N(_.bg,_.Pm).N(_.pe,_.Pm).N(_.te,_.Pm).N(_.Nf,_.Pm).fa(_.Pf,_.Qm).N("encv",d=>{d.reader.skip(78);_.Pm(d)}).N(_.Hf,_.Pm).N("schi",_.Pm).N("tenc",d=>{d.reader.skip(6);if(_.Em(d.reader)){d.reader.skip(1);const e=_.Rk(_.Mm(d.reader,16));e!==b.stream.keyId&&(a.g.debug(fF(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)};
|
|
165
|
+
mG=function(a){return a.H?!0:Array.from(a.a.values()).filter(b=>b.type!==_.I).every(b=>!b.jc&&!b.yc&&b.oa)};yG=function(a,b){return a.D.Tc&&(b=b.Ia)?a.D.Tc.getBaseUriCollectionById(b.id):null};zG=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)}};
|
|
166
|
+
rG=function(a,b,c){var d=[];const e=yG(a,b);e&&(d=b.$c(),d=_.aD(e,d));d.length||(d=b.Da());a=_.gC(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};
|
|
167
|
+
sG=function(a,b,c,d){const e=CF(a,b,a.D.xb(),c.endTime,zF(a,b.stream).id);if(d)var f="i";else a:{if(f=b.stream){var g=f.type;if(g===_.t){f=EB(f.type,_.Kl(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}};
|
|
168
|
+
tG=function(a,b,c,d,e){const f=yG(a,d);b=_.hl(a.D.Cb,b,e);c.Sb=b;return b.V.then(g=>{zG(a,f,g);c.Sb=null;return g}).catch(g=>{zG(a,f);throw g;})};AG=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)}};
|
|
169
|
+
ED=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=PD(a);if(!e)throw Error(CA);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=BG(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(!EE(f))throw a.log.error("Unable to switch to restricted track",
|
|
170
|
+
b.id),Error("Unable to switch to restricted track.");a.ca=f.video.id;var g=yield e.parser.loadVariant(f,e.id);QD(a.l,e).kb?g.video&&(CG(a,e,g.video,!1),yield IF(a.a,g.video,c,d)):(DG(a,e,g,!1),yield EG(a,g,c,d));null==a.Hc&&(a.Hc=a.Ec);a.Ec=new FG(f);GG(a,e.variants)}else a.ca=null,null!=a.Hc&&(a.Ec=a.Hc,a.Hc=null),a.configuration.abr.enabled||(a.log.info("Enable ABR Selection"),a.configuration.abr.enabled=!0,a.h.enable()),e=GG(a,e.variants).variant,null!=e&&HG(a)&&IG(a,e)})};
|
|
171
|
+
KG=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 JG(a,c);else{var d=vF(a.a),e=uF(a.a);c=PD(a);if(!c)throw Error(CA);var f=BG(a).filter(k=>k.audio.id===b&&EE(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");
|
|
172
|
+
g=!0;const k=a.getTrackManager().Ja();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(!QD(a.l,c).kb&&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(xD);a.h.setTracks(f);
|
|
173
|
+
DG(a,c,e,!1);g||!HG(a)?yield EG(a,e,!0,0):yield JF(a.a,h)}})};HD=function(a,b){return _.v(function*(){if(a.vf!==b&&(a.vf=b,a.G===LG&&(a.L.getTextDisplayer().setTextVisibility(b),!a.configuration.streaming.alwaysStreamText)))if(b){var c=PD(a);c=_.GE(c.textStreams,a.zc,a.gd,a.xc);0<c.length&&(yield wF(a.a,c[0]))}else xF(a.a)})};
|
|
174
|
+
ID=function(a,b){return _.v(function*(){if(a.f&&a.a){const c=PD(a),d=yield c.parser.loadTextStream(b.id,c.id);yield wF(a.a,d);MG(a,c,d,!1);yield NG(a,d);a.zc=d.language;a.xc=d.kind===_.Ud}})};LD=function(a){const b=a.vf;return a.f?a.L.getTextDisplayer().isTextVisible():b};
|
|
175
|
+
OG=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)};QG=function(a){return new _.PG(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})};
|
|
176
|
+
VG=function(a){return _.v(function*(){RG(a);yield SG(a);TG(a);if(_.Qh(4)||_.Qh(5)){const b=a.getSurface().getMedia();OG(a,b);yield UG(a,b)}a.configuration=a.ja})};WG=function(a){return _.v(function*(){const b=a.w.a;b&&(yield b.catch(()=>{}));a.fb&&(a.fb.release(),a.fb=null);yield Object.getPrototypeOf(Object.getPrototypeOf(a)).release.call(a);yield a.unload();oD(a.eb,0)})};TG=function(a){a.j&&(a.o.off(a.j,_.Sd),a.j=null);a.R&&(a.R.stop(),a.R=null)};
|
|
177
|
+
RG=function(a){if(a.G===XG)throw new _.J(_.C,7,7E3,"Player is destroyed.");};YG=function(a){return a.Z?a.Z.catch(()=>{}):Promise.resolve()};ZG=function(a){const b=new _.Zv;(a=a.playlist)&&a.cropTimeline&&(a.startTime||a.endTime)&&(b.h={start:a.startTime||null,end:a.endTime||null});return b};
|
|
178
|
+
cH=function(a,b){return _.v(function*(){a.F=new _.lv;oD(a.eb,2);const c=$G(a,a.configuration);yield UG(a,c);NE(a.w,b);a.J=new aH;AC(a.J,d=>{a.log.info("Timeline cue found",d);bH(a,_.Wf,d)},()=>{a.log.info("Timeline cues changed");a.trigger(new _.H(_.Zf))})})};
|
|
179
|
+
fH=function(a,b,c,d,e){return _.v(function*(){var f=_.cp(b)[c];const g=yield dH(a,f);NE(a.w,d);_.Nn(XA);f=yield eH(a,g,f,b.id||"");NE(a.w,d);f.periods.forEach(h=>{h.parser=g});e&&f.presentationTimeline.o&&(yield g.stop(),NE(a.w,d));_.Nn("manifest.end");_.Pn("Fetch and parse manifest",XA,"manifest.end");return{parser:g,manifest:f}})};
|
|
180
|
+
jH=function(a,b,c){return _.v(function*(){_.Nn("initDrm.start");const d=new _.gp({Cb:a.getNetworkEngine(),onError:h=>a.onError(h),hf:h=>{if(a.a){var k=PD(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.");
|
|
181
|
+
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&&!gH.includes(x),p.allowedByKeySystem=x),u!==p.allowedByKeySystem&&(x=y.type,y.type===_.t&&(x=`video ${y.width}x${y.height}@`+`${_.Hi(y.bandwidth)}`),a.log.warn("DRM Key not available for "+`KID: '${y.keyId}'. Applying restrictions to ${x}`)),
|
|
182
|
+
F===k&&u!==p.allowedByKeySystem&&(l=!0)}}}if(h=sF(a.a)){p=uF(a.a);y=vF(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(yA),hH(a),GG(a,h.variants)}l&&h!==k&&(a.log.info(yA),hH(a),GG(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===
|
|
183
|
+
_.SA)));c.drmResolver&&(e=c.drmResolver({hasLaurl:e}),(c.drm=e)&&_.Ap(c.drm));e=c.drm;var f=_.pk(e);d.f=f;e=e?e.offlineId||"":"";f=[];const g=_.At(b.periods);if(e){const h=_.tp(_.Oe);h&&(yield h.f(a,g),f=yield h.a(e))}yield _.no(d,g,f);a.A=d;iH(a,b.periods);_.Nn("initDrm.end");_.Pn("Init DRM","initDrm.start","initDrm.end");return d})};
|
|
184
|
+
wH=function(a,b){return _.v(function*(){const c=a.j;kH(a,c);lH(a,a.f.periods);a.Ec=new mH(a.configuration.preferredAudioLanguage||[],a.configuration.preferredAudioRole,a.configuration.preferredAudioChannelCount,a.configuration.preferSpatialAudio,a.configuration.mediaSource.codecSwitchingStrategy);a.zc=a.configuration.preferredTextLanguage;a.gd=a.configuration.preferredTextRole;a.xc=a.configuration.preferForcedSubtitles;yield _.Eo(a.A,c);NE(a.w,b);a.h.configure(a.configuration.abr);a.pf&&a.h.setCmsdManager(a.pf);
|
|
185
|
+
a.h.init((f,g,h)=>_.v(function*(){if(HG(a)){a.log.info(`ABR switch to ${f.width}x${f.height}`);var k=BG(a).find(l=>l.id===f.id)||null;if(k){const l=PD(a);k=yield l.parser.loadVariant(k,l.id);IG(a,k,g,h)}else a.log.warn("No matching variant found for track switch")}}));a.B=nH(a,c,a.configuration.startTime);a.nb=oH(a);a.H=new pH({mc:()=>c.playbackRate,qd:f=>{c.playbackRate=f},si:f=>{c.currentTime+=f}});YE(a.H,a.configuration.trickPlay);a.isLive()&&a.configuration.streaming.enableLiveEdgeChasing&&(a.kd=
|
|
186
|
+
new qH(a));rH(a,Math.max(1E-4,a.configuration.streaming.rebufferingGoal));sH(a)?wE(a.f,_.lj(a.configuration.preferredVideoCodec),_.lj(a.configuration.preferredAudioCodec),a.configuration.preferredAudioChannelCount):vE(a.f,_.lj(a.configuration.preferredVideoCodec),_.lj(a.configuration.preferredAudioCodec),a.configuration.preferredAudioChannelCount);var d=tH(a);d.h=a.configuration.streaming;a.a=d;a.G=LG;yield d.start();NE(a.w,b);a.configuration.streaming.startAtSegmentBoundary&&(d=uH(a,a.B.getTime()),
|
|
187
|
+
OC(a.B.f,d));for(var e of a.f.periods)vH(a,e);hH(a);e=BG(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");GG(a,e)})};
|
|
188
|
+
xH=function(a,b){var c=a.getMediaPosition(),d=a.Cc,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 _.Xv(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));tB(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;
|
|
189
|
+
break a}d=!0}!d&&a.trigger(new _.H(_.Bf));DC(a.we);BC(a.J,b.cues)};yH=function(a){return _.v(function*(){yield Promise.all(a.P.map(b=>b.stop()));a.P=[]})};AH=function(a,b,c){b=zH(a,b,c);c.catch(()=>{});c.reject(b);a.onError(b);throw b;};BH=function(a){a.P.map(b=>b.requestStop())};
|
|
190
|
+
CH=function(a,b){return _.v(function*(){const c=yield fH(a,b,0,null,!0);try{const d=[a.f,sD(c.manifest)],e=vD(d,a.f.presentationTimeline);return{parser:c.parser,manifest:e}}catch(d){throw new _.J(_.C,7,7003,"Failed to append load manifest");}})};DH=function(a,b){a.configuration.ads.hls.mockCuesFn?(b=a.configuration.ads.hls.mockCuesFn(a),BC(a.J,b)):BC(a.J,b)};
|
|
191
|
+
EH=function(a,b){return _.v(function*(){const c=a.P[a.P.length-1];b.periods.forEach(d=>{d.parser=c});if(a.S===_.oa)DH(a,b.cues),MF(a.a,b);else if(a.S===_.ab){a.f=wD(a.f,sD(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."),BH(a),a.P=[],_.pC(a.f.presentationTimeline,!0),a.trigger(new _.H(_.ie)));xH(a,a.f);MF(a.a,a.f)}})};
|
|
192
|
+
FH=function(a){return _.v(function*(){BH(a);a.P=[];a.S===_.ab?a.trigger(new _.H(_.Af)):a.trigger(new _.H(_.ie))})};
|
|
193
|
+
SG=function(a){return _.v(function*(){a.G!==XG&&(a.G=GH);const b=a.j;b&&(a.o.off(b,_.ke),a.o.off(b,_.cf),a.o.off(b,_.Ne),a.o.off(b,_.Rd),a.o.off(b,_.rf),a.o.off(b,_.of));a.J&&(a.J.release(),a.J=null);a.nb&&(a.nb.release(),a.nb=null);a.R&&(a.R.stop(),a.R=null);yield yH(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.L&&(yield a.L.destroy(),a.L=null);a.Ib&&(a.Ib.release(),a.Ib=null);a.kd&&
|
|
194
|
+
(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.Jb.clear();a.Ic=!1;HH(a)})};UG=function(a,b){return _.v(function*(){var c=window.muxjs?new IH:new _.JH;const d=_.Uo(a.configuration,[_.Zd,dB]).create(a);a.K=d;const e=QG(a);e.track(a);a.Ib=e;c=new _.KH(b,c,d,e,a.configuration);yield c.open();a.L=c})};
|
|
195
|
+
MH=function(a,b,c){c=void 0===c?!0:c;return _.v(function*(){const d=Date.now()/1E3,e=new _.xk;a.w.a=e;LH(a,b);try{RG(a);yield YG(a);NE(a.w,e);a.ia=_.cp(b);a.configuration=_.um([a.ja,b]);SB(a.configuration.xmlParser);a.Ac&&a.configuration.mse.sendPlaybackSessionIdHeader&&a.getNetworkEngine().headers.set(JA,a.Ac);a.log.info(_.Na,a.configuration);a.log.info(_.eb,a.ia);yield cH(a,e);NE(a.w,e);const f=yield fH(a,b,a.getSourceIndex(),e,!1);NE(a.w,e);a.P=[f.parser];a.f=f.manifest;DH(a,f.manifest.cues);a.A=
|
|
196
|
+
yield jH(a,a.f,a.configuration);NE(a.w,e);c&&(yield wH(a,e),NE(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){AH(a,f,e)}})};OH=function(a,b){return _.v(function*(){return a.configuration.contentSteering.enabled?(a.U||(a.U=new NH(a.configuration.contentSteering,a.getNetworkEngine()),a.U.on(PA,c=>{a.trigger(c)}),yield gD(a.U,b)),a.U):null})};
|
|
197
|
+
LH=function(a,b){b.cmcd&&b.cmcd.enabled&&(b.cmcd.sessionId||(b.cmcd.sessionId=a.Ac?a.Ac:void 0),a.fb=new PH(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)}))};
|
|
198
|
+
zH=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):ME(a.w)};$G=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);OG(a,c);return c};bH=function(a,b,c){a.trigger(new _.H(b,{detail:zC(c,QH(a))}))};
|
|
199
|
+
dH=function(a,b){return _.v(function*(){var c=a.getNetworkEngine();c=yield _.Lt(b.url,c,a.configuration.manifest.attemptParameters,b.type||null);c.configure(a.configuration.manifest);return c})};
|
|
200
|
+
eH=function(a,b,c,d){return(new _.kp(Promise.resolve().then(()=>_.v(function*(){let e=null;for(;!e;)try{{var f=b,g=c.url;const k=RH(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);AG(e.periods);return e})),()=>{a.log.info("Aborting parser step...");return b.stop()})).V};
|
|
201
|
+
HH=function(a){if(a.F&&a.I&&a.B){var b=SH(a)||a.Kb,c=a.H;c.l=b;aF(c,c.o?"seek":void 0);a.B.j.o=b;TH(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(_.yf))))}};
|
|
202
|
+
iH=function(a,b){UH(a,b);var c=a.a?uF(a.a):null;const d=a.a?vF(a.a):null,e=!sH(a);for(const f of b)BE(a.A,c,d,f,e);c=DB(b,f=>f.variants.some(EE));if(0===c)throw new _.J(_.C,4,4032);if(c<b.length)throw new _.J(_.C,4,4011);for(const f of b)yE(f.variants,a.configuration.restrictions)&&a.a&&PD(a)===f&&hH(a),VH(a,f.variants)};
|
|
203
|
+
kH=function(a,b){const c=d=>{a.j&&a.I&&(d.type===_.Df&&a.Kb?(a.I.a=WH,HH(a)):d.type===_.zg&&8===a.getState()&&.1>a.getBufferInfo().Ra(a.getMediaPosition())?(a.I.a=WH,HH(a)):a.I&&XH(a));TH(a)};a.o.on(b,_.cf,c);a.o.on(b,_.Ne,c);a.o.on(b,_.Rd,c);a.o.on(b,_.Df,c);a.o.on(b,_.Cf,c);a.o.on(b,_.of,c);a.o.on(b,_.zg,c);a.o.on(b,_.rf,()=>{if(a.j){var d=a.j.playbackRate;0!==d&&a.H.set(d)}})};
|
|
204
|
+
lH=function(a,b){for(let c=0;c<b.length;c++){const d=b[c],e=new Map;for(const f of BG(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,Na:0,mimeType:_.sc,codecs:"",kind:_.NA,encrypted:!1,keyId:null,language:g.closedCaptions.get(h),label:null,type:_.I,primary:!1,trickModeVideo:null,
|
|
205
|
+
emsgSchemeIdUris:null,roles:g.roles,channelsCount:null,spatialAudio:!1,closedCaptions:null};e.set(h,k)}}for(const f of e.values())d.textStreams.push(f)}};HG=function(a){return a.a?a.a.F:!1};BG=function(a){return a.f.alternativeVariants&&0<a.f.alternativeVariants.length?a.f.alternativeVariants:a.B?PD(a).variants:a.f.periods[0].variants};PD=function(a){const b=a.B.getTime();let c=null;for(const d of a.f.periods)d.startTime<=b&&(c=d);return c};
|
|
206
|
+
IG=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=YH(a,b);if(QD(a.l,e).kb){const f=b.video;if(f){ZH(a,e,()=>CG(a,e,f,!0));e===PD(a)&&$H(a);yield IF(a.a,f,c,d);return}}ZH(a,e,()=>{DG(a,e,b,!0)});e===PD(a)&&$H(a);GF(a.a,b,c,d)}})};nH=function(a,b,c){return new aI(b,a.f,a.configuration.streaming,c,d=>{a.nb&&VC(a.nb,!0,d);a.a&&NF(a.a)},d=>a.dispatchEvent(d),a.S===_.ab)};
|
|
207
|
+
oH=function(a){const b=new bI(a.j);var c=new cI(a.f);XE(c,()=>{hH(a)});b.a.add(c);a.J&&(c=new dI(a.J),XC(c,d=>{d.xe&&d.xe();bH(a,_.Xf,d)},d=>{d.ff&&d.ff();bH(a,_.Yf,d)},(d,e)=>{e||(d.xe&&d.xe(),bH(a,_.Xf,d),d.ff&&d.ff(),bH(a,_.Yf,d))}),b.a.add(c));a.S===_.ab&&(c=new eI(a.Cc,a.Kc,d=>a.trigger(d),a.configuration.playlist),b.a.add(c),a.we=c);return b};rH=function(a,b){a.I=new fI(b,Math.min(.5,b/2));a.I.a=WH;HH(a);a.R=(new _.Kh(()=>{XH(a)})).Hb(.25)};
|
|
208
|
+
sH=function(a){return a.configuration.mediaSource.codecSwitchingStrategy===_.If&&(_.Qh(2)||_.Qh(3)||_.Qh(4)||_.Qh(5)||_.Qh(6)||_.Th()&&38===_.Xh().major||_.Th()&&53===_.Xh().major||_.Th()&&68===_.Xh().major?!1:!0)};
|
|
209
|
+
tH=function(a){const b={configuration:{li:a.S===_.ab},xb:()=>a.B.getTime(),$:a.L,Cb: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 _.gI(a.f,b)};
|
|
210
|
+
uH=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=uF(a.a);var e=vF(a.a);const f=PD(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};
|
|
211
|
+
vH=function(a,b){UH(a,[b]);const c=b.variants,d=a.a?uF(a.a):null,e=a.a?vF(a.a):null,f=!sH(a);BE(a.A,d,e,b,f);if(!c.some(EE))throw new _.J(_.C,4,4011);VH(a,b.variants);yE(c,a.configuration.restrictions)&&a.a&&PD(a)===b&&hH(a);if(!_.Qh(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||[])_.so(a.A,k.keyId,k.initData)||_.uo(a.A,k.initDataType,k.initData,k.keyId)};
|
|
212
|
+
hH=function(a){const b=a.getTrackManager();b&&a.G!==XG&&(b.m&&(OD(b),b.m.trigger(new _.H(_.ag))),$H(a))};GG=function(a,b){b=hI(a,b);if(!b)return{variant:null,kb:null};a=iI(a,b);return{variant:b,kb:a}};
|
|
213
|
+
XH=function(a){if(a.j){switch(a.G){case LG:a:if(a.j.ended||dE(a.L))var b=!0;else{if(a.isLive()){b=vC(a.f.presentationTimeline);var c=a.getBufferInfo();if(null!==c&&(c=c.Qa(),null!==c&&c>=b)){b=!0;break a}}b=!1}break;default:b=!1}if(a.L){var d=fE(a.L);c=d.video;d=d.audio;var e=a.j.currentTime;c&&d?(c=c.Ra(e),d=d.Ra(e),d=Math.min(c,d)):d=c?c.Ra(e):d?d.Ra(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?jI:WH;c.a=e;c=d!==e}}(d=SH(a))&&a.fb&&(a.fb.h=!0);c||6===a.getState()&&
|
|
214
|
+
!d?(a.log.debug("Buffering state changed. Is buffering",d,"buffered to end",b,"state",a.getState()),HH(a)):a.Ic&&TH(a)}};TH=function(a){var b=a.eb;if(a.Kb)var c=!1;else if(a.j&&a.j.ended)c=!0;else{c=a.getMediaDuration();var d=a.getMediaPosition();c=a.Ic&&0<=d&&c<=d?!0:!1}a=c?11:SH(a)||a.Kb?6:a.j&&a.j.paused?10:8;oD(b,a)};SH=function(a){return a.A&&a.A.F?!0:a.I?a.I.getState()===WH:!1};kI=function(a){const b=PD(a);return b?QD(a.l,b).video:null};
|
|
215
|
+
lI=function(a){const b=PD(a);return b?QD(a.l,b).audio:null};nI=function(a){if(null==PD(a))return[];mI(a);return BG(a).filter(b=>EE(b))};oI=function(a){const b=PD(a);if(null==b)return[];mI(a);return a.f.alternativeTextStreams?a.f.alternativeTextStreams:b.textStreams.filter(c=>!a.md.has(c))};
|
|
216
|
+
MG=function(a,b,c,d){PE(a.l,b,c);if(b=a.getTrackManager())SD(b,c.id,_.L,d),c=b.Za(),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}))};NG=function(a,b){return _.v(function*(){HG(a)?yield _.KF(a.a,b):a.W=b})};
|
|
217
|
+
CG=function(a,b,c,d){const e=a.getTrackManager();if(e){var f=a.F.f;QD(a.l,b).video=c;SD(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}))}};DG=function(a,b,c,d){b.parser&&b.parser.setCurrentVariant(c);c.video&&CG(a,b,c.video,d);c.audio&&pI(a,b,c.audio,d)};
|
|
218
|
+
EG=function(a,b,c,d){c=void 0===c?!1:c;d=void 0===d?0:d;return _.v(function*(){HG(a)?yield GF(a.a,b,c,d):(a.da=b,a.fh=c,a.eh=d)})};
|
|
219
|
+
JG=function(a,b){return _.v(function*(){const c=PD(a);if(!c)throw Error(CA);const d=c.variants.filter(g=>g.video&&g.video.muxedAudioId===b.groupId&&EE(g));if(0===d.length)throw Error("No variants containing muxed audio found.");let e=d[0];const f=vF(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}`),qI(a,c,b,!1),yield HF(a.a))})};
|
|
220
|
+
qI=function(a,b,c,d){b=QD(a.l,b);b.audio=null;b.kb=c;if(b=a.getTrackManager())a=a.F.f,SD(b,c.id,_.M,d),c=b.Sa(),qB(a,c,d)};QH=function(a){return a.S===_.ab&&"flat"===a.configuration.playlist.timeline};sI=function(a,b,c){c=void 0===c?!0:c;_.v(function*(){var d=GG(a,b.variants).variant;a.Aa=d&&d.audio&&d.audio.id;d&&(d=yield b.parser.loadVariant(d,b.id),DG(a,b,d,!0),yield EG(a,d,c));(d=rI(a,b.textStreams))&&(a.configuration.streaming.alwaysStreamText||LD(a))&&(MG(a,b,d,!0),yield NG(a,d))})};
|
|
221
|
+
pI=function(a,b,c,d){const e=a.getTrackManager();if(e){var f=a.F.f;a=QD(a.l,b);a.audio=c;a.kb=null;SD(e,c.id,_.M,d);c=e.Sa();qB(f,c,d)}};UH=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)&&!EB(b.type,_.Kl(b.mimeType,b.codecs))&&delete d.video;a.log.debug("Video removed due to disableVideoTracks")}};
|
|
222
|
+
VH=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])?gH.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});};
|
|
223
|
+
mI=function(a){if(a.a&&a.f){var b=sF(a.a),c=PD(a);null!=b&&b===c&&(uF(a.a),vF(a.a),_.tF(a.a,_.I),QD(a.l,c),QD(a.l,c),QD(a.l,c),QD(a.l,c))}};
|
|
224
|
+
hI=function(a,b){try{VH(a,b)}catch(e){return a.onError(e),null}b=b.filter(e=>EE(e));var c=nD(b,a.Aa);b=a.Ec.create(c);b=Array.from(b.values());var d=b.map(xD);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(),yD(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(),
|
|
225
|
+
yD(c,b))};iI=function(a,b){return b&&b.video?(a=(a.f.muxedAudioTracks||[]).find(c=>c.groupId===b.video.muxedAudioId))&&a.primary?a:null:null};rI=function(a,b){return _.GE(b,a.zc,a.gd,a.xc)[0]||null};
|
|
226
|
+
tI=function(a,b){a.h.disable();a.log.debug("Choosing new streams after period changed");var c=GG(a,b.variants);let d=c.variant;const e=c.kb;let f=rI(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&&ZH(a,b,()=>CG(a,b,g,!0));h&&ZH(a,b,()=>pI(a,b,h,!0));e&&ZH(a,b,()=>qI(a,b,e,!0));f&&(a.configuration.streaming.alwaysStreamText||LD(a))&&ZH(a,
|
|
227
|
+
b,()=>MG(a,b,f,!0));b===PD(a)&&$H(a);c=a.configuration.streaming.alwaysStreamText||LD(a)?f:null;return{video:g,audio:h,text:c,kb:e}};ZH=function(a,b,c){a.Jb.has(b)||a.Jb.set(b,[]);a.Jb.get(b).push(c)};$H=function(a){const b=PD(a);if(b){const c=a.Jb.get(b)||[];for(a.Jb.delete(b);c.length;)c.shift()()}};YH=function(a,b){for(const c of a.f.periods)if(c.variants.some(d=>d.id===b.id))return c;return null};
|
|
228
|
+
uI=function(a,b,c,d){return _.v(function*(){let e;try{e=yield _.Lt(b.url,a.getNetworkEngine(),a.configuration.manifest.attemptParameters,b.type||null);e.configure(a.configuration.manifest);{var f=e,g=b.url;const G=RH(a,a.configuration.id||"");var h=f.start(g,G)}const k=yield h;AG(k.periods);if(!k.periods.length)throw new _.J(_.C,4,4014);yield yH(a);a.P=[e];const l=d&&d.id,m=c&&c.id;a.f.periods=k.periods;const n=$B(k.periods,a.B.getTime())||k.periods[0];sH(a)?wE(a.f,_.lj(a.configuration.preferredVideoCodec),
|
|
229
|
+
_.lj(a.configuration.preferredAudioCodec),a.configuration.preferredAudioChannelCount):vE(a.f,_.lj(a.configuration.preferredVideoCodec),_.lj(a.configuration.preferredAudioCodec),a.configuration.preferredAudioChannelCount);const p=pD(l,m,n.variants),u=rI(a,n.textStreams);GG(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,
|
|
230
|
+
a.configuration.streaming.attemptParameters));yield Promise.all(h);YF(a.a,_.q,y);YF(a.a,_.t,x);YF(a.a,_.I,u);p&&DG(a,n,p,!1);a.log.info("Switch CDN successful.")}catch(k){throw e&&(yield e.stop()),k;}})};RH=function(a,b){return{networkingEngine:a.getNetworkEngine(),onContentSteeringInfoFound:c=>OH(a,c),configurationId:b,filterNewPeriod:c=>vH(a,c),filterAllPeriods:c=>iH(a,c),onEvent:c=>a.Df(c),onError:c=>a.onError(c),onUpdate:c=>EH(a,c),onTurnedStatic:()=>FH(a),Dd:()=>a.h}};
|
|
231
|
+
vI=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)}};
|
|
232
|
+
wI=function(){const a=MediaSource.isTypeSupported;MediaSource.isTypeSupported=b=>"mp2t"===b.split(/ *; */)[0].split("/")[1].toLowerCase()?!1:a(b)};xI=function(){const a=MediaSource.prototype.addSourceBuffer;MediaSource.prototype.addSourceBuffer=function(...b){b=a.apply(this,b);b.abort=function(){};return b}};yI=function(){const a=SourceBuffer.prototype.remove;SourceBuffer.prototype.remove=function(b,c){return a.call(this,b,c-.001)}};
|
|
233
|
+
zI=function(){const a=MediaSource.isTypeSupported;MediaSource.isTypeSupported=b=>"opus"!==_.HB(b)&&a(b)};AI=function(a,b){const c=a.mode;a.mode=c===_.Ef?_.Ef:_.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};kB=[112,115,115,104,0,0,0,0];_.BI=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.Ia=g}Gd(){return this.ka?this.ka-this.na+1:null}f(){return this.keyInfo}};
|
|
234
|
+
_.CI=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.Na=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.Ia=B}getPosition(){return this.position}Gd(){return this.ka?this.ka-this.na+1:null}f(){return this.keyInfo}};
|
|
235
|
+
PH=class{constructor(a,b,c){this.j=a;this.a=b;this.g=new _.S("clpp.net.CmcdManager");this.l=MB(this);this.j.a.push(this.l);this.f=c;this.h=!1}release(){hB(this.j,this.l)}};_.PB=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}};
|
|
236
|
+
_.RB=class{j(a,b){a=QB(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=_.RB.prototype;_.Mg.Zd=_.Og(18);_.Mg.Ee=_.Og(16);
|
|
237
|
+
_.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.Dc=_.Og(2);_.Mg.Xb=_.Og(0);_.DI=0;
|
|
238
|
+
_.PG=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&&WB(this);a&&(this.player=a,this.player.on(_.wf,this.a,this))}release(){WB(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&&
|
|
239
|
+
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(UB)}YB(this);this.a();this.player&&this.player.trigger(new _.H(_.rg))}clear(){this.T=[];YB(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,
|
|
240
240
|
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}}))}}}}};
|
|
241
|
-
_.
|
|
242
|
-
|
|
243
|
-
this.a&&a<this.f}
|
|
244
|
-
_.
|
|
245
|
-
a)}isLive(){return 2===this.j.version?!this.a.f:Infinity===this.f&&!this.o}Nd(){return!this.o}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
_.
|
|
249
|
-
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.
|
|
250
|
-
1].endTime-this.a[0].startTime}replace(a){this.a=a}};
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
d,g),()=>{this.j.H=!0});this.o=(new _.
|
|
256
|
-
this.f.getTime();return 0<this.h.readyState&&!this.h.paused?
|
|
257
|
-
|
|
258
|
-
a);this.o.set(d,f);const g=this.w.find(h=>h.Pc===e&&h.Oc===f);g&&g.
|
|
259
|
-
|
|
260
|
-
null;const c=Date.now();this.j.forEach((e,f)=>{e.vd&&c>e.vd&&(e.vd=0,this.trigger(new _.H(
|
|
261
|
-
return new _.
|
|
262
|
-
null}
|
|
263
|
-
this.f.set(_.M,a),
|
|
264
|
-
(b=a.renditions[0])}}b?
|
|
265
|
-
|
|
266
|
-
_.
|
|
267
|
-
a.push(b.p.catch(
|
|
268
|
-
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=_.
|
|
269
|
-
this.f.
|
|
270
|
-
_.I?Promise.resolve()
|
|
271
|
-
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+
|
|
241
|
+
_.EI=class{constructor(a){this.h=Math.exp(Math.log(.5)/a);this.f=this.a=0}};
|
|
242
|
+
WD=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))})}Wb(){return this.a}Qa(){return this.f}nc(a){return null==this.a||null==this.f?!1:a>=
|
|
243
|
+
this.a&&a<this.f}Ra(a){return null==this.f||this.f<a?0:this.f-Math.max(a,this.a)}};FI=class{constructor(a){this.a=this.h=0;this.f=a}Yb(){return this.h}getDuration(){return this.f?this.a-this.h:Infinity}};
|
|
244
|
+
_.GI=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 FI(d);this.I=null;this.B=this.j.type||null}Fc(){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+=
|
|
245
|
+
a)}isLive(){return 2===this.j.version?!this.a.f:Infinity===this.f&&!this.o}Nd(){return!this.o}Gc(){return this.B}};aH=class{constructor(){this.f=()=>{};this.h=()=>{};this.a=new Set}release(){this.f=()=>{};this.h=()=>{};this.a.clear()}cues(){return this.a}};
|
|
246
|
+
eI=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 _.Xv("crop",a,d.endTime?d.endTime-a:Infinity,!1))}release(){this.f=this.j=this.h=this.a=null}l(a){tB(this.a,a);DC(this)}};
|
|
247
|
+
FC=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=EC(this);return{value:a,done:!a}}};
|
|
248
|
+
_.HI=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: "+
|
|
249
|
+
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.Na-=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-
|
|
250
|
+
1].endTime-this.a[0].startTime}replace(a){this.a=a}};PC=class{constructor(a,b){this.h=a;this.l=IC(a);this.a=a.a.currentTime;this.j=Date.now()/1E3;this.o=b;this.f=()=>{}}release(){this.h=null;this.f=()=>{}}};QC=class{constructor(a){this.a=a}};
|
|
251
|
+
II=class{constructor(a,b,c,d,e){this.a=a;this.G=b;this.h=c;this.F=e;this.j=new _.Ut;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,()=>JC(this));this.w=(new _.Kh(()=>{JC(this)})).Hb(.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;JC(this)}};
|
|
252
|
+
JI=class{constructor(a,b){this.f=a;this.o=b;this.l=this.h=this.j=0;this.a=new _.Kh(()=>{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}};
|
|
253
|
+
KI=class{constructor(a,b,c,d){this.a=a;this.j=b;this.o=d;this.A=c;this.l=!1;this.f=new _.Ut;this.h=new JI(a,10);this.w=!1;0<a.readyState?MC(this,c):NC(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}};
|
|
254
|
+
aI=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 II(a,b.presentationTimeline,c,RC(this,a,c),f);this.f=new KI(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=UC(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;OC(this.f,l);h=void 0;break a}}this.g.debug("Seek to "+k);this.A(h?1:0);h=void 0}return h},TC(this,
|
|
255
|
+
d,g),()=>{this.j.H=!0});this.o=(new _.Kh(()=>{if(0!==this.h.readyState&&!this.h.paused){var h=this.f.getTime(),k=nC(this.a),l=xC(this.a);3>l-k&&(k=l-3);h<k&&(k=UC(this,h),this.g.info("Jumping forward "+(k-h)+" seconds to catch up with the seek range."),this.h.currentTime=k)}})).Hb(.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=
|
|
256
|
+
this.f.getTime();return 0<this.h.readyState&&!this.h.paused?yC(this.a,a):a}};bI=class{constructor(a){this.f=a;this.a=new Set;this.h=(new _.Kh(()=>{VC(this,!1)})).Hb(.25)}release(){this.h.stop();for(const a of this.a)a.release();this.a.clear()}};
|
|
257
|
+
dI=class{constructor(a){this.j=a;this.o=new Map;this.a=()=>{};this.f=()=>{};this.h=()=>{};this.w=[{Pc:null,Oc:2,Jc:(b,c)=>this.a(b,c)},{Pc:1,Oc:2,Jc:(b,c)=>this.a(b,c)},{Pc:3,Oc:2,Jc:(b,c)=>this.a(b,c)},{Pc:2,Oc:1,Jc:(b,c)=>this.f(b,c)},{Pc:2,Oc:3,Jc:(b,c)=>this.f(b,c)},{Pc:1,Oc:3,Jc:(b,c)=>this.h(b,c)},{Pc:3,Oc:1,Jc:(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=WC(d,
|
|
258
|
+
a);this.o.set(d,f);const g=this.w.find(h=>h.Pc===e&&h.Oc===f);g&&g.Jc(d,b&&0===c)}}};hD=class{constructor(){this.f=new _.EI(2);this.h=new _.EI(5);this.a=0}getBandwidthEstimate(a){return 128E3>this.a?a:Math.min(_.fC(this.f),_.fC(this.h))}};_.LI=class{constructor(a,b){this.id=a;this.qa=b}};
|
|
259
|
+
NH=class extends _.Du{constructor(a,b){super();this.A=a;this.h=null;this.B=b;this.C=new _.ru;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}.`),
|
|
260
|
+
null;const c=Date.now();this.j.forEach((e,f)=>{e.vd&&c>e.vd&&(e.vd=0,this.trigger(new _.H(QA,{detail:{serviceLocationId:f,banned:!1,bannedSeconds:0}})))});let d=b.filter(e=>0===iD(this,e.serviceLocationId).vd);d.length||(d=b);d.length&&(b=this.w.get(a),bD(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(PA,{detail:b})),this.w.set(a,d)));
|
|
261
|
+
return new _.LI(a,d)}notifyThroughput(a,b,c){a=iD(this,a);$C(a.Xf,b,c);a.Ge=!0}banLocation(a){const b=iD(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(QA,{detail:{serviceLocationId:a,banned:!0,bannedSeconds:this.f}}))}};var MI=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 NI=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 zD(this,_.N)}getAudioTracks(){return zD(this,_.M)}sa(){return zD(this,_.L)}ta(){return this.a.get(_.N)||null}Sa(){return this.a.get(_.M)||null}Za(){return this.a.get(_.L)||null}wb(){return this.f.get(_.N)||null}Ob(){return this.f.get(_.M)||
|
|
262
|
+
null}Pb(){return this.f.get(_.L)||null}Ja(){return AD(this,_.N)}ra(){return AD(this,_.M)}ua(){return AD(this,_.L)}Gb(a){this.m&&BD(this,_.N,a)}za(a){this.m&&BD(this,_.M,a)}bb(a){this.m&&BD(this,_.L,a)}rb(a,b){b=void 0===b?!1:b;if(this.m)if(a)FD(this,a,b);else if(a=b,b=AD(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."),ED(this.m,null,a))}Eb(a){this.m&&(a?(CD(this,a,_.M),DD(this,a,_.M)&&(this.g.info(`Set audio rendition with ID: ${a.id}`),
|
|
263
|
+
this.f.set(_.M,a),KG(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()}Fb(a){if(this.m){var b=a;if(!a){const c=this.Za();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&&
|
|
264
|
+
(b=a.renditions[0])}}b?JD(this,b):KD(this)}}detach(){}};NI.prototype.setTextRendition=NI.prototype.Fb;NI.prototype.isAbrEnabled=NI.prototype.va;NI.prototype.addTextTrack=NI.prototype.addTextTrack;NI.prototype.setAudioRendition=NI.prototype.Eb;NI.prototype.setVideoRendition=NI.prototype.rb;NI.prototype.setTextTrack=NI.prototype.bb;NI.prototype.setAudioTrack=NI.prototype.za;NI.prototype.setVideoTrack=NI.prototype.Gb;NI.prototype.getTextTrack=NI.prototype.ua;NI.prototype.getAudioTrack=NI.prototype.ra;
|
|
265
|
+
NI.prototype.getVideoTrack=NI.prototype.Ja;NI.prototype.getLoadingTextRendition=NI.prototype.Pb;NI.prototype.getLoadingAudioRendition=NI.prototype.Ob;NI.prototype.getLoadingVideoRendition=NI.prototype.wb;NI.prototype.getTextRendition=NI.prototype.Za;NI.prototype.getAudioRendition=NI.prototype.Sa;NI.prototype.getVideoRendition=NI.prototype.ta;NI.prototype.getTextTracks=NI.prototype.sa;NI.prototype.getAudioTracks=NI.prototype.getAudioTracks;NI.prototype.getVideoTracks=NI.prototype.getVideoTracks;var IH;IH=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()}};_.JH=class{init(){}h(){}f(){}};var UD;
|
|
266
|
+
_.KH=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 _.Ut;this.K=!1;this.w={};this.H=b;this.F=d;this.I=e;this.da=this.I.streaming.maxSegmentToMediaOffset||1;this.M=new _.xk;this.A="";this.G={};this.o=VD(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&&
|
|
267
|
+
a.push(b.p.catch(wB));for(b=1;b<d.length;++b)d[b].p.catch(wB),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,
|
|
268
|
+
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=_.Kl(e.mimeType,e.codecs);if(l===_.I)XD(d,m);else{var f=new Map;f.set(l,m);_.Rs(m)&&b&&!e.aesEncrypted||!_.Jl(m,l)||!(e=_.Jl(m))||(f=e(),d.w[l]=f,f=f.demuxMimeTypes(l,m),c&&f.delete(_.q));yield ZD(d,f);d.P=f.has(_.q)&&f.has(_.t)}}}})}Wb(a){return a===_.I?this.f.Wb():(a=eE(this,a))?a.Wb():null}Qa(a){return a===_.I?this.f.Qa():(a=eE(this,a))?a.Qa():null}nc(a,b,c){return a===_.I?
|
|
269
|
+
this.f.nc(b):(a=eE(this,a))?a.nc(b,!1,c):!1}Ra(a,b){return a===_.I?this.f.Ra(b):(a=eE(this,a))?a.Ra(b):0}remove(a,b,c){return a===_.I?this.f.remove(b,c):aE(this,a,this.U.bind(this,a,b,c)).then(()=>{if(a===_.t){var d=this.Wb(a);const e=this.Qa(a);null!==d&&null!==e&&ZB(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 aE(this,a,this.U.bind(this,a,0,this.o.duration))}flush(a){return a===
|
|
270
|
+
_.I?Promise.resolve():aE(this,a,this.S.bind(this,a))}endOfStream(a){return oE(this,()=>{dE(this)||(a?this.o.endOfStream(a):this.o.endOfStream())})}getDuration(){return this.o.duration}L(a,b){this.g.debug("Appending data to "+a+uA);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+uA)}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 "+
|
|
271
|
+
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+uA);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+uA,b),b;}this.g.debug("Done Aborting operations for "+a+uA);this.B(a)}S(a){try{this.j.readyState>HTMLMediaElement.HAVE_NOTHING?(this.g.debug("Flushing buffer for "+
|
|
272
272
|
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 "+
|
|
273
273
|
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),
|
|
274
|
-
|
|
275
|
-
a=
|
|
276
|
-
!1}segmentDownloaded(a,b){this.g.debug("Segment downloaded:","deltaTimeMs\x3d"+a,"numBytes\x3d"+b,"lastTimeChosenMs\x3d"+this.h,"enabled\x3d"+this.l)
|
|
277
|
-
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=
|
|
278
|
-
a;this.j=null}setCmsdManager(a){this.A=a}configure(a){this.a=a}reset(){this.F=!1;this.w=new
|
|
279
|
-
`found. Role: ${this.a}`)}b||(b=a.filter(d=>d.primary),0<b.length&&(a=b));this.f&&(b=
|
|
280
|
-
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
|
|
281
|
-
a.D.xb();var c
|
|
282
|
-
if(!a.
|
|
283
|
-
(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=
|
|
284
|
-
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,Jj:l,eventDuration:m,id:n,messageData:d}}),this.D.onEvent(c))))}L(a){let b=!1,c=0;(new _.
|
|
285
|
-
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 _.
|
|
286
|
-
trigger:a=>this.trigger(a)});this.
|
|
287
|
-
{this.G===
|
|
288
|
-
b.release();a.G!==
|
|
289
|
-
this.
|
|
290
|
-
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!==
|
|
291
|
-
c);const d=a[0];d.playlist&&d.playlist.startTime&&(d.startTime=d.playlist.startTime);b.ia=_.
|
|
292
|
-
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 _.
|
|
293
|
-
7,7003,"Cannot append-load to non-playlist player.");const c=yield
|
|
294
|
-
yield
|
|
295
|
-
a={start:
|
|
296
|
-
c.play()}else this.H.set(a,b);(b=this.H.getConfiguration())&&b.preferTrickPlayTracks&&
|
|
297
|
-
|
|
298
|
-
this.F.h=a}return this.F.getStats()}getBandwidthEstimate(){return this.h.getBandwidthEstimate()}getCueTimeline(){return this.J}getTimelineCues(){return this.J?
|
|
299
|
-
g.f.periods[k].startTime)-h.startTime;if(Infinity===l)throw new _.J(1,4,4040);const m=new _.
|
|
300
|
-
roles:[],channelsCount:null,spatialAudio:!1,closedCaptions:null};g.md.add(k);h.textStreams.push(k);yield
|
|
301
|
-
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,
|
|
302
|
-
c?"":c)===
|
|
303
|
-
this.
|
|
304
|
-
d=b.va();if(c=yield b.Rc(c.url,a)){c=_.Xg(b.getLoadedSource(),{url:c});d&&b.h.disable();yield
|
|
305
|
-
e);e.line=-1;try{e.align=_.Wc}catch(f){e.align="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;
|
|
306
|
-
this.a&&(this.a.mode=a?_.Ef:_.Yd)}destroy(){this.a&&
|
|
307
|
-
_.oa||a===_.ab}create(){return new
|
|
308
|
-
_.
|
|
309
|
-
_.
|
|
274
|
+
nE(this,a))}getTextDisplayer(){return this.C}};UD=window.URL.createObjectURL;_.OI=class{constructor(){this.g=new _.S("clpp.abr");this.o=null;this.l=!1;this.w=new hD;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=HE(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."),
|
|
275
|
+
a=HE(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=
|
|
276
|
+
!1}segmentDownloaded(a,b){this.g.debug("Segment downloaded:","deltaTimeMs\x3d"+a,"numBytes\x3d"+b,"lastTimeChosenMs\x3d"+this.h,"enabled\x3d"+this.l);$C(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...");
|
|
277
|
+
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=rB(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=
|
|
278
|
+
a;this.j=null}setCmsdManager(a){this.A=a}configure(a){this.a=a}reset(){this.F=!1;this.w=new hD;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);IE(this,a,c,b)}}};var PI=class{constructor(){this.a=null}};var QI=class{constructor(){this.a=new Map}clear(){this.a.clear()}},OE=class{constructor(){this.text=this.video=this.kb=this.audio=null}};var RI=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(SE(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 FG=class{constructor(a,b){b=void 0===b?_.mf:b;this.f=a;this.a=b;this.h=new mH(a.language,"",a.audio&&a.audio.channelsCount?a.audio.channelsCount:0,!1,b)}create(a){const b=this.a===_.If&&TB(),c=a.filter(d=>SE(this.f,d,!b));return c.length?new RI(c[0],c):this.h.create(a)}},mH=class{constructor(a,b,c,d,e){this.j=_.lj(a);this.a=b;this.f=c;this.l=void 0===d?!1:d;this.h=void 0===e?_.mf:e}create(a){var b=TE(a,this.j);0<b.length&&(a=b);b=!1;if(this.a){var c=UE(a,this.a);0<c.length?(a=c,b=!0):_.A("No exact match for preferred variant role could be "+
|
|
279
|
+
`found. Role: ${this.a}`)}b||(b=a.filter(d=>d.primary),0<b.length&&(a=b));this.f&&(b=rE(a,this.f),b.length?a=b:_.A("No exact match for the channel count could be found."));b=VE(a,this.l);b.length?a=b:_.A("No exact match for spatial audio could be found.");b=this.h===_.If&&TB();c=new RI(a[0]);for(const d of a)c.add(d,!b);return c}};var fI=class{constructor(a,b){this.a=jI;this.f=(new Map).set(jI,b).set(WH,a)}getState(){return this.a}},WH=0,jI=1;var qH=class{constructor(a){this.D=a;this.a=a.getConfiguration().streaming;this.f=new _.Ut;this.g=new _.S("clpp.mse.media.LiveEdgeObserver");WE(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."),
|
|
280
|
+
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 cI=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=$B(c,a)||c[0]}b!==a&&this.f(a);this.a=a}};var pH=class{constructor(a){this.f=a;this.o=this.w=this.l=!1;this.h=this.f.mc();this.A=_.xd;this.j=null;this.a=new _.Kh(()=>{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;aF(this,b)}};var dF=new _.Pu(()=>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]));_.gI=class{constructor(a,b){this.D=b;this.j=a;hF(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())iF(c),b.push(jF(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=
|
|
281
|
+
a.D.xb();var c=$B(a.j.periods,b+_.nu);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.kb;yield qF(a,c,b);a.f||(a.g.debug("init: completed initial Stream setup"),a.D.yi&&a.D.yi())})}resume(){if(!VF(this))for(const a of this.a.values())a.endOfStream=!1,pF(this,a,0)}ec(a){const b=this;return _.v(function*(){if(!b.f){var c=fF(a);
|
|
282
|
+
if(!a.Db&&null!=a.sb&&!a.yc)if(a.sb=null,a.jc)b.g.debug(c,"skipping update and clearing the buffer"),yield DF(b,a,a.Je,a.ie);else{try{const d=fG(b,a);null!=d&&(pF(b,a,d),a.dd=!1)}catch(d){yield gG(b,d);return}hG(b,a);if(WF(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()&&
|
|
283
|
+
(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=jB(d.reader),g=jB(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=_.Hm(d.reader),m=_.P(d.reader),n=_.P(d.reader),f=jB(d.reader),g=jB(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=_.Mm(d.reader,d.reader.Va()-d.reader.getPosition()),a=
|
|
284
|
+
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,Jj:l,eventDuration:m,id:n,messageData:d}}),this.D.onEvent(c))))}L(a){let b=!1,c=0;(new _.Wm).N(_.ue,_.Pm).N(_.bg,_.Pm).N(_.pe,_.Pm).N(_.te,_.Pm).N(_.Nf,_.Pm).fa(_.Pf,_.Qm).N("encv",d=>{d.reader.skip(78);_.Pm(d)}).N("pasp",d=>{c=d.start+d.headerSize;const e=_.P(d.reader),
|
|
285
|
+
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 _.Ym(new DataView(a.data)),a.seek(c),_.O(a,1),_.O(a,1))}};var SI=class{constructor(){this.a=null}};var TI=class extends _.Gu{constructor(){super(OA);this.G=GH;this.Ib=this.j=this.Z=null;this.vf=!1;this.o=new _.Ut;this.R=this.If=this.kd=this.H=this.nb=this.B=this.L=this.A=null;this.Ic=!1;this.a=this.J=this.I=null;this.P=[];this.f=null;this.h=new _.OI;this.U=this.fb=null;this.gh=1E9;this.md=new Set;this.da=null;this.fh=!1;this.eh=0;this.W=null;this.l=new QI;this.F=null;this.eb=new MI({isSeeking:()=>this.qf,xi:a=>{null!==this.H&&(this.H.w=10===a);this.F&&_.Wo(this.F.a,a)},Di:()=>{this.R&&this.R.stop()},
|
|
286
|
+
trigger:a=>this.trigger(a)});this.Ec=new mH(this.configuration.preferredAudioLanguage||[],this.configuration.preferredAudioRole,this.configuration.preferredAudioChannelCount,this.configuration.preferSpatialAudio,this.configuration.mediaSource.codecSwitchingStrategy);this.zc=this.configuration.preferredTextLanguage;this.w=new PI;this.ca=this.Aa=null;this.Jb=new Map;this.Hc=null;this.gd=this.configuration.preferredTextRole;this.xc=this.configuration.preferForcedSubtitles;this.o.on(window,"online",()=>
|
|
287
|
+
{this.G===LG&&UF(this.a)});this.we=this.Cc=this.Be=null;this.S=_.oa;this.Kc=new SI;this.Ac=null}init(a,b){const c=a.getMedia();super.init(a,b);OG(this,c)}namespace(){return OA}setSeekInterceptor(a){this.If=a||null}setPlaybackSessionId(a){this.Ac=a}dh(){return new NI}getState(){return this.eb.getState()}getDrmInfo(){return this.A?this.A.getDrmInfo():null}unload(){const a=this;return _.v(function*(){HD(a,!1);a.Ic=!1;if(a.ia){a.log.debug("Unload player with source",a.ia);var b=a.getTrackManager();b&&
|
|
288
|
+
b.release();a.G!==XG&&(yield VG(a),a.ia=null,a.eb.h=0,a.Aa=null,a.ca=null,a.getNetworkEngine().headers.delete(JA))}})}release(){const a=this;return _.v(function*(){if(a.Z)return a.Z;a.Z=WG(a);a.Z.finally(()=>{a.Z=null});return a.Z})}getBufferInfo(a){if(this.L){var b=fE(this.L);const c=new _.Au(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.Ib?(b=VB(this.Ib),NB(b,a)):super.getBufferInfo(a)}getPosition(){var a=
|
|
289
|
+
this.Kc,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.Kc;b=b.a?a+b.a.Yb():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.Kc,b=this.getMediaDuration();
|
|
290
|
+
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!==XG&&(a.log.debug("Destroying player..."),a.G=XG,TG(a),a.o&&(a.o.release(),a.o=null),a.Cc=null,a.h=null)})}getTimeline(){return this.Cc}setupPlaylist(a){const b=this;return _.v(function*(){const c=new _.xk;b.w.a=c;try{RG(b);b.S=_.ab;yield YG(b);NE(b.w,
|
|
291
|
+
c);const d=a[0];d.playlist&&d.playlist.startTime&&(d.startTime=d.playlist.startTime);b.ia=_.cp(d);b.configuration=_.um([b.ja,d]);b.log.info("Loading playlist configurations",a);b.Cc=ZG(b.configuration);yield cH(b,c);NE(b.w,c);const e=a.map(n=>fH(b,n,0,null,!0)),f=yield Promise.all(e);b.P=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=
|
|
292
|
+
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 _.GI({version:2},null,0,null==h),l=f.map(n=>sD(n.manifest)),m=vD(l,k);b.f=m;b.A=yield jH(b,m,b.configuration);NE(b.w,c);yield wH(b,c);NE(b.w,c);MF(b.a,m);xH(b,m);c.resolve()}catch(d){yield yH(b),AH(b,d,c)}})}appendLoad(a){const b=this;return _.v(function*(){RG(b);if(b.S!==_.ab)throw new _.J(_.C,
|
|
293
|
+
7,7003,"Cannot append-load to non-playlist player.");const c=yield CH(b,a);b.f=c.manifest;c.parser&&b.P.push(c.parser);MF(b.a,c.manifest);WF(b.a)&&b.a.resume();xH(b,c.manifest)})}seekWith(a){return this.seek(this.getPosition()+a)}ah(){const a=this;return _.v(function*(){RG(a);a.Be?(a.log.info("Loading preloaded asset",a.Be),a.Be=null,yield wH(a,null)):a.log.warn("No preloaded asset found")})}preload(a){const b=this;return _.v(function*(){RG(b);_.Nn("preload.start");b.log.info("Preloading asset",a);
|
|
294
|
+
yield MH(b,a,!1);b.Be=a;b.log.info("Preloaded asset",a);_.Nn("preload.end");_.Pn("preload","preload.start","preload.end")})}load(a){return MH(this,a)}detach(){const a=this;return _.v(function*(){yield SG(a);a.configuration=a.ja;TG(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&&XH(this);TH(this)}getSeekRange(){var a={start:0,end:0};if(this.f){var b=this.f.presentationTimeline;
|
|
295
|
+
a={start:nC(b),end:xC(b)}}b=this.Kc;b.a?(b=b.a.getDuration(),b>a.end&&(b=a.end),b={start:0,end:b}):b=a;return b}Fc(){return this.f?this.f.presentationTimeline.Fc():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===LG){if(_.Qh()){this.log.warn("Pausing and unpausing to mitigate playbackRate platform issue.");const c=this.getSurface().getMedia();c.pause();this.H.set(a,b);
|
|
296
|
+
c.play()}else this.H.set(a,b);(b=this.H.getConfiguration())&&b.preferTrickPlayTracks&&FF(this.a,1<Math.abs(a));this.h.playbackRateChanged(a)}}bd(){if(!this.f||!this.B)return[];const a=kI(this),b=lI(this),c=[];for(const d of nI(this)){const e=CE(d);e.ee=d.video===a;e.de=d.audio===b;c.push(e)}return c}sa(){if(this.f&&this.B){var a=PD(this);if(null==a)a=null;else{if(!QD(this.l,a).text){var b=_.GE(a.textStreams,this.zc,this.gd,this.xc);b.length&&PE(this.l,a,b[0])}a=QD(this.l,a).text}b=[];for(const c of oI(this)){const d=
|
|
297
|
+
DE(c);d.Le=c===a;b.push(d)}return b}return[]}getPeriods(){return this.f.periods}getStats(){if(this.G!==LG)return _.$o();TH(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===LG){(c=PD(this))?(a=QD(this.l,c).video,c=QD(this.l,c).audio,a=((a?a.bandwidth:0)||0)+((c?c.bandwidth:0)||0)):a=null;a&&(this.F.w=a);if(b=kI(this))a=this.F,c=b.height||NaN,a.A=b.width||NaN,a.j=c;a=this.h.getBandwidthEstimate();
|
|
298
|
+
this.F.h=a}return this.F.getStats()}getBandwidthEstimate(){return this.h.getBandwidthEstimate()}getCueTimeline(){return this.J}getTimelineCues(){return this.J?CC(this.J,QH(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!==LG)throw g.log.error("Must call load() and wait for it to resolve before adding text tracks."),Error("State error!");const h=PD(g);var k=g.f.periods.indexOf(h)+1;const l=(k>=g.f.periods.length?g.f.presentationTimeline.getDuration():
|
|
299
|
+
g.f.periods[k].startTime)-h.startTime;if(Infinity===l)throw new _.J(1,4,4040);const m=new _.CI(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:_.UA,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,
|
|
300
|
+
roles:[],channelsCount:null,spatialAudio:!1,closedCaptions:null};g.md.add(k);h.textStreams.push(k);yield wF(g.a,k);const n=_.tF(g.a,_.I);n&&PE(g.l,h,n);g.md.delete(k);g.log.debug("Choosing new streams after adding a text stream");sI(g,h);hH(g);return DE(k)})}ih(a){this.log.debug(_.YA,a.id);try{this.log.debug("onChooseStreams_, choosing variant from ",a.variants);this.log.debug("onChooseStreams_, choosing text from ",a.textStreams);const b=tI(this,a);this.log.debug("onChooseStreams_, chose video ",
|
|
301
|
+
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,kb:null}}}jh(){const a=this;return _.v(function*(){a.log.debug("onCanSwitch_");a.configuration.abr.enabled&&a.h.enable();a.da&&(yield GF(a.a,a.da,a.fh,a.eh),a.da=null);a.W&&(yield _.KF(a.a,a.W),a.W=null)})}oh(){const a=PD(this);a&&a.parser&&a.parser.update()}lh(){this.B&&this.B.j.ze()}hh(a,b,c){if((void 0===
|
|
302
|
+
c?"":c)===WA)return hH(this),this.va()||(this.configuration.abr.enabled=!0,this.h.enable()),sI(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)}hH(this);this.va()||(this.configuration.abr.enabled=!0,this.h.enable());sI(this,b)}return c}kh(){this.log.debug("endOfStream called by streaming engine");
|
|
303
|
+
this.Ic=!0}onError(a){if(this.G!==XG&&7001!==a.code&&7E3!==a.code){var b=new _.H(_.Sd,{detail:a});a.severity===_.C&&oD(this.eb,3);this.trigger(b);b.defaultPrevented&&(b.a=!0)}}Df(a){a.type===_.Kd?this.dispatchEvent(a):"largegap"!==a.type&&(a.type===_.Ag?HH(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(),
|
|
304
|
+
d=b.va();if(c=yield b.Rc(c.url,a)){c=_.Xg(b.getLoadedSource(),{url:c});d&&b.h.disable();yield XF(b.a);var e=kI(b),f=lI(b);do{var g=!1;try{b.log.info(`Switching CDN to ${c.url}.`),yield uI(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();UF(b.a,!0);b.ia[b.getSourceIndex()]=c;a.f=!0;b.trigger(new _.H(_.Uc,{newManifest:c.url}))}}})}},XG=0,GH=1,LG=2,gH=[_.Me,_.be];var UI=class extends _.Uv{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===EA&&(this.a=c)}this.a||(this.a=a.addTextTrack(_.fB,EA));this.a.mode=_.Yd}getClass(){return dB}isRenderer(){return!1}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=_.Ki(e);e=new VTTCue(d.startTime,d.endTime,
|
|
305
|
+
e);e.line=-1;try{e.align=_.Wc}catch(f){e.align="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;AI(this.a,c=>c.startTime<b&&c.endTime>a);return!0}isTextVisible(){return this.a.mode===_.Ef}setTextVisibility(a){null!==
|
|
306
|
+
this.a&&(this.a.mode=a?_.Ef:_.Yd)}destroy(){this.a&&AI(this.a,()=>!0);this.a=null;return Promise.resolve()}};var VI=class{a(){return!0}create(a){return new UI(a)}};_.vh(new class{a(){return OA}canPlay(a,b){if(_.Yh())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 _.Mt||_.Fj(a.url)in _.Nt?!0:!1:!1;if(d&&a){if(_.Qh(2))return 1;if(_.Zh()&&c===_.lm){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===
|
|
307
|
+
_.oa||a===_.ab}create(){return new TI}});_.To(dB,new VI);
|
|
308
|
+
_.rr(function(){_.rh("MediaSource.install");if(window.MediaSource)if(window.cast&&cast.__platform__&&cast.__platform__.canDisplayType)_.qh("Patching Chromecast MSE bugs."),vI();else if(_.Zh()){var a=navigator.appVersion;a=0<=a.indexOf("Version")?parseInt(a.match(/Version\/(\d+)/)[1],10):13;wI();10>=a?(_.qh("Blacklisting MSE on Safari \x3c\x3d 10."),window.MediaSource=null):12>=a?(_.qh("Patching Safari 11 \x26 12 MSE bugs."),xI(),yI()):(_.qh("Patching Safari 13 MSE bugs."),xI())}else _.Qh(2)||_.Qh(3)||
|
|
309
|
+
_.Qh(4)?zI():_.qh("Using native MSE as-is.");else _.qh("No MSE implementation available.")});};f.call(g, window);
|