@castlabs/prestoplay 6.6.1 → 6.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -1
- package/cjs/cl.adobe.js +3 -3
- package/cjs/cl.airplay.js +3 -3
- package/cjs/cl.broadpeak.js +6 -6
- package/cjs/cl.cast.js +110 -110
- package/cjs/cl.conviva.js +33 -33
- package/cjs/cl.core.js +423 -423
- package/cjs/cl.crypto.js +10 -10
- package/cjs/cl.dash.js +71 -71
- package/cjs/cl.externs.js +47 -41
- package/cjs/cl.freewheel.js +24 -24
- package/cjs/cl.hls.js +68 -49
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +31 -31
- package/cjs/cl.ima.js +24 -23
- package/cjs/cl.mse.js +263 -260
- package/cjs/cl.muxdata.js +11 -12
- package/cjs/cl.onboard.js +3 -3
- package/cjs/cl.persistent.js +14 -14
- package/cjs/cl.playlist.js +6 -6
- package/cjs/cl.smooth.js +71 -71
- package/cjs/cl.thumbnails.js +23 -23
- package/cjs/cl.tizen.js +71 -71
- package/cjs/cl.ttml.js +27 -27
- package/cjs/cl.verimatrix.js +5 -5
- package/cjs/cl.vimond.js +13 -13
- package/cjs/cl.vr.js +19 -19
- package/cjs/cl.vtt.js +14 -14
- package/cjs/cl.youbora.js +19 -19
- package/cl.adobe.js +3 -3
- package/cl.airplay.js +3 -3
- package/cl.broadpeak.js +5 -5
- package/cl.cast.js +88 -88
- package/cl.conviva.js +27 -27
- package/cl.core.js +346 -344
- package/cl.crypto.js +8 -8
- package/cl.dash.js +67 -67
- package/cl.externs.js +47 -41
- package/cl.freewheel.js +19 -19
- package/cl.hls.js +57 -40
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +25 -25
- package/cl.ima.js +17 -16
- package/cl.mse.js +228 -228
- package/cl.muxdata.js +9 -8
- package/cl.onboard.js +4 -4
- package/cl.persistent.js +10 -10
- package/cl.playlist.js +5 -5
- package/cl.smooth.js +58 -59
- package/cl.thumbnails.js +17 -17
- package/cl.tizen.js +57 -57
- package/cl.ttml.js +22 -22
- package/cl.verimatrix.js +4 -4
- package/cl.vimond.js +8 -8
- package/cl.vr.js +15 -15
- package/cl.vtt.js +12 -12
- package/cl.youbora.js +14 -14
- package/package.json +1 -1
- package/typings.d.ts +108 -7
package/cjs/cl.mse.js
CHANGED
|
@@ -1,267 +1,270 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
_.
|
|
6
|
-
_.
|
|
7
|
-
_.
|
|
8
|
-
c?'CHECKSUM\x3d"'+c+'" ':"",'VALUE\x3d"'+e+'"',"\x3e\x3c/KID\x3e\x3c/PROTECTINFO\x3e",d?
|
|
9
|
-
b,d||null,e,a,c)};_.
|
|
10
|
-
|
|
11
|
-
_.
|
|
12
|
-
|
|
13
|
-
_.Qv=function(a,b
|
|
14
|
-
Rv=function(a){
|
|
15
|
-
_.
|
|
16
|
-
|
|
17
|
-
_.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
_.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
_.kw=function(a,b,c){
|
|
24
|
-
_.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
Gw=function(a
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
a
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
Ww=function(a){
|
|
39
|
-
|
|
40
|
-
return
|
|
41
|
-
e
|
|
42
|
-
q
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
nx=function(a,b,c){
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
2
|
+
var f=function(window){var Vu,Wu,Xu,Yu,Zu,$u,av,bv,cv,dv,gv,hv,kv,lv,mv,nv,ov,pv,rv,uv,vv,wv,xv,yv,Av,Bv,Cv,Hv,Iv,Jv,Kv,Mv,Rv,Sv,Uv,Xv,Yv,$v,aw,cw,dw,ew,fw,gw,nw,rw,uw,tw,vw,ww,xw,yw,Cw,Fw,Ew,Gw,Hw,Kw,Lw,Mw,Nw,Pw,Rw,Tw,Sw,Uw,Xw,Vw,Zw,$w,ax,cx,bx,dx,fx,gx,ix,hx,kx,ex,lx,jx,mx,sx,px,nx,qx,rx,tx,ux,xx,wx,yx,zx,Ax,ox,Bx,Dx,vx,Ex,Fx,Gx,Hx,Ix,Jx,Kx,Lx,Nx,Ox,Mx,Wx,Vx,Xx,Yx,Zx,ay,by,dy,cy,ey,hy,fy,gy,jy,iy,ky,ly,oy,qy,py,ry,sy,ty,uy,wy,xy,yy,vy,Ay,zy,Ey,Fy,Hy,Dy,Cy,Iy,By,Gy,My,Oy,Ly,Py,Ky,Ny,Jy,Ry,Qy,Ty,Vy,Xy,Yy,cz,fz,hz,mz,pz,
|
|
3
|
+
jz,rz,az,sz,Zy,qz,vz,tz,kz,oz,yz,xz,uz,Iz,Ez,Fz,zz,Jz,Az,Cz,Mz,Lz,Dz,Kz,Nz,$y,iz,Bz,nz,bz,dz,ez,Oz,Pz,Gz,lz,Hz,Sz,Tz,Uz,$z,Yz,Xz,Wz,Zz,bA,fA,mA,xA,eA,rA,sA,tA,nA,uA,kA,AA,Sx,Qx,Tx,Rx,Ux,Px,FA,DA,pA,lA,wA,GA,EA,IA,vA,yA,aA,oA,JA,jA,zA,MA,qA,iA,LA,KA,cA,HA,CA,OA,gA,BA,NA,PA,dA,QA,RA,SA,TA,UA,VA,WA,XA,YA,Dv;Vu=" buffer";Wu=" is being or has been set up";Xu="\x3c/DATA\x3e\x3c/WRMHEADER\x3e";Yu="\x3c/LA_URL\x3e";Zu="\x3cLA_URL\x3e";$u='\x3cWRMHEADER xmlns\x3d"http://schemas.microsoft.com/DRM/2007/03/PlayReadyHeader" version\x3d"';
|
|
4
|
+
av="Choosing new streams after key status change";bv="IterateSegmentReference";cv="Jumping forward";dv="MediaSource threw QuotaExceededError:";_.ev="No stream with id";_.fv="Player is in ERROR state and can not switch to ";gv="PrestoPlay TextTrack";hv="Removing audio from variant - audio not compatible with platform";_.iv="Updating manifest...";_.jv="VOD";kv="bufferBehind\x3d";lv="bufferedBehind\x3d";mv="calling onCanSwitch()...";nv="cannot find segment";ov="clpp.mse.Player";pv="currentPeriod.startTime\x3d";
|
|
5
|
+
_.qv="getSegmentNextReference";rv="key-restriction";_.sv="onChooseStreams_";uv="presentationTime:";vv="presentationTime\x3d";wv="reference.endTime\x3d";xv="reference.position\x3d";yv="reference.startTime\x3d";_.zv="subtitles";Av="switch: Stream ";Bv=function(a,b){for(var c in a.a)b(c,a.a[c])};Cv=function(a){for(var b=a.a;_.Hk(a)&&0!==a.f.getUint8(a.a);)a.a+=1;b=a.f.buffer.slice(b,a.a);a.a+=1;return _.wh(b)};
|
|
6
|
+
_.Ev=function(a){var b=new Uint8Array(Dv),c=4+b.byteLength+a.j.byteLength+4+a.f.byteLength,d=new _.Dk(c,!1);_.S(d,c);_.Fk(d,b);_.Fk(d,a.j);_.S(d,a.f.byteLength);_.Fk(d,a.f);return _.N(d.buffer)};
|
|
7
|
+
_.Fv=function(a,b,c,d){var e=_.Oh(b);if(8!==e.byteLength)e="";else{var f=_.Nl(e);e=_.Lh(f);b:switch(f=f.byteLength,_.Tf("Trying to create PlayReady header in version",a),a){case "4.0.0.0":e=[$u+a+'"\x3e',"\x3cDATA\x3e\x3cPROTECTINFO\x3e","\x3cKEYLEN\x3e"+f+"\x3c/KEYLEN\x3e","\x3cALGID\x3eAESCTR\x3c/ALGID\x3e\x3c/PROTECTINFO\x3e","\x3cKID\x3e"+e+"\x3c/KID\x3e",c?"\x3cCHECKSUM\x3e"+c+"\x3c/CHECKSUM\x3e":"",d?Zu+d+Yu:"",Xu].join("");break b;case "4.1.0.0":e=[$u+a+'"\x3e','\x3cDATA\x3e\x3cPROTECTINFO\x3e\x3cKID ALGID\x3d"AESCTR" ',
|
|
8
|
+
c?'CHECKSUM\x3d"'+c+'" ':"",'VALUE\x3d"'+e+'"',"\x3e\x3c/KID\x3e\x3c/PROTECTINFO\x3e",d?Zu+d+Yu:"",Xu].join("");break b;case "4.2.0.0":case "4.3.0.0":e=[$u+a+'"\x3e','\x3cDATA\x3e\x3cPROTECTINFO\x3e\x3cKIDS\x3e\x3cKID ALGID\x3d"AESCTR" ',c?'CHECKSUM\x3d"'+c+'" ':"",'VALUE\x3d"'+e+'"',"\x3e\x3c/KID\x3e\x3c/KIDS\x3e\x3c/PROTECTINFO\x3e",d?Zu+d+Yu:"",Xu].join("");break b;default:_.G("Cannot create PlayReady header in version",a),e=""}}if(!e)return null;_.Tf("New payload",e);e=_.N(_.Bh(e,!0));return new _.Kl(_.Ol,
|
|
9
|
+
b,d||null,e,a,c)};_.Gv=function(a,b){return b===a.version?a:_.Fv(b,a.a,a.m||void 0,a.g||void 0)};Hv=function(a,b){a:{if(b){var c=_.u(a.f.keys());for(var d=c.next();!d.done;d=c.next()){d=a.f.get(d.value);for(var e=0;e<d.fb.length;e++)if(d.fb[e]===b){c=d;break a}}}c=null}return c?c.Da:null};Iv=function(a,b){return _.dj("Edge/")?!0:a.M.has(b)};Jv=function(a,b){var c=a.m.get(b);return!(!c||c!==_.Ud&&c!==_.pd)};
|
|
10
|
+
Kv=function(a,b){var c=b.audio,d=b.video;if(c&&c.encrypted&&!Iv(a,_.Yi(c.mimeType,c.codecs))||d&&d.encrypted&&!Iv(a,_.Yi(d.mimeType,d.codecs)))return!1;var e=a.keySystem();return 0==b.drmInfos.length||b.drmInfos.some(function(f){return f.keySystem==e})};_.Lv=function(a,b){return a.concat(b)};Mv=function(){};
|
|
11
|
+
_.Nv=function(a,b){if(0==b.length)return a;var c=b.map(function(d){return new _.Lg(d)});return a.map(function(d){return new _.Lg(d)}).map(function(d){return c.map(d.resolve.bind(d))}).reduce(_.Lv,[]).map(function(d){return d.toString()})};_.Ov=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:b||[],keyIds:[],periodId:c?c:null}};
|
|
12
|
+
_.Pv=function(a,b,c,d,e){this.Ka=a;this.sa=b;this.ea=c;this.keyInfo=d||null;this.Fc=_.K.R(e)?!1:!!e};
|
|
13
|
+
_.Qv=function(a,b,c,d,e,f,g,h,l,m,n,p,q,r){l=void 0===l?!1:l;m=void 0===m?null:m;n=void 0===n?null:n;p=void 0===p?null:p;q=void 0===q?null:q;r=void 0===r?[]:r;this.position=a;this.startTime=b;this.endTime=c;this.Na=g;this.Ka=d;this.sa=e;this.ea=f;this.keyInfo=(void 0===h?null:h)||null;this.Fc=_.K.R(l)?!1:!!l;this.timescale=m;this.horizontalTiles=n;this.verticalTiles=p;this.durationPerTile=q;this.a=r||[];this.g=!1};
|
|
14
|
+
Rv=function(a,b){a=_.gh(a);b=_.gh(b);var c=a.split("-"),d=b.split("-");return c[0]==d[0]&&1==c.length&&2==d.length};Sv=function(a){return a.language?_.gh(a.language):a.audio&&a.audio.language?_.gh(a.audio.language):a.video&&a.video.language?_.gh(a.video.language):_.Ie};
|
|
15
|
+
_.Tv=function(a,b){for(var c=_.gh(a),d=new Set,e=_.u(b),f=e.next();!f.done;f=e.next())d.add(_.gh(f.value));e=_.u(d);for(f=e.next();!f.done;f=e.next())if(f=f.value,f==c)return f;e=_.u(d);for(f=e.next();!f.done;f=e.next())if(f=f.value,Rv(f,c))return f;e=_.u(d);for(f=e.next();!f.done;f=e.next()){var g=f=f.value,h=c;g=_.gh(g);h=_.gh(h);g=g.split("-");h=h.split("-");if(2==g.length&&2==h.length&&g[0]==h[0])return f}d=_.u(d);for(f=d.next();!f.done;f=d.next())if(e=f.value,Rv(c,e))return e;return null};
|
|
16
|
+
Uv=function(a,b){for(var c in b)if(b[c]===a)return c;return""};
|
|
17
|
+
_.Vv=function(a,b){if(!a.length)return b;if(!b.length)return a;for(var c=[],d=0;d<a.length;d++)for(var e={},f=0;f<b.length;e={Tc:e.Tc},f++)if(a[d].keySystem===b[f].keySystem&&a[d].periodId===b[f].periodId){var g=a[d];f=b[f];var h=[];h=h.concat(g.initData||[]);h=h.concat(f.initData||[]);e.Tc=_.nf(g.keyIds||[]).concat();f.keyIds&&f.keyIds.length&&f.keyIds.forEach(function(l){return function(m){l.Tc.includes(m)||l.Tc.push(m)}}(e));c.push({keySystem:g.keySystem,licenseServerUri:g.licenseServerUri||f.licenseServerUri,
|
|
18
|
+
distinctiveIdentifierRequired:g.distinctiveIdentifierRequired||f.distinctiveIdentifierRequired,persistentStateRequired:g.persistentStateRequired||f.persistentStateRequired,videoRobustness:g.videoRobustness||f.videoRobustness,audioRobustness:g.audioRobustness||f.audioRobustness,serverCertificate:g.serverCertificate||f.serverCertificate,initData:h,keyIds:e.Tc,periodId:g.periodId});break}return c};_.Wv=function(a,b){return a.length&&b.length?0<_.Vv(a,b).length:!0};
|
|
19
|
+
Xv=function(a,b){for(var c=0,d=_.u(a),e=d.next();!e.done;e=d.next())c+=b(e.value)?1:0;return c};Yv=function(a){var b=[a.mimeType];_.Cq.forEach(function(c,d){var e=a[d];e&&b.push(c+'\x3d"'+e+'"')});return b.join(";")};_.Zv=function(a){a=a.split(".");var b=a[0];a.pop();return[b,a.join(".")]};$v=function(a,b){for(var c=new _.ak(void 0,void 0===b?"total":b),d=_.u(a),e=d.next();!e.done;e=d.next())c.a.push(e.value);c.length=a.length;return c};aw=function(a,b){return a.start-b.start};
|
|
20
|
+
_.bw=function(a){this.m=a;this.log=new _.H("clpp.renditions");this.U=[];this.j=this.a=null;this.g=!1};cw=function(a){return a.U.map(function(b){return{start:b.start,end:b.end,width:b.width,height:b.height,bandwidth:b.bandwidth,rendition:b.rendition}})};dw=function(a){a.a&&a.a.trigger(new _.I(_.sc))};
|
|
21
|
+
ew=function(a){if(a.a){for(var b=!1,c={},d=0;d<a.U.length;d++){var e=a.U[d],f=e.width+"x"+e.height,g=c[f];if(g&&g!==e.bandwidth){b=!0;break}c[f]=e.bandwidth}b&&!a.g?(a.log.debug("Tracking timeupdates"),a.a.on(_.Fe,a.f,a),a.g=!0):!b&&a.g&&(a.log.debug("Stop tracking timeupdates"),a.a.off(_.Fe,a.f),a.g=!1)}};fw=function(a,b,c){a.U=a.U.filter(function(d){if(d.end<=b||d.start>=c)return!1;d.start=Math.max(d.start,b);d.end=Math.min(d.end,c);return!0});a.a&&a.a.trigger(new _.I(_.Ue))};
|
|
22
|
+
gw=function(a,b){for(var c=null,d=_.u(a),e=d.next();!e.done;e=d.next())e=e.value,b>=e.startTime&&(c=e);return c};_.hw=function(a){this.g=Math.exp(Math.log(.5)/a);this.f=this.a=0};_.iw=function(a,b,c){var d=Math.pow(a.g,b);c=c*(1-d)+d*a.a;isNaN(c)||(a.a=c,a.f+=b)};_.jw=function(a){return a.a/(1-Math.pow(a.g,a.f))};
|
|
23
|
+
_.kw=function(a,b,c,d,e,f,g,h){a=_.Zh(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};
|
|
24
|
+
_.lw=function(a,b,c,d){var e=void 0===e?!1:e;this.A=a;this.F=b;this.m=this.f=Infinity;this.a=1;this.B=0;this.g=this.j=null;this.D=0;this.w=this.o=c;this.I=void 0===d?!0:d;this.h=new _.H("clpp.media.PresentationTimeline");this.H=e};_.mw=function(a,b){a.o=b;a.w=b};nw=function(a){return a.o?a.f:a.w?a.g:null};
|
|
25
|
+
_.pw=function(a,b,c){if(0!=b.length){var d=b[b.length-1].endTime+c;_.ow(a,b[0].startTime+c);a.a=b.reduce(function(e,f){return Math.max(e,f.endTime-f.startTime)},a.a);a.g=Math.max(a.g||0,d);null!=a.A&&a.I&&(a.A=(Date.now()+a.D)/1E3-(a.g||0)-a.a);a.h.debug("notifySegments: maxSegmentDuration\x3d"+a.a)}};_.ow=function(a,b){a.j=null==a.j?b:Math.min(a.j,b)};_.qw=function(a,b){a.a=Math.max(a.a,b);a.h.debug("notifyNewSegmentDuration: maxSegmentDuration\x3d"+a.a)};
|
|
26
|
+
_.sw=function(a){return Infinity==a.m?0:Math.max(0,rw(a)-a.m)};rw=function(a){if(a.o)a=a.f;else if(a.w)a=a.g||0;else{var b=(Date.now()+a.D)/1E3;a=Math.min(a.H?Math.max(0,b-(a.a-a.B)-a.A):Math.max(0,b-a.a-a.A),a.f)}return a};uw=function(a,b){var c=Math.max(a.j,0);return Infinity==a.m?Math.ceil(1E3*c)/1E3:Math.max(c,Math.min(rw(a)-a.m+b,tw(a)))};tw=function(a){return Math.max(0,rw(a)-(a.o||a.w?0:a.F))};vw=function(){this.f=function(){};this.a=new Set};ww=function(a,b){a.f=b};
|
|
27
|
+
xw=function(a,b,c){this.g=a;this.a=b;this.f=c;this.h=new _.H("clpp.media.SegmentIterator")};yw=function(a){var b=a.g.get(a.a);if(!b)return null;0<b.a.length&&b.Ka().length&&a.f>=b.a.length&&(a.a+=1,a.f=0,b=a.g.get(a.a));return b&&0<b.a.length?b.a[a.f]||null:b};_.zw=function(a){this.a=a;this.h=new _.H("clpp.media.SegmentIndex")};_.Aw=function(a){return a.a.length?a.a[a.a.length-1].endTime:0};_.Bw=function(a,b){for(var c=0;c<a.a.length;++c)if(a.a[c].endTime>b)return a.a.splice(0,c);c=a.a;a.a=[];return c};
|
|
28
|
+
Cw=function(a,b){var c=a.Dc(b);c=null===c?-1:c-1;var d=a.get(c+1),e=-1;if(d&&0<d.a.length)for(var f=d.a.length-1;0<=f;--f){var g=d.a[f];if(b>=g.startTime&&b<g.endTime){for(;f&&!g.g;)--f,g=d.a[f];if(!g.g)break;c+=1;e=f-1;break}}return new xw(a,c,e)};_.Dw=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)};Fw=function(a){var b=this;this.f=a;this.a=new Set;this.g=(new _.aj(function(){Ew(b,!1)})).eb(.25)};
|
|
29
|
+
Ew=function(a,b){for(var c=_.u(a.a),d=c.next();!d.done;d=c.next())d.value.o(a.f.currentTime,b)};
|
|
30
|
+
Gw=function(a){var b=this;this.m=a;this.j=new Map;this.a=function(){};this.f=function(){};this.g=function(){};this.w=[{pc:null,oc:2,dc:function(c,d){return b.a(c,d)}},{pc:1,oc:2,dc:function(c,d){return b.a(c,d)}},{pc:3,oc:2,dc:function(c,d){return b.a(c,d)}},{pc:2,oc:1,dc:function(c,d){return b.f(c,d)}},{pc:2,oc:3,dc:function(c,d){return b.f(c,d)}},{pc:1,oc:3,dc:function(c,d){return b.g(c,d)}},{pc:3,oc:1,dc:function(c,d){return b.g(c,d)}}]};Hw=function(a,b,c,d){a.a=b;a.f=c;a.g=d};
|
|
31
|
+
_.Iw=function(a){_.Hp[a]&&delete _.Hp[a]};_.Jw=function(a){_.Fp[a]&&delete _.Fp[a]};Kw=function(a,b){this.w=null;this.D=a;this.g=b;this.j=this.A=0;this.m=Infinity;this.f=this.a=null;this.B="";this.o=new Map};
|
|
32
|
+
Lw=function(a,b,c,d){return Promise.resolve().then(function(){if(a.w&&a.g)if(null==c||null==d)a.w.parseInit(_.N(b));else{var e={periodStart:a.A,segmentStart:c,segmentEnd:d};e=a.w.parseMedia(_.N(b),e);var f=e.cues.filter(function(g){return g.startTime>=a.j&&g.startTime<a.m});a.g.append(f,e.styles);null==a.a&&(a.a=Math.max(c,a.j));a.f=Math.min(d,a.m)}})};
|
|
33
|
+
Mw=function(a,b,c){a.B=b;if(b=a.o.get(b))for(var d=_.u(b.keys()),e=d.next();!e.done;e=d.next())if(e=b.get(e.value))e=e.filter(function(f){return f.endTime<=c}),a.g.append(e,[])};
|
|
34
|
+
Nw=function(a,b,c,d,e){var f=c+" "+d,g=new Map;b=_.u(b);for(var h=b.next();!h.done;h=b.next()){var l=h.value;h=l.stream;g.has(h)||g.set(h,new Map);g.get(h).has(f)||g.get(h).set(f,[]);l.startTime+=e;l.endTime+=e;l.startTime>=a.j&&l.startTime<a.m&&(l=new _.zg(l.startTime,l.endTime,l.text),g.get(h).get(f).push(l),h==a.B&&a.g.append([l],[]))}e=_.u(g.keys());for(f=e.next();!f.done;f=e.next())for(f=f.value,a.o.has(f)||a.o.set(f,new Map),b=_.u(g.get(f).keys()),h=b.next();!h.done;h=b.next())h=h.value,l=g.get(f).get(h),
|
|
35
|
+
a.o.get(f).set(h,l);a.a=null==a.a?Math.max(c,a.j):Math.min(a.a,Math.max(c,a.j));a.f=Math.max(a.f,Math.min(d,a.m))};_.Ow=function(a){a=a.toLowerCase();return _.bq[a]||window.muxjs&&a==_.dc?!0:!1};Pw=function(){this.a=new muxjs.mp4.CaptionParser;this.m=[];this.j={}};_.Qw=function(){};Rw=function(){this.a=new muxjs.mp4.Transmuxer({keepOriginalTimestamps:!0,remux:!1});this.f=null;this.o=[];this.m=[];this.g=[];this.j=!1;this.a.on("data",this.A.bind(this));this.a.on("done",this.w.bind(this))};
|
|
36
|
+
Tw=function(a,b){return!window.muxjs||"mp2t"!=a.toLowerCase().split(";")[0].split("/")[1]&&"aac"!=a.toLowerCase().split(";")[0].split("/")[1]?!1:b?MediaSource.isTypeSupported(Sw(b,a))||MediaSource.isTypeSupported(a.replace(/aac/i,_.Hd)):MediaSource.isTypeSupported(Sw(_.lc,a))||MediaSource.isTypeSupported(a.replace(/aac/i,_.Hd))||MediaSource.isTypeSupported(Sw(_.Re,a))};
|
|
37
|
+
Sw=function(a,b){var c=b.replace(/mp2t/i,_.Hd);a==_.lc&&(c=c.replace(_.Re,_.lc));var d=/avc1\.(66|77|100)\.(\d+)/.exec(c);if(d){var e="avc1.",f=d[1],g=Number(d[2]);e=("66"==f?e+"4200":"77"==f?e+"4d00":e+"6400")+(g>>4).toString(16);e+=(g&15).toString(16);c=c.replace(d[0],e)}return c};Uw=function(a,b){a.j=!0;a.f=new _.di;a.o=[];a.m=[];a.g=[];var c=_.N(b);a.a.push(c);a.a.flush();a.j&&a.f.reject(new _.L(_.M,3,3018));return a.f};
|
|
38
|
+
_.Ww=function(a,b,c,d,e){this.j=a;this.A=c;this.a={};this.J=!1;this.f=null;this.g={};this.o=new _.eg;this.I=!1;this.w={};this.F=b;this.B=d;this.K=e;this.M=this.K.streaming.maxSegmentToMediaOffset||1;this.H=new _.di;this.D={};this.m=Vw(this,this.H);this.h=new _.H("clpp.mse.MediaSourceEngine")};Xw=function(a){var b=_.Yi(a.mimeType,a.codecs),c=Yv(a);return _.Ow(b)||MediaSource.isTypeSupported(c)||Tw(b,a.type)};
|
|
39
|
+
Vw=function(a,b){var c=new MediaSource,d=Yw(c);a.o.one(c,"sourceopen",function(){URL.revokeObjectURL(d);b.resolve()});a.j.src=d;return c};Zw=function(a,b){b.forEach(function(c,d){var e=a.m.addSourceBuffer(c);a.o.on(e,_.jd,a.S.bind(a,d));a.o.on(e,"updateend",a.Pc.bind(a,d));a.a[d]=e;a.g[d]=[];a.D[d]=!1});a.J=b.has(_.lc)&&b.has(_.Re)};$w=function(a,b){a.f||(a.f=new Kw(a.K,a.A));var c=a.f;if(b!=_.dc){var d=_.bq[b];if(!d)throw new _.L(_.M,2,2012,"Text parser is unavailable for "+b);c.w=new d(c.D)}};
|
|
40
|
+
ax=function(a){return a.m?a.m.readyState==_.id:!0};cx=function(a){var b={};b.total=new _.ak(a.j.buffered,"total");b.audio=bx(a,_.lc);b.video=bx(a,_.Re);var c=[];a.f&&(c=[{start:a.f.tb(),end:a.f.Ba()}]);b.text=$v(c,_.Ce);return b};bx=function(a,b){try{return new _.ak(a.a[b].buffered,b)}catch(c){return b in a.a&&a.h.error("failed to get buffered range for "+b,c),null}};dx=function(a,b){if(!a.a[b])return"";var c=bx(a,b);return c?c.toString():""};
|
|
41
|
+
fx=function(a,b,c,d,e,f,g,h){h=void 0===h?!1:h;var l=a.a[b],m=-1,n=0;l&&l.buffered&&(n=l.buffered.length);b===_.Re&&null!==d&&null!==e&&h&&(m=0<n?l.buffered.end(n-1):-1);b==_.Ce?c=Lw(a.f,c,d,e):a.w[b]?c=Uw(a.w[b],c).then(function(p){p.captions&&0<p.captions.length&&(a.f||$w(a,_.De),Nw(a.f,p.captions,d,e,a.a.video.timestampOffset));var q=[];0<p.audio.byteLength&&a.a.audio&&q.push(ex(a,_.lc,a.we.bind(a,_.lc,p.audio.buffer)));0<p.video.byteLength&&a.a.video&&q.push(ex(a,_.Re,a.we.bind(a,_.Re,p.video.buffer)));
|
|
42
|
+
return Promise.all(q)}):(f&&window.muxjs&&(a.f||$w(a,_.De),null==d&&null==e?a.F.init(c):a.F.g(c,function(p){p.length&&Nw(a.f,p,d,e,a.a.video.timestampOffset)})),c=ex(a,b,a.we.bind(a,b,c)));return c.then(function(){if(b===_.Re&&null!==d&&null!==e&&!h)a.B.append(d,e,g),null!==d&&null!==e&&a.h.debug("Appended video segment ",d,e,"Buffer:",dx(a,b));else if(b===_.lc&&null!==d&&null!==e)dw(a.B),null!==d&&null!==e&&a.h.debug("Appended audio segment ",d,e,"Buffer:",dx(a,b));else if(b===_.Re&&null!==d&&null!==
|
|
43
|
+
e&&h){var p=l.buffered.length,q=0<p?l.buffered.end(p-1):-1;0>m&&0<p&&(m=l.buffered.start(0));0<=m&&0<q&&a.B.append(m,q,g)}if(!a.D[b]&&l&&1===l.buffered.length){p=l.buffered.start(0);var r=d-p;if(Math.abs(r)>a.M&&0===l.timestampOffset)return a.h.warn("Detected a delta of "+r+" between media times and segment times for "+(b+". The segment start time is ")+(d+" and the media start time is ")+(p+". Adjusting timestampOffset.")),p=ex(a,b,function(){a.Wg(b,r)}),q=ex(a,b,a.$f.bind(a,b,!1)),Promise.all([p,
|
|
44
|
+
q])}null!==d&&null!==e&&(a.D[b]=!0)})["catch"](function(p){throw p;})};gx=function(a,b){var c=a.Ba(_.Re)||0;Mw(a.f,b,c)};ix=function(a,b,c,d,e){if(b==_.Ce)return a.f.A=c,a=a.f,a.j=d,a.m=e,Promise.resolve();b=hx(a,b,c,d,e);a.J&&(b=b.concat(hx(a,_.lc,c,d,e)));return Promise.all(b)};hx=function(a,b,c,d,e){return[ex(a,b,a.jh.bind(a,b)),ex(a,b,a.Wg.bind(a,b,c)),ex(a,b,a.Sk.bind(a,b,d,e))]};kx=function(a,b){jx(a,function(){a.m.duration=b})};
|
|
45
|
+
ex=function(a,b,c){if(a.I)return Promise.reject();c={start:c,p:new _.di};a.g[b].push(c);1===a.g[b].length&&lx(a,b);return c.p};lx=function(a,b){var c=a.g[b][0];if(c)try{a.h.debug("Starting next operation for "+b),c.start()}catch(d){"QuotaExceededError"==d.name?c.p.reject(new _.L(_.M,3,3017,{type:b})):c.p.reject(new _.L(_.M,3,3015,{mediaError:d})),mx(a,b)}else a.h.debug("No more scheduled operations for "+b)};
|
|
46
|
+
jx=function(a,b){if(a.I)return Promise.reject();var c=[],d;for(d in a.a){var e=new _.di,f={start:function(g){g.resolve()}.bind(null,e),p:e};a.g[d].push(f);c.push(e);1==a.g[d].length&&f.start()}return Promise.all(c).then(function(){for(var g in a.a);try{b()}catch(m){var h=Promise.reject(new _.L(_.M,3,3015,{mediaError:m}))}for(var l in a.a)mx(a,l);return h},function(){for(var g in a.a)a.g[g].length&&a.g[g].shift();return Promise.reject()})};mx=function(a,b){a.g[b].shift();lx(a,b)};
|
|
47
|
+
sx=function(a,b,c,d){var e=a.periods.flatMap(function(n){return n.variants});if(b.length||c.length)e=nx(e,b,c);e=ox(e,d);if(1<a.periods.length){var f=function(n){n=n.split(".");var p=n[0];1<n.length&&(p+="."+n[1]);return p.toLowerCase()};b=[];c=_.u(a.periods);for(var g=c.next();!g.done;g=c.next()){d=new Set;g=_.u(g.value.variants);for(var h=g.next();!h.done;h=g.next())h=h.value,null!==h.audio&&d.add(f(h.audio.codecs));b.push(d)}var l=b[0];c={};for(d=1;d<b.length;c={fe:c.fe},d++)c.fe=b[d],l=new Set(_.nf(l).concat().filter(function(n){return function(p){return n.fe.has(p)}}(c)));
|
|
48
|
+
e=e.filter(function(n){return 0===l.size&&null===n.audio?!0:0<l.size&&null===n.audio?!1:l.has(f(n.audio.codecs))})}e=px(e);var m=qx(e);a=_.u(a.periods);for(e=a.next();!e.done;e=a.next())e=e.value,e.variants=e.variants.filter(function(n){if(rx(n)===m)return!0;_.Tf("Dropping Variant (better codec available)",n);return!1})};px=function(a){var b=new _.$f;a=_.u(a);for(var c=a.next();!c.done;c=a.next()){c=c.value;var d=rx(c);b.push(d,c)}return b};
|
|
49
|
+
nx=function(a,b,c){var d={};b=_.u(b);for(var e=b.next();!e.done;d={le:d.le},e=b.next())if(d.le=e.value,e=a.filter(function(f){return function(g){return g.video&&g.video.codecs.startsWith(f.le)}}(d)),e.length){a=e;break}d={};c=_.u(c);for(b=c.next();!b.done;d={de:d.de},b=c.next())if(d.de=b.value,b=a.filter(function(f){return function(g){return g.audio&&g.audio.codecs.startsWith(f.de)}}(d)),b.length){a=b;break}return a};
|
|
50
|
+
qx=function(a){var b="",c=Infinity;Bv(a,function(d,e){var f=e.reduce(function(g,h){return g+h.bandwidth||0},0)/e.length;_.Tf(_.Pc,d,"avg bandwidth",f);f<c&&(b=d,c=f)});return b};rx=function(a){var b="";a.video&&(b=_.Zv(a.video.codecs)[0]);var c="";a.audio&&(c=_.Zv(a.audio.codecs)[0]);return b+"-"+c};
|
|
51
|
+
tx=function(a,b,c){function d(f,g,h){return f>=g&&f<=h}var e=a.video;return e&&e.width&&e.height&&!(d(e.width,b.minWidth,Math.min(b.maxWidth,c.width))&&d(e.height,b.minHeight,Math.min(b.maxHeight,c.height))&&d(e.width*e.height,b.minPixels,b.maxPixels))||!d(a.bandwidth,b.minBandwidth,b.maxBandwidth)?!1:!0};ux=function(a,b,c){var d=!1;a=_.u(a);for(var e=a.next();!e.done;e=a.next()){e=e.value;var f=e.allowedByApplication;e.allowedByApplication=tx(e,b,c);f!=e.allowedByApplication&&(d=!0)}return d};
|
|
52
|
+
xx=function(a,b,c,d){var e=!1;d.variants=d.variants.filter(function(m){if(a&&a.da&&!Kv(a,m))return _.Tf("Dropping variant - not compatible with key system",m),!1;var n=m.audio,p=m.video;if(n&&!Xw(n)){var q=n.codecs;0<=n.codecs.indexOf("ec-3")?(_.Tf("Trying to use AC-3 for EC-3"),n.codecs=n.codecs.replace("ec-3","ac-3"),Xw(n)?_.Sf("Using AC-3 instead of EC-3 for",vx(n)):(n.codecs=q,_.Sf(hv,vx(n)),m.audio=null,e=!0,n=null)):(_.Sf(hv,vx(n)),m.audio=null,e=!0,n=null)}return p&&!Xw(p)?(_.Sf("Dropping variant - video not compatible with platform",
|
|
53
|
+
vx(p)),!1):n&&b&&!wx(n,b)?(_.Sf("Dropping variant - not compatible with active audio","active audio",vx(b),"variant.audio",vx(n)),!1):p&&c&&!wx(p,c)?(_.Sf("Dropping variant - not compatible with active video","active video",vx(c),"variant.video",vx(p)),!1):!0});if(e){for(var f=!1,g=!1,h=_.u(d.variants),l=h.next();!l.done;l=h.next())l=l.value,!f&&l.video&&l.audio&&(f=!0),g||l.audio||!l.video||(g=!0);f&&g&&(d.variants=d.variants.filter(function(m){return m.video&&!m.audio?(_.Sf("Dropping variant - not compatible with video + audio",
|
|
54
|
+
"variant.video",vx(m.video)),!1):!0}))}d.textStreams=d.textStreams.filter(function(m){var n=_.Ow(_.Yi(m.mimeType,m.codecs));n||_.Tf("Dropping text stream. Is not supported by the platform.",m);return n})};wx=function(a,b){return a.mimeType!=b.mimeType||a.codecs.split(".")[0]!=b.codecs.split(".")[0]?!1:!0};
|
|
55
|
+
yx=function(a){var 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);var g=c&&c.mimeType||null,h=b&&b.mimeType||null,l=[];b&&l.push(b.kind);c&&l.push(c.kind);l=l[0]||null;var m=new Set,n=new Set;if(b)for(var p=_.u(b.roles),q=p.next();!q.done;q=p.next())n.add(q.value);if(c)for(p=_.u(c.roles),q=p.next();!q.done;q=p.next())m.add(q.value);q=[c,b].map(function(r){return r?r.accessibility||[]:[]}).reduce(function(r,v){return r.concat(v)},[]);a={id:a.id,active:!1,type:"variant",
|
|
54
56
|
bandwidth:a.bandwidth,language:a.language,label:null,kind:l,width:null,height:null,frameRate:null,mimeType:g,audioMimeType:h,codecs:f.join(", "),audioCodec:d,videoCodec:e,primary:a.primary,roles:Array.from(m),audioRoles:Array.from(n),videoId:null,audioId:null,channelsCount:null,audioBandwidth:null,videoBandwidth:null,originalVideoId:null,originalAudioId:null,originalTextId:null,accessibility:q,keyId:c?c.keyId:b?b.keyId:null};c&&(a.videoId=c.id,a.originalVideoId=c.originalId,a.width=c.width||null,
|
|
55
57
|
a.height=c.height||null,a.frameRate=c.frameRate||null,a.videoBandwidth=c.bandwidth||null);b&&(a.audioId=b.id,a.originalAudioId=b.originalId,a.channelsCount=b.channelsCount,a.audioBandwidth=b.bandwidth||null,a.label=b.label,a.audioRoles=b.roles);return a};
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
_.
|
|
59
|
-
[]);return b.length?
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
d,null,["id","track"])}))||c.renditions.push(d);return a||d};
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
_.Q)a.f.set(b,c),
|
|
68
|
-
c),
|
|
69
|
-
|
|
70
|
-
a.
|
|
71
|
-
|
|
72
|
-
_
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
b.C.setPlaybackRate(b.a.chasingRate)):1<e&&c<=f&&(b.
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
b,a.a=d,a.
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
!g.
|
|
88
|
-
|
|
89
|
-
b;a.
|
|
90
|
-
|
|
91
|
-
h.start(l+1)-f;break a}h=null}h&&(e=Math.min(h+.1,e))}a.
|
|
92
|
-
|
|
93
|
-
a;if(0===g.length||!e)throw _.
|
|
94
|
-
|
|
95
|
-
b.start);b=_.
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
_.
|
|
100
|
-
var g=a.m[f];if(g&&g.
|
|
101
|
-
(
|
|
102
|
-
|
|
103
|
-
c)};
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
(a.m[b].O.resolve(),a.m[b].
|
|
108
|
-
|
|
109
|
-
e.value,a.o.get(m.id).O["catch"](function(){}),a.o.get(m.id).O.reject(),a.o["delete"](m.id);throw h;case 3:n=_.u(b);for(e=n.next();!e.done;e=n.next())p=e.value,q=a.o.get(p.id),q.
|
|
110
|
-
|
|
111
|
-
"need Period "+h,
|
|
112
|
-
1;b.
|
|
113
|
-
|
|
114
|
-
c),d=b.stream.segmentIterator.next().value),null===d&&a.
|
|
115
|
-
Math.max(0,c-1))),a=f||
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
0;
|
|
119
|
-
|
|
120
|
-
_.L&&
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
h,b).then(function(){return
|
|
126
|
-
|
|
127
|
-
a.C.
|
|
128
|
-
"Appending segment with "+(F.toFixed(3)+" - "+
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
f,f+h).then(function(){a.
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
h.variant.audio);h.text&&l.set(_.Ce,h.text);var m=_.u(a.
|
|
136
|
-
for(h=g.next();!h.done;h=g.next())h=h.value,(m=l.get(h))?(_.
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
c);c=a.C.
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
this.configuration.preferredAudioChannelCount);this.
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
{detail:{bufferedTimeMS:-1,reason:e}})):d===_.
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
a.
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
isNaN(a.configuration.suggestedPresentationDelay)||(a.log.info("Apply suggested presentation delay of: "+a.configuration.suggestedPresentationDelay),a.f.presentationTimeline.
|
|
155
|
-
|
|
156
|
-
if(n.length){n=a.getPeriods();for(var q=0;q<n.length;q++)for(var r=n[q],
|
|
157
|
-
(E.keyId+"'. Applying restrictions to "+
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
r}});a.isLive()&&a.configuration.streaming.enableLiveEdgeChasing&&(a.
|
|
162
|
-
h.next();!l.done;l=h.next())m=l.value,
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
d,"buffered to end",b,"state",a.getState()),
|
|
167
|
-
|
|
168
|
-
a.g.disable())};
|
|
169
|
-
|
|
170
|
-
b.id});f?(a.
|
|
171
|
-
|
|
172
|
-
e.audio.codecs.split(".")[0]){d=e.audio;a.
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
b).variant=c};
|
|
176
|
-
|
|
58
|
+
zx=function(a){return{id:a.id,active:!1,type:_.Ce,bandwidth:0,language:a.language,label:a.label,kind:a.kind||null,width:null,height:null,frameRate:null,mimeType:a.mimeType,audioMimeType:null,codecs:a.codecs||null,audioCodec:null,videoCodec:null,primary:a.primary,roles:a.roles,audioRoles:null,videoId:null,audioId:null,channelsCount:null,audioBandwidth:null,videoBandwidth:null,originalVideoId:null,originalAudioId:null,originalTextId:a.originalId,accessibility:a.accessibility,keyId:null}};
|
|
59
|
+
Ax=function(a){return a.allowedByApplication&&a.allowedByKeySystem};ox=function(a,b){var c=a.filter(function(g){return g.audio&&g.audio.channelsCount}),d=new Map;c=_.u(c);for(var e=c.next();!e.done;e=c.next()){e=e.value;var f=e.audio.channelsCount;d.has(f)||d.set(f,[]);d.get(f).push(e)}c=Array.from(d.keys());if(0===c.length)return a;e=c.filter(function(g){return g<=b});return e.length?d.get(Math.max.apply(null,e)):d.get(Math.min.apply(null,c))};
|
|
60
|
+
_.Cx=function(a,b,c){b=_.Fg(b);var d=a,e=a.filter(function(g){return g.primary});e.length&&(d=e);var f=d.length?d[0].language:"";d=d.filter(function(g){return g.language===f});b.some(function(g){var h=_.Tv(_.gh(g),a.map(function(l){return l.language}));return h?(d=a.filter(function(l){return _.gh(l.language)===h}),!0):!1});if(c){b=Bx(d,c);if(b.length)return b;_.G("No exact match for the text role could be found.")}else if(b=d.filter(function(g){return 0===g.roles.length}),b.length)return b;b=d.map(function(g){return g.roles}).reduce(_.Lv,
|
|
61
|
+
[]);return b.length?Bx(d,b[0]):d};Bx=function(a,b){return a.filter(function(c){return c.roles.includes(b)})};Dx=function(a,b,c){for(var d=0;d<c.length;d++)if(c[d].audio===a&&c[d].video===b)return c[d];return null};
|
|
62
|
+
vx=function(a){var b=Yv(a);return a.type===_.lc?"type\x3daudio mimeType\x3d"+a.mimeType+" codecs\x3d"+a.codecs+" codecInfo\x3d"+b+" bandwidth\x3d"+a.bandwidth+" channelsCount\x3d"+a.channelsCount:a.type===_.Re?"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"};
|
|
63
|
+
Ex=function(a,b){var c=String(_.xi++);c=new _.si(c,a);c.mimeType=_.ti(b.mimeType);if(a===_.O||a===_.Q)c.label=_.ti(b.label),c.language=_.ti(b.language);a===_.ui?(c.frameRate=b.frameRate,c.roles=b.roles):a===_.Q?(c.channelsCount=b.channelsCount,c.roles=b.audioRoles||[],c.mimeType=_.ti(b.audioMimeType)):(c.kind=_.ti(b.kind),c.roles=b.roles);c.accessibility=a===_.ui||a===_.Q?(b.accessibility||[]).filter(function(d){return d.type===a}):b.accessibility||[];return c};
|
|
64
|
+
Fx=function(a,b,c){var d=new _.Ai(a===_.ui?""+b.videoId:a===_.Q?""+b.audioId:""+b.id,c);switch(a){case _.ui:d.codec=_.ti(b.videoCodec);d.bandwidth=b.videoBandwidth||b.bandwidth;d.width=b.width;d.height=b.height;d.originalId=b.originalVideoId;d.drm={keyId:b.keyId||void 0};break;case _.Q:d.codec=_.ti(b.audioCodec);d.bandwidth=b.audioBandwidth||b.bandwidth;d.originalId=b.originalAudioId;d.drm={keyId:b.keyId||void 0};break;default:d.codec=_.ti(b.codecs),d.originalId=b.originalTextId}(a=c.renditions.find(function(e){return _.K.xa(e,
|
|
65
|
+
d,null,["id","track"])}))||c.renditions.push(d);return a||d};Gx=function(a,b){var c=a.reduce(function(d,e){b===_.ui?null===e.videoId||d[e.videoId]&&!e.active||(d[e.videoId]=e):b===_.Q&&(null===e.audioId||d[e.audioId]&&!e.active||(d[e.audioId]=e));return d},{});return Object.values(c)};Hx=function(a,b){if(void 0!==b&&null!==b){var c=a.filter(function(d){return d.audio&&d.audio.id===b});if(0<c.length)return c}return a};
|
|
66
|
+
Ix=function(a,b,c){function d(f,g){return null==f?null==g:g.id==f}for(var e=0;e<c.length;e++)if(d(a,c[e].audio)&&d(b,c[e].video))return c[e];return null};Jx=function(){this.h=new _.H("cl.api.mse.TrackManager");this.l=null;this.g=[];this.a=new Map;this.f=new Map};Kx=function(a,b){return a.g.filter(function(c){return c.type===b})};Lx=function(a,b){var c=a.a.get(b)||null;return c&&c.track};Nx=function(a,b,c){c&&Lx(a,c.type)===c&&!a.l.ka()||Mx(a,b,c&&c.renditions[0])};
|
|
67
|
+
Ox=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)};
|
|
68
|
+
Mx=function(a,b,c,d){d=void 0===d?!1:d;if(a.l&&((a.a.get(b)||null)!==c||a.l.ka())){var e=a.l;if(c){if(0>a.g.indexOf(c.track))throw Error("Unknown rendition with ID "+c.id);if(b!==c.track.type)throw Error("Types mismatch");a.h.debug("Activate rendition type\n "+b+" with ID: "+c.id);if(b===_.O){var f=e.ia().find(function(n){return n.id==c.id});f&&(a.f.set(b,c),Ox(a,c),e.trigger(new _.I(_.Vj)),Px(e,!0).then(function(){Qx(e,f)})["catch"](function(n){a.h.warn("Error while activating track",n)}))}else if(b===
|
|
69
|
+
_.Q)a.f.set(b,c),Rx(e,parseInt(c.id,10));else if(b===_.ui){var g=a.a.get(_.Q)||null;if(g){var h=Sx(e).filter(function(n){return n.videoId==c.id});var l=h.find(function(n){return n.audioId==g.id});if(!l){a.h.debug("Unable to find exact variant. Searching for equivalent");var m=g.track.renditions.map(function(n){return n.id}).filter(function(n){return n!==g.id});l=h.find(function(n){return m.find(function(p){return p==n.audioId})})}}else l=Sx(e).find(function(n){return n.videoId==c.id});l?(a.f.set(b,
|
|
70
|
+
c),Tx(e,l,d)):a.h.warn("Cannot find matching variant")}}else a.h.debug(_.Ea+b),Lx(a,b)&&(b===_.O?Px(e,!1).then(function(){a.a.set(b,null);e.trigger(new _.I(_.Vj))})["catch"](function(n){a.h.warn("Error while de-activating text tracks",n)}):b===_.Q?a.h.info("Enabling ABR for audio is not supported"):Tx(e,null,d))}};
|
|
71
|
+
Wx=function(a){if(a.l){a.h.debug("Track list change detected, updating track list");for(var b=[],c=_.u(Object.values(_.Bq)),d=c.next();!d.done;d=c.next())d=d.value,a.a.set(d,null),a.f.set(d,null);c={};d=_.u(a.l.ia());for(var e=d.next();!e.done;c={Xb:c.Xb},e=d.next()){e=e.value;c.Xb=Ex(_.O,e);var f=b.find(function(h){return function(l){return h.Xb.xa(l)}}(c));c.Xb=f||c.Xb;var g=Fx(_.O,e,c.Xb);e.active&&a.a.set(_.O,g);f||b.push(c.Xb)}Ux(a.l)||a.a.set(_.O,null);c=Sx(a.l);Vx(a,b,c,_.ui);Vx(a,b,c,_.Q);
|
|
72
|
+
a.g=b}};Vx=function(a,b,c,d){var e=Gx(c,d);c={};e=_.u(e);for(var f=e.next();!f.done;c={Yb:c.Yb},f=e.next()){f=f.value;c.Yb=Ex(d,f);var g=b.find(function(l){return function(m){return l.Yb.xa(m)}}(c));c.Yb=g||c.Yb;var h=Fx(d,f,c.Yb);f.active&&a.a.set(d,h);g||b.push(c.Yb)}};
|
|
73
|
+
Xx=function(a,b,c){if(b){a.g.length||Wx(a);for(var d=b.type,e=a.a.get(d)||null,f,g=_.u(Kx(a,d)),h=g.next();!h.done&&!(f=h.value.renditions.find(function(l){return l.id==b.id}));h=g.next());f&&e!==f&&(Ox(a,f),d===_.Q?a.l.trigger(new _.I(_.Uj)):d===_.ui&&a.l.trigger(new _.I(_.Ve,{details:{width:f.width||0,height:f.height||0,bandwidth:f.bandwidth,track:f.track,abrSelection:c}})))}};Yx=function(){this.f=new _.hw(2);this.g=new _.hw(5);this.a=0};Zx=function(a,b){return 128E3>a.a?b:Math.min(_.jw(a.f),_.jw(a.g))};
|
|
74
|
+
_.$x=function(){this.h=new _.H("clpp.abr");this.w=null;this.j=!1;this.f=new Yx;this.o=[];this.m=1;this.B=this.A=!1;this.a=this.g=null};ay=function(a,b){a&&(b=b.filter(function(c){return tx(c,a,{width:Infinity,height:Infinity})}));return b.sort(function(c,d){return c.bandwidth-d.bandwidth})};by=function(){this.a=new Map};dy=function(a,b){a.a.has(b)||a.a.set(b,new cy);return a.a.get(b)};cy=function(){this.text=this.variant=null};
|
|
75
|
+
ey=function(a,b){this.f=a;this.a=new Set([a]);b=b||[];for(var c=_.u(b),d=c.next();!d.done;d=c.next())this.add(d.value)};hy=function(a,b){var c;if(!(c=!!a.audio!=!!b.audio||!!a.video!=!!b.video||a.language!=b.language)&&(c=a.audio&&b.audio)){c=a.audio;var d=b.audio;c=!(c.channelsCount==d.channelsCount&&fy(c,d)&&gy(c.roles,d.roles))}!c&&(c=a.video&&b.video)&&(c=a.video,d=b.video,c=!(fy(c,d)&&gy(c.roles,d.roles)));return c?!1:!0};
|
|
76
|
+
fy=function(a,b){if(a.mimeType!=b.mimeType)return!1;var c=a.codecs.split(",").map(function(f){return _.Zv(f)[0]}),d=b.codecs.split(",").map(function(f){return _.Zv(f)[0]});if(c.length!=d.length)return!1;c.sort();d.sort();for(var e=0;e<c.length;e++)if(c[e]!=d[e])return!1;return!0};gy=function(a,b){var c=new Set(a),d=new Set(b);c["delete"]("main");d["delete"]("main");if(c.size!=d.size)return!1;c=_.u(c);for(var e=c.next();!e.done;e=c.next())if(!d.has(e.value))return!1;return!0};
|
|
77
|
+
jy=function(a){this.a=a;this.f=new iy(a.language,"",a.audio&&a.audio.channelsCount?a.audio.channelsCount:0)};iy=function(a,b,c){this.g=_.Fg(a);this.a=b;this.f=c};ky=function(a,b){var c=null;b.some(function(d){c=_.Tv(_.gh(d),a.map(function(e){return Sv(e)}));return!!c});return c?a.filter(function(d){return c===Sv(d)}):[]};ly=function(a,b){return a.filter(function(c){var d=c.audio;c=c.video;return d&&0<=d.roles.indexOf(b)||c&&0<=c.roles.indexOf(b)})};
|
|
78
|
+
oy=function(a,b){this.a=my;this.f=(new Map).set(my,b).set(ny,a)};
|
|
79
|
+
qy=function(a){var b=this;this.C=a;this.a=a.getConfiguration().streaming;this.f=new _.eg;this.h=new _.H("clpp.mse.media.LiveEdgeObserver");py(this)&&(a=this.C.getSurface().getMedia(),this.f.on(a,_.Fe,function(){var c=b.C.getPosition(),d=b.C.getSeekRange().end;c=d-c;var e=b.C.getPlaybackRate(),f=b.a.stopChasingAt;1<=e&&c>=b.a.chaseJumpDistance?(b.h.debug("Too far from edge, jump to beginning."),b.C.setPlaybackRate(1),b.C.seek(d)):1===e&&c>=b.a.startChasingAt?(b.h.debug("Not on live edge, increase playback rate."),
|
|
80
|
+
b.C.setPlaybackRate(b.a.chasingRate)):1<e&&c<=f&&(b.h.debug("On live edge, reduce playback rate."),b.C.setPlaybackRate(1))}))};
|
|
81
|
+
py=function(a){return 1>=a.a.chasingRate?(a.h.warn("chasingRate must be greater than 1."),!1):a.a.chaseJumpDistance<=a.a.startChasingAt?(a.h.warn("chaseJumpDistance must be greater than startChasingAt."),!1):a.a.startChasingAt<=a.a.stopChasingAt?(a.h.warn("startChasingAt must be greater than stopChasingAt."),!1):0>a.a.stopChasingAt?(a.h.warn("stopChasingAt must be greater than or equal to 0."),!1):!0};ry=function(a){this.g=a;this.a=null;this.f=function(){}};sy=function(a,b){a.f=b};
|
|
82
|
+
ty=function(a){var b=this;this.a=a;this.j=!1;this.g=this.a.Ge();this.f=new _.aj(function(){b.a.Hj(.25*b.g)})};uy=function(a){a.f.stop();var b=a.j?0:a.g;0<=b?a.a.Ge()!=b&&a.a.Vg(b):(a.f.eb(.25),0!=a.a.Ge()&&a.a.Vg(0))};wy=function(a,b){this.g=a;this.m=vy(a);this.a=a.a.currentTime;this.j=Date.now()/1E3;this.o=b;this.f=function(){}};xy=function(a,b){a.f=b};yy=function(a){this.a=a};
|
|
83
|
+
vy=function(a){if(a.a.paused||0==a.a.playbackRate||0===a.a.buffered.length)var b=!1;else a:{b=a.a.buffered;a=a.a.currentTime;for(var c=0;c<b.length;c++){var 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};Ay=function(a,b,c,d,e){var f=this;this.a=a;this.F=b;this.m=c;this.D=e;this.g=new _.eg;this.B=!1;this.I=a.readyState;this.j=!1;this.f=d;this.o=this.H=this.A=!1;this.g.on(a,_.Ze,function(){return zy(f)});this.w=(new _.aj(function(){zy(f)})).eb(.25)};
|
|
84
|
+
zy=function(a){if(0!=a.a.readyState){if(a.a.seeking){if(!a.B)return}else a.B=!1;if(!a.a.paused&&!a.o){a.a.readyState!=a.I&&(a.j=!1,a.I=a.a.readyState);var b=a.m.smallGapLimit,c=a.a.currentTime,d=a.a.buffered;a:{var e=new _.ak(d);var f=a.m.gapDetectionThreshold;if(e.length&&!(1===e.length&&1E-6>e.end(0)-e.start(0)))for(var g=0;g<e.length;g++)if(e.start(g)>c&&(0===g||e.end(g-1)-c<=f)){e=g;break a}e=null}if(null==e){if(a.f){a=a.f;d=a.g;c=vy(d);d=d.a.currentTime;b=Date.now()/1E3;if(a.a!=d||a.m!=c)a.j=
|
|
85
|
+
b,a.a=d,a.m=c;d=b-a.j;d>=a.o&&c&&a.f(a.a,d)}}else if((0!=e||a.A)&&a.H&&(f=d.start(e),!(f>=tw(a.F)))){g=f-c;b=g<=b;var h=!1;if(!(.001>g)){if(!b&&!a.j){a.j=!0;var l=new _.I("largegap",{detail:{currentTime:c,gapSize:g}});l.cancelable=!0;a.D(l);a.m.jumpLargeGaps&&!l.defaultPrevented?h=!0:_.Sf("Ignoring large gap at",c,"size",g)}if(b||h)0==e?_.Sf(cv,g,"seconds because of gap before start time of",f):_.Sf(cv,g,"seconds because of gap starting at",d.end(e-1),"and ending at",f),a.a.currentTime=f}}}}};
|
|
86
|
+
Ey=function(a,b,c,d){this.a=a;this.j=b;this.o=d;this.A=c;this.m=!1;this.f=new _.eg;this.g=new By(a);this.w=!1;0<a.readyState?Cy(this,c):Dy(this,c)};Fy=function(a){return a.m?a.a.currentTime:a.A};Hy=function(a,b){0<a.a.readyState?Gy(a.g,b):Dy(a,b)};Dy=function(a,b){a.A=b;a.f.off(a.a,_.xd);a.f.one(a.a,_.xd,function(){Cy(a,b)})};Cy=function(a,b){a.w||(a.w=!0,a.o&&a.o());.001>Math.abs(a.a.currentTime-b)?Iy(a):(a.f.one(a.a,_.me,function(){Iy(a)}),Gy(a.g,0==a.a.currentTime?b:a.a.currentTime))};
|
|
87
|
+
Iy=function(a){_.fj()&&!a.m&&a.j();a.m=!0;a.f.on(a.a,_.me,function(){return a.j()})};By=function(a){var b=this;this.f=a;this.o=10;this.m=this.g=this.j=0;this.a=new _.aj(function(){0>=b.j?(_.G(["Failed to move playhead from",b.g,"to",b.m].join(" ")),b.a.stop()):b.f.currentTime!=b.g?b.a.stop():(b.f.currentTime=b.m,b.j--)})};Gy=function(a,b){a.g=a.f.currentTime;a.m=b;a.j=a.o;a.f.currentTime=b;a.a.eb(.1)};
|
|
88
|
+
My=function(a,b,c,d,e,f){var g=this;this.g=a;this.a=b.presentationTimeline;this.B=b.minBufferTime||0;this.m=c;this.A=e;this.w=null;this.j=new Ay(a,b.presentationTimeline,c,Jy(this,a,c),f);this.f=new Ey(a,function(){a:{var h=g.j;h.B=!0;h.A=!1;h.j=!1;h=Fy(g.f);var l=Ky(g,h);if(.001<Math.abs(l-h)){var m=(new Date).getTime()/1E3;if(!g.w||g.w<m-1){g.w=m;Hy(g.f,l);h=void 0;break a}}g.h.debug("Seek to "+h);g.A();h=void 0}return h},Ly(this,d),function(){g.j.H=!0});this.o=(new _.aj(function(){if(0!=g.g.readyState&&
|
|
89
|
+
!g.g.paused){var h=Fy(g.f),l=uw(g.a,0),m=tw(g.a);3>m-l&&(l=m-3);h<l&&(l=Ky(g,h),g.h.info("Jumping forward "+(l-h)+" seconds to catch up with the seek range."),g.g.currentTime=l)}})).eb(.25);this.h=new _.H("clpp.mse.Playhead")};Oy=function(a){var b=Fy(a.f);return 0<a.g.readyState&&!a.g.paused?Ny(a,b):b};Ly=function(a,b){null==b?b=Infinity>a.a.getDuration()?uw(a.a,0):tw(a.a):0>b&&(b=tw(a.a)+b);return Py(a,Ny(a,b))};Py=function(a,b){var c=a.a.getDuration();return b>=c?c-a.m.durationBackoff:b};
|
|
90
|
+
Ky=function(a,b){var c=new _.ak(a.g.buffered);c=c.fc.bind(c);var d=Math.max(a.B,a.m.rebufferingGoal),e=a.m.safeSeekOffset,f=uw(a.a,0),g=tw(a.a),h=a.a.getDuration();3>g-f&&(f=g-3);var l=uw(a.a,d),m=uw(a.a,e);d=uw(a.a,d+e);if(b>=h)return a.h.debug("Playhead past duration."),Py(a,b);if(b>g)return a.h.debug("Playhead past end."),g;if(b<f){if(c(m))return a.h.debug("Playhead before start \x26 start is buffered"),m;a.h.debug("Playhead before start \x26 start is unbuffered");return d}if(b>=l||c(b))return a.h.debug("Playhead in safe region or in buffered region."),
|
|
91
|
+
b;a.h.debug("Playhead outside safe region \x26 in unbuffered region.");return d};Ny=function(a,b){var c=uw(a.a,0);if(b<c)return c;c=tw(a.a);return b>c?c:b};
|
|
92
|
+
Jy=function(a,b,c){if(!c.stallEnabled)return null;var d=c.gapDetectionThreshold,e=c.stallSkip;c=new wy(new yy(b),c.stallThreshold);xy(c,function(f,g){a.h.warn("Stall detected at "+f+" for "+g+" seconds.");if(e){var h=new _.ak(b.buffered),l;if(l=_.dj("Edge/")||_.dj("Trident/")||_.ki()||_.fj())a:{if(h.length&&!(1>=h.length))for(l=0;l<h.length-1;l++)if(f>h.start(l)&&f<h.end(l)){l=h.start(l+1)-h.end(l)>=d;break a}l=!1}if(l){a:{if(h.length&&!(1>=h.length))for(l=0;l<h.length-1;l++)if(f>h.start(l)&&f<h.end(l)){h=
|
|
93
|
+
h.start(l+1)-f;break a}h=null}h&&(e=Math.min(h+.1,e))}a.h.warn("Seeking forward "+e+" seconds to break stall.");b.currentTime+=e}else a.h.warn("Pausing and unpausing to break stall."),b.pause(),b.play()});return c};
|
|
94
|
+
Ry=function(a){function b(){d=!0}function c(m){f.push(m);_.Qk(m)}a=_.N(a);var d=!1,e,f=[],g=[];(new _.Pk).L(_.Gd,c).L(_.Ge,c).L(_.Ad,c).L(_.Ed,c).L(_.ue,c).W(_.we,function(m){e=m;f.push(m);_.Rk(m)}).W("encv",b).W("enca",b).W("avc1",function(m){g.push({L:m,Oc:1701733238})}).W("avc3",function(m){g.push({L:m,Oc:1701733238})}).W("ac-3",function(m){g.push({L:m,Oc:1701733217})}).W("ec-3",function(m){g.push({L:m,Oc:1701733217})}).W("mp4a",function(m){g.push({L:m,Oc:1701733217})}).parse(a);if(d)return _.Sf("Init segment already indicates encryption."),
|
|
95
|
+
a;if(0===g.length||!e)throw _.Uf("Failed to find boxes needed to fake encryption!"),_.Uf("Failed init segment (hex):",_.Ph(a)),new _.L(_.M,3,14E3);g.reverse();for(var h=_.u(g),l=h.next();!l.done;l=h.next())l=l.value,_.Sf('Inserting "'+_.Uk(l.Oc)+'" box into init segment.'),a=Qy(a,e,l.L,f,l.Oc);return a};
|
|
96
|
+
Qy=function(a,b,c,d,e){var f=Sy.value(),g=a.subarray(c.start,c.start+c.size),h=_.th(g),l=new Uint8Array(c.size+f.byteLength);l.set(g,0);g=_.th(l);g.setUint32(4,e);l.set(f,c.size);e=h.getUint32(4);g.setUint32(c.size+16,e);Ty(l,0,l.byteLength);e=new Uint8Array(a.byteLength+l.byteLength);c=_.dj("Xbox One")||_.cj()?c.start:c.start+c.size;f=a.subarray(c);e.set(a.subarray(0,c));e.set(l,c);e.set(f,c+l.byteLength);a=_.u(d);for(d=a.next();!d.done;d=a.next())d=d.value,Ty(e,d.start,d.size+l.byteLength);l=_.th(e,
|
|
97
|
+
b.start);b=_.Vk(b);a=l.getUint32(b);l.setUint32(b,a+1);return e};Ty=function(a,b,c){a=_.th(a,b);b=a.getUint32(0);0!=b&&(1==b?(a.setUint32(8,c>>32),a.setUint32(12,c&4294967295)):a.setUint32(0,c))};_.Uy=function(a,b){this.C=b;this.f=a;this.j=null;this.w=1;this.F=Promise.resolve();this.m=[];this.o=new Map;this.a=new Map;this.I=this.g=this.A=this.B=!1;this.H=0;this.h=new _.H("clpp.mse.Streaming");this.D=!1};
|
|
98
|
+
Vy=function(a){var b=a.a.get(_.Re);return b?a.f.periods[b.Bb]:(b=a.a.get(_.lc))?a.f.periods[b.Bb]:null};Xy=function(a){return _.Wy(a,_.lc)};Yy=function(a){return _.Wy(a,_.Re)};_.Wy=function(a,b){var c=a.a.get(b);return c?c.Ub||c.stream:null};
|
|
99
|
+
cz=function(a,b){var c,d,e,f,g,h,l,m,n,p;return _.B(function(q){switch(q.a){case 1:return c=_.xn,_.x(q,a.C.X.clear(c.TEXT),2);case 2:return a.H++,a.I=!1,d=a.H,e=a.C.X,f=new Map,g=new Set,f.set(c.TEXT,b),g.add(b),_.x(q,e.init(f,!1),3);case 3:return a.g?q["return"]():_.x(q,Zy(a,g),4);case 4:if(a.g)return q["return"]();l=(h=e.getTextDisplayer().isTextVisible())||a.j.alwaysStreamText;a.H!=d||a.a.has(c.TEXT)||a.I||!l||(m=a.C.yb(),n=$y(a,m),p=az(b,n,0),a.a.set(c.TEXT,p),bz(a,p,0));_.z(q)}})};
|
|
100
|
+
fz=function(a){a.I=!0;var b=a.a.get(_.Ce);b&&(dz(b),ez(b)["catch"](function(){}),a.a["delete"](_.Ce))};hz=function(a,b,c,d){b.video&&_.gz(a,b.video,c,d);b.audio&&_.gz(a,b.audio,c,d)};
|
|
101
|
+
_.gz=function(a,b,c,d){var e=a.a.get(b.type);if(!e&&b.type==_.Ce&&a.j.ignoreTextStreamFailures)cz(a,b);else if(e){var f=iz(a,b);if(c&&f!=e.Bb)for(a.h.debug("switch: switching to stream in another Period; clearing buffer and changing Periods"),b=_.u(a.a.values()),c=b.next();!c.done;c=b.next())jz(a,c.value);else{e.Ub&&(a.h.debug("switch during trick play mode",b),b.trickModeVideo?(e.Ub=b,b=b.trickModeVideo,a.h.debug("switch found trick play stream",b)):(e.Ub=null,a.h.debug("switch found no special trick play stream")));
|
|
102
|
+
var g=a.m[f];if(g&&g.Rc&&(g=a.o.get(b.id))&&g.Rc)if(e.stream!=b){g=a.f.presentationTimeline.getDuration();var h=a.C.yb();h=kz(a,e,h);!c&&(e.endOfStream||h>=g)?a.h.debug(Av+lz(e)+" already buffered to the end. Not switching."):(b.type==_.Ce&&$w(a.C.X,_.Yi(b.mimeType,b.codecs)),e.stream=b,e.stream.segmentIterator=null,e.qd=!0,a.h.debug("switch: switching to Stream "+lz(e)),mz(a,e,f)&&(a.h.info("Aborting current segment request to switch."),e.Eb.abort()),c&&(e.Zb?e.be=!0:e.$a?(e.Hb=!0,e.Fd=d,e.be=!0):
|
|
103
|
+
(dz(e),nz(a,e,!0,d)["catch"](function(l){if(a.C)a.C.onError(l)}))))}else a.h.debug(Av+lz(e)+" already active")}}};mz=function(a,b,c){if(!b.Eb)return!1;var d=a.C.yb(),e=a.C.X.Ba(b.type);c=(c=oz(a,b,d,e,c))?c.ea?c.ea-c.sa+1:null:null;if(null==c)return!1;var f=b.stream.initSegmentReference;f&&(c+=(f.ea?f.ea-f.sa+1:null)||0);f=a.C.Ce().getBandwidthEstimate();if(8*c/f<(null===e?0:e-d)-Math.max(a.f.minBufferTime||0,a.j.rebufferingGoal))return!0;a=b.Eb;a=a.j?a.j.bytesRemaining:-1;return 0>a||a>c?!0:!1};
|
|
104
|
+
pz=function(a){function b(l){return a.C.X.fc(l,c,0)}var c=a.C.yb(),d=!1,e=$y(a,c);if(_.jh(a.a.values(),function(l){return l.Bb==e}))for(var f=_.u(a.a.keys()),g=f.next();!g.done;g=f.next()){g=g.value;var h=a.a.get(g);h.stream.segmentIterator=null;b(g)||(jz(a,h),d=!0)}else if(!_.jh(a.a.keys(),b)){a.h.debug("(all): seeked: unbuffered seek: clearing all buffers");d=_.u(a.a.values());for(f=d.next();!f.done;f=d.next())jz(a,f.value);d=!0}d||a.h.debug("(all): seeked: buffered seek: presentationTime\x3d"+
|
|
105
|
+
c)};jz=function(a,b){var c=lz(b);b.Zb?a.h.debug(c,"clear: already clearing the buffer"):b.Hb?a.h.debug(c,"clear: already waiting"):b.$a?(a.h.debug(c,"clear: currently updating"),b.Hb=!0,b.Fd=0):null==a.C.X.tb(b.type)?(a.h.debug(c,"clear: nothing buffered"),null==b.sb&&bz(a,b,0)):(a.h.debug(c,"clear: handling right now"),dz(b),nz(a,b,!1,0)["catch"](function(d){if(a.C)a.C.onError(d)}))};
|
|
106
|
+
rz=function(a,b,c,d,e){var f,g,h,l,m,n,p;return _.B(function(q){if(1==q.a)return f=a.C.yb(),g=$y(a,f),h=_.xn,l=new Map,m=new Set,b&&(l.set(h.AUDIO,b),m.add(b)),c&&(l.set(h.VIDEO,c),m.add(c)),d&&(l.set(h.TEXT,d),m.add(d)),n=a.C.X,p=a.j.forceNativeTS,_.x(q,n.init(l,p),2);if(3!=q.a){if(a.g)return q["return"]();qz(a);return _.x(q,Zy(a,m),3)}if(a.g)return q["return"]();l.forEach(function(r,v){if(!a.a.has(v)){var y=az(r,g,e);a.a.set(v,y);bz(a,y,0)}});_.z(q)})};
|
|
107
|
+
az=function(a,b,c){return{stream:a,type:a.type,Rb:null,segmentIterator:null,ra:null,Ub:null,qd:!0,Bb:b,endOfStream:!1,$a:!1,sb:null,Hb:!1,Fd:0,be:!1,Zb:!1,gf:!1,Lc:!1,Tg:c||0,Eb:null,Jd:!1,og:0}};
|
|
108
|
+
sz=function(a,b){var c=a.m[b];if(c)return a.h.debug("(all) Period "+b+Wu),c.O;a.h.debug("(all) setting up Period "+b);c={O:new _.di,Rc:!1};a.m[b]=c;for(var d=new Set,e=_.u(a.f.periods[b].variants),f=e.next();!f.done;f=e.next())f=f.value,f.video&&d.add(f.video),f.video&&f.video.trickModeVideo&&d.add(f.video.trickModeVideo),f.audio&&d.add(f.audio);e=_.u(a.f.periods[b].textStreams);for(f=e.next();!f.done;f=e.next())d.add(f.value);a.F=a.F.then(function(){return a.g?null:Zy(a,d)}).then(function(){a.g||
|
|
109
|
+
(a.m[b].O.resolve(),a.m[b].Rc=!0,a.h.debug("(all) setup Period "+b))})["catch"](function(g){a.g||(a.m[b].O["catch"](function(){}),a.m[b].O.reject(),delete a.m[b],a.h.warn("(all) failed to setup Period "+b),a.C.onError(g))});return c.O};
|
|
110
|
+
Zy=function(a,b){var c,d,e,f,g,h,l,m,n,p,q;return _.B(function(r){switch(r.a){case 1:c=[];d=_.u(b);for(e=d.next();!e.done;e=d.next())f=e.value,(g=a.o.get(f.id))?(a.h.debug("(all) Stream "+f.id+Wu),c.push(g.O)):(a.h.debug("(all) setting up Stream "+f.id),a.o.set(f.id,{O:new _.di,Rc:!1}),c.push(f.createSegmentIndex()));_.Af(r,2);return _.x(r,Promise.all(c),4);case 4:if(a.g)return r["return"]();_.Bf(r,3);break;case 2:h=_.Cf(r);if(a.g)return r["return"]();l=_.u(b);for(e=l.next();!e.done;e=l.next())m=
|
|
111
|
+
e.value,a.o.get(m.id).O["catch"](function(){}),a.o.get(m.id).O.reject(),a.o["delete"](m.id);throw h;case 3:n=_.u(b);for(e=n.next();!e.done;e=n.next())p=e.value,q=a.o.get(p.id),q.Rc||(q.O.resolve(),q.Rc=!0,a.h.debug("(all) setup Stream "+p.id));_.z(r)}})};qz=function(a){var b=a.f.presentationTimeline.getDuration();Infinity>b?kx(a.C.X,b):kx(a.C.X,Math.pow(2,32))};
|
|
112
|
+
vz=function(a,b){function c(p){return p.type==_.Ce&&p.stream.mimeType==_.dc}if(c(b))return gx(a.C.X,b.stream.originalId||""),null;var d=lz(b),e=a.C.yb(),f=kz(a,b,e);a.h.debug(d,"timeNeeded\x3d"+f);var g=iz(a,b.stream),h=$y(a,f),l=a.C.X.Ha(b.type,e);a.h.debug(d,"update_:",vv+e,"bufferedAhead\x3d"+l);var m=Math.max(a.f.minBufferTime||0,a.j.rebufferingGoal,a.j.bufferingGoal)*a.w,n=nw(a.f.presentationTimeline);if(null!=n&&f>=n&&!b.Jd)return tz(a,b),null;b.endOfStream=!1;b.Bb=h;if(h!=g)return a.h.debug(d,
|
|
113
|
+
"need Period "+h,vv+e,"timeNeeded\x3d"+f,"currentPeriodIndex\x3d"+g),null;if(l>=m)return a.h.debug(d,"buffering goal met"),a.j.bufferLimitUpdateInterval||.5;h=a.C.X.Ba(b.type);h=oz(a,b,e,h,g);if(!h)return a.f.presentationTimeline.isLive()||b.type===_.Ce?a.j.bufferLimitUpdateInterval||1:(a.h.debug("Media state "+d+": no next segment found. Assuming EOS."),tz(a,b),null);d=Infinity;l=_.u(a.a.values());for(m=l.next();!m.done;m=l.next())m=m.value,c(m)||(m=kz(a,m,e),d=Math.min(d,m));if(f>=d+a.f.presentationTimeline.a)return a.j.bufferLimitUpdateInterval||
|
|
114
|
+
1;b.Tg=0;uz(a,b,e,g,h)["catch"](function(){});return null};tz=function(a,b){a.h.debug(lz(b),"buffered to end of presentation");b.endOfStream=!0;if(b.type==_.Re){var c=a.a.get(_.Ce);c&&c.stream.mimeType==_.dc&&(c.endOfStream=!0)}};kz=function(a,b,c){if(!b.Rb||!b.ra)return Math.max(c,b.Tg);c=iz(a,b.Rb);return a.f.periods[c].startTime+b.ra.endTime};
|
|
115
|
+
oz=function(a,b,c,d,e){if(b.stream.segmentLookupStrategy===wz)b.stream.segmentIterator?a=yw(b.stream.segmentIterator):b.ra||d?(e=b.ra?b.ra.endTime:d,a.h.info(bv,"looking up segment from new stream endTime:",e),b.stream.segmentIterator=Cw(b.stream.segmentIndex,e),d=b.stream.segmentIterator.next().value,null===d&&(b.stream.segmentIterator=null,a.h.warn(bv,nv,"endTime:",e,b.ra)),a=d):(e=Math.max(c,0),a.h.info(bv,"looking up segment","lookupTime:",e,uv,c),d=null,d||(b.stream.segmentIterator=Cw(b.stream.segmentIndex,
|
|
116
|
+
c),d=b.stream.segmentIterator.next().value),null===d&&a.h.warn(bv,nv,"lookupTime:",e,uv,c),a=d);else{var f=lz(b);b.ra&&b.stream==b.Rb?(d=b.ra.position+1,a.h.debug(f,"next position known:","position\x3d"+d),a=xz(a,b,e,d)):(b.ra?(a.h.debug(f,"next position unknown: another Stream buffered"),c=iz(a,b.Rb),c=yz(a,b,a.f.periods[c].startTime+b.ra.endTime,e)):(a.h.debug(f,"next position unknown: nothing buffered"),c=yz(a,b,d||c,e)),null==c?a=null:(f=null,null!=d||null!==a.j&&a.j.ignoreDrift||(f=xz(a,b,e,
|
|
117
|
+
Math.max(0,c-1))),a=f||xz(a,b,e,c)))}return a};yz=function(a,b,c,d){var e=lz(b);d=a.f.periods[d];var f=Math.max(0,c-d.startTime);b=b.stream.findSegmentPosition(f);a.h.debug(e,"Looked up segment:",vv+c,"lookupTime\x3d"+f,pv+d.startTime,"Result: segment position\x3d"+b);null==b&&a.h.warn(e,"cannot find segment:",pv+d.startTime,"lookupTime\x3d"+f);return b};
|
|
118
|
+
xz=function(a,b,c,d){var e=lz(b);c=a.f.periods[c];var f=b.stream.getSegmentReference(d);if(!f)return a.h.debug(e,"segment does not exist:",pv+c.startTime,"position\x3d"+d),null;var g=a.f.presentationTimeline;d=_.sw(g);g=rw(g);return!b.Jd&&(c.startTime+f.endTime<d||c.startTime+f.startTime>g)?(a.h.debug(e,"segment is not available:",pv+c.startTime,yv+f.startTime,wv+f.endTime,"availabilityStart\x3d"+d,"availabilityEnd\x3d"+g),null):f};
|
|
119
|
+
uz=function(a,b,c,d,e){var f,g,h,l,m,n,p,q,r,v,y,A,E;return _.B(function(F){f=_.xn;g=lz(b);h=a.f.periods[d];a.h.debug(g,"fetchAndAppend_:",vv+c,pv+h.startTime,xv+e.position,yv+e.startTime,wv+e.endTime);l=b.stream;m=b.stream.segmentIterator;n=a.f.presentationTimeline.getDuration();p=a.f.periods[d+1];q=Math.max(0,h.startTime-.1);r=p?p.startTime+.01:n;v=zz(a,b,d,q,r,e);b.$a=!0;b.qd=!1;a.h.debug(g,"fetching segment");y=!1;A=function(D,J){if(a.g||a.A)return null;y=!0;return Az(a,b,c,h,l,e,D,J)};E=a.C.X.Ba(b.type)||
|
|
120
|
+
0;v.then(function(){return a.g||a.A?null:Bz(a,b,e,!1,function(D){return A(D.data,!0)})}).then(function(D){return a.g||a.A?null:y||null===D?(Cz(a,b,E,e,l),null):A(D,!1)}).then(function(){if(!a.g&&!a.A){Cz(a,b,E,e,l);b.$a=!1;b.gf=!1;b.Hb||a.C.Zd();if(m){var D=m.next().value;D&&a.h.debug("New iterated segment",D)}bz(a,b,0);Dz(a,b,l);a.h.debug(g,"finished fetch and append")}})["catch"](function(D){return _.B(function(J){if(a.g||a.A)return J["return"]();b.$a=!1;if(b.type==f.TEXT&&a.j.ignoreTextStreamFailures)return 1001==
|
|
121
|
+
D.code?a.h.warn(g,"Text stream failed to download. Proceeding without it."):a.h.warn(g,"Text stream failed to parse. Proceeding without it."),a.a["delete"](f.TEXT),J.G(0);if(7001==D.code)return b.$a=!1,b.sb=null,bz(a,b,0),J.G(0);if(3017===D.code)return Ez(a,b,D),J.G(0);if(1001===D.code&&D.data&&404===D.data[1])return a.h.warn(g,"request for segment failed","segment not available on server",xv+e.position,yv+e.startTime,wv+e.endTime,"error\x3d"+D),b.$a=!1,b.sb=null,bz(a,b,1),J.G(0);if(b.type===f.TEXT)return D instanceof
|
|
122
|
+
_.L&&D.a(1),dz(b),a.C.onError(new _.L(1,2,2010,D)),J.G(0);if(1001<=D.code&&1003>=D.code)return _.x(J,Fz(a,b,h,D),0);a.h.error(g,"failed fetch and append: code\x3d"+D.code);b.Lc=!0;D instanceof _.L&&D.a(_.M);return _.x(J,Gz(a,D),0)})});_.z(F)})};
|
|
123
|
+
Iz=function(a,b){b=void 0===b?!1:b;if(a.g)a.h.error("Unable to retry after StreamingEngine is destroyed!");else if(a.A)a.h.error("Unable to retry after StreamingEngine encountered a fatal error!");else for(var c=_.u(a.a.values()),d=c.next();!d.done;d=c.next()){d=d.value;var e=lz(d);if(d.Lc||b&&Hz(d))a.h.info(e,"Retrying after failure..."),d.Lc=!1,bz(a,d,.1)}};
|
|
124
|
+
Ez=function(a,b,c){var d=lz(b);if(Array.from(a.a.values()).some(function(f){return f!=b&&f.gf}))a.h.debug(d,dv,"waiting for another stream to recover...");else{var e=Math.round(100*a.w);if(20<e)a.w-=.2;else if(4<e)a.w-=.04;else{a.h.error(d,"MediaSource threw QuotaExceededError too many times");b.Lc=!0;a.A=!0;a.C.onError(c);return}a.h.warn(d,dv,"reducing buffering goals by "+(100-Math.round(100*a.w))+"%");b.gf=!0}bz(a,b,4)};
|
|
125
|
+
Fz=function(a,b,c,d){var e,f;return _.B(function(g){e=1001===d.code&&500<=d.data.status;f=!0;e||(f=!a.C.pe(b.stream,c));if(!f)return g.G(0);b.Lc=!0;d.a(_.M);return _.x(g,Gz(a,d),0)})};
|
|
126
|
+
zz=function(a,b,c,d,e,f){c=a.f.periods[c].startTime-f.Na;if(!b.qd&&c===b.og)return Promise.resolve();b.og=c;var g=lz(b);a.h.debug(g,"setting timestamp offset to "+c);a.h.debug(g,"setting append window start to "+d);a.h.debug(g,"setting append window end to "+e);d=ix(a.C.X,b.type,c,d,e);if(!b.stream.initSegmentReference||!b.qd)return d;a.h.debug(g,"fetching init segment");e=Bz(a,b,b.stream.initSegmentReference,!0).then(function(h){if(a.g)return null;a.h.debug(g,"appending init segment");return Jz(a,
|
|
127
|
+
h,b).then(function(){return fx(a.C.X,b.type,h,null,null,!!b.stream.closedCaptions&&0<b.stream.closedCaptions.size)})})["catch"](function(h){b.qd=!0;return Promise.reject(h)});return Promise.all([d,e])};Jz=function(a,b,c){var d;return _.B(function(e){if(!a.j.patchEdgeWhenMixedContent||!_.cj())return e.G(0);d=Ry(b);return _.x(e,fx(a.C.X,c.type,d.buffer,null,null,!!c.stream.closedCaptions&&0<c.stream.closedCaptions.size),0)})};
|
|
128
|
+
Az=function(a,b,c,d,e,f,g,h){h=void 0===h?!1:h;var l,m,n,p,q,r,v,y,A;return _.B(function(E){switch(E.a){case 1:l=lz(b);if(!(e&&e.keyId&&a.C.hd)){E.G(2);break}m=Hv(a.C.hd,e.keyId);if(!m){a.h.warn("Unable to find DRM session for "+e.keyId);E.G(2);break}_.Af(E,4);return _.x(E,m,6);case 6:_.Bf(E,2);break;case 4:n=_.Cf(E),a.h.warn("DRM session load failed!",n);case 2:if(!(e.encrypted&&e.keyId&&a.C.hd&&Jv(a.C.hd,e.keyId))){E.G(7);break}dz(b);p=iz(a,e);q=Kz(a,p);if(!q){E.G(8);break}return _.x(E,q,8);case 8:return r=
|
|
129
|
+
a.C.pe(e,d,rv),v=f.startTime+d.startTime,y=f.endTime+d.startTime,a.h.warn(l,"Blocked append for "+v+" - "+y+": "+r+". Stream with Key ID "+(e.keyId+" has restrictions.")),E["return"](Promise.resolve());case 7:return A=e.closedCaptions&&0<e.closedCaptions.size,null!=e.emsgSchemeIdUris&&0<e.emsgSchemeIdUris.length&&(new _.Pk).W("emsg",a.zk.bind(a,d,f,e.emsgSchemeIdUris)).parse(g),E["return"](Lz(a,b,c).then(function(){if(a.g)return null;var F=f.startTime+d.startTime,D=f.endTime+d.startTime;a.h.debug(l,
|
|
130
|
+
"Appending segment with "+(F.toFixed(3)+" - "+D.toFixed(3)+" KeyID: ")+(e.keyId+" Width: ")+(e.width+" Height: "+e.height+" Bitrate: ")+(_.Hh(e.bandwidth)+" Fragment: ")+h);return fx(a.C.X,b.type,g,F,D,A,e.id,h)}).then(function(){a.g||(a.h.debug(l,"appended media segment"),b.Rb=e,b.ra=f)}))}})};
|
|
131
|
+
Cz=function(a,b,c,d,e){if(!a.f.presentationTimeline.isLive()&&b.type!==_.Ce){var f=lz(b);c=(a.C.X.Ba(b.type)||0)-c;var g=d.endTime-d.startTime,h=c-g;Math.abs(h)>=Math.min(.01,g)&&Math.abs(h)<=Math.min(1,g)&&(a.h.debug(f,"Adjusted segment",d.position,"with real duration",c,"and accounted for",h,"delta between segment duration and real duration"),b.Jd=!0,e.adjustSegmentDurations(d.position,h))}};
|
|
132
|
+
Mz=function(a,b,c){(new _.Pk).L(_.Gd,_.Qk).L(_.Ge,_.Qk).L(_.Ad,_.Qk).L(_.Ed,_.Qk).L(_.ue,_.Qk).W(_.we,_.Rk).L("encv",function(d){d.reader.skip(78);_.Qk(d)}).L(_.oe,_.Qk).L("schi",_.Qk).L("tenc",function(d){d.reader.skip(6);if(_.Jk(d.reader)){d.reader.skip(1);var e=_.Ph(_.Ok(d.reader,16));e!==b.stream.keyId&&(a.h.debug(lz(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)};
|
|
133
|
+
Lz=function(a,b,c){if(a.g)return Promise.resolve();var d=lz(b);a.h.debug(d,"checking buffer length");var e=Math.max(a.j.bufferBehind,a.f.presentationTimeline.a),f=a.C.X.tb(b.type);if(null==f)return a.h.debug(d,"buffer behind okay because nothing buffered:",vv+c,kv+e),Promise.resolve();var g=c-f,h=g-e;if(.01>=h)return a.h.debug(d,"buffer behind okay:",vv+c,lv+g,kv+e,"underflow\x3d"+Math.abs(h)),Promise.resolve();a.h.debug(d,"buffer behind too large:",vv+c,lv+g,kv+e,"overflow\x3d"+h);return a.C.X.remove(b.type,
|
|
134
|
+
f,f+h).then(function(){a.g||a.h.debug(d,"evicted "+h+" seconds")})};Dz=function(a,b,c){if(!a.B){b=lz(b);var d=Array.from(a.a.values());1!=d.length||d[0].type!=_.Ce?a.B=d.every(function(e){return e.type==_.Ce||a.D?!0:!e.Hb&&!e.Zb&&e.ra}):a.D&&(a.B=!0);a.B&&(a.h.debug(b,"startup complete"),c=iz(a,c),Kz(a,c))}};
|
|
135
|
+
Kz=function(a,b){var c=null;a.m[b]||(c=sz(a,b).then(function(){a.g||(a.h.debug(mv),a.C.We())})["catch"](Mv));for(var d=0;d<a.f.periods.length;++d)sz(a,d)["catch"](Mv);a.C.vk&&(a.h.debug("calling onStartupComplete()..."),a.C.vk());return c};
|
|
136
|
+
Nz=function(a,b){var c=lz(b),d=iz(a,b.stream);if(b.Bb!=d){var e=b.Bb,f=Array.from(a.a.values());f.every(function(g){return g.Bb==e})?f.every(Hz)?(a.h.debug(c,"all need Period "+e),sz(a,e).then(function(){if(!a.g)if(f.every(function(n){var p=Hz(n),q=iz(a,n.stream);return p&&n.Bb==e&&q!=e})){var g=a.f.periods[e];a.h.debug(c,"calling onChooseStreams()...");var h=a.C.Xe(g);a.D=!h.variant&&!!h.text;var l=new Map;h.variant&&h.variant.video&&l.set(_.Re,h.variant.video);h.variant&&h.variant.audio&&l.set(_.lc,
|
|
137
|
+
h.variant.audio);h.text&&l.set(_.Ce,h.text);var m=_.u(a.a.keys());for(h=m.next();!h.done;h=m.next())if(h=h.value,!l.has(h)&&h!=_.Ce){a.h.error(c,"invalid Streams chosen: missing "+h+" Stream");a.C.onError(new _.L(_.M,5,5005));return}m=_.u(Array.from(l.keys()));for(h=m.next();!h.done;h=m.next())if(h=h.value,!a.a.has(h))if(h==_.Ce)rz(a,null,null,l.get(_.Ce),g.startTime),l["delete"](h);else{a.h.error(c,"invalid Streams chosen: unusable "+h+" Stream");a.C.onError(new _.L(_.M,5,5005));return}g=_.u(Array.from(a.a.keys()));
|
|
138
|
+
for(h=g.next();!h.done;h=g.next())h=h.value,(m=l.get(h))?(_.gz(a,m,!1,0),bz(a,a.a.get(h),0)):a.a["delete"](h);a.h.debug(c,mv);a.C.We()}else a.h.debug(c,"ignoring transition to Period",e,"since another is happening")})["catch"](Mv)):a.h.debug(c,"all MediaStates need Period "+e+", but not all MediaStates are idle"):a.h.debug(c,"not all MediaStates need Period "+e)}};$y=function(a,b){var c=gw(a.f.periods,b+_.zq);return c?a.f.periods.indexOf(c):0};
|
|
139
|
+
iz=function(a,b){for(var c=a.f.periods,d=0;d<c.length;d++){for(var e=c[d],f=new Set,g=_.u(e.variants),h=g.next();!h.done;h=g.next())h=h.value,h.audio&&f.add(h.audio),h.video&&f.add(h.video),h.video&&h.video.trickModeVideo&&f.add(h.video.trickModeVideo);e=_.u(e.textStreams);for(g=e.next();!g.done;g=e.next())f.add(g.value);if(f.has(b))return d}return-1};
|
|
140
|
+
Bz=function(a,b,c,d,e){d=void 0===d?!1:d;e=void 0===e?null:e;var f=_.kw(c.Ka(),c.sa,c.ea,a.j.attemptParameters,c.startTime,c.endTime,b.type,c.timescale);f.type=2;f.onFragment=c.Fc?null:e;f.disableFragmentSupport=c.Fc||a.j.disableFragmentSupport;f.disableMergedFragments=a.j.disableMergedFragments;if(e=c.f())f.keyInfo=e,f.onFragment=null;d&&(f.responseModifiers.push(function(g){Mz(a,b,g.data)}),b.type===_.Re&&a.j.overridePasp&&f.responseModifiers.push(a.fl.bind(a)));a.h.debug("fetching: reference\x3d",
|
|
141
|
+
c);c=a.C.Cb.fetch(f);b.Eb=c;return c.O.then(function(g){var h=a.C.Ce(),l=g.timeMs,m=g.data.byteLength;l&&m&&!d&&h.segmentDownloaded(l,m);b.Eb=null;return g.data})};
|
|
142
|
+
nz=function(a,b,c,d){var e,f,g,h;return _.B(function(l){if(1==l.a)return e=lz(b),b.Hb=!1,b.be=!1,b.Fd=0,b.Zb=!0,b.stream.segmentIterator=null,a.h.debug(e,"clearing buffer"),d?(g=a.C.yb(),h=a.C.X.getDuration(),f=a.C.X.remove(b.type,g+d,h)):f=a.C.X.clear(b.type).then(function(){return!a.g&&c?a.C.X.flush(b.type):null}),_.x(l,f,2);if(a.g)return l["return"]();a.h.debug(e,"cleared buffer");b.Rb=null;b.ra=null;b.Zb=!1;b.endOfStream=!1;b.Jd=!1;bz(a,b,0);_.z(l)})};
|
|
143
|
+
bz=function(a,b,c){a.h.debug(lz(b),"updating in "+c+" seconds");b.sb=(new _.Zi(function(){var d;return _.B(function(e){if(1==e.a)return _.Af(e,2),_.x(e,a.Db(b),4);if(2!=e.a)return _.Bf(e,0);d=_.Cf(e);if(a.C)a.C.onError(d);_.z(e)})})).Z(c)};dz=function(a){null!=a.sb&&(a.sb.stop(),a.sb=null)};ez=function(a){return _.B(function(b){return a.Eb?_.x(b,a.Eb.abort(),0):b.G(0)})};
|
|
144
|
+
Oz=function(a){var b,c,d,e;return _.B(function(f){b=[];c=_.u(a.a.values());for(d=c.next();!d.done;d=c.next())e=d.value,dz(e),e.$a&&e.Eb&&(e.$a=!1,b.push(e.Eb.abort())),e.Hb&&b.push(nz(a,e,!0,0));return _.x(f,Promise.all(b),0)})};Pz=function(a,b,c){(a=a.a.get(b))&&c&&(dz(a),a.stream=c,a.Rb=c,a.ra&&(a.ra=c.getSegmentReference(a.ra.position)),a.ra||(a.Rb=null))};
|
|
145
|
+
Gz=function(a,b){var c;return _.B(function(d){switch(d.a){case 1:if(a.g)return d["return"]();if(!a.C.Xg){d.G(2);break}_.Af(d,3);return _.x(d,a.C.Xg(b),5);case 5:_.Bf(d,2);break;case 3:c=_.Cf(d),c.cause=b,b=c;case 2:if(!b.f)a.C.onError(b);_.z(d)}})};lz=function(a){return"("+a.type+":"+a.stream.id+")"};Hz=function(a){return!a.$a&&null==a.sb&&!a.Hb&&!a.Zb};
|
|
146
|
+
Sz=function(a){_.lk.call(this,ov);var b=this;this.F=Qz;this.j=this.Sb=this.da=null;this.Re=0;this.tg=2;this.ed=null;this.Pe=!1;this.o=new _.eg;this.Va=this.Od=this.zc=this.qc=this.A=this.J=this.m=null;this.Yc=!1;this.g=this.f=this.B=this.a=this.wc=this.H=null;this.Ug=1E9;this.Td=new Set;this.V=!0;this.ma=null;this.Og=!1;this.Hg=0;this.ga=null;this.P=new by;this.Pg={width:Infinity,height:Infinity};this.I=null;this.ha=_.Ym;this.xc=new iy(this.configuration.preferredAudioLanguage||[],this.configuration.preferredAudioRole,
|
|
147
|
+
this.configuration.preferredAudioChannelCount);this.Ga=this.configuration.preferredTextLanguage;this.T=this.yc=null;this.Ac=new Map;this.na=null;this.vc=this.configuration.preferredTextRole;a&&a(this);this.Qe=null;this.o.on(window,"online",function(){b.F===Rz&&Iz(b.a)})};
|
|
148
|
+
Tz=function(a){return new _.bw(function(b){if(void 0===b||null===b)return null;var c=a.getTrackManager(),d=[];if(c){c=_.u(c.getVideoTracks());for(var e=c.next();!e.done;e=c.next())d.push.apply(d,_.nf(e.value.renditions))}return d.find(function(f){return f.id==b})||null})};
|
|
149
|
+
Uz=function(a,b){if(a.ha!==b)if(a.ha===_.jn&&b!==_.Ym)a.log.info(_.fv+Uv(b,_.gn));else{var c=a.Re;c=0===c?0:Date.now()-c;var d=a.ha;a.ha=b;a.Re=Date.now();a.I&&_.Om(a.I.a,a.ha);b===_.cn&&(a.tg=a.Oe?1:2);var e=a.tg,f={currentState:a.ha,previousState:d,timeSinceLastStateChangeMS:c,reason:b===_.cn||d===_.cn?e:void 0};a.log.info(_.fb+Uv(d,_.gn)+" -\x3e "+(Uv(b,_.gn)+(b!==_.cn?"":"["+Uv(e,_.fn)+"]")));a.trigger(new _.I(_.se,{detail:f}));(b===_.en||b===_.jn)&&a.Va&&a.Va.stop();b===_.cn?a.trigger(new _.I(_.xc,
|
|
150
|
+
{detail:{bufferedTimeMS:-1,reason:e}})):d===_.cn&&a.trigger(new _.I(_.wc,{detail:{bufferedTimeMS:c,reason:e}}))}};$z=function(a){var b=!1;b=void 0===b?!0:b;var c,d;return _.B(function(e){switch(e.a){case 1:return a.F===Vz?e["return"](Promise.reject(new _.L(_.M,7,7E3))):_.x(e,Wz(a),2);case 2:return _.x(e,Xz(a),3);case 3:c=_.ki(4)||_.ki(5);if(!b&&!c){e.G(0);break}d=a.getSurface().getMedia();return _.x(e,Yz(a,d),5);case 5:return _.x(e,Zz(a,d),0)}})};
|
|
151
|
+
Yz=function(a,b){a.j||(a.o.on(b,_.jd,function(){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 _.L(_.M,3,3016,{code:c,extendedError:d,message:a.j.error.message})}}else c=null;if(c)a.onError(c)}),a.j=b);return Promise.resolve()};Xz=function(a){a.j&&(a.o.off(a.j,_.jd),a.j=null);return Promise.resolve()};
|
|
152
|
+
Wz=function(a){var b;return _.B(function(c){switch(c.a){case 1:a.F!==Vz&&(a.F=Qz);if(b=a.j)a.o.off(b,_.wd),a.o.off(b,_.$d),a.o.off(b,_.Vd),a.o.off(b,_.id),a.o.off(b,_.ee),a.o.off(b,_.ce);a.qc&&(a.qc.release(),a.qc=null);a.Va&&(a.Va.stop(),a.Va=null);if(!a.B){c.G(2);break}return _.x(c,a.B.stop(),3);case 3:a.B=null;case 2:if(!a.g){c.G(4);break}return _.x(c,a.g.stop(),4);case 4:if(!a.a){c.G(6);break}return _.x(c,a.a.destroy(),7);case 7:a.a=null;case 6:a.A&&(a.A.release(),a.A=null);if(!a.J){c.G(8);break}return _.x(c,
|
|
153
|
+
a.J.destroy(),9);case 9:a.J=null;case 8:a.Od&&(a.Od.release(),a.Od=null);b&&b.src&&(b.removeAttribute("src"),b.load());if(!a.m){c.G(10);break}return _.x(c,a.m.destroy(),11);case 11:a.m=null;case 10:a.P.clear(),a.H=null,a.Td.clear(),a.f=null,a.I=null,a.V=!0,a.Ac.clear(),a.Yc=!1,aA(a),_.z(c)}})};
|
|
154
|
+
Zz=function(a,b){var c,d,e;return _.B(function(f){if(1==f.a)return c=window.muxjs?new Pw:new _.Qw,d=_.Mm(a.configuration,["html","single-native"]),a.K=d.create(a),a.ed=Tz(a),a.ed.track(a),e=new _.Ww(b,c,a.K,a.ed,a.configuration),_.x(f,e.H,2);a.J=e;_.z(f)})};bA=function(a,b){var c,d;return _.B(function(e){if(1==e.a)return c=a.getNetworkEngine(),d=a,_.x(e,_.Ep(b.url,c,a.configuration.manifest.attemptParameters,b.type||null),2);d.B=e.f;a.B.configure(a.configuration.manifest);_.z(e)})};
|
|
155
|
+
fA=function(a,b){var c;return _.B(function(d){a.wc=new vw;ww(a.wc,function(e){cA(a,_.pg,e)});c=new _.ei(Promise.resolve().then(function(){var e,f,g;return _.B(function(h){switch(h.a){case 1:if(a.f){h.G(3);break}_.Af(h,4);e=a;return _.x(h,a.B.start(b.url,dA(a)),6);case 6:e.f=h.f;_.Bf(h,1);break;case 4:f=_.Cf(h);if(!a.uc)throw f;return _.x(h,a.uc(b.url,f),8);case 8:if(g=h.f)b.url=g;else throw f;h.G(1);break;case 3:!a.f.presentationTimeline||a.configuration.manifest.hlsLowLatency||_.K.R(a.configuration.suggestedPresentationDelay)||
|
|
156
|
+
isNaN(a.configuration.suggestedPresentationDelay)||(a.log.info("Apply suggested presentation delay of: "+a.configuration.suggestedPresentationDelay),a.f.presentationTimeline.F=a.configuration.suggestedPresentationDelay);a.f.presentationTimeline&&(a.f.presentationTimeline.H=!!a.configuration.lowLatencyMode);if(0==a.f.periods.length)throw new _.L(_.M,4,4014);eA(a.f.periods);_.z(h)}})}),function(){a.log.info("Aborting parser step...");return a.B.stop()});return _.x(d,c.O,0)})};
|
|
157
|
+
mA=function(a){var b,c,d,e,f;return _.B(function(g){switch(g.a){case 1:a.m=new _.Ul({Cb:a.getNetworkEngine(),onError:function(h){return a.onError(h)},Ze:function(h){if(a.a){var l=gA(a),m=!1,n=Object.keys(h);0===n.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 p=1===n.length&&"00"===n[0];p&&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.");
|
|
158
|
+
if(n.length){n=a.getPeriods();for(var q=0;q<n.length;q++)for(var r=n[q],v=_.u(r.variants),y=v.next();!y.done;y=v.next()){y=y.value;var A=[];y.audio&&A.push(y.audio);y.video&&A.push(y.video);A=_.u(A);for(var E=A.next();!E.done;E=A.next()){E=E.value;var F=y.allowedByKeySystem;if(E.keyId){var D=h[p?"00":E.keyId];D=!!D&&!hA.includes(D);y.allowedByKeySystem=D}F!==y.allowedByKeySystem&&(D=E.type,E.type===_.Re&&(D="video "+E.width+"x"+E.height+"@"+_.Hh(E.bandwidth)),a.log.warn("DRM Key not available for KID: '"+
|
|
159
|
+
(E.keyId+"'. Applying restrictions to "+D)));r===l&&F!==y.allowedByKeySystem&&(m=!0)}}}if(h=Vy(a.a))if(p=Xy(a.a),n=Yy(a.a),p=Dx(p,n,h.variants),!p||p.allowedByKeySystem)a.log.info(av),iA(a),jA(a,h.variants);m&&h!==l&&(a.log.info(av),iA(a),jA(a,l.variants))}},onExpirationUpdated:function(h,l){if(a.B&&a.B.onExpirationUpdated)a.B.onExpirationUpdated(h,l);a.trigger(new _.I(_.ad,{expirationTime:l}))},onEvent:function(h){return a.ve(h)},getConfiguration:function(){return a.getConfiguration()},Kc:function(){return a.Kc()}});
|
|
160
|
+
kA(a);c=(b=a.configuration.drm)?b.offlineId||"":"";d=[];e=_.xp(a.f.periods);if(!c){g.G(2);break}f=_.nk(_.Wd);if(!f){g.G(2);break}return _.x(g,f.Hk(b,e,a.getNetworkEngine()),4);case 4:return _.x(g,f.dj(c),5);case 5:d=g.f;case 2:return _.x(g,_.Zl(a.m,e,d),6);case 6:a.f&&lA(a,a.f.periods),_.z(g)}})};
|
|
161
|
+
xA=function(a){var b,c,d,e,f,g,h,l,m,n,p;return _.B(function(q){if(1==q.a)return b=a.j,c=function(r){a.j&&a.H&&(r.type===_.me&&a.Ud?(a.H.a=ny,aA(a)):r.type===_.Ze&&a.getState()===_.mn&&.1>a.getBufferInfo().Ha(a.getPosition())?(a.H.a=ny,aA(a)):a.H&&nA(a));oA(a)},d=function(){if(a.j){var r=a.j.playbackRate;0!=r&&a.zc.set(r)}},a.o.on(b,_.$d,c),a.o.on(b,_.Vd,c),a.o.on(b,_.id,c),a.o.on(b,_.me,c),a.o.on(b,_.le,c),a.o.on(b,_.ce,c),a.o.on(b,_.Ze,c),a.o.on(b,_.ee,d),a.g||(a.g=new _.$x,a.g.configure(a.configuration.abr)),
|
|
162
|
+
pA(a,a.f.periods),a.xc=new iy(a.configuration.preferredAudioLanguage||[],a.configuration.preferredAudioRole,a.configuration.preferredAudioChannelCount),a.Ga=a.configuration.preferredTextLanguage,a.vc=a.configuration.preferredTextRole,_.x(q,_.lm(a.m,b),2);if(3!=q.a){if(!a.m)throw new _.L(_.M,7,7001);a.g.init(function(r,v,y){!a.V&&qA(a,r,v,y)});a.A=rA(a,a.configuration.startTime);a.qc=sA(a);a.zc=new ty({Ge:function(){return b.playbackRate},Vg:function(r){b.playbackRate=r},Hj:function(r){b.currentTime+=
|
|
163
|
+
r}});a.isLive()&&a.configuration.streaming.enableLiveEdgeChasing&&(a.Od=new qy(a));e=Math.max(1E-4,a.configuration.streaming.rebufferingGoal);tA(a,e);sx(a.f,_.Fg(a.configuration.preferredVideoCodec),_.Fg(a.configuration.preferredAudioCodec),a.configuration.preferredAudioChannelCount);a.a=uA(a);a.a.j=a.configuration.streaming;a.F=Rz;return _.x(q,a.a.start(),3)}if(!a.a)throw new _.L(_.M,7,7001);a.configuration.streaming.startAtSegmentBoundary&&(f=Oy(a.A),g=vA(a,f),Hy(a.A.f,g));h=_.u(a.f.periods);for(l=
|
|
164
|
+
h.next();!l.done;l=h.next())m=l.value,wA(a,m);iA(a);n=gA(a)||a.f.periods[0];p=n.variants.some(function(r){return r.primary});a.configuration.preferredAudioLanguage||p||a.log.warn("No preferred audio language set. We will choose an arbitrary language initially");jA(a,n.variants);a.o.one(b,_.wd,function(){a.I.A=Date.now()/1E3-(null===a.Qe?0:a.Qe)});_.z(q)})};
|
|
165
|
+
eA=function(a){function b(d){return d.video&&d.audio||d.video&&d.video.codecs.includes(",")}if(a.some(function(d){return d.variants.some(b)})){_.Tf("Found variant with audio and video content, so filtering out audio-only content in all periods.");a=_.u(a);for(var c=a.next();!c.done;c=a.next())c=c.value,c.variants=c.variants.filter(b)}};rA=function(a,b){return new My(a.j,a.f,a.configuration.streaming,b,function(){a.qc&&Ew(a.qc,!0);a.a&&pz(a.a)},function(c){return a.dispatchEvent(c)})};
|
|
166
|
+
sA=function(a){var b=new ry(a.f);sy(b,function(){iA(a)});var c=new Gw(a.wc);Hw(c,function(e){e.Yd&&e.Yd();cA(a,_.rg,e)},function(e){e.Ye&&e.Ye();cA(a,_.sg,e)},function(e,f){f||(e.Yd&&e.Yd(),cA(a,_.rg,e),e.Ye&&e.Ye(),cA(a,_.sg,e))});var d=new Fw(a.j);d.a.add(b);d.a.add(c);return d};tA=function(a,b){a.H=new oy(b,Math.min(.5,b/2));a.H.a=ny;aA(a);a.Va=(new _.aj(function(){nA(a)})).eb(.25)};
|
|
167
|
+
nA=function(a){switch(a.F){case Rz:a:if(a.j.ended||ax(a.J))var b=!0;else{if(a.isLive()){b=rw(a.f.presentationTimeline);var c=a.getBufferInfo();if(null!==c&&(c=c.Ba(),null!==c&&c>=b)){b=!0;break a}}b=!1}break;default:b=!1}if(a.J){var d=cx(a.J);c=d.video;d=d.audio;var e=a.j.currentTime;c&&d?(c=c.Ha(e),d=d.Ha(e),c=Math.min(c,d)):c=c?c.Ha(e):d?d.Ha(e):0}else c=0;if(d=a.H){d=a.H;var f=b,g=d.f.get(d.a);e=d.a;c=f||c>=g?my:ny;d.a=c;d=e!=c}c=d;d=yA(a);c||a.getState()===_.cn&&!d?(a.log.debug("Buffering state changed. Is buffering",
|
|
168
|
+
d,"buffered to end",b,"state",a.getState()),aA(a)):a.Yc&&oA(a)};uA=function(a){var b={yb:function(){return Oy(a.A)},X:a.J,Cb:a.getNetworkEngine(),Xe:a.hi.bind(a),We:a.gi.bind(a),onError:a.onError.bind(a),xg:a.ck.bind(a),onEvent:a.ve.bind(a),Cg:a.ii.bind(a),Zd:a.qk.bind(a),Ce:function(){return a.g},pe:a.rh.bind(a),Xg:a.$k.bind(a),hd:a.m};return new _.Uy(a.f,b)};kA=function(a){var b=_.yk(a.configuration.drm);a.m.g=b};
|
|
169
|
+
AA=function(a){a.B&&a.B.configure(a.configuration.manifest);a.m&&kA(a);if(a.a){a.a.j=a.configuration.streaming;try{for(var b=_.u(a.f.periods),c=b.next();!c.done;c=b.next())wA(a,c.value)}catch(e){a.onError(e)}c=Xy(a.a);var d=Yy(a.a);b=gA(a)||a.f.periods[0];c=Dx(c,d,b.variants);a.g&&c&&c.allowedByApplication&&c.allowedByKeySystem?jA(a,b.variants):(a.log.debug("Choosing new streams after changing configuration"),zA(a,b))}a.g&&(a.g.configure(a.configuration.abr),a.configuration.abr.enabled&&!a.V?a.g.enable():
|
|
170
|
+
a.g.disable())};Sx=function(a){if(a.f&&a.A){var b=BA(a),c=[];a=_.u(CA(a));for(var d=a.next();!d.done;d=a.next()){d=d.value;var e=yx(d);e.active=d==b;c.push(e)}return c}return[]};Qx=function(a,b){if(a.f&&a.a){var c=gA(a),d=c.textStreams.find(function(e){return e.id==b.id});d?(DA(a,c,d,!1),EA(a,d),a.Ga=d.language):a.log.error(_.ev,b.id)}};
|
|
171
|
+
Tx=function(a,b,c){var d=void 0===d?0:d;if(a.f&&a.a){var e=gA(a);if(a.configuration.abr.enabled&&b)a.log.info("Disable ABR and enable manual track selection to select "+(b.width+"x"+b.height+"@"+b.bandwidth)),a.configuration.abr.enabled=!1,a.g.disable();else if(!a.configuration.abr.enabled&&!b){a.log.info("Enable ABR Selection");a.configuration.abr.enabled=!0;a.g.enable();a.T=null;c=jA(a,e.variants);null!=a.na&&(a.xc=a.na,a.na=null);null==c||a.V||qA(a,c);return}if(b){a.T=b.id;var f=e.variants.find(function(g){return g.id==
|
|
172
|
+
b.id});f?(a.T=f.video.id,Ax(f)?(FA(a,e,f,!1),GA(a,f,c,d),null==a.na&&(a.na=a.xc),a.xc=new jy(f),jA(a,e.variants)):a.log.error("Unable to switch to restricted track",b.id)):a.log.error("No variant with id",b.id)}else a.T=null,null!=a.na&&(a.xc=a.na,a.na=null),c=jA(a,e.variants),null==c||a.V||qA(a,c)}};
|
|
173
|
+
Rx=function(a,b){if(a.a&&(a.f||a.A)){var c=Yy(a.a),d=Xy(a.a),e=gw(a.f.periods,Oy(a.A)),f=a.f.periods[e?a.f.periods.indexOf(e):0].variants.filter(function(m){return m.audio.id==b&&Ax(m)});e=f.find(function(m){return m.video.id==c.id});var g=!1;if(!e){a.log.debug("Cannot find exact variant, looking for anything else that matches with given audioId");g=!0;var h=a.getTrackManager().La();if(h){var l=h.renditions.map(function(m){return m.id});e=f.find(function(m){return l.find(function(n){return n==m.video.id})})}}if(e){if(d.codecs.split(".")[0]===
|
|
174
|
+
e.audio.codecs.split(".")[0]){d=e.audio;a.yc=d.id;a.g.setVariants(f);f=gA(a);FA(a,f,e,!1);g||a.V?GA(a,e,!0,0):_.gz(a.a,d,!0,0);Promise.resolve();return}a.log.warn("Target audio codecs not compatible with active audio codecs.")}}Promise.reject()};Ux=function(a){var b=a.Pe;return a.f?a.J.getTextDisplayer().isTextVisible():b};
|
|
175
|
+
Px=function(a,b){var c,d,e,f;return _.B(function(g){c=a.Pe;d=b;if(c==d)return g["return"]();a.Pe=d;if(a.F!==Rz)return g.G(0);a.J.getTextDisplayer().setTextVisibility(b);if(a.configuration.streaming.alwaysStreamText)return g.G(0);if(!b)return fz(a.a),g.G(0);e=gA(a);f=_.Cx(e.textStreams,a.Ga,a.vc);return 0<f.length?_.x(g,cz(a.a,f[0]),0):g.G(0)})};
|
|
176
|
+
FA=function(a,b,c,d){var e=a.getTrackManager();a.B.setCurrentVariant(c);if(e){var f=a.I.B;if(c.video){Xx(e,c.video,d);var g=e.fa();f.j!==g&&(f.j=g,f.a.push({timestamp:Date.now()/1E3,id:g.id,trackId:g.track.id,type:g.track.type,fromAdaptation:d,width:g.width,height:g.height,bandwidth:g.bandwidth}))}c.audio&&(Xx(e,c.audio,d),e=e.Ia(),f.f!==e&&(f.f=e,f.a.push({timestamp:Date.now()/1E3,id:e.id,trackId:e.track.id,type:e.track.type,fromAdaptation:d,width:null,height:null,bandwidth:e.bandwidth})))}dy(a.P,
|
|
177
|
+
b).variant=c};DA=function(a,b,c,d){dy(a.P,b).text=c;if(b=a.getTrackManager())Xx(b,c,d),c=b.Ja(),a=a.I.B,a.g!==c&&(a.g=c,a.a.push({timestamp:Date.now()/1E3,id:c.id,trackId:c.track.id,type:c.track.type,fromAdaptation:d,width:null,height:null,bandwidth:null}))};
|
|
178
|
+
pA=function(a,b){for(var c=0;c<b.length;c++){for(var d=b[c],e=new Map,f=_.u(d.variants),g=f.next();!g.done;g=f.next())if(g=g.value,g.video&&g.video.closedCaptions){g=g.video;for(var h=_.u(g.closedCaptions.keys()),l=h.next();!l.done;l=h.next())if(l=l.value,!e.has(l)){var m={id:a.Ug++,originalId:l,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:function(){return null},getSegmentReference:function(){return null},initSegmentReference:null,Na:0,mimeType:_.dc,codecs:"",kind:"caption",
|
|
177
179
|
encrypted:!1,keyId:null,language:g.closedCaptions.get(l),label:null,type:_.Ce,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:g.roles,channelsCount:null,closedCaptions:null};e.set(l,m)}}e=_.u(e.values());for(f=e.next();!f.done;f=e.next())d.textStreams.push(f.value)}};
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
g.initDataType,g.initData,g.keyId)}}}};
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
a.g.chooseVariant())};
|
|
185
|
-
|
|
186
|
-
text:null}};
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
missingKeys:g,restrictedKeyStatuses:h});};
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
return _.x(
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
_.
|
|
200
|
-
_.
|
|
201
|
-
b)
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
_.t.
|
|
207
|
-
_.t.
|
|
208
|
-
_.t.
|
|
209
|
-
b[
|
|
210
|
-
a
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
_.t.
|
|
220
|
-
_.t.
|
|
221
|
-
_.t.
|
|
222
|
-
_.t.
|
|
223
|
-
_.t
|
|
224
|
-
_.t.
|
|
225
|
-
_.t.
|
|
226
|
-
_.t.
|
|
227
|
-
_.t.
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
_.t.
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
_.t.
|
|
241
|
-
_.t.
|
|
242
|
-
_.t.
|
|
243
|
-
_.t.
|
|
244
|
-
_.t.
|
|
245
|
-
_.t.
|
|
246
|
-
_.
|
|
247
|
-
|
|
248
|
-
_.
|
|
249
|
-
_.t.
|
|
250
|
-
_.t.
|
|
251
|
-
_.t.
|
|
252
|
-
_.t.
|
|
253
|
-
_.t.
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
_.t.
|
|
258
|
-
|
|
259
|
-
_.t.
|
|
260
|
-
_.x(n,b.
|
|
261
|
-
|
|
262
|
-
_.
|
|
263
|
-
_.
|
|
264
|
-
e.startTime
|
|
180
|
+
lA=function(a,b){for(var c=a.a?Xy(a.a):null,d=a.a?Yy(a.a):null,e=_.u(b),f=e.next();!f.done;f=e.next())xx(a.m,c,d,f.value);c=Xv(b,function(g){return g.variants.some(Ax)});if(0===c)throw new _.L(_.M,4,4032);if(c<b.length)throw new _.L(_.M,4,4011);c=_.u(b);for(d=c.next();!d.done;d=c.next())d=d.value,ux(d.variants,a.configuration.restrictions,a.Pg)&&a.a&&gA(a)==d&&iA(a),HA(a,d.variants)};
|
|
181
|
+
wA=function(a,b){var c=a.a?Xy(a.a):null,d=a.a?Yy(a.a):null;xx(a.m,c,d,b);d=b.variants;if(!d.some(Ax))throw new _.L(_.M,4,4011);HA(a,b.variants);ux(d,a.configuration.restrictions,a.Pg)&&a.a&&gA(a)==b&&iA(a);if(!_.ki(2)&&(c=a.m?a.m.getDrmInfo():null)){d=_.u(d);for(var e=d.next();!e.done;e=d.next()){e=_.u(e.value.drmInfos);for(var f=e.next();!f.done;f=e.next())if(f=f.value,f.keySystem===c.keySystem){f=_.u(f.initData||[]);for(var g=f.next();!g.done;g=f.next())g=g.value,_.om(a.m,g.keyId,g.initData)||_.fm(a.m,
|
|
182
|
+
g.initDataType,g.initData,g.keyId)}}}};GA=function(a,b,c,d){c=void 0===c?!1:c;d=void 0===d?0:d;a.V?(a.ma=b,a.Og=c,a.Hg=d):hz(a.a,b,c,d)};EA=function(a,b){a.V?a.ga=b:_.gz(a.a,b,!0,0)};IA=function(a){if(a.a&&a.f){var b=Vy(a.a),c=gA(a);null!=b&&b==c&&(Xy(a.a),Yy(a.a),_.Wy(a.a,_.Ce),dy(a.P,c),dy(a.P,c))}};
|
|
183
|
+
vA=function(a,b){function c(g,h){if(!g)return null;var l=g.findSegmentPosition(h-f.startTime);return null==l?null:(l=g.getSegmentReference(l))?l.startTime+f.startTime:null}var d=Xy(a.a),e=Yy(a.a),f=gA(a);d=c(d,b);e=c(e,b);return null!=e&&null!=d?Math.max(e,d):null!=e?e:null!=d?d:b};yA=function(a){return a.m&&a.m.D?!0:a.H?a.H.getState()===ny:!1};aA=function(a){if(a.I&&a.H&&a.A){var b=JA(a)===_.cn,c=a.zc;c.j=b;uy(c);a.A.j.o=b;oA(a)}};oA=function(a){Uz(a,JA(a))};
|
|
184
|
+
JA=function(a){var b=a.getDuration(),c=a.getPosition();return a.j&&a.j.ended||(a.Yc||a.ha===_.en)&&1>=Math.abs(b-c)?_.en:yA(a)||a.Ud?_.cn:a.j&&a.j.paused?_.ln:_.mn};
|
|
185
|
+
jA=function(a,b){try{HA(a,b)}catch(e){return a.onError(e),null}var c=b.filter(function(e){return Ax(e)});c=Hx(c,a.yc);var d=a.xc.create(c);d=Array.from(d.values());a.g.setVariants(d);if(null!==a.T&&null!==a.yc&&(d=d.find(function(e){return e.video.id==a.T&&e.audio.id==a.yc}),a.T=null,d))return d;if(a.configuration.abr.enabled||null===a.T)return a.g.chooseVariant();c=c.find(function(e){return null!==e.video&&e.video.id===a.T});return c?c:(a.log.warn("Selected video track not found. Falling back to ABR selection"),
|
|
186
|
+
a.g.chooseVariant())};zA=function(a,b,c){c=void 0===c?!0:c;var d=jA(a,b.variants);a.yc=d&&d.audio&&d.audio.id;d&&(FA(a,b,d,!0),GA(a,d,c));(c=_.Cx(b.textStreams,a.Ga,a.vc)[0]||null)&&(a.configuration.streaming.alwaysStreamText||Ux(a))&&(DA(a,b,c,!0),EA(a,c))};
|
|
187
|
+
MA=function(a,b){a.V=!0;a.g.disable();a.log.debug("Choosing new streams after period changed");var c=jA(a,b.variants),d=_.Cx(b.textStreams,a.Ga,a.vc)[0]||null;a.ma&&(b.variants.includes(a.ma)&&(c=a.ma),a.ma=null);a.ga&&(b.textStreams.includes(a.ga)&&(d=a.ga),a.ga=null);c&&KA(a,b,function(){return FA(a,b,c,!0)});d&&(a.configuration.streaming.alwaysStreamText||Ux(a))&&KA(a,b,function(){return DA(a,b,d,!0)});b===gA(a)&&LA(a);return a.configuration.streaming.alwaysStreamText||Ux(a)?{variant:c,text:d}:
|
|
188
|
+
{variant:c,text:null}};qA=function(a,b,c,d){c=void 0===c?!1:c;d=void 0===d?0:d;if(a.configuration.abr.enabled){a.log.debug("switch_");var e=NA(a,b);KA(a,e,function(){return FA(a,e,b,!0)});e===gA(a)&&LA(a);a.a&&hz(a.a,b,c,d)}};iA=function(a){var b=a.getTrackManager();b&&a.F!==Vz&&(b.l&&(Wx(b),b.l.trigger(new _.I(_.Dq))),LA(a))};LA=function(a){var b=gA(a);if(b){var c=a.Ac.get(b)||[];for(a.Ac["delete"](b);c.length;)c.shift()()}};KA=function(a,b,c){a.Ac.has(b)||a.Ac.set(b,[]);a.Ac.get(b).push(c)};
|
|
189
|
+
cA=function(a,b,c){a.trigger(new _.I(b,{detail:{schemeIdUri:c.schemeIdUri,value:c.value,startTime:c.startTime,endTime:c.endTime,id:c.id,eventElement:c.eventElement,type:c.type}}))};
|
|
190
|
+
HA=function(a,b){var c=a.m?_.K.Bf(a.m.ma):{},d=Object.keys(c);d=d.length&&"00"==d[0];for(var e=!1,f=!1,g=[],h=[],l=_.u(b),m=l.next();!m.done;m=l.next()){m=m.value;var n=[];m.audio&&n.push(m.audio);m.video&&n.push(m.video);n=_.u(n);for(var p=n.next();!p.done;p=n.next())if(p=p.value,p.keyId){var q=c[d?"00":p.keyId];q?hA.includes(q)&&(h.includes(q)||h.push(q)):g.includes(p.keyId)||g.push(p.keyId)}m.allowedByApplication?m.allowedByKeySystem&&(e=!0):f=!0}if(!e)throw new _.L(_.M,4,4012,{hasAppRestrictions:f,
|
|
191
|
+
missingKeys:g,restrictedKeyStatuses:h});};CA=function(a){var b=gA(a);if(null==b)return[];IA(a);return b.variants.filter(function(c){return Ax(c)})};OA=function(a){var b=gA(a);if(null==b)return[];IA(a);return b.textStreams.filter(function(c){return!a.Td.has(c)})};gA=function(a){var b=Oy(a.A),c=null;a=_.u(a.f.periods);for(var d=a.next();!d.done;d=a.next())d=d.value,d.startTime<=b&&(c=d);return c};BA=function(a){var b=gA(a);return b&&dy(a.P,b).variant};
|
|
192
|
+
NA=function(a,b){for(var c=_.u(a.f.periods),d=c.next();!d.done;d=c.next())if(d=d.value,d.variants.includes(b))return d;return null};
|
|
193
|
+
PA=function(a,b,c){var d,e,f,g,h,l,m,n,p,q,r,v,y,A,E,F,D,J,ja;return _.B(function(P){switch(P.a){case 1:return d=_.xn,_.Af(P,2),_.x(P,_.Ep(b.url,a.getNetworkEngine(),a.configuration.manifest.attemptParameters,b.type||null),4);case 4:return e=P.f,e.configure(a.configuration.manifest),_.x(P,e.start(b.url,dA(a)),5);case 5:f=P.f;eA(f.periods);if(!f.periods.length)throw new _.L(_.M,4,4014);return _.x(P,a.B.stop(),6);case 6:a.B=e;g=c.audio&&c.audio.id;h=c.video&&c.video.id;a.f.periods=f.periods;l=gw(f.periods,
|
|
194
|
+
Oy(a.A))||f.periods[0];sx(a.f,_.Fg(a.configuration.preferredVideoCodec),_.Fg(a.configuration.preferredAudioCodec),a.configuration.preferredAudioChannelCount);m=Ix(g,h,l.variants);n=_.Cx(l.textStreams,a.Ga,a.vc)[0]||null;jA(a,l.variants);p=m&&m.video;q=m&&m.audio;r=[];v=new Set;y=_.u(l.variants);for(A=y.next();!A.done;A=y.next())E=A.value,E.video&&v.add(E.video),E.audio&&v.add(E.audio);F=_.u(_.nf(v).concat(_.nf(l.textStreams)));for(D=F.next();!D.done;D=F.next())J=D.value,r.push(J.createSegmentIndex());
|
|
195
|
+
return _.x(P,Promise.all(r),7);case 7:Pz(a.a,d.AUDIO,q);Pz(a.a,d.VIDEO,p);Pz(a.a,d.TEXT,n);m&&FA(a,l,m,!1);a.log.info("Switch CDN successful.");_.Bf(P,0);break;case 2:ja=_.Cf(P);if(!e){P.G(8);break}return _.x(P,e.stop(),8);case 8:throw ja;}})};
|
|
196
|
+
dA=function(a){return{networkingEngine:a.getNetworkEngine(),filterNewPeriod:function(b){return wA(a,b)},filterAllPeriods:function(b){return lA(a,b)},onTimelineCueAdded:function(b){var c=a.wc;a:{var d=_.u(c.a);for(var e=d.next();!e.done;e=d.next())if(e=e.value,e.schemeIdUri===b.schemeIdUri&&e.startTime===b.startTime&&e.endTime===b.endTime){d=e;break a}d=null}null==d&&(c.a.add(b),c.f(b))},onEvent:function(b){return a.ve(b)},onError:function(b){return a.onError(b)}}};QA=function(){};
|
|
197
|
+
RA=function(){var a=MediaSource.prototype.addSourceBuffer;MediaSource.prototype.addSourceBuffer=function(b){for(var c=[],d=0;d<arguments.length;++d)c[d]=arguments[d];c=a.apply(this,c);c.abort=function(){};return c}};SA=function(){var a=SourceBuffer.prototype.remove;SourceBuffer.prototype.remove=function(b,c){return a.call(this,b,c-.001)}};TA=function(){var a=MediaSource.isTypeSupported;MediaSource.isTypeSupported=function(b){return"mp2t"==b.split(/ *; */)[0].split("/")[1].toLowerCase()?!1:a(b)}};
|
|
198
|
+
UA=function(){var a=MediaSource.isTypeSupported;MediaSource.isTypeSupported=function(b){return"opus"!=_.Zv(b)[0]&&a(b)}};
|
|
199
|
+
VA=function(){var a=MediaSource.isTypeSupported,b=/^dv(?:h[e1]|a[v1])\./;MediaSource.isTypeSupported=function(c){var d=c.split(/ *; */),e=d.shift(),f={};d=_.u(d);for(var g=d.next();!g.done;g=d.next())g=g.value.split("\x3d"),f[g[0]]=g[1].replace(/"(.*)"/,"$1");d=f.codecs;if(!d)return a(c);var h=!1,l=!1;c=d.split(",").filter(function(n){b.test(n)&&(l=!0);/^(hev|hvc)1\.2/.test(n)&&(h=!0);return!0});l&&(h=!1);f.codecs=c.join(",");h&&(f.eotf="smpte2084");for(var m in f)e+="; "+m+'\x3d"'+f[m]+'"';return cast.__platform__.canDisplayType(e)}};
|
|
200
|
+
WA=function(a){_.lq.call(this,a);a=a.getSurface().getMedia();this.a=null;for(var b=0;b<a.textTracks.length;++b){var c=a.textTracks[b];c.mode=_.Zc;c.label===gv&&(this.a=c)}this.a||(this.a=a.addTextTrack(_.zv,gv));this.a.mode=_.nd};XA=function(a,b){var c=a.mode;a.mode=c==_.ne?_.ne:_.nd;for(var d=a.cues,e=d.length-1;0<=e;e--){var f=d[e];f&&b(f)&&a.removeCue(f)}a.mode=c};YA=function(){};Dv=[112,115,115,104,0,0,0,0];_.Pv.prototype.f=function(){return this.keyInfo};_.Qv.prototype.getPosition=function(){return this.position};
|
|
201
|
+
_.Qv.prototype.f=function(){return this.keyInfo};_.$A=function ZA(a){var c,d,e,f,g,h;return _.If(ZA,function(l){1==l.a&&(c=-1,e=d=void 0,f=_.u(a),g=f.next());if(5!=l.a){if(g.done)return-1===c?l.G(0):_.x(l,{Je:c,Jk:d,item:e,next:void 0},0);h=g.value;return 0<=c?_.x(l,{Je:c,item:e,Jk:d,next:h},5):l.G(5)}c++;d=e;e=h;g=f.next();return l.G(2)})};
|
|
202
|
+
_.bw.prototype.track=function(a){null!=this.a&&(this.a&&(this.a.off(_.je,this.f),this.g&&this.a.off(_.Fe,this.f)),this.a=null);a&&(this.a=a,this.a.on(_.je,this.f,this))};
|
|
203
|
+
_.bw.prototype.append=function(a,b,c){var d=this.m?this.m(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};var e=this.U.find(function(f){return f.start>=a&&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{d=_.u(this.U);for(e=d.next();!e.done;e=d.next())e=e.value,a>=e.start&&a<e.end?e.end=a:b>=e.start&&b<e.end&&(e.start=
|
|
204
|
+
b);this.U.push(c);this.U.sort(aw)}ew(this);this.f();this.a&&this.a.trigger(new _.I(_.Ue))};_.bw.prototype.clear=function(){this.U=[];ew(this);this.a&&(this.a.trigger(new _.I(_.Ue)),this.a.trigger(new _.I(_.sc)))};
|
|
205
|
+
_.bw.prototype.f=function(){if(this.a){var a=this.a.getPosition();if(0<=a){a:{for(var b=this.U.length,c=Number.MAX_SAFE_INTEGER,d=0;d<b;d++){var e=this.U[d];c=Math.min(e.start,c);if(e.start<=a&&e.end>a){a=.1>e.end-a&&d<b-1?this.U[d+1].rendition:e.rendition;break a}if(e.start>a)break}a=0<b&&c>a&&.25>c-a?this.U[0].rendition:null}if(a&&this.j!==a&&(this.j=a,this.a)){c=b=-1;if(a)b=a.width||-1,c=a.height||-1;else if(d=this.a.getSurface().getMedia())b=d.videoWidth,c=d.videoHeight;this.a.trigger(new _.I(_.uc,
|
|
206
|
+
{detail:{width:b,height:c,bandwidth:a?a.bandwidth:null,rendition:a}}))}}}};_.lw.prototype.getDuration=function(){return this.f};_.lw.prototype.getPresentationStartTime=function(){return this.A};_.lw.prototype.offset=function(a){null!=this.j&&(this.j+=a);null!=this.g&&(this.g+=a)};_.lw.prototype.isLive=function(){return Infinity==this.f&&!this.o};vw.prototype.release=function(){this.f=function(){};this.a.clear()};vw.prototype.cues=function(){return this.a};
|
|
207
|
+
xw.prototype.next=function(){var a=this.g.get(this.a);a&&0<a.a.length?(this.f+=1,a.Ka().length&&this.f===a.a.length&&(this.a+=1,this.f=0)):(this.a+=1,this.f=0);a=yw(this);return{value:a,done:!a}};_.t=_.zw.prototype;_.t.destroy=function(){this.a=[];return Promise.resolve()};
|
|
208
|
+
_.t.Dc=function(a){for(var b=this.a.length-1;0<=b;--b){var c=this.a[b];if(a>=c.startTime&&a<c.endTime)return c.position}if(this.a.length&&a<this.a[0].startTime)return this.a[0].position;this.h.warn("No Segment found for "+a+". We have "+this.a.length+" references");for(a=0;a<this.a.length;a++)b=this.a[a],this.h.debug("SegmentIndex Ref "+a+" start: "+b.startTime+" end: "+b.endTime+" pos: "+b.position);return null};
|
|
209
|
+
_.t.get=function(a){if(0==this.a.length)return null;a-=this.a[0].position;return 0>a||a>=this.a.length?null:this.a[a]};_.t.offset=function(a){this.h.info("Apply offset"+a+" to segment index");for(var b=_.u(this.a),c=b.next();!c.done;c=b.next())c=c.value,c.startTime+=a,c.endTime+=a,c.Na-=a};
|
|
210
|
+
_.t.Vc=function(a,b){var c=a-this.a[0].position;if(0<=c&&c<this.a.length)for(this.h.warn("Accounting for segment duration drift",b,"at",c),this.a[c].endTime+=b,c+=1;c<this.a.length;++c)this.a[c].startTime+=b,this.a[c].endTime+=b};_.t.getDuration=function(){return this.a[this.a.length-1].endTime-this.a[0].startTime};
|
|
211
|
+
_.t.ya=function(a){for(var b=[],c=[],d=0,e=0;d<this.a.length&&e<a.length;){var f=this.a[d],g=a[e];f.startTime<g.startTime?(b.push(f),d++):(f.startTime>g.startTime?0===d?c.push(g):this.h.info("Refusing to rewrite original references on update!"):(.1<Math.abs(f.endTime-g.endTime)?(f=new _.Qv(f.position,g.startTime,g.endTime,g.Ka,g.sa,g.ea,g.Na,g.keyInfo,g.Fc,g.timescale,g.horizontalTiles,g.verticalTiles,g.durationPerTile),b.push(f)):b.push(f),d++),e++)}for(;d<this.a.length;)b.push(this.a[d++]);if(b.length)for(d=
|
|
212
|
+
b[b.length-1].position+1;e<a.length;)f=a[e++],f=new _.Qv(d++,f.startTime,f.endTime,f.Ka,f.sa,f.ea,f.Na,f.keyInfo,f.Fc,f.timescale,f.horizontalTiles,f.verticalTiles,f.durationPerTile),b.push(f);else b=a;a=b;if(c.length&&b.length){a=[];e=b[0].position;d=c.length;c=_.u(c);for(f=c.next();!f.done;f=c.next())f=f.value,a.push(new _.Qv(e-d--,f.startTime,f.endTime,f.Ka,f.sa,f.ea,f.Na,f.keyInfo,f.Fc,f.timescale,f.horizontalTiles,f.verticalTiles,f.durationPerTile));b=_.u(b);for(f=b.next();!f.done;f=b.next())a.push(f.value)}this.a=
|
|
213
|
+
a};_.t.replace=function(a){this.a=a};Fw.prototype.release=function(){this.g.stop();for(var a=_.u(this.a),b=a.next();!b.done;b=a.next())b.value.release();this.a.clear()};Gw.prototype.release=function(){this.m=null;this.j.clear();this.a=function(){};this.f=function(){};this.g=function(){}};
|
|
214
|
+
Gw.prototype.o=function(a,b){for(var c={},d=_.u(this.m.cues()),e=d.next();!e.done;c={je:c.je,xd:c.xd},e=d.next()){e=e.value;c.je=this.j.get(e)||null;c.xd=a<e.startTime?1:a>e.endTime?3:2;this.j.set(e,c.xd);var f=this.w.find(function(g){return function(h){return h.pc===g.je&&h.oc===g.xd}}(c));f&&f.dc(e,b)}};_.t=Kw.prototype;_.t.destroy=function(){this.g=this.w=null;this.o.clear();return Promise.resolve()};
|
|
215
|
+
_.t.remove=function(a,b){var c=this;return Promise.resolve().then(function(){!c.g||!c.g.remove(a,b)||null==c.a||b<=c.a||a>=c.f||(a<=c.a&&b>=c.f?c.a=c.f=null:a<=c.a&&b<c.f?c.a=b:a>c.a&&b>=c.f&&(c.f=a))})};_.t.tb=function(){return this.a};_.t.Ba=function(){return this.f};_.t.fc=function(a){return null==this.a||null==this.f?!1:a>=this.a&&a<this.f};_.t.Ha=function(a){return null==this.f||this.f<a?0:this.f-Math.max(a,this.a)};
|
|
216
|
+
Pw.prototype.init=function(a){var b=muxjs.mp4.probe;a=_.N(a);this.m=b.videoTrackIds(a);this.j=b.timescale(a);this.a.init()};Pw.prototype.g=function(a,b){var c=_.N(a);(c=this.a.parse(c,this.m,this.j))&&c.captions&&b(c.captions);this.a.clearParsedCaptions()};Pw.prototype.f=function(){this.a.resetCaptionStream()};_.Qw.prototype.init=function(){};_.Qw.prototype.g=function(){};_.Qw.prototype.f=function(){};Rw.prototype.destroy=function(){this.a&&(this.a.dispose(),this.a=null);return Promise.resolve()};Rw.prototype.A=function(a){this.g=a.captions;var b=new Uint8Array(a.data.byteLength+a.initSegment.byteLength);b.set(a.initSegment,0);b.set(a.data,a.initSegment.byteLength);a.type===_.Re?this.o.push(b):a.type===_.lc&&this.m.push(b)};Rw.prototype.w=function(){var a={video:_.Rh.apply(_.Kh,_.nf(this.o)),captions:this.g,audio:_.Rh.apply(_.Kh,_.nf(this.m))};this.f.resolve(a);this.j=!1};_.t=_.Ww.prototype;
|
|
217
|
+
_.t.destroy=function(){var a=this;this.I=!0;var b=[],c;for(c in this.g){var d=this.g[c],e=d[0];this.g[c]=d.slice(0,1);e&&b.push(e.p["catch"](Mv));for(e=1;e<d.length;++e)d[e].p["catch"](Mv),d[e].p.reject()}this.f&&b.push(this.f.destroy());this.A&&b.push(this.A.destroy());for(var f in this.w)b.push(this.w[f].destroy());return Promise.all(b).then(function(){a.o&&(a.o.release(),a.o=null);a.j&&(a.j.removeAttribute("src"),a.j.load(),a.j=null);a.m=null;a.f=null;a.A=null;a.a={};a.w={};a.D={};a.F=null;a.J=
|
|
218
|
+
!1;for(var g in a.g);a.g={}})};
|
|
219
|
+
_.t.init=function(a,b){var c=this,d;return _.B(function(e){if(1==e.a)return d=_.xn,_.x(e,c.H,2);a.forEach(function(f,g){var h=_.Yi(f.mimeType,f.codecs);if(g==d.TEXT)$w(c,h);else{var l=new Map;l.set(g,h);if((!MediaSource.isTypeSupported(h)||!b||f.keyInfo)&&Tw(h,g)){c.w[g]=new Rw;h="aac"==h.toLowerCase().split(";")[0].split("/")[1]?h.replace(/aac/i,_.Hd):Sw(g,h);var m=new Map;m.set(g,h);try{var n=h.match(/"(.*?)"/)[0].replace(/"/g,"").split(","),p=new Map;if(1<n.length)for(var q=_.u(n),r=q.next();!r.done;r=
|
|
220
|
+
q.next()){var v=r.value;v.startsWith("avc")?p.set(_.Re,'video/mp4;codecs\x3d"'+v+'"'):v.startsWith("mp4a")&&p.set(_.lc,'audio/mp4;codecs\x3d"'+v+'"')}l=0<p.size?p:m}catch(y){l=m}}Zw(c,l)}});_.z(e)})};_.t.tb=function(a){return a===_.Ce?this.f.tb():(a=bx(this,a))?a.tb():null};_.t.Ba=function(a){return a===_.Ce?this.f.Ba():(a=bx(this,a))?a.Ba():null};_.t.fc=function(a,b,c){return a===_.Ce?this.f.fc(b):(a=bx(this,a))?a.fc(b,!1,c):!1};
|
|
221
|
+
_.t.Ha=function(a,b){if(a===_.Ce)return this.f.Ha(b);var c=bx(this,a);return c?c.Ha(b):0};_.t.remove=function(a,b,c){var d=this;return a===_.Ce?this.f.remove(b,c):ex(this,a,this.Qg.bind(this,a,b,c)).then(function(){if(a===_.Re){var e=d.tb(a),f=d.Ba(a);null!==e&&null!==f&&fw(d.B,e,f)}else a===_.lc&&(e=d.B,e.a&&e.a.trigger(new _.I(_.sc)))})};_.t.clear=function(a){if(a==_.Ce){if(!this.f)return Promise.resolve();this.F.f();return this.f.remove(0,Infinity)}return ex(this,a,this.Qg.bind(this,a,0,this.m.duration))};
|
|
222
|
+
_.t.flush=function(a){return a==_.Ce?Promise.resolve():ex(this,a,this.$f.bind(this,a))};_.t.endOfStream=function(a){var b=this;return jx(this,function(){ax(b)||(a?b.m.endOfStream(a):b.m.endOfStream())})};_.t.getDuration=function(){return this.m.duration};_.t.we=function(a,b){this.h.debug("Appending data to "+a+Vu);try{this.a[a].appendBuffer(b)}catch(c){throw this.h.warn("Failed to append data for "+a,c),c;}this.h.debug("Done Appending data to "+a+Vu)};
|
|
223
|
+
_.t.Qg=function(a,b,c){if(c<=b)this.Pc(a);else{this.h.debug("Removing data from "+a+" range:",b,c);try{this.a[a].remove(b,c)}catch(d){throw this.h.warn("Failed to remove data from "+a+" buffer. Range:",b,c,d),d;}this.h.debug("Done Removing data from "+a+" range:",b,c)}};
|
|
224
|
+
_.t.jh=function(a){try{this.h.debug("Aborting operations for "+a+Vu);var 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(d){throw this.h.warn("Failed to abort operations for "+a+Vu,d),d;}this.h.debug("Done Aborting operations for "+a+Vu);this.Pc(a)};
|
|
225
|
+
_.t.$f=function(a){try{this.j.readyState>HTMLMediaElement.HAVE_NOTHING?(this.h.debug("Flushing buffer for "+a),this.j.currentTime-=.001):this.h.warn("Skip buffer flush for "+a+" with element state: "+this.j.readyState)}catch(b){throw this.h.warn("Failed to flush buffer for "+a,b),b;}this.h.debug("Done Flushing buffer for "+a);this.Pc(a)};
|
|
226
|
+
_.t.Wg=function(a,b){0>b&&(b+=.001);try{this.h.debug("Setting timestamp offset for "+a,b),this.a[a].timestampOffset=b}catch(c){throw this.h.warn("Failed to set timestamp offset for "+a,b,c),c;}this.h.debug("Done Setting timestamp offset for "+a,b);this.Pc(a)};
|
|
227
|
+
_.t.Sk=function(a,b,c){try{this.h.debug("Setting append window for "+a,b,c),this.a[a].appendWindowStart=0,this.a[a].appendWindowEnd=c,this.a[a].appendWindowStart=b}catch(d){throw this.h.warn("Failed to set append window for "+a,b,c,d),d;}this.h.debug("Done Setting append window for "+a,b,c);this.Pc(a)};_.t.S=function(a){this.g[a][0].p.reject(new _.L(_.M,3,3014,{mediaError:this.j.error?this.j.error.code:0}))};
|
|
228
|
+
_.t.Pc=function(a){var b=this.g[a][0];b&&(b.p.resolve(),this.h.debug("Update-End received for "+a),mx(this,a))};_.t.getTextDisplayer=function(){return this.A};var Yw=window.URL.createObjectURL;_.w(Jx,_.R);_.t=Jx.prototype;_.t.initialize=function(a){this.l=a};_.t.release=function(){this.g=[];this.a.clear();this.f.clear()};_.t.load=function(){};_.t.destroy=function(){this.release();this.l=null};_.t.getVideoTracks=function(){return Kx(this,_.ui)};_.t.getAudioTracks=function(){return Kx(this,_.Q)};_.t.ia=function(){return Kx(this,_.O)};_.t.fa=function(){return this.a.get(_.ui)||null};_.t.Ia=function(){return this.a.get(_.Q)||null};_.t.Ja=function(){return this.a.get(_.O)||null};
|
|
229
|
+
_.t.Xa=function(){return this.f.get(_.ui)||null};_.t.hb=function(){return this.f.get(_.Q)||null};_.t.ib=function(){return this.f.get(_.O)||null};_.t.La=function(){return Lx(this,_.ui)};_.t.pa=function(){return Lx(this,_.Q)};_.t.qa=function(){return Lx(this,_.O)};_.t.cb=function(a){Nx(this,_.ui,a)};_.t.va=function(a){Nx(this,_.Q,a)};_.t.Ea=function(a){Nx(this,_.O,a)};_.t.bb=function(a,b){Mx(this,_.ui,a,void 0===b?!1:b)};_.t.ob=function(a,b){Mx(this,_.Q,a,void 0===b?!1:b)};
|
|
230
|
+
_.t.pb=function(a,b){Mx(this,_.O,a,void 0===b?!1:b)};_.t.addTextTrack=function(a){var b=this;return _.B(function(c){return b.l?_.x(c,b.l.addTextTrack(a.url,a.language,a.kind,a.mimeType,a.codec,a.label),0):c.G(0)})};_.t.ka=function(){return!!this.l&&this.l.ka()};Jx.prototype.isAbrEnabled=Jx.prototype.ka;Jx.prototype.addTextTrack=Jx.prototype.addTextTrack;Jx.prototype.setTextRendition=Jx.prototype.pb;Jx.prototype.setAudioRendition=Jx.prototype.ob;Jx.prototype.setVideoRendition=Jx.prototype.bb;
|
|
231
|
+
Jx.prototype.setTextTrack=Jx.prototype.Ea;Jx.prototype.setAudioTrack=Jx.prototype.va;Jx.prototype.setVideoTrack=Jx.prototype.cb;Jx.prototype.getTextTrack=Jx.prototype.qa;Jx.prototype.getAudioTrack=Jx.prototype.pa;Jx.prototype.getVideoTrack=Jx.prototype.La;Jx.prototype.getLoadingTextRendition=Jx.prototype.ib;Jx.prototype.getLoadingAudioRendition=Jx.prototype.hb;Jx.prototype.getLoadingVideoRendition=Jx.prototype.Xa;Jx.prototype.getTextRendition=Jx.prototype.Ja;Jx.prototype.getAudioRendition=Jx.prototype.Ia;
|
|
232
|
+
Jx.prototype.getVideoRendition=Jx.prototype.fa;Jx.prototype.getTextTracks=Jx.prototype.ia;Jx.prototype.getAudioTracks=Jx.prototype.getAudioTracks;Jx.prototype.getVideoTracks=Jx.prototype.getVideoTracks;_.t=_.$x.prototype;_.t.stop=function(){this.w=null;this.j=!1;this.o=[];this.m=1;this.g=null;this.B=!1};_.t.init=function(a){this.w=a};
|
|
233
|
+
_.t.chooseVariant=function(){var a=ay(!this.B&&this.a.initialRestrictions?this.a.initialRestrictions:this.a.restrictions,this.o),b=Zx(this.f,this.a.defaultBandwidthEstimate);this.o.length&&!a.length&&(this.h.warn("No variants met the ABR restrictions. Choosing a variant by lowest bandwidth."),a=ay(null,this.o),a=[a[0]]);var c=a[0]||null;a=_.u(_.$A(a));for(var d=a.next();!d.done;d=a.next()){var e=d.value;d=e.item;var f=isNaN(this.m)||0===this.m?1:Math.abs(this.m),g=f*d.bandwidth,h=g/this.a.bandwidthDowngradeTarget;
|
|
234
|
+
e=f*(e.next||{bandwidth:Infinity}).bandwidth/this.a.bandwidthUpgradeTarget;this.h.debug("Bandwidth ranges:",(g/1E6).toFixed(3),(h/1E6).toFixed(3),(e/1E6).toFixed(3));b>=h&&b<=e&&(c=d)}this.g=Date.now();this.B=!0;return c};_.t.enable=function(){this.j=!0};_.t.disable=function(){this.j=!1};
|
|
235
|
+
_.t.segmentDownloaded=function(a,b){this.h.debug("Segment downloaded:","deltaTimeMs\x3d"+a,"numBytes\x3d"+b,"lastTimeChosenMs\x3d"+this.g,"enabled\x3d"+this.j);var c=this.f;if(!(16E3>b)){var d=8E3*b/a,e=a/1E3;c.a+=b;_.iw(c.f,e,d);_.iw(c.g,e,d)}if(null!=this.g&&this.j)a:{this.h.debug("Suggesting Streams...");if(!this.A){if(!(128E3<=this.f.a)){this.h.debug("Still waiting for a good estimate...");break a}this.A=!0;if(this.a.useSwitchIntervalForInitialSwitch&&Date.now()-this.g<1E3*this.a.switchInterval){this.h.debug("Skipping initial estimation switch due to switch interval...");
|
|
236
|
+
break a}}else if(Date.now()-this.g<1E3*this.a.switchInterval){this.h.debug("Still within switch interval...");break a}c=this.chooseVariant();this.h.debug("Calling switch_(), bandwidth\x3d"+Math.round(Zx(this.f,this.a.defaultBandwidthEstimate)/1E3)+" kbps");this.w(c)}};_.t.playbackRateChanged=function(a){this.m=a};_.t.getBandwidthEstimate=function(){return Zx(this.f,this.a.defaultBandwidthEstimate)};_.t.setVariants=function(a){this.o=a};_.t.configure=function(a){this.a=a};
|
|
237
|
+
_.t.reset=function(){this.A=!1;this.f=new Yx;var a=this.chooseVariant();a&&this.w(a)};by.prototype.clear=function(){this.a.clear()};ey.prototype.add=function(a){if(hy(this.f,a))return this.a.add(a),!0;_.G("Rejecting variant - not compatible with root.");return!1};ey.prototype.values=function(){return this.a.values()};jy.prototype.create=function(a){var b=this,c=a.filter(function(d){return hy(b.a,d)});return c.length?new ey(c[0],c):this.f.create(a)};
|
|
238
|
+
iy.prototype.create=function(a){var b=ky(a,this.g);0<b.length&&(a=b);b=!1;if(this.a){var c=ly(a,this.a);0<c.length?(a=c,b=!0):_.G("No exact match for preferred variant role could be found. Role: "+this.a)}b||(b=a.filter(function(d){return d.primary}),0<b.length&&(a=b));this.f&&(b=ox(a,this.f),b.length?a=b:_.G("No exact match for the channel count could be found."));b=new ey(a[0]);a=_.u(a);for(c=a.next();!c.done;c=a.next())c=c.value,hy(b.f,c)&&b.add(c);return b};oy.prototype.getState=function(){return this.a};var ny=0,my=1;qy.prototype.release=function(){this.f.release()};ry.prototype.release=function(){this.a=this.g=null;this.f=function(){}};ry.prototype.o=function(a){var b=this.a,c=this.g.periods;a=gw(c,a)||c[0];b!=a&&this.f(a);this.a=a};ty.prototype.release=function(){this.f&&(this.f.stop(),this.f=null);this.a=null};ty.prototype.set=function(a){this.g=a;uy(this)};wy.prototype.release=function(){this.g=null;this.f=function(){}};Ay.prototype.release=function(){this.g&&(this.g.release(),this.g=null);null!=this.w&&(this.w.stop(),this.w=null);this.f&&(this.f.release(),this.f=null);this.a=this.F=this.D=null;this.o=!1};Ay.prototype.Zd=function(){this.A=!0;zy(this)};Ey.prototype.release=function(){this.f&&(this.f.release(),this.f=null);null!=this.g&&(this.g.release(),this.g=null);this.j=function(){};this.a=null;this.o=function(){};this.w=!1};By.prototype.release=function(){this.a&&(this.a.stop(),this.a=null);this.f=null};My.prototype.release=function(){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.g=this.f=this.a=this.m=null;this.A=function(){}};var Sy=new _.Vm(function(){return 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])});var wz;_.t=_.Uy.prototype;_.t.destroy=function(){var a=this,b,c,d,e;return _.B(function(f){if(1==f.a){b=[];c=_.u(a.a.values());for(d=c.next();!d.done;d=c.next())e=d.value,dz(e),b.push(ez(e));return _.x(f,Promise.all(b),2)}a.a.clear();a.o.clear();a.C=null;a.f=null;a.F=null;a.m=null;a.j=null;a.g=!0;_.z(f)})};
|
|
239
|
+
_.t.start=function(){var a=this,b,c,d;return _.B(function(e){if(1==e.a){b=a.C.yb();c=$y(a,b);d=a.C.Xe(a.f.periods[c]);if(!d.variant&&!d.text)throw a.h.error("init: no Streams chosen"),new _.L(_.M,5,5005);a.D=!d.variant&&!!d.text;return _.x(e,rz(a,d.variant?d.variant.audio:null,d.variant?d.variant.video:null,d.text,b),2)}if(a.g)return e["return"]();a.h.debug("init: completed initial Stream setup");a.C&&a.C.ek&&(a.h.debug("init: calling onInitialStreamsSetup()..."),a.C.ek());_.z(e)})};
|
|
240
|
+
_.t.Db=function(a){var b=this,c,d,e,f;return _.B(function(g){switch(g.a){case 1:if(b.g)return g["return"]();c=lz(a);if(a.$a||null==a.sb||a.Zb)return g["return"]();a.sb=null;if(!a.Hb){g.G(2);break}b.h.debug(c,"skipping update and clearing the buffer");return _.x(g,nz(b,a,a.be,a.Fd),3);case 3:return g["return"]();case 2:_.Af(g,4);d=vz(b,a);null!=d&&(bz(b,a,d),a.Lc=!1);_.Bf(g,5);break;case 4:return e=_.Cf(g),_.x(g,Gz(b,e),6);case 6:return g["return"]();case 5:f=Array.from(b.a.values()),Nz(b,a),b.B&&
|
|
241
|
+
f.every(function(h){return h.endOfStream})&&(b.h.debug(c,"calling endOfStream()..."),b.C.X.endOfStream().then(function(){if(!b.g){var h=b.C.X.getDuration();h<b.f.presentationTimeline.getDuration()&&(b.f.presentationTimeline.f=h)}}).then(function(){b.C.xg()})),_.z(g)}})};
|
|
242
|
+
_.t.zk=function(a,b,c,d){var e=Cv(d.reader),f=Cv(d.reader),g=_.T(d.reader),h=_.T(d.reader),l=_.T(d.reader),m=_.T(d.reader);d=_.Ok(d.reader,d.reader.Ca()-d.reader.getPosition());a=a.startTime+b.startTime+h/g;if(c.includes(e))if("urn:mpeg:dash:event:2012"==e)this.C.Cg();else this.C.onEvent(new _.I("emsg",{detail:{startTime:a,endTime:a+l/g,schemeIdUri:e,value:f,timescale:g,presentationTimeDelta:h,eventDuration:l,id:m,messageData:d}}))};
|
|
243
|
+
_.t.fl=function(a){var b=this,c=!1,d=0;(new _.Pk).L(_.Gd,_.Qk).L(_.Ge,_.Qk).L(_.Ad,_.Qk).L(_.Ed,_.Qk).L(_.ue,_.Qk).W(_.we,_.Rk).L("encv",function(e){e.reader.skip(78);_.Qk(e)}).L("pasp",function(e){d=e.start+e.headerSize;var f=_.T(e.reader),g=_.T(e.reader);c=f!==g;b.h.debug("hSpacing\x3d"+f+", vSpacing\x3d"+g+", updatePASP\x3d"+c);e.parser.stop()}).parse(a.data);c&&(a=new _.Dk(new DataView(a.data)),a.seek(d),_.S(a,1),_.S(a,1))};wz="iterateSegmentReference";_.aB={ITERATOR:wz,LOOKUP:_.qv};_.w(Sz,_.lk);_.t=Sz.prototype;_.t.init=function(a,b){var c=a.getMedia();_.lk.prototype.init.call(this,a,b);Yz(this,c)};_.t.namespace=function(){return ov};_.t.Tf=function(){return new Jx};_.t.getState=function(){return this.ha};_.t.getDrmInfo=function(){return this.m?this.m.getDrmInfo():null};
|
|
244
|
+
_.t.unload=function(){var a=this;Px(this,!1);this.Yc=!1;if(this.w){var b=this.getTrackManager();b&&b.release();return this.F===Vz?Promise.resolve():$z(this).then(function(){a.log.debug(_.kb,a.w);a.w=null;a.Re=0;a.yc=null;a.T=null})}return Promise.resolve()};
|
|
245
|
+
_.t.release=function(){var a=this;return _.B(function(b){if(a.da)return b["return"](a.da);a.da=new Promise(function(c,d){try{var e=a.Sb;a.Sb=null;var f=e;e&&(f=e["catch"](function(){}));f?f=f.then(function(){return _.lk.prototype.release.call(a)}):f=_.lk.prototype.release.call(a);f=f.then(function(){return a.unload()});f.then(function(){Uz(a,_.Ym);a.da=null;c()})["catch"](function(g){a.da=null;d(g)})}catch(g){a.da=null,d(g)}});return b["return"](a.da)})};
|
|
246
|
+
_.t.getBufferInfo=function(a){if(this.J){var b=cx(this.J),c=new _.ak(void 0,a);switch(a){case _.ui:return b.video?b.video:c;case _.Q:return b.audio?b.audio:c;case _.O:return b.text?b.text:c}return b.total?b.total:c}return this.ed?(b=cw(this.ed),$v(b,a)):_.lk.prototype.getBufferInfo.call(this,a)};_.t.getPosition=function(){return this.A?Oy(this.A):_.lk.prototype.getPosition.call(this)};_.t.getPresentationStartTime=function(){return this.f?this.f.presentationTimeline.getPresentationStartTime():null};
|
|
247
|
+
_.t.getDuration=function(){return this.f?this.f.presentationTimeline.getDuration():Infinity};_.t.destroy=function(){var a=this;return _.B(function(b){if(1==b.a)return _.x(b,_.lk.prototype.destroy.call(a),2);if(3!=b.a){if(a.F===Vz)return b["return"]();a.log.debug("Destroying player...");a.F=Vz;return _.x(b,Xz(a),3)}a.o&&(a.o.release(),a.o=null);a.g=null;_.z(b)})};
|
|
248
|
+
_.t.load=function(a){var b=this,c,d,e,f,g,h,l,m;return _.B(function(n){switch(n.a){case 1:if(b.F===Vz)return n["return"](Promise.reject(new _.L(_.M,7,7E3)));c=new _.di;d=function(){return b.Sb!==c};e=function(){b.log.info("Aborting current load");throw new _.L(_.M,7,7E3);};b.Sb=c;_.Af(n,2);d()&&e();if(!b.da){n.G(4);break}_.Af(n,5);return _.x(n,b.da,7);case 7:_.Bf(n,6,2);break;case 5:_.Cf(n,2);case 6:d()&&e();case 4:return b.I=new _.Tm,b.Qe=Date.now()/1E3,Uz(b,_.kn),b.w=_.qn(a),_.kk(a)&&(b.configuration=
|
|
249
|
+
_.jk(b.Kd,a)),b.log.info(_.Ua,b.configuration),b.log.info(_.eb,b.w),(f=b.getTrackManager())&&f.load(),g=b.getSurface().getMedia(),g.loop=!!b.configuration.loop,_.K.R(b.configuration.volume)||b.setVolume(b.configuration.volume),_.K.R(b.configuration.muted)||b.setMuted(b.configuration.muted),AA(b),h=b.w[b.getSourceIndex()],d()&&e(),_.x(n,Yz(b,g),8);case 8:return d()&&e(),_.x(n,Zz(b,g),9);case 9:return d()&&e(),_.x(n,bA(b,h),10);case 10:return d()&&e(),_.x(n,fA(b,h),11);case 11:return d()&&e(),_.x(n,
|
|
250
|
+
mA(b),12);case 12:return d()&&e(),_.x(n,xA(b),13);case 13:d()&&e();c.resolve();_.Bf(n,0);break;case 2:throw m=l=_.Cf(n),d()&&(m=new _.L(_.M,7,7E3)),c.reject(m),b.onError(m),m;}})};_.t.detach=function(){var a=this;return _.B(function(b){return 1==b.a?_.x(b,Wz(a),2):b["return"](Xz(a))})};_.t.isLive=function(){var a;this.f?(a=this.f.presentationTimeline.isLive())||(a=this.f.presentationTimeline,a=Infinity!=a.f&&!a.o):a=!1;return a};
|
|
251
|
+
_.t.Gg=function(){this.log.debug("User seeking finished");this.H&&nA(this);oA(this)};_.t.getSeekRange=function(){if(this.f){var a=this.f.presentationTimeline;return{start:uw(a,0),end:tw(a)}}return{start:0,end:0}};_.t.getPlaybackRate=function(){if(this.zc){var a=this.zc;a=a.j?0:a.g}else a=0;return a};
|
|
252
|
+
_.t.setPlaybackRate=function(a){if(0===a)this.log.warn("A trick play rate of 0 is unsupported!");else if(this.F===Rz){this.zc.set(a);this.g.playbackRateChanged(a);var b=this.a,c=1<Math.abs(a);if(a=b.a.get(_.Re)){var d=a.stream;if(d)if(b.h.debug("setTrickPlay",c),c)(c=d.trickModeVideo)&&!a.Ub&&(b.h.debug("Engaging trick mode stream",c),_.gz(b,c,!1,0),a.Ub=d);else if(d=a.Ub)b.h.debug("Restoring non-trick-mode stream",d),a.Ub=null,_.gz(b,d,!0,0)}}};
|
|
253
|
+
_.t.ia=function(){if(this.f&&this.A){var a=gA(this);if(null==a)a=null;else{if(!dy(this.P,a).text){var b=_.Cx(a.textStreams,this.Ga,this.vc);b.length&&(b=b[0],dy(this.P,a).text=b)}a=dy(this.P,a).text}b=[];for(var c=_.u(OA(this)),d=c.next();!d.done;d=c.next()){d=d.value;var e=zx(d);e.active=d==a;b.push(e)}return b}return[]};_.t.getPeriods=function(){return this.f.periods};
|
|
254
|
+
_.t.getStats=function(){if(this.F!==Rz)return _.Um();oA(this);var a=this.j;if(a.getVideoPlaybackQuality){a=a.getVideoPlaybackQuality();var b=this.I,c=Number(a.totalVideoFrames);b.m=Number(a.droppedVideoFrames);b.j=c}if(this.F===Rz){if(a=BA(this))this.I.o=a.bandwidth;a&&a.video&&(b=this.I,c=a.video.height||NaN,b.w=a.video.width||NaN,b.g=c);a=this.g.getBandwidthEstimate();this.I.f=a}return this.I.getStats()};
|
|
255
|
+
_.t.getTimelineCues=function(){return this.wc?_.nf(this.wc.cues()).concat().map(function(a){return{schemeIdUri:a.schemeIdUri,value:a.value,startTime:a.startTime,endTime:a.endTime,id:a.id,eventElement:a.eventElement,type:a.type}}):[]};_.t.resetAbr=function(){this.g&&this.g.reset()};
|
|
256
|
+
_.t.addTextTrack=function(a,b,c,d,e,f){var g=this,h,l,m,n,p,q,r,v,y;return _.B(function(A){if(1==A.a){if(g.F!==Rz)throw g.log.error("Must call load() and wait for it to resolve before adding text tracks."),Error("State error!");h=gA(g);l=_.xn;m=g.f.periods.indexOf(h);n=m+1;p=n>=g.f.periods.length?g.f.presentationTimeline.getDuration():g.f.periods[n].startTime;q=p-h.startTime;if(Infinity==q)throw new _.L(1,4,4040);r=new _.Qv(1,0,q,function(){return[a]},0,null,0);v={id:g.Ug++,originalId:null,createSegmentIndex:Promise.resolve.bind(Promise),
|
|
257
|
+
findSegmentPosition:function(){return 1},getSegmentReference:function(E){return 1==E?r:null},adjustSegmentDurations:function(){},getDuration:function(){return q},segmentLookupStrategy:_.qv,initSegmentReference:null,mimeType:d,codecs:e||"",kind:c,encrypted:!1,keyId:null,language:b,label:f||null,type:l.TEXT,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:null,closedCaptions:null};g.Td.add(v);h.textStreams.push(v);return _.x(A,cz(g.a,v),2)}if(y=_.Wy(g.a,_.Ce))dy(g.P,h).text=
|
|
258
|
+
y;g.Td["delete"](v);g.log.debug("Choosing new streams after adding a text stream");zA(g,h);iA(g);return A["return"](zx(v))})};_.t.hi=function(a){this.log.debug(_.sv,a);try{this.log.debug("onChooseStreams_, choosing variant from ",a.variants);this.log.debug("onChooseStreams_, choosing text from ",a.textStreams);var b=MA(this,a);this.log.debug("onChooseStreams_, chose variant ",b.variant);this.log.debug("onChooseStreams_, chose text ",b.text);return b}catch(c){return this.onError(c),{variant:null,text:null}}};
|
|
259
|
+
_.t.gi=function(){this.log.debug("canSwitch_");this.V=!1;this.configuration.abr.enabled&&this.g.enable();this.ma&&(hz(this.a,this.ma,this.Og,this.Hg),this.ma=null);this.ga&&(_.gz(this.a,this.ga,!0,0),this.ga=null)};_.t.ii=function(){this.B&&this.B.update&&this.B.update()};_.t.qk=function(){this.A&&this.A.j.Zd()};
|
|
260
|
+
_.t.rh=function(a,b,c){if((void 0===c?"":c)===rv)return iA(this),this.ka()||(this.configuration.abr.enabled=!0,this.g.enable()),zA(this,b,!1),!0;if(c=b.variants.some(function(g){var h=!1,l=g[a.type];l&&(h=g.allowedByApplication&&l.id!==a.id,a.type===_.lc&&(h=h&&l.language===a.language));return h})&&this.ka()){for(var d=_.u(b.variants),e=d.next();!e.done;e=d.next()){e=e.value;var f=e[a.type];f&&f.id===a.id&&(e.allowedByApplication=!1)}iA(this);this.ka()||(this.configuration.abr.enabled=!0,this.g.enable());
|
|
261
|
+
zA(this,b)}return c};_.t.ck=function(){this.log.debug("endOfStream called by streaming engine");this.Yc=!0};_.t.onError=function(a){if(this.F!==Vz&&7001!==a.code&&7E3!==a.code){var b=new _.I(_.jd,{detail:a});a.severity===_.M&&Uz(this,_.jn);this.trigger(b);b.defaultPrevented&&(b.a=!0)}};_.t.ve=function(a){a.type===_.dd?this.dispatchEvent(a):"largegap"!==a.type&&(a.type===_.$e?aA(this):"emsg"!==a.type&&(a instanceof _.I?this.dispatchEvent(a):this.log.debug(_.yb,a.type)))};_.t.ka=function(){return this.configuration.abr.enabled};
|
|
262
|
+
_.t.$k=function(a){var b=this,c,d,e,f,g,h,l,m;return _.B(function(n){switch(n.a){case 1:if(!b.uc)return n["return"]();b.log.info("Attempt to switch CDN.");c=b.getLoadedSource();d=b.ka();return _.x(n,b.uc(c.url,a),2);case 2:e=n.f;if(!e)return n["return"]();f=_.K.ya(b.getLoadedSource(),{url:e});d&&b.g.disable();return _.x(n,Oz(b.a),3);case 3:g=BA(b);case 4:return h=!1,_.Af(n,7),b.log.info("Switching CDN to "+f.url+"."),_.x(n,PA(b,f,g),9);case 9:_.Bf(n,6);break;case 7:return l=_.Cf(n),b.log.info("Switch failed"),
|
|
263
|
+
_.x(n,b.uc(f.url,a),10);case 10:if(m=n.f)f.url=m,h=!0;else throw l;case 6:h?n.G(4):(d&&b.g.enable(),Iz(b.a,!0),b.w[b.getSourceIndex()]=f,a.f=!0,b.trigger(new _.I(_.Cc,{newManifest:f.url})),_.z(n))}})};Sz.prototype.detach=Sz.prototype.detach;var Vz=0,Qz=1,Rz=2,hA=[_.Ud,_.pd];QA.prototype.a=function(){return ov};
|
|
264
|
+
QA.prototype.canPlay=function(a,b){if(_.gj())return 0;var c=a.type||"",d=window.MediaSource&&MediaSource.isTypeSupported?!0:!1,e=window.MediaSource&&MediaSource.isTypeSupported?c in _.Fp||_.Gp(a.url)in _.Hp?!0:!1:!1;if(d&&e){if(_.ki(2))return 1;if(_.hj()&&c===_.Lj){if(b.streaming.preferNativeHlsOnSafari)return 1;_.G("Support for MSE + FairPlay on Apple is experimental. In case of issues, consider using native HLS.")}return 2}return 0};QA.prototype.create=function(){return new Sz};_.Zf(new QA);_.bo(function(){_.Tf("MediaSource.install");if(window.MediaSource)if(window.cast&&cast.__platform__&&cast.__platform__.canDisplayType)_.Sf("Patching Chromecast MSE bugs."),VA();else if(_.hj()){var a=navigator.appVersion;a=0<=a.indexOf("Version")?parseInt(a.match(/Version\/(\d+)/)[1],10):13;TA();10>=a?(_.Sf("Blacklisting MSE on Safari \x3c\x3d 10."),window.MediaSource=null):12>=a?(_.Sf("Patching Safari 11 \x26 12 MSE bugs."),RA(),SA()):(_.Sf("Patching Safari 13 MSE bugs."),RA())}else _.ki(2)||_.ki(3)||
|
|
265
|
+
_.ki(4)?UA():_.Sf("Using native MSE as-is.");else _.Sf("No MSE implementation available.")});_.w(WA,_.lq);_.t=WA.prototype;
|
|
266
|
+
_.t.append=function(a){function b(e){if(e.startTime>=e.endTime)_.G("Invalid cue times: "+e.startTime+" - "+e.endTime),e=null;else{var f=e.payload||"";f=f.replace(/<br\s*\/?>/igm,"\n");f=_.Jh(f);f=new VTTCue(e.startTime,e.endTime,f);f.line=-1;try{f.align=_.Ec}catch(g){f.align="middle"}e.writingMode===_.Pe?f.vertical="lr":e.writingMode===_.Qe&&(f.vertical="rl");e=f}e&&c.push(e)}var c=[],d=_.u(a);for(a=d.next();!a.done;a=d.next())b(a.value);a=c.slice().sort(function(e,f){return e.startTime!==f.startTime?
|
|
267
|
+
e.startTime-f.startTime:e.endTime!==f.endTime?e.endTime-f.startTime:c.indexOf(f)-c.indexOf(e)});d=_.u(a);for(a=d.next();!a.done;a=d.next())this.a.addCue(a.value)};_.t.remove=function(a,b){if(!this.a)return!1;XA(this.a,function(c){return c.startTime<b&&c.endTime>a});return!0};_.t.isTextVisible=function(){return this.a.mode==_.ne};_.t.setTextVisibility=function(a){null!==this.a&&(this.a.mode=a?_.ne:_.nd)};_.t.destroy=function(){this.a&&XA(this.a,function(){return!0});this.a=null;return Promise.resolve()};YA.prototype.$=function(){return!0};YA.prototype.create=function(a){return new WA(a)};_.Lm("single-native",new YA);};
|
|
265
268
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
266
269
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
267
270
|
else{_=this.clpp._;(f.call(g,this));}
|