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