@castlabs/prestoplay 6.25.0 → 6.25.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 +9 -1
- package/cjs/cl.airplay.js +3 -3
- package/cjs/cl.broadpeak.js +4 -4
- package/cjs/cl.cast.js +38 -38
- package/cjs/cl.conviva.js +14 -14
- package/cjs/cl.core.js +115 -115
- package/cjs/cl.crypto.js +2 -2
- package/cjs/cl.dash.js +21 -21
- package/cjs/cl.freewheel.js +8 -8
- package/cjs/cl.hls.js +42 -42
- package/cjs/cl.htmlcue.js +7 -7
- package/cjs/cl.ima.js +9 -9
- package/cjs/cl.mse.js +46 -46
- package/cjs/cl.muxdata.js +6 -6
- package/cjs/cl.playlist.js +4 -4
- package/cjs/cl.sessions.js +5 -5
- package/cjs/cl.simid.js +2 -2
- package/cjs/cl.smooth.js +19 -19
- package/cjs/cl.thumbnails.js +2 -2
- package/cjs/cl.tizen.js +18 -18
- package/cjs/cl.ttml.js +5 -5
- package/cjs/cl.verimatrix.js +1 -1
- package/cjs/cl.vimond.js +4 -4
- package/cjs/cl.vr.js +7 -7
- package/cjs/cl.vtt.js +1 -1
- package/cjs/cl.youbora.js +6 -6
- package/cl.airplay.js +1 -1
- package/cl.cast.js +11 -11
- package/cl.conviva.js +1 -1
- package/cl.core.js +61 -61
- package/cl.crypto.js +2 -2
- package/cl.dash.js +10 -10
- package/cl.freewheel.js +1 -1
- package/cl.hls.js +9 -9
- package/cl.htmlcue.js +2 -2
- package/cl.ima.js +3 -3
- package/cl.mse.js +11 -11
- package/cl.muxdata.js +1 -1
- package/cl.playlist.js +1 -1
- package/cl.smooth.js +10 -10
- package/cl.tizen.js +3 -3
- package/cl.ttml.js +2 -2
- package/cl.vimond.js +1 -1
- package/cl.vr.js +2 -2
- package/cl.vtt.js +1 -1
- package/cl.youbora.js +4 -4
- package/clpp.styles.css +4 -0
- package/package.json +1 -1
- package/typings.d.ts +9 -11
package/cl.crypto.js
CHANGED
|
@@ -4,6 +4,6 @@ g),b.onError(new _.I(1,7,7104,null,g)),c}try{const g=a.l?new QV:new RV;yield g.i
|
|
|
4
4
|
this.C;const e=a[0],f=a[1],g=a[2];a=a[3];var b=this.l;const h=b[0],k=b[1],l=b[2];b=b[3];const m=new Uint32Array(256);let n=0,r=0,u;for(u=0;256>u;u++)m[u]=128>u?u<<1:u<<1^283;for(u=0;256>u;u++){let v=r^r<<1^r<<2^r<<3^r<<4;v=v>>>8^v&255^99;c[n]=v;d[v]=n;const y=m[n],A=m[y],E=m[A];let G=257*m[v]^16843008*v;e[n]=G<<24|G>>>8;f[n]=G<<16|G>>>16;g[n]=G<<8|G>>>24;a[n]=G;G=16843009*E^65537*A^257*y^16843008*n;h[v]=G<<24|G>>>8;k[v]=G<<16|G>>>16;l[v]=G<<8|G>>>24;b[v]=G;n?(n=y^m[m[m[E^y]]],r^=m[m[r]]):n=r=1}}}importKey(a){a=
|
|
5
5
|
MV(a);for(var b=!0,c=0;c<a.length&&b;)b=a[c]===this.w[c],c++;if(b)return new Promise(m=>m());this.w=a;this.a=a.length;if(4!==this.a&&6!==this.a&&8!==this.a)throw Error("Invalid aes key size\x3d"+this.a);this.h=4*(this.a+7);this.f=new Uint32Array(this.h);this.j=new Uint32Array(this.h);b=this.A;const d=this.B;var e=this.l;c=e[0];const f=e[1],g=e[2],h=e[3];let k=0,l=0;for(e=0;e<this.h;e++)e<this.a?k=this.f[e]=a[e]:(l=k,0===e%this.a?(l=l<<8|l>>>24,l=b[l>>>24]<<24|b[l>>>16&255]<<16|b[l>>>8&255]<<8|b[l&
|
|
6
6
|
255],l^=d[e/this.a|0]<<24):6<this.a&&4===e%this.a&&(l=b[l>>>24]<<24|b[l>>>16&255]<<16|b[l>>>8&255]<<8|b[l&255]),k=(this.f[e-this.a]^l)>>>0,this.f[e]=k);for(a=0;a<this.h;a++)e=this.h-a,l=a&3?this.f[e]:this.f[e-4],this.j[a]=4>a||4>=e?l:c[b[l>>>24]]^f[b[l>>>16&255]]^g[b[l>>>8&255]]^h[b[l&255]],this.j[a]>>>=0;return new Promise(m=>m())}decrypt(a,b){let c=0;const d=this.a+6,e=this.j,f=this.o;var g=this.l;const h=g[0],k=g[1],l=g[2];g=g[3];var m=MV(b);b=m[0];let n=m[1],r=m[2];m=m[3];a=_.ej(a);const u=new Int32Array(a.length);
|
|
7
|
-
let v,y,A;let E,G,X,dd,
|
|
8
|
-
e[
|
|
7
|
+
let v,y,A;let E,G,X,dd,ec,Nb,Yd,Ob,fc;const gc=this.F.bind(this);for(;c<a.length;){dd=gc(a[c]);ec=gc(a[c+1]);Nb=gc(a[c+2]);Yd=gc(a[c+3]);E=dd^e[0];G=Yd^e[1];X=Nb^e[2];var Fb=ec^e[3];Ob=4;for(fc=1;fc<d;fc++)v=h[E>>>24]^k[G>>16&255]^l[X>>8&255]^g[Fb&255]^e[Ob],y=h[G>>>24]^k[X>>16&255]^l[Fb>>8&255]^g[E&255]^e[Ob+1],A=h[X>>>24]^k[Fb>>16&255]^l[E>>8&255]^g[G&255]^e[Ob+2],Fb=h[Fb>>>24]^k[E>>16&255]^l[G>>8&255]^g[X&255]^e[Ob+3],E=v,G=y,X=A,Ob+=4;v=f[E>>>24]<<24^f[G>>16&255]<<16^f[X>>8&255]<<8^f[Fb&255]^
|
|
8
|
+
e[Ob];y=f[G>>>24]<<24^f[X>>16&255]<<16^f[Fb>>8&255]<<8^f[E&255]^e[Ob+1];A=f[X>>>24]<<24^f[Fb>>16&255]<<16^f[E>>8&255]<<8^f[G&255]^e[Ob+2];Fb=f[Fb>>>24]<<24^f[E>>16&255]<<16^f[G>>8&255]<<8^f[X&255]^e[Ob+3];Ob+=3;u[c]=gc(v^b);u[c+1]=gc(Fb^n);u[c+2]=gc(A^r);u[c+3]=gc(y^m);b=dd;n=ec;r=Nb;m=Yd;c+=4}return new Promise(ib=>{{var va=u.buffer;const xb=va.byteLength,Bc=xb&&(new DataView(va)).getUint8(xb-1);va=Bc?va.slice(0,xb-Bc):va}ib(va)})}destroy(){this.B=this.j=this.f=this.l=this.C=this.o=this.A=this.h=
|
|
9
9
|
this.a=this.w=null;return new Promise(a=>a())}F(a){return a<<24|(a&65280)<<8|(a&16711680)>>8|a>>>24}};var QV=class{constructor(){this.a=null}importKey(a){const b=this;return _.x(function*(){b.a=yield crypto.subtle.importKey("raw",a,{name:"AES-CBC"},!1,["decrypt"])})}decrypt(a,b){const c=this;return _.x(function*(){return yield crypto.subtle.decrypt({name:"AES-CBC",iv:b},c.a,a)})}destroy(){this.a=null;return new Promise(a=>a())}};_.z("clpp.crypto.CryptoComponent",class extends _.Kv{constructor(){super();this.j={};this.l=!1;this.g=new _.S("clpp.crypto")}f(){if(window.crypto&&crypto.subtle){var a=crypto.subtle.decrypt;a=typeof crypto.subtle.importKey===_.ne&&typeof a===_.ne}else a=!1;(this.l=a)||this.g.warn("No WebCrypto APIs found. Will fallback to software AES")}o(a){const b=OV(this,a);a.getNetworkEngine().Ec(b)}a(){this.j={}}id(){return"crypto"}});};f.call(g, window);
|
package/cl.dash.js
CHANGED
|
@@ -8,9 +8,9 @@ a},zO=function(a){return a?"true"===a.toLowerCase():!1},AO=function(a,b,c,d,e){c
|
|
|
8
8
|
a),k=void 0);"Time"===h&&(m=Math.round(m));switch(l){case void 0:case "d":case "i":case "u":g=m.toString();break;case "o":g=m.toString(8);break;case "x":g=m.toString(16);break;case "X":g=m.toString(16).toUpperCase();break;default:g=m.toString()}k=window.parseInt(k,10)||1;return Array(Math.max(0,k-g.length)+1).join("0")+g})},DO=function(a,b){var c=BO(a,b,dO);let d=1;c&&(d=wO(c)||1);c=BO(a,b,VN);(c=wO(c||""))&&(c/=d);let e=Number(BO(a,b,aO))||0,f=e/d||0;a.Jh&&null!=a.pd&&a.pd!==f&&(_.C("The stream is non-compliant with the DASH spec. The value of `presentationTimeOffset` has changed during the transition from dynamic to static manifest, which is not allowed. The last "+
|
|
9
9
|
`value will be ignored. (Period ID: ${a.La.id}, `+`Representation ID: ${a.P.id})`),e=a.pd*d,f=a.pd);var g=BO(a,b,"startNumber");let h=xO(g||"");if(null==g||null==h)h=1;g=BO(a,b,"endNumber");g=null!==g?xO(g||""):null;var k=CO(a,b,SN),l=null;if(k){{l=d;var m=e,n=a.Ea.duration||Infinity;const A=_.Dn;k=A.a(k,"S");const E=[];var r=0;for(let G=0;G<k.length;++G){var u=k[G],v=A.Z(u,"t",xO);const X=A.Z(u,"d",xO);var y=A.Z(u,"r",vO);null!=v&&(v-=m);if(!X){_.C('"S" element must have a duration:',ZN,u);break}v=
|
|
10
10
|
null!=v?v:r;y=y||0;if(0>y)if(G+1<k.length){y=A.Z(k[G+1],"t",xO);if(null==y){_.C('An "S" element cannot have a negative repeat','if the next "S" element does not have a valid start time:',ZN,u);break}else if(v>=y){_.C('An "S" element cannot have a negative repeat if its start ','time exceeds the next "S" element\'s start time:',ZN,u);break}y=Math.ceil((y-v)/X)-1}else{if(Infinity===n){_.C(TN,"if the Period has an infinite duration:",YN,u);break}else if(v/l>=n){_.C(TN,"if its start time exceeds the Period's duration:",
|
|
11
|
-
YN,u);break}y=Math.ceil((n*l-v)/X)-1}0<E.length&&v!==r&&(Math.abs((v-r)/l)>=_.ku&&_.C("SegmentTimeline contains a large gap/overlap:","the content may have errors in it.",u),E[E.length-1].end=v/l);for(u=0;u<=y;++u)r=v+X,E.push({start:v/l,end:r/l,Ai:v}),v=r}l=E}}a=BO(a,b,"availabilityTimeOffset");b=Number(a||"");b=isNaN(b)?null:b;if(null==a||null==b)b=0;return{timescale:d,Ma:c,Ac:h,
|
|
11
|
+
YN,u);break}y=Math.ceil((n*l-v)/X)-1}0<E.length&&v!==r&&(Math.abs((v-r)/l)>=_.ku&&_.C("SegmentTimeline contains a large gap/overlap:","the content may have errors in it.",u),E[E.length-1].end=v/l);for(u=0;u<=y;++u)r=v+X,E.push({start:v/l,end:r/l,Ai:v}),v=r}l=E}}a=BO(a,b,"availabilityTimeOffset");b=Number(a||"");b=isNaN(b)?null:b;if(null==a||null==b)b=0;return{timescale:d,Ma:c,Ac:h,we:g,Ob:f,kf:e,timeline:l,ne:b}},BO=function(a,b,c){return[b(a.P),b(a.wa),b(a.La)].filter(_.yi).map(d=>d.getAttribute(c)).reduce((d,
|
|
12
12
|
e)=>d||e)},CO=function(a,b,c){return[b(a.P),b(a.wa),b(a.La)].filter(_.yi).map(d=>_.Dn.h(d,c)).reduce((d,e)=>d||e)},FO=function(a,b,c,d,e,f){const g=_.Dn,h=g.getAttributeNS(a,XN,"href"),k=g.getAttributeNS(a,XN,"actuate")||"onRequest";g.ge(a,XN);if(5<=f)return oO(new _.I(_.F,4,4028));if("onLoad"!==k)return oO(new _.I(_.F,4,4027));const l=_.gD([d],[h]);d=_.Bj(l,b);d.type=1;return lO(e.fetch(d),m=>{m=_.ij(m.data);m=g.j(m,a.tagName);if(!m)return oO(new _.I(_.F,4,4001,{uri:h}));g.fe(a);g.Yd(m,a);g.Xd(m,
|
|
13
|
-
a);return EO(a,b,c,l[0],e,f+1)})},EO=function(a,b,c,d,e,f=0){var g=_.Dn;if(g.getAttributeNS(a,XN,"href"))return g=FO(a,b,c,d,e,f),c&&(g=lO(g,void 0,()=>EO(a,b,c,d,e,f))),g;const h=[],k=g.Nd(a);for(const l of k)"urn:mpeg:dash:resolve-to-zero:2013"===g.getAttributeNS(l,XN,"href")?g.removeChild(a,l):l.tagName!==SN&&h.push(EO(l,b,c,d,e,f));return lO(pO(h),()=>a)},GO=function(a,b,c){const d=a.Ea.duration;var e=a.Ea.bg;if(!a.
|
|
13
|
+
a);return EO(a,b,c,l[0],e,f+1)})},EO=function(a,b,c,d,e,f=0){var g=_.Dn;if(g.getAttributeNS(a,XN,"href"))return g=FO(a,b,c,d,e,f),c&&(g=lO(g,void 0,()=>EO(a,b,c,d,e,f))),g;const h=[],k=g.Nd(a);for(const l of k)"urn:mpeg:dash:resolve-to-zero:2013"===g.getAttributeNS(l,XN,"href")?g.removeChild(a,l):l.tagName!==SN&&h.push(EO(l,b,c,d,e,f));return lO(pO(h),()=>a)},GO=function(a,b,c){const d=a.Ea.duration;var e=a.Ea.bg;if(!a.ve)return e=new _.jK(b),_.LD(e,d),e;{var f=a.La;const g=a.P;f=f&&f.id&&g&&g.id?
|
|
14
14
|
`${f.id},${g.id}`:null}if(!a.cg||null==c[f])return a=new _.jK(b),e||_.LD(a,d),c[f]=a;c=c[f];e||_.LD(new _.jK(b),d);_.kE(c,b);_.lE(c,_.aE(a.presentationTimeline)-a.Ea.start);return c},HO=function(a,b){var c=a.presentationTimeline,d=[...b.a];c.l||0===d.length||(c.I=Math.floor(Math.max(c.I||0,d[d.length-1].endTime+a.Ea.start)));a.cg||_.YD(a.presentationTimeline,[...b.a],a.Ea.start)},IO=function(a){return""===a.id?`${a.schemeIdUri}:${a.startTime}:${a.endTime}`:a.id},KO=function(a,b,c,d){let e;var f=(new _.Dm).ea("sidx",
|
|
15
15
|
g=>{e=JO(b,d,c,g)});a&&f.parse(a);if(e)return e;{f=`${b}-${b+a.byteLength-1}`;const g=c[0];a=_.K(a);_.Hh('Invalid box type. Expected "sidx", but received:',a,"from:",g,"byte range:",f);throw new _.I(_.F,3,3004,{url:g,Li:f,size:a.byteLength,aj:qO(a)});}},JO=function(a,b,c,d){const e=[];d.reader.skip(4);const f=_.P(d.reader);if(0===f)throw _.Hh("Invalid timescale."),new _.I(_.F,3,3005);if(0===d.version){var g=_.P(d.reader);var h=_.P(d.reader)}else g=_.rm(d.reader),h=_.rm(d.reader);d.reader.skip(2);
|
|
16
16
|
const k=_.pm(d.reader);a=a+d.size+h;for(h=0;h<k;h++){var l=_.P(d.reader);const m=(l&2147483648)>>>31;l&=2147483647;const n=_.P(d.reader);d.reader.skip(4);if(1===m)throw _.Hh("Hierarchical SIDXs are not supported."),new _.I(_.F,3,3006);e.push(new _.jE(e.length,g/f-b,(g+n)/f-b,()=>c,a,a+l-1,b));g+=n;a+=l}d.parser.stop();return e},LO=function(a){var b=_.om(a.a);let c;for(c=1;8>=c&&!(b&1<<8-c);c++);if(8<c)throw new _.I(_.F,3,3002);const d=new Uint8Array(c);d[0]=b;for(b=1;b<c;b++)d[b]=_.om(a.a);return d},
|
|
@@ -19,18 +19,18 @@ return new NO(b,e)},PO=function(a){if(8<a.a.byteLength)throw new _.I(_.F,3,3002)
|
|
|
19
19
|
f));return g},RO=function(a){var b=new QO(a.a);a=OO(b);if(179!==a.id)throw _.C("Not a CueTime element."),new _.I(_.F,3,3013);a=PO(a);b=OO(b);if(183!==b.id)throw _.C("Not a CueTrackPositions element."),new _.I(_.F,3,3012);b=new QO(b.a);let c=0;for(;_.mm(b.a);){const d=OO(b);if(241===d.id){c=PO(d);break}}return{Bi:a,bi:c}},TO=function(a,b){var c=CO(a,b,"Initialization");if(!c)return null;let d=a.P.la;(b=c.getAttribute("sourceURL")||void 0)&&(d=_.gD(a.P.la,[b]));let e=0,f=null;if(c=_.Dn.Z(c,"range",
|
|
20
20
|
uO))e=c.start,f=c.end;return new _.eK(()=>d,e,f,null,null,b,a.P.Pa)},WO=function(a,b){var c=Number(BO(a,UO,aO))||0,d=BO(a,UO,dO),e=1;d&&(e=wO(d)||1);c=c/e||0;d=TO(a,UO);{e=a.P.mimeType.split("/")[1];if(a.P.contentType!==_.H&&"mp4"!==e&&"webm"!==e)throw _.Hh("SegmentBase specifies an unsupported container type.",a.P),new _.I(_.F,4,4006);if("webm"===e&&!d)throw _.Hh(PN,"the SegmentBase uses a WebM container,","but does not contain an Initialization element.",a.P),new _.I(_.F,4,4005);const g=CO(a,UO,
|
|
21
21
|
"RepresentationIndex");var f=BO(a,UO,"indexRange");let h=a.P.la;f=uO(f||"");if(g){const k=g.getAttribute("sourceURL");k&&(h=_.gD(a.P.la,[k]));f=_.Dn.Z(g,"range",uO,f)}if(!f)throw _.Hh(PN,"the SegmentBase does not contain @indexRange","or a RepresentationIndex element.",a.P),new _.I(_.F,4,4002);a.presentationTimeline.B=null;a=VO(a,b,d,h,f.start,f.end,e,c)}return{createSegmentIndex:a.createSegmentIndex,findSegmentPosition:a.findSegmentPosition,getSegmentReference:a.getSegmentReference,adjustSegmentDurations:a.adjustSegmentDurations,
|
|
22
|
-
getDuration:a.getDuration,initSegmentReference:d,getLastSegmentEndTime:a.getLastSegmentEndTime,Fa:c}},UO=function(a){return a.yd},VO=function(a,b,c,d,e,f,g,h){const k=a.presentationTimeline,l=!a.
|
|
22
|
+
getDuration:a.getDuration,initSegmentReference:d,getLastSegmentEndTime:a.getLastSegmentEndTime,Fa:c}},UO=function(a){return a.yd},VO=function(a,b,c,d,e,f,g,h){const k=a.presentationTimeline,l=!a.ve||!a.Ea.bg,m=a.Ea.start,n=a.Ea.duration;let r=b,u=null;return{createSegmentIndex:function(v){return _.x(function*(){var y=[r(d,e,f,v),"webm"===g?r(c.ab(),c.za,c.qa,v):null];r=null;y=yield Promise.all(y);var A=y[0];const E=y[1]||null;A="mp4"===g?KO(A,e,d,h):(new XO).parse(A,E,d,h);_.YD(k,A,m);u=new _.jK(A);
|
|
23
23
|
l&&_.LD(u,n);return y})},findSegmentPosition:function(v){return u.f(v)},getSegmentReference:function(v){return u.get(v)},adjustSegmentDurations:function(v,y){return u.h(v,y)},getDuration:function(){return null!=n?n:u.getDuration()},getLastSegmentEndTime:()=>n}},dP=function(a,b,c,d){const e=YO(a),f=ZO(a);$O(a,f);let g=null;if(f.md)a.presentationTimeline.B=null,g=aP(a,b,e,f);else if(f.Ma)d||(a.presentationTimeline.B=null,mO(a.presentationTimeline,f.ne),_.ZD(a.presentationTimeline,f.Ma),_.WD(a.presentationTimeline,
|
|
24
24
|
a.Ea.start)),g=bP(a,f);else{b=cP(a,f);const h=GO(a,b,c);HO(a,h);g={createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:h.f.bind(h),getSegmentReference:h.get.bind(h),adjustSegmentDurations:h.h.bind(h),getDuration:h.getDuration.bind(h),getLastSegmentEndTime:()=>_.iE(h)}}return{createSegmentIndex:g.createSegmentIndex,findSegmentPosition:g.findSegmentPosition,getSegmentReference:g.getSegmentReference,adjustSegmentDurations:g.adjustSegmentDurations,getDuration:g.getDuration,initSegmentReference:e,
|
|
25
|
-
getLastSegmentEndTime:g.getLastSegmentEndTime,Fa:f.Ob}},YO=function(a){const b=BO(a,eP,"initialization");if(!b)return null;const c=a.P.la,d=AO(b,a.P.id,null,a.bandwidth||null,null);return new _.eK(function(){return _.gD(c,[d])},0,null,null,null,d,a.P.Pa)},ZO=function(a){const b=DO(a,eP),c=BO(a,eP,"media");a=BO(a,eP,"index");return{Ma:b.Ma,timescale:b.timescale,Ac:b.Ac,
|
|
25
|
+
getLastSegmentEndTime:g.getLastSegmentEndTime,Fa:f.Ob}},YO=function(a){const b=BO(a,eP,"initialization");if(!b)return null;const c=a.P.la,d=AO(b,a.P.id,null,a.bandwidth||null,null);return new _.eK(function(){return _.gD(c,[d])},0,null,null,null,d,a.P.Pa)},ZO=function(a){const b=DO(a,eP),c=BO(a,eP,"media");a=BO(a,eP,"index");return{Ma:b.Ma,timescale:b.timescale,Ac:b.Ac,we:b.we,Ob:b.Ob,kf:b.kf,timeline:b.timeline,Fe:c,md:a,ne:b.ne}},$O=function(a,b){let c;c=b.md?1:0;c+=b.timeline?1:0;c+=b.Ma?1:0;if(0===
|
|
26
26
|
c)throw _.Hh("SegmentTemplate does not contain any segment information:","the SegmentTemplate must contain either an index URL template","a SegmentTimeline, or a segment duration.",a.P),new _.I(_.F,4,4002);1!==c&&(_.C("SegmentTemplate contains multiple segment information sources:","the SegmentTemplate should only contain an index URL template,","a SegmentTimeline or a segment duration.",a.P),b.md?(_.Fh("Using the index URL template by default."),b.timeline=null):_.Fh("Using the SegmentTimeline by default."),
|
|
27
27
|
b.Ma=null);if(!b.md&&!b.Fe)throw _.Hh(RN,"the SegmentTemplate's media URL template is missing.",a.P),new _.I(_.F,4,4002);},aP=function(a,b,c,d){const e=a.P.mimeType.split("/")[1];if("mp4"!==e&&"webm"!==e)throw _.Hh("SegmentTemplate specifies an unsupported container type.",a.P),new _.I(_.F,4,4006);if("webm"===e&&!c)throw _.Hh(RN,"the SegmentTemplate uses a WebM container,","but does not contain an initialization URL template.",a.P),new _.I(_.F,4,4005);var f=AO(d.md,a.P.id,null,a.bandwidth||null,null);
|
|
28
|
-
f=_.gD(a.P.la,[f]);return VO(a,b,c,f,0,null,e,d.Ob)},bP=function(a,b){const c=b.Fe,d=a.Ea.duration,e=b.Ma,f=b.Ac,g=b.
|
|
28
|
+
f=_.gD(a.P.la,[f]);return VO(a,b,c,f,0,null,e,d.Ob)},bP=function(a,b){const c=b.Fe,d=a.Ea.duration,e=b.Ma,f=b.Ac,g=b.we,h=b.timescale,k=a.bandwidth||null,l=a.P.id,m=a.P.la,n=a.P.Pa;return{createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:function(r){return 0>r||d&&r>=d?null:Math.floor(r/e)},getSegmentReference:function(r){const u=r+f;if(null!==g&&u>g)return null;const v=r*e;let y=v+e;d&&(y=Math.min(y,d));if(0>y||d&&v>=d)return null;const A=AO(c,l,u,k,v*h);return new _.jE(r,v,y,
|
|
29
29
|
function(){return _.gD(m,[A])},0,null,b.Ob,null,null,null,null,null,null,null,null,A,n)},adjustSegmentDurations:()=>{},getDuration:()=>d,getLastSegmentEndTime:()=>d}},cP=function(a,b){const c=b.Fe,d=b.timeline;if(0===d.length)return[];const e=[];for(let f=0;f<d.length;f++){const g=f+b.Ac,h=a.P.la,k=AO(c,a.P.id,g,a.bandwidth||null,d[f].Ai+b.kf);e.push(new _.jE(g,d[f].start,d[f].end,()=>_.gD(h,[k]),0,null,b.Ob,null,null,null,null,null,null,null,null,k,a.P.Pa))}return e},eP=function(a){return a.ic},
|
|
30
30
|
jP=function(a,b){const c=TO(a,fP),d=gP(a);hP(a,d);const e=iP(a.Ea.duration,d.Ac,a.P.la,a.P.Pa,d),f=GO(a,e,b);HO(a,f);return{createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:f.f.bind(f),getSegmentReference:f.get.bind(f),adjustSegmentDurations:f.h.bind(f),getDuration:f.getDuration.bind(f),initSegmentReference:c,getLastSegmentEndTime:()=>_.iE(f),Fa:d.Ob}},fP=function(a){return a.hc},gP=function(a){const b=kP(a);a=DO(a,fP);let c=a.Ac;0===c&&(_.C("SegmentList@startNumber must be \x3e 0"),
|
|
31
31
|
c=1);let d=0;a.Ma?d=a.Ma*(c-1):a.timeline&&0<a.timeline.length&&(d=a.timeline[0].start);return{Ma:a.Ma,startTime:d,Ac:c,Ob:a.Ob,timeline:a.timeline,yc:b}},hP=function(a,b){if(!b.Ma&&!b.timeline&&1<b.yc.length)throw _.C(QN,"the SegmentList specifies multiple segments,","but does not specify a segment duration or timeline.",a.P),new _.I(_.F,4,4002);if(!b.Ma&&!a.Ea.duration&&!b.timeline&&1===b.yc.length)throw _.C(QN,"the SegmentList specifies one segment,","but does not specify a segment duration, period duration,",
|
|
32
32
|
"or timeline.",a.P),new _.I(_.F,4,4002);if(b.timeline&&0===b.timeline.length)throw _.C(QN,"the SegmentList has an empty timeline.",a.P),new _.I(_.F,4,4002);},iP=function(a,b,c,d,e){let f=e.yc.length;e.timeline&&e.timeline.length!==e.yc.length&&(f=Math.min(e.timeline.length,e.yc.length),_.C("The number of items in the segment timeline and the number of","segment URLs do not match, truncating",e.yc.length,"to",f));const g=[];var h=e.startTime;for(let k=0;k<f;k++){const l=e.yc[k],m=_.gD(c,[l.eg]);let n;
|
|
33
|
-
n=null!=e.Ma?h+e.Ma:e.timeline?e.timeline[k].end:h+a;g.push(new _.jE(k+b,h,n,()=>m,l.start,l.end,e.Ob,null,null,null,null,null,null,null,null,l.eg,d));h=n}return g},kP=function(a){return[a.P.hc,a.wa.hc,a.La.hc].filter(_.yi).map(b=>_.Dn.a(b,"SegmentURL")).reduce((b,c)=>0<b.length?b:c).map(b=>{b.getAttribute("indexRange")&&!a.
|
|
33
|
+
n=null!=e.Ma?h+e.Ma:e.timeline?e.timeline[k].end:h+a;g.push(new _.jE(k+b,h,n,()=>m,l.start,l.end,e.Ob,null,null,null,null,null,null,null,null,l.eg,d));h=n}return g},kP=function(a){return[a.P.hc,a.wa.hc,a.La.hc].filter(_.yi).map(b=>_.Dn.a(b,"SegmentURL")).reduce((b,c)=>0<b.length?b:c).map(b=>{b.getAttribute("indexRange")&&!a.Ae&&(a.Ae=!0,_.C("We do not support the SegmentURL@indexRange attribute on SegmentList. We only use the SegmentList@duration attribute or SegmentTimeline, which must be accurate."));
|
|
34
34
|
const c=b.getAttribute("media");b=_.Dn.Z(b,"mediaRange",uO,{start:0,end:null});return{eg:c,start:b.start,end:b.end}})},mP=function(a,b,c){c=c.map(e=>({scheme:e.getAttribute(bO),value:e.getAttribute(_.Dg)}));const d=a.a.clockSyncUri;!c.length&&d&&(a.g.info("No UTCTiming elements found, falling back on clockSyncUri from config to synchronize clocks."),c.push({scheme:gO,value:d}));return 0===c.length?(a.g.warn(ON),Promise.reject(Error(ON))):nO(c,e=>{const f=e.scheme;e=e.value;switch(f){case gO:case "urn:mpeg:dash:utc:http-head:2012":return lP(a,
|
|
35
35
|
b,e,"HEAD");case "urn:mpeg:dash:utc:http-xsdate:2014":case "urn:mpeg:dash:utc:http-iso:2014":case "urn:mpeg:dash:utc:http-xsdate:2012":case "urn:mpeg:dash:utc:http-iso:2012":return lP(a,b,e,"GET");case "urn:mpeg:dash:utc:direct:2014":case "urn:mpeg:dash:utc:direct:2012":{const g=Date.parse(e);return isNaN(g)?(a.g.warn(`Invalid date for scheme ${f}, `+`value: ${e}`),Promise.reject()):Promise.resolve(g-Date.now())}case "urn:mpeg:dash:utc:http-ntp:2014":case "urn:mpeg:dash:utc:ntp:2014":case "urn:mpeg:dash:utc:sntp:2014":return a.g.warn("NTP UTCTiming scheme is not supported"),
|
|
36
36
|
Promise.reject();default:return a.g.warn("Unrecognized scheme in UTCTiming element",f),Promise.reject()}}).catch(()=>{a.g.warn(LN);return Promise.reject(Error(LN))})},nP=function(a,b,c,d){return _.x(function*(){const e=_.Dn.a(b,"UTCTiming");try{const f=yield mP(a,c,e);d.H=f;a.g.info("Clock synchronized. The difference between server and "+`client clock was ${f} ms.`)}catch(f){a.g.warn("Failed to synchronize clocks. This content may not play on clients with bad clocks!")}return d})},lP=function(a,
|
|
@@ -43,19 +43,19 @@ f.drmInfos.some(h=>h.keySystem===g.keySystem)),0===b.drmInfos.length))throw new
|
|
|
43
43
|
a),null;c=c.toLowerCase();if(d&&(d=d.replace(/-/g,"").toLowerCase(),d.includes(" ")))throw new _.I(_.F,4,4009);let g=[];try{if(g=e.map(h=>({initDataType:_.kd,initData:_.Yl(h),keyId:null})),0===g.length&&f&&b.f(f))try{const h=b.f(f),k=_.Yl(h),l=_.In(k);g.push({initDataType:_.kd,initData:_.UC(l),keyId:null})}catch(h){_.C("Unable to parse ms:pro payload",h),g=[]}}catch(h){throw new _.I(_.F,4,4007);}return{node:a,Zb:c,keyId:d,init:0<g.length?g:null}},BP=function(a,b,c){if(a.length){c=c||`${"__clpp_baseUriCollection_"}
|
|
44
44
|
${b.length}`;const d=[];a.forEach(e=>{const f=e.getAttribute("serviceLocation");e=_.Dn.f(e);f&&e&&d.push({serviceLocationId:f,uri:e,params:{}})});if(d.length)return a=new _.UE(c,d),b.push(a),a}return null},DP=function(a,b){a=CP(a).filter(c=>c.getLastSegmentEndTime).map(c=>c.getLastSegmentEndTime());0<a.length&&(a=Math.min(...a),_.XD(b.presentationTimeline,a+b.Ea.start))},EP=function(a,b){return _.YE(_.Bk(a,b))?_.H:a.split("/")[0]},CP=function(a){const b=new Set;a.forEach(c=>{c.variants.forEach(d=>
|
|
45
45
|
{d.audio&&b.add(d.audio);d.video&&b.add(d.video)})});return Array.from(b)},GP=function(a){return _.x(function*(){var b=a.w?_.VE(a.w,MN):null;var c=[];b&&(c=_.ME(b,""));0===c.length&&(c=a.o);var d=_.Bj(c,a.a.attemptParameters);d.type=1;c=Date.now();d=a.D.networkingEngine.fetch(d);_.Mj(a.A,d);var e=yield d.V;if(!a.D)return 0;b||e.uri&&!a.o.includes(e.uri)&&a.o.unshift(e.uri);d=null!=a.f;const f=yield FP(a,e.data,e.uri);f.manifest.contentSteering&&(a.w=yield a.D.onContentSteeringInfoFound(f.manifest.contentSteering));
|
|
46
|
-
if(a.w&&b){0!==e.request.uriIndex&&_.WE(a.w,b.la[0].serviceLocationId);var g=e.request,h=e.timeMs;e=e.data.byteLength;h&&e&&(b=_.TE(a.w,b.la[g.uriIndex].serviceLocationId),_.KE(b.oe,h,e),b.wd=!0)}b=(Date.now()-c)/1E3;_.ND(a.I,1,b);if(d&&a.D.onUpdate)a.D.onUpdate(f.manifest);if(f.zi){if(a.D.onTurnedStatic)a.D.onTurnedStatic();a.D.onEvent(new _.D(_.Pe))}return b})},HP=function(a,b){0>a.l||a.B.
|
|
46
|
+
if(a.w&&b){0!==e.request.uriIndex&&_.WE(a.w,b.la[0].serviceLocationId);var g=e.request,h=e.timeMs;e=e.data.byteLength;h&&e&&(b=_.TE(a.w,b.la[g.uriIndex].serviceLocationId),_.KE(b.oe,h,e),b.wd=!0)}b=(Date.now()-c)/1E3;_.ND(a.I,1,b);if(d&&a.D.onUpdate)a.D.onUpdate(f.manifest);if(f.zi){if(a.D.onTurnedStatic)a.D.onTurnedStatic();a.D.onEvent(new _.D(_.Pe))}return b})},HP=function(a,b){0>a.l||a.B.ha(Math.max(3,a.l-b,_.OD(a.I)))},FP=function(a,b,c){return _.x(function*(){var d=_.ij(b);_.Kn($N);d=_.Dn.j(d,
|
|
47
47
|
"MPD");_.Kn("parse.xml.end");_.Mn($N,$N,"parse.xml.end");if(!d)throw new _.I(_.F,4,4001,c);d=EO(d,a.a.attemptParameters,a.a.xlinkFailGracefully,c,a.D.networkingEngine);_.Mj(a.A,d);d=yield d.V;return IP(a,d,c)})},IP=function(a,b,c){return _.x(function*(){var d=_.Dn;const e=[];var f=[c],g=d.a(b,MN),h=g.map(d.f).filter(_.yi);0<h.length&&(f=_.gD(f,h),a.o=f,BP(g,e,MN));g=d.a(b,HN);h=g.map(d.f);var k=_.gD(f,h);BP(g,e,HN);f=b.getAttribute("type")||cO;a.l=d.Z(b,"minimumUpdatePeriod",tO,-1);f===cO&&0<=a.l&&
|
|
48
48
|
(a.g.warn("Invalid manifest - a static manifest should not contain the `minimumUpdatePeriod` attribute. The attribute will be ignored."),a.l=-1,a.B.stop());g=d.Z(b,"maxSegmentDuration",tO);if(d=f===cO&&"dynamic"===a.C)a.g.info("MPD dynamic to static transition."),f="dynamic";h=f===cO;var l="dynamic"===f;if(a.f)var m=a.f.presentationTimeline;else{var n=_.Dn;m=a.a.timeline||{};var r=n.Z(b,"suggestedPresentationDelay",tO),u=n.Z(b,"minBufferTime",tO,0);r=null!=a.a.suggestedPresentationDelay?a.a.suggestedPresentationDelay:
|
|
49
|
-
a.a.lowLatencyMode?0:null!=r?r:3*u;n=n.Z(b,"availabilityStartTime",sO);m=new _.iK(m,n,r,h,!!a.a.autoCorrectDrift,!!a.a.lowLatencyMode);m=h?m:nP(a.J,b,k,m)}m=yield m;n=_.Dn.Z(b,"timeShiftBufferDepth",tO);n=l&&a.a.availabilityWindowOverride&&!isNaN(a.a.availabilityWindowOverride)?a.a.availabilityWindowOverride:null===n?Infinity:n;m.A=n;if(!a.D)throw new _.I(_.F,7,7001);n={
|
|
49
|
+
a.a.lowLatencyMode?0:null!=r?r:3*u;n=n.Z(b,"availabilityStartTime",sO);m=new _.iK(m,n,r,h,!!a.a.autoCorrectDrift,!!a.a.lowLatencyMode);m=h?m:nP(a.J,b,k,m)}m=yield m;n=_.Dn.Z(b,"timeShiftBufferDepth",tO);n=l&&a.a.availabilityWindowOverride&&!isNaN(a.a.availabilityWindowOverride)?a.a.availabilityWindowOverride:null===n?Infinity:n;m.A=n;if(!a.D)throw new _.I(_.F,7,7001);n={ve:l,cg:null!=a.f,presentationTimeline:m,La:null,Ea:null,wa:null,P:null,bandwidth:0,Ae:!1,Jh:d,jc:null,pd:null};k=JP(a,n,k,e,b);
|
|
50
50
|
r=k.duration;l=k.periods;d&&(DP(l,n),m.C=!0);if(h||!d&&!k.Kf)m.f=r||Infinity;if(2===a.a.timeline.version){h=r;n=l[0].startTime;if(null==h||Infinity===h)h=KP(l);_.QD(m.a,n,n+h)}_.ZD(m,g||1);m.isLive();if(!a.f){a.f={presentationTimeline:m,periods:l,minBufferTime:0,cues:[]};a:{l=_.Dn;if(m=l.h(b,"ContentSteering"))if(g=m.getAttribute("defaultServiceLocation")||"",h=l.f(m)){l=l.Z(m,"queryBeforeStart",zO,!1);g={manifestType:_.Kc,contentSteeringServerUri:h,defaultServiceLocation:g,queryBeforeStart:l||!1,
|
|
51
51
|
baseUriCollections:[]};break a}g=null}g&&(a.f.contentSteering=g,a.f.contentSteering.baseUriCollections=e)}a.f.cues=k.cues;a.C=f;return{manifest:a.f,zi:d}})},JP=function(a,b,c,d,e){const f=_.Dn,g=f.Z(e,"mediaPresentationDuration",tO),h=a.f?a.f.periods[a.f.periods.length-1]||null:null;var k=[];const l=[];var m=0;e=f.a(e,"Period");for(let v=0;v<e.length;v++){var n=e[v];m=f.Z(n,_.Zf,tO,m);var r=f.Z(n,VN,tO);let y=null;if(v!==e.length-1){var u=f.Z(e[v+1],_.Zf,tO);null!=u&&(y=u-m)}else null!=g&&(y=g-m);
|
|
52
52
|
u=_.ku;y&&r&&Math.abs(y-r)>u&&a.g.warn("There is a gap/overlap between Periods",n);null==y&&(y=r);n=LP(a,b,c,d,{start:m,duration:y,node:n,bg:null==y||v===e.length-1});r=n.La;l.push(r);k=k.concat(n.cues);a.G.includes(r.id)||(a.G.push(r.id),a.f&&(a.D.filterNewPeriod(r),a.f.periods.push(r)));if(null==y){v!==e.length-1&&a.g.warn("Skipping Period",v+1,"and any subsequent Periods:","Period",v+1,"does not have a valid start time.",l[v+1]);m=null;break}m+=y}null==a.f&&a.D.filterAllPeriods(l);h&&(b=l.find(v=>
|
|
53
53
|
v.id===h.id))&&(h.endTime=b.endTime);k=MP(a,k);return null!=g?(m!==g&&a.g.warn("@mediaPresentationDuration does not match the total duration of ","all Periods."),{periods:l,duration:g,Kf:!1,cues:k}):{periods:l,duration:m,Kf:!0,cues:k}},KP=function(a){return a.map(b=>b.variants[0].video||b.variants[0].audio).reduce((b,c)=>c?c.getDuration():0+b,0)},LP=function(a,b,c,d,e){var f=_.Dn;b.La=NP(a,e.node,null,c,d);b.Ea=e;c=b.La.id||`__clpp_period_${e.start}`;b.La.id||(a.g.info("No Period ID given for Period with start time "+
|
|
54
|
-
e.start+`, Assigning a default: ${c}.`),b.La.id=c);d=f.a(e.node,"EventStream").flatMap(A=>OP(a,e.start,e.duration,A));f=f.a(e.node,_.fa).map(A=>PP(a,b,A)).filter(_.yi);if(b.
|
|
54
|
+
e.start+`, Assigning a default: ${c}.`),b.La.id=c);d=f.a(e.node,"EventStream").flatMap(A=>OP(a,e.start,e.duration,A));f=f.a(e.node,_.fa).map(A=>PP(a,b,A)).filter(_.yi);if(b.ve){var g=[];for(var h of f)for(var k of h.ei)g.push(k);if(g.length!==(new Set(g)).size)throw new _.I(_.F,4,4018);}h=f.filter(A=>!A.hf);k=f.filter(A=>A.hf);for(var l of k){l.streams.forEach(A=>{A.trickPlay=!0});k=l.streams[0];g=l.hf;for(var m of h)if(g.includes(m.id))for(var n of m.streams)n.trickModeVideo=k}m=QP(f,_.w);n=QP(h,
|
|
55
55
|
_.p);if(!m.length&&!n.length)throw new _.I(_.F,4,4004);n.length||(n=[null]);m.length||(m=[null]);l=[];for(var r of n)for(var u of m)RP(a,r,u,l);u=[...QP(h,_.H),...QP(h,_.NC)];r=[];for(var v of u)r.push.apply(r,v.streams);u=QP(h,_.re);v=[];for(var y of u)v.push.apply(v,y.streams);y=SP(e,h);return{La:{id:c,configurationId:a.D.configurationId,startTime:e.start,endTime:y,textStreams:r,thumbStreams:v,variants:l},cues:d}},MP=function(a,b){const c=new Set(b.map(IO));a.j.forEach((d,e)=>{c.has(e)||a.j.delete(e)});
|
|
56
56
|
b.forEach(d=>{const e=IO(d);a.j.has(e)||a.j.set(e,d)});return Array.from(a.j.values())},NP=function(a,b,c,d,e){const f=_.Dn;c=c||{contentType:"",mimeType:"",codecs:"",emsgSchemeIdUris:[],frameRate:void 0,Ge:null,Pa:e?e.find(u=>u.id===HN)||null:null};d=d||c.la;var g=f.a(b,HN);const h=g.map(f.f);e=e?BP(g,e,b.getAttribute("id")||void 0):null;g=b.getAttribute("contentType")||c.contentType;const k=b.getAttribute(_.Me)||c.mimeType,l=b.getAttribute(_.Bd)||c.codecs,m=f.Z(b,"frameRate",yO)||c.frameRate,n=
|
|
57
57
|
TP(f.a(b,"InbandEventStream"),c.emsgSchemeIdUris),r=f.a(b,"AudioChannelConfiguration");a=UP(a,r)||c.Ge;g||(g=EP(k,l));return{la:_.gD(d,h),Pa:e||c.Pa,yd:f.h(b,"SegmentBase")||c.yd,hc:f.h(b,"SegmentList")||c.hc,ic:f.h(b,"SegmentTemplate")||c.ic,width:f.Z(b,_.Vg,xO)||c.width,height:f.Z(b,_.oe,xO)||c.height,contentType:g,mimeType:k,codecs:l,frameRate:m,emsgSchemeIdUris:n,id:b.getAttribute("id")||"",Ge:a}},OP=function(a,b,c,d){const e=_.Dn,f=d.getAttribute(bO)||"",g=d.getAttribute(_.Dg)||"",h=e.Z(d,dO,
|
|
58
|
-
xO)||1,k=e.Z(d,aO,xO)||0,l=[];for(const n of e.a(d,"Event")){d=e.Z(n,"presentationTime",xO)||0;var m=e.Z(n,VN,xO)||0;d=b+d/h-k/h;m=d+m/h;null!=c&&(d=Math.min(d,b+c),m=Math.min(m,b+c));let r=_.ug;f.startsWith(_.
|
|
58
|
+
xO)||1,k=e.Z(d,aO,xO)||0,l=[];for(const n of e.a(d,"Event")){d=e.Z(n,"presentationTime",xO)||0;var m=e.Z(n,VN,xO)||0;d=b+d/h-k/h;m=d+m/h;null!=c&&(d=Math.min(d,b+c),m=Math.min(m,b+c));let r=_.ug;f.startsWith(_.zg)?r=_.gi:"urn:mpeg:dash:event:callback:2015"===f&&(r=_.Qe);const u={configurationId:a.D.configurationId,schemeIdUri:f,value:g,startTime:d,endTime:m,id:n.getAttribute("id")||"",type:r,eventElement:e.Bd(n)};u.type===_.Qe&&(u.ae=()=>{if(u.eventElement){var v=u.eventElement.getAttribute("messageData")||
|
|
59
59
|
"";v&&v.startsWith("http")&&(v=_.Bj(v),v.type=_.Aj,a.D.networkingEngine.fetch(v))}});l.push(u)}return l},PP=function(a,b,c){var d=_.Dn;b.wa=NP(a,c,b.La,null,null);let e=!1;var f=d.a(c,"Role");const g=f.map(X=>X.getAttribute(_.Dg)).filter(_.yi);let h=null;var k=d.a(c,"Label").map(d.f).filter(_.yi);k&&0<k.length&&(h=k[k.length-1]);let l=void 0;(k=b.wa.contentType===_.H)&&(l=_.NC);for(var m of f)if(f=m.getAttribute(bO),null==f||"urn:mpeg:dash:role:2011"===f||"urn:mpeg:dash:role"===f)switch(f=m.getAttribute(_.Dg),
|
|
60
60
|
f){case _.He:e=!0;break;case _.wC:case _.NC:l=f;break;case "forced-subtitle":case "forced_subtitle":case _.le:l=_.le}f=d.a(c,KN);m=null;for(var n of f){f=n.getAttribute(bO)||"";var r=n.getAttribute(_.Dg);if(f!==WN&&!VP.includes(f)||void 0===r)return null;f===WN&&(0===r.length&&(m=null),m=r.split(" "))}n=d.a(c,"Accessibility");const u=new Map;for(var v of n)if(f=v.getAttribute(bO),"urn:scte:dash:cc:cea-608:2015"===f||"urn:scte:dash:cc:cea-708:2015"===f)if(f=1,r=v.getAttribute(_.Dg),null!=r)for(const X of r.split(";")){if(X.includes("\x3d")){var y=
|
|
61
61
|
X.split("\x3d");r=y[0].startsWith("CC")?y[0]:"CC"+y[0];y=y[1].split(",")[0].split(":").pop()}else r="CC"+f,f+=2,y=X;u.set(r,_.Qi(y))}else u.set("CC1",_.tg);v=d.a(c,JN);const A=wP(v,a.a.ignoreDrmInfo,b.La.id,a.a.playreadyVersion||null),E=c.getAttribute("lang")||_.tg;v=_.Qi(E);null==h&&(h=c.getAttribute("label"));d=d.a(c,_.Bb);c=d.map(X=>WP(a,b,A,l,E,h||"",e,g,u,X)).filter(_.yi);if(0===c.length){if(k)return null;throw new _.I(_.F,4,4003);}if(!b.wa.contentType||b.wa.contentType===UN){b.wa.contentType=
|
package/cl.freewheel.js
CHANGED
|
@@ -13,7 +13,7 @@ _.t||a.a.setSiteSection(b.siteSectionId);const c=yield CV();a.a.setVideoAsset(b.
|
|
|
13
13
|
if(Array.isArray(b.parameters))for(const d of b.parameters)a.a.setParameter(d.name,d.value,d.level);DV(a);a.a.submitRequest();return a.A})}start(){const a=this;return _.x(function*(){yield GV(a)})}w(){}resume(){this.f&&this.f.resume()}pause(){this.f&&this.f.pause()}skip(){this.f&&this.f.skipCurrentAd()}getVolume(){return this.a?this.a.getAdVolume():1}setVolume(a){this.a&&this.a.setAdVolume(a)}getPosition(){return this.f?this.f.getPlayheadTime():-1}o(){return!0}h(){const a=this;return _.x(function*(){a.j.release();
|
|
14
14
|
a.l&&(a.l.stop(),a.l=null);FV(a);a.a&&(a.a.dispose(),a.a=null)})}K(a){if(a.success)this.G=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL),this.B=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL),this.F=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL),this.m.trigger(new _.D(_.Fc,{adsTimeline:new KV(this.a)})),this.l=new _.Pv(this.m.getSurface(),(b,c)=>this.a.resize(b,c),this.m.fd(zV).f);else this.m.onError(new _.I(1,
|
|
15
15
|
9,10003,{errorType:0},void 0));this.A.resolve()}M(a){IV(this,_.jc,a);this.l.start()}L(a){this.f=null;a=a.slot;IV(this,_.kc);this.l.stop();if(a)switch(a.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:GV(this);break;case tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL:FV(this);this.m.play();break;case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:HV(this)}}J(a){const b=a.subType;this.g.debug("ad event",b);switch(b){case tv.freewheel.SDK.EVENT_AD_IMPRESSION:IV(this,_.zc,a);IV(this,
|
|
16
|
-
_.sc,a);break;case tv.freewheel.SDK.EVENT_AD_IMPRESSION_END:IV(this,_.
|
|
16
|
+
_.sc,a);break;case tv.freewheel.SDK.EVENT_AD_IMPRESSION_END:IV(this,_.Ac,a);break;case tv.freewheel.SDK.EVENT_AD_FIRST_QUARTILE:IV(this,_.oc,a);break;case tv.freewheel.SDK.EVENT_AD_MIDPOINT:IV(this,_.uc,a);break;case tv.freewheel.SDK.EVENT_AD_THIRD_QUARTILE:IV(this,_.Dc,a);break;case tv.freewheel.SDK.EVENT_AD_COMPLETE:IV(this,_.nc,a);break;case tv.freewheel.SDK.EVENT_AD_CLICK:IV(this,_.mc,a);break;case tv.freewheel.SDK.EVENT_AD_PAUSE:IV(this,_.vc,a);break;case tv.freewheel.SDK.EVENT_AD_RESUME:IV(this,
|
|
17
17
|
_.xc,a);break;case tv.freewheel.SDK.EVENT_AD_SKIPPED:IV(this,_.yc,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_START:IV(this,_.lc,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_END:IV(this,_.wc,a);break;case tv.freewheel.SDK.EVENT_ERROR:this.m.onError(new _.I(1,9,10003,{errorType:1},{fwCode:a[tv.freewheel.SDK.INFO_KEY_ERROR_CODE],fwInfo:a[tv.freewheel.SDK.INFO_KEY_ERROR_INFO],fwModule:a[tv.freewheel.SDK.INFO_KEY_ERROR_MODULE]}))}}I(){if(!this.f){var a=this.m.getPosition();if(this.f=this.B.find(b=>
|
|
18
18
|
.5>Math.abs(a-b.getTimePosition()))||null){const b=this.B.findIndex(c=>c===this.f);this.B.splice(b,1);this.m.pause();EV(this);this.f.play()}}}H(a){if((a=a.detail)&&this.a)switch(a.currentState){case _.kp:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PLAYING);break;case _.jp:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PAUSED);break;case _.$o:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_COMPLETED);HV(this);break;case _.hp:case _.ap:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_STOPPED)}}};
|
|
19
19
|
LV.prototype.getPosition=LV.prototype.getPosition;LV.prototype.setVolume=LV.prototype.setVolume;LV.prototype.getVolume=LV.prototype.getVolume;LV.prototype.skip=LV.prototype.skip;LV.prototype.pause=LV.prototype.pause;LV.prototype.resume=LV.prototype.resume;_.Bp(new class{constructor(){this.Wa=new _.S(yV)}name(){return yV}a(a,b){return a.namespace()!==_.ud&&b&&b.freewheel?window.tv&&tv.freewheel&&tv.freewheel.SDK?!0:(this.Wa.warn("FreeWheel SDK is not loaded."),!1):!1}create(a){return new LV(a)}});};f.call(g, window);
|
package/cl.hls.js
CHANGED
|
@@ -5,7 +5,7 @@ d.name===b)||null;if(!a&&c.required)throw new _.I(_.F,4,4024,{missingTag:b});ret
|
|
|
5
5
|
b.add(c));a.thumbStreams.forEach(c=>b.add(c));return Array.from(b)},VK=function(a,b){Array.isArray(a)||(a=[a]);a.forEach(c=>{for(const d of UK(c))b(d,c)})},WK=function(a){return a.some(b=>QK(b.ca,_.Fa))},XK=function(a){return a.type===_.p||a.type===_.w},YK=function(a){if(RK(a,_.Fa))return _.Ub;a=RK(a,_.Ka);if(!a)return"LIVE";if(a.value===_.Ub)return _.Ub;if("EVENT"===a.value)return"EVENT";throw new _.I(_.F,4,4044,`Invalid EXT-X-PLAYLIST-TYPE value: ${a.value}`);},ZK=function(a){a={AUDIO:_.p,VIDEO:_.w,
|
|
6
6
|
SUBTITLES:_.H,"CLOSED-CAPTIONS":_.H}[a.toUpperCase()];if(!a)throw new _.I(_.F,4,4044,"EXT-X-MEDIA tag has an invalid TYPE attribute.");return a},$K=function(a,b,c){c=void 0===c?!1:c;var d=0;let e=null;if(a){d=a.split("@");a=Number(d[0]);if(0>=a)throw new _.I(_.F,4,4044,"Byte range length must be positive.");if(d[1]){if(d=Number(d[1]),0>d)throw new _.I(_.F,4,4044,"Byte range start byte must not be negative.");}else{if(c)throw new _.I(_.F,4,4044,"Invalid byte range, offset is required but missing.");
|
|
7
7
|
if(null==b)throw new _.I(_.F,4,4044,"Invalid byte range, cannot calculate offset based on previous byte ranges.");d=b+1}e=d+a-1}return{za:d,qa:e}},aL=function(a,b){a=RK(a,_.Aa);return $K(a?a.value:null,b)},bL=function(a){a=RK(a,"EXTINF",{required:!0}).value.split(",");return{duration:Number(a[0]),title:a[1]||null}},cL=function(a,b){b=void 0===b?{}:b;const c={Ef:!1,Yg:!1,Zg:null,Dh:null,mg:null};a=RK(a,_.Oa,{required:b.rg});if(!a)return c;const d=e=>null==e?null:Number(e);c.Ef="YES"===_.J(a,"CAN-BLOCK-RELOAD");
|
|
8
|
-
c.Yg="YES"===_.J(a,"CAN-SKIP-DATERANGES");c.Zg=d(_.J(a,"CAN-SKIP-UNTIL"));c.Dh=d(_.J(a,"HOLD-BACK"));c.mg=d(_.J(a,"PART-HOLD-BACK",void 0,{required:b.rg}));return c},dL=function(a,b,c){c=void 0===c?!1:c;a=_.J(a,"BYTERANGE");return $K(a,b,c)},eL=function(a){const b=NK(a,zK),c=NK(a,AK);a=NK(a,"EXT-X-IMAGE-STREAM-INF");return{zc:{zf:PK(b,[_.EB,_.Tb]),closedCaptions:PK(b,wK),vi:PK(b,FK)},Ed:c,
|
|
8
|
+
c.Yg="YES"===_.J(a,"CAN-SKIP-DATERANGES");c.Zg=d(_.J(a,"CAN-SKIP-UNTIL"));c.Dh=d(_.J(a,"HOLD-BACK"));c.mg=d(_.J(a,"PART-HOLD-BACK",void 0,{required:b.rg}));return c},dL=function(a,b,c){c=void 0===c?!1:c;a=_.J(a,"BYTERANGE");return $K(a,b,c)},eL=function(a){const b=NK(a,zK),c=NK(a,AK);a=NK(a,"EXT-X-IMAGE-STREAM-INF");return{zc:{zf:PK(b,[_.EB,_.Tb]),closedCaptions:PK(b,wK),vi:PK(b,FK)},Ed:c,ze:a}},gL=function(a,b){const c=aL(a.ca,null);return new fL(0,0,0,()=>[a.a],c.za,c.qa,0,b)},hL=function(a){let b=
|
|
9
9
|
Infinity,c=Infinity;UK(a).filter(XK).forEach(d=>{{d=d.T;var e=d[0].startTime;const f=d[d.length-1].endTime;d=e;e=f-e}b=Math.min(b,d);c=Math.min(c,e)});return{Sc:b,duration:c}},iL=function(a){return a.map(b=>{({duration:b}=hL(b));return b}).reduce((b,c)=>b+c,0)},jL=function(a){return(a.video?a.video.Ga:"")+" - "+(a.audio?a.audio.Ga:"")},kL=function(a,b,c,d,e){if(b===_.Ub)return{delay:0,Cd:0};b=RK(a,_.Ja);if(c&&b){e=Number(IK(b,"PART-TARGET"));if(null!=d)return{delay:d,Cd:e};({mg:d}=cL(a,{rg:!0}));
|
|
10
10
|
return{delay:d,Cd:e}}a=RK(a,_.Pa,{required:!0});a=Number(a.value);e=e||a;return null!=d?{delay:d,Cd:e}:{delay:3*a,Cd:e}},mL=function(a){const b=new Map;a.forEach(c=>{var d=`${lL(c).type}:${lL(c).groupId}`;b.has(d)?(d=b.get(d),d.includes(c)||d.push(c)):b.set(d,[c])});return b},nL=function(a){const b=new Map;for(const c of a){a=_.J(c,_.$a);a=_.Qi(a||_.tg);const d=IK(c,_.Ua),e=IK(c,"INSTREAM-ID");b.has(d)||b.set(d,new Map);b.get(d).set(e,a)}return b},oL=function(a){return a.filter(b=>"mp4a.40.34"!==
|
|
11
11
|
b)},pL=function(a,b){if(!a)return null;const c=a.Ga;return b.find(d=>lL(d).Ga===c)||null},qL=function(a){return(a=_.J(a,"CHANNELS"))?parseInt(a.split("/")[0],10):null},rL=function(a){for(const b of a)if(b.startsWith("#EXT-")&&(a=_.Xi(0,b),_.pu.has(a.name)))return 1;return 0},sL=function(a,b){return a.replace(/\{\$([a-zA-Z0-9_-]+)\}/g,(c,d)=>{c=b.get(d);if(null==c)throw new _.I(_.F,4,4044,`Undefined variable '${d}'`);return c})},tL=function(a,b){a.forEach(c=>{c.attributes.forEach(d=>{d.value=sL(d.value,
|
|
@@ -36,19 +36,19 @@ RK(c.ca,_.Ia);if(!k)throw LM.error("Failed to infer discontinuity number, becaus
|
|
|
36
36
|
_.Da)&&g++,k.pa=g});PL(b)},PM=function(a,b){return _.x(function*(){const {textStreams:c,thumbStreams:d,Sg:e}=yield NM(a,b);var f=a.f.periods[0].variants;a.a.lowLatencyMode&&null!==a.o&&(f=f.filter(g=>g.id===a.o.id));f=f.map(g=>{const h=pL(g.audio,e),k=pL(g.video,e);g=OM(a,h,k,g.bandwidth);if(!g)throw new _.I(_.F,4,4047,{message:"Video and audio are encrypted in an incompatible way.",cj:k?lL(k).Ga:void 0,audio:h?lL(h).Ga:void 0});return g});return rM(a.D.configurationId,f,c,d,!0)})},CM=function(a,
|
|
37
37
|
b){EM(a)||2!==a.a.timeline.version||(a.I||(a.I=b[0].startTime),_.hF(b,-a.I))},QM=function(a,b){b=b.flatMap(d=>d.T[0].ca);b=RK(b,_.Ma);if(!b)return null;const c=(new Date(b.value)).getTime();return isNaN(c)?(a.g.warn("Failed to parse EXT-X-PROGRAM-DATE-TIME tag "+`value (value: ${b.value}).`),null):c/1E3},RM=function(a,b,c){b=b.find(d=>null!==RK(d.ca,_.Ba));if(!b)return[];if(null===c)throw new _.I(_.F,4,4024,"EXT-X-PROGRAM-DATE-TIME tag is required when EXT-X-DATERANGE tags are present");return b.ca.filter(d=>
|
|
38
38
|
d.name===_.Ba).map(d=>{a:{var e=a.C,f=!EM(a),g=_.J(d,"ID"),h=_.J(d,"START-DATE");if(null===g||null===h)_.ou.warn("Invalid EXT-X-DATERANGE missing mandatory ID or START-DATE attribute, ignoring the EXT-X-DATERANGE tag.",d),d=null;else{e=f?e-c:-c;var k=new Date(h);h=k.getTime()/1E3+e;g={id:g,startTime:h,startDate:k};f=MK(_.J(d,yK));void 0!==f&&0<=f&&(g.duration=f);var l=MK(_.J(d,"PLANNED-DURATION"));void 0!==l&&0<=l&&(g.plannedDuration=l);var m=_.J(d,"CLASS");null!==m&&(g.schemeIdUri=m);var n=_.J(d,
|
|
39
|
-
"END-DATE");n=n?new Date(n):null;null!==n&&n.getTime()>=k.getTime()&&(g.endDate=n);{const v=d.attributes;if(null==v)var r=null;else{k={};for(r of v)r.name.trim().startsWith("X-")&&(k[r.name]=r.value);r=_.oh(k)?k:null}}r=r||{};(k=_.J(d,"CUE"))&&(r.CUE=k.split(","));if(m===_.Fd){k=d.attributes;if(null==k)var u=null;else{m={};for(u of k)switch(u.name){case _.ac:m[_.ac]=u.value;break;case _.$b:m[_.$b]=u.value;break;case _.
|
|
39
|
+
"END-DATE");n=n?new Date(n):null;null!==n&&n.getTime()>=k.getTime()&&(g.endDate=n);{const v=d.attributes;if(null==v)var r=null;else{k={};for(r of v)r.name.trim().startsWith("X-")&&(k[r.name]=r.value);r=_.oh(k)?k:null}}r=r||{};(k=_.J(d,"CUE"))&&(r.CUE=k.split(","));if(m===_.Fd){k=d.attributes;if(null==k)var u=null;else{m={};for(u of k)switch(u.name){case _.ac:m[_.ac]=u.value;break;case _.$b:m[_.$b]=u.value;break;case _.dc:m[_.dc]=MK(u.value);break;case _.bc:m[_.bc]=MK(u.value);break;case "X-SNAP":m["X-SNAP"]=
|
|
40
40
|
u.value.split(",");break;case _.cc:m[_.cc]=u.value.split(",")}m[_.ac]&&m[_.$b]||!m[_.ac]&&!m[_.$b]?(_.ou.warn("Invalid EXT-X-DATERANGE Interstitial attributes X-ASSET-URI, X-ASSET-LIST"),u=null):u=_.oh(m)?m:null}if(null===u){_.ou.warn("Invalid interstitial attributes, ignoring the EXT-X-DATERANGE tag.",d);d=null;break a}r=Object.assign(r,u)}_.oh(r)&&(g.customAttributes=r);g.endTime=n?n.getTime()/1E3+e:f?h+f:l?h+l:h;g.type=_.hi;d=g}}return d}).filter(Boolean)},HM=function(a,b){const c=new Set(b.map(d=>
|
|
41
41
|
d.id));a.B.forEach((d,e)=>{c.has(e)||a.B.delete(e)});for(const d of b){if((b=a.B.get(d.id))&&b.startTime!==d.startTime)a.D.onError(new _.I(1,4,4044,"EXT-X-DATERANGE START-DATE has changed for"+` ID=${d.id}`));const e={configurationId:a.D.configurationId,schemeIdUri:d.schemeIdUri,customAttributes:d.customAttributes,value:"",startTime:d.startTime,endTime:d.endTime,id:d.id,type:_.hi,eventElement:null};b&&!LK(b,e)||a.B.set(d.id,e)}return Array.from(a.B.values())},SM=function(a,b,c){a.A=_.Ub;_.UD(b,!0);
|
|
42
42
|
b.f=c[c.length-1].endTime},yM=function(a,b,c,d){a=CL(a.R,b,c);a.verbatimUri=d;return a},AM=function(a){return a.filter(b=>b.name===zK&&_.J(b,_.Ib)===_.EB&&!_.J(b,_.Kb)).map(b=>{const c=qL(b),d=_.J(b,_.$a)||_.tg;return{groupId:IK(b,_.Ua),id:_.fK++,label:IK(b,_.gb),language:d,channelsCount:c,primary:"YES"===_.J(b,"DEFAULT")}})},BM=function(a,b){return _.x(function*(){var c=nL(b.zc.closedCaptions),d=TM(a,b.Ed),e=yield UM(a,b),f=Object.values(e).flat().map(h=>h.playlist);MM(a,f);f=f[0];var g=YK(f.ca);
|
|
43
|
-
a.A=g;a.K=cL(f.ca);f=kL(f.ca,g,a.a.lowLatencyMode||!1,a.a.suggestedPresentationDelay,a.a.liveRefreshPeriod);g=yield VM(a,e.Af,d);c=yield WM(a,e.Ed,g,c);d=yield XM(a,e.si,d);g=yield YM(a,e.
|
|
43
|
+
a.A=g;a.K=cL(f.ca);f=kL(f.ca,g,a.a.lowLatencyMode||!1,a.a.suggestedPresentationDelay,a.a.liveRefreshPeriod);g=yield VM(a,e.Af,d);c=yield WM(a,e.Ed,g,c);d=yield XM(a,e.si,d);g=yield YM(a,e.ze);d=rM(a.D.configurationId,c,d,g,!EM(a));a.D.filterAllPeriods(d);c=[...e.Ed,...e.Af].map(h=>h.playlist);e=QM(a,c);c=RM(a,c,e);return{periods:d,ai:e,xi:c,Nh:f}})},DM=function(a,b,c,d){let e=!0,f=null,g=0;EM(a)||(e=!1,f=0,g=b);b=a.a.timeline||{};b.type=void 0;a=new _.iK(b,f,g,!0,void 0,!!a.a.lowLatencyMode);_.UD(a,
|
|
44
44
|
e);vM(a,c);d&&_.TD(a,d);return a},FM=function(a){var b=0;for(var c of a.j.values())b=Math.max(b,c.streams[0].Sc);for(c=0;95443.7176888889<=b;)c+=95443.7176888889,b-=95443.7176888889;if(c){a.g.debug("Offsetting live streams by",c,"to compensate for rollover");for(const d of a.j.values())b=d.streams[0],95443.7176888889>b.Sc?(a.g.debug("Offset applied to",b.type),b.segmentIndex.offset(c)):a.g.debug("Offset NOT applied to",b.type)}},GM=function(a,b,c){c=iL(c);"LIVE"===a.A||"EVENT"===a.A?(c=Math.max(c,
|
|
45
45
|
b.J),isNaN(a.a.availabilityWindowOverride)||(c=a.a.availabilityWindowOverride),b.A=c):a.A===_.Ub&&(b.f=c)},NM=function(a,b){return _.x(function*(){const c=g=>lL(g.stream).type===_.w||lL(g.stream).type===_.p;var d=b.filter(c),e=b.filter(g=>!c(g)),f=g=>{g=g.map(h=>{var k=lL(h.stream);k={language:k.language,channelsCount:k.channelsCount,spatialAudio:k.spatialAudio,closedCaptions:k.closedCaptions,primary:k.primary,kind:k.kind||null,groupId:k.groupId,type:k.type,codecs:k.codecs,name:k.originalId,uri:k.Ga,
|
|
46
46
|
Fd:{width:k.width,height:k.height,frameRate:k.frameRate}};h=Object.assign({},{playlist:h.playlist},k);return ZM(a,h)});return Promise.all(g)};d=yield f(d);f=yield f(e);$M(a,d.concat(f));e=f.filter(g=>lL(g).type===_.NC);f=f.filter(g=>lL(g).type===_.re);return{textStreams:e,thumbStreams:f,Sg:d}})},OM=function(a,b,c,d,e){const f=[],g=(c||b).length();for(let n=0;n<g;n++){var h=b?b.streams[n]||null:null,k=c?c.streams[n]||null:null,l=h,m=k;l=l&&m?_.nD(l.drmInfos,m.drmInfos)?_.mD(l.drmInfos,m.drmInfos):
|
|
47
47
|
null:l?l.drmInfos:m?m.drmInfos:null;if(!l)return null;m=d;h={id:e?e:a.h++,language:h?h.language:_.tg,primary:!!h&&h.primary||!!k&&k.primary,audio:h,video:k,bandwidth:m,drmInfos:l,allowedByApplication:!0,allowedByKeySystem:!0};f.push(h)}return new aN(f)},ZM=function(a,b){return _.x(function*(){const c=b.playlist,d=b.codecs,e=b.type,f=b.Qc,g=b.jc,h=b.groupId,k=b.muxedAudioId,l=b.primary;var m=b.kind;const n=b.name,r=b.channelsCount,u=b.spatialAudio,v=b.closedCaptions,y=b.Fd,A=_.Qi(f||_.tg);if(1!==c.type)throw new _.I(_.F,
|
|
48
|
-
4,4017);const E=yield bN(a,c,e,d),G=a.a.lowLatencyMode?_.CC:_.BC;let X=m;e!==_.H||m||(X=_.NC);const dd=YK(c.ca);m=E.map(
|
|
49
|
-
segmentIndex:va,segmentLookupStrategy:G,initSegmentReference:
|
|
48
|
+
4,4017);const E=yield bN(a,c,e,d),G=a.a.lowLatencyMode?_.CC:_.BC;let X=m;e!==_.H||m||(X=_.NC);const dd=YK(c.ca);m=E.map(ec=>{const Nb=ec.T,Yd=ec.fh,Ob=ec.mimeType,fc=ec.pa,gc=Nb[0].startTime,Fb=Nb[Nb.length-1].endTime,ib=Fb-gc,va=new _.jK(Nb),xb=Nb[0].initSegment||null;return{id:null===g?_.fK++:g,originalId:n,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:va.f.bind(va),getSegmentReference:va.get.bind(va),adjustSegmentDurations:va.h.bind(va),getDuration:va.getDuration.bind(va),
|
|
49
|
+
segmentIndex:va,segmentLookupStrategy:G,initSegmentReference:xb,mimeType:Ob,codecs:d,kind:X,Lf:Yd.type,encrypted:Yd.type===HK,aesEncrypted:ec.aesEncrypted,keyId:Yd.keyId,language:A,originalLanguage:f||_.tg,label:n,type:e,primary:l,trickModeVideo:null,emsgSchemeIdUris:null,frameRate:y?y.frameRate:void 0,width:y?y.width:void 0,height:y?y.height:void 0,bandwidth:void 0,roles:[],channelsCount:r,spatialAudio:u,closedCaptions:v,T:Nb,drmInfos:Yd.drmInfos,pa:fc,Ga:c.verbatimUri,le:c.a,Sc:gc,Ee:Fb,duration:ib,
|
|
50
50
|
groupId:h,Xi:dd,muxedAudioId:k}});return new cN(m)})},$M=function(a,b){b.forEach(c=>{a.j.a.set(lL(c).Ga,c)})},TM=function(a,b){const c=new Map;for(const f of b){var d=_.J(f,_.EB);b=_.J(f,_.Tb);var e=_.J(f,FK);const g=dN(a,f);if(e){const h=_.nk(_.H,g);c.set(`${_.H}:${e}`,h);e=g.indexOf(h);-1<e&&g.splice(e,1)}d&&(e=eN(_.p,g),c.set(`${"audio"}:${d}`,e));b&&(d=eN(_.w,g),c.set(`${"video"}:${b}`,d))}return c},UM=function(a,b){return _.x(function*(){const c=yield Promise.all([fN(a,b.zc.zf),fN(a,b.zc.vi),
|
|
51
|
-
fN(a,b.Ed),fN(a,b.
|
|
51
|
+
fN(a,b.Ed),fN(a,b.ze)]),[d,e,f,g]=c;return{Af:d,si:e,Ed:f,ze:g}})},VM=function(a,b,c){return _.x(function*(){if(0===b.length)return new Map;var d=[gN(a,b[0],c)];yield d[0];d=d.concat(b.slice(1).map(e=>gN(a,e,c)));d=yield Promise.all(d);return mL(d)})},WM=function(a,b,c,d){return _.x(function*(){const e=new Set;var f=[...b];let g=0;var h=Infinity;for(let k=0;k<f.length;++k){const l=Number(IK(f[k].tag,_.la));l<h&&(h=l,g=k)}h=f.splice(g,1).pop();h=yield hN(a,h,c,d,e);f=f.map(k=>hN(a,k,c,d,e));f=yield Promise.all(f);
|
|
52
52
|
f.splice(g,0,h);return f.reduce(_.eD,[])})},XM=function(a,b,c){return Promise.all(b.map(d=>gN(a,d,c)))},YM=function(a,b){return Promise.all(b.map(c=>iN(a,c)))},jN=function(a,b){return _.x(function*(){const c=TK(a.w,b.verbatimUri),{response:d,text:e}=yield xM(a,c);return yM(a,e,d.uri,b.verbatimUri)})},kN=function(a,b,c){return _.x(function*(){const d=yield ZM(a,{playlist:c,codecs:b.codecs,type:b.type,Qc:b.originalLanguage,jc:b.id,groupId:b.groupId,primary:b.primary,kind:b.kind||null,name:b.label,channelsCount:b.channelsCount,
|
|
53
53
|
spatialAudio:b.spatialAudio||!1,closedCaptions:b.closedCaptions,Fd:{width:b.width,height:b.height,frameRate:b.frameRate}});b.bandwidth&&iM(d,b.bandwidth);return d})},EM=function(a){return a.A===_.Ub},fN=function(a,b){return _.x(function*(){return(yield Promise.all(b.map(c=>_.x(function*(){const d=yield lN(a,c);return d?{tag:c,playlist:d}:null})))).filter(Boolean)})},JM=function(a,b){return _.x(function*(){var c=new _.Ci(lL(b).le);if(a.a.lowLatencyMode&&a.K&&a.K.Ef){var d=b.streams[b.streams.length-
|
|
54
54
|
1].segmentIndex;if(d=d.a[d.a.length-1]){var e=d.a,f=e.length-1;d={Oh:d.position,Uh:e&&0<e.length?f:null}}else d=null;if(e=d)d=e.Oh,e=e.Uh,f=_.bk(c.a.toString()),f._HLS_msn=d.toString(),null===e&&f._HLS_part&&delete f._HLS_part,null!==e&&(f._HLS_part=e.toString()),d=_.ak(f,!0),d=new _.Ji(d),_.Fi(c,d)}const {response:g,text:h}=yield xM(a,c.toString());c=lL(b).Ga;d=lL(b).le;e=g.uri;d!==e&&(d=e,eM(b,d));c=yM(a,h,d,c);return{stream:b,playlist:c}})},dN=function(a,b){var c=_.J(b,_.oa,a.a.hlsDefaultCodecs||
|
|
@@ -65,15 +65,15 @@ b=dL(a,null,!0);return new _.eK(()=>[e],b.za,b.qa,c)},vN=function(a,b,c,d,e,f,g)
|
|
|
65
65
|
null!=r,v=r?[r]:[];if(!u&&!a.a.lowLatencyMode)return null;a=0;r={za:0,qa:null};let y=null;u?({duration:c}=bL(n),a=e+c,r=aL(n,b?b.qa:null)):(b=vN(b,c,d,e,f,g,k),a=b[b.length-1].endTime,y=b);h=h===_.re?SK(n):null;d=new fL(d,e,a,()=>v,r.za,r.qa,f,g,!1,null,h?h.hd:null,h?h.Dd:null,h?h.durationPerTile:null,y,m);d.pa=l;return d},qN=function(a,b,c,d,e,f,g){return _.x(function*(){var h=d[0];if(null!=a.C)return a.C;if(!EM(a)&&a.f)try{var k=a.j.get(c);var l=k?dM(k,e)||null:null;if(!l)throw new _.I(_.F,4,4030,
|
|
66
66
|
"Segment not found in pervious playlist update.");var m=l.startTime+l.Fa;a.g.debug(`Setting playlist start time to ${m}.`);return a.C=m}catch(n){if(h=a.j.get(c))m=h.streams[h.streams.length-1].T,m=m[m.length-1],a.g.warn(`Last #EXT-X-MEDIA-SEQUENCE values ${h.streams[0].T[0].position} - ${m.position}`+`, new values ${e} - ${e+d.length-1}.`,b,h);throw new _.I(_.F,4,4047,{message:"The updated playlist does not share any segments with the previous one.",uri:c});}m=yield xN(a,f,g,h);l=$L(h.ca,a.w,e);k=
|
|
67
67
|
uN(h,b,l);h=yield yN(a,k,h,l,m,g);a.g.debug(`Setting playlist start time to ${h}.`);return a.C=h})},rN=function(a,b,c,d,e,f,g,h){return _.x(function*(){var k=c[0],l=null==h;tN(c);const m=yield xN(a,f,g,k);var n=h?h.Lh:null;if(QK(c[0].ca,_.Ga)||null===n)n=XL(c,m),n=0===n.length?[TL()]:n;else{var r=XL(c,m);n=[n,...r]}r=n;n=r[r.length-1];r=UL(r);let u=h?h.Mh:null;var v=zN(u,k.ca,a.w,d);let y=uN(k,b,v)||(h?h.Fh:null);const A=k.pa;k=l?e:yield AN(a,A,y,k,d,v,m,g);l=[];v=!1;for(let G=0;G<c.length;G++){var E=
|
|
68
|
-
c[G];const X=l[l.length-1]||null,dd=0===G?0:X.endTime,
|
|
68
|
+
c[G];const X=l[l.length-1]||null,dd=0===G?0:X.endTime,ec=d+G,Nb=zN(u,E.ca,a.w,ec);(u=Nb)&&(v=!0);if(E=wN(a,X,E,ec,dd,k,Nb,f,b,A,y))y=E.initSegment,l.push(E)}return{T:l,fh:r,Lh:n,aesEncrypted:v,mimeType:m,endTime:l[l.length-1].endTime,pa:A,Fh:y,Mh:u}})},xN=function(a,b,c,d){return _.x(function*(){const e=d.a;var f=RK(d.ca,_.Ha);f=f?IK(f,_.Kb):null;return BN(a,b,c,e,f)})},yN=function(a,b,c,d,e,f){return _.x(function*(){if(null==c.a)return 0;const g=gL(c,d);return bM(a.S,b,g,e,f,null!=d)})},zN=function(a,
|
|
69
69
|
b,c,d){return b.some(e=>e.name===_.Ga&&"NONE"===_.J(e,DK))?null:(b=$L(b,c,d))?b:a&&a.generatedIv?Object.assign({},a,{iv:_.bm(new Uint8Array(12),HL(d))}):a},AN=function(a,b,c,d,e,f,g,h){return _.x(function*(){if(a.L.has(b))return a.L.get(b);const k=yield yN(a,c,d,f,g,h);a.g.debug(`Segment #${e} has raw media timestamp `+`${k} s.`);a.L.set(b,k);return k})},BN=function(a,b,c,d,e){return _.x(function*(){const f=[d,e].filter(Boolean);var g=_.qk(f,b,c);if(g)return g;g=_.Bj([d],a.a.attemptParameters);g.method=
|
|
70
70
|
"HEAD";g.type=2;g=(yield a.H(g)).headers["content-type"];if(!g)throw new _.I(_.F,4,4021,"Unknown MIME type of: "+f.join(", "));return g.toLowerCase().split(";")[0]})},zM=a=>{a=_.nu(a)||"";return null!=_.mu.video[a]?_.w:null!=_.mu.audio[a]?_.p:null},xL=class{constructor(a,b,c,d){if(1===b){if(!d||0===d.length)throw new _.I(_.F,4,4043,"Media playlist must have at least one segment!");if(null==d[0].a)throw new _.I(_.F,4,4043,"Media playlist must have at least one full segment!");}this.a=a;this.verbatimUri=
|
|
71
71
|
"";this.type=b;this.ca=c;this.T=1===b?d:null}},DL=class{constructor(a,b,c){c=void 0===c?[]:c;this.ca=b;this.a=a;this.f=c;this.pa=-1}},fL=class extends _.jE{constructor(a,b,c,d,e,f,g,h,k,l,m,n,r,u,v){u=void 0===u?[]:u;super(a,b,c,d,e,f,g,void 0===h?null:h,void 0===k?!1:k,void 0===l?null:l,void 0===m?null:m,void 0===n?null:n,void 0===r?null:r,u,void 0===v?null:v);this.pa=0}},CN=class{constructor(){this.h=0;this.a=new Map}},DN=class{constructor(){this.a=new Map;this.f=new Map}set(a,b){this.f.set(a,b);
|
|
72
72
|
return b.then(c=>this.a.set(a,c)).catch(()=>{}).then(()=>this.f.delete(a))}has(a){return this.a.has(a)}get(a){return this.a.get(a)||null}values(){return Array.from(this.a.values())}clear(){this.f.clear();this.a.clear()}},LM=new _.S("clpp.hls.DiscontinuityUtils");var ZL={"com.apple.streamingkeydelivery":function(a,b){if(b===_.Hg)throw new _.I(_.F,4,4041);if(IK(a,DK)===EK)throw new _.I(_.F,4,4044,"EXT-X-KEY:METHOD SAMPLE-AES-CTR is not supported in FairPlay.");return _.hD(_.Ed,[{initDataType:_.Wf,initData:new Uint8Array(0)}],"")},"com.microsoft.playready":SL,"urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":SL,"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":function(a){var b=IK(a,DK);if(!QL.includes(b))return RL.error("Widevine in HLS is only supported with [",
|
|
73
73
|
QL.join(", "),"], not",b),null;b=IK(a,_.Kb);b=_.At(b);b=_.K(b.data);b=_.hD(_.Jd,[{initDataType:_.kd,initData:b}],"");if(a=_.J(a,"KEYID"))b.keyIds=[a.substr(2).toLowerCase()];return b}},QL=["SAMPLE-AES",EK],RL=new _.S("clpp.hls.DrmParser");var YL=new _.S("clpp.hls.EncryptionUtils");var EN=class{constructor(a){this.g=new _.S("clpp.hls.MediaReader");this.f=a;this.a={attemptParameters:_.xj()}}};var cN=class{constructor(a){this.streams=a}length(){return this.streams.length}};var aN=class{constructor(a){this.a=a}length(){return this.a.length}};var FN=class{constructor(){this.a=this.D=null;this.h=1;this.j=new DN;this.w="";this.R=new CN;this.G=0;this.o=null;this.l=new _.Gk(()=>{this.Xb()});this.A=_.Ub;this.f=null;this.F=new _.vu;this.K=this.C=null;this.g=new _.S("clpp.hls.HlsParser");this.L=new Map;this.S=new EN(this.H.bind(this));this.O=!1;this.I=null;this.M=!1;this.B=new Map;this.J=new Set}configure(a){this.a=a;this.S.a=a}setCurrentVariant(a){this.o=a}start(a,b){const c=this;return _.x(function*(){if(c.O)throw Error("start() may be called only once!");
|
|
74
|
-
c.O=!0;c.D=b;const {response:d,text:e}=yield xM(c,a);c.w=d.uri;const f=yield IM(c,e);c.f=f;const g=c.G;c.l&&0<g&&c.l.
|
|
74
|
+
c.O=!0;c.D=b;const {response:d,text:e}=yield xM(c,a);c.w=d.uri;const f=yield IM(c,e);c.f=f;const g=c.G;c.l&&0<g&&c.l.ha(g);return f})}requestStop(){this.M=!0}stop(){this.l&&(this.l.stop(),this.l=null);const a=[];this.F&&(a.push(this.F.destroy()),this.F=null);this.j.clear();this.f=this.a=this.D=this.o=null;this.B.clear();this.J.clear();return Promise.all(a)}update(){const a=this;return _.x(function*(){const b=a.f;if(!EM(a)&&b){var c=b.presentationTimeline;"LIVE"===a.A&&(a.C=null);var d=Array.from(a.j.values());
|
|
75
75
|
if(a.a.lowLatencyMode&&null!==a.o){const g=wM(a);d=d.filter(h=>g.includes(lL(h).Ga))}var e=yield KM(a,d);d=e.map(g=>g.playlist);MM(a,d);e=yield PM(a,e);kM(b.periods,e).forEach(g=>{a.D.filterNewPeriod(g)});CM(a,e);var f=QM(a,d);f=RM(a,d,f);b.cues=HM(a,f);mM(b.periods,e);vM(c,e);if(d=WK(d))!0!==a.a.keepTimelineLive&&SM(a,c,e),a.l.stop(),a.l=null;if(a.D.onUpdate)a.D.onUpdate(b);if(d&&a.D.onTurnedStatic)a.D.onTurnedStatic();a.M&&(yield a.stop());return b}})}loadVariant(a,b){const c=this;return _.x(function*(){const d=
|
|
76
76
|
a.id;var e=c.f.periods.find(k=>k.id===b);if(e&&(e=e.variants.find(k=>k.id===d)))return e;e=c.f.alternativeVariants.find(k=>k.id===d);if(!e)throw new _.zi(`No alternative variant with id: ${d}`);var f=null,g=null;if(e.audio){const k=e.audio;f=mN(c,k.verbatimUri,()=>_.x(function*(){const l=yield jN(c,k);return kN(c,k,l)}))}if(e.video){const k=e.video;g=mN(c,k.verbatimUri,()=>_.x(function*(){const l=yield jN(c,k);return kN(c,k,l)}))}f=yield f;g=yield g;e=OM(c,f,g,e.bandwidth,e.id);let h;e&&(e=rM(c.D.configurationId,
|
|
77
77
|
[e],[],[],!EM(c)),c.D.filterAllPeriods(e),e.forEach((k,l)=>{c.f.periods[l].variants.push(k.variants[0]);b===c.f.periods[l].id&&(h=k.variants[0])}));if(!h)throw new _.zi(`Could load variant with id: ${d}`);return h})}loadTextStream(a,b){const c=this;return _.x(function*(){let d;var e=c.f.periods.find(f=>f.id===b);e&&(e=e.textStreams.find(f=>f.id===a)||null)&&(d=e);if(!d&&c.f.alternativeTextStreams){const f=c.f.alternativeTextStreams.find(h=>h.id===a)||null;if(!f)throw new _.zi(`Could not load text stream with id: ${a}`);
|
|
78
|
-
const g=yield mN(c,f.verbatimUri,()=>_.x(function*(){const h=yield jN(c,f);return kN(c,f,h)}));g&&c.f.periods.forEach((h,k)=>{h=g.streams[k];c.f.periods[k].textStreams.push(h);h.id===a&&(d=h)})}if(!d)throw new _.zi(`Could not load text stream with id: ${a}`);return d})}Xb(){const a=this;return _.x(function*(){a.g.debug(_.qC);if(a.D)try{yield a.update(),a.l&&0<a.G&&a.l.
|
|
78
|
+
const g=yield mN(c,f.verbatimUri,()=>_.x(function*(){const h=yield jN(c,f);return kN(c,f,h)}));g&&c.f.periods.forEach((h,k)=>{h=g.streams[k];c.f.periods[k].textStreams.push(h);h.id===a&&(d=h)})}if(!d)throw new _.zi(`Could not load text stream with id: ${a}`);return d})}Xb(){const a=this;return _.x(function*(){a.g.debug(_.qC);if(a.D)try{yield a.update(),a.l&&0<a.G&&a.l.ha(a.G)}catch(b){if(!(b instanceof _.I))throw b;a.D&&(a.D.onError(b),1===b.severity&&a.l&&a.l.ha(.1))}})}H(a){if(!this.F)throw new _.I(_.F,
|
|
79
79
|
7,7001);a=this.D.networkingEngine.fetch(a);_.Mj(this.F,a);return a.V}};_.z("clpp.hls.HlsComponent",class extends _.Kv{f(){_.et.m3u8=FN;_.ct[_.zl]=FN;_.ct[GK]=FN}a(){_.IE("m3u8");_.JE(_.zl);_.JE(GK)}id(){return"hls"}});};f.call(g, window);
|
package/cl.htmlcue.js
CHANGED
|
@@ -2,8 +2,8 @@ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(windo
|
|
|
2
2
|
b=b[1]?b[1]:b[2];a.input=a.input.substr(b.length);return b},pU=function(a){let b=null;for(;b=a.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)a=a.replace(b[0],c=>oU[c]);return a},rU=function(a,b){qU(a,b);Array.from(b.getElementsByTagName("*")).forEach(c=>{qU(a,c)})},qU=function(a,b){for(const c in a)null!=a[c]&&(b.style[c]=a[c])},sU=function(a,b){return 0===a?"0":a+b},tU=function(a,b){return 1>Math.abs(a-b)||a<b},uU=function(a,b){return a<b&&1<Math.abs(a-b)},vU=function(a,b){return a>b&&1<Math.abs(a-b)},wU=
|
|
3
3
|
function(a,b){return 1>Math.abs(a-b)||a>b},yU=function(a){const b=a.getBoundingClientRect();var c=getComputedStyle(a,null);const d=parseFloat(c.getPropertyValue("border-left-width"))||0,e=parseFloat(c.getPropertyValue("border-right-width"))||0;var f=parseFloat(c.getPropertyValue("border-top-width"))||0;c=parseFloat(c.getPropertyValue("border-bottom-width"))||0;const g=(b.top||a.offsetTop)+f;f=(b.height||a.offsetHeight)-f-c;return new xU(b.left+d,b.right+e,g,(b.bottom||g+f)+c,f,(b.width||a.offsetWidth)-
|
|
4
4
|
d-e)},zU=function(a){return new xU(a.left,a.f,a.top,a.a,a.height,a.width)},AU=function(a,b){return b.some(c=>uU(a.left,c.f)&&vU(a.f,c.left)&&uU(a.top,c.a)&&vU(a.a,c.top))},BU=function(a,b){return wU(a.top,b.top)&&tU(a.a,b.a)&&wU(a.left,b.left)&&tU(a.f,b.f)},CU=function(a,b,c){switch(c){case "+x":return uU(a.left,b.left);case "-x":return vU(a.f,b.f);case "+y":return uU(a.top,b.top);case "-y":return vU(a.a,b.a);default:throw Error("Unknown axis");}},DU=function(a){return a.f.writingMode===_.Wt},EU=
|
|
5
|
-
function(a){var b=a.a.childNodes[0],c=a.a.getBoundingClientRect();const d=b.getClientRects();b=c.height/d.length;c=c.width/d.length;return DU(a)?b:c},FU=function(a){switch(a.f.writingMode){case _.Wt:return"horizontal-tb";case _.Fg:return _.Fg;case _.Gg:return _.Gg;default:throw Error("Unknown writing mode");}},GU=function(a){switch(a.f.positionAlign){case _.
|
|
6
|
-
_.t)switch(b){case _.
|
|
5
|
+
function(a){var b=a.a.childNodes[0],c=a.a.getBoundingClientRect();const d=b.getClientRects();b=c.height/d.length;c=c.width/d.length;return DU(a)?b:c},FU=function(a){switch(a.f.writingMode){case _.Wt:return"horizontal-tb";case _.Fg:return _.Fg;case _.Gg:return _.Gg;default:throw Error("Unknown writing mode");}},GU=function(a){switch(a.f.positionAlign){case _.Ae:return _.ue;case "auto":case _.ld:return _.Vt;case _.Be:return _.Mf}return a.f.textAlign},HU=function(a,b){if(typeof a.f.position===_.t&&typeof a.f.size===
|
|
6
|
+
_.t)switch(b){case _.Ae:return a.f.position;case "auto":case _.ld:return a.f.position-a.f.size/2;case _.Be:return a.f.position-a.f.size}return 0},IU=function(a){if(!a.f.positionAlign)switch(a.f.textAlign){case _.Zf:case _.ue:return _.Ae;case _.Vt:return _.ld;case _.ie:case _.Mf:return _.Be}return a.f.positionAlign},LU=function(a,b,c){return(JU(a)||KU(a))&&_.th(c)?sU(c,_.Ff):JU(a)&&_.B(c)?sU(0,_.Ff):DU(a)&&_.th(b)?sU(b,"%"):jU},MU=function(a,b,c){return DU(a)&&_.th(c)?sU(c,_.Ff):(JU(a)||KU(a))&&_.th(b)?
|
|
7
7
|
sU(b,"%"):jU},KU=function(a){return a.f.writingMode===_.Gg},JU=function(a){return a.f.writingMode===_.Fg},NU=function(a,b){if(a.j)switch(b.writingMode){case _.Wt:return["-y"];case _.Fg:return["+x"];case _.Gg:return["-x"]}a=[];switch(b.writingMode){case _.Wt:a=["+y","-y"];break;case _.Fg:a=["+x","-x"];break;case _.Gg:a=["-x","+x"]}0>b.line&&(a=a.reverse());return a},OU=function(a){for(a.h=[];0<a.f.childNodes.length;)a.f.removeChild(a.f.childNodes[0]);a.a=yU(a.l.a)},PU=function(a,b,c){a=a.f;const d=
|
|
8
8
|
a.viewportAnchorUnits;if(d===_.cu)return a.viewportAnchorY/100*c-a.regionAnchorY/100*b;if(0===d)return a.viewportAnchorY-a.regionAnchorY;throw Error(fU);},RU=function(a,b,c,d){const e=document.createElement(_.eg),f=e.dataset;f.name=b;f.for=c;d&&(f.name=`${b} (sandbox)`,f.sandbox=!0);c=document.head;c.appendChild(e);QU(a,c,b);a.g.debug(`Created HTML style element #${b}.`);return e.sheet},SU=function(a,b){a=`.${a.j} .clpp-text-container`;const c=`${a} .clpp-text-cue`;return b=b.replace(/::cue\((#[^)]+)\)/g,
|
|
9
9
|
`${a} $1`).replace(/::cue\(([^)]+)\)/g,`${c} $1`).replace(/::cue-region\(([^)]+)\)/g,`${a} $1 .clpp-text-cue`).replace(/::cue/g,c).replace(/::cue-region/g,`${a} .clpp-text-cue-region .clpp-text-cue`).replace(/::ttml/g,a)},TU=function(a,b){let c=!1;try{a.f.insertRule(b,0);const d=a.f.cssRules[0];d instanceof CSSStyleRule&&(c=d.selectorText.split(",").every(e=>0===e.trim().indexOf(`.${a.j} `)))}catch(d){}0<a.f.cssRules.length&&a.f.deleteRule(0);return c},UU=function(a){if(null!=a.a){for(;0<a.a.cssRules.length;)a.a.deleteRule(0);
|
package/cl.ima.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var MT="clpp.ima.AdsManagerFactory",NT=function(a,b){return new Promise(c=>{if(a.readyState===HTMLMediaElement.HAVE_NOTHING&&0===a.networkState)c();else b.one(a,"emptied",c)})},OT=function(a){a=a.K;const b=new google.ima.AdsRenderingSettings;b.restoreCustomPlaybackStateOnAdBreakComplete=!1;typeof a.bitrate===_.t&&(b.bitrate=a.bitrate);b.enablePreloading=typeof a.enablePreloading===_.$c?a.enablePreloading:!0;typeof a.loadVideoTimeout===_.t&&(b.loadVideoTimeout=a.loadVideoTimeout);Array.isArray(a.mimeTypes)&&
|
|
2
2
|
(b.mimeTypes=a.mimeTypes);typeof a.playAdsAfterTime===_.t&&(b.playAdsAfterTime=a.playAdsAfterTime);typeof a.useStyledLinearAds===_.$c&&(b.useStyledLinearAds=a.useStyledLinearAds);b.uiElements=Array.isArray(a.uiElements)?a.uiElements:[];return b},PT=function(a){return!1===a.K.disableCustomPlayback&&a.a.isCustomPlaybackUsed()},QT=function(a){const b=a.a,c=a.A,d=google.ima.AdEvent.Type;c.on(b,d.AD_BREAK_READY,a.Aa.bind(a));c.on(b,d.LOADED,a.Y.bind(a));c.on(b,d.CONTENT_PAUSE_REQUESTED,a.qc.bind(a));c.on(b,
|
|
3
|
-
d.STARTED,a.ba.bind(a));c.on(b,d.LOG,a.Oa.bind(a));c.on(b,d.AD_PROGRESS,a.$.bind(a));c.on(b,d.AD_BUFFERING,a.Ha.bind(a));c.on(b,d.FIRST_QUARTILE,a.U.bind(a));c.on(b,d.MIDPOINT,a.pb.bind(a));c.on(b,d.THIRD_QUARTILE,a.
|
|
4
|
-
null;a.m.onError(new _.I(1,9,10003,{errorType:c},b))},ST=function(a){return _.x(function*(){yield a.m.detach();var b=a.m;b.a&&b.a.stopForwardingEventsTo(b)})},TT=function(a,b,c){c=c&&c.getAd();let d=null;c&&(d={ad:new W(c,a.H,a.G)});a.m.trigger(new _.D(b,d))},UT=function(a){a.C=null;TT(a,_.
|
|
3
|
+
d.STARTED,a.ba.bind(a));c.on(b,d.LOG,a.Oa.bind(a));c.on(b,d.AD_PROGRESS,a.$.bind(a));c.on(b,d.AD_BUFFERING,a.Ha.bind(a));c.on(b,d.FIRST_QUARTILE,a.U.bind(a));c.on(b,d.MIDPOINT,a.pb.bind(a));c.on(b,d.THIRD_QUARTILE,a.ja.bind(a));c.on(b,d.PAUSED,a.Pb.bind(a));c.on(b,d.RESUMED,a.Qb.bind(a));c.on(b,d.CLICK,a.S.bind(a));c.on(b,d.SKIPPED,a.da.bind(a));c.on(b,d.IMPRESSION,a.W.bind(a));c.on(b,d.COMPLETE,a.Za.bind(a));c.on(b,d.CONTENT_RESUME_REQUESTED,a.tc.bind(a))},RT=function(a,b){const c=b?a.va.create(b.getErrorCode()):
|
|
4
|
+
null;a.m.onError(new _.I(1,9,10003,{errorType:c},b))},ST=function(a){return _.x(function*(){yield a.m.detach();var b=a.m;b.a&&b.a.stopForwardingEventsTo(b)})},TT=function(a,b,c){c=c&&c.getAd();let d=null;c&&(d={ad:new W(c,a.H,a.G)});a.m.trigger(new _.D(b,d))},UT=function(a){a.C=null;TT(a,_.Ac);a.m.getSurface().hide(a.O)},VT=function(a){return _.x(function*(){yield NT(a.f,a.A)})},WT=function(a){return _.x(function*(){return new Promise(b=>{a.A.on(a.f,_.Ef,()=>{a.m.getState()===_.jp&&b()})})})},XT=
|
|
5
5
|
function(a){_.Fp(a.f,{visibility:"visible"})},ZT=function(a){return _.x(function*(){a.R.initialize();const b=!!a.m.getConfiguration().muted;(yield a.L.canPlay(b))||PT(a)?(PT(a)&&(yield ST(a)),YT(a)):(TT(a,_.Yc),a.g.warn(_.ja))})},$T=function(a,b){return _.x(function*(){a.R.initialize();yield b.play();YT(a)})},YT=function(a){a.a.init(a.f.offsetWidth,a.f.offsetHeight,google.ima.ViewMode.NORMAL);a.a.start();a.M=!0},aU=function(){return!window.google||!google.ima||!google.ima.AdsLoader},W=class{constructor(a,
|
|
6
6
|
b,c){this.a=a;this.f=a.getAdPodInfo();this.j=b;this.h=c}sb(){return"Google IMA SDK"}tb(){return google.ima.VERSION}xb(){return 0}getId(){return this.a.getAdId()}getCreativeId(){return this.a.getCreativeId()}Sb(){return""}getApiFramework(){return this.a.getApiFramework()}getAdSystem(){return this.a.getAdSystem()}getAdvertiserName(){return this.a.getAdvertiserName()}getTitle(){return this.a.getTitle()}getDuration(){return this.a.getDuration()}getPosition(){return 0}getSkipTimeOffset(){return this.a.getSkipTimeOffset()}Vb(){return this.f?
|
|
7
7
|
this.f.getIsBumper():!1}ub(){let a=null;const b=this.a,c=Object.keys(b).find(d=>typeof b[d]===_.Se&&typeof b[d].clickThroughUrl===_.cg);c&&(a=b[c].clickThroughUrl);return a}getMediaUrl(){return this.a.getMediaUrl()}ib(){return this.a.getVastMediaWidth()}hb(){return this.a.getVastMediaHeight()}Ta(){return this.a.getVastMediaBitrate()}Ua(){return this.h?2:this.j?1:0}getPodIndex(){return this.f?this.f.getPodIndex():0}Ib(){return this.f?this.f.getTimeOffset():0}wb(){return this.f?this.f.getAdPosition():
|
|
@@ -11,7 +11,7 @@ W.prototype.getSkipTimeOffset=W.prototype.getSkipTimeOffset;W.prototype.getPosit
|
|
|
11
11
|
W.prototype.getTechnology=W.prototype.xb;W.prototype.getAdManagerVersion=W.prototype.tb;W.prototype.getAdManagerName=W.prototype.sb;var bU=class{create(a){const b=google.ima.AdError.ErrorCode;switch(a){case b.VAST_LOAD_TIMEOUT:case b.VAST_MEDIA_LOAD_TIMEOUT:case b.FAILED_TO_REQUEST_ADS:return 0;case b.VIDEO_PLAY_ERROR:return 1;default:return 2}}};var cU=class{constructor(a){this.a=a}getCuePoints(){return this.a}Lb(){return 0<=this.a.indexOf(0)||0===this.a.length}Kb(){return 0<=this.a.indexOf(-1)}};cU.prototype.hasPostroll=cU.prototype.Kb;cU.prototype.hasPreroll=cU.prototype.Lb;cU.prototype.getCuePoints=cU.prototype.getCuePoints;var dU=class{constructor(a){var b=a.fd("ima");if(!b)throw Error("IMA plugin not created.");var c=b.Nc(),d=b.h;b=b.a;if(!c||!d||!b)throw Error("IMA plugin not initialized.");const e=a.getSurface().getMedia();if(!e)throw Error("Missing media element.");this.m=a;this.f=e;a=this.m.getConfiguration();a=_.mh(a.ima||{});this.K=a=_.lh({disableCustomPlayback:!1},a);this.O=c;this.R=d;this.B=b;this.L=new _.Rv;this.g=new _.S("clpp.ima");this.l=this.a=null;this.j=new _.rn;this.M=!1;this.A=new _.St;this.va=new bU;
|
|
12
12
|
this.C=null;this.J=this.G=this.H=!1;this.I=this.F=null;c=this.A;d=google.ima.AdErrorEvent.Type.AD_ERROR;c.one(this.B,google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.nc.bind(this));c.on(this.B,d,this.lc.bind(this));c.on(this.m,_.je,this.oc.bind(this))}nc(a){this.a=a.getAdsManager(this.f,OT(this));this.a.isCustomPlaybackUsed()&&!PT(this)?(this.g.warn("IMA plugin is disabled for this platform with single video element. Disposing."),this.m.onError(new _.I(1,9,10002)),this.h()):(this.l=new _.Pv(this.m.getSurface(),
|
|
13
13
|
(b,c,d)=>{this.a.resize(b,c,d?google.ima.ViewMode.FULLSCREEN:google.ima.ViewMode.NORMAL)}),a=this.a.getCuePoints(),this.F=new cU(a),this.m.trigger(new _.D(_.Fc,{adsTimeline:this.F})),QT(this));this.j.resolve()}lc(a){RT(this,a.getError());this.j.resolve()}qc(a){const b=this;return _.x(function*(){b.J=!0;PT(b)?(b.I=b.m.getPosition(),yield ST(b)):(yield b.m.pause(),_.Fp(b.f,{visibility:_.pe}));TT(b,_.jc,a);b.l.start()})}Aa(){const a=this;return _.x(function*(){PT(a)&&(yield NT(a.f,a.A));a.a.start()})}Y(a){a.getAd().isLinear()?
|
|
14
|
-
TT(this,_.tc,a):(this.a.discardAdBreak(),this.H||(this.H=!0,this.m.play()))}ba(a){this.C=a.getAd().getDuration();TT(this,_.zc,a);this.m.getSurface().show(this.O)}Oa(a){a=a.getAdData();RT(this,a?a.adError:null);UT(this)}$(a){TT(this,_.wc,a)}Ha(a){TT(this,_.lc,a)}U(a){TT(this,_.oc,a)}pb(a){TT(this,_.uc,a)}
|
|
14
|
+
TT(this,_.tc,a):(this.a.discardAdBreak(),this.H||(this.H=!0,this.m.play()))}ba(a){this.C=a.getAd().getDuration();TT(this,_.zc,a);this.m.getSurface().show(this.O)}Oa(a){a=a.getAdData();RT(this,a?a.adError:null);UT(this)}$(a){TT(this,_.wc,a)}Ha(a){TT(this,_.lc,a)}U(a){TT(this,_.oc,a)}pb(a){TT(this,_.uc,a)}ja(a){TT(this,_.Dc,a)}Pb(a){TT(this,_.vc,a)}Qb(a){TT(this,_.xc,a)}S(a){this.pause();TT(this,_.mc,a)}da(a){TT(this,_.yc,a);UT(this)}W(a){TT(this,_.sc,a)}Za(a){TT(this,_.nc,a);UT(this)}tc(){const a=
|
|
15
15
|
this;return _.x(function*(){a.H=!0;if(PT(a)&&null!==a.I)yield VT(a),yield _.fs(a.m),!a.G&&a.I&&(yield WT(a),yield a.m.seek(a.I));else{if(!a.J)return a.m.play();XT(a)}a.J=!1;a.l&&a.l.stop();a.G||(yield a.m.play());TT(a,_.kc)})}oc(){this.G=!0;this.B.contentComplete()}load(){const a=this;return _.x(function*(){var b=a.m;const c=a.K;try{if(typeof c.adTagUrl!==_.cg)throw new _.I(1,9,10001,{missingKeys:"adTagUrl"});}catch(f){return b.onError(f),a.j.resolve(),a.j}if(!c.adTagUrl)return a.j.resolve(),a.j;
|
|
16
16
|
b=yield a.L.canPlay(!1);const d=yield a.L.canPlay(!0),e=new google.ima.AdsRequest;e.adTagUrl=c.adTagUrl;e.setAdWillAutoPlay(b);e.setAdWillPlayMuted(d);a.B.getSettings().setAutoPlayAdBreaks(!1);a.B.requestAds(e);return a.j})}start(a){const b=this;return _.x(function*(){b.a&&b.F&&!b.M?b.F.Lb()?yield ZT(b):yield $T(b,a):yield a.play()})}w(){}o(){return!0}resume(){this.a&&this.a.resume()}pause(){this.a&&this.a.pause()}skip(){this.a&&this.a.skip()}getVolume(){return this.a?this.a.getVolume():1}setVolume(a){this.a&&
|
|
17
17
|
this.a.setVolume(a)}getPosition(){if(!this.a||null===this.C)return-1;const a=this.a.getRemainingTime();return 0>a?0:this.C-a}h(){this.a&&(this.a.destroy(),this.a=null);XT(this);this.A.release();this.l&&(this.l.stop(),this.l=null);return Promise.resolve()}};dU.prototype.getPosition=dU.prototype.getPosition;dU.prototype.setVolume=dU.prototype.setVolume;dU.prototype.getVolume=dU.prototype.getVolume;dU.prototype.skip=dU.prototype.skip;dU.prototype.pause=dU.prototype.pause;dU.prototype.resume=dU.prototype.resume;var eU=class extends _.Zv{constructor(){super();this.a=this.h=this.f=null}onPlayerCreated(a){if(aU())return a.onError(new _.I(1,9,1E4));this.f=_.Dp(_.Sd,{"class":"clpp-ima clpp-hidden"});a.getSurface().addElementToContainer(this.f);this.h=new google.ima.AdDisplayContainer(this.f,a.getSurface().getMedia());this.a=new google.ima.AdsLoader(this.h);this.a.getSettings().setPlayerType(_.qa);this.a.getSettings().setPlayerVersion(_.ea);this.a.getSettings().setAutoPlayAdBreaks(!0)}onPlayerWillDestroy(a){this.a&&
|
package/cl.mse.js
CHANGED
|
@@ -56,7 +56,7 @@ c.la.find(g=>g.serviceLocationId===e);f?d.push(f):a.g.warn("setManifestConfig: c
|
|
|
56
56
|
_.VE=function(a,b){var c=a.l.get(b);if(!c)return a.g.warn(`getBaseUriCollectionById: invalid baseUriSetId:${b}.`),null;const d=Date.now();a.j.forEach((f,g)=>{f.Xc&&d>f.Xc&&(f.Xc=0,a.trigger(new _.D(_.Md,{detail:{serviceLocationId:g,banned:!1,bannedSeconds:0}})))});let e=c.filter(f=>0===_.TE(a,f.serviceLocationId).Xc);e.length||(e=c);e.length&&(c=a.w.get(b),LE(e,c)||(c={baseUriCollectionId:b,from:c||[],to:e},a.g.info(`Steering server update baseUriCollectionId: ${c.baseUriCollectionId} from: ${JSON.stringify(c.from)} to: ${JSON.stringify(c.to)}`),
|
|
57
57
|
a.trigger(new _.D(_.Ld,{detail:c})),a.w.set(b,e)));return new _.UE(b,e)};_.WE=function(a,b){const c=_.TE(a,b);c.Xc=Date.now()+1E3*a.f;c.wd=!1;a.g.info(`service location ${b} banned during ${a.f} seconds`);a.trigger(new _.D(_.Md,{detail:{serviceLocationId:b,banned:!0,bannedSeconds:a.f}}))};
|
|
58
58
|
NE=function(a,b){b=new URL(b);const c=[],d=[];a.j.forEach((e,f)=>{e.wd&&(c.push(f),d.push(parseInt(e.oe.getBandwidthEstimate(1E4),10)));e.wd=!1});c.length?a.h.manifestType===_.Kc?(b.searchParams.set("_DASH_pathway",`"${c.toString()}"`),b.searchParams.set("_DASH_throughput",d.toString())):a.h.manifestType===_.zl&&(b.searchParams.set("_HLS_pathway",`"${c.toString()}"`),b.searchParams.set("_HLS_throughput",d.toString())):a.g.debug("addQueryParams_: serviceLocations EMPTY");return b.toString()};
|
|
59
|
-
OE=function(a,b){a.g.info(`Scheduling next steering manifest update in ${b} s.`);a.a.
|
|
59
|
+
OE=function(a,b){a.g.info(`Scheduling next steering manifest update in ${b} s.`);a.a.ha(b)};PE=function(a,b,c){null!=a.a&&(a.a.stop(),a.a=null);const d=b["RELOAD-URI"]||c;a.a=new _.Gk(()=>{QE(a,d)});if(c=b.TTL)a.f=c;OE(a,a.f);const e=b["PATHWAY-PRIORITY"]||[],f=b["PATHWAY-CLONES"]||[];a.j.forEach((g,h)=>{e.includes(h)||a.j.delete(h)});a.o.forEach((g,h)=>{g=XE(a,h,e,f);a.l.set(h,g)})};
|
|
60
60
|
XE=function(a,b,c,d){const e=[],f=a.o.get(b)||[];if(!c.length)return a.l.get(b);for(const g of c)if(a=f.find(h=>h.serviceLocationId===g))e.push(a);else{const h=d.find(k=>k.ID===g);if(h&&(a=f.find(k=>k.serviceLocationId===h["BASE-ID"]))){const k={serviceLocationId:g,uri:a.uri,params:{}};h[oC]&&(h[oC].HOST&&(a=new URL(a.uri),a.hostname=h[oC].HOST,k.uri=a.toString()),h[oC].PARAMS&&Object.entries(h[oC].PARAMS).forEach(l=>{var [m,n]=l;k.params[m]=n}));e.push(k)}}return e};
|
|
61
61
|
_.YE=function(a){a=a.toLowerCase();return _.Ct[a]||window.muxjs&&a===_.Jc?!0:!1};ZE=function(a,b){if(b!==_.Jc){var c=_.Ct[b];if(!c)throw new _.I(_.F,2,2012,"Text parser is unavailable for "+b);a.w=new c(a.C)}};
|
|
62
62
|
$E=function(a,b,c,d){return Promise.resolve().then(()=>{if(a.w&&a.j)if(null==c||null==d)a.w.parseInit(_.K(b));else{var e={periodStart:a.A,segmentStart:c,segmentEnd:d};e=a.w.parseMedia(_.K(b),e);var f=e.cues.filter(g=>g.startTime>=a.h&&g.startTime<a.l);a.j.append(f,e.styles);null==a.a&&(a.a=Math.max(c,a.h));a.f=Math.min(d,a.l)}})};aF=function(a,b,c){a.B=b;if(b=a.o.get(b))for(const d of b.keys()){let e=b.get(d);e&&(e=e.filter(f=>f.endTime<=c),a.j.append(e,[]))}};
|
|
@@ -80,7 +80,7 @@ FF=function(a,b){var c=a.m;if(c.f){var d=(d=HF(c))?IF(c.o,d).bb:null;c=c.f.muxed
|
|
|
80
80
|
JF=function(a,b,c){return qF(a,c).flatMap(d=>d.renditions).find(d=>parseInt(d.id,10)===b)||null};KF=function(a,b,c,d){a.h.length||GF(a);const e=a.a.get(c)||null;(b=JF(a,b,c))&&e!==b&&(yF(a,b),c===_.M?a.m.trigger(new _.D(_.Xc)):c===_.N&&a.m.trigger(new _.D(_.Kg,{details:{width:b.width||0,height:b.height||0,bandwidth:b.bandwidth,track:b.track,abrSelection:d}})))};LF=function(a){const b=_.Bk(a.mimeType,a.codecs),c=rD(a);return _.YE(b)||_.Is(c)||(_.Ak(b,a.type)?!0:!1)};
|
|
81
81
|
NF=function(a,b){if(window.ManagedMediaSource){a.j.disableRemotePlayback=!0;var c=new ManagedMediaSource;a.l.one(c,LC,()=>{URL.revokeObjectURL(a.B);b.resolve()});a.l.on(c,MC,()=>{a.S=!0});a.l.on(c,"endstreaming",()=>{a.S=!1});a.B=MF(c);a.j.src=a.B;return c}c=new MediaSource;a.B=MF(c);a.l.one(c,LC,()=>{URL.revokeObjectURL(a.B);b.resolve()});a.j.src=a.B;return c};
|
|
82
82
|
OF=function(a,b){b.forEach((c,d)=>{{const e=a.a[d];e&&(a.l.off(e,_.q),a.l.off(e,QC),a.o.removeSourceBuffer(e),delete a.a[d])}c=a.o.addSourceBuffer(c);a.l.on(c,_.q,a.Pb.bind(a,d));a.l.on(c,QC,a.C.bind(a,d));a.a[d]=c;a.h[d]=[];a.H[d]=!1})};PF=function(a,b){try{return new _.Bu(a.a[b].buffered,b)}catch(c){return b in a.a&&a.g.error(AC+b,c),null}};QF=function(a,b){return a.a[b]?(a=PF(a,b))?a.toString():"":""};
|
|
83
|
-
SF=function(a,b,c){if(a.J)return Promise.reject();c={start:c,p:new _.rn};a.h[b].push(c);1===a.h[b].length&&RF(a,b);return c.p};TF=function(a,b,c,d,e){return[SF(a,b,a.pb.bind(a,b)),SF(a,b,a.
|
|
83
|
+
SF=function(a,b,c){if(a.J)return Promise.reject();c={start:c,p:new _.rn};a.h[b].push(c);1===a.h[b].length&&RF(a,b);return c.p};TF=function(a,b,c,d,e){return[SF(a,b,a.pb.bind(a,b)),SF(a,b,a.ja.bind(a,b,c)),SF(a,b,a.Qb.bind(a,b,d,e))]};
|
|
84
84
|
VF=function(a,b){return _.x(function*(){if(a.J)return Promise.reject();const c=[];for(const d in a.a){const e=new _.rn,f={start:function(g){g.resolve()}.bind(null,e),p:e};a.h[d].push(f);c.push(e);1===a.h[d].length&&f.start()}try{yield Promise.all(c)}catch(d){for(const e in a.a)a.h[e].length&&a.h[e].shift();return Promise.reject(d)}for(const d in a.a);try{yield b()}catch(d){return Promise.reject(new _.I(_.F,3,3015,{mediaError:d}))}finally{for(const d in a.a)UF(a,d)}})};
|
|
85
85
|
UF=function(a,b){a.h[b].shift();RF(a,b)};RF=function(a,b){const c=a.h[b][0];if(c)try{a.g.debug(nC+b),c.start()}catch(d){d.name===fC?c.p.reject(new _.I(_.F,3,3017,{type:b})):c.p.reject(new _.I(_.F,3,3015,{mediaError:d})),UF(a,b)}else a.g.debug(bC+b)};
|
|
86
86
|
aG=function(a,b,c,d){const e=a.periods.flatMap(k=>k.variants);var f=e;if(b.length||c.length)f=WF(f,b,c);f=XF(f,d);if(1<a.periods.length&&e.some(k=>null!=k.audio)){const k=m=>{m=m.split(".");let n=m[0];1<m.length&&(n+="."+m[1]);return n.toLowerCase()};b=[];for(var g of a.periods){c=new Set;for(const m of g.variants)null!==m.audio&&c.add(k(m.audio.codecs));b.push(c)}let l=b[0];for(g=1;g<b.length;g++){const m=b[g];l=new Set([...l].filter(n=>m.has(n)))}f=f.filter(m=>0===l.size&&null===m.audio?!0:0<l.size&&
|
|
@@ -121,7 +121,7 @@ d=a.getUint32(b);a.setUint32(b,d+1);return h};ZG=function(a,b,c){a=_.fj(a,b);b=a
|
|
|
121
121
|
jH=function(a,b,c,d,e){return _.x(function*(){var f=a.D.Jb();const g=eH(a,f);if(null==g)a.g.warn("Cannot initialize streams, period not found at",f);else{f=new Map;var h=new Set;b&&(f.set(_.p,b),h.add(b));c&&(f.set(_.w,c),h.add(c));d&&(f.set(_.H,d),h.add(d));yield a.D.aa.init(f,a.h.forceNativeTS,a.h.disableAudioTracks);a.f||(fH(a),yield gH(a,h),a.f||f.forEach((k,l)=>{a.a.has(l)||(k=hH(k,g,e),a.a.set(l,k),iH(a,k,0))}))}})};
|
|
122
122
|
kH=function(a,b){a=a.j.periods.find(c=>c.id===b)||null;if(!a)throw new _.I(_.F,5,5006,`Period ${b} not found`);return a};lH=function(a){var b=a.a.get(_.w);return b?kH(a,b.Wb):(b=a.a.get(_.p))?kH(a,b.Wb):null};_.mH=function(a,b){return(a=a.a.get(b))?a.gc||a.stream:null};nH=function(a){return _.mH(a,_.p)};oH=function(a){return _.mH(a,_.w)};
|
|
123
123
|
gH=function(a,b){return _.x(function*(){const c=[];for(const f of b){const g=a.w.get(f.id);g?(a.g.debug("(all) Stream "+f.id+" is being or has been set up"),c.push(g)):(a.g.debug("(all) setting up Stream "+f.id),a.w.set(f.id,new _.rn),c.push(f.createSegmentIndex(a.D.yb)))}try{if(yield Promise.all(c),a.f)return}catch(f){if(a.f)return;for(var d of b){var e=a.w.get(d.id);e&&(e.catch(()=>{}),e.reject(),a.w.delete(d.id))}throw f;}for(e of b)(d=a.w.get(e.id))&&!d.done&&(d.resolve(),a.g.debug("(all) setup Stream "+
|
|
124
|
-
e.id))})};eH=function(a,b){return(a=ID(a.j.periods,b+_.ku))?a.id:null};hH=function(a,b,c){return{stream:a,type:a.type,dc:null,segmentIterator:null,sa:null,gc:null,$d:!0,Wb:b,endOfStream:!1,zb:!1,ob:null,bc:!1,Jd:0,ke:!1,mc:!1,Ue:!1,Pc:!1,sg:c||0,Yb:null,Ld:!1,dg:0}};iH=function(a,b,c){a.g.debug($G(b),"updating in "+c+" seconds");b.ob=(new _.Mt(()=>_.x(function*(){try{yield a.Xb(b)}catch(d){if(a.D)a.D.onError(d)}}))).
|
|
124
|
+
e.id))})};eH=function(a,b){return(a=ID(a.j.periods,b+_.ku))?a.id:null};hH=function(a,b,c){return{stream:a,type:a.type,dc:null,segmentIterator:null,sa:null,gc:null,$d:!0,Wb:b,endOfStream:!1,zb:!1,ob:null,bc:!1,Jd:0,ke:!1,mc:!1,Ue:!1,Pc:!1,sg:c||0,Yb:null,Ld:!1,dg:0}};iH=function(a,b,c){a.g.debug($G(b),"updating in "+c+" seconds");b.ob=(new _.Mt(()=>_.x(function*(){try{yield a.Xb(b)}catch(d){if(a.D)a.D.onError(d)}}))).ha(c)};
|
|
125
125
|
pH=function(a,b){return _.x(function*(){yield a.D.aa.clear(_.H);a.H++;a.I=!1;var c=a.H,d=a.D.aa;const e=new Map,f=new Set;e.set(_.H,b);f.add(b);yield d.init(e,!1,a.h.disableAudioTracks);a.f||(yield gH(a,f),a.f||(d=d.getTextDisplayer().isTextVisible()||a.h.alwaysStreamText,a.H!==c||a.a.has(_.H)||a.I||!d||(c=a.D.Jb(),d=eH(a,c),null==d?a.g.warn("Cannot set up text media state, period not found at",c):(c=hH(b,d,0),a.a.set(_.H,c),iH(a,c,0)))))})};
|
|
126
126
|
qH=function(a){a.I=!0;const b=a.a.get(_.H);b&&(a.g.info("Unload text stream"),cH(b),dH(b).catch(()=>{}),a.a.delete(_.H))};rH=function(a){return _.x(function*(){const b=a.a.get(_.p);b&&(a.g.info("Unload audio stream"),cH(b),yield dH(b).catch(()=>{}),a.a.delete(_.p))})};
|
|
127
127
|
_.zH=function(a,b,c,d){const e=a.a.get(b.type);if(!e&&b.type===_.H&&a.h.ignoreTextStreamFailures)pH(a,b);else if(e){var f=sH(a,b).id;if(c&&f!==e.Wb){a.g.debug("switch: switching to stream in another Period; clearing buffer and changing Periods");for(var g of a.a.values())tH(a,g)}else if(e.gc&&(a.g.debug("switch during trick play mode",b),b.trickModeVideo?(e.gc=b,b=b.trickModeVideo,a.g.debug("switch found trick play stream",b)):(e.gc=null,a.g.debug("switch found no special trick play stream"))),uH(a,
|
|
@@ -174,7 +174,7 @@ g=!0;const k=a.getTrackManager().Ia();if(k){const l=k.renditions.map(m=>m.id);h=
|
|
|
174
174
|
nI(a,c,e,!1);g||a.W?oI(a,e,!0,0):CH(a.a,h)}})};zF=function(a,b){return _.x(function*(){if(a.Te!==b&&(a.Te=b,a.H===uI&&(a.L.getTextDisplayer().setTextVisibility(b),!a.configuration.streaming.alwaysStreamText)))if(b){var c=HF(a);c=_.lG(c.textStreams,a.Qb,a.Td,a.Pb);0<c.length&&(yield pH(a.a,c[0]))}else qH(a.a)})};
|
|
175
175
|
AF=function(a,b){return _.x(function*(){if(a.f&&a.a){var c=HF(a);const d=yield a.j.loadTextStream(b.id,c.id);yield pH(a.a,d);vI(a,c,d,!1);c=d;a.W?a.S=c:_.zH(a.a,c,!0,0);a.Qb=d.language;a.Pb=d.kind===_.le}})};DF=function(a){const b=a.Te;return a.f?a.L.getTextDisplayer().isTextVisible():b};
|
|
176
176
|
wI=function(a,b){a.l||(a.w.on(b,_.q,()=>{if(a.l.error){var c=a.l.error.code;if(1===c)c=null;else{var d=a.l.error.msExtendedCode;d&&(0>d&&(d+=Math.pow(2,32)),d=d.toString(16));c=new _.I(_.F,3,3016,{code:c,extendedError:d,message:a.l.error.message})}}else c=null;if(c)a.onError(c)}),a.l=b)};yI=function(a){return new _.xI(b=>{const c=a.getTrackManager(),d=[];if(c)for(const e of c.getVideoTracks())d.push(...e.renditions);return d.find(e=>e.id===b.toString())||null})};
|
|
177
|
-
zI=function(a,b){if(a.
|
|
177
|
+
zI=function(a,b){if(a.ja!==b)if(a.ja===_.ap&&b!==_.hp)b=oD(b,_.gp),a.log.info(_.dC+`${b}`);else{var c=a.jf;c=0===c?0:Date.now()-c;var d=a.ja;a.ja=b;a.jf=Date.now();null!==a.I&&(a.I.A=b===_.jp);a.G&&_.To(a.G.a,a.ja);b===_.dp&&(a.yg=a.Se?1:2);var e=a.yg,f={currentState:a.ja,previousState:d,timeSinceLastStateChangeMS:c,reason:b===_.dp||d===_.dp?e:void 0},g=oD(d,_.gp),h=oD(b,_.gp),k=b!==_.dp?"":`[${oD(e,_.fp)}]`;a.log.info(`Player state change: ${g} -> `+`${h}${k}`);a.trigger(new _.D(_.$f,{detail:f}));
|
|
178
178
|
(b===_.$o||b===_.ap)&&a.Aa&&a.Aa.stop();b===_.dp?a.trigger(new _.D(_.bd,{detail:{bufferedTimeMS:-1,reason:e}})):d===_.dp&&a.trigger(new _.D(_.ad,{detail:{bufferedTimeMS:c,reason:e}}))}};EI=function(a){return _.x(function*(){AI(a);yield BI(a);CI(a);if(_.Kk(4)||_.Kk(5)){const b=a.getSurface().getMedia();wI(a,b);yield DI(a,b)}a.configuration=a.ba})};
|
|
179
179
|
FI=function(a){return _.x(function*(){const b=a.A.a;b&&(yield b.catch(()=>{}));yield Object.getPrototypeOf(Object.getPrototypeOf(a)).release.call(a);yield a.unload();zI(a,_.hp)})};CI=function(a){a.l&&(a.w.off(a.l,_.q),a.l=null)};AI=function(a){if(a.H===GI)throw new _.I(_.F,7,7E3,"Player is destroyed.");};HI=function(a){return a.Y?a.Y.catch(()=>{}):Promise.resolve()};
|
|
180
180
|
II=function(a){const b=new _.Uv;(a=a.playlist)&&a.cropTimeline&&(a.startTime||a.endTime)&&(b.h={start:a.startTime||null,end:a.endTime||null});return b};MI=function(a,b){return _.x(function*(){a.G=new _.qv;zI(a,_.ip);const c=JI(a,a.configuration);yield DI(a,c);oG(a.A,b);a.K=new KI;dE(a.K,d=>{a.log.info("Timeline cue found",d);LI(a,_.kg,d)},()=>{a.log.info("Timeline cues changed");a.trigger(new _.D(_.ng))})})};
|
|
@@ -263,11 +263,11 @@ a.forEach((e,f)=>{const g=_.Bk(e.mimeType,e.codecs);if(f===_.H)d.A(g);else{var h
|
|
|
263
263
|
_.H?this.f.Qa():(a=PF(this,a))?a.Qa():null}ma(a){return a===_.H?this.f.ma():(a=PF(this,a))?a.ma():null}Mb(a,b,c){return a===_.H?this.f.Mb(b):(a=PF(this,a))?a.Mb(b,!1,c):!1}Ca(a,b){return a===_.H?this.f.Ca(b):(a=PF(this,a))?a.Ca(b):0}$(){const a={};a.total=new _.Bu(this.j.buffered,"total");a.audio=PF(this,_.p);a.video=PF(this,_.w);let b=[];this.f&&(b=[{start:this.f.Qa(),end:this.f.ma()}]);a.text=uD(b,_.H);return a}L(a,b,c,d,e,f,g,h){g=void 0===g?!1:g;h=void 0===h?!1:h;const k=this.a[a];let l=-1,m=
|
|
264
264
|
0;k&&k.buffered&&(m=k.buffered.length);a===_.w&&null!==c&&null!==d&&g&&(l=0<m?k.buffered.end(m-1):-1);a===_.H?h=$E(this.f,b,c,d):this.w[a]?(b=this.w[a].transmux(b),b.captions&&0<b.captions.length&&(this.f||this.A(_.hg),bF(this.f,b.captions,c,d,this.a.video.timestampOffset)),e=[],0<b.audio.byteLength&&this.a.audio&&!h&&e.push(SF(this,_.p,this.U.bind(this,_.p,b.audio.buffer))),0<b.video.byteLength&&this.a.video&&e.push(SF(this,_.w,this.U.bind(this,_.w,b.video.buffer))),h=Promise.all(e)):(e&&window.muxjs&&
|
|
265
265
|
(this.f||this.A(_.hg),null==c&&null==d?this.I.init(b):this.I.h(b,n=>{n.length&&bF(this.f,n,c,d,this.a.video.timestampOffset)})),h=SF(this,a,this.U.bind(this,a,b)));return h.then(()=>{if(a===_.w&&null!==c&&null!==d&&!g)this.F.append(c,d,f),null!==c&&null!==d&&this.g.debug(HB,c,d,JB,QF(this,a));else if(a===_.p&&null!==c&&null!==d)ED(this.F),null!==c&&null!==d&&this.g.debug(GB,c,d,JB,QF(this,a));else if(a===_.w&&null!==c&&null!==d&&g){var n=k.buffered.length,r=0<n?k.buffered.end(n-1):-1;0>l&&0<n&&(l=
|
|
266
|
-
k.buffered.start(0));0<=l&&0<r&&this.F.append(l,r,f)}if(!this.H[a]&&k&&1===k.buffered.length){n=k.buffered.start(0);const u=c-n;if(Math.abs(u)>this.Oa&&0===k.timestampOffset)return this.g.warn(`Detected a delta of ${u} between `+`media times and segment times for ${a}. `+`The segment start time is ${c} and the media start time `+`is ${n}. Adjusting timestampOffset.`),n=SF(this,a,()=>{this.
|
|
266
|
+
k.buffered.start(0));0<=l&&0<r&&this.F.append(l,r,f)}if(!this.H[a]&&k&&1===k.buffered.length){n=k.buffered.start(0);const u=c-n;if(Math.abs(u)>this.Oa&&0===k.timestampOffset)return this.g.warn(`Detected a delta of ${u} between `+`media times and segment times for ${a}. `+`The segment start time is ${c} and the media start time `+`is ${n}. Adjusting timestampOffset.`),n=SF(this,a,()=>{this.ja(a,u)}),r=SF(this,a,this.W.bind(this,a,!1)),Promise.all([n,r])}null!==c&&null!==d&&(this.H[a]=!0)}).catch(n=>
|
|
267
267
|
{throw n;})}va(a){const b=this.ma(_.w)||0;aF(this.f,a,b)}da(){this.f&&aF(this.f,"",0)}remove(a,b,c){return a===_.H?this.f.remove(b,c):SF(this,a,this.ba.bind(this,a,b,c)).then(()=>{if(a===_.w){const d=this.Qa(a),e=this.ma(a);null!==d&&null!==e&&HD(this.F,d,e)}else a===_.p&&FD(this.F)})}clear(a){if(a===_.H){if(!this.f)return Promise.resolve();this.I.f();return this.f.remove(0,Infinity)}return SF(this,a,this.ba.bind(this,a,0,this.o.duration))}flush(a){return a===_.H?Promise.resolve():SF(this,a,this.W.bind(this,
|
|
268
268
|
a))}Za(a,b,c,d){const e=this;return _.x(function*(){if(a===_.H){e.f.A=b;var f=e.f;f.h=c;f.l=d}else f=TF(e,a,b,c,d),e.O&&(f=f.concat(TF(e,_.p,b,c,d))),yield Promise.all(f)})}endOfStream(a){return VF(this,()=>{this.M()||(a?this.o.endOfStream(a):this.o.endOfStream())})}Y(a){VF(this,()=>{this.o.duration=a})}getDuration(){return this.o.duration}U(a,b){this.g.debug(IB+a+zB);try{this.a[a].appendBuffer(b)}catch(c){throw this.g.warn(TB+a,c),c;}this.g.debug(NB+a+zB)}ba(a,b,c){if(c<=b)this.C(a);else{this.g.debug(hC+
|
|
269
269
|
a+BB,b,c);try{this.a[a].remove(b,c)}catch(d){throw this.g.warn(VB+a+AB,b,c,d),d;}this.g.debug(PB+a+BB,b,c)}}pb(a){try{this.g.debug(FB+a+zB);const b=this.a[a].appendWindowStart,c=this.a[a].appendWindowEnd;this.a[a].abort();this.a[a].appendWindowStart=b;this.a[a].appendWindowEnd=c}catch(b){throw this.g.warn(SB+a+zB,b),b;}this.g.debug(MB+a+zB);this.C(a)}W(a){try{this.j.readyState>HTMLMediaElement.HAVE_NOTHING?(this.g.debug(YB+a),this.j.currentTime-=.001):this.g.warn(mC+a+CB+this.j.readyState)}catch(b){throw this.g.warn(UB+
|
|
270
|
-
a,b),b;}this.g.debug(OB+a);this.C(a)}
|
|
270
|
+
a,b),b;}this.g.debug(OB+a);this.C(a)}ja(a,b){0>b&&(b+=.001);try{this.g.debug(lC+a,b),this.a[a].timestampOffset=b}catch(c){throw this.g.warn(XB+a,b,c),c;}this.g.debug(RB+a,b);this.C(a)}Qb(a,b,c){try{this.g.debug(jC+a,b,c),this.a[a].appendWindowStart=0,this.a[a].appendWindowEnd=c,this.a[a].appendWindowStart=b}catch(d){throw this.g.warn(WB+a,b,c,d),d;}this.g.debug(QB+a,b,c);this.C(a)}Pb(a){this.h[a][0].p.reject(new _.I(_.F,3,3014,{mediaError:this.j.error?this.j.error.code:0}))}C(a){const b=this.h[a][0];
|
|
271
271
|
b&&(b.p.resolve(),this.g.debug(pC+a),UF(this,a))}getTextDisplayer(){return this.G}};MF=window.URL.createObjectURL;_.pK=class{constructor(){this.g=new _.S("clpp.abr");this.A=null;this.l=!1;this.w=new SE;this.f=[];this.o=1;this.C=this.B=!1;this.j=this.a=this.h=null}stop(){this.A=null;this.l=!1;this.f=[];this.o=1;this.h=null;this.C=!1}init(a){this.A=a}chooseTrack(){let a=mG(this,!this.C&&this.a.initialRestrictions?this.a.initialRestrictions:this.a.restrictions,this.f);var b=this.getBandwidthEstimate();this.f.length&&!a.length&&(this.g.warn("No tracks met the ABR restrictions. Choosing a track by lowest bandwidth."),
|
|
272
272
|
a=mG(this,null,this.f),a=[a[0]]);this.h=Date.now();this.C=!0;{var c=a;let e=c[0]||null;for(let f=0;f<c.length;f++){const g=c[f];var d=c[f+1];const h=isNaN(this.o)||0===this.o?1:Math.abs(this.o),k=h*g.bandwidth,l=k/this.a.bandwidthDowngradeTarget;d=h*(d?d.bandwidth:Infinity)/this.a.bandwidthUpgradeTarget;this.g.debug("Bandwidth ranges:",(k/1E6).toFixed(3),(l/1E6).toFixed(3),(d/1E6).toFixed(3));b>=l&&b<=d&&(e=g)}b=e}return b||a[0]||this.f[0]}enable(){this.l=!0}disable(){this.l=!1}segmentDownloaded(a,
|
|
273
273
|
b){this.g.debug("Segment downloaded:","deltaTimeMs\x3d"+a,"numBytes\x3d"+b,"lastTimeChosenMs\x3d"+this.h,"enabled\x3d"+this.l);_.KE(this.w,a,b);if(null!=this.h&&this.l)a:{this.g.debug("Suggesting Streams...");if(!this.B){if(!(128E3<=this.w.a)){this.g.debug("Still waiting for a good estimate...");break a}this.B=!0;if(this.a.useSwitchIntervalForInitialSwitch&&Date.now()-this.h<1E3*this.a.switchInterval){this.g.debug("Skipping initial estimation switch due to switch interval...");break a}}else if(Date.now()-
|
|
@@ -281,15 +281,15 @@ f)=>{const g=_.Bk(e.mimeType,e.codecs);if(f===_.H)d.A(g);else{var h=new Map;h.se
|
|
|
281
281
|
a===_.w&&null!==c&&null!==d&&g&&(k=0<l?h.buffered.end(l-1):-1);a===_.H?b=$E(this.f,b,c,d):this.w[a]?(b=this.w[a].transmux(b),b.captions&&0<b.captions.length&&(this.f||this.A(_.hg),bF(this.f,b.captions,c,d,this.a.video.timestampOffset)),e=[],0<b.audio.byteLength&&this.a.audio&&e.push(KG(this,_.p,this.W.bind(this,_.p,b.audio.buffer))),0<b.video.byteLength&&this.a.video&&e.push(KG(this,_.w,this.W.bind(this,_.w,b.video.buffer))),b=Promise.all(e)):(e&&window.muxjs&&(this.f||this.A(_.hg),null==c&&null==
|
|
282
282
|
d?this.J.init(b):this.J.h(b,m=>{m.length&&bF(this.f,m,c,d,this.a.video.timestampOffset)})),b=KG(this,a,this.W.bind(this,a,b)));return b.then(()=>{if(a===_.w&&null!==c&&null!==d&&!g)this.F.append(c,d,f),null!==c&&null!==d&&this.g.debug(HB,c,d,JB,IG(this,a));else if(a===_.p&&null!==c&&null!==d)ED(this.F),null!==c&&null!==d&&this.g.debug(GB,c,d,JB,IG(this,a));else if(a===_.w&&null!==c&&null!==d&&g){var m=h.buffered.length,n=0<m?h.buffered.end(m-1):-1;0>k&&0<m&&(k=h.buffered.start(0));0<=k&&0<n&&this.F.append(k,
|
|
283
283
|
n,f)}if(!this.I[a]&&h&&1===h.buffered.length){m=h.buffered.start(0);const r=c-m;if(Math.abs(r)>this.Oa&&0===h.timestampOffset)return this.g.warn(`Detected a delta of ${r} between `+`media times and segment times for ${a}. `+`The segment start time is ${c} and the media start time `+`is ${m}. Adjusting timestampOffset.`),m=KG(this,a,()=>{LG(this,a,r)}),n=KG(this,a,this.ba.bind(this,a,!1)),Promise.all([m,n])}null!==c&&null!==d&&(this.I[a]=!0)}).catch(m=>{throw m;})}va(a){const b=this.ma(_.w)||0;aF(this.f,
|
|
284
|
-
a,b)}da(){this.f&&aF(this.f,"",0)}remove(a,b,c){return a===_.H?this.f.remove(b,c):KG(this,a,this.
|
|
285
|
-
_.H){g.f.A=b;var h=g.f;h.h=c;h.l=d}else{h=yield NG(g,a,e,f);var k=OG(g,a,b,c,d,h);g.S&&(k=k.concat(OG(g,_.p,b,c,d,h)));yield Promise.all(k)}})}endOfStream(a){return QG(this,()=>{this.M()||(a?this.o.endOfStream(a):this.o.endOfStream())})}Y(a){QG(this,()=>{this.o.duration=a})}getDuration(){return this.o.duration}W(a,b){this.g.debug(IB+a+zB);try{this.a[a].appendBuffer(b)}catch(c){throw this.g.warn(TB+a,c),c;}this.g.debug(NB+a+zB)}
|
|
284
|
+
a,b)}da(){this.f&&aF(this.f,"",0)}remove(a,b,c){return a===_.H?this.f.remove(b,c):KG(this,a,this.ja.bind(this,a,b,c)).then(()=>{if(a===_.w){const d=this.Qa(a),e=this.ma(a);null!==d&&null!==e&&HD(this.F,d,e)}else a===_.p&&FD(this.F)})}clear(a){if(a===_.H){if(!this.f)return Promise.resolve();this.J.f();return this.f.remove(0,Infinity)}return KG(this,a,this.ja.bind(this,a,0,this.o.duration))}flush(a){return a===_.H?Promise.resolve():KG(this,a,this.ba.bind(this,a))}Za(a,b,c,d,e,f){const g=this;return _.x(function*(){if(a===
|
|
285
|
+
_.H){g.f.A=b;var h=g.f;h.h=c;h.l=d}else{h=yield NG(g,a,e,f);var k=OG(g,a,b,c,d,h);g.S&&(k=k.concat(OG(g,_.p,b,c,d,h)));yield Promise.all(k)}})}endOfStream(a){return QG(this,()=>{this.M()||(a?this.o.endOfStream(a):this.o.endOfStream())})}Y(a){QG(this,()=>{this.o.duration=a})}getDuration(){return this.o.duration}W(a,b){this.g.debug(IB+a+zB);try{this.a[a].appendBuffer(b)}catch(c){throw this.g.warn(TB+a,c),c;}this.g.debug(NB+a+zB)}ja(a,b,c){if(c<=b)this.C(a);else{this.g.debug(hC+a+BB,b,c);try{this.a[a].remove(b,
|
|
286
286
|
c)}catch(d){throw this.g.warn(VB+a+AB,b,c,d),d;}this.g.debug(PB+a+BB,b,c)}}ba(a){try{this.j.readyState>HTMLMediaElement.HAVE_NOTHING?(this.g.debug(YB+a),this.j.currentTime-=.001):this.g.warn(mC+a+CB+this.j.readyState)}catch(b){throw this.g.warn(UB+a,b),b;}this.g.debug(OB+a);this.C(a)}pb(a){this.h[a][0].p.reject(new _.I(_.F,3,3014,{mediaError:this.j.error?this.j.error.code:0}))}C(a){const b=this.h[a][0];b&&(b.p.resolve(),this.g.debug(pC+a),PG(this,a))}getTextDisplayer(){return this.G}},EG=window.URL.createObjectURL;var IJ=class{constructor(a){this.h=a;this.a=null;this.f=()=>{}}release(){this.a=this.h=null;this.f=()=>{}}l(a){const b=this.a;{const c=this.h.periods;a=ID(c,a)||c[0]}b!==a&&this.f(a);this.a=a}};var ZI=class{constructor(a){this.f=a;this.o=this.A=this.l=!1;this.h=this.f.Uf();this.w=_.Pd;this.j=null;this.a=new _.Gk(()=>{this.A||this.f.Qh(.25*this.h)});this.g=new _.S("clpp.mse.media.PlayRateController")}getConfiguration(){return this.j}release(){this.a&&(this.a.stop(),this.a=null);this.f=null}set(a,b){this.h=a;VG(this,b)}};var YG=new _.Ru(()=>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]));_.MJ=class{constructor(a,b){this.D=b;this.j=a;bH(a);this.h=null;this.l=1;this.G=Promise.resolve();this.B=new Map;this.w=new Map;this.a=new Map;this.I=this.f=this.o=this.C=!1;this.H=0;this.g=new _.S("clpp.mse.Streaming");this.A=this.F=!1}destroy(){const a=this;return _.x(function*(){const b=[];for(const c of a.a.values())cH(c),b.push(dH(c));yield Promise.all(b);a.a.clear();a.w.clear();a.D=null;a.j=null;a.G=null;a.B.clear();a.h=null;a.f=!0})}start(){const a=this;return _.x(function*(){const b=a.D.Jb();
|
|
287
287
|
var c=ID(a.j.periods,b+_.ku);if(!c)throw new _.I(_.F,5,5006,"No period found.");c=a.D.Ke(c);if(!c.video&&!c.audio&&!c.text)throw a.g.error("start(): No streams chosen"),new _.I(_.F,5,5005,"No streams chosen.");a.F=!c.video&&!c.audio&&!!c.text;a.A=!!c.bb;yield jH(a,c.audio,c.video,c.text,b);a.f||(a.g.debug("init: completed initial Stream setup"),a.D&&a.D.Sh&&(a.g.debug("init: calling onInitialStreamsSetup()..."),a.D.Sh()))})}resume(){if(!GH(this))for(const a of this.a.values())a.endOfStream=!1,iH(this,
|
|
288
288
|
a,0)}Xb(a){const b=this;return _.x(function*(){if(!b.f){var c=$G(a);if(!a.zb&&null!=a.ob&&!a.mc)if(a.ob=null,a.bc)b.g.debug(c,"skipping update and clearing the buffer"),yield yH(b,a,a.ke,a.Jd);else{try{const d=RH(b,a);null!=d&&(iH(b,a,d),a.Pc=!1)}catch(d){yield SH(b,d);return}TH(b,a);if(HH(b))if(b.D.configuration.Kh){b.g.debug("End of stream reached, keeping MediaSource open.");for(const d of b.a.values())d.ob=null}else b.g.debug("End of stream reached, calling ms.endOfStream()."),yield b.D.aa.endOfStream(),
|
|
289
289
|
b.f||(c=b.D.aa.getDuration(),c<b.j.presentationTimeline.getDuration()&&(b.j.presentationTimeline.f=c),b.D.hg())}}})}J(a,b,c,d){const e=SC(d.reader),f=SC(d.reader),g=_.P(d.reader),h=_.P(d.reader),k=_.P(d.reader),l=_.P(d.reader);d=_.tm(d.reader,d.reader.Sa()-d.reader.getPosition());a=a.startTime+b.startTime+h/g;c.includes(e)&&("urn:mpeg:dash:event:2012"===e?this.D.lg():(c=new _.D("emsg",{detail:{startTime:a,endTime:a+k/g,schemeIdUri:e,value:f,timescale:g,presentationTimeDelta:h,eventDuration:k,id:l,
|
|
290
|
-
messageData:d}}),this.D.onEvent(c)))}K(a){let b=!1,c=0;(new _.Dm).N(_.Oe,_.wm).N(_.qg,_.wm).N(_.Je,_.wm).N(_.Ne,_.wm).N(_.bg,_.wm).ea(_.dg,_.xm).N("encv",d=>{d.reader.skip(78);_.wm(d)}).N("pasp",d=>{c=d.start+d.headerSize;const e=_.P(d.reader),f=_.P(d.reader);b=e!==f;this.g.debug(`hSpacing=${e}, vSpacing=${f}, updatePASP=${b}`);d.parser.stop()}).parse(a.data);b&&(a=new _.Fm(new DataView(a.data)),a.seek(c),_.O(a,1),_.O(a,1))}};var tK=class{constructor(){this.a=null}};var uK=class extends _.Fu{constructor(){super(xC);this.H=nJ;this.l=this.Y=null;this.jf=0;this.yg=2;this.Oa=null;this.Te=!1;this.w=new _.St;this.Aa=this.mf=this.Ud=this.I=this.Ha=this.C=this.L=this.B=null;this.qc=!1;this.f=this.j=this.a=this.K=this.J=null;this.h=new _.pK;this.U=null;this.rf=1E9;this.Vd=new Set;this.W=!0;this.da=null;this.qf=!1;this.Bg=0;this.S=null;this.o=new rK;this.G=null;this.
|
|
290
|
+
messageData:d}}),this.D.onEvent(c)))}K(a){let b=!1,c=0;(new _.Dm).N(_.Oe,_.wm).N(_.qg,_.wm).N(_.Je,_.wm).N(_.Ne,_.wm).N(_.bg,_.wm).ea(_.dg,_.xm).N("encv",d=>{d.reader.skip(78);_.wm(d)}).N("pasp",d=>{c=d.start+d.headerSize;const e=_.P(d.reader),f=_.P(d.reader);b=e!==f;this.g.debug(`hSpacing=${e}, vSpacing=${f}, updatePASP=${b}`);d.parser.stop()}).parse(a.data);b&&(a=new _.Fm(new DataView(a.data)),a.seek(c),_.O(a,1),_.O(a,1))}};var tK=class{constructor(){this.a=null}};var uK=class extends _.Fu{constructor(){super(xC);this.H=nJ;this.l=this.Y=null;this.jf=0;this.yg=2;this.Oa=null;this.Te=!1;this.w=new _.St;this.Aa=this.mf=this.Ud=this.I=this.Ha=this.C=this.L=this.B=null;this.qc=!1;this.f=this.j=this.a=this.K=this.J=null;this.h=new _.pK;this.U=null;this.rf=1E9;this.Vd=new Set;this.W=!0;this.da=null;this.qf=!1;this.Bg=0;this.S=null;this.o=new rK;this.G=null;this.ja=_.hp;this.nc=new WI(this.configuration.preferredAudioLanguage||[],this.configuration.preferredAudioRole,
|
|
291
291
|
this.configuration.preferredAudioChannelCount,this.configuration.preferSpatialAudio,this.configuration.mediaSource.codecSwitchingStrategy);this.Qb=this.configuration.preferredTextLanguage;this.A=new qK;this.$=this.va=null;this.Za=new Map;this.oc=null;this.Td=this.configuration.preferredTextRole;this.Pb=this.configuration.preferForcedSubtitles;this.w.on(window,"online",()=>{this.H===uI&&FH(this.a)});this.Wd=this.lc=this.Zd=null;this.R=_.ma;this.tc=new tK;this.Xe=null}init(a,b){const c=a.getMedia();
|
|
292
|
-
super.init(a,b);wI(this,c)}namespace(){return xC}setSeekInterceptor(a){this.mf=a||null}setPlaybackSessionId(a){this.Xe=a}Ag(){return new oK}getState(){return this.
|
|
292
|
+
super.init(a,b);wI(this,c)}namespace(){return xC}setSeekInterceptor(a){this.mf=a||null}setPlaybackSessionId(a){this.Xe=a}Ag(){return new oK}getState(){return this.ja}getDrmInfo(){return this.B?this.B.getDrmInfo():null}unload(){const a=this;return _.x(function*(){zF(a,!1);a.qc=!1;if(a.ga){a.log.debug("Unload player with source",a.ga);var b=a.getTrackManager();b&&b.release();a.H!==GI&&(yield EI(a),a.ga=null,a.jf=0,a.va=null,a.$=null,a.getNetworkEngine().headers.delete(rC))}})}release(){const a=this;
|
|
293
293
|
return _.x(function*(){if(a.Y)return a.Y;a.Y=FI(a);a.Y.finally(()=>{a.Y=null});return a.Y})}getBufferInfo(a){if(this.L){var b=this.L.$();const c=new _.Bu(void 0,a);switch(a){case _.N:return b.video?b.video:c;case _.M:return b.audio?b.audio:c;case _.L:return b.text?b.text:c}return b.total?b.total:c}return this.Oa?(b=CD(this.Oa),uD(b,a)):super.getBufferInfo(a)}getPosition(){var a=this.tc,b=this.getMediaPosition();a.a&&(a=a.a,b-=a.f,b=0>b?0:b>a.a?a.a:b);return b}getMediaPosition(){return this.C?DE(this.C):
|
|
294
294
|
super.getMediaPosition()}seek(a,b){if(this.mf&&!this.mf(a,b))return Promise.resolve();b=this.tc;b=b.a?a+b.a.Tb():a;b!==a&&this.log.info(`Seeking to ${a} s corresponding to `+`media time of ${b} s.`);return super.seek(b)}getPresentationStartTime(){return this.f?this.f.presentationTimeline.getPresentationStartTime():null}getDuration(){var a=this.tc,b=this.getMediaDuration();return a.a?a.a.getDuration():b}getMediaDuration(){return this.f?this.f.presentationTimeline.getDuration():Infinity}destroy(){const a=
|
|
295
295
|
this,b=()=>Object.getPrototypeOf(Object.getPrototypeOf(this)).destroy;return _.x(function*(){yield b().call(a);a.H!==GI&&(a.log.debug("Destroying player..."),a.H=GI,CI(a),a.w&&(a.w.release(),a.w=null),a.lc=null,a.h=null)})}getTimeline(){return this.lc}setupPlaylist(a){const b=this;return _.x(function*(){const c=new _.rn;b.A.a=c;try{AI(b);b.R=_.rb;yield HI(b);oG(b.A,c);const d=a[0];d.playlist&&d.playlist.startTime&&(d.startTime=d.playlist.startTime);b.ga=_.np(d);b.configuration=_.Il(b.ba,d);b.log.info("Loading playlist configurations",
|
|
@@ -305,7 +305,7 @@ originalId:null,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosi
|
|
|
305
305
|
k);const n=_.mH(g.a,_.H);n&&qG(g.o,h,n);g.Vd.delete(k);g.log.debug("Choosing new streams after adding a text stream");WJ(g,h);RI(g);return iG(k)})}Eg(a){this.log.debug(_.FC,a);try{this.log.debug("onChooseStreams_, choosing variant from ",a.variants);this.log.debug("onChooseStreams_, choosing text from ",a.textStreams);const b=XJ(this,a);this.log.debug("onChooseStreams_, chose video ",b.video);this.log.debug("onChooseStreams_, chose audio ",b.audio);this.log.debug("onChooseStreams_, chose text ",b.text);
|
|
306
306
|
return b}catch(b){return this.onError(b),{audio:null,video:null,text:null,bb:null}}}Dg(){this.log.debug("canSwitch_");this.W=!1;this.configuration.abr.enabled&&this.h.enable();this.da&&(AH(this.a,this.da,this.qf,this.Bg),this.da=null);this.S&&(_.zH(this.a,this.S,!0,0),this.S=null)}Jg(){this.j&&this.j.update()}Gg(){this.C&&this.C.j.ce()}Cg(a,b,c){if((void 0===c?"":c)===DC)return RI(this),this.ua()||(this.configuration.abr.enabled=!0,this.h.enable()),WJ(this,b,!1),!0;if(c=b.variants.some(d=>{let e=
|
|
307
307
|
!1;const f=d[a.type];f&&(e=d.allowedByApplication&&f.id!==a.id,a.type===_.p&&(e=e&&f.language===a.language));return e})&&this.ua()){for(const d of b.variants){const e=d[a.type];e&&e.id===a.id&&(d.allowedByApplication=!1)}RI(this);this.ua()||(this.configuration.abr.enabled=!0,this.h.enable());WJ(this,b)}return c}Fg(){this.log.debug("endOfStream called by streaming engine");this.qc=!0}onError(a){if(this.H!==GI&&7001!==a.code&&7E3!==a.code){var b=new _.D(_.q,{detail:a});a.severity===_.F&&zI(this,_.ap);
|
|
308
|
-
this.trigger(b);b.defaultPrevented&&(b.a=!0)}}ef(a){a.type===_.de?this.dispatchEvent(a):"largegap"!==a.type&&(a.type===_.Pg?oJ(this):"emsg"!==a.type&&(a instanceof _.D?this.dispatchEvent(a):this.log.debug(_.
|
|
308
|
+
this.trigger(b);b.defaultPrevented&&(b.a=!0)}}ef(a){a.type===_.de?this.dispatchEvent(a):"largegap"!==a.type&&(a.type===_.Pg?oJ(this):"emsg"!==a.type&&(a instanceof _.D?this.dispatchEvent(a):this.log.debug(_.Mb,a.type)))}ua(){return this.configuration.abr.enabled}Ig(a){const b=this;return _.x(function*(){if(b.Gc){b.log.info("Attempt to switch CDN.");var c=b.getLoadedSource(),d=b.ua();if(c=yield b.Gc(c.url,a)){c=_.lh(b.getLoadedSource(),{url:c});d&&b.h.disable();yield IH(b.a);var e=iI(b),f=jI(b);do{var g=
|
|
309
309
|
!1;try{b.log.info(`Switching CDN to ${c.url}.`),yield YJ(b,c,e,f)}catch(h){if(b.log.info("Switch failed"),g=yield b.Gc(c.url,a))c.url=g,g=!0;else throw h;}}while(g);d&&b.h.enable();FH(b.a,!0);b.ga[b.getSourceIndex()]=c;a.f=!0;b.trigger(new _.D(_.jd,{newManifest:c.url}))}}})}},GI=0,nJ=1,uI=2,QI=[_.bf,_.se];
|
|
310
310
|
_.Kh(new class{a(){return xC}canPlay(a,b){if(_.Tk())return 0;const c=a.type||"",d=(window.ManagedMediaSource?!0:!1)||(window.MediaSource&&MediaSource.isTypeSupported?!0:!1);a=window.ManagedMediaSource||window.MediaSource&&MediaSource.isTypeSupported?c in _.ct||_.dt(a.url)in _.et?!0:!1:!1;if(d&&a){if(_.Kk(2))return 1;if(_.Uk()&&c===_.zl){if(b.streaming.preferNativeHlsOnSafari)return 1;_.C("Support for MSE + FairPlay on Apple is experimental. In case of issues, consider using native HLS.")}return 2}return 0}f(a){return a===
|
|
311
311
|
_.ma||a===_.rb}create(){return new uK}});_.mr(function(){_.Gh("MediaSource.install");if(window.MediaSource)if(window.cast&&cast.__platform__&&cast.__platform__.canDisplayType)_.Fh("Patching Chromecast MSE bugs."),ZJ();else if(_.Uk()){var a=navigator.appVersion;a=0<=a.indexOf("Version")?parseInt(a.match(/Version\/(\d+)/)[1],10):13;$J();10>=a?(_.Fh("Blacklisting MSE on Safari \x3c\x3d 10."),window.MediaSource=null):12>=a?(_.Fh("Patching Safari 11 \x26 12 MSE bugs."),aK(),bK()):(_.Fh("Patching Safari 13 MSE bugs."),aK())}else _.Kk(2)||_.Kk(3)||
|
package/cl.muxdata.js
CHANGED
|
@@ -2,7 +2,7 @@ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(windo
|
|
|
2
2
|
a.m.getSurface();var e={player_is_paused:a.m.isPaused(),player_is_fullscreen:f.isFullscreen(),video_source_duration:1E3*a.m.getDuration(),player_autoplay_on:!!a.m.getConfiguration().autoplay};if(c){const k=new _.Bm(c.url);e.video_source_url=_.Zj(k);e.video_source_mime_type=c.type;c.name&&(e.video_title=c.name)}if(c=f.getContainer())e.player_width=c.offsetWidth,e.player_height=c.offsetHeight;(c=a.m.getSurface().getMedia())?c={videoWidth:c.videoWidth,videoHeight:c.videoHeight}:(c=a.m.getTrackManager().oa(),
|
|
3
3
|
c={videoWidth:c.width,videoHeight:c.height});const {videoWidth:g,videoHeight:h}=c;a.g.debug(`Video dimensions: ${g}x${h}`);g&&h&&(e.video_source_height=g,e.video_source_width=h);(d=d.ra())&&d.language&&(e.player_language_code=d.language)}return e}});a.g.debug("Mux SDK options",b);return b},tB=function(a){_.Th(a.a);a.j.vd(a.F);a.j.We(a.C)},rB=function(a){const b={env_key:a.f.envKey,video_title:a.o&&a.o.name||"",player_name:_.qa,player_software_name:_.qa,player_software_version:_.ea,player_mux_plugin_name:"CastlabsPlayer built-in Mux Plugin",
|
|
4
4
|
player_mux_plugin_version:_.ea};(a=a.m.getConfiguration().viewerId)&&(b.viewer_user_id=a);return b},uB=function(a){a.a.on(a.m,_.og,()=>{const b={player_playhead_time:1E3*a.m.getPosition()};a.emit(_.og,b)});a.a.on(a.m,_.gf,()=>a.emit(_.gf));a.a.on(a.m,_.Zc,a.G.bind(a));a.a.on(a.m,_.$f,a.I.bind(a));a.a.on(a.m,_.Cg,()=>a.emit(_.Sf));a.a.on(a.m,_.Bg,()=>a.emit(_.Rf));a.a.on(a.m,_.q,a.H.bind(a));a.a.on(a.m,_.jc,()=>a.emit("adbreakstart"));a.a.on(a.m,_.kc,()=>a.emit("adbreakend"));a.a.on(a.m,_.zc,()=>{a.emit("adplay");
|
|
5
|
-
a.emit("adplaying")});a.a.on(a.m,_.vc,()=>a.emit("adpause"));a.a.on(a.m,_.xc,()=>{a.emit("adplay");a.emit("adplaying")});a.a.on(a.m,_.
|
|
5
|
+
a.emit("adplaying")});a.a.on(a.m,_.vc,()=>a.emit("adpause"));a.a.on(a.m,_.xc,()=>{a.emit("adplay");a.emit("adplaying")});a.a.on(a.m,_.Ac,()=>a.emit("adended"));a.a.on(a.m,_.oc,()=>a.emit("adfirstquartile"));a.a.on(a.m,_.uc,()=>a.emit("admidpoint"));a.a.on(a.m,_.Dc,()=>a.emit("adthirdquartile"));a.j.Ec(a.F);a.j.me(a.C);a.a.on(a.m,_.q,b=>{if((b=b.detail)&&1===b.category){var c=b.data;c=c&&c.request;if(void 0!==c&&!0===(1===c.type||2===c.type||3===c.type))if(7001===b.code){b=c;c=b.requestStartTimestamp;
|
|
6
6
|
var d=new _.Bm(b.uris[b.uriIndex]);b={request_start:c,request_type:oB(b),request_hostname:d.a};a.g.debug("onRequestCanceled()","Track event: requestcanceled",b);a.emit("requestcanceled",b)}else{{d=c.requestStartTimestamp;const f=new _.Bm(c.uris[c.uriIndex]);var e=b.data;e=void 0===e?-1:void 0!==e.response?e.response.status:void 0!==e.status?e.status:-1;b={request_start:d,request_type:oB(c),request_hostname:f.a,request_error:`${oB(c)}${"LoadError"}`,request_error_code:e,request_error_text:b.toString()};
|
|
7
7
|
a.g.debug("onRequestFailed()","Track event: requestfailed",b);a.emit("requestfailed",b)}}}})},vB=function(a,b){a.trigger(new _.D(_.q,{detail:b}))},wB=function(a){return!_.B(a)&&typeof a.init===_.ne&&typeof a.emit===_.ne},lB="manifest",mB="media",nB="encryption",pB=["x-request-id","cf-ray","x-amz-cf-id","x-akamai-request-id"];var xB=class{constructor(a,b){this.m=a;this.o=this.f=null;this.B=("000000"+(Math.random()*Math.pow(36,6)<<0).toString(36)).slice(-6);this.a=new _.St;this.g=b;this.A=this.l=this.h=!1;this.w=null;this.j=a.getNetworkEngine();this.F=this.J.bind(this);this.C=this.K.bind(this)}initialize(a,b,c){this.f=a;this.o=b;this.w=c;if(!this.h){try{this.h=!0,this.w.init(this.B,sB(this))}catch(d){throw this.h=!1,tB(this),new _.I(1,9,9302,null,d);}this.emit("playerready")}this.l&&!this.A&&(a=rB(this),this.emit("videochange",
|
|
8
8
|
a),this.l=!1);uB(this)}release(){this.g.debug("release()");this.l?this.g.debug(_.ia):(tB(this),this.l=!0,this.o=this.f=null)}destroy(){this.g.debug(_.Qd);this.A?this.g.debug(_.ha):(this.A=!0,this.emit("destroy"))}emit(a,b){if(null===this.w)throw new _.I(1,9,9301);this.w.emit(this.B,a,b)}G(a){this.g.debug(_.Te);var b=a.detail;a=this.m.getTrackManager();b&&b.bandwidth&&(b=b.bandwidth,(a=a.Ra())&&a.bandwidth&&(b+=a.bandwidth),this.emit("renditionchange",{video_source_bitrate:b}))}I(a){this.g.debug(_.Ye);
|
package/cl.playlist.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var SA=function(a,b){return 0<=b&&b<a.a.length},TA=function(a){a.trigger(new _.D(_.
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var SA=function(a,b){return 0<=b&&b<a.a.length},TA=function(a){a.trigger(new _.D(_.vf))},UA=class extends _.Cu{on(a,b,c){return super.on(a,b,c)}one(a,b,c){return super.one(a,b,c)}off(a,b){return super.off(a,b)}constructor(a,b){b=void 0===b?()=>Promise.resolve():b;super();this.m=a;this.l=b;this.f=0;this.a=[];this.h=!1;this.j=this.Da.bind(this)}getPosition(){return this.f}wh(){return this.a}ed(){return 0<this.a.length&&SA(this,this.f)?this.a[this.f]:null}xh(){const a=this.f+1;return 0<
|
|
2
2
|
this.a.length&&SA(this,a)?this.a[a]:null}Ih(){return this.h}start(){this.h||(this.h=!0,this.m.on(_.je,this.j),this.Qd(this.f,!0))}stop(){this.h=!1;this.m.off(_.je,this.j)}Da(){this.next()}next(){const a=this;return _.x(function*(){yield a.Qd(Math.min(a.a.length-1,a.f+1))})}$h(){const a=this;return _.x(function*(){yield a.Qd(Math.max(0,a.f-1))})}Qd(a,b){b=void 0===b?!1:b;const c=this;return _.x(function*(){if(0<c.a.length&&SA(c,a)&&(b||c.f!==a)){c.f=a;var d=c.ed();d&&(yield c.l(d),yield c.m.load(d.configuration),
|
|
3
3
|
c.trigger(new _.D(_.tf,{item:d})))}})}append(a){this.a.push(a);TA(this)}Gh(a,b){if(0<=b&&b<=this.a.length){const c=this.ed();this.a.splice(b,0,a);c&&(this.f=this.a.indexOf(c));TA(this)}}remove(a){if(0<this.a.length&&SA(this,a)){if(this.f===a)throw Error("Can't remove the current item");this.a.splice(a,1);TA(this)}}clear(){this.stop();this.f=0;this.a=[];this.h=!1;TA(this)}};_.z("clpp.Playlist",UA);UA.prototype.clear=UA.prototype.clear;UA.prototype.remove=UA.prototype.remove;UA.prototype.insert=UA.prototype.Gh;
|
|
4
4
|
UA.prototype.append=UA.prototype.append;UA.prototype.goTo=UA.prototype.Qd;UA.prototype.previous=UA.prototype.$h;UA.prototype.next=UA.prototype.next;UA.prototype.onEnded=UA.prototype.Da;UA.prototype.stop=UA.prototype.stop;UA.prototype.start=UA.prototype.start;UA.prototype.isStarted=UA.prototype.Ih;UA.prototype.getUpcoming=UA.prototype.xh;UA.prototype.getCurrent=UA.prototype.ed;UA.prototype.getQueue=UA.prototype.wh;UA.prototype.getPosition=UA.prototype.getPosition;UA.prototype.off=UA.prototype.off;
|
package/cl.smooth.js
CHANGED
|
@@ -15,16 +15,16 @@ A;y++){b:{var k=h;var l=g[y],m=new RegExp("\\w+:"+l),n=0;if(k.hasAttribute(l)){k
|
|
|
15
15
|
m,f]);n&&b.append([n]);if(e){g=0;k=[];if(c.flags&2)for(k=[],m=0;m<c.h;m++)k.push(10+6*c.f[m].Vc);else g=8;b.append([c,new cT,new dT(g,k,c.h)])}h.append([a,b]);f.flags|=1;f.j=h.a()+8;d=new PS([h,d]);h=d.write();e&&(e=d.get("saio"),d=d.f,e.offset[0]=c.start+16,d.seek(e.start),e.write(d),h=d.buffer);return h},fT=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,
|
|
16
16
|
periodId:null}},gT=function(a){return{initData:_.UC(_.zn(a)),initDataType:_.kd,keyId:a,periodId:null}},hT=function(a,b,c){a=_.In(a);c&&a.version!==c&&(a=_.WC(a,c));return{initData:_.UC(a),initDataType:_.kd,keyId:b,periodId:null}},iT=function(a,b){return _.x(function*(){var c=_.Bj(b);c.timeout=a.f.attemptParameters.timeout;c.maxAttempts=Math.max(a.f.attemptParameters.maxAttempts,b.length);c.baseDelay=a.f.attemptParameters.baseDelay;c.backoffFactor=a.f.attemptParameters.backoffFactor;c.fuzzFactor=a.f.attemptParameters.fuzzFactor;
|
|
17
17
|
c.type=1;c=yield a.D.networkingEngine.fetch(c).V;a.o=c.uri;return c})},qT=function(a,b){const c=_.Dn;let d=null;try{const ib=_.lj(b);d=c.j(ib,_.Hb)}catch(ib){}if(!d)throw a.g.error("Unable to parse manifest"),new _.I(_.F,4,4033,a.o);const e=+jT(a,d,"MajorVersion"),f=+jT(a,d,"MinorVersion"),g=+d.getAttribute("TimeScale")||1E7;let h=+jT(a,d,"Duration");const k="TRUE"===d.getAttribute("IsLive"),l=+d.getAttribute("LookAheadCount"),m=+d.getAttribute("DVRWindowLength")||Infinity,n=c.a(d,"Protection")[0];
|
|
18
|
-
if(!1===/^[2].[0-2]$/.test(""+e+"."+f))throw a.g.error("Smooth Streaming version must be 2.0, 2.1 or 2.2"),new _.I(_.F,4,4036,a.o);k?(kT(a,lT),a.B=typeof a.f.liveRefreshPeriod===_.t?1E3*a.f.liveRefreshPeriod:Math.min(1E3*a.I,1E4),h=Infinity):kT(a,mT);a.a={startTime:0,delay:0,duration:h/g,
|
|
19
|
-
u}{const ib=[],va=_.Dn.a(d,"StreamIndex");if(!va.length)throw a.g.error("No streams found!"),new _.I(_.F,4,4034,a.o);for(let
|
|
20
|
-
Na
|
|
21
|
-
32E3:5,24E3:6,22050:7,16E3:8,12E3:9,11025:10,8E3:11,7350:12},Rm=yG[Qm];if("AACH"===xG){Na=new Uint8Array(4);const zG=yG[2*Qm];Na[0]=40|Rm>>1;Na[1]=Rm<<7|X<<3|zG>>1;Na[2]=zG<<7|8;Na[3]=0;hd=new Uint16Array(2);hd[0]=(Na[0]<<8)+Na[1];hd[1]=(Na[2]<<8)+Na[3]
|
|
22
|
-
maxWidth:
|
|
23
|
-
gd[gd.length-1];
|
|
24
|
-
fg:f,timescale:g,duration:h,isLive:k,Ti:l,
|
|
25
|
-
textStreams:Wh,thumbStreams:[]}}{var
|
|
26
|
-
a.C.A=Vh;
|
|
27
|
-
c);c&&null!=a.l&&(window.clearTimeout(a.l),a.l=null,a.B=null);a.O=b},nT=function(a,b){for(let e=0;e<a.A.streams.length;e++){const f=b.streams[e];for(const g of a.A.streams[e].tracks){var c=f.tracks.find(h=>h.type===g.type&&h.bitrate===g.bitrate);if(c){VR(g,c)||a.g.warn("The current stream is updated with a stream that seems to have different base properties!");var d=sT(a,a.A.timescale,f,c);c=g.segmentIndex;_.kE(c,d);(d=a.a.
|
|
18
|
+
if(!1===/^[2].[0-2]$/.test(""+e+"."+f))throw a.g.error("Smooth Streaming version must be 2.0, 2.1 or 2.2"),new _.I(_.F,4,4036,a.o);k?(kT(a,lT),a.B=typeof a.f.liveRefreshPeriod===_.t?1E3*a.f.liveRefreshPeriod:Math.min(1E3*a.I,1E4),h=Infinity):kT(a,mT);a.a={startTime:0,delay:0,duration:h/g,ue:m/g,od:0};if(n){{var r=a.f.playreadyVersion;const ib=_.Dn,va=[],xb=ib.a(n,"ProtectionHeader")[0],Bc=_.Yl(ib.f(xb)||""),ic=_.In(Bc).a;va.push(fT(_.Jd,gT(ic),[ic]));va.push(fT(_.Hd,hT(Bc,ic,r),[ic]));var u=va}a.w=
|
|
19
|
+
u}{const ib=[],va=_.Dn.a(d,"StreamIndex");if(!va.length)throw a.g.error("No streams found!"),new _.I(_.F,4,4034,a.o);for(let xb=0;xb<va.length;xb++){{var v=a,y=va[xb];const Bc=jT(v,y,"Type"),ic=+y.getAttribute("Chunks"),Vh=y.getAttribute("Subtype")||"",xe=y.getAttribute("Language")||_.tg,ye=_.Qi(xe),Wh=y.getAttribute("Name")||"",uf=+y.getAttribute(_.eb),wg=+y.getAttribute(_.db),Os=jT(v,y,"Url"),Pm=+y.getAttribute("TimeScale")||null;{const gd=[],Ej=_.Dn.a(y,_.zb);for(let ze=0;ze<Ej.length;ze++){{let hd,
|
|
20
|
+
Na,Zd;var A=v,E=Ej[ze],G=Bc;const Fj=+E.getAttribute("Index"),xg=+jT(A,E,"Bitrate");let Cc=NaN,yg=NaN,Qm=NaN,Ps=NaN,uG=NaN,vG=NaN,wG=NaN;const xG=E.getAttribute("FourCC")||"";switch(G){case _.w:Cc=+jT(A,E,_.db);yg=+jT(A,E,_.eb);break;case _.p:Ps=+E.getAttribute("Channels")||2,Qm=+jT(A,E,"SamplingRate"),vG=+jT(A,E,"AudioTag"),uG=+jT(A,E,"BitsPerSample"),wG=+jT(A,E,"PacketSize")}let Qs=String(E.getAttribute("CodecPrivateData"));if(G===_.p&&!Qs){{var X=Ps;const yG={96E3:0,88200:1,64E3:2,48E3:3,44100:4,
|
|
21
|
+
32E3:5,24E3:6,22050:7,16E3:8,12E3:9,11025:10,8E3:11,7350:12},Rm=yG[Qm];if("AACH"===xG){Na=new Uint8Array(4);const zG=yG[2*Qm];Na[0]=40|Rm>>1;Na[1]=Rm<<7|X<<3|zG>>1;Na[2]=zG<<7|8;Na[3]=0;hd=new Uint16Array(2);hd[0]=(Na[0]<<8)+Na[1];hd[1]=(Na[2]<<8)+Na[3];Zd=hd[0].toString(16)+hd[1].toString(16)}else Na=new Uint8Array(2),Na[0]=16|Rm>>1,Na[1]=Rm<<7|X<<3,hd=new Uint16Array(1),hd[0]=(Na[0]<<8)+Na[1],Zd=hd[0].toString(16);Qs=Zd.toUpperCase()}}var dd={id:A.U++,type:G,index:Fj,bitrate:xg,Kd:Qs,maxHeight:Cc,
|
|
22
|
+
maxWidth:yg,xd:Qm,Ff:Ps,Ii:vG,Tg:uG,Vi:wG,nh:xG,segmentIndex:null}}gd.push(dd)}var ec=gd}{const gd=[],Ej=_.Dn.a(y,"c");for(let ze=0;ze<Ej.length;ze++){const hd=Ej[ze];let Na=parseInt(hd.getAttribute("t"),10),Zd=parseInt(hd.getAttribute("d"),10),Fj=parseInt(hd.getAttribute("r"),10),xg=0;if(isNaN(Na)&&isNaN(Zd))throw v.g.error("Either one or both FragmentDuration and FragmentTime field MUST be present in StreamFragmentElement"),new _.I(_.F,4,4037,v.o);0===ze&&isNaN(Na)&&(xg=Na=0);if(0<ze){const Cc=
|
|
23
|
+
gd[gd.length-1];xg=Cc.n+1;Cc.d||(Cc.d=Na-Cc.t);Na||(Na=Cc.t+Cc.d);Zd||(Zd=Na-Cc.t)}gd.push({n:xg,d:Zd,t:Na});if(Fj){Fj--;for(let Cc=0;Cc<Fj;Cc++){const yg=gd[gd.length-1];xg=yg.n+1;Na=yg.t+yg.d;Zd=yg.d;gd.push({n:xg,d:Zd,t:Na})}}}v.F()||gd.length===ic||v.g.warn("Number of fragments ("+ic+") differs from number of chunks ("+gd.length+").");var Nb=gd}var Yd={type:Bc,Mi:ic,ri:Vh,language:ye,Qc:xe,name:Wh,maxWidth:uf,maxHeight:wg,Di:Os,tracks:ec,Of:Nb,timescale:Pm}}ib.push(Yd)}var Ob=ib}const fc={Ui:e,
|
|
24
|
+
fg:f,timescale:g,duration:h,isLive:k,Ti:l,ue:m,Ae:!1,streams:Ob};if(a.j&&a.A)return nT(a,fc),Promise.resolve();a.H.clear();{const ib=fc.timescale,va=fc.duration,xb=YR(fc.streams,_.p),Bc=YR(fc.streams,_.w),ic=YR(fc.streams,_.H),Vh=[];let xe=oT(a,va,ib,xb),ye=oT(a,va,ib,Bc);const Wh=oT(a,va,ib,ic);xe.length||(xe=[null]);ye.length||(ye=[null]);for(let uf=0;uf<ye.length;uf++)for(let wg=0;wg<xe.length;wg++)Vh.push(pT(a,ye[uf],xe[wg]));var gc={id:"ID",configurationId:void 0,startTime:0,endTime:va,variants:Vh,
|
|
25
|
+
textStreams:Wh,thumbStreams:[]}}{var Fb=fc.streams;let ib=a.a.startTime,va=a.a.delay;const xb=a.J;let Bc=Math.min(a.a.duration||Infinity,xb);const ic=a.F(),Vh=a.a.ue,xe=a.a.od,ye=a.I,Wh=isFinite(a.G)?a.G:0;if(ic)Bc=Infinity,ib=Date.now()/1E3-xe,a.a.startTime=ib,va=3*ye;else{const wg=isFinite(xb)?xb:a.a.duration;for(const Os of Fb)for(const Pm of Os.tracks)Pm.segmentIndex.offset(-Wh),_.LD(Pm.segmentIndex,wg)}const uf=a.f.timeline||{};uf.type=void 0;a.C=new _.iK(uf,ib,va,!ic,!0);a.C.f=Bc;_.ZD(a.C,ye);
|
|
26
|
+
a.C.A=Vh;ic||a.C.offset(-Wh)}a.D.filterAllPeriods([gc]);a.j={presentationTimeline:a.C,periods:[gc],minBufferTime:0,cues:[]};Promise.resolve();a.L||(a.D.networkingEngine.Ec(a.M),a.L=!0);a.A=fc;return Promise.resolve()},rT=function(a,b){null!=a.B&&null!=b&&(a.l=window.setTimeout(a.Xb.bind(a),b))},jT=function(a,b,c){if(b=b.getAttribute(c))return b;a.g.error("required attribute not provided: "+c);throw new _.I(_.F,4,4038,a.o,c);},kT=function(a,b){const c=b===mT;a.j&&a.j.presentationTimeline&&_.UD(a.j.presentationTimeline,
|
|
27
|
+
c);c&&null!=a.l&&(window.clearTimeout(a.l),a.l=null,a.B=null);a.O=b},nT=function(a,b){for(let e=0;e<a.A.streams.length;e++){const f=b.streams[e];for(const g of a.A.streams[e].tracks){var c=f.tracks.find(h=>h.type===g.type&&h.bitrate===g.bitrate);if(c){VR(g,c)||a.g.warn("The current stream is updated with a stream that seems to have different base properties!");var d=sT(a,a.A.timescale,f,c);c=g.segmentIndex;_.kE(c,d);(d=a.a.ue)&&_.lE(c,_.iE(c)-d).forEach(h=>{h.ab().forEach(k=>{a.H.delete(k)})})}else a.g.warn(`Cannot find satisfying update for ${g.type} `+
|
|
28
28
|
`track with bitrate ${g.bitrate}. Skipping update.`)}}},sT=function(a,b,c,d){let e=0;const f=[],g=c.timescale||b;c.Of.forEach((h,k)=>{const l=h.d/g;0===k?(h=h.t/g,a.G=Math.min(a.G,h)):h=f[k-1].endTime;const m=h+l,n=UR(a.o,c,k,d);a.I=Math.max(a.I,l);f.push(new _.jE(k,h,m,()=>[n],0,null,0,null,!0,g));a.H.set(n,h);e+=l});if(c.type===_.w||c.type===_.p)b=f[f.length-1],a.J=Math.min(a.J,e),0===a.a.od?a.a.od=b.endTime:a.a.od=Math.min(a.a.od,b.endTime);return f},oT=function(a,b,c,d){let e=[];for(let f=0;f<
|
|
29
29
|
d.length;f++){const g=d[f].tracks.map(h=>{{var k=d[f],l=sT(a,c,k,h);const X=new _.jK(l);var m=null;k.type!==_.H&&(m=tT(a,b,c,k,h));h.segmentIndex=X;l=_.fK++;var n=Promise.resolve.bind(Promise),r=X.f.bind(X),u=X.get.bind(X),v=X.h.bind(X),y=X.getDuration.bind(X),A=uT[k.type];var E="";switch(k.type){case _.w:E=h.Kd;var G=/00000001[0-9]7/.exec(E);E="avc1."+(G&&G[0]?E.substr(E.indexOf(G[0])+10,6):"42c00c");a.g.debug("VIDEO CODECS: ",E);break;case _.p:E=h.Kd,G=2,"AACH"===h.nh?G=5:E&&(G=(parseInt(E.substr(0,
|
|
30
30
|
2),16)&248)>>3),E="mp4a.40."+G,a.g.debug("AUDIO CODECS: ",E)}G=k.type===_.H?vT[k.ri]:void 0;h={id:l,originalId:null,Yi:null,createSegmentIndex:n,findSegmentPosition:r,getSegmentReference:u,adjustSegmentDurations:v,getDuration:y,segmentIndex:X,segmentLookupStrategy:_.BC,initSegmentReference:m,mimeType:A,codecs:E,frameRate:void 0,bandwidth:h.bitrate,width:h.maxWidth||void 0,height:h.maxHeight||void 0,kind:G,encrypted:a.K(),keyId:null,language:k.language,originalLanguage:k.Qc,label:k.name,type:k.type,
|