@castlabs/prestoplay 6.4.0 → 6.5.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 +57 -0
- 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 +421 -402
- package/cjs/cl.crypto.js +9 -9
- package/cjs/cl.dash.js +72 -72
- package/cjs/cl.externs.js +54 -133
- package/cjs/cl.freewheel.js +24 -24
- package/cjs/cl.hls.js +47 -49
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +31 -32
- package/cjs/cl.ima.js +22 -22
- package/cjs/cl.mse.js +258 -255
- package/cjs/cl.muxdata.js +12 -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 +69 -69
- package/cjs/cl.thumbnails.js +24 -24
- 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 -18
- package/cjs/cl.vtt.js +14 -14
- package/cjs/cl.youbora.js +20 -20
- 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 +363 -351
- package/cl.crypto.js +8 -8
- package/cl.dash.js +67 -67
- package/cl.externs.js +49 -132
- package/cl.freewheel.js +19 -19
- package/cl.hls.js +40 -40
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +25 -25
- package/cl.ima.js +16 -16
- package/cl.mse.js +230 -231
- package/cl.muxdata.js +8 -8
- package/cl.onboard.js +4 -4
- package/cl.persistent.js +9 -9
- package/cl.playlist.js +5 -5
- package/cl.smooth.js +58 -58
- 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 -14
- package/cl.vtt.js +12 -12
- package/cl.youbora.js +15 -16
- package/package.json +8 -2
package/cjs/cl.mse.js
CHANGED
|
@@ -1,265 +1,268 @@
|
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
_.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
_.
|
|
21
|
-
_.
|
|
22
|
-
_.
|
|
23
|
-
_.
|
|
24
|
-
_.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
_.
|
|
28
|
-
|
|
29
|
-
_.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
a.m.get(f).set(h,l);a.a=null==a.a?Math.max(c,a.h):Math.min(a.a,Math.max(c,a.h));a.f=Math.max(a.f,Math.min(d,a.j))};_.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
_.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
return Promise.all(q)}):(f&&window.muxjs&&(a.g||
|
|
42
|
-
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.
|
|
43
|
-
q])}null!==d&&null!==e&&(a.
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
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=
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
"variant.video",
|
|
54
|
-
|
|
2
|
+
var f=function(window){var Ku,Lu,Mu,Nu,Ou,Pu,Qu,Ru,Su,Tu,Wu,Xu,Zu,$u,av,bv,cv,dv,fv,hv,iv,jv,kv,lv,nv,ov,pv,vv,wv,xv,yv,Av,Dv,Ev,Fv,Gv,Iv,Kv,Mv,Ov,Pv,Qv,Rv,Sv,$v,dw,gw,fw,hw,iw,jw,kw,ow,rw,qw,sw,tw,ww,xw,yw,zw,Bw,Dw,Fw,Ew,Gw,Jw,Hw,Lw,Mw,Nw,Pw,Ow,Qw,Sw,Tw,Vw,Uw,Rw,Ww,Yw,Xw,dx,ax,Zw,bx,cx,ex,fx,ix,hx,jx,kx,lx,$w,mx,ox,gx,px,qx,rx,sx,tx,ux,vx,wx,yx,zx,xx,Hx,Gx,Ix,Jx,Kx,Mx,Nx,Px,Ox,Qx,Tx,Rx,Sx,Vx,Ux,Wx,Xx,$x,by,ay,cy,dy,ey,fy,hy,iy,jy,gy,ly,ky,py,qy,sy,oy,ny,ty,my,ry,xy,zy,wy,Ay,vy,yy,uy,Cy,By,Ey,Gy,Iy,Jy,Oy,Ry,Ty,Yy,az,Vy,
|
|
3
|
+
cz,My,dz,Ky,bz,gz,ez,Wy,$y,jz,iz,fz,tz,pz,qz,kz,uz,lz,nz,xz,wz,oz,vz,yz,Ly,Uy,mz,Zy,Ny,Py,Qy,zz,Az,rz,Xy,sz,Dz,Ez,Fz,Lz,Jz,Iz,Hz,Kz,Nz,Rz,Yz,iA,Qz,cA,dA,eA,Zz,fA,Wz,lA,Dx,Bx,Ex,Cx,Fx,Ax,qA,oA,aA,Xz,hA,rA,pA,tA,gA,jA,Mz,$z,uA,Vz,kA,xA,bA,Uz,wA,vA,Oz,sA,nA,zA,Sz,mA,yA,AA,Pz,BA,CA,DA,EA,FA,GA,HA,IA,JA,qv;Ku=" buffer";Lu=" is being or has been set up";Mu="\x3c/DATA\x3e\x3c/WRMHEADER\x3e";Nu="\x3c/LA_URL\x3e";Ou="\x3cLA_URL\x3e";Pu='\x3cWRMHEADER xmlns\x3d"http://schemas.microsoft.com/DRM/2007/03/PlayReadyHeader" version\x3d"';
|
|
4
|
+
Qu="Choosing new streams after key status change";Ru="IterateSegmentReference";Su="Jumping forward";Tu="MediaSource threw QuotaExceededError:";_.Uu="No stream with id";_.Vu="Player is in ERROR state and can not switch to ";Wu="PrestoPlay TextTrack";Xu="Removing audio from variant - audio not compatible with platform";_.Yu="Updating manifest...";Zu="bufferBehind\x3d";$u="bufferedBehind\x3d";av="calling onCanSwitch()...";bv="cannot find segment";cv="clpp.mse.Player";dv="currentPeriod.startTime\x3d";
|
|
5
|
+
_.ev="getSegmentNextReference";fv="key-restriction";_.gv="onChooseStreams_";hv="presentationTime:";iv="presentationTime\x3d";jv="reference.endTime\x3d";kv="reference.position\x3d";lv="reference.startTime\x3d";_.mv="subtitles";nv="switch: Stream ";ov=function(a,b){for(var c in a.a)b(c,a.a[c])};pv=function(a){for(var b=a.a;_.yk(a)&&0!==a.f.getUint8(a.a);)a.a+=1;b=a.f.buffer.slice(b,a.a);a.a+=1;return _.ph(b)};
|
|
6
|
+
_.rv=function(a){var b=new Uint8Array(qv),c=4+b.byteLength+a.h.byteLength+4+a.f.byteLength,d=new _.uk(c,!1);_.S(d,c);_.wk(d,b);_.wk(d,a.h);_.S(d,a.f.byteLength);_.wk(d,a.f);return _.N(d.buffer)};
|
|
7
|
+
_.sv=function(a,b,c,d){var e=_.ek(b);if(8!==e.byteLength)e="";else{var f=_.El(e);e=_.bk(f);b:switch(f=f.byteLength,_.Rf("Trying to create PlayReady header in version",a),a){case "4.0.0.0":e=[Pu+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?Ou+d+Nu:"",Mu].join("");break b;case "4.1.0.0":e=[Pu+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?Ou+d+Nu:"",Mu].join("");break b;case "4.2.0.0":case "4.3.0.0":e=[Pu+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?Ou+d+Nu:"",Mu].join("");break b;default:_.G("Cannot create PlayReady header in version",a),e=""}}if(!e)return null;_.Rf("New payload",e);e=_.N(_.uh(e,!0));return new _.Bl(_.Fl,
|
|
9
|
+
b,d||null,e,a,c)};_.uv=function(a,b){return b===a.version?a:_.sv(b,a.a,a.j||void 0,a.g||void 0)};vv=function(a,b){a:{if(b){var c=_.u(a.g.keys());for(var d=c.next();!d.done;d=c.next()){d=a.g.get(d.value);for(var e=0;e<d.cb.length;e++)if(d.cb[e]===b){c=d;break a}}}c=null}return c?c.za:null};wv=function(a,b){return _.Qi("Edge/")?!0:a.N.has(b)};xv=function(a,b){var c=a.m.get(b);return!(!c||c!==_.Sd&&c!==_.nd)};
|
|
10
|
+
yv=function(a,b){var c=b.audio,d=b.video;if(c&&c.encrypted&&!wv(a,_.Ji(c.mimeType,c.codecs))||d&&d.encrypted&&!wv(a,_.Ji(d.mimeType,d.codecs)))return!1;var e=a.keySystem();return 0==b.drmInfos.length||b.drmInfos.some(function(f){return f.keySystem==e})};_.zv=function(a,b){return a.concat(b)};Av=function(){};
|
|
11
|
+
_.Bv=function(a,b){if(0==b.length)return a;var c=b.map(function(d){return new _.Fg(d)});return a.map(function(d){return new _.Fg(d)}).map(function(d){return c.map(d.resolve.bind(d))}).reduce(_.zv,[]).map(function(d){return d.toString()})};_.Cv=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:b||[],keyIds:[],periodId:c?c:null}};
|
|
12
|
+
Dv=function(a,b){for(var c in b)if(b[c]===a)return c;return""};Ev=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};Fv=function(a,b){a=_.Gi(a);b=_.Gi(b);var c=a.split("-"),d=b.split("-");return c[0]==d[0]&&1==c.length&&2==d.length};Gv=function(a){return a.language?_.Gi(a.language):a.audio&&a.audio.language?_.Gi(a.audio.language):a.video&&a.video.language?_.Gi(a.video.language):_.He};
|
|
13
|
+
_.Hv=function(a,b){for(var c=_.Gi(a),d=new Set,e=_.u(b),f=e.next();!f.done;f=e.next())d.add(_.Gi(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,Fv(f,c))return f;e=_.u(d);for(f=e.next();!f.done;f=e.next()){var g=f=f.value,h=c;g=_.Gi(g);h=_.Gi(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,Fv(c,e))return e;return null};
|
|
14
|
+
Iv=function(a){var b=[a.mimeType];_.tq.forEach(function(c,d){var e=a[d];e&&b.push(c+'\x3d"'+e+'"')});return b.join(";")};_.Jv=function(a){a=a.split(".");var b=a[0];a.pop();return[b,a.join(".")]};Kv=function(a,b){for(var c=new _.Jj(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};
|
|
15
|
+
_.Lv=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={Oc:e.Oc},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.Oc=_.lf(g.keyIds||[]).concat();f.keyIds&&f.keyIds.length&&f.keyIds.forEach(function(l){return function(m){l.Oc.includes(m)||l.Oc.push(m)}}(e));c.push({keySystem:g.keySystem,licenseServerUri:g.licenseServerUri||f.licenseServerUri,
|
|
16
|
+
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.Oc,periodId:g.periodId});break}return c};Mv=function(a,b){return a.start-b.start};
|
|
17
|
+
_.Nv=function(a){this.m=a;this.log=new _.H("clpp.renditions");this.f=[];this.j=this.a=null;this.h=!1};Ov=function(a){return a.f.map(function(b){return{start:b.start,end:b.end,width:b.width,height:b.height,bandwidth:b.bandwidth,rendition:b.rendition}})};Pv=function(a){a.a&&a.a.trigger(new _.J(_.oc))};
|
|
18
|
+
Qv=function(a){if(a.a){for(var b=!1,c={},d=0;d<a.f.length;d++){var e=a.f[d],f=e.width+"x"+e.height,g=c[f];if(g&&g!==e.bandwidth){b=!0;break}c[f]=e.bandwidth}b&&!a.h?(a.log.debug("Tracking timeupdates"),a.a.on(_.Ee,a.g,a),a.h=!0):!b&&a.h&&(a.log.debug("Stop tracking timeupdates"),a.a.off(_.Ee,a.g),a.h=!1)}};Rv=function(a,b,c){a.f=a.f.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 _.J(_.Te))};
|
|
19
|
+
Sv=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};_.Tv=function(a){this.g=Math.exp(Math.log(.5)/a);this.f=this.a=0};_.Uv=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)};_.Vv=function(a){return a.a/(1-Math.pow(a.g,a.f))};
|
|
20
|
+
_.Wv=function(a,b,c,d,e,f,g,h){a=_.Ih(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};_.Xv=function(a,b,c,d,e){this.Ha=a;this.Qa=b;this.Ea=c;this.keyInfo=d||null;this.Zb=_.K.S(e)?!1:!!e};
|
|
21
|
+
_.Yv=function(a,b,c,d,e,f,g,h,l,m,n,p,q,r){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.Aa=g;this.Ha=d;this.Qa=e;this.Ea=f;this.keyInfo=h||null;this.Zb=_.K.S(l)?!1:!!l;this.timescale=m;this.horizontalTiles=n;this.verticalTiles=p;this.durationPerTile=q;this.a=r||[];this.g=!1};
|
|
22
|
+
_.Zv=function(a,b,c,d){var e=void 0===e?!1:e;this.o=a;this.Re=b;this.ic=this.g=Infinity;this.a=1;this.w=0;this.f=this.h=null;this.A=0;this.m=this.j=c;this.F=void 0===d?!0:d;this.B=new _.H("clpp.media.PresentationTimeline");this.D=e};$v=function(a){return a.j?a.g:a.m?a.f:null};
|
|
23
|
+
_.bw=function(a,b,c){if(0!=b.length){var d=b[b.length-1].endTime+c;_.aw(a,b[0].startTime+c);a.a=b.reduce(function(e,f){return Math.max(e,f.endTime-f.startTime)},a.a);a.f=Math.max(a.f||0,d);null!=a.o&&a.F&&(a.o=(Date.now()+a.A)/1E3-a.f-a.a);a.B.debug("notifySegments: maxSegmentDuration\x3d"+a.a)}};_.aw=function(a,b){a.h=null==a.h?b:Math.min(a.h,b)};_.cw=function(a,b){a.a=Math.max(a.a,b);a.B.debug("notifyNewSegmentDuration: maxSegmentDuration\x3d"+a.a)};
|
|
24
|
+
_.ew=function(a){return Infinity==a.ic?0:Math.max(0,dw(a)-a.ic)};dw=function(a){if(a.j)a=a.g;else if(a.m)a=a.f||0;else{var b=(Date.now()+a.A)/1E3;a=Math.min(a.D?Math.max(0,b-(a.a-a.w)-a.o):Math.max(0,b-a.a-a.o),a.g)}return a};gw=function(a,b){var c=Math.max(a.h,0);return Infinity==a.ic?Math.ceil(1E3*c)/1E3:Math.max(c,Math.min(dw(a)-a.ic+b,fw(a)))};fw=function(a){return Math.max(0,dw(a)-(a.j||a.m?0:a.Re))};hw=function(){this.f=function(){};this.a=new Set};iw=function(a,b){a.f=b};
|
|
25
|
+
jw=function(a,b,c){this.g=a;this.a=b;this.f=c;new _.H("clpp.media.SegmentIterator")};kw=function(a){var b=a.g.get(a.a);if(!b)return null;0<b.a.length&&b.Ha().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};_.lw=function(a){this.a=a;this.f=new _.H("clpp.media.SegmentIndex")};_.mw=function(a){return a.a.length?a.a[a.a.length-1].endTime:0};_.nw=function(a,b){for(var c=0;c<a.a.length;++c)if(a.a[c].endTime>b){a.a.splice(0,c);return}a.a=[]};
|
|
26
|
+
ow=function(a,b){var c=a.Bc(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 jw(a,c,e)};
|
|
27
|
+
_.pw=function(a,b){for(;a.a.length;)if(0>=a.a[0].endTime)a.a.shift();else break;if(0!=a.a.length){var c=a.a[a.a.length-1];c.startTime>=b||(a.a[a.a.length-1]=new _.Yv(c.position,c.startTime,b,c.Ha,c.Qa,c.Ea,c.Aa,c.keyInfo,c.Zb,c.timescale,c.horizontalTiles,c.verticalTiles,c.durationPerTile))}};rw=function(a){var b=this;this.f=a;this.a=new Set;this.g=(new _.Ni(function(){qw(b,!1)})).bb(.25)};qw=function(a,b){for(var c=_.u(a.a),d=c.next();!d.done;d=c.next())d.value.m(a.f.currentTime,b)};
|
|
28
|
+
sw=function(a){var b=this;this.j=a;this.h=new Map;this.a=function(){};this.f=function(){};this.g=function(){};this.o=[{oc:null,nc:2,cc:function(c,d){return b.a(c,d)}},{oc:1,nc:2,cc:function(c,d){return b.a(c,d)}},{oc:3,nc:2,cc:function(c,d){return b.a(c,d)}},{oc:2,nc:1,cc:function(c,d){return b.f(c,d)}},{oc:2,nc:3,cc:function(c,d){return b.f(c,d)}},{oc:1,nc:3,cc:function(c,d){return b.g(c,d)}},{oc:3,nc:1,cc:function(c,d){return b.g(c,d)}}]};tw=function(a,b,c,d){a.a=b;a.f=c;a.g=d};
|
|
29
|
+
_.uw=function(a){_.yp[a]&&delete _.yp[a]};_.vw=function(a){_.wp[a]&&delete _.wp[a]};ww=function(a,b){this.o=null;this.B=a;this.g=b;this.h=this.w=0;this.j=Infinity;this.f=this.a=null;this.A="";this.m=new Map};
|
|
30
|
+
xw=function(a,b,c,d){return Promise.resolve().then(function(){if(a.o&&a.g)if(null==c||null==d)a.o.parseInit(_.N(b));else{var e={periodStart:a.w,segmentStart:c,segmentEnd:d};e=a.o.parseMedia(_.N(b),e);var f=e.cues.filter(function(g){return g.startTime>=a.h&&g.startTime<a.j});a.g.append(f,e.styles);null==a.a&&(a.a=Math.max(c,a.h));a.f=Math.min(d,a.j)}})};
|
|
31
|
+
yw=function(a,b,c){a.A=b;if(b=a.m.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,[])};
|
|
32
|
+
zw=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.h&&l.startTime<a.j&&(l=new _.yg(l.startTime,l.endTime,l.text),g.get(h).get(f).push(l),h==a.A&&a.g.append([l],[]))}e=_.u(g.keys());for(f=e.next();!f.done;f=e.next())for(f=f.value,a.m.has(f)||a.m.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),
|
|
33
|
+
a.m.get(f).set(h,l);a.a=null==a.a?Math.max(c,a.h):Math.min(a.a,Math.max(c,a.h));a.f=Math.max(a.f,Math.min(d,a.j))};_.Aw=function(a){a=a.toLowerCase();return _.Tp[a]||window.muxjs&&a==_.ac?!0:!1};Bw=function(){this.a=new muxjs.mp4.CaptionParser;this.j=[];this.h={}};_.Cw=function(){};Dw=function(){this.a=new muxjs.mp4.Transmuxer({keepOriginalTimestamps:!0,remux:!1});this.f=null;this.m=[];this.j=[];this.g=[];this.h=!1;this.a.on("data",this.w.bind(this));this.a.on("done",this.o.bind(this))};
|
|
34
|
+
Fw=function(a,b){return!window.muxjs||"mp2t"!=a.toLowerCase().split(";")[0].split("/")[1]&&"aac"!=a.toLowerCase().split(";")[0].split("/")[1]?!1:b?MediaSource.isTypeSupported(Ew(b,a))||MediaSource.isTypeSupported(a.replace(/aac/i,_.Ed)):MediaSource.isTypeSupported(Ew(_.ic,a))||MediaSource.isTypeSupported(a.replace(/aac/i,_.Ed))||MediaSource.isTypeSupported(Ew(_.Qe,a))};
|
|
35
|
+
Ew=function(a,b){var c=b.replace(/mp2t/i,_.Ed);a==_.ic&&(c=c.replace(_.Qe,_.ic));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};Gw=function(a,b){a.h=!0;a.f=new _.Nh;a.m=[];a.j=[];a.g=[];var c=_.N(b);a.a.push(c);a.a.flush();a.h&&a.f.reject(new _.L(_.M,3,3018));return a.f};
|
|
36
|
+
_.Iw=function(a,b,c,d,e){this.j=a;this.A=c;this.f={};this.K=!1;this.g=null;this.h={};this.o=new _.dg;this.J=!1;this.w={};this.F=b;this.B=d;this.L=e;this.N=this.L.streaming.maxSegmentToMediaOffset||1;this.I=new _.Nh;this.D={};this.m=Hw(this,this.I);this.a=new _.H("clpp.mse.MediaSourceEngine")};Jw=function(a){var b=_.Ji(a.mimeType,a.codecs),c=Iv(a);return _.Aw(b)||MediaSource.isTypeSupported(c)||Fw(b,a.type)};
|
|
37
|
+
Hw=function(a,b){var c=new MediaSource,d=Kw(c);a.o.one(c,"sourceopen",function(){URL.revokeObjectURL(d);b.resolve()});a.j.src=d;return c};Lw=function(a,b){b.forEach(function(c,d){var e=a.m.addSourceBuffer(c);a.o.on(e,_.gd,a.U.bind(a,d));a.o.on(e,"updateend",a.Kc.bind(a,d));a.f[d]=e;a.h[d]=[];a.D[d]=!1});a.K=b.has(_.ic)&&b.has(_.Qe)};Mw=function(a,b){a.g||(a.g=new ww(a.L,a.A));var c=a.g;if(b!=_.ac){var d=_.Tp[b];if(!d)throw new _.L(_.M,2,2012,"Text parser is unavailable for "+b);c.o=new d(c.B)}};
|
|
38
|
+
Nw=function(a){return a.m?a.m.readyState==_.fd:!0};Pw=function(a){var b={};b.total=new _.Jj(a.j.buffered,"total");b.audio=Ow(a,_.ic);b.video=Ow(a,_.Qe);var c=[];a.g&&(c=[{start:a.g.rb(),end:a.g.xa()}]);b.text=Kv(c,_.Be);return b};Ow=function(a,b){try{return new _.Jj(a.f[b].buffered,b)}catch(c){return b in a.f&&a.a.error("failed to get buffered range for "+b,c),null}};
|
|
39
|
+
Qw=function(a,b){if(!a.f[b])return"";var c=Ow(a,b);if(null===c)return"";for(var d="",e=0;e<c.length;e++)0<e&&(d+=" "),d+=c.start(e).toFixed(3)+"-"+c.end(e).toFixed(3);return d};
|
|
40
|
+
Sw=function(a,b,c,d,e,f,g,h){h=void 0===h?!1:h;var l=a.f[b],m=-1,n=0;l&&l.buffered&&(n=l.buffered.length);b===_.Qe&&null!==d&&null!==e&&h&&(m=0<n?l.buffered.end(n-1):-1);b==_.Be?c=xw(a.g,c,d,e):a.w[b]?c=Gw(a.w[b],c).then(function(p){a.g||Mw(a,_.Ce);p.captions&&p.captions.length&&zw(a.g,p.captions,d,e,a.f.video.timestampOffset);var q=[];0<p.audio.byteLength&&a.f.audio&&q.push(Rw(a,_.ic,a.me.bind(a,_.ic,p.audio.buffer)));0<p.video.byteLength&&a.f.video&&q.push(Rw(a,_.Qe,a.me.bind(a,_.Qe,p.video.buffer)));
|
|
41
|
+
return Promise.all(q)}):(f&&window.muxjs&&(a.g||Mw(a,_.Ce),null==d&&null==e?a.F.init(c):a.F.g(c,function(p){p.length&&zw(a.g,p,d,e,a.f.video.timestampOffset)})),c=Rw(a,b,a.me.bind(a,b,c)));return c.then(function(){if(b===_.Qe&&null!==d&&null!==e&&!h)a.B.append(d,e,g),null!==d&&null!==e&&a.a.debug("Appended video segment ",d,e,"Buffer:",Qw(a,b));else if(b===_.ic&&null!==d&&null!==e)Pv(a.B),null!==d&&null!==e&&a.a.debug("Appended audio segment ",d,e,"Buffer:",Qw(a,b));else if(b===_.Qe&&null!==d&&null!==
|
|
42
|
+
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.N&&0===l.timestampOffset)return a.a.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=Rw(a,b,function(){a.tg(b,r)}),q=Rw(a,b,a.If.bind(a,b,!1)),Promise.all([p,
|
|
43
|
+
q])}null!==d&&null!==e&&(a.D[b]=!0)})["catch"](function(p){throw p;})};Tw=function(a,b){var c=a.xa(_.Qe)||0;yw(a.g,b,c)};Vw=function(a,b,c,d,e){if(b==_.Be)return a.g.w=c,a=a.g,a.h=d,a.j=e,Promise.resolve();b=Uw(a,b,c,d,e);a.K&&(b=b.concat(Uw(a,_.ic,c,d,e)));return Promise.all(b)};Uw=function(a,b,c,d,e){return[Rw(a,b,a.Dg.bind(a,b)),Rw(a,b,a.tg.bind(a,b,c)),Rw(a,b,a.Ij.bind(a,b,d,e))]};
|
|
44
|
+
Rw=function(a,b,c){if(a.J)return Promise.reject();c={start:c,p:new _.Nh};a.h[b].push(c);1===a.h[b].length&&Ww(a,b);return c.p};Ww=function(a,b){var c=a.h[b][0];if(c)try{a.a.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})),Xw(a,b)}else a.a.debug("No more scheduled operations for "+b)};
|
|
45
|
+
Yw=function(a,b){if(a.J)return Promise.reject();var c=[],d;for(d in a.f){var e=new _.Nh,f={start:function(g){g.resolve()}.bind(null,e),p:e};a.h[d].push(f);c.push(e);1==a.h[d].length&&f.start()}return Promise.all(c).then(function(){for(var g in a.f);try{b()}catch(m){var h=Promise.reject(new _.L(_.M,3,3015,{mediaError:m}))}for(var l in a.f)Xw(a,l);return h},function(){for(var g in a.f)a.h[g].length&&a.h[g].shift();return Promise.reject()})};Xw=function(a,b){a.h[b].shift();Ww(a,b)};
|
|
46
|
+
dx=function(a,b,c,d){var e=a.periods.flatMap(function(n){return n.variants});if(b.length||c.length)e=Zw(e,b,c);e=$w(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={Xd:c.Xd},d++)c.Xd=b[d],l=new Set(_.lf(l).concat().filter(function(n){return function(p){return n.Xd.has(p)}}(c)));
|
|
47
|
+
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=ax(e);var m=bx(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(cx(n)===m)return!0;_.Rf("Dropping Variant (better codec available)",n);return!1})};ax=function(a){var b=new _.ag;a=_.u(a);for(var c=a.next();!c.done;c=a.next()){c=c.value;var d=cx(c);b.push(d,c)}return b};
|
|
48
|
+
Zw=function(a,b,c){var d={};b=_.u(b);for(var e=b.next();!e.done;d={be:d.be},e=b.next())if(d.be=e.value,e=a.filter(function(f){return function(g){return g.video&&g.video.codecs.startsWith(f.be)}}(d)),e.length){a=e;break}d={};c=_.u(c);for(b=c.next();!b.done;d={Vd:d.Vd},b=c.next())if(d.Vd=b.value,b=a.filter(function(f){return function(g){return g.audio&&g.audio.codecs.startsWith(f.Vd)}}(d)),b.length){a=b;break}return a};
|
|
49
|
+
bx=function(a){var b="",c=Infinity;ov(a,function(d,e){var f=e.reduce(function(g,h){return g+h.bandwidth||0},0)/e.length;_.Rf(_.Lc,d,"avg bandwidth",f);f<c&&(b=d,c=f)});return b};cx=function(a){var b="";a.video&&(b=_.Jv(a.video.codecs)[0]);var c="";a.audio&&(c=_.Jv(a.audio.codecs)[0]);return b+"-"+c};
|
|
50
|
+
ex=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};fx=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=ex(e,b,c);f!=e.allowedByApplication&&(d=!0)}return d};
|
|
51
|
+
ix=function(a,b,c,d){var e=!1;d.variants=d.variants.filter(function(m){if(a&&a.$&&!yv(a,m))return _.Rf("Dropping variant - not compatible with key system",m),!1;var n=m.audio,p=m.video;if(n&&!Jw(n)){var q=n.codecs;0<=n.codecs.indexOf("ec-3")?(_.Rf("Trying to use AC-3 for EC-3"),n.codecs=n.codecs.replace("ec-3","ac-3"),Jw(n)?_.Qf("Using AC-3 instead of EC-3 for",gx(n)):(n.codecs=q,_.Qf(Xu,gx(n)),m.audio=null,e=!0,n=null)):(_.Qf(Xu,gx(n)),m.audio=null,e=!0,n=null)}return p&&!Jw(p)?(_.Qf("Dropping variant - video not compatible with platform",
|
|
52
|
+
gx(p)),!1):n&&b&&!hx(n,b)?(_.Qf("Dropping variant - not compatible with active audio","active audio",gx(b),"variant.audio",gx(n)),!1):p&&c&&!hx(p,c)?(_.Qf("Dropping variant - not compatible with active video","active video",gx(c),"variant.video",gx(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?(_.Qf("Dropping variant - not compatible with video + audio",
|
|
53
|
+
"variant.video",gx(m.video)),!1):!0}))}d.textStreams=d.textStreams.filter(function(m){var n=_.Aw(_.Ji(m.mimeType,m.codecs));n||_.Rf("Dropping text stream. Is not supported by the platform.",m);return n})};hx=function(a,b){return a.mimeType!=b.mimeType||a.codecs.split(".")[0]!=b.codecs.split(".")[0]?!1:!0};
|
|
54
|
+
jx=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,w){return r.concat(w)},[]);a={id:a.id,active:!1,type:"variant",
|
|
55
55
|
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,
|
|
56
56
|
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};
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
_.
|
|
60
|
-
[]);return b.length?
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
d,null,["id","track"])}))||c.renditions.push(d);return a||d};
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
_.
|
|
69
|
-
c),
|
|
70
|
-
|
|
71
|
-
a.h=b}};
|
|
72
|
-
|
|
73
|
-
_.
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
b.
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
b,a.a=d,a.j=c;d=b-a.h;d>=a.m&&c&&a.f(a.a,d)}}else if((0!=e||a.w)&&a.
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
!g.h.paused){var h=
|
|
89
|
-
|
|
90
|
-
b;a.f.debug("Playhead outside safe region \x26 in unbuffered region.");return d};
|
|
91
|
-
|
|
57
|
+
kx=function(a){return{id:a.id,active:!1,type:_.Be,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}};
|
|
58
|
+
lx=function(a){return a.allowedByApplication&&a.allowedByKeySystem};$w=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))};
|
|
59
|
+
_.nx=function(a,b,c){b=_.bi(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=_.Hv(_.Gi(g),a.map(function(l){return l.language}));return h?(d=a.filter(function(l){return _.Gi(l.language)===h}),!0):!1});if(c){b=mx(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(_.zv,
|
|
60
|
+
[]);return b.length?mx(d,b[0]):d};mx=function(a,b){return a.filter(function(c){return c.roles.includes(b)})};ox=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};
|
|
61
|
+
gx=function(a){var b=Iv(a);return a.type===_.ic?"type\x3daudio mimeType\x3d"+a.mimeType+" codecs\x3d"+a.codecs+" codecInfo\x3d"+b+" bandwidth\x3d"+a.bandwidth+" channelsCount\x3d"+a.channelsCount:a.type===_.Qe?"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"};
|
|
62
|
+
px=function(a,b){var c=String(_.ji++);c=new _.ei(c,a);c.mimeType=_.fi(b.mimeType);if(a===_.P||a===_.Q)c.label=_.fi(b.label),c.language=_.fi(b.language);a===_.gi?(c.frameRate=b.frameRate,c.roles=b.roles):a===_.Q?(c.channelsCount=b.channelsCount,c.roles=b.audioRoles||[],c.mimeType=_.fi(b.audioMimeType)):(c.kind=_.fi(b.kind),c.roles=b.roles);c.accessibility=a===_.gi||a===_.Q?(b.accessibility||[]).filter(function(d){return d.type===a}):b.accessibility||[];return c};
|
|
63
|
+
qx=function(a,b,c){var d=new _.mi(a===_.gi?""+b.videoId:a===_.Q?""+b.audioId:""+b.id,c);switch(a){case _.gi:d.codec=_.fi(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=_.fi(b.audioCodec);d.bandwidth=b.audioBandwidth||b.bandwidth;d.originalId=b.originalAudioId;d.drm={keyId:b.keyId||void 0};break;default:d.codec=_.fi(b.codecs),d.originalId=b.originalTextId}(a=c.renditions.find(function(e){return _.K.va(e,
|
|
64
|
+
d,null,["id","track"])}))||c.renditions.push(d);return a||d};rx=function(a,b){var c=a.reduce(function(d,e){b===_.gi?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)};sx=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};
|
|
65
|
+
tx=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};ux=function(){this.g=new _.H("cl.api.mse.TrackManager");this.l=null;this.h=[];this.a=new Map;this.f=new Map};vx=function(a,b){return a.h.filter(function(c){return c.type===b})};wx=function(a,b){var c=a.a.get(b)||null;return c&&c.track};yx=function(a,b,c){c&&wx(a,c.type)===c&&!a.l.ja()||xx(a,b,c&&c.renditions[0])};
|
|
66
|
+
zx=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)};
|
|
67
|
+
xx=function(a,b,c,d){d=void 0===d?!1:d;if(a.l&&((a.a.get(b)||null)!==c||a.l.ja())){var e=a.l;if(c){if(0>a.h.indexOf(c.track))throw Error("Unknown rendition with ID "+c.id);if(b!==c.track.type)throw Error("Types mismatch");a.g.debug("Activate rendition type\n "+b+" with ID: "+c.id);if(b===_.P){var f=e.ha().find(function(n){return n.id==c.id});f&&(a.f.set(b,c),zx(a,c),e.trigger(new _.J(_.Ej)),Ax(e,!0).then(function(){Bx(e,f)})["catch"](function(n){a.g.warn("Error while activating track",n)}))}else if(b===
|
|
68
|
+
_.Q)a.f.set(b,c),Cx(e,parseInt(c.id,10));else if(b===_.gi){var g=a.a.get(_.Q)||null;if(g){var h=Dx(e).filter(function(n){return n.videoId==c.id});var l=h.find(function(n){return n.audioId==g.id});if(!l){a.g.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=Dx(e).find(function(n){return n.videoId==c.id});l?(a.f.set(b,
|
|
69
|
+
c),Ex(e,l,d)):a.g.warn("Cannot find matching variant")}}else a.g.debug(_.Ea+b),wx(a,b)&&(b===_.P?Ax(e,!1).then(function(){a.a.set(b,null);e.trigger(new _.J(_.Ej))})["catch"](function(n){a.g.warn("Error while de-activating text tracks",n)}):b===_.Q?a.g.info("Enabling ABR for audio is not supported"):Ex(e,null,d))}};
|
|
70
|
+
Hx=function(a){if(a.l){a.g.debug("Track list change detected, updating track list");for(var b=[],c=_.u(Object.values(_.sq)),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.ha());for(var e=d.next();!e.done;c={Vb:c.Vb},e=d.next()){e=e.value;c.Vb=px(_.P,e);var f=b.find(function(h){return function(l){return h.Vb.va(l)}}(c));c.Vb=f||c.Vb;var g=qx(_.P,e,c.Vb);e.active&&a.a.set(_.P,g);f||b.push(c.Vb)}Fx(a.l)||a.a.set(_.P,null);c=Dx(a.l);Gx(a,b,c,_.gi);Gx(a,b,c,_.Q);
|
|
71
|
+
a.h=b}};Gx=function(a,b,c,d){var e=rx(c,d);c={};e=_.u(e);for(var f=e.next();!f.done;c={Wb:c.Wb},f=e.next()){f=f.value;c.Wb=px(d,f);var g=b.find(function(l){return function(m){return l.Wb.va(m)}}(c));c.Wb=g||c.Wb;var h=qx(d,f,c.Wb);f.active&&a.a.set(d,h);g||b.push(c.Wb)}};
|
|
72
|
+
Ix=function(a,b,c){if(b){a.h.length||Hx(a);for(var d=b.type,e=a.a.get(d)||null,f,g=_.u(vx(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&&(zx(a,f),d===_.Q?a.l.trigger(new _.J(_.Dj)):d===_.gi&&a.l.trigger(new _.J(_.Ue,{details:{width:f.width||0,height:f.height||0,bandwidth:f.bandwidth,track:f.track,abrSelection:c}})))}};Jx=function(){this.f=new _.Tv(2);this.g=new _.Tv(5);this.a=0};Kx=function(a,b){return 128E3>a.a?b:Math.min(_.Vv(a.f),_.Vv(a.g))};
|
|
73
|
+
_.Lx=function(){this.f=new _.H("clpp.abr");this.w=null;this.j=!1;this.g=new Jx;this.o=[];this.m=1;this.B=this.A=!1;this.a=this.h=null};Mx=function(a,b){a&&(b=b.filter(function(c){return ex(c,a,{width:Infinity,height:Infinity})}));return b.sort(function(c,d){return c.bandwidth-d.bandwidth})};Nx=function(){this.a=new Map};Px=function(a,b){a.a.has(b)||a.a.set(b,new Ox);return a.a.get(b)};Ox=function(){this.text=this.variant=null};
|
|
74
|
+
Qx=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)};Tx=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&&Rx(c,d)&&Sx(c.roles,d.roles))}!c&&(c=a.video&&b.video)&&(c=a.video,d=b.video,c=!(Rx(c,d)&&Sx(c.roles,d.roles)));return c?!1:!0};
|
|
75
|
+
Rx=function(a,b){if(a.mimeType!=b.mimeType)return!1;var c=a.codecs.split(",").map(function(f){return _.Jv(f)[0]}),d=b.codecs.split(",").map(function(f){return _.Jv(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};Sx=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};
|
|
76
|
+
Vx=function(a){this.a=a;this.f=new Ux(a.language,"",a.audio&&a.audio.channelsCount?a.audio.channelsCount:0)};Ux=function(a,b,c){this.g=_.bi(a);this.a=b;this.f=c};Wx=function(a,b){var c=null;b.some(function(d){c=_.Hv(_.Gi(d),a.map(function(e){return Gv(e)}));return!!c});return c?a.filter(function(d){return c===Gv(d)}):[]};Xx=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)})};
|
|
77
|
+
$x=function(a,b){this.a=Yx;this.f=(new Map).set(Yx,b).set(Zx,a)};
|
|
78
|
+
by=function(a){var b=this;this.C=a;this.a=a.getConfiguration().streaming;this.g=new _.dg;this.f=new _.H("clpp.mse.media.LiveEdgeObserver");ay(this)&&(a=this.C.getSurface().getMedia(),this.g.on(a,_.Ee,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.f.debug("Too far from edge, jump to beginning."),b.C.setPlaybackRate(1),b.C.seek(d)):1===e&&c>=b.a.startChasingAt?(b.f.debug("Not on live edge, increase playback rate."),
|
|
79
|
+
b.C.setPlaybackRate(b.a.chasingRate)):1<e&&c<=f&&(b.f.debug("On live edge, reduce playback rate."),b.C.setPlaybackRate(1))}))};
|
|
80
|
+
ay=function(a){return 1>=a.a.chasingRate?(a.f.warn("chasingRate must be greater than 1."),!1):a.a.chaseJumpDistance<=a.a.startChasingAt?(a.f.warn("chaseJumpDistance must be greater than startChasingAt."),!1):a.a.startChasingAt<=a.a.stopChasingAt?(a.f.warn("startChasingAt must be greater than stopChasingAt."),!1):0>a.a.stopChasingAt?(a.f.warn("stopChasingAt must be greater than or equal to 0."),!1):!0};cy=function(a){this.g=a;this.a=null;this.f=function(){}};dy=function(a,b){a.f=b};
|
|
81
|
+
ey=function(a){var b=this;this.a=a;this.h=!1;this.g=this.a.te();this.f=new _.Ni(function(){b.a.Ei(.25*b.g)})};fy=function(a){a.f.stop();var b=a.h?0:a.g;0<=b?a.a.te()!=b&&a.a.sg(b):(a.f.bb(.25),0!=a.a.te()&&a.a.sg(0))};hy=function(a,b){this.g=a;this.j=gy(a);this.a=a.a.currentTime;this.h=Date.now()/1E3;this.m=b;this.f=function(){}};iy=function(a,b){a.f=b};jy=function(a){this.a=a};
|
|
82
|
+
gy=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};ly=function(a,b,c,d,e){var f=this;this.a=a;this.D=b;this.j=c;this.B=e;this.g=new _.dg;this.A=!1;this.I=a.readyState;this.h=!1;this.f=d;this.m=this.F=this.w=!1;this.g.on(a,_.Ye,function(){return ky(f)});this.o=(new _.Ni(function(){ky(f)})).bb(.25)};
|
|
83
|
+
ky=function(a){if(0!=a.a.readyState){if(a.a.seeking){if(!a.A)return}else a.A=!1;if(!a.a.paused&&!a.m){a.a.readyState!=a.I&&(a.h=!1,a.I=a.a.readyState);var b=a.j.smallGapLimit,c=a.a.currentTime,d=a.a.buffered;a:{var e=new _.Jj(d);var f=a.j.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=gy(d);d=d.a.currentTime;b=Date.now()/1E3;if(a.a!=d||a.j!=c)a.h=
|
|
84
|
+
b,a.a=d,a.j=c;d=b-a.h;d>=a.m&&c&&a.f(a.a,d)}}else if((0!=e||a.w)&&a.F&&(f=d.start(e),!(f>=fw(a.D)))){g=f-c;b=g<=b;var h=!1;if(!(.001>g)){if(!b&&!a.h){a.h=!0;var l=new _.J("largegap",{detail:{currentTime:c,gapSize:g}});l.cancelable=!0;a.B(l);a.j.jumpLargeGaps&&!l.defaultPrevented?h=!0:_.Qf("Ignoring large gap at",c,"size",g)}if(b||h)0==e?_.Qf(Su,g,"seconds because of gap before start time of",f):_.Qf(Su,g,"seconds because of gap starting at",d.end(e-1),"and ending at",f),a.a.currentTime=f}}}}};
|
|
85
|
+
py=function(a,b,c,d){this.a=a;this.h=b;this.m=d;this.w=c;this.j=!1;this.f=new _.dg;this.g=new my(a);this.o=!1;0<a.readyState?ny(this,c):oy(this,c)};qy=function(a){return a.j?a.a.currentTime:a.w};sy=function(a,b){0<a.a.readyState?ry(a.g,b):oy(a,b)};oy=function(a,b){a.w=b;a.f.off(a.a,_.vd);a.f.one(a.a,_.vd,function(){ny(a,b)})};ny=function(a,b){a.o||(a.o=!0,a.m&&a.m());.001>Math.abs(a.a.currentTime-b)?ty(a):(a.f.one(a.a,_.ke,function(){ty(a)}),ry(a.g,0==a.a.currentTime?b:a.a.currentTime))};
|
|
86
|
+
ty=function(a){_.Si()&&!a.j&&a.h();a.j=!0;a.f.on(a.a,_.ke,function(){return a.h()})};my=function(a){var b=this;this.f=a;this.m=10;this.j=this.g=this.h=0;this.a=new _.Ni(function(){0>=b.h?(_.G(["Failed to move playhead from",b.g,"to",b.j].join(" ")),b.a.stop()):b.f.currentTime!=b.g?b.a.stop():(b.f.currentTime=b.j,b.h--)})};ry=function(a,b){a.g=a.f.currentTime;a.j=b;a.h=a.m;a.f.currentTime=b;a.a.bb(.1)};
|
|
87
|
+
xy=function(a,b,c,d,e,f){var g=this;this.h=a;this.a=b.presentationTimeline;this.B=b.minBufferTime||0;this.m=c;this.A=e;this.w=null;this.j=new ly(a,b.presentationTimeline,c,uy(this,a,c),f);this.g=new py(a,function(){a:{var h=g.j;h.A=!0;h.w=!1;h.h=!1;h=qy(g.g);var l=vy(g,h);if(.001<Math.abs(l-h)){var m=(new Date).getTime()/1E3;if(!g.w||g.w<m-1){g.w=m;sy(g.g,l);h=void 0;break a}}g.f.debug("Seek to "+h);g.A();h=void 0}return h},wy(this,d),function(){g.j.F=!0});this.o=(new _.Ni(function(){if(0!=g.h.readyState&&
|
|
88
|
+
!g.h.paused){var h=qy(g.g),l=gw(g.a,0),m=fw(g.a);3>m-l&&(l=m-3);h<l&&(l=vy(g,h),g.f.info("Jumping forward "+(l-h)+" seconds to catch up with the seek range."),g.h.currentTime=l)}})).bb(.25);this.f=new _.H("clpp.mse.Playhead")};zy=function(a){var b=qy(a.g);return 0<a.h.readyState&&!a.h.paused?yy(a,b):b};wy=function(a,b){null==b?b=Infinity>a.a.getDuration()?gw(a.a,0):fw(a.a):0>b&&(b=fw(a.a)+b);return Ay(a,yy(a,b))};Ay=function(a,b){var c=a.a.getDuration();return b>=c?c-a.m.durationBackoff:b};
|
|
89
|
+
vy=function(a,b){var c=new _.Jj(a.h.buffered);c=c.ec.bind(c);var d=Math.max(a.B,a.m.rebufferingGoal),e=a.m.safeSeekOffset,f=gw(a.a,0),g=fw(a.a),h=a.a.getDuration();3>g-f&&(f=g-3);var l=gw(a.a,d),m=gw(a.a,e);d=gw(a.a,d+e);if(b>=h)return a.f.debug("Playhead past duration."),Ay(a,b);if(b>g)return a.f.debug("Playhead past end."),g;if(b<f){if(c(m))return a.f.debug("Playhead before start \x26 start is buffered"),m;a.f.debug("Playhead before start \x26 start is unbuffered");return d}if(b>=l||c(b))return a.f.debug("Playhead in safe region or in buffered region."),
|
|
90
|
+
b;a.f.debug("Playhead outside safe region \x26 in unbuffered region.");return d};yy=function(a,b){var c=gw(a.a,0);if(b<c)return c;c=fw(a.a);return b>c?c:b};
|
|
91
|
+
uy=function(a,b,c){if(!c.stallEnabled)return null;var d=c.gapDetectionThreshold,e=c.stallSkip;c=new hy(new jy(b),c.stallThreshold);iy(c,function(f,g){a.f.warn("Stall detected at "+f+" for "+g+" seconds.");if(e){var h=new _.Jj(b.buffered),l;if(l=_.Qi("Edge/")||_.Qi("Trident/")||_.Uh()||_.Si())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=
|
|
92
92
|
h.start(l+1)-f;break a}h=null}h&&(e=Math.min(h+.1,e))}a.f.warn("Seeking forward "+e+" seconds to break stall.");b.currentTime+=e}else a.f.warn("Pausing and unpausing to break stall."),b.pause(),b.play()});return c};
|
|
93
|
-
|
|
94
|
-
a;if(0===g.length||!e)throw _.
|
|
95
|
-
|
|
96
|
-
b.start);b=_.
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
_.
|
|
101
|
-
var g=a.
|
|
102
|
-
(f+=(
|
|
103
|
-
|
|
104
|
-
c)};
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
(a.
|
|
109
|
-
|
|
110
|
-
e.value,a.
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
h,b).then(function(){return
|
|
127
|
-
|
|
128
|
-
a.
|
|
129
|
-
"Appending segment with "+(
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
f,f+h).then(function(){a.
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
h.variant.audio);h.text&&l.set(_.
|
|
137
|
-
for(h=g.next();!h.done;h=g.next())h=h.value,(m=l.get(h))?(_.
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
c);c=a.
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
a.
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
(
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
_.
|
|
201
|
-
b)
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
_.
|
|
205
|
-
_.t.
|
|
93
|
+
Cy=function(a){function b(){d=!0}function c(m){f.push(m);_.Hk(m)}a=_.N(a);var d=!1,e,f=[],g=[];(new _.Gk).M(_.Dd,c).M(_.Fe,c).M(_.yd,c).M(_.Cd,c).M(_.te,c).W(_.ve,function(m){e=m;f.push(m);_.Ik(m)}).W("encv",b).W("enca",b).W("avc1",function(m){g.push({M:m,Jc:1701733238})}).W("avc3",function(m){g.push({M:m,Jc:1701733238})}).W("ac-3",function(m){g.push({M:m,Jc:1701733217})}).W("ec-3",function(m){g.push({M:m,Jc:1701733217})}).W("mp4a",function(m){g.push({M:m,Jc:1701733217})}).parse(a);if(d)return _.Qf("Init segment already indicates encryption."),
|
|
94
|
+
a;if(0===g.length||!e)throw _.Sf("Failed to find boxes needed to fake encryption!"),_.Sf("Failed init segment (hex):",_.fk(a)),new _.L(_.M,3,14E3);g.reverse();for(var h=_.u(g),l=h.next();!l.done;l=h.next())l=l.value,_.Qf('Inserting "'+_.Lk(l.Jc)+'" box into init segment.'),a=By(a,e,l.M,f,l.Jc);return a};
|
|
95
|
+
By=function(a,b,c,d,e){var f=Dy.value(),g=a.subarray(c.start,c.start+c.size),h=_.mh(g),l=new Uint8Array(c.size+f.byteLength);l.set(g,0);g=_.mh(l);g.setUint32(4,e);l.set(f,c.size);e=h.getUint32(4);g.setUint32(c.size+16,e);Ey(l,0,l.byteLength);e=new Uint8Array(a.byteLength+l.byteLength);c=_.Qi("Xbox One")||_.Pi()?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,Ey(e,d.start,d.size+l.byteLength);l=_.mh(e,
|
|
96
|
+
b.start);b=_.Mk(b);a=l.getUint32(b);l.setUint32(b,a+1);return e};Ey=function(a,b,c){a=_.mh(a,b);b=a.getUint32(0);0!=b&&(1==b?(a.setUint32(8,c>>32),a.setUint32(12,c&4294967295)):a.setUint32(0,c))};_.Fy=function(a,b){this.C=b;this.g=a;this.j=null;this.A=1;this.F=Promise.resolve();this.m=[];this.o=new Map;this.f=new Map;this.J=this.h=this.w=this.B=!1;this.I=0;this.a=new _.H("clpp.mse.Streaming");this.D=!1};
|
|
97
|
+
Gy=function(a){var b=a.f.get(_.Qe);return b?a.g.periods[b.zb]:(b=a.f.get(_.ic))?a.g.periods[b.zb]:null};Iy=function(a){return _.Hy(a,_.ic)};Jy=function(a){return _.Hy(a,_.Qe)};_.Hy=function(a,b){var c=a.f.get(b);return c?c.Rb||c.stream:null};
|
|
98
|
+
Oy=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=_.on,_.x(q,a.C.X.clear(c.TEXT),2);case 2:return a.I++,a.J=!1,d=a.I,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.h?q["return"]():_.x(q,Ky(a,g),4);case 4:if(a.h)return q["return"]();l=(h=e.getTextDisplayer().isTextVisible())||a.j.alwaysStreamText;a.I!=d||a.f.has(c.TEXT)||a.J||!l||(m=a.C.wb(),n=Ly(a,m),p=My(b,n,0),a.f.set(c.TEXT,p),Ny(a,p,0));_.z(q)}})};
|
|
99
|
+
Ry=function(a){a.J=!0;var b=a.f.get(_.Be);b&&(Py(b),Qy(b)["catch"](function(){}),a.f["delete"](_.Be))};Ty=function(a,b,c,d){b.video&&_.Sy(a,b.video,c,d);b.audio&&_.Sy(a,b.audio,c,d)};
|
|
100
|
+
_.Sy=function(a,b,c,d){var e=a.f.get(b.type);if(!e&&b.type==_.Be&&a.j.ignoreTextStreamFailures)Oy(a,b);else if(e){var f=Uy(a,b);if(c&&f!=e.zb)for(a.a.debug("switch: switching to stream in another Period; clearing buffer and changing Periods"),b=_.u(a.f.values()),c=b.next();!c.done;c=b.next())Vy(a,c.value);else{e.Rb&&(a.a.debug("switch during trick play mode",b),b.trickModeVideo?(e.Rb=b,b=b.trickModeVideo,a.a.debug("switch found trick play stream",b)):(e.Rb=null,a.a.debug("switch found no special trick play stream")));
|
|
101
|
+
var g=a.m[f];if(g&&g.Mc&&(g=a.o.get(b.id))&&g.Mc)if(e.stream!=b){g=a.g.presentationTimeline.getDuration();var h=a.C.wb();h=Wy(a,e,h);!c&&(e.endOfStream||h>=g)?a.a.debug(nv+Xy(e)+" already buffered to the end. Not switching."):(b.type==_.Be&&Mw(a.C.X,_.Ji(b.mimeType,b.codecs)),e.stream=b,e.stream.segmentIterator=null,e.jd=!0,a.a.debug("switch: switching to Stream "+Xy(e)),Yy(a,e,f)&&(a.a.info("Aborting current segment request to switch."),e.Cb.abort()),c&&(e.Xb?e.Td=!0:e.Ya?(e.Fb=!0,e.vd=d,e.Td=!0):
|
|
102
|
+
(Py(e),Zy(a,e,!0,d)["catch"](function(l){if(a.C)a.C.onError(l)}))))}else a.a.debug(nv+Xy(e)+" already active")}}};Yy=function(a,b,c){if(!b.Cb)return!1;var d=a.C.wb(),e=a.C.X.xa(b.type);c=(c=$y(a,b,d,e,c))?c.Ea?c.Ea-c.Qa:null:null;if(null==c)return!1;var f=b.stream.initSegmentReference;f&&(c+=(f.Ea?f.Ea-f.Qa:null)||0);f=a.C.re().getBandwidthEstimate();if(8*c/f<(null===e?0:e-d)-Math.max(a.g.minBufferTime||0,a.j.rebufferingGoal))return!0;a=b.Cb;a=a.h?a.h.bytesRemaining:-1;return 0>a||a>c?!0:!1};
|
|
103
|
+
az=function(a){function b(l){return a.C.X.ec(l,c,0)}var c=a.C.wb(),d=!1,e=Ly(a,c);if(_.Zg(a.f.values(),function(l){return l.zb==e}))for(var f=_.u(a.f.keys()),g=f.next();!g.done;g=f.next()){g=g.value;var h=a.f.get(g);h.stream.segmentIterator=null;b(g)||(Vy(a,h),d=!0)}else if(!_.Zg(a.f.keys(),b)){a.a.debug("(all): seeked: unbuffered seek: clearing all buffers");d=_.u(a.f.values());for(f=d.next();!f.done;f=d.next())Vy(a,f.value);d=!0}d||a.a.debug("(all): seeked: buffered seek: presentationTime\x3d"+
|
|
104
|
+
c)};Vy=function(a,b){var c=Xy(b);b.Xb?a.a.debug(c,"clear: already clearing the buffer"):b.Fb?a.a.debug(c,"clear: already waiting"):b.Ya?(a.a.debug(c,"clear: currently updating"),b.Fb=!0,b.vd=0):null==a.C.X.rb(b.type)?(a.a.debug(c,"clear: nothing buffered"),null==b.qb&&Ny(a,b,0)):(a.a.debug(c,"clear: handling right now"),Py(b),Zy(a,b,!1,0)["catch"](function(d){if(a.C)a.C.onError(d)}))};
|
|
105
|
+
cz=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.wb(),g=Ly(a,f),h=_.on,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.h)return q["return"]();bz(a);return _.x(q,Ky(a,m),3)}if(a.h)return q["return"]();l.forEach(function(r,w){if(!a.f.has(w)){var y=My(r,g,e);a.f.set(w,y);Ny(a,y,0)}});_.z(q)})};
|
|
106
|
+
My=function(a,b,c){return{stream:a,type:a.type,Ob:null,segmentIterator:null,oa:null,Rb:null,jd:!0,zb:b,endOfStream:!1,Ya:!1,qb:null,Fb:!1,vd:0,Td:!1,Xb:!1,Te:!1,Hc:!1,qg:c||0,Cb:null,yd:!1,Sf:0}};
|
|
107
|
+
dz=function(a,b){var c=a.m[b];if(c)return a.a.debug("(all) Period "+b+Lu),c.P;a.a.debug("(all) setting up Period "+b);c={P:new _.Nh,Mc:!1};a.m[b]=c;for(var d=new Set,e=_.u(a.g.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.g.periods[b].textStreams);for(f=e.next();!f.done;f=e.next())d.add(f.value);a.F=a.F.then(function(){return a.h?null:Ky(a,d)}).then(function(){a.h||
|
|
108
|
+
(a.m[b].P.resolve(),a.m[b].Mc=!0,a.a.debug("(all) setup Period "+b))})["catch"](function(g){a.h||(a.m[b].P["catch"](function(){}),a.m[b].P.reject(),delete a.m[b],a.a.warn("(all) failed to setup Period "+b),a.C.onError(g))});return c.P};
|
|
109
|
+
Ky=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.a.debug("(all) Stream "+f.id+Lu),c.push(g.P)):(a.a.debug("(all) setting up Stream "+f.id),a.o.set(f.id,{P:new _.Nh,Mc:!1}),c.push(f.createSegmentIndex()));_.yf(r,2);return _.x(r,Promise.all(c),4);case 4:if(a.h)return r["return"]();_.zf(r,3);break;case 2:h=_.Af(r);if(a.h)return r["return"]();l=_.u(b);for(e=l.next();!e.done;e=l.next())m=
|
|
110
|
+
e.value,a.o.get(m.id).P["catch"](function(){}),a.o.get(m.id).P.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.Mc||(q.P.resolve(),q.Mc=!0,a.a.debug("(all) setup Stream "+p.id));_.z(r)}})};bz=function(a){var b=a.g.presentationTimeline.getDuration();Infinity>b?a.C.X.Tb(b):a.C.X.Tb(Math.pow(2,32))};
|
|
111
|
+
gz=function(a,b){function c(p){return p.type==_.Be&&p.stream.mimeType==_.ac}if(c(b))return Tw(a.C.X,b.stream.originalId||""),null;var d=Xy(b),e=a.C.wb(),f=Wy(a,b,e);a.a.debug(d,"timeNeeded\x3d"+f);var g=Uy(a,b.stream),h=Ly(a,f),l=a.C.X.Da(b.type,e);a.a.debug(d,"update_:",iv+e,"bufferedAhead\x3d"+l);var m=Math.max(a.g.minBufferTime||0,a.j.rebufferingGoal,a.j.bufferingGoal)*a.A,n=$v(a.g.presentationTimeline);if(null!=n&&f>=n&&!b.yd)return ez(a,b),null;b.endOfStream=!1;b.zb=h;if(h!=g)return a.a.debug(d,
|
|
112
|
+
"need Period "+h,iv+e,"timeNeeded\x3d"+f,"currentPeriodIndex\x3d"+g),null;if(l>=m)return a.a.debug(d,"buffering goal met"),a.j.bufferLimitUpdateInterval||.5;h=a.C.X.xa(b.type);h=$y(a,b,e,h,g);if(!h)return a.g.presentationTimeline.isLive()||b.type===_.Be?a.j.bufferLimitUpdateInterval||1:(a.a.debug("Media state "+d+": no next segment found. Assuming EOS."),ez(a,b),null);d=Infinity;l=_.u(a.f.values());for(m=l.next();!m.done;m=l.next())m=m.value,c(m)||(m=Wy(a,m,e),d=Math.min(d,m));if(f>=d+a.g.presentationTimeline.a)return a.j.bufferLimitUpdateInterval||
|
|
113
|
+
1;b.qg=0;fz(a,b,e,g,h)["catch"](function(){});return null};ez=function(a,b){a.a.debug(Xy(b),"buffered to end of presentation");b.endOfStream=!0;if(b.type==_.Qe){var c=a.f.get(_.Be);c&&c.stream.mimeType==_.ac&&(c.endOfStream=!0)}};Wy=function(a,b,c){if(!b.Ob||!b.oa)return Math.max(c,b.qg);c=Uy(a,b.Ob);return a.g.periods[c].startTime+b.oa.endTime};
|
|
114
|
+
$y=function(a,b,c,d,e){if(b.stream.segmentLookupStrategy===_.hz)b.stream.segmentIterator?a=kw(b.stream.segmentIterator):b.oa||d?(e=b.oa?b.oa.endTime:d,a.a.info(Ru,"looking up segment from new stream endTime:",e),b.stream.segmentIterator=ow(b.stream.segmentIndex,e),d=b.stream.segmentIterator.next().value,null===d&&(b.stream.segmentIterator=null,a.a.warn(Ru,bv,"endTime:",e,b.oa)),a=d):(e=Math.max(c,0),a.a.info(Ru,"looking up segment","lookupTime:",e,hv,c),d=null,d||(b.stream.segmentIterator=ow(b.stream.segmentIndex,
|
|
115
|
+
c),d=b.stream.segmentIterator.next().value),null===d&&a.a.warn(Ru,bv,"lookupTime:",e,hv,c),a=d);else{var f=Xy(b);b.oa&&b.stream==b.Ob?(d=b.oa.position+1,a.a.debug(f,"next position known:","position\x3d"+d),a=iz(a,b,e,d)):(b.oa?(a.a.debug(f,"next position unknown: another Stream buffered"),c=Uy(a,b.Ob),c=jz(a,b,a.g.periods[c].startTime+b.oa.endTime,e)):(a.a.debug(f,"next position unknown: nothing buffered"),c=jz(a,b,d||c,e)),null==c?a=null:(f=null,null!=d||null!==a.j&&a.j.ignoreDrift||(f=iz(a,b,e,
|
|
116
|
+
Math.max(0,c-1))),a=f||iz(a,b,e,c)))}return a};jz=function(a,b,c,d){var e=Xy(b);d=a.g.periods[d];a.a.debug(e,"looking up segment:","lastSegment.endTime\x3d"+c,dv+d.startTime);c=Math.max(0,c-d.startTime);b=b.stream.findSegmentPosition(c);null==b&&a.a.warn(e,"cannot find segment:",dv+d.startTime,"lookupTime\x3d"+c);return b};
|
|
117
|
+
iz=function(a,b,c,d){var e=Xy(b);c=a.g.periods[c];var f=b.stream.getSegmentReference(d);if(!f)return a.a.debug(e,"segment does not exist:",dv+c.startTime,"position\x3d"+d),null;var g=a.g.presentationTimeline;d=_.ew(g);g=dw(g);return!b.yd&&(c.startTime+f.endTime<d||c.startTime+f.startTime>g)?(a.a.debug(e,"segment is not available:",dv+c.startTime,lv+f.startTime,jv+f.endTime,"availabilityStart\x3d"+d,"availabilityEnd\x3d"+g),null):f};
|
|
118
|
+
fz=function(a,b,c,d,e){var f,g,h,l,m,n,p,q,r,w,y,A,E;return _.B(function(F){f=_.on;g=Xy(b);h=a.g.periods[d];a.a.debug(g,"fetchAndAppend_:",iv+c,dv+h.startTime,kv+e.position,lv+e.startTime,jv+e.endTime);l=b.stream;m=b.stream.segmentIterator;n=a.g.presentationTimeline.getDuration();p=a.g.periods[d+1];q=Math.max(0,h.startTime-.1);r=p?p.startTime+.01:n;w=kz(a,b,d,q,r,e);b.Ya=!0;b.jd=!1;a.a.debug(g,"fetching segment");y=!1;A=function(D,I){if(a.h||a.w)return null;y=!0;return lz(a,b,c,h,l,e,D,I)};E=a.C.X.xa(b.type)||
|
|
119
|
+
0;w.then(function(){return a.h||a.w?null:mz(a,b,e,!1,function(D){return A(D.data,!0)})}).then(function(D){return y||a.h||a.w||null===D?(a.h||a.w||nz(a,b,E,e,l),null):A(D,!1)}).then(function(){if(!a.h&&!a.w){nz(a,b,E,e,l);b.Ya=!1;b.Te=!1;b.Fb||a.C.Pd();if(m){var D=m.next().value;D&&a.a.debug("New iterated segment",D)}Ny(a,b,0);oz(a,b,l);a.a.debug(g,"finished fetch and append")}})["catch"](function(D){return _.B(function(I){if(a.h||a.w)return I["return"]();b.Ya=!1;if(b.type==f.TEXT&&a.j.ignoreTextStreamFailures)return 1001==
|
|
120
|
+
D.code?a.a.warn(g,"Text stream failed to download. Proceeding without it."):a.a.warn(g,"Text stream failed to parse. Proceeding without it."),a.f["delete"](f.TEXT),I.H(0);if(7001==D.code)return b.Ya=!1,b.qb=null,Ny(a,b,0),I.H(0);if(3017===D.code)return pz(a,b,D),I.H(0);if(1001===D.code&&D.data&&404===D.data[1])return a.a.warn(g,"request for segment failed","segment not available on server",kv+e.position,lv+e.startTime,jv+e.endTime,"error\x3d"+D),b.Ya=!1,b.qb=null,Ny(a,b,1),I.H(0);if(b.type===f.TEXT)return D instanceof
|
|
121
|
+
_.L&&D.a(1),Py(b),a.C.onError(new _.L(1,2,2010,D)),I.H(0);if(1001<=D.code&&1003>=D.code)return _.x(I,qz(a,b,h,D),0);a.a.error(g,"failed fetch and append: code\x3d"+D.code);b.Hc=!0;D instanceof _.L&&D.a(_.M);return _.x(I,rz(a,D),0)})});_.z(F)})};
|
|
122
|
+
tz=function(a,b){b=void 0===b?!1:b;if(a.h)a.a.error("Unable to retry after StreamingEngine is destroyed!");else if(a.w)a.a.error("Unable to retry after StreamingEngine encountered a fatal error!");else for(var c=_.u(a.f.values()),d=c.next();!d.done;d=c.next()){d=d.value;var e=Xy(d);if(d.Hc||b&&sz(d))a.a.info(e,"Retrying after failure..."),d.Hc=!1,Ny(a,d,.1)}};
|
|
123
|
+
pz=function(a,b,c){var d=Xy(b);if(Array.from(a.f.values()).some(function(f){return f!=b&&f.Te}))a.a.debug(d,Tu,"waiting for another stream to recover...");else{var e=Math.round(100*a.A);if(20<e)a.A-=.2;else if(4<e)a.A-=.04;else{a.a.error(d,"MediaSource threw QuotaExceededError too many times");b.Hc=!0;a.w=!0;a.C.onError(c);return}a.a.warn(d,Tu,"reducing buffering goals by "+(100-Math.round(100*a.A))+"%");b.Te=!0}Ny(a,b,4)};
|
|
124
|
+
qz=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.fe(b.stream,c));if(!f)return g.H(0);b.Hc=!0;d.a(_.M);return _.x(g,rz(a,d),0)})};
|
|
125
|
+
kz=function(a,b,c,d,e,f){c=a.g.periods[c].startTime-f.Aa;if(!b.jd&&c===b.Sf)return Promise.resolve();b.Sf=c;var g=Xy(b);a.a.debug(g,"setting timestamp offset to "+c);a.a.debug(g,"setting append window start to "+d);a.a.debug(g,"setting append window end to "+e);d=Vw(a.C.X,b.type,c,d,e);if(!b.stream.initSegmentReference||!b.jd)return d;a.a.debug(g,"fetching init segment");e=mz(a,b,b.stream.initSegmentReference,!0).then(function(h){if(a.h)return null;a.a.debug(g,"appending init segment");return uz(a,
|
|
126
|
+
h,b).then(function(){return Sw(a.C.X,b.type,h,null,null,!!b.stream.closedCaptions&&0<b.stream.closedCaptions.size)})})["catch"](function(h){b.jd=!0;return Promise.reject(h)});return Promise.all([d,e])};uz=function(a,b,c){var d;return _.B(function(e){if(!a.j.patchEdgeWhenMixedContent||!_.Pi())return e.H(0);d=Cy(b);return _.x(e,Sw(a.C.X,c.type,d.buffer,null,null,!!c.stream.closedCaptions&&0<c.stream.closedCaptions.size),0)})};
|
|
127
|
+
lz=function(a,b,c,d,e,f,g,h){h=void 0===h?!1:h;var l,m,n,p,q,r,w,y,A;return _.B(function(E){switch(E.a){case 1:l=Xy(b);if(!(e&&e.keyId&&a.C.bd)){E.H(2);break}m=vv(a.C.bd,e.keyId);if(!m){a.a.warn("Unable to find DRM session for "+e.keyId);E.H(2);break}_.yf(E,4);return _.x(E,m,6);case 6:_.zf(E,2);break;case 4:n=_.Af(E),a.a.warn("DRM session load failed!",n);case 2:if(!(e.encrypted&&e.keyId&&a.C.bd&&xv(a.C.bd,e.keyId))){E.H(7);break}Py(b);p=Uy(a,e);q=vz(a,p);if(!q){E.H(8);break}return _.x(E,q,8);case 8:return r=
|
|
128
|
+
a.C.fe(e,d,fv),w=f.startTime+d.startTime,y=f.endTime+d.startTime,a.a.warn(l,"Blocked append for "+w+" - "+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 _.Gk).W("emsg",a.uj.bind(a,d,f,e.emsgSchemeIdUris)).parse(g),E["return"](wz(a,b,c).then(function(){if(a.h)return null;var F=f.startTime+d.startTime,D=f.endTime+d.startTime;a.a.debug(l,
|
|
129
|
+
"Appending segment with "+(F.toFixed(3)+" - "+D.toFixed(3)+" KeyID: ")+(e.keyId+" Width: ")+(e.width+" Height: "+e.height+" Bitrate: ")+(_.Ah(e.bandwidth)+" Fragment: ")+h);return Sw(a.C.X,b.type,g,F,D,A,e.id,h)}).then(function(){a.h||(a.a.debug(l,"appended media segment"),b.Ob=e,b.oa=f)}))}})};
|
|
130
|
+
nz=function(a,b,c,d,e){if(!a.g.presentationTimeline.isLive()&&b.type!==_.Be){var f=Xy(b);c=(a.C.X.xa(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.a.debug(f,"Adjusted segment",d.position,"with real duration",c,"and accounted for",h,"delta between segment duration and real duration"),b.yd=!0,e.adjustSegmentDurations(d.position,h))}};
|
|
131
|
+
xz=function(a,b,c){(new _.Gk).M(_.Dd,_.Hk).M(_.Fe,_.Hk).M(_.yd,_.Hk).M(_.Cd,_.Hk).M(_.te,_.Hk).W(_.ve,_.Ik).M("encv",function(d){d.G.skip(78);_.Hk(d)}).M(_.ne,_.Hk).M("schi",_.Hk).M("tenc",function(d){d.G.skip(6);if(_.Ak(d.G)){d.G.skip(1);var e=_.fk(_.Fk(d.G,16));e!==b.stream.keyId&&(a.a.debug(Xy(b),"Key id from tenc mismatches with key id from manifest. Switching from "+(b.stream.keyId+" to "+e+".")),b.stream.keyId=e)}d.Xa.stop()}).parse(c)};
|
|
132
|
+
wz=function(a,b,c){if(a.h)return Promise.resolve();var d=Xy(b);a.a.debug(d,"checking buffer length");var e=Math.max(a.j.bufferBehind,a.g.presentationTimeline.a),f=a.C.X.rb(b.type);if(null==f)return a.a.debug(d,"buffer behind okay because nothing buffered:",iv+c,Zu+e),Promise.resolve();var g=c-f,h=g-e;if(.01>=h)return a.a.debug(d,"buffer behind okay:",iv+c,$u+g,Zu+e,"underflow\x3d"+Math.abs(h)),Promise.resolve();a.a.debug(d,"buffer behind too large:",iv+c,$u+g,Zu+e,"overflow\x3d"+h);return a.C.X.remove(b.type,
|
|
133
|
+
f,f+h).then(function(){a.h||a.a.debug(d,"evicted "+h+" seconds")})};oz=function(a,b,c){if(!a.B){b=Xy(b);var d=Array.from(a.f.values());1!=d.length||d[0].type!=_.Be?a.B=d.every(function(e){return e.type==_.Be||a.D?!0:!e.Fb&&!e.Xb&&e.oa}):a.D&&(a.B=!0);a.B&&(a.a.debug(b,"startup complete"),c=Uy(a,c),vz(a,c))}};
|
|
134
|
+
vz=function(a,b){var c=null;a.m[b]||(c=dz(a,b).then(function(){a.h||(a.a.debug(av),a.C.Ie())})["catch"](Av));for(var d=0;d<a.g.periods.length;++d)dz(a,d)["catch"](Av);a.C.rj&&(a.a.debug("calling onStartupComplete()..."),a.C.rj());return c};
|
|
135
|
+
yz=function(a,b){var c=Xy(b),d=Uy(a,b.stream);if(b.zb!=d){var e=b.zb,f=Array.from(a.f.values());f.every(function(g){return g.zb==e})?f.every(sz)?(a.a.debug(c,"all need Period "+e),dz(a,e).then(function(){if(!a.h)if(f.every(function(n){var p=sz(n),q=Uy(a,n.stream);return p&&n.zb==e&&q!=e})){var g=a.g.periods[e];a.a.debug(c,"calling onChooseStreams()...");var h=a.C.Je(g);a.D=!h.variant&&!!h.text;var l=new Map;h.variant&&h.variant.video&&l.set(_.Qe,h.variant.video);h.variant&&h.variant.audio&&l.set(_.ic,
|
|
136
|
+
h.variant.audio);h.text&&l.set(_.Be,h.text);var m=_.u(a.f.keys());for(h=m.next();!h.done;h=m.next())if(h=h.value,!l.has(h)&&h!=_.Be){a.a.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.f.has(h))if(h==_.Be)cz(a,null,null,l.get(_.Be),g.startTime),l["delete"](h);else{a.a.error(c,"invalid Streams chosen: unusable "+h+" Stream");a.C.onError(new _.L(_.M,5,5005));return}g=_.u(Array.from(a.f.keys()));
|
|
137
|
+
for(h=g.next();!h.done;h=g.next())h=h.value,(m=l.get(h))?(_.Sy(a,m,!1,0),Ny(a,a.f.get(h),0)):a.f["delete"](h);a.a.debug(c,av);a.C.Ie()}else a.a.debug(c,"ignoring transition to Period",e,"since another is happening")})["catch"](Av)):a.a.debug(c,"all MediaStates need Period "+e+", but not all MediaStates are idle"):a.a.debug(c,"not all MediaStates need Period "+e)}};Ly=function(a,b){var c=Sv(a.g.periods,b+_.qq);return c?a.g.periods.indexOf(c):0};
|
|
138
|
+
Uy=function(a,b){for(var c=a.g.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};
|
|
139
|
+
mz=function(a,b,c,d,e){d=void 0===d?!1:d;e=void 0===e?null:e;var f=_.Wv(c.Ha(),c.Qa,c.Ea,a.j.attemptParameters,c.startTime,c.endTime,b.type,c.timescale);f.type=2;f.onFragment=c.Zb?null:e;f.disableFragmentSupport=c.Zb||a.j.disableFragmentSupport;f.disableMergedFragments=a.j.disableMergedFragments;if(e=c.f())f.keyInfo=e,f.onFragment=null;d&&(f.responseModifiers.push(function(g){xz(a,b,g.data)}),b.type===_.Qe&&a.j.overridePasp&&f.responseModifiers.push(a.Tj.bind(a)));a.a.debug("fetching: reference\x3d",
|
|
140
|
+
c);c=a.C.Ab.fetch(f);b.Cb=c;return c.P.then(function(g){var h=a.C.re(),l=g.timeMs,m=g.data.byteLength;l&&m&&!d&&h.segmentDownloaded(l,m);b.Cb=null;return g.data})};
|
|
141
|
+
Zy=function(a,b,c,d){var e,f,g,h;return _.B(function(l){if(1==l.a)return e=Xy(b),b.Fb=!1,b.Td=!1,b.vd=0,b.Xb=!0,b.stream.segmentIterator=null,a.a.debug(e,"clearing buffer"),d?(g=a.C.wb(),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.h&&c?a.C.X.flush(b.type):null}),_.x(l,f,2);if(a.h)return l["return"]();a.a.debug(e,"cleared buffer");b.Ob=null;b.oa=null;b.Xb=!1;b.endOfStream=!1;b.yd=!1;Ny(a,b,0);_.z(l)})};
|
|
142
|
+
Ny=function(a,b,c){a.a.debug(Xy(b),"updating in "+c+" seconds");b.qb=(new _.Ki(function(){var d;return _.B(function(e){if(1==e.a)return _.yf(e,2),_.x(e,a.Bb(b),4);if(2!=e.a)return _.zf(e,0);d=_.Af(e);if(a.C)a.C.onError(d);_.z(e)})})).Z(c)};Py=function(a){null!=a.qb&&(a.qb.stop(),a.qb=null)};Qy=function(a){return _.B(function(b){return a.Cb?_.x(b,a.Cb.abort(),0):b.H(0)})};
|
|
143
|
+
zz=function(a){var b,c,d,e;return _.B(function(f){b=[];c=_.u(a.f.values());for(d=c.next();!d.done;d=c.next())e=d.value,Py(e),e.Ya&&e.Cb&&(e.Ya=!1,b.push(e.Cb.abort())),e.Fb&&b.push(Zy(a,e,!0,0));return _.x(f,Promise.all(b),0)})};Az=function(a,b,c){(a=a.f.get(b))&&c&&(Py(a),a.stream=c,a.Ob=c,a.oa&&(a.oa=c.getSegmentReference(a.oa.position)),a.oa||(a.Ob=null))};
|
|
144
|
+
rz=function(a,b){var c;return _.B(function(d){switch(d.a){case 1:if(a.h)return d["return"]();if(!a.C.ug){d.H(2);break}_.yf(d,3);return _.x(d,a.C.ug(b),5);case 5:_.zf(d,2);break;case 3:c=_.Af(d),c.cause=b,b=c;case 2:if(!b.f)a.C.onError(b);_.z(d)}})};Xy=function(a){return"("+a.type+":"+a.stream.id+")"};sz=function(a){return!a.Ya&&null==a.qb&&!a.Fb&&!a.Xb};
|
|
145
|
+
Dz=function(a){_.Uj.call(this,cv);var b=this;this.D=Bz;this.h=this.Pb=this.V=null;this.Ce=0;this.Xf=2;this.Yc=null;this.Ae=!1;this.m=new _.dg;this.Ma=this.Dd=this.xc=this.pc=this.w=this.J=this.j=null;this.Tc=!1;this.g=this.f=this.A=this.a=this.uc=this.F=null;this.rg=1E9;this.Jd=new Set;this.T=!0;this.ba=null;this.mg=!1;this.kg=0;this.$=null;this.N=new Nx;this.ng={width:Infinity,height:Infinity};this.I=null;this.aa=_.Pm;this.vc=new Ux(this.configuration.preferredAudioLanguage||[],this.configuration.preferredAudioRole,
|
|
146
|
+
this.configuration.preferredAudioChannelCount);this.fa=this.configuration.preferredTextLanguage;this.R=this.wc=null;this.yc=new Map;this.da=null;this.tc=this.configuration.preferredTextRole;a&&a(this);this.Be=null;this.m.on(window,"online",function(){b.D===Cz&&tz(b.a)})};
|
|
147
|
+
Ez=function(a){return new _.Nv(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,_.lf(e.value.renditions))}return d.find(function(f){return f.id==b})||null})};
|
|
148
|
+
Fz=function(a,b){if(a.aa!==b)if(a.aa===_.$m&&b!==_.Pm)a.log.info(_.Vu+Dv(b,_.Ym));else{var c=a.Ce;c=0===c?0:Date.now()-c;var d=a.aa;a.aa=b;a.Ce=Date.now();a.I&&_.Fm(a.I.a,a.aa);b===_.Um&&(a.Xf=a.ze?1:2);var e=a.Xf,f={currentState:a.aa,previousState:d,timeSinceLastStateChangeMS:c,reason:b===_.Um||d===_.Um?e:void 0};a.log.info(_.fb+Dv(d,_.Ym)+" -\x3e "+(Dv(b,_.Ym)+(b!==_.Um?"":"["+Dv(e,_.Xm)+"]")));a.trigger(new _.J(_.re,{detail:f}));(b===_.Wm||b===_.$m)&&a.Ma&&a.Ma.stop();b===_.Um?a.trigger(new _.J(_.tc,
|
|
149
|
+
{detail:{bufferedTimeMS:-1,reason:e}})):d===_.Um&&a.trigger(new _.J(_.sc,{detail:{bufferedTimeMS:c,reason:e}}))}};Lz=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.D===Gz?e["return"](Promise.reject(new _.L(_.M,7,7E3))):_.x(e,Hz(a),2);case 2:return _.x(e,Iz(a),3);case 3:c=_.Uh(4)||_.Uh(5);if(!b&&!c){e.H(0);break}d=a.getSurface().getMedia();return _.x(e,Jz(a,d),5);case 5:return _.x(e,Kz(a,d),0)}})};
|
|
150
|
+
Jz=function(a,b){a.h||(a.m.on(b,_.gd,function(){if(a.h.error){var c=a.h.error.code;if(1==c)c=null;else{var d=a.h.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.h.error.message})}}else c=null;if(c)a.onError(c)}),a.h=b);return Promise.resolve()};Iz=function(a){a.h&&(a.m.off(a.h,_.gd),a.h=null);return Promise.resolve()};
|
|
151
|
+
Hz=function(a){var b;return _.B(function(c){switch(c.a){case 1:a.D!==Gz&&(a.D=Bz);if(b=a.h)a.m.off(b,_.ud),a.m.off(b,_.Yd),a.m.off(b,_.Td),a.m.off(b,_.fd),a.m.off(b,_.ce),a.m.off(b,_.ae);a.pc&&(a.pc.release(),a.pc=null);a.Ma&&(a.Ma.stop(),a.Ma=null);if(!a.A){c.H(2);break}return _.x(c,a.A.stop(),3);case 3:a.A=null;case 2:if(!a.g){c.H(4);break}return _.x(c,a.g.stop(),4);case 4:if(!a.a){c.H(6);break}return _.x(c,a.a.destroy(),7);case 7:a.a=null;case 6:a.w&&(a.w.release(),a.w=null);if(!a.J){c.H(8);break}return _.x(c,
|
|
152
|
+
a.J.destroy(),9);case 9:a.J=null;case 8:a.Dd&&(a.Dd.release(),a.Dd=null);b&&b.src&&(b.removeAttribute("src"),b.load());if(!a.j){c.H(10);break}return _.x(c,a.j.destroy(),11);case 11:a.j=null;case 10:a.N.clear(),a.F=null,a.Jd.clear(),a.f=null,a.I=null,a.T=!0,a.yc.clear(),a.Tc=!1,Mz(a),_.z(c)}})};
|
|
153
|
+
Kz=function(a,b){var c,d,e;return _.B(function(f){if(1==f.a)return c=window.muxjs?new Bw:new _.Cw,d=_.ym(a.configuration,["html","single-native"]),a.K=d.create(a),a.Yc=Ez(a),a.Yc.track(a),e=new _.Iw(b,c,a.K,a.Yc,a.configuration),_.x(f,e.I,2);a.J=e;_.z(f)})};Nz=function(a,b){var c,d;return _.B(function(e){if(1==e.a)return c=a.getNetworkEngine(),d=a,_.x(e,_.vp(b.url,c,a.configuration.manifest.attemptParameters,b.type||null),2);d.A=e.f;a.A.configure(a.configuration.manifest);_.z(e)})};
|
|
154
|
+
Rz=function(a,b){var c;return _.B(function(d){a.uc=new hw;iw(a.uc,function(e){Oz(a,_.og,e)});c=new _.Oh(Promise.resolve().then(function(){var e,f,g;return _.B(function(h){switch(h.a){case 1:if(a.f){h.H(3);break}_.yf(h,4);e=a;return _.x(h,a.A.start(b.url,Pz(a)),6);case 6:e.f=h.f;_.zf(h,1);break;case 4:f=_.Af(h);if(!a.Sa)throw f;return _.x(h,a.Sa(b.url,f),8);case 8:if(g=h.f)b.url=g;else throw f;h.H(1);break;case 3:!a.f.presentationTimeline||a.configuration.manifest.hlsLowLatency||_.K.S(a.configuration.suggestedPresentationDelay)||
|
|
155
|
+
isNaN(a.configuration.suggestedPresentationDelay)||(a.log.info("Apply suggested presentation delay of: "+a.configuration.suggestedPresentationDelay),a.f.presentationTimeline.Re=a.configuration.suggestedPresentationDelay);a.f.presentationTimeline&&(a.f.presentationTimeline.D=!!a.configuration.lowLatencyMode);if(0==a.f.periods.length)throw new _.L(_.M,4,4014);Qz(a.f.periods);_.z(h)}})}),function(){a.log.info("Aborting parser step...");return a.A.stop()});return _.x(d,c.P,0)})};
|
|
156
|
+
Yz=function(a){var b,c,d,e,f;return _.B(function(g){switch(g.a){case 1:a.j=new _.Ll({Ab:a.getNetworkEngine(),onError:function(h){return a.onError(h)},Le:function(h){if(a.a){var l=Sz(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.");
|
|
157
|
+
if(n.length){n=a.getPeriods();for(var q=0;q<n.length;q++)for(var r=n[q],w=_.u(r.variants),y=w.next();!y.done;y=w.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&&!Tz.includes(D);y.allowedByKeySystem=D}F!==y.allowedByKeySystem&&(D=E.type,E.type===_.Qe&&(D="video "+E.width+"x"+E.height+"@"+_.Ah(E.bandwidth)),a.log.warn("DRM Key not available for KID: '"+
|
|
158
|
+
(E.keyId+"'. Applying restrictions to "+D)));r===l&&F!==y.allowedByKeySystem&&(m=!0)}}}if(h=Gy(a.a))if(p=Iy(a.a),n=Jy(a.a),p=ox(p,n,h.variants),!p||p.allowedByKeySystem)a.log.info(Qu),Uz(a),Vz(a,h.variants);m&&h!==l&&(a.log.info(Qu),Uz(a),Vz(a,l.variants))}},onExpirationUpdated:function(h,l){if(a.A&&a.A.onExpirationUpdated)a.A.onExpirationUpdated(h,l);a.trigger(new _.J(_.Xc,{expirationTime:l}))},onEvent:function(h){return a.le(h)},getConfiguration:function(){return a.getConfiguration()},Gc:function(){return a.Gc()}});
|
|
159
|
+
Wz(a);c=(b=a.configuration.drm)?b.offlineId||"":"";d=[];e=_.op(a.f.periods);if(!c){g.H(2);break}f=_.Wj(_.Ud);if(!f){g.H(2);break}return _.x(g,f.wj(b,e,a.getNetworkEngine()),4);case 4:return _.x(g,f.ji(c),5);case 5:d=g.f;case 2:return _.x(g,_.Ql(a.j,e,d),6);case 6:a.f&&Xz(a,a.f.periods),_.z(g)}})};
|
|
160
|
+
iA=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.h,c=function(r){a.h&&a.F&&(r.type===_.ke&&a.Ld?(a.F.a=Zx,Mz(a)):r.type===_.Ye&&a.getState()===_.cn&&.1>a.getBufferInfo().Da(a.getPosition())?(a.F.a=Zx,Mz(a)):a.F&&Zz(a));$z(a)},d=function(){if(a.h){var r=a.h.playbackRate;0!=r&&a.xc.set(r)}},a.m.on(b,_.Yd,c),a.m.on(b,_.Td,c),a.m.on(b,_.fd,c),a.m.on(b,_.ke,c),a.m.on(b,_.je,c),a.m.on(b,_.ae,c),a.m.on(b,_.Ye,c),a.m.on(b,_.ce,d),a.g||(a.g=new _.Lx,a.g.configure(a.configuration.abr)),
|
|
161
|
+
aA(a,a.f.periods),a.vc=new Ux(a.configuration.preferredAudioLanguage||[],a.configuration.preferredAudioRole,a.configuration.preferredAudioChannelCount),a.fa=a.configuration.preferredTextLanguage,a.tc=a.configuration.preferredTextRole,_.x(q,_.cm(a.j,b),2);if(3!=q.a){if(!a.j)throw new _.L(_.M,7,7001);a.g.init(function(r,w,y){!a.T&&bA(a,r,w,y)});a.w=cA(a,a.configuration.startTime);a.pc=dA(a);a.xc=new ey({te:function(){return b.playbackRate},sg:function(r){b.playbackRate=r},Ei:function(r){b.currentTime+=
|
|
162
|
+
r}});a.isLive()&&a.configuration.streaming.enableLiveEdgeChasing&&(a.Dd=new by(a));e=Math.max(1E-4,a.configuration.streaming.rebufferingGoal);eA(a,e);dx(a.f,_.bi(a.configuration.preferredVideoCodec),_.bi(a.configuration.preferredAudioCodec),a.configuration.preferredAudioChannelCount);a.a=fA(a);a.a.j=a.configuration.streaming;a.D=Cz;return _.x(q,a.a.start(),3)}if(!a.a)throw new _.L(_.M,7,7001);a.configuration.streaming.startAtSegmentBoundary&&(f=zy(a.w),g=gA(a,f),sy(a.w.g,g));h=_.u(a.f.periods);for(l=
|
|
163
|
+
h.next();!l.done;l=h.next())m=l.value,hA(a,m);Uz(a);n=Sz(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");Vz(a,n.variants);a.m.one(b,_.ud,function(){a.I.w=Date.now()/1E3-(null===a.Be?0:a.Be)});_.z(q)})};
|
|
164
|
+
Qz=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)})){_.Rf("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)}};cA=function(a,b){return new xy(a.h,a.f,a.configuration.streaming,b,function(){a.pc&&qw(a.pc,!0);a.a&&az(a.a)},function(c){return a.dispatchEvent(c)})};
|
|
165
|
+
dA=function(a){var b=new cy(a.f);dy(b,function(){Uz(a)});var c=new sw(a.uc);tw(c,function(e){e.Od&&e.Od();Oz(a,_.qg,e)},function(e){e.Ke&&e.Ke();Oz(a,_.rg,e)},function(e,f){f||(e.Od&&e.Od(),Oz(a,_.qg,e),e.Ke&&e.Ke(),Oz(a,_.rg,e))});var d=new rw(a.h);d.a.add(b);d.a.add(c);return d};eA=function(a,b){a.F=new $x(b,Math.min(.5,b/2));a.F.a=Zx;Mz(a);a.Ma=(new _.Ni(function(){Zz(a)})).bb(.25)};
|
|
166
|
+
Zz=function(a){switch(a.D){case Cz:a:if(a.h.ended||Nw(a.J))var b=!0;else{if(a.isLive()){b=dw(a.f.presentationTimeline);var c=a.getBufferInfo();if(null!==c&&(c=c.xa(),null!==c&&c>=b)){b=!0;break a}}b=!1}break;default:b=!1}c=0;if(a.J){var d=Pw(a.J),e=d.video;d=d.audio;var f=a.h.currentTime;if(e||d)c=e&&d?Math.min(e.Da(f),d.Da(f)):e?e.Da(f):d.Da(f)}if(e=a.F){e=a.F;d=c;f=b;var g=e.f.get(e.a);c=e.a;d=f||d>=g?Yx:Zx;e.a=d;e=c!=d}c=e;e=jA(a);c||a.getState()===_.Um&&!e?(a.log.debug("Buffering state changed. Is buffering",
|
|
167
|
+
e,"buffered to end",b,"state",a.getState()),Mz(a)):a.Tc&&$z(a)};fA=function(a){var b={wb:function(){return zy(a.w)},X:a.J,Ab:a.getNetworkEngine(),Je:a.xh.bind(a),Ie:a.wh.bind(a),onError:a.onError.bind(a),ag:a.$i.bind(a),onEvent:a.le.bind(a),fg:a.yh.bind(a),Pd:a.mj.bind(a),re:function(){return a.g},fe:a.Jg.bind(a),ug:a.Oj.bind(a),bd:a.j};return new _.Fy(a.f,b)};Wz=function(a){var b=_.pk(a.configuration.drm);a.j.h=b};
|
|
168
|
+
lA=function(a){a.A&&a.A.configure(a.configuration.manifest);a.j&&Wz(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())hA(a,c.value)}catch(e){a.onError(e)}c=Iy(a.a);var d=Jy(a.a);b=Sz(a)||a.f.periods[0];c=ox(c,d,b.variants);a.g&&c&&c.allowedByApplication&&c.allowedByKeySystem?Vz(a,b.variants):(a.log.debug("Choosing new streams after changing configuration"),kA(a,b))}a.g&&(a.g.configure(a.configuration.abr),a.configuration.abr.enabled&&!a.T?a.g.enable():
|
|
169
|
+
a.g.disable())};Dx=function(a){if(a.f&&a.w){var b=mA(a),c=[];a=_.u(nA(a));for(var d=a.next();!d.done;d=a.next()){d=d.value;var e=jx(d);e.active=d==b;c.push(e)}return c}return[]};Bx=function(a,b){if(a.f&&a.a){var c=Sz(a),d=c.textStreams.find(function(e){return e.id==b.id});d?(oA(a,c,d,!1),pA(a,d),a.fa=d.language):a.log.error(_.Uu,b.id)}};
|
|
170
|
+
Ex=function(a,b,c){var d=void 0===d?0:d;if(a.f&&a.a){var e=Sz(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.R=null;c=Vz(a,e.variants);null!=a.da&&(a.vc=a.da,a.da=null);null==c||a.T||bA(a,c);return}if(b){a.R=b.id;var f=e.variants.find(function(g){return g.id==
|
|
171
|
+
b.id});f?(a.R=f.video.id,lx(f)?(qA(a,e,f,!1),rA(a,f,c,d),null==a.da&&(a.da=a.vc),a.vc=new Vx(f),Vz(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.R=null,null!=a.da&&(a.vc=a.da,a.da=null),c=Vz(a,e.variants),null==c||a.T||bA(a,c)}};
|
|
172
|
+
Cx=function(a,b){if(a.a&&(a.f||a.w)){var c=Jy(a.a),d=Iy(a.a),e=Sv(a.f.periods,zy(a.w)),f=a.f.periods[e?a.f.periods.indexOf(e):0].variants.filter(function(m){return m.audio.id==b&&lx(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().Ia();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]===
|
|
173
|
+
e.audio.codecs.split(".")[0]){d=e.audio;a.wc=d.id;a.g.setVariants(f);f=Sz(a);qA(a,f,e,!1);g||a.T?rA(a,e,!0,0):_.Sy(a.a,d,!0,0);Promise.resolve();return}a.log.warn("Target audio codecs not compatible with active audio codecs.")}}Promise.reject()};Fx=function(a){var b=a.Ae;return a.f?a.J.getTextDisplayer().isTextVisible():b};
|
|
174
|
+
Ax=function(a,b){var c,d,e,f;return _.B(function(g){c=a.Ae;d=b;if(c==d)return g["return"]();a.Ae=d;if(a.D!==Cz)return g.H(0);a.J.getTextDisplayer().setTextVisibility(b);if(a.configuration.streaming.alwaysStreamText)return g.H(0);if(!b)return Ry(a.a),g.H(0);e=Sz(a);f=_.nx(e.textStreams,a.fa,a.tc);return 0<f.length?_.x(g,Oy(a.a,f[0]),0):g.H(0)})};
|
|
175
|
+
qA=function(a,b,c,d){var e=a.getTrackManager();a.A.setCurrentVariant(c);if(e){var f=a.I.A;if(c.video){Ix(e,c.video,d);var g=e.ga();f.h!==g&&(f.h=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&&(Ix(e,c.audio,d),e=e.Fa(),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})))}Px(a.N,
|
|
176
|
+
b).variant=c};oA=function(a,b,c,d){Px(a.N,b).text=c;if(b=a.getTrackManager())Ix(b,c,d),c=b.Ga(),a=a.I.A,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}))};
|
|
177
|
+
aA=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.rg++,originalId:l,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:function(){return null},getSegmentReference:function(){return null},initSegmentReference:null,Aa:0,mimeType:_.ac,codecs:"",kind:"caption",
|
|
178
|
+
encrypted:!1,keyId:null,language:g.closedCaptions.get(l),label:null,type:_.Be,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)}};
|
|
179
|
+
Xz=function(a,b){for(var c=a.a?Iy(a.a):null,d=a.a?Jy(a.a):null,e=_.u(b),f=e.next();!f.done;f=e.next())ix(a.j,c,d,f.value);c=Ev(b,function(g){return g.variants.some(lx)});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,fx(d.variants,a.configuration.restrictions,a.ng)&&a.a&&Sz(a)==d&&Uz(a),sA(a,d.variants)};
|
|
180
|
+
hA=function(a,b){var c=a.a?Iy(a.a):null,d=a.a?Jy(a.a):null;ix(a.j,c,d,b);d=b.variants;if(!d.some(lx))throw new _.L(_.M,4,4011);sA(a,b.variants);fx(d,a.configuration.restrictions,a.ng)&&a.a&&Sz(a)==b&&Uz(a);if(!_.Uh(2)&&(c=a.j?a.j.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,_.fm(a.j,g.keyId,g.initData)||_.Xl(a.j,
|
|
181
|
+
g.initDataType,g.initData,g.keyId)}}}};rA=function(a,b,c,d){c=void 0===c?!1:c;d=void 0===d?0:d;a.T?(a.ba=b,a.mg=c,a.kg=d):Ty(a.a,b,c,d)};pA=function(a,b){a.T?a.$=b:_.Sy(a.a,b,!0,0)};tA=function(a){if(a.a&&a.f){var b=Gy(a.a),c=Sz(a);null!=b&&b==c&&(Iy(a.a),Jy(a.a),_.Hy(a.a,_.Be),Px(a.N,c),Px(a.N,c))}};
|
|
182
|
+
gA=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=Iy(a.a),e=Jy(a.a),f=Sz(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};jA=function(a){return a.j&&a.j.D?!0:a.F?a.F.getState()===Zx:!1};Mz=function(a){if(a.I&&a.F&&a.w){var b=uA(a)===_.Um,c=a.xc;c.h=b;fy(c);a.w.j.m=b;$z(a)}};$z=function(a){Fz(a,uA(a))};
|
|
183
|
+
uA=function(a){var b=a.getDuration(),c=a.getPosition();return a.h&&a.h.ended||(a.Tc||a.aa===_.Wm)&&1>=Math.abs(b-c)?_.Wm:jA(a)||a.Ld?_.Um:a.h&&a.h.paused?_.bn:_.cn};
|
|
184
|
+
Vz=function(a,b){try{sA(a,b)}catch(e){return a.onError(e),null}var c=b.filter(function(e){return lx(e)});c=sx(c,a.wc);var d=a.vc.create(c);d=Array.from(d.values());a.g.setVariants(d);if(null!==a.R&&null!==a.wc&&(d=d.find(function(e){return e.video.id==a.R&&e.audio.id==a.wc}),a.R=null,d))return d;if(a.configuration.abr.enabled||null===a.R)return a.g.chooseVariant();c=c.find(function(e){return null!==e.video&&e.video.id===a.R});return c?c:(a.log.warn("Selected video track not found. Falling back to ABR selection"),
|
|
185
|
+
a.g.chooseVariant())};kA=function(a,b,c){c=void 0===c?!0:c;var d=Vz(a,b.variants);a.wc=d&&d.audio&&d.audio.id;d&&(qA(a,b,d,!0),rA(a,d,c));(c=_.nx(b.textStreams,a.fa,a.tc)[0]||null)&&(a.configuration.streaming.alwaysStreamText||Fx(a))&&(oA(a,b,c,!0),pA(a,c))};
|
|
186
|
+
xA=function(a,b){a.T=!0;a.g.disable();a.log.debug("Choosing new streams after period changed");var c=Vz(a,b.variants),d=_.nx(b.textStreams,a.fa,a.tc)[0]||null;a.ba&&(b.variants.includes(a.ba)&&(c=a.ba),a.ba=null);a.$&&(b.textStreams.includes(a.$)&&(d=a.$),a.$=null);c&&vA(a,b,function(){return qA(a,b,c,!0)});d&&(a.configuration.streaming.alwaysStreamText||Fx(a))&&vA(a,b,function(){return oA(a,b,d,!0)});b===Sz(a)&&wA(a);return a.configuration.streaming.alwaysStreamText||Fx(a)?{variant:c,text:d}:{variant:c,
|
|
187
|
+
text:null}};bA=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=yA(a,b);vA(a,e,function(){return qA(a,e,b,!0)});e===Sz(a)&&wA(a);a.a&&Ty(a.a,b,c,d)}};Uz=function(a){var b=a.getTrackManager();b&&a.D!==Gz&&(b.l&&(Hx(b),b.l.trigger(new _.J(_.uq))),wA(a))};wA=function(a){var b=Sz(a);if(b){var c=a.yc.get(b)||[];for(a.yc["delete"](b);c.length;)c.shift()()}};vA=function(a,b,c){a.yc.has(b)||a.yc.set(b,[]);a.yc.get(b).push(c)};
|
|
188
|
+
Oz=function(a,b,c){a.trigger(new _.J(b,{detail:{schemeIdUri:c.schemeIdUri,value:c.value,startTime:c.startTime,endTime:c.endTime,id:c.id,eventElement:c.eventElement,type:c.type}}))};
|
|
189
|
+
sA=function(a,b){var c=a.j?_.K.kf(a.j.da):{},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?Tz.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,
|
|
190
|
+
missingKeys:g,restrictedKeyStatuses:h});};nA=function(a){var b=Sz(a);if(null==b)return[];tA(a);return b.variants.filter(function(c){return lx(c)})};zA=function(a){var b=Sz(a);if(null==b)return[];tA(a);return b.textStreams.filter(function(c){return!a.Jd.has(c)})};Sz=function(a){var b=zy(a.w),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};mA=function(a){var b=Sz(a);return b&&Px(a.N,b).variant};
|
|
191
|
+
yA=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};
|
|
192
|
+
AA=function(a,b,c){var d,e,f,g,h,l,m,n,p,q,r,w,y,A,E,F,D,I,O;return _.B(function(T){switch(T.a){case 1:return d=_.on,_.yf(T,2),_.x(T,_.vp(b.url,a.getNetworkEngine(),a.configuration.manifest.attemptParameters,b.type||null),4);case 4:return e=T.f,e.configure(a.configuration.manifest),_.x(T,e.start(b.url,Pz(a)),5);case 5:f=T.f;Qz(f.periods);if(!f.periods.length)throw new _.L(_.M,4,4014);return _.x(T,a.A.stop(),6);case 6:a.A=e;g=c.audio&&c.audio.id;h=c.video&&c.video.id;a.f.periods=f.periods;l=Sv(f.periods,
|
|
193
|
+
zy(a.w))||f.periods[0];dx(a.f,_.bi(a.configuration.preferredVideoCodec),_.bi(a.configuration.preferredAudioCodec),a.configuration.preferredAudioChannelCount);m=tx(g,h,l.variants);n=_.nx(l.textStreams,a.fa,a.tc)[0]||null;Vz(a,l.variants);p=m&&m.video;q=m&&m.audio;r=[];w=new Set;y=_.u(l.variants);for(A=y.next();!A.done;A=y.next())E=A.value,E.video&&w.add(E.video),E.audio&&w.add(E.audio);F=_.u(_.lf(w).concat(_.lf(l.textStreams)));for(D=F.next();!D.done;D=F.next())I=D.value,r.push(I.createSegmentIndex());
|
|
194
|
+
return _.x(T,Promise.all(r),7);case 7:Az(a.a,d.AUDIO,q);Az(a.a,d.VIDEO,p);Az(a.a,d.TEXT,n);m&&qA(a,l,m,!1);a.log.info("Switch CDN successful.");_.zf(T,0);break;case 2:O=_.Af(T);if(!e){T.H(8);break}return _.x(T,e.stop(),8);case 8:throw O;}})};
|
|
195
|
+
Pz=function(a){return{networkingEngine:a.getNetworkEngine(),filterNewPeriod:function(b){return hA(a,b)},filterAllPeriods:function(b){return Xz(a,b)},onTimelineCueAdded:function(b){var c=a.uc;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.le(b)},onError:function(b){return a.onError(b)}}};BA=function(){};
|
|
196
|
+
CA=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}};DA=function(){var a=SourceBuffer.prototype.remove;SourceBuffer.prototype.remove=function(b,c){return a.call(this,b,c-.001)}};EA=function(){var a=MediaSource.isTypeSupported;MediaSource.isTypeSupported=function(b){return"mp2t"==b.split(/ *; */)[0].split("/")[1].toLowerCase()?!1:a(b)}};
|
|
197
|
+
FA=function(){var a=MediaSource.isTypeSupported;MediaSource.isTypeSupported=function(b){return"opus"!=_.Jv(b)[0]&&a(b)}};
|
|
198
|
+
GA=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)}};
|
|
199
|
+
HA=function(a){_.cq.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=_.Vc;c.label===Wu&&(this.a=c)}this.a||(this.a=a.addTextTrack(_.mv,Wu));this.a.mode=_.kd};IA=function(a,b){var c=a.mode;a.mode=c==_.le?_.le:_.kd;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};JA=function(){};qv=[112,115,115,104,0,0,0,0];
|
|
200
|
+
_.LA=function KA(a){var c,d,e,f,g,h;return _.Gf(KA,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.H(0):_.x(l,{Kd:c,yj:d,item:e,next:void 0},0);h=g.value;return 0<=c?_.x(l,{Kd:c,item:e,yj:d,next:h},5):l.H(5)}c++;d=e;e=h;g=f.next();return l.H(2)})};_.Nv.prototype.track=function(a){null!=this.a&&(this.a&&(this.a.off(_.he,this.g),this.h&&this.a.off(_.Ee,this.g)),this.a=null);a&&(this.a=a,this.a.on(_.he,this.g,this))};
|
|
201
|
+
_.Nv.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.f.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.f);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=
|
|
202
|
+
b);this.f.push(c);this.f.sort(Mv)}Qv(this);this.g();this.a&&this.a.trigger(new _.J(_.Te))};_.Nv.prototype.clear=function(){this.f=[];Qv(this);this.a&&(this.a.trigger(new _.J(_.Te)),this.a.trigger(new _.J(_.oc)))};
|
|
203
|
+
_.Nv.prototype.g=function(){if(this.a){var a=this.a.getPosition();if(0<=a){a:{for(var b=this.f.length,c=Number.MAX_SAFE_INTEGER,d=0;d<b;d++){var e=this.f[d];c=Math.min(e.start,c);if(e.start<=a&&e.end>a){a=.1>e.end-a&&d<b-1?this.f[d+1].rendition:e.rendition;break a}if(e.start>a)break}a=0<b&&c>a&&.25>c-a?this.f[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 _.J(_.qc,
|
|
204
|
+
{detail:{width:b,height:c,bandwidth:a?a.bandwidth:null,rendition:a}}))}}}};_.Xv.prototype.f=function(){return this.keyInfo};_.Yv.prototype.getPosition=function(){return this.position};_.Yv.prototype.f=function(){return this.keyInfo};_.t=_.Zv.prototype;_.t.getDuration=function(){return this.g};_.t.Tb=function(a){this.g=a};_.t.getPresentationStartTime=function(){return this.o};_.t.offset=function(a){null!=this.h&&(this.h+=a);null!=this.f&&(this.f+=a)};
|
|
205
|
+
_.t.isLive=function(){return Infinity==this.g&&!this.j};hw.prototype.release=function(){this.f=function(){};this.a.clear()};hw.prototype.cues=function(){return this.a};jw.prototype.next=function(){var a=this.g.get(this.a);a&&0<a.a.length?(this.f+=1,a.Ha().length&&this.f===a.a.length&&(this.a+=1,this.f=0)):(this.a+=1,this.f=0);a=kw(this);return{value:a,done:!a}};_.t=_.lw.prototype;_.t.destroy=function(){this.a=[];return Promise.resolve()};
|
|
206
|
+
_.t.Bc=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.f.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.f.debug("SegmentIndex Ref "+a+" start: "+b.startTime+" end: "+b.endTime+" pos: "+b.position);return null};
|
|
206
207
|
_.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.f.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.Aa-=a};
|
|
207
|
-
_.t.
|
|
208
|
-
_.t.
|
|
209
|
-
b[b.length-1].position+1;e<a.length;)f=a[e++],f=new _.
|
|
210
|
-
a};_.t.replace=function(a){this.a=a};
|
|
211
|
-
|
|
212
|
-
_.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.rb=function(){return this.a};_.t.xa=function(){return this.f};_.t.
|
|
213
|
-
|
|
214
|
-
_.t.destroy=function(){var a=this;this.
|
|
208
|
+
_.t.Qc=function(a,b){var c=a-this.a[0].position;if(0<=c&&c<this.a.length)for(this.f.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};
|
|
209
|
+
_.t.Wa=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.f.info("Refusing to rewrite original references on update!"):(.1<Math.abs(f.endTime-g.endTime)?(f=new _.Yv(f.position,g.startTime,g.endTime,g.Ha,g.Qa,g.Ea,g.Aa,g.keyInfo,g.Zb,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=
|
|
210
|
+
b[b.length-1].position+1;e<a.length;)f=a[e++],f=new _.Yv(d++,f.startTime,f.endTime,f.Ha,f.Qa,f.Ea,f.Aa,f.keyInfo,f.Zb,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 _.Yv(e-d--,f.startTime,f.endTime,f.Ha,f.Qa,f.Ea,f.Aa,f.keyInfo,f.Zb,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=
|
|
211
|
+
a};_.t.replace=function(a){this.a=a};rw.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()};sw.prototype.release=function(){this.j=null;this.h.clear();this.a=function(){};this.f=function(){};this.g=function(){}};
|
|
212
|
+
sw.prototype.m=function(a,b){for(var c={},d=_.u(this.j.cues()),e=d.next();!e.done;c={$d:c.$d,pd:c.pd},e=d.next()){e=e.value;c.$d=this.h.get(e)||null;c.pd=a<e.startTime?1:a>e.endTime?3:2;this.h.set(e,c.pd);var f=this.o.find(function(g){return function(h){return h.oc===g.$d&&h.nc===g.pd}}(c));f&&f.cc(e,b)}};_.t=ww.prototype;_.t.destroy=function(){this.g=this.o=null;this.m.clear();return Promise.resolve()};
|
|
213
|
+
_.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.rb=function(){return this.a};_.t.xa=function(){return this.f};_.t.ec=function(a){return null==this.a||null==this.f?!1:a>=this.a&&a<this.f};_.t.Da=function(a){return null==this.f||this.f<a?0:this.f-Math.max(a,this.a)};
|
|
214
|
+
Bw.prototype.init=function(a){var b=muxjs.mp4.probe;a=_.N(a);this.j=b.videoTrackIds(a);this.h=b.timescale(a);this.a.init()};Bw.prototype.g=function(a,b){var c=_.N(a);(c=this.a.parse(c,this.j,this.h))&&c.captions&&b(c.captions);this.a.clearParsedCaptions()};Bw.prototype.f=function(){this.a.resetCaptionStream()};_.Cw.prototype.init=function(){};_.Cw.prototype.g=function(){};_.Cw.prototype.f=function(){};Dw.prototype.destroy=function(){this.a&&(this.a.dispose(),this.a=null);return Promise.resolve()};Dw.prototype.w=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===_.Qe?this.m.push(b):a.type===_.ic&&this.j.push(b)};Dw.prototype.o=function(){var a={video:_.hk.apply(_.ak,_.lf(this.m)),captions:this.g,audio:_.hk.apply(_.ak,_.lf(this.j))};this.f.resolve(a);this.h=!1};_.t=_.Iw.prototype;
|
|
215
|
+
_.t.destroy=function(){var a=this;this.J=!0;var b=[],c;for(c in this.h){var d=this.h[c],e=d[0];this.h[c]=d.slice(0,1);e&&b.push(e.p["catch"](Av));for(e=1;e<d.length;++e)d[e].p["catch"](Av),d[e].p.reject()}this.g&&b.push(this.g.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.g=null;a.A=null;a.f={};a.w={};a.D={};a.F=null;a.K=
|
|
215
216
|
!1;for(var g in a.h);a.h={}})};
|
|
216
|
-
_.t.init=function(a,b){var c=this,d;return _.
|
|
217
|
-
q.next()){var w=r.value;w.startsWith("avc")?p.set(_.
|
|
218
|
-
_.t.Da=function(a,b){if(a===_.
|
|
219
|
-
_.t.flush=function(a){return a==_.
|
|
220
|
-
_.t.
|
|
221
|
-
_.t.
|
|
222
|
-
_.t.
|
|
223
|
-
_.t.
|
|
224
|
-
_.t.
|
|
225
|
-
_.t.
|
|
226
|
-
_.t.
|
|
227
|
-
_.t.
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
_.t.chooseVariant=function(){var a=
|
|
217
|
+
_.t.init=function(a,b){var c=this,d;return _.B(function(e){if(1==e.a)return d=_.on,_.x(e,c.I,2);a.forEach(function(f,g){var h=_.Ji(f.mimeType,f.codecs);if(g==d.TEXT)Mw(c,h);else{var l=new Map;l.set(g,h);if((!MediaSource.isTypeSupported(h)||!b||f.keyInfo)&&Fw(h,g)){c.w[g]=new Dw;h="aac"==h.toLowerCase().split(";")[0].split("/")[1]?h.replace(/aac/i,_.Ed):Ew(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=
|
|
218
|
+
q.next()){var w=r.value;w.startsWith("avc")?p.set(_.Qe,'video/mp4;codecs\x3d"'+w+'"'):w.startsWith("mp4a")&&p.set(_.ic,'audio/mp4;codecs\x3d"'+w+'"')}l=0<p.size?p:m}catch(y){l=m}}Lw(c,l)}});_.z(e)})};_.t.rb=function(a){return a===_.Be?this.g.rb():(a=Ow(this,a))?a.rb():null};_.t.xa=function(a){return a===_.Be?this.g.xa():(a=Ow(this,a))?a.xa():null};_.t.ec=function(a,b,c){return a===_.Be?this.g.ec(b):(a=Ow(this,a))?a.ec(b,!1,c):!1};
|
|
219
|
+
_.t.Da=function(a,b){if(a===_.Be)return this.g.Da(b);var c=Ow(this,a);return c?c.Da(b):0};_.t.remove=function(a,b,c){var d=this;return a===_.Be?this.g.remove(b,c):Rw(this,a,this.og.bind(this,a,b,c)).then(function(){if(a===_.Qe){var e=d.rb(a),f=d.xa(a);null!==e&&null!==f&&Rv(d.B,e,f)}else a===_.ic&&(e=d.B,e.a&&e.a.trigger(new _.J(_.oc)))})};_.t.clear=function(a){if(a==_.Be){if(!this.g)return Promise.resolve();this.F.f();return this.g.remove(0,Infinity)}return Rw(this,a,this.og.bind(this,a,0,this.m.duration))};
|
|
220
|
+
_.t.flush=function(a){return a==_.Be?Promise.resolve():Rw(this,a,this.If.bind(this,a))};_.t.endOfStream=function(a){var b=this;return Yw(this,function(){Nw(b)||(a?b.m.endOfStream(a):b.m.endOfStream())})};_.t.Tb=function(a){var b=this;Yw(this,function(){b.m.duration=a})};_.t.getDuration=function(){return this.m.duration};
|
|
221
|
+
_.t.me=function(a,b){this.a.debug("Appending data to "+a+Ku);try{this.f[a].appendBuffer(b)}catch(c){throw this.a.warn("Failed to append data for "+a,c),c;}this.a.debug("Done Appending data to "+a+Ku)};_.t.og=function(a,b,c){if(c<=b)this.Kc(a);else{this.a.debug("Removing data from "+a+" range:",b,c);try{this.f[a].remove(b,c)}catch(d){throw this.a.warn("Failed to remove data from "+a+" buffer. Range:",b,c,d),d;}this.a.debug("Done Removing data from "+a+" range:",b,c)}};
|
|
222
|
+
_.t.Dg=function(a){try{this.a.debug("Aborting operations for "+a+Ku);var b=this.f[a].appendWindowStart,c=this.f[a].appendWindowEnd;this.f[a].abort();this.f[a].appendWindowStart=b;this.f[a].appendWindowEnd=c}catch(d){throw this.a.warn("Failed to abort operations for "+a+Ku,d),d;}this.a.debug("Done Aborting operations for "+a+Ku);this.Kc(a)};
|
|
223
|
+
_.t.If=function(a){try{this.j.readyState>HTMLMediaElement.HAVE_NOTHING?(this.a.debug("Flushing buffer for "+a),this.j.currentTime-=.001):this.a.warn("Skip buffer flush for "+a+" with element state: "+this.j.readyState)}catch(b){throw this.a.warn("Failed to flush buffer for "+a,b),b;}this.a.debug("Done Flushing buffer for "+a);this.Kc(a)};
|
|
224
|
+
_.t.tg=function(a,b){0>b&&(b+=.001);try{this.a.debug("Setting timestamp offset for "+a,b),this.f[a].timestampOffset=b}catch(c){throw this.a.warn("Failed to set timestamp offset for "+a,b,c),c;}this.a.debug("Done Setting timestamp offset for "+a,b);this.Kc(a)};
|
|
225
|
+
_.t.Ij=function(a,b,c){try{this.a.debug("Setting append window for "+a,b,c),this.f[a].appendWindowStart=0,this.f[a].appendWindowEnd=c,this.f[a].appendWindowStart=b}catch(d){throw this.a.warn("Failed to set append window for "+a,b,c,d),d;}this.a.debug("Done Setting append window for "+a,b,c);this.Kc(a)};_.t.U=function(a){this.h[a][0].p.reject(new _.L(_.M,3,3014,{mediaError:this.j.error?this.j.error.code:0}))};
|
|
226
|
+
_.t.Kc=function(a){var b=this.h[a][0];b&&(b.p.resolve(),this.a.debug("Update-End received for "+a),Xw(this,a))};_.t.getTextDisplayer=function(){return this.A};var Kw=window.URL.createObjectURL;_.v(ux,_.R);_.t=ux.prototype;_.t.initialize=function(a){this.l=a};_.t.release=function(){this.h=[];this.a.clear();this.f.clear()};_.t.load=function(){};_.t.destroy=function(){this.release();this.l=null};_.t.getVideoTracks=function(){return vx(this,_.gi)};_.t.getAudioTracks=function(){return vx(this,_.Q)};_.t.ha=function(){return vx(this,_.P)};_.t.ga=function(){return this.a.get(_.gi)||null};_.t.Fa=function(){return this.a.get(_.Q)||null};_.t.Ga=function(){return this.a.get(_.P)||null};
|
|
227
|
+
_.t.Ua=function(){return this.f.get(_.gi)||null};_.t.fb=function(){return this.f.get(_.Q)||null};_.t.gb=function(){return this.f.get(_.P)||null};_.t.Ia=function(){return wx(this,_.gi)};_.t.ma=function(){return wx(this,_.Q)};_.t.na=function(){return wx(this,_.P)};_.t.ab=function(a){yx(this,_.gi,a)};_.t.sa=function(a){yx(this,_.Q,a)};_.t.Ba=function(a){yx(this,_.P,a)};_.t.$a=function(a,b){xx(this,_.gi,a,void 0===b?!1:b)};_.t.mb=function(a,b){xx(this,_.Q,a,void 0===b?!1:b)};
|
|
228
|
+
_.t.nb=function(a,b){xx(this,_.P,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.H(0)})};_.t.ja=function(){return!!this.l&&this.l.ja()};ux.prototype.isAbrEnabled=ux.prototype.ja;ux.prototype.addTextTrack=ux.prototype.addTextTrack;ux.prototype.setTextRendition=ux.prototype.nb;ux.prototype.setAudioRendition=ux.prototype.mb;ux.prototype.setVideoRendition=ux.prototype.$a;
|
|
229
|
+
ux.prototype.setTextTrack=ux.prototype.Ba;ux.prototype.setAudioTrack=ux.prototype.sa;ux.prototype.setVideoTrack=ux.prototype.ab;ux.prototype.getTextTrack=ux.prototype.na;ux.prototype.getAudioTrack=ux.prototype.ma;ux.prototype.getVideoTrack=ux.prototype.Ia;ux.prototype.getLoadingTextRendition=ux.prototype.gb;ux.prototype.getLoadingAudioRendition=ux.prototype.fb;ux.prototype.getLoadingVideoRendition=ux.prototype.Ua;ux.prototype.getTextRendition=ux.prototype.Ga;ux.prototype.getAudioRendition=ux.prototype.Fa;
|
|
230
|
+
ux.prototype.getVideoRendition=ux.prototype.ga;ux.prototype.getTextTracks=ux.prototype.ha;ux.prototype.getAudioTracks=ux.prototype.getAudioTracks;ux.prototype.getVideoTracks=ux.prototype.getVideoTracks;_.t=_.Lx.prototype;_.t.stop=function(){this.w=null;this.j=!1;this.o=[];this.m=1;this.h=null;this.B=!1};_.t.init=function(a){this.w=a};
|
|
231
|
+
_.t.chooseVariant=function(){var a=Mx(!this.B&&this.a.initialRestrictions?this.a.initialRestrictions:this.a.restrictions,this.o),b=Kx(this.g,this.a.defaultBandwidthEstimate);this.o.length&&!a.length&&(this.f.warn("No variants met the ABR restrictions. Choosing a variant by lowest bandwidth."),a=Mx(null,this.o),a=[a[0]]);var c=a[0]||null;a=_.u(_.LA(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;
|
|
231
232
|
e=f*(e.next||{bandwidth:Infinity}).bandwidth/this.a.bandwidthUpgradeTarget;this.f.debug("Bandwidth ranges:",(g/1E6).toFixed(3),(h/1E6).toFixed(3),(e/1E6).toFixed(3));b>=h&&b<=e&&(c=d)}this.h=Date.now();this.B=!0;return c};_.t.enable=function(){this.j=!0};_.t.disable=function(){this.j=!1};
|
|
232
|
-
_.t.segmentDownloaded=function(a,b){this.f.debug("Segment downloaded:","deltaTimeMs\x3d"+a,"numBytes\x3d"+b,"lastTimeChosenMs\x3d"+this.h,"enabled\x3d"+this.j);var c=this.g;if(!(16E3>b)){var d=8E3*b/a,e=a/1E3;c.a+=b;_.
|
|
233
|
-
break a}}else if(Date.now()-this.h<1E3*this.a.switchInterval){this.f.debug("Still within switch interval...");break a}c=this.chooseVariant();this.f.debug("Calling switch_(), bandwidth\x3d"+Math.round(
|
|
234
|
-
_.t.reset=function(){this.A=!1;this.g=new
|
|
235
|
-
|
|
236
|
-
_.
|
|
237
|
-
_.
|
|
238
|
-
|
|
239
|
-
_.t.
|
|
240
|
-
_.t.
|
|
241
|
-
_.t.
|
|
242
|
-
_.t.
|
|
243
|
-
_.t.
|
|
244
|
-
_.
|
|
245
|
-
|
|
246
|
-
_.
|
|
247
|
-
|
|
248
|
-
_.t.
|
|
249
|
-
_.t.
|
|
250
|
-
_.t.
|
|
251
|
-
_.t.
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
_.t.
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
_.
|
|
261
|
-
|
|
262
|
-
|
|
233
|
+
_.t.segmentDownloaded=function(a,b){this.f.debug("Segment downloaded:","deltaTimeMs\x3d"+a,"numBytes\x3d"+b,"lastTimeChosenMs\x3d"+this.h,"enabled\x3d"+this.j);var c=this.g;if(!(16E3>b)){var d=8E3*b/a,e=a/1E3;c.a+=b;_.Uv(c.f,e,d);_.Uv(c.g,e,d)}if(null!=this.h&&this.j)a:{this.f.debug("Suggesting Streams...");if(!this.A){if(!(128E3<=this.g.a)){this.f.debug("Still waiting for a good estimate...");break a}this.A=!0;if(this.a.useSwitchIntervalForInitialSwitch&&Date.now()-this.h<1E3*this.a.switchInterval){this.f.debug("Skipping initial estimation switch due to switch interval...");
|
|
234
|
+
break a}}else if(Date.now()-this.h<1E3*this.a.switchInterval){this.f.debug("Still within switch interval...");break a}c=this.chooseVariant();this.f.debug("Calling switch_(), bandwidth\x3d"+Math.round(Kx(this.g,this.a.defaultBandwidthEstimate)/1E3)+" kbps");this.w(c)}};_.t.playbackRateChanged=function(a){this.m=a};_.t.getBandwidthEstimate=function(){return Kx(this.g,this.a.defaultBandwidthEstimate)};_.t.setVariants=function(a){this.o=a};_.t.configure=function(a){this.a=a};
|
|
235
|
+
_.t.reset=function(){this.A=!1;this.g=new Jx;var a=this.chooseVariant();a&&this.w(a)};Nx.prototype.clear=function(){this.a.clear()};Qx.prototype.add=function(a){if(Tx(this.f,a))return this.a.add(a),!0;_.G("Rejecting variant - not compatible with root.");return!1};Qx.prototype.values=function(){return this.a.values()};Vx.prototype.create=function(a){var b=this,c=a.filter(function(d){return Tx(b.a,d)});return c.length?new Qx(c[0],c):this.f.create(a)};
|
|
236
|
+
Ux.prototype.create=function(a){var b=Wx(a,this.g);0<b.length&&(a=b);b=!1;if(this.a){var c=Xx(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=$w(a,this.f),b.length?a=b:_.G("No exact match for the channel count could be found."));b=new Qx(a[0]);a=_.u(a);for(c=a.next();!c.done;c=a.next())c=c.value,Tx(b.f,c)&&b.add(c);return b};$x.prototype.getState=function(){return this.a};var Zx=0,Yx=1;by.prototype.release=function(){this.g.release()};cy.prototype.release=function(){this.a=this.g=null;this.f=function(){}};cy.prototype.m=function(a){var b=this.a,c=this.g.periods;a=Sv(c,a)||c[0];b!=a&&this.f(a);this.a=a};ey.prototype.release=function(){this.f&&(this.f.stop(),this.f=null);this.a=null};ey.prototype.set=function(a){this.g=a;fy(this)};hy.prototype.release=function(){this.g=null;this.f=function(){}};ly.prototype.release=function(){this.g&&(this.g.release(),this.g=null);null!=this.o&&(this.o.stop(),this.o=null);this.f&&(this.f.release(),this.f=null);this.a=this.D=this.B=null;this.m=!1};ly.prototype.Pd=function(){this.w=!0;ky(this)};py.prototype.release=function(){this.f&&(this.f.release(),this.f=null);null!=this.g&&(this.g.release(),this.g=null);this.h=function(){};this.a=null;this.m=function(){};this.o=!1};my.prototype.release=function(){this.a&&(this.a.stop(),this.a=null);this.f=null};xy.prototype.release=function(){this.g&&(this.g.release(),this.g=null);this.j&&(this.j.release(),this.j=null);this.o&&(this.o.stop(),this.o=null);this.h=this.g=this.a=this.m=null;this.A=function(){}};var Dy=new _.Mm(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])});_.t=_.Fy.prototype;_.t.destroy=function(){var a=this,b,c,d,e;return _.B(function(f){if(1==f.a){b=[];c=_.u(a.f.values());for(d=c.next();!d.done;d=c.next())e=d.value,Py(e),b.push(Qy(e));return _.x(f,Promise.all(b),2)}a.f.clear();a.o.clear();a.C=null;a.g=null;a.F=null;a.m=null;a.j=null;a.h=!0;_.z(f)})};
|
|
237
|
+
_.t.start=function(){var a=this,b,c,d;return _.B(function(e){if(1==e.a){b=a.C.wb();c=Ly(a,b);d=a.C.Je(a.g.periods[c]);if(!d.variant&&!d.text)throw a.a.error("init: no Streams chosen"),new _.L(_.M,5,5005);a.D=!d.variant&&!!d.text;return _.x(e,cz(a,d.variant?d.variant.audio:null,d.variant?d.variant.video:null,d.text,b),2)}if(a.h)return e["return"]();a.a.debug("init: completed initial Stream setup");a.C&&a.C.bj&&(a.a.debug("init: calling onInitialStreamsSetup()..."),a.C.bj());_.z(e)})};
|
|
238
|
+
_.t.Bb=function(a){var b=this,c,d,e,f;return _.B(function(g){switch(g.a){case 1:if(b.h)return g["return"]();c=Xy(a);if(a.Ya||null==a.qb||a.Xb)return g["return"]();a.qb=null;if(!a.Fb){g.H(2);break}b.a.debug(c,"skipping update and clearing the buffer");return _.x(g,Zy(b,a,a.Td,a.vd),3);case 3:return g["return"]();case 2:_.yf(g,4);d=gz(b,a);null!=d&&(Ny(b,a,d),a.Hc=!1);_.zf(g,5);break;case 4:return e=_.Af(g),_.x(g,rz(b,e),6);case 6:return g["return"]();case 5:f=Array.from(b.f.values()),yz(b,a),b.B&&
|
|
239
|
+
f.every(function(h){return h.endOfStream})&&(b.a.debug(c,"calling endOfStream()..."),b.C.X.endOfStream().then(function(){if(!b.h){var h=b.C.X.getDuration();h<b.g.presentationTimeline.getDuration()&&b.g.presentationTimeline.Tb(h)}}).then(function(){b.C.ag()})),_.z(g)}})};
|
|
240
|
+
_.t.uj=function(a,b,c,d){var e=pv(d.G),f=pv(d.G),g=_.U(d.G),h=_.U(d.G),l=_.U(d.G),m=_.U(d.G);d=_.Fk(d.G,d.G.ya()-d.G.getPosition());a=a.startTime+b.startTime+h/g;if(c.includes(e))if("urn:mpeg:dash:event:2012"==e)this.C.fg();else this.C.onEvent(new _.J("emsg",{detail:{startTime:a,endTime:a+l/g,schemeIdUri:e,value:f,timescale:g,presentationTimeDelta:h,eventDuration:l,id:m,messageData:d}}))};
|
|
241
|
+
_.t.Tj=function(a){var b=this,c=!1,d=0;(new _.Gk).M(_.Dd,_.Hk).M(_.Fe,_.Hk).M(_.yd,_.Hk).M(_.Cd,_.Hk).M(_.te,_.Hk).W(_.ve,_.Ik).M("encv",function(e){e.G.skip(78);_.Hk(e)}).M("pasp",function(e){d=e.start+e.ve;var f=_.U(e.G),g=_.U(e.G);c=f!==g;b.a.debug("hSpacing\x3d"+f+", vSpacing\x3d"+g+", updatePASP\x3d"+c);e.Xa.stop()}).parse(a.data);c&&(a=new _.uk(new DataView(a.data)),a.seek(d),_.S(a,1),_.S(a,1))};_.hz="iterateSegmentReference";_.v(Dz,_.Uj);_.t=Dz.prototype;_.t.init=function(a,b){var c=a.getMedia();_.Uj.prototype.init.call(this,a,b);Jz(this,c)};_.t.namespace=function(){return cv};_.t.Cf=function(){return new ux};_.t.getState=function(){return this.aa};_.t.getDrmInfo=function(){return this.j?this.j.getDrmInfo():null};
|
|
242
|
+
_.t.unload=function(){var a=this;Ax(this,!1);this.Tc=!1;if(this.o){var b=this.getTrackManager();b&&b.release();return this.D===Gz?Promise.resolve():Lz(this).then(function(){a.log.debug(_.jb,a.o);a.o=null;a.Ce=0;a.wc=null;a.R=null})}return Promise.resolve()};
|
|
243
|
+
_.t.release=function(){var a=this;return _.B(function(b){if(a.V)return b["return"](a.V);a.V=new Promise(function(c,d){try{var e=a.Pb;a.Pb=null;var f=e;e&&(f=e["catch"](function(){}));f?f=f.then(function(){return _.Uj.prototype.release.call(a)}):f=_.Uj.prototype.release.call(a);f=f.then(function(){return a.unload()});f.then(function(){Fz(a,_.Pm);a.V=null;c()})["catch"](function(g){a.V=null;d(g)})}catch(g){a.V=null,d(g)}});return b["return"](a.V)})};
|
|
244
|
+
_.t.getBufferInfo=function(a){if(this.J){var b=Pw(this.J),c=new _.Jj(void 0,a);switch(a){case _.gi:return b.video?b.video:c;case _.Q:return b.audio?b.audio:c;case _.P:return b.text?b.text:c}return b.total?b.total:c}return this.Yc?(b=Ov(this.Yc),Kv(b,a)):_.Uj.prototype.getBufferInfo.call(this,a)};_.t.getPosition=function(){return this.w?zy(this.w):_.Uj.prototype.getPosition.call(this)};_.t.getPresentationStartTime=function(){return this.f?this.f.presentationTimeline.getPresentationStartTime():null};
|
|
245
|
+
_.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,_.Uj.prototype.destroy.call(a),2);if(3!=b.a){if(a.D===Gz)return b["return"]();a.log.debug("Destroying player...");a.D=Gz;return _.x(b,Iz(a),3)}a.m&&(a.m.release(),a.m=null);a.g=null;_.z(b)})};
|
|
246
|
+
_.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.D===Gz)return n["return"](Promise.reject(new _.L(_.M,7,7E3)));c=new _.Nh;d=function(){return b.Pb!==c};e=function(){b.log.info("Aborting current load");throw new _.L(_.M,7,7E3);};b.Pb=c;_.yf(n,2);d()&&e();if(!b.V){n.H(4);break}_.yf(n,5);return _.x(n,b.V,7);case 7:_.zf(n,6,2);break;case 5:_.Af(n,2);case 6:d()&&e();case 4:return b.I=new _.Km,b.Be=Date.now()/1E3,Fz(b,_.an),b.o=_.gn(a),_.Tj(a)&&(b.configuration=
|
|
247
|
+
_.Sj(b.zd,a)),b.log.info(_.Ta,b.configuration),b.log.info(_.eb,b.o),(f=b.getTrackManager())&&f.load(),g=b.getSurface().getMedia(),g.loop=!!b.configuration.loop,_.K.S(b.configuration.volume)||b.setVolume(b.configuration.volume),_.K.S(b.configuration.muted)||b.setMuted(b.configuration.muted),lA(b),h=b.o[b.getSourceIndex()],d()&&e(),_.x(n,Jz(b,g),8);case 8:return d()&&e(),_.x(n,Kz(b,g),9);case 9:return d()&&e(),_.x(n,Nz(b,h),10);case 10:return d()&&e(),_.x(n,Rz(b,h),11);case 11:return d()&&e(),_.x(n,
|
|
248
|
+
Yz(b),12);case 12:return d()&&e(),_.x(n,iA(b),13);case 13:d()&&e();c.resolve();_.zf(n,0);break;case 2:throw m=l=_.Af(n),d()&&(m=new _.L(_.M,7,7E3)),c.reject(m),b.onError(m),m;}})};_.t.isLive=function(){var a;this.f?(a=this.f.presentationTimeline.isLive())||(a=this.f.presentationTimeline,a=Infinity!=a.g&&!a.j):a=!1;return a};_.t.jg=function(){this.log.debug("User seeking finished");this.F&&Zz(this);$z(this)};
|
|
249
|
+
_.t.getSeekRange=function(){if(this.f){var a=this.f.presentationTimeline;return{start:gw(a,0),end:fw(a)}}return{start:0,end:0}};_.t.getPlaybackRate=function(){if(this.xc){var a=this.xc;a=a.h?0:a.g}else a=0;return a};
|
|
250
|
+
_.t.setPlaybackRate=function(a){if(0===a)this.log.warn("A trick play rate of 0 is unsupported!");else if(this.D===Cz){this.xc.set(a);this.g.playbackRateChanged(a);var b=this.a,c=1<Math.abs(a);if(a=b.f.get(_.Qe)){var d=a.stream;if(d)if(b.a.debug("setTrickPlay",c),c)(c=d.trickModeVideo)&&!a.Rb&&(b.a.debug("Engaging trick mode stream",c),_.Sy(b,c,!1,0),a.Rb=d);else if(d=a.Rb)b.a.debug("Restoring non-trick-mode stream",d),a.Rb=null,_.Sy(b,d,!0,0)}}};
|
|
251
|
+
_.t.ha=function(){if(this.f&&this.w){var a=Sz(this);if(null==a)a=null;else{if(!Px(this.N,a).text){var b=_.nx(a.textStreams,this.fa,this.tc);b.length&&(b=b[0],Px(this.N,a).text=b)}a=Px(this.N,a).text}b=[];for(var c=_.u(zA(this)),d=c.next();!d.done;d=c.next()){d=d.value;var e=kx(d);e.active=d==a;b.push(e)}return b}return[]};_.t.getPeriods=function(){return this.f.periods};
|
|
252
|
+
_.t.getStats=function(){if(this.D!==Cz)return _.Lm();$z(this);var a=this.h;if(a.getVideoPlaybackQuality){a=a.getVideoPlaybackQuality();var b=this.I,c=Number(a.totalVideoFrames);b.j=Number(a.droppedVideoFrames);b.h=c}if(this.D===Cz){if(a=mA(this))this.I.m=a.bandwidth;a&&a.video&&(b=this.I,c=a.video.height||NaN,b.o=a.video.width||NaN,b.g=c);a=this.g.getBandwidthEstimate();this.I.f=a}return this.I.getStats()};
|
|
253
|
+
_.t.getTimelineCues=function(){return this.uc?_.lf(this.uc.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()};
|
|
254
|
+
_.t.addTextTrack=function(a,b,c,d,e,f){var g=this,h,l,m,n,p,q,r,w,y;return _.B(function(A){if(1==A.a){if(g.D!==Cz)throw g.log.error("Must call load() and wait for it to resolve before adding text tracks."),Error("State error!");h=Sz(g);l=_.on;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 _.Yv(1,0,q,function(){return[a]},0,null,0);w={id:g.rg++,originalId:null,createSegmentIndex:Promise.resolve.bind(Promise),
|
|
255
|
+
findSegmentPosition:function(){return 1},getSegmentReference:function(E){return 1==E?r:null},adjustSegmentDurations:function(){},getDuration:function(){return q},segmentLookupStrategy:_.ev,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.Jd.add(w);h.textStreams.push(w);return _.x(A,Oy(g.a,w),2)}if(y=_.Hy(g.a,_.Be))Px(g.N,h).text=
|
|
256
|
+
y;g.Jd["delete"](w);g.log.debug("Choosing new streams after adding a text stream");kA(g,h);Uz(g);return A["return"](kx(w))})};_.t.xh=function(a){this.log.debug(_.gv,a);try{this.log.debug("onChooseStreams_, choosing variant from ",a.variants);this.log.debug("onChooseStreams_, choosing text from ",a.textStreams);var b=xA(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}}};
|
|
257
|
+
_.t.wh=function(){this.log.debug("canSwitch_");this.T=!1;this.configuration.abr.enabled&&this.g.enable();this.ba&&(Ty(this.a,this.ba,this.mg,this.kg),this.ba=null);this.$&&(_.Sy(this.a,this.$,!0,0),this.$=null)};_.t.yh=function(){this.A&&this.A.update&&this.A.update()};_.t.mj=function(){this.w&&this.w.j.Pd()};
|
|
258
|
+
_.t.Jg=function(a,b,c){if((void 0===c?"":c)===fv)return Uz(this),this.ja()||(this.configuration.abr.enabled=!0,this.g.enable()),kA(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===_.ic&&(h=h&&l.language===a.language));return h})&&this.ja()){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)}Uz(this);this.ja()||(this.configuration.abr.enabled=!0,this.g.enable());
|
|
259
|
+
kA(this,b)}return c};_.t.$i=function(){this.log.debug("endOfStream called by streaming engine");this.Tc=!0};_.t.onError=function(a){if(this.D!==Gz&&7001!==a.code&&7E3!==a.code){var b=new _.J(_.gd,{detail:a});a.severity===_.M&&Fz(this,_.$m);this.trigger(b);b.defaultPrevented&&(b.a=!0)}};_.t.le=function(a){a.type===_.ad?this.dispatchEvent(a):"largegap"!==a.type&&(a.type===_.Ze?Mz(this):"emsg"!==a.type&&(a instanceof _.J?this.dispatchEvent(a):this.log.debug(_.xb,a.type)))};_.t.ja=function(){return this.configuration.abr.enabled};
|
|
260
|
+
_.t.Oj=function(a){var b=this,c,d,e,f,g,h,l,m;return _.B(function(n){switch(n.a){case 1:if(!b.Sa)return n["return"]();b.log.info("Attempt to switch CDN.");c=b.getLoadedSource();d=b.ja();return _.x(n,b.Sa(c.url,a),2);case 2:e=n.f;if(!e)return n["return"]();f=_.K.Wa(b.getLoadedSource(),{url:e});d&&b.g.disable();return _.x(n,zz(b.a),3);case 3:g=mA(b);case 4:return h=!1,_.yf(n,7),b.log.info("Switching CDN to "+f.url+"."),_.x(n,AA(b,f,g),9);case 9:_.zf(n,6);break;case 7:return l=_.Af(n),b.log.info("Switch failed"),
|
|
261
|
+
_.x(n,b.Sa(f.url,a),10);case 10:if(m=n.f)f.url=m,h=!0;else throw l;case 6:h?n.H(4):(d&&b.g.enable(),tz(b.a,!0),b.o[b.getSourceIndex()]=f,a.f=!0,b.trigger(new _.J(_.yc,{newManifest:f.url})),_.z(n))}})};var Gz=0,Bz=1,Cz=2,Tz=[_.Sd,_.nd];BA.prototype.a=function(){return cv};
|
|
262
|
+
BA.prototype.canPlay=function(a,b){if(_.Ti())return 0;var c=a.type||"",d=window.MediaSource&&MediaSource.isTypeSupported?!0:!1,e=window.MediaSource&&MediaSource.isTypeSupported?c in _.wp||_.xp(a.url)in _.yp?!0:!1:!1;if(d&&e){if(_.Uh(2))return 1;if(_.Ui()&&c===_.uj){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};BA.prototype.create=function(){return new Dz};_.$f(new BA);_.Tn(function(){_.Rf("MediaSource.install");if(window.MediaSource)if(window.cast&&cast.__platform__&&cast.__platform__.canDisplayType)_.Qf("Patching Chromecast MSE bugs."),GA();else if(_.Ui()){var a=navigator.appVersion;a=0<=a.indexOf("Version")?parseInt(a.match(/Version\/(\d+)/)[1],10):13;EA();10>=a?(_.Qf("Blacklisting MSE on Safari \x3c\x3d 10."),window.MediaSource=null):12>=a?(_.Qf("Patching Safari 11 \x26 12 MSE bugs."),CA(),DA()):(_.Qf("Patching Safari 13 MSE bugs."),CA())}else _.Uh(2)||_.Uh(3)||
|
|
263
|
+
_.Uh(4)?FA():_.Qf("Using native MSE as-is.");else _.Qf("No MSE implementation available.")});_.v(HA,_.cq);_.t=HA.prototype;
|
|
264
|
+
_.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=_.Ch(f);f=new VTTCue(e.startTime,e.endTime,f);f.line=-1;try{f.align=_.Ac}catch(g){f.align="middle"}e.writingMode===_.Oe?f.vertical="lr":e.writingMode===_.Pe&&(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?
|
|
265
|
+
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;IA(this.a,function(c){return c.startTime<b&&c.endTime>a});return!0};_.t.isTextVisible=function(){return this.a.mode==_.le};_.t.setTextVisibility=function(a){null!==this.a&&(this.a.mode=a?_.le:_.kd)};_.t.destroy=function(){this.a&&IA(this.a,function(){return!0});this.a=null;return Promise.resolve()};JA.prototype.ca=function(){return!0};JA.prototype.create=function(a){return new HA(a)};_.xm("single-native",new JA);};
|
|
263
266
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
264
267
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
265
268
|
else{_=this.clpp._;(f.call(g,this));}
|