@castlabs/prestoplay 6.4.0 → 6.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -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 +103 -103
- package/cjs/cl.conviva.js +33 -33
- package/cjs/cl.core.js +414 -398
- package/cjs/cl.crypto.js +9 -9
- package/cjs/cl.dash.js +71 -71
- package/cjs/cl.externs.js +53 -132
- package/cjs/cl.freewheel.js +21 -21
- package/cjs/cl.hls.js +46 -48
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +31 -32
- package/cjs/cl.ima.js +21 -21
- package/cjs/cl.mse.js +250 -250
- package/cjs/cl.muxdata.js +12 -12
- package/cjs/cl.onboard.js +3 -3
- package/cjs/cl.persistent.js +13 -13
- 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 +69 -69
- 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 +18 -18
- package/cjs/cl.vtt.js +14 -14
- package/cjs/cl.youbora.js +15 -15
- package/cl.adobe.js +3 -3
- package/cl.airplay.js +3 -3
- package/cl.broadpeak.js +5 -5
- package/cl.cast.js +85 -85
- package/cl.conviva.js +27 -27
- package/cl.core.js +360 -351
- package/cl.crypto.js +8 -8
- package/cl.dash.js +67 -67
- package/cl.externs.js +48 -131
- package/cl.freewheel.js +17 -17
- package/cl.hls.js +39 -40
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +25 -25
- package/cl.ima.js +15 -15
- package/cl.mse.js +228 -228
- 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 +14 -14
- package/cl.vtt.js +12 -12
- package/cl.youbora.js +14 -14
- package/package.json +3 -1
package/cjs/cl.mse.js
CHANGED
|
@@ -1,265 +1,265 @@
|
|
|
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.C[b]&&l&&1===l.buffered.length){p=l.buffered.start(0);var r=d-p;if(Math.abs(r)>a.L&&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=
|
|
43
|
-
q])}null!==d&&null!==e&&(a.C[b]=!0)})["catch"](function(p){throw p;})};
|
|
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 Gu,Hu,Iu,Ju,Ku,Lu,Mu,Nu,Ou,Pu,Su,Tu,Vu,Wu,Xu,Yu,Zu,$u,bv,dv,ev,fv,gv,hv,jv,kv,lv,qv,rv,sv,uv,wv,zv,Av,Bv,Cv,Ev,Gv,Iv,Kv,Lv,Mv,Nv,Ov,Wv,$v,cw,bw,dw,ew,fw,gw,kw,nw,mw,ow,pw,sw,tw,uw,vw,xw,zw,Bw,Aw,Cw,Fw,Dw,Hw,Iw,Jw,Lw,Kw,Mw,Ow,Pw,Rw,Qw,Nw,Sw,Uw,Tw,$w,Xw,Vw,Yw,Zw,ax,bx,ex,dx,fx,gx,hx,Ww,ix,kx,cx,lx,mx,nx,ox,px,qx,rx,sx,ux,vx,tx,Dx,Cx,Ex,Fx,Gx,Ix,Jx,Lx,Kx,Mx,Px,Nx,Ox,Rx,Qx,Sx,Tx,Wx,Yx,Xx,Zx,$x,ay,by,dy,ey,fy,cy,hy,gy,ly,my,oy,ky,jy,py,iy,ny,ty,vy,sy,wy,ry,uy,qy,yy,xy,Ay,Cy,Ey,Fy,Ky,My,Uy,Oy,Wy,Iy,
|
|
3
|
+
Xy,Gy,Vy,az,Yy,bz,Py,Ry,fz,ez,cz,nz,lz,hz,oz,gz,jz,rz,qz,kz,pz,$y,Hy,Ny,iz,Ty,Jy,Sy,sz,tz,Zy,Qy,mz,wz,xz,yz,Ez,Cz,Bz,Az,Dz,Gz,Kz,Rz,bA,Jz,Wz,Xz,Yz,Sz,Zz,Pz,eA,zx,xx,Ax,yx,Bx,wx,jA,hA,Uz,Qz,aA,kA,iA,mA,$z,cA,Fz,Tz,nA,Oz,dA,qA,Vz,Nz,pA,oA,Hz,lA,gA,sA,Lz,fA,rA,tA,Iz,uA,vA,wA,xA,yA,zA,AA,BA,CA,mv;Gu=" buffer";Hu=" is being or has been set up";Iu="\x3c/DATA\x3e\x3c/WRMHEADER\x3e";Ju="\x3c/LA_URL\x3e";Ku="\x3cLA_URL\x3e";Lu='\x3cWRMHEADER xmlns\x3d"http://schemas.microsoft.com/DRM/2007/03/PlayReadyHeader" version\x3d"';
|
|
4
|
+
Mu="Choosing new streams after key status change";Nu="IterateSegmentReference";Ou="Jumping forward";Pu="MediaSource threw QuotaExceededError:";_.Qu="No stream with id";_.Ru="Player is in ERROR state and can not switch to ";Su="PrestoPlay TextTrack";Tu="Removing audio from variant - audio not compatible with platform";_.Uu="Updating manifest...";Vu="bufferBehind\x3d";Wu="bufferedBehind\x3d";Xu="calling onCanSwitch()...";Yu="cannot find segment";Zu="clpp.mse.Player";$u="currentPeriod.startTime\x3d";
|
|
5
|
+
_.av="getSegmentNextReference";bv="key-restriction";_.cv="onChooseStreams_";dv="presentationTime:";ev="presentationTime\x3d";fv="reference.endTime\x3d";gv="reference.position\x3d";hv="reference.startTime\x3d";_.iv="subtitles";jv="switch: Stream ";kv=function(a,b){for(var c in a.a)b(c,a.a[c])};lv=function(a){for(var b=a.a;_.xk(a)&&0!==a.f.getUint8(a.a);)a.a+=1;b=a.f.buffer.slice(b,a.a);a.a+=1;return _.oh(b)};
|
|
6
|
+
_.nv=function(a){var b=new Uint8Array(mv),c=4+b.byteLength+a.h.byteLength+4+a.f.byteLength,d=new _.tk(c,!1);_.S(d,c);_.vk(d,b);_.vk(d,a.h);_.S(d,a.f.byteLength);_.vk(d,a.f);return _.N(d.buffer)};
|
|
7
|
+
_.ov=function(a,b,c,d){var e=_.dk(b);if(8!==e.byteLength)e="";else{var f=_.Dl(e);e=_.ak(f);b:switch(f=f.byteLength,_.Qf("Trying to create PlayReady header in version",a),a){case "4.0.0.0":e=[Lu+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?Ku+d+Ju:"",Iu].join("");break b;case "4.1.0.0":e=[Lu+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?Ku+d+Ju:"",Iu].join("");break b;case "4.2.0.0":case "4.3.0.0":e=[Lu+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?Ku+d+Ju:"",Iu].join("");break b;default:_.F("Cannot create PlayReady header in version",a),e=""}}if(!e)return null;_.Qf("New payload",e);e=_.N(_.th(e,!0));return new _.Al(_.El,
|
|
9
|
+
b,d||null,e,a,c)};_.pv=function(a,b){return b===a.version?a:_.ov(b,a.a,a.j||void 0,a.g||void 0)};qv=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.bb.length;e++)if(d.bb[e]===b){c=d;break a}}}c=null}return c?c.za:null};rv=function(a,b){return _.Pi("Edge/")?!0:a.O.has(b)};sv=function(a,b){var c=a.m.get(b);return!(!c||c!==_.Rd&&c!==_.md)};
|
|
10
|
+
uv=function(a,b){var c=b.audio,d=b.video;if(c&&c.encrypted&&!rv(a,_.Ii(c.mimeType,c.codecs))||d&&d.encrypted&&!rv(a,_.Ii(d.mimeType,d.codecs)))return!1;var e=a.keySystem();return 0==b.drmInfos.length||b.drmInfos.some(function(f){return f.keySystem==e})};_.vv=function(a,b){return a.concat(b)};wv=function(){};
|
|
11
|
+
_.xv=function(a,b){if(0==b.length)return a;var c=b.map(function(d){return new _.Eg(d)});return a.map(function(d){return new _.Eg(d)}).map(function(d){return c.map(d.resolve.bind(d))}).reduce(_.vv,[]).map(function(d){return d.toString()})};_.yv=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:b||[],keyIds:[],periodId:c?c:null}};
|
|
12
|
+
zv=function(a,b){for(var c in b)if(b[c]===a)return c;return""};Av=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};Bv=function(a,b){a=_.Fi(a);b=_.Fi(b);var c=a.split("-"),d=b.split("-");return c[0]==d[0]&&1==c.length&&2==d.length};Cv=function(a){return a.language?_.Fi(a.language):a.audio&&a.audio.language?_.Fi(a.audio.language):a.video&&a.video.language?_.Fi(a.video.language):_.Ge};
|
|
13
|
+
_.Dv=function(a,b){for(var c=_.Fi(a),d=new Set,e=_.u(b),f=e.next();!f.done;f=e.next())d.add(_.Fi(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,Bv(f,c))return f;e=_.u(d);for(f=e.next();!f.done;f=e.next()){var g=f=f.value,h=c;g=_.Fi(g);h=_.Fi(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,Bv(c,e))return e;return null};
|
|
14
|
+
Ev=function(a){var b=[a.mimeType];_.rq.forEach(function(c,d){var e=a[d];e&&b.push(c+'\x3d"'+e+'"')});return b.join(";")};_.Fv=function(a){a=a.split(".");var b=a[0];a.pop();return[b,a.join(".")]};Gv=function(a,b){for(var c=new _.Ij(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
|
+
_.Hv=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={Mc:e.Mc},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.Mc=_.kf(g.keyIds||[]).concat();f.keyIds&&f.keyIds.length&&f.keyIds.forEach(function(l){return function(m){l.Mc.includes(m)||l.Mc.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.Mc,periodId:g.periodId});break}return c};Iv=function(a,b){return a.start-b.start};
|
|
17
|
+
_.Jv=function(a){this.m=a;this.log=new _.H("clpp.renditions");this.f=[];this.j=this.a=null;this.h=!1};Kv=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}})};Lv=function(a){a.a&&a.a.trigger(new _.I(_.oc))};
|
|
18
|
+
Mv=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(_.De,a.g,a),a.h=!0):!b&&a.h&&(a.log.debug("Stop tracking timeupdates"),a.a.off(_.De,a.g),a.h=!1)}};Nv=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 _.I(_.Se))};
|
|
19
|
+
Ov=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};_.Pv=function(a){this.g=Math.exp(Math.log(.5)/a);this.f=this.a=0};_.Qv=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)};_.Rv=function(a){return a.a/(1-Math.pow(a.g,a.f))};
|
|
20
|
+
_.Sv=function(a,b,c,d,e,f,g,h){a=_.Hh(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};_.Tv=function(a,b,c,d,e){this.Ha=a;this.Pa=b;this.Ea=c;this.keyInfo=d||null;this.Xb=_.J.R(e)?!1:!!e};
|
|
21
|
+
_.Uv=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.Pa=e;this.Ea=f;this.keyInfo=h||null;this.Xb=_.J.R(l)?!1:!!l;this.timescale=m;this.horizontalTiles=n;this.verticalTiles=p;this.durationPerTile=q;this.a=r||[];this.g=!1};
|
|
22
|
+
_.Vv=function(a,b,c,d){var e=void 0===e?!1:e;this.o=a;this.Pe=b;this.hc=this.g=Infinity;this.a=1;this.w=0;this.f=this.h=null;this.A=0;this.m=this.j=c;this.D=void 0===d?!0:d;this.B=new _.H("clpp.media.PresentationTimeline");this.C=e};Wv=function(a){return a.j?a.g:a.m?a.f:null};
|
|
23
|
+
_.Yv=function(a,b,c){if(0!=b.length){var d=b[b.length-1].endTime+c;_.Xv(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.D&&(a.o=(Date.now()+a.A)/1E3-a.f-a.a);a.B.debug("notifySegments: maxSegmentDuration\x3d"+a.a)}};_.Xv=function(a,b){a.h=null==a.h?b:Math.min(a.h,b)};_.Zv=function(a,b){a.a=Math.max(a.a,b);a.B.debug("notifyNewSegmentDuration: maxSegmentDuration\x3d"+a.a)};
|
|
24
|
+
_.aw=function(a){return Infinity==a.hc?0:Math.max(0,$v(a)-a.hc)};$v=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.C?Math.max(0,b-(a.a-a.w)-a.o):Math.max(0,b-a.a-a.o),a.g)}return a};cw=function(a,b){var c=Math.max(a.h,0);return Infinity==a.hc?Math.ceil(1E3*c)/1E3:Math.max(c,Math.min($v(a)-a.hc+b,bw(a)))};bw=function(a){return Math.max(0,$v(a)-(a.j||a.m?0:a.Pe))};dw=function(){this.f=function(){};this.a=new Set};ew=function(a,b){a.f=b};
|
|
25
|
+
fw=function(a,b,c){this.g=a;this.a=b;this.f=c;new _.H("clpp.media.SegmentIterator")};gw=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};_.hw=function(a){this.a=a;this.f=new _.H("clpp.media.SegmentIndex")};_.iw=function(a){return a.a.length?a.a[a.a.length-1].endTime:0};_.jw=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
|
+
kw=function(a,b){var c=a.zc(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 fw(a,c,e)};
|
|
27
|
+
_.lw=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 _.Uv(c.position,c.startTime,b,c.Ha,c.Pa,c.Ea,c.Aa,c.keyInfo,c.Xb,c.timescale,c.horizontalTiles,c.verticalTiles,c.durationPerTile))}};nw=function(a){var b=this;this.f=a;this.a=new Set;this.g=(new _.Li(function(){mw(b,!1)})).ab(.25)};mw=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
|
+
ow=function(a){var b=this;this.j=a;this.h=new Map;this.a=function(){};this.f=function(){};this.g=function(){};this.o=[{nc:null,mc:2,ac:function(c,d){return b.a(c,d)}},{nc:1,mc:2,ac:function(c,d){return b.a(c,d)}},{nc:3,mc:2,ac:function(c,d){return b.a(c,d)}},{nc:2,mc:1,ac:function(c,d){return b.f(c,d)}},{nc:2,mc:3,ac:function(c,d){return b.f(c,d)}},{nc:1,mc:3,ac:function(c,d){return b.g(c,d)}},{nc:3,mc:1,ac:function(c,d){return b.g(c,d)}}]};pw=function(a,b,c,d){a.a=b;a.f=c;a.g=d};
|
|
29
|
+
_.qw=function(a){_.wp[a]&&delete _.wp[a]};_.rw=function(a){_.up[a]&&delete _.up[a]};sw=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
|
+
tw=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
|
+
uw=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
|
+
vw=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 _.xg(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))};_.ww=function(a){a=a.toLowerCase();return _.Rp[a]||window.muxjs&&a==_.ac?!0:!1};xw=function(){this.a=new muxjs.mp4.CaptionParser;this.j=[];this.h={}};_.yw=function(){};zw=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
|
+
Bw=function(a,b){return!window.muxjs||"mp2t"!=a.toLowerCase().split(";")[0].split("/")[1]&&"aac"!=a.toLowerCase().split(";")[0].split("/")[1]?!1:b?MediaSource.isTypeSupported(Aw(b,a))||MediaSource.isTypeSupported(a.replace(/aac/i,_.Dd)):MediaSource.isTypeSupported(Aw(_.ic,a))||MediaSource.isTypeSupported(a.replace(/aac/i,_.Dd))||MediaSource.isTypeSupported(Aw(_.Pe,a))};
|
|
35
|
+
Aw=function(a,b){var c=b.replace(/mp2t/i,_.Dd);a==_.ic&&(c=c.replace(_.Pe,_.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};Cw=function(a,b){a.h=!0;a.f=new _.Mh;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
|
+
_.Ew=function(a,b,c,d,e){this.j=a;this.A=c;this.f={};this.J=!1;this.g=null;this.h={};this.o=new _.cg;this.I=!1;this.w={};this.D=b;this.B=d;this.K=e;this.L=this.K.streaming.maxSegmentToMediaOffset||1;this.G=new _.Mh;this.C={};this.m=Dw(this,this.G);this.a=new _.H("clpp.mse.MediaSourceEngine")};Fw=function(a){var b=_.Ii(a.mimeType,a.codecs),c=Ev(a);return _.ww(b)||MediaSource.isTypeSupported(c)||Bw(b,a.type)};
|
|
37
|
+
Dw=function(a,b){var c=new MediaSource,d=Gw(c);a.o.one(c,"sourceopen",function(){URL.revokeObjectURL(d);b.resolve()});a.j.src=d;return c};Hw=function(a,b){b.forEach(function(c,d){var e=a.m.addSourceBuffer(c);a.o.on(e,_.fd,a.T.bind(a,d));a.o.on(e,"updateend",a.Ic.bind(a,d));a.f[d]=e;a.h[d]=[];a.C[d]=!1});a.J=b.has(_.ic)&&b.has(_.Pe)};Iw=function(a,b){a.g||(a.g=new sw(a.K,a.A));var c=a.g;if(b!=_.ac){var d=_.Rp[b];if(!d)throw new _.L(_.M,2,2012,"Text parser is unavailable for "+b);c.o=new d(c.B)}};
|
|
38
|
+
Jw=function(a){return a.m?a.m.readyState==_.ed:!0};Lw=function(a){var b={};b.total=new _.Ij(a.j.buffered,"total");b.audio=Kw(a,_.ic);b.video=Kw(a,_.Pe);var c=[];a.g&&(c=[{start:a.g.rb(),end:a.g.xa()}]);b.text=Gv(c,_.Ae);return b};Kw=function(a,b){try{return new _.Ij(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
|
+
Mw=function(a,b){if(!a.f[b])return"";var c=Kw(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
|
+
Ow=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===_.Pe&&null!==d&&null!==e&&h&&(m=0<n?l.buffered.end(n-1):-1);b==_.Ae?c=tw(a.g,c,d,e):a.w[b]?c=Cw(a.w[b],c).then(function(p){a.g||Iw(a,_.Be);p.captions&&p.captions.length&&vw(a.g,p.captions,d,e,a.f.video.timestampOffset);var q=[];0<p.audio.byteLength&&a.f.audio&&q.push(Nw(a,_.ic,a.ke.bind(a,_.ic,p.audio.buffer)));0<p.video.byteLength&&a.f.video&&q.push(Nw(a,_.Pe,a.ke.bind(a,_.Pe,p.video.buffer)));
|
|
41
|
+
return Promise.all(q)}):(f&&window.muxjs&&(a.g||Iw(a,_.Be),null==d&&null==e?a.D.init(c):a.D.g(c,function(p){p.length&&vw(a.g,p,d,e,a.f.video.timestampOffset)})),c=Nw(a,b,a.ke.bind(a,b,c)));return c.then(function(){if(b===_.Pe&&null!==d&&null!==e&&!h)a.B.append(d,e,g),null!==d&&null!==e&&a.a.debug("Appended video segment ",d,e,"Buffer:",Mw(a,b));else if(b===_.ic&&null!==d&&null!==e)Lv(a.B),null!==d&&null!==e&&a.a.debug("Appended audio segment ",d,e,"Buffer:",Mw(a,b));else if(b===_.Pe&&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.C[b]&&l&&1===l.buffered.length){p=l.buffered.start(0);var r=d-p;if(Math.abs(r)>a.L&&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=Nw(a,b,function(){a.qg(b,r)}),q=Nw(a,b,a.Gf.bind(a,b,!1)),Promise.all([p,
|
|
43
|
+
q])}null!==d&&null!==e&&(a.C[b]=!0)})["catch"](function(p){throw p;})};Pw=function(a,b){var c=a.xa(_.Pe)||0;uw(a.g,b,c)};Rw=function(a,b,c,d,e){if(b==_.Ae)return a.g.w=c,a=a.g,a.h=d,a.j=e,Promise.resolve();b=Qw(a,b,c,d,e);a.J&&(b=b.concat(Qw(a,_.ic,c,d,e)));return Promise.all(b)};Qw=function(a,b,c,d,e){return[Nw(a,b,a.Ag.bind(a,b)),Nw(a,b,a.qg.bind(a,b,c)),Nw(a,b,a.Gj.bind(a,b,d,e))]};
|
|
44
|
+
Nw=function(a,b,c){if(a.I)return Promise.reject();c={start:c,p:new _.Mh};a.h[b].push(c);1===a.h[b].length&&Sw(a,b);return c.p};Sw=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})),Tw(a,b)}else a.a.debug("No more scheduled operations for "+b)};
|
|
45
|
+
Uw=function(a,b){if(a.I)return Promise.reject();var c=[],d;for(d in a.f){var e=new _.Mh,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)Tw(a,l);return h},function(){for(var g in a.f)a.h[g].length&&a.h[g].shift();return Promise.reject()})};Tw=function(a,b){a.h[b].shift();Sw(a,b)};
|
|
46
|
+
$w=function(a,b,c,d){var e=a.periods.flatMap(function(n){return n.variants});if(b.length||c.length)e=Vw(e,b,c);e=Ww(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={Vd:c.Vd},d++)c.Vd=b[d],l=new Set(_.kf(l).concat().filter(function(n){return function(p){return n.Vd.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=Xw(e);var m=Yw(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(Zw(n)===m)return!0;_.Qf("Dropping Variant (better codec available)",n);return!1})};Xw=function(a){var b=new _.$f;a=_.u(a);for(var c=a.next();!c.done;c=a.next()){c=c.value;var d=Zw(c);b.push(d,c)}return b};
|
|
48
|
+
Vw=function(a,b,c){var d={};b=_.u(b);for(var e=b.next();!e.done;d={$d:d.$d},e=b.next())if(d.$d=e.value,e=a.filter(function(f){return function(g){return g.video&&g.video.codecs.startsWith(f.$d)}}(d)),e.length){a=e;break}d={};c=_.u(c);for(b=c.next();!b.done;d={Td:d.Td},b=c.next())if(d.Td=b.value,b=a.filter(function(f){return function(g){return g.audio&&g.audio.codecs.startsWith(f.Td)}}(d)),b.length){a=b;break}return a};
|
|
49
|
+
Yw=function(a){var b="",c=Infinity;kv(a,function(d,e){var f=e.reduce(function(g,h){return g+h.bandwidth||0},0)/e.length;_.Qf(_.Kc,d,"avg bandwidth",f);f<c&&(b=d,c=f)});return b};Zw=function(a){var b="";a.video&&(b=_.Fv(a.video.codecs)[0]);var c="";a.audio&&(c=_.Fv(a.audio.codecs)[0]);return b+"-"+c};
|
|
50
|
+
ax=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};bx=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=ax(e,b,c);f!=e.allowedByApplication&&(d=!0)}return d};
|
|
51
|
+
ex=function(a,b,c,d){var e=!1;d.variants=d.variants.filter(function(m){if(a&&a.$&&!uv(a,m))return _.Qf("Dropping variant - not compatible with key system",m),!1;var n=m.audio,p=m.video;if(n&&!Fw(n)){var q=n.codecs;0<=n.codecs.indexOf("ec-3")?(_.Qf("Trying to use AC-3 for EC-3"),n.codecs=n.codecs.replace("ec-3","ac-3"),Fw(n)?_.Pf("Using AC-3 instead of EC-3 for",cx(n)):(n.codecs=q,_.Pf(Tu,cx(n)),m.audio=null,e=!0,n=null)):(_.Pf(Tu,cx(n)),m.audio=null,e=!0,n=null)}return p&&!Fw(p)?(_.Pf("Dropping variant - video not compatible with platform",
|
|
52
|
+
cx(p)),!1):n&&b&&!dx(n,b)?(_.Pf("Dropping variant - not compatible with active audio","active audio",cx(b),"variant.audio",cx(n)),!1):p&&c&&!dx(p,c)?(_.Pf("Dropping variant - not compatible with active video","active video",cx(c),"variant.video",cx(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?(_.Pf("Dropping variant - not compatible with video + audio",
|
|
53
|
+
"variant.video",cx(m.video)),!1):!0}))}d.textStreams=d.textStreams.filter(function(m){var n=_.ww(_.Ii(m.mimeType,m.codecs));n||_.Qf("Dropping text stream. Is not supported by the platform.",m);return n})};dx=function(a,b){return a.mimeType!=b.mimeType||a.codecs.split(".")[0]!=b.codecs.split(".")[0]?!1:!0};
|
|
54
|
+
fx=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
|
-
|
|
57
|
+
gx=function(a){return{id:a.id,active:!1,type:_.Ae,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
|
+
hx=function(a){return a.allowedByApplication&&a.allowedByKeySystem};Ww=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
|
+
_.jx=function(a,b,c){b=_.ai(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=_.Dv(_.Fi(g),a.map(function(l){return l.language}));return h?(d=a.filter(function(l){return _.Fi(l.language)===h}),!0):!1});if(c){b=ix(d,c);if(b.length)return b;_.F("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(_.vv,
|
|
60
|
+
[]);return b.length?ix(d,b[0]):d};ix=function(a,b){return a.filter(function(c){return c.roles.includes(b)})};kx=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
|
+
cx=function(a){var b=Ev(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===_.Pe?"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
|
+
lx=function(a,b){var c=String(_.ii++);c=new _.di(c,a);c.mimeType=_.ei(b.mimeType);if(a===_.P||a===_.Q)c.label=_.ei(b.label),c.language=_.ei(b.language);a===_.fi?(c.frameRate=b.frameRate,c.roles=b.roles):a===_.Q?(c.channelsCount=b.channelsCount,c.roles=b.audioRoles||[],c.mimeType=_.ei(b.audioMimeType)):(c.kind=_.ei(b.kind),c.roles=b.roles);c.accessibility=a===_.fi||a===_.Q?(b.accessibility||[]).filter(function(d){return d.type===a}):b.accessibility||[];return c};
|
|
63
|
+
mx=function(a,b,c){var d=new _.li(a===_.fi?""+b.videoId:a===_.Q?""+b.audioId:""+b.id,c);switch(a){case _.fi:d.codec=_.ei(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=_.ei(b.audioCodec);d.bandwidth=b.audioBandwidth||b.bandwidth;d.originalId=b.originalAudioId;d.drm={keyId:b.keyId||void 0};break;default:d.codec=_.ei(b.codecs),d.originalId=b.originalTextId}(a=c.renditions.find(function(e){return _.J.va(e,
|
|
64
|
+
d,null,["id","track"])}))||c.renditions.push(d);return a||d};nx=function(a,b){var c=a.reduce(function(d,e){b===_.fi?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)};ox=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
|
+
px=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};qx=function(){this.g=new _.H("cl.api.mse.TrackManager");this.l=null;this.h=[];this.a=new Map;this.f=new Map};rx=function(a,b){return a.h.filter(function(c){return c.type===b})};sx=function(a,b){var c=a.a.get(b)||null;return c&&c.track};ux=function(a,b,c){c&&sx(a,c.type)===c&&!a.l.ha()||tx(a,b,c&&c.renditions[0])};
|
|
66
|
+
vx=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
|
+
tx=function(a,b,c,d){d=void 0===d?!1:d;if(a.l&&((a.a.get(b)||null)!==c||a.l.ha())){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.fa().find(function(n){return n.id==c.id});f&&(a.f.set(b,c),vx(a,c),e.trigger(new _.I(_.Dj)),wx(e,!0).then(function(){xx(e,f)})["catch"](function(n){a.g.warn("Error while activating track",n)}))}else if(b===
|
|
68
|
+
_.Q)a.f.set(b,c),yx(e,parseInt(c.id,10));else if(b===_.fi){var g=a.a.get(_.Q)||null;if(g){var h=zx(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=zx(e).find(function(n){return n.videoId==c.id});l?(a.f.set(b,
|
|
69
|
+
c),Ax(e,l,d)):a.g.warn("Cannot find matching variant")}}else a.g.debug(_.Fa+b),sx(a,b)&&(b===_.P?wx(e,!1).then(function(){a.a.set(b,null);e.trigger(new _.I(_.Dj))})["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"):Ax(e,null,d))}};
|
|
70
|
+
Dx=function(a){if(a.l){a.g.debug("Track list change detected, updating track list");for(var b=[],c=_.u(Object.values(_.qq)),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.fa());for(var e=d.next();!e.done;c={Tb:c.Tb},e=d.next()){e=e.value;c.Tb=lx(_.P,e);var f=b.find(function(h){return function(l){return h.Tb.va(l)}}(c));c.Tb=f||c.Tb;var g=mx(_.P,e,c.Tb);e.active&&a.a.set(_.P,g);f||b.push(c.Tb)}Bx(a.l)||a.a.set(_.P,null);c=zx(a.l);Cx(a,b,c,_.fi);Cx(a,b,c,_.Q);
|
|
71
|
+
a.h=b}};Cx=function(a,b,c,d){var e=nx(c,d);c={};e=_.u(e);for(var f=e.next();!f.done;c={Ub:c.Ub},f=e.next()){f=f.value;c.Ub=lx(d,f);var g=b.find(function(l){return function(m){return l.Ub.va(m)}}(c));c.Ub=g||c.Ub;var h=mx(d,f,c.Ub);f.active&&a.a.set(d,h);g||b.push(c.Ub)}};
|
|
72
|
+
Ex=function(a,b,c){if(b){a.h.length||Dx(a);for(var d=b.type,e=a.a.get(d)||null,f,g=_.u(rx(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&&(vx(a,f),d===_.Q?a.l.trigger(new _.I(_.Cj)):d===_.fi&&a.l.trigger(new _.I(_.Te,{details:{width:f.width||0,height:f.height||0,bandwidth:f.bandwidth,track:f.track,abrSelection:c}})))}};Fx=function(){this.f=new _.Pv(2);this.g=new _.Pv(5);this.a=0};Gx=function(a,b){return 128E3>a.a?b:Math.min(_.Rv(a.f),_.Rv(a.g))};
|
|
73
|
+
_.Hx=function(){this.f=new _.H("clpp.abr");this.w=null;this.j=!1;this.g=new Fx;this.o=[];this.m=1;this.B=this.A=!1;this.a=this.h=null};Ix=function(a,b){a&&(b=b.filter(function(c){return ax(c,a,{width:Infinity,height:Infinity})}));return b.sort(function(c,d){return c.bandwidth-d.bandwidth})};Jx=function(){this.a=new Map};Lx=function(a,b){a.a.has(b)||a.a.set(b,new Kx);return a.a.get(b)};Kx=function(){this.text=this.variant=null};
|
|
74
|
+
Mx=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)};Px=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&&Nx(c,d)&&Ox(c.roles,d.roles))}!c&&(c=a.video&&b.video)&&(c=a.video,d=b.video,c=!(Nx(c,d)&&Ox(c.roles,d.roles)));return c?!1:!0};
|
|
75
|
+
Nx=function(a,b){if(a.mimeType!=b.mimeType)return!1;var c=a.codecs.split(",").map(function(f){return _.Fv(f)[0]}),d=b.codecs.split(",").map(function(f){return _.Fv(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};Ox=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
|
+
Rx=function(a){this.a=a;this.f=new Qx(a.language,"",a.audio&&a.audio.channelsCount?a.audio.channelsCount:0)};Qx=function(a,b,c){this.g=_.ai(a);this.a=b;this.f=c};Sx=function(a,b){var c=null;b.some(function(d){c=_.Dv(_.Fi(d),a.map(function(e){return Cv(e)}));return!!c});return c?a.filter(function(d){return c===Cv(d)}):[]};Tx=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
|
+
Wx=function(a,b){this.a=Ux;this.f=(new Map).set(Ux,b).set(Vx,a)};
|
|
78
|
+
Yx=function(a){var b=this;this.f=a;this.a=a.getConfiguration().streaming;this.h=new _.cg;this.g=new _.H("clpp.mse.media.LiveEdgeObserver");Xx(this)&&(a=this.f.getSurface().getMedia(),this.h.on(a,_.De,function(){var c=b.f.getPosition(),d=b.f.getSeekRange().end;c=d-c;var e=b.f.getPlaybackRate(),f=b.a.stopChasingAt;1<=e&&c>=b.a.chaseJumpDistance?(b.g.debug("Too far from edge, jump to beginning."),b.f.setPlaybackRate(1),b.f.seek(d)):1===e&&c>=b.a.startChasingAt?(b.g.debug("Not on live edge, increase playback rate."),
|
|
79
79
|
b.f.setPlaybackRate(b.a.chasingRate)):1<e&&c<=f&&(b.g.debug("On live edge, reduce playback rate."),b.f.setPlaybackRate(1))}))};
|
|
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.D&&(f=d.start(e),!(f>=
|
|
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
|
-
|
|
80
|
+
Xx=function(a){return 1>=a.a.chasingRate?(a.g.warn("chasingRate must be greater than 1."),!1):a.a.chaseJumpDistance<=a.a.startChasingAt?(a.g.warn("chaseJumpDistance must be greater than startChasingAt."),!1):a.a.startChasingAt<=a.a.stopChasingAt?(a.g.warn("startChasingAt must be greater than stopChasingAt."),!1):0>a.a.stopChasingAt?(a.g.warn("stopChasingAt must be greater than or equal to 0."),!1):!0};Zx=function(a){this.g=a;this.a=null;this.f=function(){}};$x=function(a,b){a.f=b};
|
|
81
|
+
ay=function(a){var b=this;this.a=a;this.h=!1;this.g=this.a.re();this.f=new _.Li(function(){b.a.Di(.25*b.g)})};by=function(a){a.f.stop();var b=a.h?0:a.g;0<=b?a.a.re()!=b&&a.a.pg(b):(a.f.ab(.25),0!=a.a.re()&&a.a.pg(0))};dy=function(a,b){this.g=a;this.j=cy(a);this.a=a.a.currentTime;this.h=Date.now()/1E3;this.m=b;this.f=function(){}};ey=function(a,b){a.f=b};fy=function(a){this.a=a};
|
|
82
|
+
cy=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};hy=function(a,b,c,d,e){var f=this;this.a=a;this.C=b;this.j=c;this.B=e;this.g=new _.cg;this.A=!1;this.G=a.readyState;this.h=!1;this.f=d;this.m=this.D=this.w=!1;this.g.on(a,_.Xe,function(){return gy(f)});this.o=(new _.Li(function(){gy(f)})).ab(.25)};
|
|
83
|
+
gy=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.G&&(a.h=!1,a.G=a.a.readyState);var b=a.j.smallGapLimit,c=a.a.currentTime,d=a.a.buffered;a:{var e=new _.Ij(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=cy(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.D&&(f=d.start(e),!(f>=bw(a.C)))){g=f-c;b=g<=b;var h=!1;if(!(.001>g)){if(!b&&!a.h){a.h=!0;var l=new _.I("largegap",{detail:{currentTime:c,gapSize:g}});l.cancelable=!0;a.B(l);a.j.jumpLargeGaps&&!l.defaultPrevented?h=!0:_.Pf("Ignoring large gap at",c,"size",g)}if(b||h)0==e?_.Pf(Ou,g,"seconds because of gap before start time of",f):_.Pf(Ou,g,"seconds because of gap starting at",d.end(e-1),"and ending at",f),a.a.currentTime=f}}}}};
|
|
85
|
+
ly=function(a,b,c,d){this.a=a;this.h=b;this.m=d;this.w=c;this.j=!1;this.f=new _.cg;this.g=new iy(a);this.o=!1;0<a.readyState?jy(this,c):ky(this,c)};my=function(a){return a.j?a.a.currentTime:a.w};oy=function(a,b){0<a.a.readyState?ny(a.g,b):ky(a,b)};ky=function(a,b){a.w=b;a.f.off(a.a,_.ud);a.f.one(a.a,_.ud,function(){jy(a,b)})};jy=function(a,b){a.o||(a.o=!0,a.m&&a.m());.001>Math.abs(a.a.currentTime-b)?py(a):(a.f.one(a.a,_.je,function(){py(a)}),ny(a.g,0==a.a.currentTime?b:a.a.currentTime))};
|
|
86
|
+
py=function(a){_.Ri()&&!a.j&&a.h();a.j=!0;a.f.on(a.a,_.je,function(){return a.h()})};iy=function(a){var b=this;this.f=a;this.m=10;this.j=this.g=this.h=0;this.a=new _.Li(function(){0>=b.h?(_.F(["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--)})};ny=function(a,b){a.g=a.f.currentTime;a.j=b;a.h=a.m;a.f.currentTime=b;a.a.ab(.1)};
|
|
87
|
+
ty=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 hy(a,b.presentationTimeline,c,qy(this,a,c),f);this.g=new ly(a,function(){a:{var h=g.j;h.A=!0;h.w=!1;h.h=!1;h=my(g.g);var l=ry(g,h);if(.001<Math.abs(l-h)){var m=(new Date).getTime()/1E3;if(!g.w||g.w<m-1){g.w=m;oy(g.g,l);h=void 0;break a}}g.f.debug("Seek to "+h);g.A();h=void 0}return h},sy(this,d),function(){g.j.D=!0});this.o=(new _.Li(function(){if(0!=g.h.readyState&&
|
|
88
|
+
!g.h.paused){var h=my(g.g),l=cw(g.a,0),m=bw(g.a);3>m-l&&(l=m-3);h<l&&(l=ry(g,h),g.f.info("Jumping forward "+(l-h)+" seconds to catch up with the seek range."),g.h.currentTime=l)}})).ab(.25);this.f=new _.H("clpp.mse.Playhead")};vy=function(a){var b=my(a.g);return 0<a.h.readyState&&!a.h.paused?uy(a,b):b};sy=function(a,b){null==b?b=Infinity>a.a.getDuration()?cw(a.a,0):bw(a.a):0>b&&(b=bw(a.a)+b);return wy(a,uy(a,b))};wy=function(a,b){var c=a.a.getDuration();return b>=c?c-a.m.durationBackoff:b};
|
|
89
|
+
ry=function(a,b){var c=new _.Ij(a.h.buffered);c=c.cc.bind(c);var d=Math.max(a.B,a.m.rebufferingGoal),e=a.m.safeSeekOffset,f=cw(a.a,0),g=bw(a.a),h=a.a.getDuration();3>g-f&&(f=g-3);var l=cw(a.a,d),m=cw(a.a,e);d=cw(a.a,d+e);if(b>=h)return a.f.debug("Playhead past duration."),wy(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};uy=function(a,b){var c=cw(a.a,0);if(b<c)return c;c=bw(a.a);return b>c?c:b};
|
|
91
|
+
qy=function(a,b,c){if(!c.stallEnabled)return null;var d=c.gapDetectionThreshold,e=c.stallSkip;c=new dy(new fy(b),c.stallThreshold);ey(c,function(f,g){a.f.warn("Stall detected at "+f+" for "+g+" seconds.");if(e){var h=new _.Ij(b.buffered),l;if(l=_.Pi("Edge/")||_.Pi("Trident/")||_.Th()||_.Ri())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.o[f];if(g&&g.Kc&&(g=a.w.get(b.id))&&g.Kc)if(e.stream!=b){g=a.h.presentationTimeline.getDuration();var h=a.f.wb();h=
|
|
102
|
-
(f+=(h.Ea?h.Ea-h.Pa:null)||0),h=a.f.
|
|
103
|
-
|
|
104
|
-
c)};
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
93
|
+
yy=function(a){function b(){d=!0}function c(m){f.push(m);_.Gk(m)}a=_.N(a);var d=!1,e,f=[],g=[];(new _.Fk).M(_.Cd,c).M(_.Ee,c).M(_.xd,c).M(_.Bd,c).M(_.se,c).V(_.ue,function(m){e=m;f.push(m);_.Hk(m)}).V("encv",b).V("enca",b).V("avc1",function(m){g.push({M:m,Hc:1701733238})}).V("avc3",function(m){g.push({M:m,Hc:1701733238})}).V("ac-3",function(m){g.push({M:m,Hc:1701733217})}).V("ec-3",function(m){g.push({M:m,Hc:1701733217})}).V("mp4a",function(m){g.push({M:m,Hc:1701733217})}).parse(a);if(d)return _.Pf("Init segment already indicates encryption."),
|
|
94
|
+
a;if(0===g.length||!e)throw _.Rf("Failed to find boxes needed to fake encryption!"),_.Rf("Failed init segment (hex):",_.ek(a)),new _.L(_.M,3,14E3);g.reverse();for(var h=_.u(g),l=h.next();!l.done;l=h.next())l=l.value,_.Pf('Inserting "'+_.Kk(l.Hc)+'" box into init segment.'),a=xy(a,e,l.M,f,l.Hc);return a};
|
|
95
|
+
xy=function(a,b,c,d,e){var f=zy.value(),g=a.subarray(c.start,c.start+c.size),h=_.lh(g),l=new Uint8Array(c.size+f.byteLength);l.set(g,0);g=_.lh(l);g.setUint32(4,e);l.set(f,c.size);e=h.getUint32(4);g.setUint32(c.size+16,e);Ay(l,0,l.byteLength);e=new Uint8Array(a.byteLength+l.byteLength);c=_.Pi("Xbox One")||_.Oi()?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,Ay(e,d.start,d.size+l.byteLength);l=_.lh(e,
|
|
96
|
+
b.start);b=_.Lk(b);a=l.getUint32(b);l.setUint32(b,a+1);return e};Ay=function(a,b,c){a=_.lh(a,b);b=a.getUint32(0);0!=b&&(1==b?(a.setUint32(8,c>>32),a.setUint32(12,c&4294967295)):a.setUint32(0,c))};_.By=function(a,b){this.f=b;this.h=a;this.m=null;this.B=1;this.G=Promise.resolve();this.o=[];this.w=new Map;this.g=new Map;this.J=this.j=this.A=this.C=!1;this.I=0;this.a=new _.H("clpp.mse.Streaming");this.D=!1};
|
|
97
|
+
Cy=function(a){var b=a.g.get(_.Pe);return b?a.h.periods[b.zb]:(b=a.g.get(_.ic))?a.h.periods[b.zb]:null};Ey=function(a){return _.Dy(a,_.ic)};Fy=function(a){return _.Dy(a,_.Pe)};_.Dy=function(a,b){var c=a.g.get(b);return c?c.Pb||c.stream:null};
|
|
98
|
+
Ky=function(a,b){var c,d,e,f,g,h,l,m,n,p;return _.A(function(q){switch(q.a){case 1:return c=_.nn,_.y(q,a.f.W.clear(c.TEXT),2);case 2:return a.I++,a.J=!1,d=a.I,e=a.f.W,f=new Map,g=new Set,f.set(c.TEXT,b),g.add(b),_.y(q,e.init(f,!1),3);case 3:return a.j?q["return"]():_.y(q,Gy(a,g),4);case 4:if(a.j)return q["return"]();l=(h=e.getTextDisplayer().isTextVisible())||a.m.alwaysStreamText;a.I!=d||a.g.has(c.TEXT)||a.J||!l||(m=a.f.wb(),n=Hy(a,m),p=Iy(b,n,0),a.g.set(c.TEXT,p),Jy(a,p,0));_.z(q)}})};
|
|
99
|
+
My=function(a,b,c,d){b.video&&_.Ly(a,b.video,c,d);b.audio&&_.Ly(a,b.audio,c,d)};
|
|
100
|
+
_.Ly=function(a,b,c,d){var e=a.g.get(b.type);if(!e&&b.type==_.Ae&&a.m.ignoreTextStreamFailures)Ky(a,b);else if(e){var f=Ny(a,b);if(c&&f!=e.zb)for(a.a.debug("switch: switching to stream in another Period; clearing buffer and changing Periods"),c=_.u(a.g.values()),d=c.next();!d.done;d=c.next())Oy(a,d.value);else{e.Pb&&(a.a.debug("switch during trick play mode",b),b.trickModeVideo?(e.Pb=b,b=b.trickModeVideo,a.a.debug("switch found trick play stream",b)):(e.Pb=null,a.a.debug("switch found no special trick play stream")));
|
|
101
|
+
var g=a.o[f];if(g&&g.Kc&&(g=a.w.get(b.id))&&g.Kc)if(e.stream!=b){g=a.h.presentationTimeline.getDuration();var h=a.f.wb();h=Py(a,e,h);!c&&(e.endOfStream||h>=g)?a.a.debug(jv+Qy(e)+" already buffered to the end. Not switching."):(b.type==_.Ae&&Iw(a.f.W,_.Ii(b.mimeType,b.codecs)),e.stream=b,e.stream.segmentIterator=null,e.gd=!0,a.a.debug("switch: switching to Stream "+Qy(e)),e.fc?(b=a.f.wb(),g=a.f.W.xa(e.type),f=(f=Ry(a,e,b,g,f))?f.Ea?f.Ea-f.Pa:null:null,null==f?f=!1:((h=e.stream.initSegmentReference)&&
|
|
102
|
+
(f+=(h.Ea?h.Ea-h.Pa:null)||0),h=a.f.pe().getBandwidthEstimate(),8*f/h<(null===g?0:g-b)-Math.max(a.h.minBufferTime||0,a.m.rebufferingGoal)?f=!0:(b=e.fc,b=b.h?b.h.bytesRemaining:-1,f=0>b||b>f?!0:!1))):f=!1,f&&(a.a.info("Aborting current segment request to switch."),e.fc.abort()),c&&(e.Vb?e.Rd=!0:e.Xa?(e.Db=!0,e.td=d,e.Rd=!0):(Sy(e),Ty(a,e,!0,d))))}else a.a.debug(jv+Qy(e)+" already active")}}};
|
|
103
|
+
Uy=function(a){function b(l){return a.f.W.cc(l,c,0)}var c=a.f.wb(),d=!1,e=Hy(a,c);if(_.Yg(a.g.values(),function(l){return l.zb==e}))for(var f=_.u(a.g.keys()),g=f.next();!g.done;g=f.next()){g=g.value;var h=a.g.get(g);h.stream.segmentIterator=null;b(g)||(Oy(a,h),d=!0)}else if(!_.Yg(a.g.keys(),b)){a.a.debug("(all): seeked: unbuffered seek: clearing all buffers");d=_.u(a.g.values());for(f=d.next();!f.done;f=d.next())Oy(a,f.value);d=!0}d||a.a.debug("(all): seeked: buffered seek: presentationTime\x3d"+
|
|
104
|
+
c)};Oy=function(a,b){var c=Qy(b);b.Vb?a.a.debug(c,"clear: already clearing the buffer"):b.Db?a.a.debug(c,"clear: already waiting"):b.Xa?(a.a.debug(c,"clear: currently updating"),b.Db=!0,b.td=0):null==a.f.W.rb(b.type)?(a.a.debug(c,"clear: nothing buffered"),null==b.pb&&Jy(a,b,0)):(a.a.debug(c,"clear: handling right now"),Sy(b),Ty(a,b,!1,0))};
|
|
105
|
+
Wy=function(a,b,c,d,e){var f,g,h,l,m,n,p;return _.A(function(q){if(1==q.a)return f=a.f.wb(),g=Hy(a,f),h=_.nn,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.f.W,p=a.m.forceNativeTS,_.y(q,n.init(l,p),2);if(3!=q.a){if(a.j)return q["return"]();Vy(a);return _.y(q,Gy(a,m),3)}if(a.j)return q["return"]();l.forEach(function(r,w){if(!a.g.has(w)){var x=Iy(r,g,e);a.g.set(w,x);Jy(a,x,0)}});_.z(q)})};
|
|
106
|
+
Iy=function(a,b,c){return{stream:a,type:a.type,Mb:null,segmentIterator:null,ma:null,Pb:null,gd:!0,zb:b,endOfStream:!1,Xa:!1,pb:null,Db:!1,td:0,Rd:!1,Vb:!1,Re:!1,Fc:!1,ng:c||0,fc:null,wd:!1,Pf:0}};
|
|
107
|
+
Xy=function(a,b){var c=a.o[b];if(c)return a.a.debug("(all) Period "+b+Hu),c.P;a.a.debug("(all) setting up Period "+b);c={P:new _.Mh,Kc:!1};a.o[b]=c;for(var d=new Set,e=_.u(a.h.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.h.periods[b].textStreams);for(f=e.next();!f.done;f=e.next())d.add(f.value);a.G=a.G.then(function(){return a.j?null:Gy(a,d)}).then(function(){a.j||
|
|
108
108
|
(a.o[b].P.resolve(),a.o[b].Kc=!0,a.a.debug("(all) setup Period "+b))})["catch"](function(g){a.j||(a.o[b].P["catch"](function(){}),a.o[b].P.reject(),delete a.o[b],a.a.warn("(all) failed to setup Period "+b),a.f.onError(g))});return c.P};
|
|
109
|
-
|
|
110
|
-
e.value,a.w.get(m.id).P["catch"](function(){}),a.w.get(m.id).P.reject(),a.w["delete"](m.id);throw h;case 3:n=_.u(b);for(e=n.next();!e.done;e=n.next())p=e.value,q=a.w.get(p.id),q.Kc||(q.P.resolve(),q.Kc=!0,a.a.debug("(all) setup Stream "+p.id));_.z(r)}})};
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
"need Period "+h,
|
|
114
|
-
1;b.
|
|
115
|
-
|
|
116
|
-
c),d=b.stream.segmentIterator.next().value),null===d&&a.a.warn(
|
|
117
|
-
Math.max(0,c-1))),a=f||
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
b,e,!1,function(w){return f(w.data,!0)})}).then(function(w){return q||a.j||a.A||null===w?(a.j||a.A||
|
|
121
|
-
a.a.warn(g,"Text stream failed to parse. Proceeding without it."),a.g["delete"](_.
|
|
122
|
-
!0;1001===w.code&&500<=w.data.status||(x=!a.f.
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
h,b).then(function(){return
|
|
127
|
-
|
|
128
|
-
a.f.
|
|
129
|
-
"Appending segment with "+(E.toFixed(3)+" - "+G.toFixed(3)+" KeyID: ")+(e.keyId+" Width: ")+(e.width+" Height: "+e.height+" Bitrate: ")+(_.
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
f,f+h).then(function(){a.j||a.a.debug(d,"evicted "+h+" seconds")})};
|
|
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.f.Ab.fetch(f);b.fc=c;return c.P.then(function(g){var h=a.f.
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
this.configuration.preferredAudioChannelCount);this.ia=this.configuration.preferredTextLanguage;this.O=this.uc=null;this.wc=new Map;this.da=null;this.qb=this.configuration.preferredTextRole;a&&a(this);this.
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
{detail:{bufferedTimeMS:-1,reason:e}})):d===_.
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
a.I.destroy(),9);case 9:a.I=null;case 8:a.
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
isNaN(a.configuration.suggestedPresentationDelay)||(a.log.info("Apply suggested presentation delay of: "+a.configuration.suggestedPresentationDelay),a.f.presentationTimeline.
|
|
155
|
-
|
|
156
|
-
if(n.length){n=a.getPeriods();for(var q=0;q<n.length;q++)for(var r=n[q],w=_.u(r.variants),x=w.next();!x.done;x=w.next()){x=x.value;var
|
|
157
|
-
(D.keyId+"'. Applying restrictions to "+G)));r===l&&E!==x.allowedByKeySystem&&(m=!0)}}}if(h=
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
r}});a.isLive()&&a.configuration.streaming.enableLiveEdgeChasing&&(a.
|
|
162
|
-
h.next();!l.done;l=h.next())m=l.value,
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
e,"buffered to end",b,"state",a.getState()),
|
|
167
|
-
|
|
168
|
-
a.g.disable())};
|
|
169
|
-
|
|
170
|
-
b.id});f?(a.O=f.video.id,
|
|
171
|
-
|
|
172
|
-
e.audio.codecs.split(".")[0]){d=e.audio;a.uc=d.id;a.g.setVariants(f);f=
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
b).variant=c};
|
|
176
|
-
|
|
177
|
-
encrypted:!1,keyId:null,language:g.closedCaptions.get(l),label:null,type:_.
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
g.initDataType,g.initData,g.keyId)}}}};
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
a.g.chooseVariant())};
|
|
185
|
-
|
|
186
|
-
text:null}};
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
missingKeys:g,restrictedKeyStatuses:h});};
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
return _.y(
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
_.
|
|
200
|
-
_.
|
|
201
|
-
b);this.f.push(c);this.f.sort(
|
|
202
|
-
_.
|
|
203
|
-
{detail:{width:b,height:c,bandwidth:a?a.bandwidth:null,rendition:a}}))}}}};_.
|
|
204
|
-
_.t.isLive=function(){return Infinity==this.g&&!this.j};
|
|
109
|
+
Gy=function(a,b){var c,d,e,f,g,h,l,m,n,p,q;return _.A(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.w.get(f.id))?(a.a.debug("(all) Stream "+f.id+Hu),c.push(g.P)):(a.a.debug("(all) setting up Stream "+f.id),a.w.set(f.id,{P:new _.Mh,Kc:!1}),c.push(f.createSegmentIndex()));_.xf(r,2);return _.y(r,Promise.all(c),4);case 4:if(a.j)return r["return"]();_.yf(r,3);break;case 2:h=_.zf(r);if(a.j)return r["return"]();l=_.u(b);for(e=l.next();!e.done;e=l.next())m=
|
|
110
|
+
e.value,a.w.get(m.id).P["catch"](function(){}),a.w.get(m.id).P.reject(),a.w["delete"](m.id);throw h;case 3:n=_.u(b);for(e=n.next();!e.done;e=n.next())p=e.value,q=a.w.get(p.id),q.Kc||(q.P.resolve(),q.Kc=!0,a.a.debug("(all) setup Stream "+p.id));_.z(r)}})};Vy=function(a){var b=a.h.presentationTimeline.getDuration();Infinity>b?a.f.W.Rb(b):a.f.W.Rb(Math.pow(2,32))};
|
|
111
|
+
az=function(a,b){if(!a.j){var c=Qy(b);if(!b.Xa&&null!=b.pb&&!b.Vb)if(b.pb=null,b.Db)a.a.debug(c,"skipping update and clearing the buffer"),Ty(a,b,b.Rd,b.td);else{try{var d=Yy(a,b);null!=d&&(Jy(a,b,d),b.Fc=!1)}catch(e){Zy(a,e);return}d=Array.from(a.g.values());$y(a,b);a.C&&d.every(function(e){return e.endOfStream})&&(a.a.debug(c,"calling endOfStream()..."),a.f.W.endOfStream().then(function(){if(!a.j){var e=a.f.W.getDuration();e<a.h.presentationTimeline.getDuration()&&a.h.presentationTimeline.Rb(e)}}).then(function(){a.f.Yf()}))}}};
|
|
112
|
+
Yy=function(a,b){function c(p){return p.type==_.Ae&&p.stream.mimeType==_.ac}if(c(b))return Pw(a.f.W,b.stream.originalId||""),null;var d=Qy(b),e=a.f.wb(),f=Py(a,b,e);a.a.debug(d,"timeNeeded\x3d"+f);var g=Ny(a,b.stream),h=Hy(a,f),l=a.f.W.Da(b.type,e);a.a.debug(d,"update_:",ev+e,"bufferedAhead\x3d"+l);var m=Math.max(a.h.minBufferTime||0,a.m.rebufferingGoal,a.m.bufferingGoal)*a.B,n=Wv(a.h.presentationTimeline);if(null!=n&&f>=n&&!b.wd)return bz(a,b),null;b.endOfStream=!1;b.zb=h;if(h!=g)return a.a.debug(d,
|
|
113
|
+
"need Period "+h,ev+e,"timeNeeded\x3d"+f,"currentPeriodIndex\x3d"+g),null;if(l>=m)return a.a.debug(d,"buffering goal met"),a.m.bufferLimitUpdateInterval||.5;h=a.f.W.xa(b.type);h=Ry(a,b,e,h,g);if(!h)return a.h.presentationTimeline.isLive()||b.type===_.Ae?a.m.bufferLimitUpdateInterval||1:(a.a.debug("Media state "+d+": no next segment found. Assuming EOS."),bz(a,b),null);d=Infinity;l=_.u(a.g.values());for(m=l.next();!m.done;m=l.next())m=m.value,c(m)||(m=Py(a,m,e),d=Math.min(d,m));if(f>=d+a.h.presentationTimeline.a)return a.m.bufferLimitUpdateInterval||
|
|
114
|
+
1;b.ng=0;cz(a,b,e,g,h);return null};bz=function(a,b){a.a.debug(Qy(b),"buffered to end of presentation");b.endOfStream=!0;if(b.type==_.Pe){var c=a.g.get(_.Ae);c&&c.stream.mimeType==_.ac&&(c.endOfStream=!0)}};Py=function(a,b,c){if(!b.Mb||!b.ma)return Math.max(c,b.ng);c=Ny(a,b.Mb);return a.h.periods[c].startTime+b.ma.endTime};
|
|
115
|
+
Ry=function(a,b,c,d,e){if(b.stream.segmentLookupStrategy===_.dz)b.stream.segmentIterator?a=gw(b.stream.segmentIterator):b.ma||d?(e=b.ma?b.ma.endTime:d,a.a.info(Nu,"looking up segment from new stream endTime:",e),b.stream.segmentIterator=kw(b.stream.segmentIndex,e),d=b.stream.segmentIterator.next().value,null===d&&(b.stream.segmentIterator=null,a.a.warn(Nu,Yu,"endTime:",e,b.ma)),a=d):(e=Math.max(c,0),a.a.info(Nu,"looking up segment","lookupTime:",e,dv,c),d=null,d||(b.stream.segmentIterator=kw(b.stream.segmentIndex,
|
|
116
|
+
c),d=b.stream.segmentIterator.next().value),null===d&&a.a.warn(Nu,Yu,"lookupTime:",e,dv,c),a=d);else{var f=Qy(b);b.ma&&b.stream==b.Mb?(d=b.ma.position+1,a.a.debug(f,"next position known:","position\x3d"+d),a=ez(a,b,e,d)):(b.ma?(a.a.debug(f,"next position unknown: another Stream buffered"),c=Ny(a,b.Mb),c=fz(a,b,a.h.periods[c].startTime+b.ma.endTime,e)):(a.a.debug(f,"next position unknown: nothing buffered"),c=fz(a,b,d||c,e)),null==c?a=null:(f=null,null!=d||null!==a.m&&a.m.ignoreDrift||(f=ez(a,b,e,
|
|
117
|
+
Math.max(0,c-1))),a=f||ez(a,b,e,c)))}return a};fz=function(a,b,c,d){var e=Qy(b);d=a.h.periods[d];a.a.debug(e,"looking up segment:","lastSegment.endTime\x3d"+c,$u+d.startTime);c=Math.max(0,c-d.startTime);b=b.stream.findSegmentPosition(c);null==b&&a.a.warn(e,"cannot find segment:",$u+d.startTime,"lookupTime\x3d"+c);return b};
|
|
118
|
+
ez=function(a,b,c,d){var e=Qy(b);c=a.h.periods[c];var f=b.stream.getSegmentReference(d);if(!f)return a.a.debug(e,"segment does not exist:",$u+c.startTime,"position\x3d"+d),null;var g=a.h.presentationTimeline;d=_.aw(g);g=$v(g);return!b.wd&&(c.startTime+f.endTime<d||c.startTime+f.startTime>g)?(a.a.debug(e,"segment is not available:",$u+c.startTime,hv+f.startTime,fv+f.endTime,"availabilityStart\x3d"+d,"availabilityEnd\x3d"+g),null):f};
|
|
119
|
+
cz=function(a,b,c,d,e){function f(w,x){if(a.j||a.A)return null;q=!0;return gz(a,b,c,h,l,e,w,x)}var g=Qy(b),h=a.h.periods[d];a.a.debug(g,"fetchAndAppend_:",ev+c,$u+h.startTime,gv+e.position,hv+e.startTime,fv+e.endTime);var l=b.stream,m=b.stream.segmentIterator,n=a.h.presentationTimeline.getDuration(),p=a.h.periods[d+1];d=hz(a,b,d,Math.max(0,h.startTime-.1),p?p.startTime+.01:n,e);b.Xa=!0;b.gd=!1;a.a.debug(g,"fetching segment");var q=!1,r=a.f.W.xa(b.type)||0;d.then(function(){return a.j||a.A?null:iz(a,
|
|
120
|
+
b,e,!1,function(w){return f(w.data,!0)})}).then(function(w){return q||a.j||a.A||null===w?(a.j||a.A||jz(a,b,r,e,l),null):f(w,!1)}).then(function(){if(!a.j&&!a.A){jz(a,b,r,e,l);b.Xa=!1;b.Re=!1;b.Db||a.f.Nd();if(m){var w=m.next().value;w&&a.a.debug("New iterated segment",w)}Jy(a,b,0);kz(a,b,l);a.a.debug(g,"finished fetch and append")}})["catch"](function(w){if(!a.j&&!a.A)if(b.Xa=!1,b.type==_.Ae&&a.m.ignoreTextStreamFailures)1001==w.code?a.a.warn(g,"Text stream failed to download. Proceeding without it."):
|
|
121
|
+
a.a.warn(g,"Text stream failed to parse. Proceeding without it."),a.g["delete"](_.Ae);else if(7001==w.code)b.Xa=!1,b.pb=null,Jy(a,b,0);else if(3017===w.code)lz(a,b,w);else if(1001===w.code&&w.data&&404===w.data[1])a.a.warn(g,"request for segment failed","segment not available on server",gv+e.position,hv+e.startTime,fv+e.endTime,"error\x3d"+w),b.Xa=!1,b.pb=null,Jy(a,b,1);else if(b.type===_.Ae)w instanceof _.L&&w.a(1),Sy(b),a.f.onError(new _.L(1,2,2010,w));else if(1001<=w.code&&1003>=w.code){var x=
|
|
122
|
+
!0;1001===w.code&&500<=w.data.status||(x=!a.f.de(b.stream,h));x&&(b.Fc=!0,w.a(_.M),Zy(a,w))}else a.a.error(g,"failed fetch and append: code\x3d"+w.code),b.Fc=!0,w instanceof _.L&&w.a(_.M),Zy(a,w)})};
|
|
123
|
+
nz=function(a,b){b=void 0===b?!1:b;if(a.j)a.a.error("Unable to retry after StreamingEngine is destroyed!");else if(a.A)a.a.error("Unable to retry after StreamingEngine encountered a fatal error!");else for(var c=_.u(a.g.values()),d=c.next();!d.done;d=c.next()){d=d.value;var e=Qy(d);if(d.Fc||b&&mz(d))a.a.info(e,"Retrying after failure..."),d.Fc=!1,Jy(a,d,.1)}};
|
|
124
|
+
lz=function(a,b,c){var d=Qy(b);if(Array.from(a.g.values()).some(function(f){return f!=b&&f.Re}))a.a.debug(d,Pu,"waiting for another stream to recover...");else{var e=Math.round(100*a.B);if(20<e)a.B-=.2;else if(4<e)a.B-=.04;else{a.a.error(d,"MediaSource threw QuotaExceededError too many times");b.Fc=!0;a.A=!0;a.f.onError(c);return}a.a.warn(d,Pu,"reducing buffering goals by "+(100-Math.round(100*a.B))+"%");b.Re=!0}Jy(a,b,4)};
|
|
125
|
+
hz=function(a,b,c,d,e,f){c=a.h.periods[c].startTime-f.Aa;if(!b.gd&&c===b.Pf)return Promise.resolve();b.Pf=c;var g=Qy(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=Rw(a.f.W,b.type,c,d,e);if(!b.stream.initSegmentReference||!b.gd)return d;a.a.debug(g,"fetching init segment");e=iz(a,b,b.stream.initSegmentReference,!0).then(function(h){if(a.j)return null;a.a.debug(g,"appending init segment");return oz(a,
|
|
126
|
+
h,b).then(function(){return Ow(a.f.W,b.type,h,null,null,!!b.stream.closedCaptions&&0<b.stream.closedCaptions.size)})})["catch"](function(h){b.gd=!0;return Promise.reject(h)});return Promise.all([d,e])};oz=function(a,b,c){var d;return _.A(function(e){if(!a.m.patchEdgeWhenMixedContent||!_.Oi())return e.H(0);d=yy(b);return _.y(e,Ow(a.f.W,c.type,d.buffer,null,null,!!c.stream.closedCaptions&&0<c.stream.closedCaptions.size),0)})};
|
|
127
|
+
gz=function(a,b,c,d,e,f,g,h){h=void 0===h?!1:h;var l,m,n,p,q,r,w,x,C;return _.A(function(D){switch(D.a){case 1:l=Qy(b);if(!(e&&e.keyId&&a.f.Zc)){D.H(2);break}m=qv(a.f.Zc,e.keyId);if(!m){a.a.warn("Unable to find DRM session for "+e.keyId);D.H(2);break}_.xf(D,4);return _.y(D,m,6);case 6:_.yf(D,2);break;case 4:n=_.zf(D),a.a.warn("DRM session load failed!",n);case 2:if(!(e.encrypted&&e.keyId&&a.f.Zc&&sv(a.f.Zc,e.keyId))){D.H(7);break}Sy(b);p=Ny(a,e);q=pz(a,p);if(!q){D.H(8);break}return _.y(D,q,8);case 8:return r=
|
|
128
|
+
a.f.de(e,d,bv),w=f.startTime+d.startTime,x=f.endTime+d.startTime,a.a.warn(l,"Blocked append for "+w+" - "+x+": "+r+". Stream with Key ID "+(e.keyId+" has restrictions.")),D["return"](Promise.resolve());case 7:return C=e.closedCaptions&&0<e.closedCaptions.size,null!=e.emsgSchemeIdUris&&0<e.emsgSchemeIdUris.length&&(new _.Fk).V("emsg",a.K.bind(a,d,f,e.emsgSchemeIdUris)).parse(g),D["return"](qz(a,b,c).then(function(){if(a.j)return null;var E=f.startTime+d.startTime,G=f.endTime+d.startTime;a.a.debug(l,
|
|
129
|
+
"Appending segment with "+(E.toFixed(3)+" - "+G.toFixed(3)+" KeyID: ")+(e.keyId+" Width: ")+(e.width+" Height: "+e.height+" Bitrate: ")+(_.zh(e.bandwidth)+" Fragment: ")+h);return Ow(a.f.W,b.type,g,E,G,C,e.id,h)}).then(function(){a.j||(a.a.debug(l,"appended media segment"),b.Mb=e,b.ma=f)}))}})};
|
|
130
|
+
jz=function(a,b,c,d,e){if(!a.h.presentationTimeline.isLive()&&b.type!==_.Ae){var f=Qy(b);c=(a.f.W.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.wd=!0,e.adjustSegmentDurations(d.position,h))}};
|
|
131
|
+
rz=function(a,b,c){(new _.Fk).M(_.Cd,_.Gk).M(_.Ee,_.Gk).M(_.xd,_.Gk).M(_.Bd,_.Gk).M(_.se,_.Gk).V(_.ue,_.Hk).M("encv",function(d){d.F.skip(78);_.Gk(d)}).M(_.le,_.Gk).M("schi",_.Gk).M("tenc",function(d){d.F.skip(6);if(_.zk(d.F)){d.F.skip(1);var e=_.ek(_.Ek(d.F,16));e!==b.stream.keyId&&(a.a.debug(Qy(b),"Key id from tenc mismatches with key id from manifest. Switching from "+(b.stream.keyId+" to "+e+".")),b.stream.keyId=e)}d.Wa.stop()}).parse(c)};
|
|
132
|
+
qz=function(a,b,c){if(a.j)return Promise.resolve();var d=Qy(b);a.a.debug(d,"checking buffer length");var e=Math.max(a.m.bufferBehind,a.h.presentationTimeline.a),f=a.f.W.rb(b.type);if(null==f)return a.a.debug(d,"buffer behind okay because nothing buffered:",ev+c,Vu+e),Promise.resolve();var g=c-f,h=g-e;if(.01>=h)return a.a.debug(d,"buffer behind okay:",ev+c,Wu+g,Vu+e,"underflow\x3d"+Math.abs(h)),Promise.resolve();a.a.debug(d,"buffer behind too large:",ev+c,Wu+g,Vu+e,"overflow\x3d"+h);return a.f.W.remove(b.type,
|
|
133
|
+
f,f+h).then(function(){a.j||a.a.debug(d,"evicted "+h+" seconds")})};kz=function(a,b,c){if(!a.C){b=Qy(b);var d=Array.from(a.g.values());1!=d.length||d[0].type!=_.Ae?a.C=d.every(function(e){return e.type==_.Ae||a.D?!0:!e.Db&&!e.Vb&&e.ma}):a.D&&(a.C=!0);a.C&&(a.a.debug(b,"startup complete"),c=Ny(a,c),pz(a,c))}};
|
|
134
|
+
pz=function(a,b){var c=null;a.o[b]||(c=Xy(a,b).then(function(){a.j||(a.a.debug(Xu),a.f.Ge())})["catch"](wv));for(var d=0;d<a.h.periods.length;++d)Xy(a,d)["catch"](wv);a.f.qj&&(a.a.debug("calling onStartupComplete()..."),a.f.qj());return c};
|
|
135
|
+
$y=function(a,b){var c=Qy(b),d=Ny(a,b.stream);if(b.zb!=d){var e=b.zb,f=Array.from(a.g.values());f.every(function(g){return g.zb==e})?f.every(mz)?(a.a.debug(c,"all need Period "+e),Xy(a,e).then(function(){if(!a.j)if(f.every(function(n){var p=mz(n),q=Ny(a,n.stream);return p&&n.zb==e&&q!=e})){var g=a.h.periods[e];a.a.debug(c,"calling onChooseStreams()...");var h=a.f.He(g);a.D=!h.variant&&!!h.text;var l=new Map;h.variant&&h.variant.video&&l.set(_.Pe,h.variant.video);h.variant&&h.variant.audio&&l.set(_.ic,
|
|
136
|
+
h.variant.audio);h.text&&l.set(_.Ae,h.text);var m=_.u(a.g.keys());for(h=m.next();!h.done;h=m.next())if(h=h.value,!l.has(h)&&h!=_.Ae){a.a.error(c,"invalid Streams chosen: missing "+h+" Stream");a.f.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.g.has(h))if(h==_.Ae)Wy(a,null,null,l.get(_.Ae),g.startTime),l["delete"](h);else{a.a.error(c,"invalid Streams chosen: unusable "+h+" Stream");a.f.onError(new _.L(_.M,5,5005));return}g=_.u(Array.from(a.g.keys()));
|
|
137
|
+
for(h=g.next();!h.done;h=g.next())h=h.value,(m=l.get(h))?(_.Ly(a,m,!1,0),Jy(a,a.g.get(h),0)):a.g["delete"](h);a.a.debug(c,Xu);a.f.Ge()}else a.a.debug(c,"ignoring transition to Period",e,"since another is happening")})["catch"](wv)):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)}};Hy=function(a,b){var c=Ov(a.h.periods,b+_.oq);return c?a.h.periods.indexOf(c):0};
|
|
138
|
+
Ny=function(a,b){for(var c=a.h.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
|
+
iz=function(a,b,c,d,e){d=void 0===d?!1:d;e=void 0===e?null:e;var f=_.Sv(c.Ha(),c.Pa,c.Ea,a.m.attemptParameters,c.startTime,c.endTime,b.type,c.timescale);f.type=2;f.onFragment=c.Xb?null:e;f.disableFragmentSupport=c.Xb||a.m.disableFragmentSupport;f.disableMergedFragments=a.m.disableMergedFragments;if(e=c.f())f.keyInfo=e,f.onFragment=null;d&&(f.responseModifiers.push(function(g){rz(a,b,g.data)}),b.type===_.Pe&&a.m.overridePasp&&f.responseModifiers.push(a.L.bind(a)));a.a.debug("fetching: reference\x3d",
|
|
140
|
+
c);c=a.f.Ab.fetch(f);b.fc=c;return c.P.then(function(g){var h=a.f.pe(),l=g.timeMs,m=g.data.byteLength;l&&m&&!d&&h.segmentDownloaded(l,m);b.fc=null;return g.data})};
|
|
141
|
+
Ty=function(a,b,c,d){var e,f,g,h;return _.A(function(l){if(1==l.a)return e=Qy(b),b.Db=!1,b.Rd=!1,b.td=0,b.Vb=!0,b.stream.segmentIterator=null,a.a.debug(e,"clearing buffer"),d?(g=a.f.wb(),h=a.f.W.getDuration(),f=a.f.W.remove(b.type,g+d,h)):f=a.f.W.clear(b.type).then(function(){return!a.j&&c?a.f.W.flush(b.type):null}),_.y(l,f,2);if(a.j)return l["return"]();a.a.debug(e,"cleared buffer");b.Mb=null;b.ma=null;b.Vb=!1;b.endOfStream=!1;b.wd=!1;Jy(a,b,0);_.z(l)})};
|
|
142
|
+
Jy=function(a,b,c){a.a.debug(Qy(b),"updating in "+c+" seconds");b.pb=(new _.Ji(function(){az(a,b)})).Z(c)};Sy=function(a){null!=a.pb&&(a.pb.stop(),a.pb=null)};sz=function(a){var b,c,d,e;return _.A(function(f){b=[];c=_.u(a.g.values());for(d=c.next();!d.done;d=c.next())e=d.value,Sy(e),e.Xa&&e.fc&&(e.Xa=!1,b.push(e.fc.abort())),e.Db&&b.push(Ty(a,e,!0,0));return _.y(f,Promise.all(b),0)})};
|
|
143
|
+
tz=function(a,b,c){(a=a.g.get(b))&&c&&(Sy(a),a.stream=c,a.Mb=c,a.ma&&(a.ma=c.getSegmentReference(a.ma.position)),a.ma||(a.Mb=null))};Zy=function(a,b){var c;_.A(function(d){switch(d.a){case 1:if(a.j)return d["return"]();if(!a.f.rg){d.H(2);break}_.xf(d,3);return _.y(d,a.f.rg(b),5);case 5:_.yf(d,2);break;case 3:c=_.zf(d),c.cause=b,b=c;case 2:if(!b.f)a.f.onError(b);_.z(d)}})};Qy=function(a){return"("+a.type+":"+a.stream.id+")"};mz=function(a){return!a.Xa&&null==a.pb&&!a.Db&&!a.Vb};
|
|
144
|
+
wz=function(a){_.Tj.call(this,Zu);var b=this;this.C=uz;this.h=this.Nb=this.U=null;this.Ae=0;this.Uf=2;this.Wc=null;this.ye=!1;this.m=new _.cg;this.ua=this.Bd=this.vc=this.oc=this.w=this.I=this.j=null;this.Rc=!1;this.g=this.f=this.A=this.a=this.sc=this.D=null;this.og=1E9;this.Gd=new Set;this.S=!0;this.ca=null;this.jg=!1;this.hg=0;this.X=null;this.L=new Jx;this.kg={width:Infinity,height:Infinity};this.G=null;this.$=_.Om;this.tc=new Qx(this.configuration.preferredAudioLanguage||[],this.configuration.preferredAudioRole,
|
|
145
|
+
this.configuration.preferredAudioChannelCount);this.ia=this.configuration.preferredTextLanguage;this.O=this.uc=null;this.wc=new Map;this.da=null;this.qb=this.configuration.preferredTextRole;a&&a(this);this.ze=null;this.m.on(window,"online",function(){b.C===vz&&nz(b.a)})};
|
|
146
|
+
xz=function(a){return new _.Jv(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,_.kf(e.value.renditions))}return d.find(function(f){return f.id==b})||null})};
|
|
147
|
+
yz=function(a,b){if(a.$!==b)if(a.$===_.Zm&&b!==_.Om)a.log.info(_.Ru+zv(b,_.Xm));else{var c=a.Ae;c=0===c?0:Date.now()-c;var d=a.$;a.$=b;a.Ae=Date.now();a.G&&_.Em(a.G.a,a.$);b===_.Tm&&(a.Uf=a.xe?1:2);var e=a.Uf,f={currentState:a.$,previousState:d,timeSinceLastStateChangeMS:c,reason:b===_.Tm||d===_.Tm?e:void 0};a.log.info(_.fb+zv(d,_.Xm)+" -\x3e "+(zv(b,_.Xm)+(b!==_.Tm?"":"["+zv(e,_.Wm)+"]")));a.trigger(new _.I(_.pe,{detail:f}));(b===_.Vm||b===_.Zm)&&a.ua&&a.ua.stop();b===_.Tm?a.trigger(new _.I(_.tc,
|
|
148
|
+
{detail:{bufferedTimeMS:-1,reason:e}})):d===_.Tm&&a.trigger(new _.I(_.sc,{detail:{bufferedTimeMS:c,reason:e}}))}};Ez=function(a){var b=!1;b=void 0===b?!0:b;var c,d;return _.A(function(e){switch(e.a){case 1:return a.C===zz?e["return"](Promise.reject(new _.L(_.M,7,7E3))):_.y(e,Az(a),2);case 2:return _.y(e,Bz(a),3);case 3:c=_.Th(4)||_.Th(5);if(!b&&!c){e.H(0);break}d=a.getSurface().getMedia();return _.y(e,Cz(a,d),5);case 5:return _.y(e,Dz(a,d),0)}})};
|
|
149
|
+
Cz=function(a,b){a.h||(a.m.on(b,_.fd,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()};Bz=function(a){a.h&&(a.m.off(a.h,_.fd),a.h=null);return Promise.resolve()};
|
|
150
|
+
Az=function(a){var b;return _.A(function(c){switch(c.a){case 1:a.C!==zz&&(a.C=uz);if(b=a.h)a.m.off(b,_.td),a.m.off(b,_.Xd),a.m.off(b,_.Sd),a.m.off(b,_.ed),a.m.off(b,_.be),a.m.off(b,_.$d);a.oc&&(a.oc.release(),a.oc=null);a.ua&&(a.ua.stop(),a.ua=null);if(!a.A){c.H(2);break}return _.y(c,a.A.stop(),3);case 3:a.A=null;case 2:if(!a.g){c.H(4);break}return _.y(c,a.g.stop(),4);case 4:if(!a.a){c.H(6);break}return _.y(c,a.a.destroy(),7);case 7:a.a=null;case 6:a.w&&(a.w.release(),a.w=null);if(!a.I){c.H(8);break}return _.y(c,
|
|
151
|
+
a.I.destroy(),9);case 9:a.I=null;case 8:a.Bd&&(a.Bd.release(),a.Bd=null);b&&b.src&&(b.removeAttribute("src"),b.load());if(!a.j){c.H(10);break}return _.y(c,a.j.destroy(),11);case 11:a.j=null;case 10:a.L.clear(),a.D=null,a.Gd.clear(),a.f=null,a.G=null,a.S=!0,a.wc.clear(),a.Rc=!1,Fz(a),_.z(c)}})};
|
|
152
|
+
Dz=function(a,b){var c,d,e;return _.A(function(f){if(1==f.a)return c=window.muxjs?new xw:new _.yw,d=_.xm(a.configuration,["html","single-native"]),a.J=d.create(a),a.Wc=xz(a),a.Wc.track(a),e=new _.Ew(b,c,a.J,a.Wc,a.configuration),_.y(f,e.G,2);a.I=e;_.z(f)})};Gz=function(a,b){var c,d;return _.A(function(e){if(1==e.a)return c=a.getNetworkEngine(),d=a,_.y(e,_.tp(b.url,c,a.configuration.manifest.attemptParameters,b.type||null),2);d.A=e.f;a.A.configure(a.configuration.manifest);_.z(e)})};
|
|
153
|
+
Kz=function(a,b){var c;return _.A(function(d){a.sc=new dw;ew(a.sc,function(e){Hz(a,_.ng,e)});c=new _.Nh(Promise.resolve().then(function(){var e,f,g;return _.A(function(h){switch(h.a){case 1:if(a.f){h.H(3);break}_.xf(h,4);e=a;return _.y(h,a.A.start(b.url,Iz(a)),6);case 6:e.f=h.f;_.yf(h,1);break;case 4:f=_.zf(h);if(!a.Ra)throw f;return _.y(h,a.Ra(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||_.J.R(a.configuration.suggestedPresentationDelay)||
|
|
154
|
+
isNaN(a.configuration.suggestedPresentationDelay)||(a.log.info("Apply suggested presentation delay of: "+a.configuration.suggestedPresentationDelay),a.f.presentationTimeline.Pe=a.configuration.suggestedPresentationDelay);a.f.presentationTimeline&&(a.f.presentationTimeline.C=!!a.configuration.lowLatencyMode);if(0==a.f.periods.length)throw new _.L(_.M,4,4014);Jz(a.f.periods);_.z(h)}})}),function(){a.log.info("Aborting parser step...");return a.A.stop()});return _.y(d,c.P,0)})};
|
|
155
|
+
Rz=function(a){var b,c,d,e,f;return _.A(function(g){switch(g.a){case 1:a.j=new _.Kl({Ab:a.getNetworkEngine(),onError:function(h){return a.onError(h)},Je:function(h){if(a.a){var l=Lz(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.");
|
|
156
|
+
if(n.length){n=a.getPeriods();for(var q=0;q<n.length;q++)for(var r=n[q],w=_.u(r.variants),x=w.next();!x.done;x=w.next()){x=x.value;var C=[];x.audio&&C.push(x.audio);x.video&&C.push(x.video);C=_.u(C);for(var D=C.next();!D.done;D=C.next()){D=D.value;var E=x.allowedByKeySystem;if(D.keyId){var G=h[p?"00":D.keyId];G=!!G&&!Mz.includes(G);x.allowedByKeySystem=G}E!==x.allowedByKeySystem&&(G=D.type,D.type===_.Pe&&(G="video "+D.width+"x"+D.height+"@"+_.zh(D.bandwidth)),a.log.warn("DRM Key not available for KID: '"+
|
|
157
|
+
(D.keyId+"'. Applying restrictions to "+G)));r===l&&E!==x.allowedByKeySystem&&(m=!0)}}}if(h=Cy(a.a))if(p=Ey(a.a),n=Fy(a.a),p=kx(p,n,h.variants),!p||p.allowedByKeySystem)a.log.info(Mu),Nz(a),Oz(a,h.variants);m&&h!==l&&(a.log.info(Mu),Nz(a),Oz(a,l.variants))}},onExpirationUpdated:function(h,l){if(a.A&&a.A.onExpirationUpdated)a.A.onExpirationUpdated(h,l);a.trigger(new _.I(_.Wc,{expirationTime:l}))},onEvent:function(h){return a.je(h)},getConfiguration:function(){return a.getConfiguration()},Ec:function(){return a.Ec()}});
|
|
158
|
+
Pz(a);c=(b=a.configuration.drm)?b.offlineId||"":"";d=[];e=_.mp(a.f.periods);if(!c){g.H(2);break}f=_.Vj(_.Td);if(!f){g.H(2);break}return _.y(g,f.uj(b,e,a.getNetworkEngine()),4);case 4:return _.y(g,f.hi(c),5);case 5:d=g.f;case 2:return _.y(g,_.Pl(a.j,e,d),6);case 6:a.f&&Qz(a,a.f.periods),_.z(g)}})};
|
|
159
|
+
bA=function(a){var b,c,d,e,f,g,h,l,m,n,p;return _.A(function(q){if(1==q.a)return b=a.h,c=function(r){a.h&&a.D&&(r.type===_.je&&a.Jd?(a.D.a=Vx,Fz(a)):r.type===_.Xe&&a.getState()===_.bn&&.1>a.getBufferInfo().Da(a.getPosition())?(a.D.a=Vx,Fz(a)):a.D&&Sz(a));Tz(a)},d=function(){if(a.h){var r=a.h.playbackRate;0!=r&&a.vc.set(r)}},a.m.on(b,_.Xd,c),a.m.on(b,_.Sd,c),a.m.on(b,_.ed,c),a.m.on(b,_.je,c),a.m.on(b,_.ie,c),a.m.on(b,_.$d,c),a.m.on(b,_.Xe,c),a.m.on(b,_.be,d),a.g||(a.g=new _.Hx,a.g.configure(a.configuration.abr)),
|
|
160
|
+
Uz(a,a.f.periods),a.tc=new Qx(a.configuration.preferredAudioLanguage||[],a.configuration.preferredAudioRole,a.configuration.preferredAudioChannelCount),a.ia=a.configuration.preferredTextLanguage,a.qb=a.configuration.preferredTextRole,_.y(q,_.bm(a.j,b),2);if(3!=q.a){if(!a.j)throw new _.L(_.M,7,7001);a.g.init(function(r,w,x){!a.S&&Vz(a,r,w,x)});a.w=Wz(a,a.configuration.startTime);a.oc=Xz(a);a.vc=new ay({re:function(){return b.playbackRate},pg:function(r){b.playbackRate=r},Di:function(r){b.currentTime+=
|
|
161
|
+
r}});a.isLive()&&a.configuration.streaming.enableLiveEdgeChasing&&(a.Bd=new Yx(a));e=Math.max(1E-4,a.configuration.streaming.rebufferingGoal);Yz(a,e);$w(a.f,_.ai(a.configuration.preferredVideoCodec),_.ai(a.configuration.preferredAudioCodec),a.configuration.preferredAudioChannelCount);a.a=Zz(a);a.a.m=a.configuration.streaming;a.C=vz;return _.y(q,a.a.start(),3)}if(!a.a)throw new _.L(_.M,7,7001);a.configuration.streaming.startAtSegmentBoundary&&(f=vy(a.w),g=$z(a,f),oy(a.w.g,g));h=_.u(a.f.periods);for(l=
|
|
162
|
+
h.next();!l.done;l=h.next())m=l.value,aA(a,m);Nz(a);n=Lz(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");Oz(a,n.variants);a.m.one(b,_.td,function(){a.G.w=Date.now()/1E3-(null===a.ze?0:a.ze)});_.z(q)})};
|
|
163
|
+
Jz=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)})){_.Qf("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)}};Wz=function(a,b){return new ty(a.h,a.f,a.configuration.streaming,b,function(){a.oc&&mw(a.oc,!0);a.a&&Uy(a.a)},function(c){return a.dispatchEvent(c)})};
|
|
164
|
+
Xz=function(a){var b=new Zx(a.f);$x(b,function(){Nz(a)});var c=new ow(a.sc);pw(c,function(e){e.Md&&e.Md();Hz(a,_.pg,e)},function(e){e.Ie&&e.Ie();Hz(a,_.qg,e)},function(e,f){f||(e.Md&&e.Md(),Hz(a,_.pg,e),e.Ie&&e.Ie(),Hz(a,_.qg,e))});var d=new nw(a.h);d.a.add(b);d.a.add(c);return d};Yz=function(a,b){a.D=new Wx(b,Math.min(.5,b/2));a.D.a=Vx;Fz(a);a.ua=(new _.Li(function(){Sz(a)})).ab(.25)};
|
|
165
|
+
Sz=function(a){switch(a.C){case vz:a:if(a.h.ended||Jw(a.I))var b=!0;else{if(a.isLive()){b=$v(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.I){var d=Lw(a.I),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.D){e=a.D;d=c;f=b;var g=e.f.get(e.a);c=e.a;d=f||d>=g?Ux:Vx;e.a=d;e=c!=d}c=e;e=cA(a);c||a.getState()===_.Tm&&!e?(a.log.debug("Buffering state changed. Is buffering",
|
|
166
|
+
e,"buffered to end",b,"state",a.getState()),Fz(a)):a.Rc&&Tz(a)};Zz=function(a){var b={wb:function(){return vy(a.w)},W:a.I,Ab:a.getNetworkEngine(),He:a.uh.bind(a),Ge:a.th.bind(a),onError:a.onError.bind(a),Yf:a.Zi.bind(a),onEvent:a.je.bind(a),cg:a.vh.bind(a),Nd:a.lj.bind(a),pe:function(){return a.g},de:a.Gg.bind(a),rg:a.Mj.bind(a),Zc:a.j};return new _.By(a.f,b)};Pz=function(a){var b=_.ok(a.configuration.drm);a.j.h=b};
|
|
167
|
+
eA=function(a){a.A&&a.A.configure(a.configuration.manifest);a.j&&Pz(a);if(a.a){a.a.m=a.configuration.streaming;try{for(var b=_.u(a.f.periods),c=b.next();!c.done;c=b.next())aA(a,c.value)}catch(e){a.onError(e)}c=Ey(a.a);var d=Fy(a.a);b=Lz(a)||a.f.periods[0];c=kx(c,d,b.variants);a.g&&c&&c.allowedByApplication&&c.allowedByKeySystem?Oz(a,b.variants):(a.log.debug("Choosing new streams after changing configuration"),dA(a,b))}a.g&&(a.g.configure(a.configuration.abr),a.configuration.abr.enabled&&!a.S?a.g.enable():
|
|
168
|
+
a.g.disable())};zx=function(a){if(a.f&&a.w){var b=fA(a),c=[];a=_.u(gA(a));for(var d=a.next();!d.done;d=a.next()){d=d.value;var e=fx(d);e.active=d==b;c.push(e)}return c}return[]};xx=function(a,b){if(a.f&&a.a){var c=Lz(a),d=c.textStreams.find(function(e){return e.id==b.id});d?(hA(a,c,d,!1),iA(a,d),a.ia=d.language):a.log.error(_.Qu,b.id)}};
|
|
169
|
+
Ax=function(a,b,c){var d=void 0===d?0:d;if(a.f&&a.a){var e=Lz(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.O=null;c=Oz(a,e.variants);null!=a.da&&(a.tc=a.da,a.da=null);null==c||a.S||Vz(a,c);return}if(b){a.O=b.id;var f=e.variants.find(function(g){return g.id==
|
|
170
|
+
b.id});f?(a.O=f.video.id,hx(f)?(jA(a,e,f,!1),kA(a,f,c,d),null==a.da&&(a.da=a.tc),a.tc=new Rx(f),Oz(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.O=null,null!=a.da&&(a.tc=a.da,a.da=null),c=Oz(a,e.variants),null==c||a.S||Vz(a,c)}};
|
|
171
|
+
yx=function(a,b){if(a.a&&(a.f||a.w)){var c=Fy(a.a),d=Ey(a.a),e=Ov(a.f.periods,vy(a.w)),f=a.f.periods[e?a.f.periods.indexOf(e):0].variants.filter(function(m){return m.audio.id==b&&hx(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]===
|
|
172
|
+
e.audio.codecs.split(".")[0]){d=e.audio;a.uc=d.id;a.g.setVariants(f);f=Lz(a);jA(a,f,e,!1);g||a.S?kA(a,e,!0,0):_.Ly(a.a,d,!0,0);Promise.resolve();return}a.log.warn("Target audio codecs not compatible with active audio codecs.")}}Promise.reject()};Bx=function(a){var b=a.ye;return a.f?a.I.getTextDisplayer().isTextVisible():b};
|
|
173
|
+
wx=function(a,b){var c,d,e,f;return _.A(function(g){c=a.ye;d=b;if(c==d)return g["return"]();a.ye=d;if(a.C!==vz)return g.H(0);a.I.getTextDisplayer().setTextVisibility(b);if(a.configuration.streaming.alwaysStreamText)return g.H(0);if(!b){var h=a.a;h.J=!0;var l=h.g.get(_.Ae);l&&(Sy(l),h.g["delete"](_.Ae));return g.H(0)}e=Lz(a);f=_.jx(e.textStreams,a.ia,a.qb);return 0<f.length?_.y(g,Ky(a.a,f[0]),0):g.H(0)})};
|
|
174
|
+
jA=function(a,b,c,d){var e=a.getTrackManager();a.A.setCurrentVariant(c);if(e){var f=a.G.A;if(c.video){Ex(e,c.video,d);var g=e.ea();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&&(Ex(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})))}Lx(a.L,
|
|
175
|
+
b).variant=c};hA=function(a,b,c,d){Lx(a.L,b).text=c;if(b=a.getTrackManager())Ex(b,c,d),c=b.Ga(),a=a.G.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}))};
|
|
176
|
+
Uz=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.og++,originalId:l,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:function(){return null},getSegmentReference:function(){return null},initSegmentReference:null,Aa:0,mimeType:_.ac,codecs:"",kind:"caption",
|
|
177
|
+
encrypted:!1,keyId:null,language:g.closedCaptions.get(l),label:null,type:_.Ae,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:g.roles,channelsCount:null,closedCaptions:null};e.set(l,m)}}e=_.u(e.values());for(f=e.next();!f.done;f=e.next())d.textStreams.push(f.value)}};
|
|
178
|
+
Qz=function(a,b){for(var c=a.a?Ey(a.a):null,d=a.a?Fy(a.a):null,e=_.u(b),f=e.next();!f.done;f=e.next())ex(a.j,c,d,f.value);c=Av(b,function(g){return g.variants.some(hx)});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,bx(d.variants,a.configuration.restrictions,a.kg)&&a.a&&Lz(a)==d&&Nz(a),lA(a,d.variants)};
|
|
179
|
+
aA=function(a,b){var c=a.a?Ey(a.a):null,d=a.a?Fy(a.a):null;ex(a.j,c,d,b);d=b.variants;if(!d.some(hx))throw new _.L(_.M,4,4011);lA(a,b.variants);bx(d,a.configuration.restrictions,a.kg)&&a.a&&Lz(a)==b&&Nz(a);if(!_.Th(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,_.em(a.j,g.keyId,g.initData)||_.Wl(a.j,
|
|
180
|
+
g.initDataType,g.initData,g.keyId)}}}};kA=function(a,b,c,d){c=void 0===c?!1:c;d=void 0===d?0:d;a.S?(a.ca=b,a.jg=c,a.hg=d):My(a.a,b,c,d)};iA=function(a,b){a.S?a.X=b:_.Ly(a.a,b,!0,0)};mA=function(a){if(a.a&&a.f){var b=Cy(a.a),c=Lz(a);null!=b&&b==c&&(Ey(a.a),Fy(a.a),_.Dy(a.a,_.Ae),Lx(a.L,c),Lx(a.L,c))}};
|
|
181
|
+
$z=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=Ey(a.a),e=Fy(a.a),f=Lz(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};cA=function(a){return a.j&&a.j.D?!0:a.D?a.D.getState()===Vx:!1};Fz=function(a){if(a.G&&a.D&&a.w){var b=nA(a)===_.Tm,c=a.vc;c.h=b;by(c);a.w.j.m=b;Tz(a)}};Tz=function(a){yz(a,nA(a))};
|
|
182
|
+
nA=function(a){var b=a.getDuration(),c=a.getPosition();return a.h&&a.h.ended||(a.Rc||a.$===_.Vm)&&1>=Math.abs(b-c)?_.Vm:cA(a)||a.Jd?_.Tm:a.h&&a.h.paused?_.an:_.bn};
|
|
183
|
+
Oz=function(a,b){try{lA(a,b)}catch(e){return a.onError(e),null}var c=b.filter(function(e){return hx(e)});c=ox(c,a.uc);var d=a.tc.create(c);d=Array.from(d.values());a.g.setVariants(d);if(null!==a.O&&null!==a.uc&&(d=d.find(function(e){return e.video.id==a.O&&e.audio.id==a.uc}),a.O=null,d))return d;if(a.configuration.abr.enabled||null===a.O)return a.g.chooseVariant();c=c.find(function(e){return null!==e.video&&e.video.id===a.O});return c?c:(a.log.warn("Selected video track not found. Falling back to ABR selection"),
|
|
184
|
+
a.g.chooseVariant())};dA=function(a,b,c){c=void 0===c?!0:c;var d=Oz(a,b.variants);a.uc=d&&d.audio&&d.audio.id;d&&(jA(a,b,d,!0),kA(a,d,c));(c=_.jx(b.textStreams,a.ia,a.qb)[0]||null)&&(a.configuration.streaming.alwaysStreamText||Bx(a))&&(hA(a,b,c,!0),iA(a,c))};
|
|
185
|
+
qA=function(a,b){a.S=!0;a.g.disable();a.log.debug("Choosing new streams after period changed");var c=Oz(a,b.variants),d=_.jx(b.textStreams,a.ia,a.qb)[0]||null;a.ca&&(b.variants.includes(a.ca)&&(c=a.ca),a.ca=null);a.X&&(b.textStreams.includes(a.X)&&(d=a.X),a.X=null);c&&oA(a,b,function(){return jA(a,b,c,!0)});d&&(a.configuration.streaming.alwaysStreamText||Bx(a))&&oA(a,b,function(){return hA(a,b,d,!0)});b===Lz(a)&&pA(a);return a.configuration.streaming.alwaysStreamText||Bx(a)?{variant:c,text:d}:{variant:c,
|
|
186
|
+
text:null}};Vz=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=rA(a,b);oA(a,e,function(){return jA(a,e,b,!0)});e===Lz(a)&&pA(a);a.a&&My(a.a,b,c,d)}};Nz=function(a){var b=a.getTrackManager();b&&a.C!==zz&&(b.l&&(Dx(b),b.l.trigger(new _.I(_.sq))),pA(a))};pA=function(a){var b=Lz(a);if(b){var c=a.wc.get(b)||[];for(a.wc["delete"](b);c.length;)c.shift()()}};oA=function(a,b,c){a.wc.has(b)||a.wc.set(b,[]);a.wc.get(b).push(c)};
|
|
187
|
+
Hz=function(a,b,c){a.trigger(new _.I(b,{detail:{schemeIdUri:c.schemeIdUri,value:c.value,startTime:c.startTime,endTime:c.endTime,id:c.id,eventElement:c.eventElement,type:c.type}}))};
|
|
188
|
+
lA=function(a,b){var c=a.j?_.J.hf(a.j.ia):{},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?Mz.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,
|
|
189
|
+
missingKeys:g,restrictedKeyStatuses:h});};gA=function(a){var b=Lz(a);if(null==b)return[];mA(a);return b.variants.filter(function(c){return hx(c)})};sA=function(a){var b=Lz(a);if(null==b)return[];mA(a);return b.textStreams.filter(function(c){return!a.Gd.has(c)})};Lz=function(a){var b=vy(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};fA=function(a){var b=Lz(a);return b&&Lx(a.L,b).variant};
|
|
190
|
+
rA=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};
|
|
191
|
+
tA=function(a,b,c){var d,e,f,g,h,l,m,n,p,q,r,w,x,C,D,E,G,K,O;return _.A(function(T){switch(T.a){case 1:return d=_.nn,_.xf(T,2),_.y(T,_.tp(b.url,a.getNetworkEngine(),a.configuration.manifest.attemptParameters,b.type||null),4);case 4:return e=T.f,e.configure(a.configuration.manifest),_.y(T,e.start(b.url,Iz(a)),5);case 5:f=T.f;Jz(f.periods);if(!f.periods.length)throw new _.L(_.M,4,4014);return _.y(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=Ov(f.periods,
|
|
192
|
+
vy(a.w))||f.periods[0];$w(a.f,_.ai(a.configuration.preferredVideoCodec),_.ai(a.configuration.preferredAudioCodec),a.configuration.preferredAudioChannelCount);m=px(g,h,l.variants);n=_.jx(l.textStreams,a.ia,a.qb)[0]||null;Oz(a,l.variants);p=m&&m.video;q=m&&m.audio;r=[];w=new Set;x=_.u(l.variants);for(C=x.next();!C.done;C=x.next())D=C.value,D.video&&w.add(D.video),D.audio&&w.add(D.audio);E=_.u(_.kf(w).concat(_.kf(l.textStreams)));for(G=E.next();!G.done;G=E.next())K=G.value,r.push(K.createSegmentIndex());
|
|
193
|
+
return _.y(T,Promise.all(r),7);case 7:tz(a.a,d.AUDIO,q);tz(a.a,d.VIDEO,p);tz(a.a,d.TEXT,n);m&&jA(a,l,m,!1);a.log.info("Switch CDN successful.");_.yf(T,0);break;case 2:O=_.zf(T);if(!e){T.H(8);break}return _.y(T,e.stop(),8);case 8:throw O;}})};
|
|
194
|
+
Iz=function(a){return{networkingEngine:a.getNetworkEngine(),filterNewPeriod:function(b){return aA(a,b)},filterAllPeriods:function(b){return Qz(a,b)},onTimelineCueAdded:function(b){var c=a.sc;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.je(b)},onError:function(b){return a.onError(b)}}};uA=function(){};
|
|
195
|
+
vA=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}};wA=function(){var a=SourceBuffer.prototype.remove;SourceBuffer.prototype.remove=function(b,c){return a.call(this,b,c-.001)}};xA=function(){var a=MediaSource.isTypeSupported;MediaSource.isTypeSupported=function(b){return"mp2t"==b.split(/ *; */)[0].split("/")[1].toLowerCase()?!1:a(b)}};
|
|
196
|
+
yA=function(){var a=MediaSource.isTypeSupported;MediaSource.isTypeSupported=function(b){return"opus"!=_.Fv(b)[0]&&a(b)}};
|
|
197
|
+
zA=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)}};
|
|
198
|
+
AA=function(a){_.aq.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=_.Uc;c.label===Su&&(this.a=c)}this.a||(this.a=a.addTextTrack(_.iv,Su));this.a.mode=_.jd};BA=function(a,b){var c=a.mode;a.mode=c==_.ke?_.ke:_.jd;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};CA=function(){};mv=[112,115,115,104,0,0,0,0];
|
|
199
|
+
_.EA=function DA(a){var c,d,e,f,g,h;return _.Ff(DA,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):_.y(l,{Hd:c,wj:d,item:e,next:void 0},0);h=g.value;return 0<=c?_.y(l,{Hd:c,item:e,wj:d,next:h},5):l.H(5)}c++;d=e;e=h;g=f.next();return l.H(2)})};_.Jv.prototype.track=function(a){null!=this.a&&(this.a&&(this.a.off(_.ge,this.g),this.h&&this.a.off(_.De,this.g)),this.a=null);a&&(this.a=a,this.a.on(_.ge,this.g,this))};
|
|
200
|
+
_.Jv.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=
|
|
201
|
+
b);this.f.push(c);this.f.sort(Iv)}Mv(this);this.g();this.a&&this.a.trigger(new _.I(_.Se))};_.Jv.prototype.clear=function(){this.f=[];Mv(this);this.a&&(this.a.trigger(new _.I(_.Se)),this.a.trigger(new _.I(_.oc)))};
|
|
202
|
+
_.Jv.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 _.I(_.qc,
|
|
203
|
+
{detail:{width:b,height:c,bandwidth:a?a.bandwidth:null,rendition:a}}))}}}};_.Tv.prototype.f=function(){return this.keyInfo};_.Uv.prototype.getPosition=function(){return this.position};_.Uv.prototype.f=function(){return this.keyInfo};_.t=_.Vv.prototype;_.t.getDuration=function(){return this.g};_.t.Rb=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)};
|
|
204
|
+
_.t.isLive=function(){return Infinity==this.g&&!this.j};dw.prototype.release=function(){this.f=function(){};this.a.clear()};dw.prototype.cues=function(){return this.a};fw.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=gw(this);return{value:a,done:!a}};_.t=_.hw.prototype;_.t.destroy=function(){this.a=[];return Promise.resolve()};
|
|
205
205
|
_.t.zc=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
206
|
_.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
207
|
_.t.Oc=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};
|
|
208
|
-
_.t.Va=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 _.
|
|
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
|
-
|
|
208
|
+
_.t.Va=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 _.Uv(f.position,g.startTime,g.endTime,g.Ha,g.Pa,g.Ea,g.Aa,g.keyInfo,g.Xb,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=
|
|
209
|
+
b[b.length-1].position+1;e<a.length;)f=a[e++],f=new _.Uv(d++,f.startTime,f.endTime,f.Ha,f.Pa,f.Ea,f.Aa,f.keyInfo,f.Xb,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 _.Uv(e-d--,f.startTime,f.endTime,f.Ha,f.Pa,f.Ea,f.Aa,f.keyInfo,f.Xb,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=
|
|
210
|
+
a};_.t.replace=function(a){this.a=a};nw.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()};ow.prototype.release=function(){this.j=null;this.h.clear();this.a=function(){};this.f=function(){};this.g=function(){}};
|
|
211
|
+
ow.prototype.m=function(a,b){for(var c={},d=_.u(this.j.cues()),e=d.next();!e.done;c={Yd:c.Yd,nd:c.nd},e=d.next()){e=e.value;c.Yd=this.h.get(e)||null;c.nd=a<e.startTime?1:a>e.endTime?3:2;this.h.set(e,c.nd);var f=this.o.find(function(g){return function(h){return h.nc===g.Yd&&h.mc===g.nd}}(c));f&&f.ac(e,b)}};_.t=sw.prototype;_.t.destroy=function(){this.g=this.o=null;this.m.clear();return Promise.resolve()};
|
|
212
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.cc=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)};
|
|
213
|
-
|
|
214
|
-
_.t.destroy=function(){var a=this;this.I=!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"](
|
|
213
|
+
xw.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()};xw.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()};xw.prototype.f=function(){this.a.resetCaptionStream()};_.yw.prototype.init=function(){};_.yw.prototype.g=function(){};_.yw.prototype.f=function(){};zw.prototype.destroy=function(){this.a&&(this.a.dispose(),this.a=null);return Promise.resolve()};zw.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===_.Pe?this.m.push(b):a.type===_.ic&&this.j.push(b)};zw.prototype.o=function(){var a={video:_.gk.apply(_.Zj,_.kf(this.m)),captions:this.g,audio:_.gk.apply(_.Zj,_.kf(this.j))};this.f.resolve(a);this.h=!1};_.t=_.Ew.prototype;
|
|
214
|
+
_.t.destroy=function(){var a=this;this.I=!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"](wv));for(e=1;e<d.length;++e)d[e].p["catch"](wv),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.C={};a.D=null;a.J=
|
|
215
215
|
!1;for(var g in a.h);a.h={}})};
|
|
216
|
-
_.t.init=function(a,b){var c=this,d;return _.A(function(e){if(1==e.a)return d=_.
|
|
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.Ic=function(a){var b=this.h[a][0];b&&(b.p.resolve(),this.a.debug("Update-End received for "+a),
|
|
226
|
-
_.t.Ta=function(){return this.f.get(_.
|
|
227
|
-
_.t.mb=function(a,b){
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
_.t.chooseVariant=function(){var a=
|
|
216
|
+
_.t.init=function(a,b){var c=this,d;return _.A(function(e){if(1==e.a)return d=_.nn,_.y(e,c.G,2);a.forEach(function(f,g){var h=_.Ii(f.mimeType,f.codecs);if(g==d.TEXT)Iw(c,h);else{var l=new Map;l.set(g,h);if((!MediaSource.isTypeSupported(h)||!b||f.keyInfo)&&Bw(h,g)){c.w[g]=new zw;h="aac"==h.toLowerCase().split(";")[0].split("/")[1]?h.replace(/aac/i,_.Dd):Aw(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=
|
|
217
|
+
q.next()){var w=r.value;w.startsWith("avc")?p.set(_.Pe,'video/mp4;codecs\x3d"'+w+'"'):w.startsWith("mp4a")&&p.set(_.ic,'audio/mp4;codecs\x3d"'+w+'"')}l=0<p.size?p:m}catch(x){l=m}}Hw(c,l)}});_.z(e)})};_.t.rb=function(a){return a===_.Ae?this.g.rb():(a=Kw(this,a))?a.rb():null};_.t.xa=function(a){return a===_.Ae?this.g.xa():(a=Kw(this,a))?a.xa():null};_.t.cc=function(a,b,c){return a===_.Ae?this.g.cc(b):(a=Kw(this,a))?a.cc(b,!1,c):!1};
|
|
218
|
+
_.t.Da=function(a,b){if(a===_.Ae)return this.g.Da(b);var c=Kw(this,a);return c?c.Da(b):0};_.t.remove=function(a,b,c){var d=this;return a===_.Ae?this.g.remove(b,c):Nw(this,a,this.lg.bind(this,a,b,c)).then(function(){if(a===_.Pe){var e=d.rb(a),f=d.xa(a);null!==e&&null!==f&&Nv(d.B,e,f)}else a===_.ic&&(e=d.B,e.a&&e.a.trigger(new _.I(_.oc)))})};_.t.clear=function(a){if(a==_.Ae){if(!this.g)return Promise.resolve();this.D.f();return this.g.remove(0,Infinity)}return Nw(this,a,this.lg.bind(this,a,0,this.m.duration))};
|
|
219
|
+
_.t.flush=function(a){return a==_.Ae?Promise.resolve():Nw(this,a,this.Gf.bind(this,a))};_.t.endOfStream=function(a){var b=this;return Uw(this,function(){Jw(b)||(a?b.m.endOfStream(a):b.m.endOfStream())})};_.t.Rb=function(a){var b=this;Uw(this,function(){b.m.duration=a})};_.t.getDuration=function(){return this.m.duration};
|
|
220
|
+
_.t.ke=function(a,b){this.a.debug("Appending data to "+a+Gu);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+Gu)};_.t.lg=function(a,b,c){if(c<=b)this.Ic(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)}};
|
|
221
|
+
_.t.Ag=function(a){try{this.a.debug("Aborting operations for "+a+Gu);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+Gu,d),d;}this.a.debug("Done Aborting operations for "+a+Gu);this.Ic(a)};
|
|
222
|
+
_.t.Gf=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.Ic(a)};
|
|
223
|
+
_.t.qg=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.Ic(a)};
|
|
224
|
+
_.t.Gj=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.Ic(a)};_.t.T=function(a){this.h[a][0].p.reject(new _.L(_.M,3,3014,{mediaError:this.j.error?this.j.error.code:0}))};
|
|
225
|
+
_.t.Ic=function(a){var b=this.h[a][0];b&&(b.p.resolve(),this.a.debug("Update-End received for "+a),Tw(this,a))};_.t.getTextDisplayer=function(){return this.A};var Gw=window.URL.createObjectURL;_.v(qx,_.R);_.t=qx.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 rx(this,_.fi)};_.t.getAudioTracks=function(){return rx(this,_.Q)};_.t.fa=function(){return rx(this,_.P)};_.t.ea=function(){return this.a.get(_.fi)||null};_.t.Fa=function(){return this.a.get(_.Q)||null};_.t.Ga=function(){return this.a.get(_.P)||null};
|
|
226
|
+
_.t.Ta=function(){return this.f.get(_.fi)||null};_.t.eb=function(){return this.f.get(_.Q)||null};_.t.fb=function(){return this.f.get(_.P)||null};_.t.Ia=function(){return sx(this,_.fi)};_.t.ka=function(){return sx(this,_.Q)};_.t.la=function(){return sx(this,_.P)};_.t.$a=function(a){ux(this,_.fi,a)};_.t.ra=function(a){ux(this,_.Q,a)};_.t.Ba=function(a){ux(this,_.P,a)};_.t.Za=function(a,b){tx(this,_.fi,a,void 0===b?!1:b)};_.t.lb=function(a,b){tx(this,_.Q,a,void 0===b?!1:b)};
|
|
227
|
+
_.t.mb=function(a,b){tx(this,_.P,a,void 0===b?!1:b)};_.t.addTextTrack=function(a){var b=this;return _.A(function(c){return b.l?_.y(c,b.l.addTextTrack(a.url,a.language,a.kind,a.mimeType,a.codec,a.label),0):c.H(0)})};_.t.ha=function(){return!!this.l&&this.l.ha()};qx.prototype.isAbrEnabled=qx.prototype.ha;qx.prototype.addTextTrack=qx.prototype.addTextTrack;qx.prototype.setTextRendition=qx.prototype.mb;qx.prototype.setAudioRendition=qx.prototype.lb;qx.prototype.setVideoRendition=qx.prototype.Za;
|
|
228
|
+
qx.prototype.setTextTrack=qx.prototype.Ba;qx.prototype.setAudioTrack=qx.prototype.ra;qx.prototype.setVideoTrack=qx.prototype.$a;qx.prototype.getTextTrack=qx.prototype.la;qx.prototype.getAudioTrack=qx.prototype.ka;qx.prototype.getVideoTrack=qx.prototype.Ia;qx.prototype.getLoadingTextRendition=qx.prototype.fb;qx.prototype.getLoadingAudioRendition=qx.prototype.eb;qx.prototype.getLoadingVideoRendition=qx.prototype.Ta;qx.prototype.getTextRendition=qx.prototype.Ga;qx.prototype.getAudioRendition=qx.prototype.Fa;
|
|
229
|
+
qx.prototype.getVideoRendition=qx.prototype.ea;qx.prototype.getTextTracks=qx.prototype.fa;qx.prototype.getAudioTracks=qx.prototype.getAudioTracks;qx.prototype.getVideoTracks=qx.prototype.getVideoTracks;_.t=_.Hx.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};
|
|
230
|
+
_.t.chooseVariant=function(){var a=Ix(!this.B&&this.a.initialRestrictions?this.a.initialRestrictions:this.a.restrictions,this.o),b=Gx(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=Ix(null,this.o),a=[a[0]]);var c=a[0]||null;a=_.u(_.EA(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
231
|
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.unload=function(){var a=this;
|
|
240
|
-
_.t.release=function(){var a=this;return _.A(function(b){if(a.U)return b["return"](a.U);a.U=new Promise(function(c,d){try{var e=a.Nb;a.Nb=null;var f=e;e&&(f=e["catch"](function(){}));f?f=f.then(function(){return _.
|
|
241
|
-
_.t.getBufferInfo=function(a){if(this.I){var b=
|
|
242
|
-
_.t.getDuration=function(){return this.f?this.f.presentationTimeline.getDuration():Infinity};_.t.destroy=function(){var a=this;return _.A(function(b){if(1==b.a)return _.y(b,_.
|
|
243
|
-
_.t.load=function(a){var b=this,c,d,e,f,g,h,l,m;return _.A(function(n){switch(n.a){case 1:if(b.C===
|
|
244
|
-
_.
|
|
245
|
-
|
|
246
|
-
_.t.getSeekRange=function(){if(this.f){var a=this.f.presentationTimeline;return{start:
|
|
247
|
-
_.t.setPlaybackRate=function(a){if(0===a)this.log.warn("A trick play rate of 0 is unsupported!");else if(this.C
|
|
248
|
-
_.t.
|
|
249
|
-
_.t.getStats=function(){if(this.C
|
|
250
|
-
_.t.getTimelineCues=function(){return this.sc?_.
|
|
251
|
-
_.t.addTextTrack=function(a,b,c,d,e,f){var g=this,h,l,m,n,p,q,r,w,x;return _.A(function(
|
|
252
|
-
findSegmentPosition:function(){return 1},getSegmentReference:function(D){return 1==D?r:null},adjustSegmentDurations:function(){},getDuration:function(){return q},segmentLookupStrategy:_.
|
|
253
|
-
x;g.
|
|
254
|
-
_.t.
|
|
255
|
-
_.t.
|
|
256
|
-
|
|
257
|
-
_.t.
|
|
258
|
-
_.y(n,b.Ra(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(),
|
|
259
|
-
|
|
260
|
-
_.
|
|
261
|
-
_.t.append=function(a){function b(e){if(e.startTime>=e.endTime)_.F("Invalid cue times: "+e.startTime+" - "+e.endTime),e=null;else{var f=e.payload||"";f=f.replace(/<br\s*\/?>/igm,"\n");f=_.
|
|
262
|
-
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;
|
|
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;_.Qv(c.f,e,d);_.Qv(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...");
|
|
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(Gx(this.g,this.a.defaultBandwidthEstimate)/1E3)+" kbps");this.w(c)}};_.t.playbackRateChanged=function(a){this.m=a};_.t.getBandwidthEstimate=function(){return Gx(this.g,this.a.defaultBandwidthEstimate)};_.t.setVariants=function(a){this.o=a};_.t.configure=function(a){this.a=a};
|
|
234
|
+
_.t.reset=function(){this.A=!1;this.g=new Fx;var a=this.chooseVariant();a&&this.w(a)};Jx.prototype.clear=function(){this.a.clear()};Mx.prototype.add=function(a){if(Px(this.f,a))return this.a.add(a),!0;_.F("Rejecting variant - not compatible with root.");return!1};Mx.prototype.values=function(){return this.a.values()};Rx.prototype.create=function(a){var b=this,c=a.filter(function(d){return Px(b.a,d)});return c.length?new Mx(c[0],c):this.f.create(a)};
|
|
235
|
+
Qx.prototype.create=function(a){var b=Sx(a,this.g);0<b.length&&(a=b);b=!1;if(this.a){var c=Tx(a,this.a);0<c.length?(a=c,b=!0):_.F("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=Ww(a,this.f),b.length?a=b:_.F("No exact match for the channel count could be found."));b=new Mx(a[0]);a=_.u(a);for(c=a.next();!c.done;c=a.next())c=c.value,Px(b.f,c)&&b.add(c);return b};Wx.prototype.getState=function(){return this.a};var Vx=0,Ux=1;Yx.prototype.release=function(){this.h.release()};Zx.prototype.release=function(){this.a=this.g=null;this.f=function(){}};Zx.prototype.m=function(a){var b=this.a,c=this.g.periods;a=Ov(c,a)||c[0];b!=a&&this.f(a);this.a=a};ay.prototype.release=function(){this.f&&(this.f.stop(),this.f=null);this.a=null};ay.prototype.set=function(a){this.g=a;by(this)};dy.prototype.release=function(){this.g=null;this.f=function(){}};hy.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.C=this.B=null;this.m=!1};hy.prototype.Nd=function(){this.w=!0;gy(this)};ly.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};iy.prototype.release=function(){this.a&&(this.a.stop(),this.a=null);this.f=null};ty.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 zy=new _.Lm(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])});_.By.prototype.destroy=function(){for(var a=_.u(this.g.values()),b=a.next();!b.done;b=a.next())Sy(b.value);this.g.clear();this.w.clear();this.m=this.o=this.G=this.h=this.f=null;this.j=!0;return Promise.resolve()};
|
|
236
|
+
_.By.prototype.start=function(){var a=this,b,c,d;return _.A(function(e){if(1==e.a){b=a.f.wb();c=Hy(a,b);d=a.f.He(a.h.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 _.y(e,Wy(a,d.variant?d.variant.audio:null,d.variant?d.variant.video:null,d.text,b),2)}if(a.j)return e["return"]();a.a.debug("init: completed initial Stream setup");a.f&&a.f.aj&&(a.a.debug("init: calling onInitialStreamsSetup()..."),a.f.aj());_.z(e)})};
|
|
237
|
+
_.By.prototype.K=function(a,b,c,d){var e=lv(d.F),f=lv(d.F),g=_.U(d.F),h=_.U(d.F),l=_.U(d.F),m=_.U(d.F);d=_.Ek(d.F,d.F.ya()-d.F.getPosition());a=a.startTime+b.startTime+h/g;if(c.includes(e))if("urn:mpeg:dash:event:2012"==e)this.f.cg();else this.f.onEvent(new _.I("emsg",{detail:{startTime:a,endTime:a+l/g,schemeIdUri:e,value:f,timescale:g,presentationTimeDelta:h,eventDuration:l,id:m,messageData:d}}))};
|
|
238
|
+
_.By.prototype.L=function(a){var b=this,c=!1,d=0;(new _.Fk).M(_.Cd,_.Gk).M(_.Ee,_.Gk).M(_.xd,_.Gk).M(_.Bd,_.Gk).M(_.se,_.Gk).V(_.ue,_.Hk).M("encv",function(e){e.F.skip(78);_.Gk(e)}).M("pasp",function(e){d=e.start+e.te;var f=_.U(e.F),g=_.U(e.F);c=f!==g;b.a.debug("hSpacing\x3d"+f+", vSpacing\x3d"+g+", updatePASP\x3d"+c);e.Wa.stop()}).parse(a.data);c&&(a=new _.tk(new DataView(a.data)),a.seek(d),_.S(a,1),_.S(a,1))};_.dz="iterateSegmentReference";_.v(wz,_.Tj);_.t=wz.prototype;_.t.init=function(a,b){var c=a.getMedia();_.Tj.prototype.init.call(this,a,b);Cz(this,c)};_.t.namespace=function(){return Zu};_.t.Af=function(){return new qx};_.t.getState=function(){return this.$};_.t.getDrmInfo=function(){return this.j?this.j.getDrmInfo():null};
|
|
239
|
+
_.t.unload=function(){var a=this;wx(this,!1);this.Rc=!1;if(this.o){var b=this.getTrackManager();b&&b.release();return this.C===zz?Promise.resolve():Ez(this).then(function(){a.log.debug(_.jb,a.o);a.o=null;a.Ae=0;a.uc=null;a.O=null})}return Promise.resolve()};
|
|
240
|
+
_.t.release=function(){var a=this;return _.A(function(b){if(a.U)return b["return"](a.U);a.U=new Promise(function(c,d){try{var e=a.Nb;a.Nb=null;var f=e;e&&(f=e["catch"](function(){}));f?f=f.then(function(){return _.Tj.prototype.release.call(a)}):f=_.Tj.prototype.release.call(a);f=f.then(function(){return a.unload()});f.then(function(){yz(a,_.Om);a.U=null;c()})["catch"](function(g){a.U=null;d(g)})}catch(g){a.U=null,d(g)}});return b["return"](a.U)})};
|
|
241
|
+
_.t.getBufferInfo=function(a){if(this.I){var b=Lw(this.I),c=new _.Ij(void 0,a);switch(a){case _.fi: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.Wc?(b=Kv(this.Wc),Gv(b,a)):_.Tj.prototype.getBufferInfo.call(this,a)};_.t.getPosition=function(){return this.w?vy(this.w):_.Tj.prototype.getPosition.call(this)};_.t.getPresentationStartTime=function(){return this.f?this.f.presentationTimeline.getPresentationStartTime():null};
|
|
242
|
+
_.t.getDuration=function(){return this.f?this.f.presentationTimeline.getDuration():Infinity};_.t.destroy=function(){var a=this;return _.A(function(b){if(1==b.a)return _.y(b,_.Tj.prototype.destroy.call(a),2);if(3!=b.a){if(a.C===zz)return b["return"]();a.log.debug("Destroying player...");a.C=zz;return _.y(b,Bz(a),3)}a.m&&(a.m.release(),a.m=null);a.g=null;_.z(b)})};
|
|
243
|
+
_.t.load=function(a){var b=this,c,d,e,f,g,h,l,m;return _.A(function(n){switch(n.a){case 1:if(b.C===zz)return n["return"](Promise.reject(new _.L(_.M,7,7E3)));c=new _.Mh;d=function(){return b.Nb!==c};e=function(){b.log.info("Aborting current load");throw new _.L(_.M,7,7E3);};b.Nb=c;_.xf(n,2);d()&&e();if(!b.U){n.H(4);break}_.xf(n,5);return _.y(n,b.U,7);case 7:_.yf(n,6,2);break;case 5:_.zf(n,2);case 6:d()&&e();case 4:return b.G=new _.Jm,b.ze=Date.now()/1E3,yz(b,_.$m),b.o=_.fn(a),_.Sj(a)&&(b.configuration=
|
|
244
|
+
_.Rj(b.xd,a)),b.log.info(_.Sa,b.configuration),b.log.info(_.eb,b.o),(f=b.getTrackManager())&&f.load(),g=b.getSurface().getMedia(),g.loop=!!b.configuration.loop,_.J.R(b.configuration.volume)||b.setVolume(b.configuration.volume),_.J.R(b.configuration.muted)||b.setMuted(b.configuration.muted),eA(b),h=b.o[b.getSourceIndex()],d()&&e(),_.y(n,Cz(b,g),8);case 8:return d()&&e(),_.y(n,Dz(b,g),9);case 9:return d()&&e(),_.y(n,Gz(b,h),10);case 10:return d()&&e(),_.y(n,Kz(b,h),11);case 11:return d()&&e(),_.y(n,
|
|
245
|
+
Rz(b),12);case 12:return d()&&e(),_.y(n,bA(b),13);case 13:d()&&e();c.resolve();_.yf(n,0);break;case 2:throw m=l=_.zf(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.gg=function(){this.log.debug("User seeking finished");this.D&&Sz(this);Tz(this)};
|
|
246
|
+
_.t.getSeekRange=function(){if(this.f){var a=this.f.presentationTimeline;return{start:cw(a,0),end:bw(a)}}return{start:0,end:0}};_.t.getPlaybackRate=function(){if(this.vc){var a=this.vc;a=a.h?0:a.g}else a=0;return a};
|
|
247
|
+
_.t.setPlaybackRate=function(a){if(0===a)this.log.warn("A trick play rate of 0 is unsupported!");else if(this.C===vz){this.vc.set(a);this.g.playbackRateChanged(a);var b=this.a,c=1<Math.abs(a);if(a=b.g.get(_.Pe)){var d=a.stream;if(d)if(b.a.debug("setTrickPlay",c),c)(c=d.trickModeVideo)&&!a.Pb&&(b.a.debug("Engaging trick mode stream",c),_.Ly(b,c,!1,0),a.Pb=d);else if(d=a.Pb)b.a.debug("Restoring non-trick-mode stream",d),a.Pb=null,_.Ly(b,d,!0,0)}}};
|
|
248
|
+
_.t.fa=function(){if(this.f&&this.w){var a=Lz(this);if(null==a)a=null;else{if(!Lx(this.L,a).text){var b=_.jx(a.textStreams,this.ia,this.qb);b.length&&(b=b[0],Lx(this.L,a).text=b)}a=Lx(this.L,a).text}b=[];for(var c=_.u(sA(this)),d=c.next();!d.done;d=c.next()){d=d.value;var e=gx(d);e.active=d==a;b.push(e)}return b}return[]};_.t.getPeriods=function(){return this.f.periods};
|
|
249
|
+
_.t.getStats=function(){if(this.C!==vz)return _.Km();Tz(this);var a=this.h;if(a.getVideoPlaybackQuality){a=a.getVideoPlaybackQuality();var b=this.G,c=Number(a.totalVideoFrames);b.j=Number(a.droppedVideoFrames);b.h=c}if(this.C===vz){if(a=fA(this))this.G.m=a.bandwidth;a&&a.video&&(b=this.G,c=a.video.height||NaN,b.o=a.video.width||NaN,b.g=c);a=this.g.getBandwidthEstimate();this.G.f=a}return this.G.getStats()};
|
|
250
|
+
_.t.getTimelineCues=function(){return this.sc?_.kf(this.sc.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()};
|
|
251
|
+
_.t.addTextTrack=function(a,b,c,d,e,f){var g=this,h,l,m,n,p,q,r,w,x;return _.A(function(C){if(1==C.a){if(g.C!==vz)throw g.log.error("Must call load() and wait for it to resolve before adding text tracks."),Error("State error!");h=Lz(g);l=_.nn;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 _.Uv(1,0,q,function(){return[a]},0,null,0);w={id:g.og++,originalId:null,createSegmentIndex:Promise.resolve.bind(Promise),
|
|
252
|
+
findSegmentPosition:function(){return 1},getSegmentReference:function(D){return 1==D?r:null},adjustSegmentDurations:function(){},getDuration:function(){return q},segmentLookupStrategy:_.av,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.Gd.add(w);h.textStreams.push(w);return _.y(C,Ky(g.a,w),2)}if(x=_.Dy(g.a,_.Ae))Lx(g.L,h).text=
|
|
253
|
+
x;g.Gd["delete"](w);g.log.debug("Choosing new streams after adding a text stream");dA(g,h);Nz(g);return C["return"](gx(w))})};_.t.uh=function(a){this.log.debug(_.cv,a);try{this.log.debug("onChooseStreams_, choosing variant from ",a.variants);this.log.debug("onChooseStreams_, choosing text from ",a.textStreams);var b=qA(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}}};
|
|
254
|
+
_.t.th=function(){this.log.debug("canSwitch_");this.S=!1;this.configuration.abr.enabled&&this.g.enable();this.ca&&(My(this.a,this.ca,this.jg,this.hg),this.ca=null);this.X&&(_.Ly(this.a,this.X,!0,0),this.X=null)};_.t.vh=function(){this.A&&this.A.update&&this.A.update()};_.t.lj=function(){this.w&&this.w.j.Nd()};
|
|
255
|
+
_.t.Gg=function(a,b,c){if((void 0===c?"":c)===bv)return Nz(this),this.ha()||(this.configuration.abr.enabled=!0,this.g.enable()),dA(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.ha()){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)}Nz(this);this.ha()||(this.configuration.abr.enabled=!0,this.g.enable());
|
|
256
|
+
dA(this,b)}return c};_.t.Zi=function(){this.log.debug("endOfStream called by streaming engine");this.Rc=!0};_.t.onError=function(a){if(this.C!==zz&&7001!==a.code&&7E3!==a.code){var b=new _.I(_.fd,{detail:a});a.severity===_.M&&yz(this,_.Zm);this.trigger(b);b.defaultPrevented&&(b.a=!0)}};_.t.je=function(a){a.type===_.$c?this.dispatchEvent(a):"largegap"!==a.type&&(a.type===_.Ye?Fz(this):"emsg"!==a.type&&(a instanceof _.I?this.dispatchEvent(a):this.log.debug(_.xb,a.type)))};_.t.ha=function(){return this.configuration.abr.enabled};
|
|
257
|
+
_.t.Mj=function(a){var b=this,c,d,e,f,g,h,l,m;return _.A(function(n){switch(n.a){case 1:if(!b.Ra)return n["return"]();b.log.info("Attempt to switch CDN.");c=b.getLoadedSource();d=b.ha();return _.y(n,b.Ra(c.url,a),2);case 2:e=n.f;if(!e)return n["return"]();f=_.J.Va(b.getLoadedSource(),{url:e});d&&b.g.disable();return _.y(n,sz(b.a),3);case 3:g=fA(b);case 4:return h=!1,_.xf(n,7),b.log.info("Switching CDN to "+f.url+"."),_.y(n,tA(b,f,g),9);case 9:_.yf(n,6);break;case 7:return l=_.zf(n),b.log.info("Switch failed"),
|
|
258
|
+
_.y(n,b.Ra(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(),nz(b.a,!0),b.o[b.getSourceIndex()]=f,a.f=!0,b.trigger(new _.I(_.yc,{newManifest:f.url})),_.z(n))}})};var zz=0,uz=1,vz=2,Mz=[_.Rd,_.md];uA.prototype.a=function(){return Zu};
|
|
259
|
+
uA.prototype.canPlay=function(a,b){if(_.Si())return 0;var c=a.type||"",d=window.MediaSource&&MediaSource.isTypeSupported?!0:!1,e=window.MediaSource&&MediaSource.isTypeSupported?c in _.up||_.vp(a.url)in _.wp?!0:!1:!1;if(d&&e){if(_.Th(2))return 1;if(_.Ti()&&c===_.tj){if(b.streaming.preferNativeHlsOnSafari)return 1;_.F("Support for MSE + FairPlay on Apple is experimental. In case of issues, consider using native HLS.")}return 2}return 0};uA.prototype.create=function(){return new wz};_.Xf(new uA);_.Rn(function(){_.Qf("MediaSource.install");if(window.MediaSource)if(window.cast&&cast.__platform__&&cast.__platform__.canDisplayType)_.Pf("Patching Chromecast MSE bugs."),zA();else if(_.Ti()){var a=navigator.appVersion;a=0<=a.indexOf("Version")?parseInt(a.match(/Version\/(\d+)/)[1],10):13;xA();10>=a?(_.Pf("Blacklisting MSE on Safari \x3c\x3d 10."),window.MediaSource=null):12>=a?(_.Pf("Patching Safari 11 \x26 12 MSE bugs."),vA(),wA()):(_.Pf("Patching Safari 13 MSE bugs."),vA())}else _.Th(2)||_.Th(3)||
|
|
260
|
+
_.Th(4)?yA():_.Pf("Using native MSE as-is.");else _.Pf("No MSE implementation available.")});_.v(AA,_.aq);_.t=AA.prototype;
|
|
261
|
+
_.t.append=function(a){function b(e){if(e.startTime>=e.endTime)_.F("Invalid cue times: "+e.startTime+" - "+e.endTime),e=null;else{var f=e.payload||"";f=f.replace(/<br\s*\/?>/igm,"\n");f=_.Bh(f);f=new VTTCue(e.startTime,e.endTime,f);f.line=-1;try{f.align=_.Ac}catch(g){f.align="middle"}e.writingMode===_.Ne?f.vertical="lr":e.writingMode===_.Oe&&(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?
|
|
262
|
+
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;BA(this.a,function(c){return c.startTime<b&&c.endTime>a});return!0};_.t.isTextVisible=function(){return this.a.mode==_.ke};_.t.setTextVisibility=function(a){null!==this.a&&(this.a.mode=a?_.ke:_.jd)};_.t.destroy=function(){this.a&&BA(this.a,function(){return!0});this.a=null;return Promise.resolve()};CA.prototype.aa=function(){return!0};CA.prototype.create=function(a){return new AA(a)};_.wm("single-native",new CA);};
|
|
263
263
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
264
264
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
265
265
|
else{_=this.clpp._;(f.call(g,this));}
|