@castlabs/prestoplay 6.34.0 → 6.35.0-beta.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/cjs/cl.adobe.js +3 -3
- package/cjs/cl.airplay.js +3 -3
- package/cjs/cl.broadpeak.js +18 -18
- package/cjs/cl.cast.js +125 -125
- package/cjs/cl.conviva.js +31 -31
- package/cjs/cl.core.js +579 -577
- package/cjs/cl.crypto.js +9 -9
- package/cjs/cl.dash.js +100 -100
- package/cjs/cl.freewheel.js +26 -26
- package/cjs/cl.hls.js +76 -76
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +30 -30
- package/cjs/cl.ima.js +25 -25
- package/cjs/cl.mediatailor.js +3 -3
- package/cjs/cl.mse.js +345 -345
- package/cjs/cl.muxdata.js +13 -13
- package/cjs/cl.onboard.js +4 -4
- package/cjs/cl.persistent.js +14 -14
- package/cjs/cl.playlist.js +5 -5
- package/cjs/cl.simid.js +16 -16
- package/cjs/cl.smooth.js +70 -70
- package/cjs/cl.thumbnails.js +25 -25
- package/cjs/cl.tizen.js +67 -67
- package/cjs/cl.ttml.js +29 -29
- package/cjs/cl.verimatrix.js +5 -5
- package/cjs/cl.vimond.js +8 -8
- package/cjs/cl.vr.js +19 -19
- package/cjs/cl.vtt.js +14 -14
- package/cjs/cl.yospace.js +3 -3
- package/cjs/cl.youbora.js +38 -38
- package/cl.adobe.js +3 -3
- package/cl.airplay.js +3 -3
- package/cl.broadpeak.js +14 -14
- package/cl.cast.js +97 -97
- package/cl.conviva.js +28 -27
- package/cl.core.js +463 -462
- package/cl.crypto.js +8 -8
- package/cl.dash.js +89 -89
- package/cl.freewheel.js +20 -20
- package/cl.hls.js +82 -82
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +26 -26
- package/cl.ima.js +19 -19
- package/cl.mediatailor.js +2 -2
- package/cl.mse.js +299 -299
- package/cl.muxdata.js +11 -11
- package/cl.onboard.js +5 -5
- package/cl.persistent.js +10 -10
- package/cl.playlist.js +5 -5
- package/cl.simid.js +14 -14
- package/cl.smooth.js +60 -60
- package/cl.thumbnails.js +17 -17
- package/cl.tizen.js +55 -55
- package/cl.ttml.js +22 -22
- package/cl.verimatrix.js +4 -4
- package/cl.vimond.js +7 -7
- package/cl.vr.js +14 -14
- package/cl.vtt.js +12 -12
- package/cl.yospace.js +3 -3
- package/cl.youbora.js +31 -31
- package/package.json +1 -1
package/cl.crypto.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
g),b.onError(new _.J(1,7,7104,null,g,g.svtaCode||3E3)),c}try{const g=a.f?new
|
|
3
|
-
return a.a[f]=g.data}catch(g){throw e&&1001===g.code&&412===g.data.status&&a.g.warn("Wrong DRMtoday credentials, server responded with 412."),g;}})},
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var BU=function(a){a=_.ti(a);const b=new Uint32Array(4);for(let c=0;4>c;c++)b[c]=a.getUint32(4*c);return b},DU=function(a,b){return c=>_.v(function*(){const d=c.request||null;if(d&&2===d.type&&d.keyInfo&&c.data){const e=d.uris[0];a.g.debug("Decrypting AES-128-encrypted video segment",e);c.data=yield CU(a,b,c.data,d.keyInfo,e)}return c})},CU=function(a,b,c,d,e){return _.v(function*(){let f=new ArrayBuffer(0);try{f=yield EU(a,b,d.url)}catch(g){return a.g.warn("Could not fetch AES key",
|
|
2
|
+
g),b.onError(new _.J(1,7,7104,null,g,g.svtaCode||3E3)),c}try{const g=a.f?new FU:new GU;yield g.importKey(f);return yield g.decrypt(c,d.iv)}catch(g){return a.g.warn("Could not decrypt segment data!",e,g),b.onError(new _.J(1,3,3103,null,g)),c}})},EU=function(a,b,c){return _.v(function*(){const d=_.fk(c),e=(new _.Ej(c)).a.hostname.endsWith(".drmtoday.com");if(e){var f=b.getConfiguration();_.fn(d,f)}f=c+JSON.stringify(d.headers);if(a.a[f])return a.a[f];try{const g=yield b.getNetworkEngine().fetch(d).V;
|
|
3
|
+
return a.a[f]=g.data}catch(g){throw e&&1001===g.code&&412===g.data.status&&a.g.warn("Wrong DRMtoday credentials, server responded with 412."),g;}})},GU=class{constructor(){this.B=[0,1,2,4,8,16,32,64,128,27,54];this.C=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)];this.l=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)];this.A=new Uint32Array(256);this.o=new Uint32Array(256);this.w=new Uint32Array(0);this.h=this.a=this.j=this.f=
|
|
4
4
|
null;{const c=this.A,d=this.o;var a=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,p=0,u;for(u=0;256>u;u++)m[u]=128>u?u<<1:u<<1^283;for(u=0;256>u;u++){let x=p^p<<1^p<<2^p<<3^p<<4;x=x>>>8^x&255^99;c[n]=x;d[x]=n;const y=m[n],B=m[y],F=m[B];let G=257*m[x]^16843008*x;e[n]=G<<24|G>>>8;f[n]=G<<16|G>>>16;g[n]=G<<8|G>>>24;a[n]=G;G=16843009*F^65537*B^257*y^16843008*n;h[x]=G<<24|G>>>8;k[x]=G<<16|G>>>16;l[x]=G<<8|G>>>24;b[x]=G;n?(n=
|
|
5
|
-
y^m[m[m[F^y]]],p^=m[m[p]]):n=p=1}}}importKey(a){a=
|
|
6
|
-
24]<<24|b[l>>>16&255]<<16|b[l>>>8&255]<<8|b[l&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=
|
|
7
|
-
let n=m[1],p=m[2];m=m[3];a=_.
|
|
8
|
-
D=B,
|
|
9
|
-
this.j=this.f=this.l=this.C=this.o=this.A=this.h=this.a=this.w=null;return new Promise(a=>a())}F(a){return a<<24|(a&65280)<<8|(a&16711680)>>8|a>>>24}};var
|
|
5
|
+
y^m[m[m[F^y]]],p^=m[m[p]]):n=p=1}}}importKey(a){a=BU(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>>>
|
|
6
|
+
24]<<24|b[l>>>16&255]<<16|b[l>>>8&255]<<8|b[l&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=BU(b);b=m[0];
|
|
7
|
+
let n=m[1],p=m[2];m=m[3];a=_.si(a);const u=new Int32Array(a.length);let x,y,B;let F,G,D,ka,Da,Xa,Hb,sb,hc;const ic=this.F.bind(this);for(;c<a.length;){ka=ic(a[c]);Da=ic(a[c+1]);Xa=ic(a[c+2]);Hb=ic(a[c+3]);F=ka^e[0];G=Hb^e[1];D=Xa^e[2];var Ib=Da^e[3];sb=4;for(hc=1;hc<d;hc++)x=h[F>>>24]^k[G>>16&255]^l[D>>8&255]^g[Ib&255]^e[sb],y=h[G>>>24]^k[D>>16&255]^l[Ib>>8&255]^g[F&255]^e[sb+1],B=h[D>>>24]^k[Ib>>16&255]^l[F>>8&255]^g[G&255]^e[sb+2],Ib=h[Ib>>>24]^k[F>>16&255]^l[G>>8&255]^g[D&255]^e[sb+3],F=x,G=y,
|
|
8
|
+
D=B,sb+=4;x=f[F>>>24]<<24^f[G>>16&255]<<16^f[D>>8&255]<<8^f[Ib&255]^e[sb];y=f[G>>>24]<<24^f[D>>16&255]<<16^f[Ib>>8&255]<<8^f[F&255]^e[sb+1];B=f[D>>>24]<<24^f[Ib>>16&255]<<16^f[F>>8&255]<<8^f[G&255]^e[sb+2];Ib=f[Ib>>>24]<<24^f[F>>16&255]<<16^f[G>>8&255]<<8^f[D&255]^e[sb+3];sb+=3;u[c]=ic(x^b);u[c+1]=ic(Ib^n);u[c+2]=ic(B^p);u[c+3]=ic(y^m);b=ka;n=Da;p=Xa;m=Hb;c+=4}return new Promise(jb=>{{var za=u.buffer;const vb=za.byteLength,xc=vb&&(new DataView(za)).getUint8(vb-1);za=xc?za.slice(0,vb-xc):za}jb(za)})}destroy(){this.B=
|
|
9
|
+
this.j=this.f=this.l=this.C=this.o=this.A=this.h=this.a=this.w=null;return new Promise(a=>a())}F(a){return a<<24|(a&65280)<<8|(a&16711680)>>8|a>>>24}};var FU=class{constructor(){this.a=null}importKey(a){const b=this;return _.v(function*(){b.a=yield crypto.subtle.importKey("raw",a,{name:"AES-CBC"},!1,["decrypt"])})}decrypt(a,b){const c=this;return _.v(function*(){return yield crypto.subtle.decrypt({name:"AES-CBC",iv:b},c.a,a)})}destroy(){this.a=null;return new Promise(a=>a())}};_.w("clpp.crypto.CryptoComponent",class extends _.Fv{constructor(){super();this.a={};this.f=!1;this.g=new _.S("clpp.crypto")}install(){if(window.crypto&&crypto.subtle){var a=crypto.subtle.decrypt;a=typeof crypto.subtle.importKey===_.Wd&&typeof a===_.Wd}else a=!1;(this.f=a)||this.g.warn("No WebCrypto APIs found. Will fallback to software AES")}playerConstructed(a){const b=DU(this,a);a.getNetworkEngine().td(b)}uninstall(){this.a={}}id(){return"crypto"}});};f.call(g, window);
|
package/cl.dash.js
CHANGED
|
@@ -1,91 +1,91 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";import './cl.mse.js';let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
()=>e())}
|
|
5
|
-
Math.floor(a/1E3)},
|
|
6
|
-
Number(b[2]);return isFinite(b)?{start:a,end:b}:null},
|
|
7
|
-
b?a.subarray(0,b):a).toString()},
|
|
8
|
-
a=c=a.f[c];b-=c.ne;c=a.startTime+b*a.duration;return{startTime:c,endTime:b===a.count-1&&null!=a.Bd?a.Bd:c+a.duration,kj:a.jj+b*a.ij}},
|
|
1
|
+
import {clpp} from "./cl.core.js";import './cl.mse.js';let g={};const _ = clpp._;var f=function(window){'use strict';var rM="\x3cms:pro/\x3e lacks content",sM="BaseURL",tM="Channel parsing failure! Ignoring scheme and value",uM="ContentProtection",vM="Empty period duration.",wM="EssentialProperty",xM="Failed to parse UTCTiming tags.",yM="Location",zM="Missing \x3cms:pro/\x3e node in ContentProtection element",AM="No UTCTiming elements found.",BM="SegmentBase does not contain sufficient segment information:",CM="SegmentList does not contain sufficient segment information:",DM="SegmentTemplate does not contain sufficient segment information:",
|
|
2
|
+
EM="SegmentTimeline",FM="Source is empty. Skipping fit.",GM='The last "S" element cannot have a negative repeat',HM="application",IM="duration",JM="http://dashif.org/guidelines/trickmode",KM="http://www.w3.org/1999/xlink",LM='ignoring the last "S" element.',MM='ignoring the remaining "S" elements.',NM="parse.xml",OM="presentationTimeOffset",PM="schemeIdUri",QM="static",RM="timescale",SM="urn:microsoft:playready",TM="urn:mpeg:cenc:2013",UM="urn:mpeg:dash:utc:http-head:2014",VM="urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95",
|
|
3
|
+
WM="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed",XM=function(a,b){return _.Ng[a]=b},YM=function(a,b,c){try{const d=a(b);if(d&&d.V&&d.abort)return c.resolve(d.V),()=>d.abort();c.resolve(d);return()=>Promise.resolve(d).then(()=>{}).catch(()=>{})}catch(d){return c.reject(d),()=>Promise.resolve()}},ZM=function(a,b,c){const d=new _.xk;let e=()=>{d.reject(new _.J(_.C,7,7001));return a.abort()};a.V.then(f=>{a.a?d.reject(new _.J(_.C,7,7001)):b?e=YM(b,f,d):d.resolve(f)},f=>{c?e=YM(c,f,d):d.reject(f)});return new _.kp(d,
|
|
4
|
+
()=>e())},$M=function(a,b){return a.reduce(((c,d,e)=>d.catch(c.bind(null,e))).bind(null,b),Promise.reject())},aN=function(a){return a===_.q||a===_.t},bN=function(a){return new _.kp(Promise.reject(a),()=>Promise.resolve())},cN=function(a){return new _.kp(Promise.all(a.map(b=>b.V)),()=>Promise.all(a.map(b=>b.abort())))},dN=function(a){return 1>=a?0:Math.floor(Math.random()*a)},eN=function(a){if(!a)return null;/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(a)&&(a+="Z");a=Date.parse(a);return isNaN(a)?null:
|
|
5
|
+
Math.floor(a/1E3)},fN=function(a){if(!a)return null;const b=/^P(?:([0-9]*)Y)?(?:([0-9]*)M)?(?:([0-9]*)D)?(?:T(?:([0-9]*)H)?(?:([0-9]*)M)?(?:([0-9.]*)S)?)?$/.exec(a);if(!b)return _.A("Invalid duration string:",a),null;a=31536E3*Number(b[1]||null)+2592E3*Number(b[2]||null)+86400*Number(b[3]||null)+3600*Number(b[4]||null)+60*Number(b[5]||null)+Number(b[6]||null);return isFinite(a)?a:null},gN=function(a){var b=/([0-9]+)-([0-9]+)/.exec(a);if(!b)return null;a=Number(b[1]);if(!isFinite(a))return null;b=
|
|
6
|
+
Number(b[2]);return isFinite(b)?{start:a,end:b}:null},hN=function(a){a=Number(a);return 0===a%1?a:null},iN=function(a){a=Number(a);return 0===a%1&&0<a?a:null},jN=function(a){a=Number(a);return 0===a%1&&0<=a?a:null},kN=function(a){let b;a=(b=a.match(/^(\d+)\/(\d+)$/))?Number(b[1])/Number(b[2]):Number(a);return isNaN(a)?null:a},lN=function(a){return a?"true"===a.toLowerCase():!1},mN=function(a){var b=void 0===b?1024:b;if(!(a instanceof Uint8Array))return"";if(typeof b!==_.r||0>=b)b=1024;return(a.byteLength>
|
|
7
|
+
b?a.subarray(0,b):a).toString()},nN=function(a,b){b-=a.l;return 0>b||b>=a.j?null:b},oN=function(a){let b=0;for(const c of a)!(0>=c.count)&&c.duration>b&&(b=c.duration);return b},pN=function(a,b){if(0>b||b>=a.a)throw new _.wj(`SegmentTimelineIndex: out of bounds: ${b}/${a.a}`);a:{var c=0;let d=a.f.length-1;for(;c<=d;){const e=Math.floor((c+d)/2),f=a.f[e],g=f.ne+f.count-1;if(b<f.ne)d=e-1;else if(b>g)c=e+1;else{c=e;break a}}c=-1}if(0>c)throw new _.wj(`SegmentTimelineIndex: index not found: ${b}/${a.a}`);
|
|
8
|
+
a=c=a.f[c];b-=c.ne;c=a.startTime+b*a.duration;return{startTime:c,endTime:b===a.count-1&&null!=a.Bd?a.Bd:c+a.duration,kj:a.jj+b*a.ij}},qN=function(a,b){if(0===a.a)return null;if(b<a.j)return 0;var c=a.f[a.f.length-1];if(b>=(null!=c.Bd?c.Bd:c.startTime+c.count*c.duration))return null;{c=0;let d=a.f.length-1,e=0;for(;c<=d;){const f=Math.floor((c+d)/2);b<a.f[f].startTime?d=f-1:(e=f,c=f+1)}c=e}a=a.f[c];b=Math.floor((b-a.startTime)/a.duration);0>b?b=0:b>=a.count&&(b=a.count-1);return a.ne+b},rN=function(a,
|
|
9
9
|
b,c,d,e){const f={RepresentationID:b,Number:c,Bandwidth:d,Time:e};return a.replace(/\$(RepresentationID|Number|Bandwidth|Time)?(?:%0([0-9]+)([diouxX]))?\$/g,(g,h,k,l)=>{if("$$"===g)return"$";let m=f[h];if(null==m)return _.A("URL template does not have an available substitution ","for identifier",'"'+h+'":',a),g;"RepresentationID"===h&&k&&(_.A("URL template should not contain a width specifier for identifier",'"RepresentationID":',a),k=void 0);"Time"===h&&(m=Math.round(m));switch(l){case void 0:case "d":case "i":case "u":g=
|
|
10
|
-
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})},
|
|
11
|
-
`value will be ignored. (Period ID: ${a.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
d.getAttribute(c)).reduce((d,e)=>d||e)},
|
|
15
|
-
g.De(a);g.ue(m,a);g.te(m,a);return
|
|
16
|
-
0,b.
|
|
17
|
-
c[0];a=_.E(a);_.sh('Invalid box type. Expected "sidx", but received:',a,"from:",g,"byte range:",f);throw new _.J(_.C,3,3004,{url:g,yj:f,size:a.byteLength,Oj:
|
|
18
|
-
31;l&=2147483647;const n=_.P(d.reader);d.reader.skip(4);if(1===m)throw _.sh("Hierarchical SIDXs are not supported."),new _.J(_.C,3,3006);e.push(new _.
|
|
19
|
-
256*c+b[d];b=c;c=
|
|
20
|
-
a.a.getUint8(0)&224)throw new _.J(_.C,3,3001);let b=0;for(let c=0;c<a.a.byteLength;c++){const d=a.a.getUint8(c);b=256*b+d}return b},
|
|
21
|
-
new _.J(_.C,3,3013);a=
|
|
22
|
-
|
|
23
|
-
adjustSegmentDurations:function(p,u){return n.h(p,u)},getDuration:function(){return null!=m?m:n.getDuration()},getLastSegmentEndTime:()=>m}},
|
|
24
|
-
c=f;f=d.startTime+e;d=d.endTime+e+c;e=
|
|
25
|
-
b-c.endTime)):a.g.warn(
|
|
26
|
-
b.o())a.g.warn("Source is empty. Skipping update.");else{var c=()=>{a.a=b;a.l=b.w();a.h=[];a.j=null};0===a.a.o()&&c();var d=
|
|
27
|
-
a.
|
|
28
|
-
e)},getSegmentReference:function(p){const u=p+f;if(null!==g&&u>g)return null;const x=p*e;let y=x+e;d&&(y=Math.min(y,d));if(0>y||d&&x>=d)return null;const B=()=>
|
|
29
|
-
"SegmentURL")).reduce((b,c)=>0<b.length?b:c).map(b=>{b.getAttribute("indexRange")&&!a.Ye&&(a.Ye=!0,_.A("We do not support the SegmentURL@indexRange attribute on SegmentList. We only use the SegmentList@duration attribute or SegmentTimeline, which must be accurate."));const c=b.getAttribute("media");b=_.
|
|
30
|
-
!c.length&&d&&(a.g.info("No UTCTiming elements found, falling back on clockSyncUri from config to synchronize clocks."),c.push({scheme:
|
|
10
|
+
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})},vN=function(a,b){var c=sN(a,b,RM);let d=1;c&&(d=iN(c)||1);c=sN(a,b,IM);(c=iN(c||""))&&(c/=d);let e=Number(sN(a,b,OM))||0,f=e/d||0;a.ki&&null!=a.Pd&&a.Pd!==f&&(_.A("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 "+
|
|
11
|
+
`value will be ignored. (Period ID: ${a.Ma.id}, `+`Representation ID: ${a.O.id})`),e=a.Pd*d,f=a.Pd);var g=sN(a,b,"startNumber");let h=jN(g||"");if(null==g||null==h)h=1;g=sN(a,b,"endNumber");g=null!==g?jN(g||""):null;var k=tN(a,b,EM),l=null;if(k){{l=d;var m=e,n=a.$a.duration||Infinity;const y=_.Gn;k=y.a(k,"S");const B=[];var p=0;let F=0;for(let G=0;G<k.length;++G){const D=k[G];var u=y.aa(D,"t",jN);const ka=y.aa(D,"d",jN);var x=y.aa(D,"r",hN);null!=u&&(u-=m);if(!ka){_.A('"S" element must have a duration:',
|
|
12
|
+
MM,D);break}u=null!=u?u:p;x=x||0;if(0>x)if(G+1<k.length){x=y.aa(k[G+1],"t",jN);if(null==x){_.A('An "S" element cannot have a negative repeat','if the next "S" element does not have a valid start time:',MM,D);break}else if(u>=x){_.A('An "S" element cannot have a negative repeat if its start ','time exceeds the next "S" element\'s start time:',MM,D);break}x=Math.ceil((x-u)/ka)-1}else{if(Infinity===n){_.A(GM,"if the Period has an infinite duration:",LM,D);break}else if(u/l>=n){_.A(GM,"if its start time exceeds the Period's duration:",
|
|
13
|
+
LM,D);break}x=Math.ceil((n*l-u)/ka)-1}0<B.length&&u!==p&&(Math.abs((u-p)/l)>=_.nu&&_.A("SegmentTimeline contains a large gap/overlap:","the content may have errors in it.",D),B[B.length-1].Bd=u/l);p=x+1;B.push({ne:F,count:p,startTime:u/l,duration:ka/l,jj:u,ij:ka,Bd:null});F+=p;p=u+p*ka}l=new uN(B)}}a=sN(a,b,"availabilityTimeOffset");b=Number(a||"");b=isNaN(b)?null:b;if(null==a||null==b)b=0;return{timescale:d,ab:c,Nc:h,Ve:g,Ub:f,Jf:e,wa:l,Oe:b}},sN=function(a,b,c){return[b(a.O),b(a.xa),b(a.Ma)].filter(_.vj).map(d=>
|
|
14
|
+
d.getAttribute(c)).reduce((d,e)=>d||e)},tN=function(a,b,c){return[b(a.O),b(a.xa),b(a.Ma)].filter(_.vj).map(d=>_.Gn.h(d,c)).reduce((d,e)=>d||e)},xN=function(a,b,c,d,e,f){const g=_.Gn,h=g.getAttributeNS(a,KM,"href"),k=g.getAttributeNS(a,KM,"actuate")||"onRequest";g.Ee(a,KM);if(5<=f)return bN(new _.J(_.C,4,4028));if("onLoad"!==k)return bN(new _.J(_.C,4,4027));const l=_.xB([d],[h]);d=_.fk(l,b);d.type=1;return ZM(e.fetch(d),m=>{m=_.wi(m.data);m=g.j(m,a.tagName);if(!m)return bN(new _.J(_.C,4,4001,{uri:h}));
|
|
15
|
+
g.De(a);g.ue(m,a);g.te(m,a);return wN(a,b,c,l[0],e,f+1)})},wN=function(a,b,c,d,e,f){f=void 0===f?0:f;var g=_.Gn;if(g.getAttributeNS(a,KM,"href"))return g=xN(a,b,c,d,e,f),c&&(g=ZM(g,void 0,()=>wN(a,b,c,d,e,f))),g;const h=[],k=g.pe(a);for(const l of k)"urn:mpeg:dash:resolve-to-zero:2013"===g.getAttributeNS(l,KM,"href")?g.removeChild(a,l):l.tagName!==EM&&h.push(wN(l,b,c,d,e,f));return ZM(cN(h),()=>a)},yN=function(a,b){const c=a.$a.start;var d=a.presentationTimeline;d.o||(d.I=Math.floor(Math.max(d.I||
|
|
16
|
+
0,b.bc+c)));a.zg||_.sC(a.presentationTimeline,{oc:b.oc+c,bc:b.bc+c,cc:b.cc},"notifySegmentSummary")},zN=function(a){return""===a.id?`${a.schemeIdUri}:${a.startTime}:${a.endTime}`:a.id},AN=function(a,b,c,d,e){return _.v(function*(){const f=_.gC(a,b,c,e);f.type=2;return(yield _.hl(d,f,{objectType:"i"}).V).data})},BN=function(a,b){b-=a.h;return 0>b||b>=a.f?null:b},DN=function(a,b,c,d){let e;var f=(new _.Wm).fa("sidx",g=>{e=CN(b,d,c,g)});a&&f.parse(a);if(e)return e;{f=`${b}-${b+a.byteLength-1}`;const g=
|
|
17
|
+
c[0];a=_.E(a);_.sh('Invalid box type. Expected "sidx", but received:',a,"from:",g,"byte range:",f);throw new _.J(_.C,3,3004,{url:g,yj:f,size:a.byteLength,Oj:mN(a)});}},CN=function(a,b,c,d){const e=[];d.reader.skip(4);const f=_.P(d.reader);if(0===f)throw _.sh("Invalid timescale."),new _.J(_.C,3,3005);if(0===d.version){var g=_.P(d.reader);var h=_.P(d.reader)}else g=_.Hm(d.reader),h=_.Hm(d.reader);d.reader.skip(2);const k=_.Fm(d.reader);a=a+d.size+h;for(h=0;h<k;h++){var l=_.P(d.reader);const m=(l&2147483648)>>>
|
|
18
|
+
31;l&=2147483647;const n=_.P(d.reader);d.reader.skip(4);if(1===m)throw _.sh("Hierarchical SIDXs are not supported."),new _.J(_.C,3,3006);e.push(new _.CI(e.length,g/f-b,(g+n)/f-b,()=>c,a,a+l-1,b));g+=n;a+=l}d.parser.stop();return e},EN=function(a){var b=_.Em(a.a);let c;for(c=1;8>=c&&!(b&1<<8-c);c++);if(8<c)throw new _.J(_.C,3,3002);const d=new Uint8Array(c);d[0]=b;for(b=1;b<c;b++)d[b]=_.Em(a.a);return d},HN=function(a){var b=EN(a);if(7<b.length)throw new _.J(_.C,3,3002);var c=0;for(var d=0;d<b.length;d++)c=
|
|
19
|
+
256*c+b[d];b=c;c=EN(a);a:{for(e of FN)if(_.Sk(c,new Uint8Array(e))){var e=!0;break a}e=!1}if(e)c=a.f.byteLength-a.a.getPosition();else{if(8===c.length&&c[1]&224)throw new _.J(_.C,3,3001);e=c[0]&(1<<8-c.length)-1;for(d=1;d<c.length;d++)e=256*e+c[d];c=e}c=a.a.getPosition()+c<=a.f.byteLength?c:a.f.byteLength-a.a.getPosition();e=new DataView(a.f.buffer,a.f.byteOffset+a.a.getPosition(),c);a.a.skip(c);return new GN(b,e)},IN=function(a){if(8<a.a.byteLength)throw new _.J(_.C,3,3002);if(8===a.a.byteLength&&
|
|
20
|
+
a.a.getUint8(0)&224)throw new _.J(_.C,3,3001);let b=0;for(let c=0;c<a.a.byteLength;c++){const d=a.a.getUint8(c);b=256*b+d}return b},LN=function(a,b,c,d,e,f){const g=[],h=()=>e;a=new JN(a.a);let k=null,l=null;for(;_.Cm(a.a);){var m=HN(a);if(187===m.id){var n=KN(m);n&&(m=c*n.lj,n=b+n.Mi,null!=k&&g.push(new _.CI(g.length,k-f,m-f,h,l,n-1,f)),k=m,l=n)}}null!=k&&g.push(new _.CI(g.length,k-f,d-f,h,l,null,f));return g},KN=function(a){var b=new JN(a.a);a=HN(b);if(179!==a.id)throw _.A("Not a CueTime element."),
|
|
21
|
+
new _.J(_.C,3,3013);a=IN(a);b=HN(b);if(183!==b.id)throw _.A("Not a CueTrackPositions element."),new _.J(_.C,3,3012);b=new JN(b.a);let c=0;for(;_.Cm(b.a);){const d=HN(b);if(241===d.id){c=IN(d);break}}return{lj:a,Mi:c}},MN=function(a,b){var c=tN(a,b,"Initialization");if(!c)return null;let d=a.O.qa;b=()=>"";const e=c.getAttribute("sourceURL")||void 0;e&&(d=_.xB(a.O.qa,[e]),b=()=>e);let f=0,g=null;if(c=_.Gn.aa(c,"range",gN))f=c.start,g=c.end;return new _.BI(()=>d,f,g,null,null,b,a.O.Ia)},NN=function(a){return a.Wd},
|
|
22
|
+
PN=function(a,b,c,d,e,f,g){const h=a.presentationTimeline,k=!a.Ue||!a.$a.ii,l=a.$a.start,m=a.$a.duration;let n=null;return{createSegmentIndex:function(p,u){return _.v(function*(){var x=[AN(c,d,e,p,u),"webm"===f?AN(b.Da(),b.na,b.ka,p,u):null];x=yield Promise.all(x);var y=x[0];const B=x[1]||null;y="mp4"===f?DN(y,d,c,g):(new ON).parse(y,B,c,g);aN(a.O.contentType)&&_.tC(h,y,l);n=new _.HI(y);k&&_.cC(n,m);return x})},findSegmentPosition:function(p){return n.f(p)},getSegmentReference:function(p){return n.get(p)},
|
|
23
|
+
adjustSegmentDurations:function(p,u){return n.h(p,u)},getDuration:function(){return null!=m?m:n.getDuration()},getLastSegmentEndTime:()=>m}},QN=function(a){var b=a.a.o();if(0===b)return null;const c=a.a.w();b=c+b-1;a=Math.max(a.l,c);return a>b?null:{Lb:a,$b:b}},RN=function(a,b){var c,d=a.a.B(b);if(!d)throw new _.wj(`Cannot get segment timing for source position ${b}`);if(!(0<a.h.length||null!=a.j))return d;var e=b+a.f;var f=c=0;for(const g of a.h)g.position<e?c+=g.ke:g.position===e&&(f+=g.ke);e=c;
|
|
24
|
+
c=f;f=d.startTime+e;d=d.endTime+e+c;e=QN(a);a.j&&b===e.$b&&(d+=a.j);return{startTime:f,endTime:d}},SN=function(a,b){return(a=QN(a))?b>=a.Lb&&b<=a.$b:!1},TN=function(a){var b=QN(a);if(!b)return null;var c=b.Lb===a.a.w();if(!(0<a.h.length||null!=a.j)&&c)return a.a.C();c=RN(a,b.Lb);b=RN(a,b.$b);return(a=a.a.C())?{oc:c.startTime,bc:b.endTime,cc:a.cc}:null},UN=function(a,b){if(null===b||Infinity===b)a.g.warn(`Period duration is ${b}. Skipping fit.`);else{var c=QN(a);c?(c=a.a.B(c.$b),c.startTime>=b||(a.j=
|
|
25
|
+
b-c.endTime)):a.g.warn(FM)}},VN=function(a,b){var c=QN(a);if(c){var d=c.Lb;c=c.$b;for(var e=c+1;d<=c;d++)if(RN(a,d).endTime>b){e=d;break}a.l=e}else a.g.warn(FM)},WN=function(a,b){const c=a.a.o(),d=b.o();if(0===c||0===d)return null;const e=a.a.w(),f=b.w();let g=0,h=0;for(;g<c&&h<d;){const k=e+g,l=f+h,m=a.a.B(k),n=b.B(l);if(!m||!n)break;const p=Math.abs(m.endTime-n.endTime);if(.1>=Math.abs(m.startTime-n.startTime)||.1>=p)return k-l+a.f;m.startTime<n.startTime?g++:h++}return null},XN=function(a,b){if(0===
|
|
26
|
+
b.o())a.g.warn("Source is empty. Skipping update.");else{var c=()=>{a.a=b;a.l=b.w();a.h=[];a.j=null};0===a.a.o()&&c();var d=WN(a,b);if(null!=d)a.f=d;else throw a.g.error("Segments could not be updated, overlapping position not found."),new _.J(_.C,4,4014);c()}},ZN=function(a,b,c){const d=a.$a.duration;if(!a.Ue)return a=new YN(b),VN(a,0),UN(a,d),a;{var e=a.Ma;const f=a.O;e=e&&e.id&&f&&f.id?`${e.id},${f.id}`:null}if(!a.zg||null==c[e])return a=new YN(b),VN(a,0),UN(a,d),c[e]=a;c=c[e];XN(c,b);VN(c,_.wC(a.presentationTimeline)-
|
|
27
|
+
a.$a.start);UN(c,d);return c},aO=function(a){const b=sN(a,$N,"initialization");if(!b)return null;const c=a.O.id,d=a.bandwidth||null,e=a.O.qa,f=()=>rN(b,c,null,d,null);return new _.BI(function(){const g=f();return _.xB(e,[g])},0,null,null,null,f,a.O.Ia)},bO=function(a,b){const c=b.bf,d=a.$a.duration,e=b.ab,f=b.Nc,g=b.Ve,h=b.timescale,k=a.bandwidth||null,l=a.O.id,m=a.O.qa,n=a.O.Ia;return{createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:function(p){return 0>p||d&&p>=d?null:Math.floor(p/
|
|
28
|
+
e)},getSegmentReference:function(p){const u=p+f;if(null!==g&&u>g)return null;const x=p*e;let y=x+e;d&&(y=Math.min(y,d));if(0>y||d&&x>=d)return null;const B=()=>rN(c,l,u,k,x*h);return new _.CI(p,x,y,function(){const F=B();return _.xB(m,[F])},0,null,b.Ub,null,null,null,null,null,null,null,null,B,n)},adjustSegmentDurations:()=>{},getDuration:()=>d,getLastSegmentEndTime:()=>d}},$N=function(a){return a.tc},cO=function(a){return a.sc},dO=function(a){return[a.O.sc,a.xa.sc,a.Ma.sc].filter(_.vj).map(b=>_.Gn.a(b,
|
|
29
|
+
"SegmentURL")).reduce((b,c)=>0<b.length?b:c).map(b=>{b.getAttribute("indexRange")&&!a.Ye&&(a.Ye=!0,_.A("We do not support the SegmentURL@indexRange attribute on SegmentList. We only use the SegmentList@duration attribute or SegmentTimeline, which must be accurate."));const c=b.getAttribute("media");b=_.Gn.aa(b,"mediaRange",gN,{start:0,end:null});return{Bg:c,start:b.start,end:b.end}})},fO=function(a,b,c){c=c.map(e=>({scheme:e.getAttribute(PM),value:e.getAttribute(_.lg)}));const d=a.a.clockSyncUri;
|
|
30
|
+
!c.length&&d&&(a.g.info("No UTCTiming elements found, falling back on clockSyncUri from config to synchronize clocks."),c.push({scheme:UM,value:d}));return 0===c.length?(a.g.warn(AM),Promise.reject(Error(AM))):$M(c,e=>{const f=e.scheme;e=e.value;switch(f){case UM:case "urn:mpeg:dash:utc:http-head:2012":return eO(a,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 eO(a,
|
|
31
31
|
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"),Promise.reject();default:return a.g.warn("Unrecognized scheme in UTCTiming element",f),Promise.reject()}}).catch(()=>
|
|
32
|
-
{a.g.warn(
|
|
33
|
-
"expected date header"),Error("Date HTTP header missing.");e=e.headers.date}else e=_.
|
|
34
|
-
initDataType:_.Vc,keyId:null}]}},
|
|
35
|
-
return a.version!==b&&(_.rh(`Parsing from ${a.version} to ${b}.`),a=_.
|
|
36
|
-
m.
|
|
37
|
-
e.licenseUrl,b.licenseServerUriOrigin=e.origin):b.licenseServerUri="";d.push(b)}}return d},
|
|
38
|
-
b.
|
|
39
|
-
e.map(h=>({initDataType:_.Vc,initData:_.
|
|
40
|
-
${b.length}`;const d=[];a.forEach(e=>{const f=e.getAttribute("serviceLocation");e=_.
|
|
41
|
-
{d.audio&&b.add(d.audio);d.video&&b.add(d.video)})});return Array.from(b)},
|
|
42
|
-
if(a.w&&b){0!==e.request.uriIndex&&a.w.banLocation(b.qa[0].serviceLocationId);var g=e.request,h=e.timeMs;e=e.data.byteLength;h&&e&&a.w.notifyThroughput(b.qa[g.uriIndex].serviceLocationId,h,e)}b=(Date.now()-c)/1E3;_.
|
|
43
|
-
_.
|
|
44
|
-
a.l=-1,a.B.stop());g=d.aa(b,"maxSegmentDuration",
|
|
45
|
-
!!a.a.lowLatencyMode);m=h?m:
|
|
46
|
-
l[0].startTime;if(null==h||Infinity===h)h=
|
|
47
|
-
(a.f.contentSteering=g,a.f.contentSteering.baseUriCollections=e)}a.f.cues=k.cues;a.C=f;return{manifest:a.f,hj:d}})},
|
|
48
|
-
n);null==y&&(y=p);n=
|
|
49
|
-
"all Periods."),{periods:l,duration:g,hg:!1,cues:k}):{periods:l,duration:m,hg:!0,cues:k}},
|
|
50
|
-
_.ha).map(B=>
|
|
51
|
-
p,u,l);u=[...
|
|
52
|
-
{contentType:"",mimeType:"",codecs:"",emsgSchemeIdUris:[],frameRate:void 0,cf:null,
|
|
53
|
-
h),
|
|
54
|
-
m=d+m/h;null!=c&&(d=Math.min(d,b+c),m=Math.min(m,b+c));let p=_.fg;f.startsWith(_.hg)?p=_.
|
|
55
|
-
b,c){var d=_.
|
|
56
|
-
|
|
57
|
-
c.drmInfos)){var e=_.
|
|
58
|
-
|
|
59
|
-
let e=void 0;b&&(e=_.
|
|
60
|
-
b===
|
|
61
|
-
b.O=
|
|
62
|
-
return{id:_.
|
|
63
|
-
keyId:a,language:n,originalLanguage:e,label:f,type:b.xa.contentType,primary:g,trickModeVideo:null,emsgSchemeIdUris:b.O.emsgSchemeIdUris,roles:h,channelsCount:b.O.cf,spatialAudio:u,closedCaptions:k,horizontalTiles:l.horizontalTiles,verticalTiles:l.verticalTiles,durationPerTile:l.durationPerTile}},
|
|
64
|
-
b;return a},
|
|
65
|
-
b),b.Wd?(a.g.info("Using SegmentBase by default."),b.
|
|
66
|
-
"the SegmentBase uses a WebM container,","but does not contain an Initialization element.",b.O),new _.J(_.C,4,4005);const ka=
|
|
67
|
-
d,Xa,Hb.start,Hb.end,D,g)}var k={createSegmentIndex:h.createSegmentIndex,findSegmentPosition:h.findSegmentPosition,getSegmentReference:h.getSegmentReference,adjustSegmentDurations:h.adjustSegmentDurations,getDuration:h.getDuration,initSegmentReference:f,getLastSegmentEndTime:h.getLastSegmentEndTime,
|
|
68
|
-
var m={
|
|
69
|
-
b.O),new _.J(_.C,4,4002);{let ka=m.Lc.length;m.wa&&m.wa.a!==m.Lc.length&&(ka=Math.min(m.wa.a,m.Lc.length),_.A("The number of items in the segment timeline and the number of","segment URLs do not match, truncating",m.Lc.length,"to",ka));var n=ka}const G=new
|
|
70
|
-
adjustSegmentDurations:D.adjustSegmentDurations.bind(D),getDuration:D.getDuration.bind(D),initSegmentReference:F,getLastSegmentEndTime:D.getLastSegmentEndTime.bind(D),
|
|
71
|
-
"a SegmentTimeline, or a segment duration.",b.O),new _.J(_.C,4,4002);1!==D&&(_.A("SegmentTemplate contains multiple segment information sources:","the SegmentTemplate should only contain an index URL template,","a SegmentTimeline or a segment duration.",b.O),e.Md?(_.qh("Using the index URL template by default."),e.wa=null):_.qh("Using the SegmentTimeline by default."),e
|
|
72
|
-
|
|
73
|
-
G){b.presentationTimeline.B=null;var x=b.presentationTimeline;x.G=Math.max(x.G,e.Oe);x.g.debug("notifyAvailabilityTimeOffset: maxAvailabilityTimeOffset\x3d"+x.G);_.
|
|
74
|
-
adjustSegmentDurations:D.adjustSegmentDurations.bind(D),getDuration:D.getDuration.bind(D),getLastSegmentEndTime:D.getLastSegmentEndTime.bind(D)}}g={createSegmentIndex:h.createSegmentIndex,findSegmentPosition:h.findSegmentPosition,getSegmentReference:h.getSegmentReference,adjustSegmentDurations:h.adjustSegmentDurations,getDuration:h.getDuration,initSegmentReference:F,getLastSegmentEndTime:h.getLastSegmentEndTime,
|
|
75
|
-
F),null;throw F;}},
|
|
76
|
-
1!==e?null:new _.
|
|
77
|
-
case "urn:mpeg:dash:23003:3:audio_channel_configuration:2011":case "urn:dts:dash:audio_channel_configuration:2012":var c=parseInt(e,10);if(!c){a.g.warn(
|
|
78
|
-
_.
|
|
79
|
-
_.
|
|
80
|
-
_.
|
|
81
|
-
_.
|
|
82
|
-
_.
|
|
83
|
-
this.j?a<this.a?this.l:null!=this.h?(a=this.l+Math.floor((a-this.a)/this.h),a>this.l+this.j-1?null:a):this.f?(a=
|
|
84
|
-
this.j?null!=this.h?{
|
|
85
|
-
e=()=>
|
|
86
|
-
f.a.byteLength)f=f.a.getFloat32(0);else if(8===f.a.byteLength)f=f.a.getFloat64(0);else throw new _.J(_.C,3,3003);}if(null==f)throw new _.J(_.C,3,3011);e=g/=1E9;f*=g;a=
|
|
87
|
-
this.f;if(!
|
|
88
|
-
const b=
|
|
89
|
-
function(a){var b=_.
|
|
90
|
-
this;return _.v(function*(){c.o=[a];c.D=b;const d=yield
|
|
91
|
-
c.severity===_.C))return}a.D&&(a.K?yield a.stop():
|
|
32
|
+
{a.g.warn(xM);return Promise.reject(Error(xM))})},gO=function(a,b,c,d){return _.v(function*(){const e=_.Gn.a(b,"UTCTiming");try{const f=yield fO(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})},eO=function(a,b,c,d){return _.v(function*(){var e=_.xB(b,[c]);e=yield a.f(e,d);if("HEAD"===d){if(!e.headers||!e.headers.date)throw a.g.warn("UTC timing response is missing",
|
|
33
|
+
"expected date header"),Error("Date HTTP header missing.");e=e.headers.date}else e=_.wi(e.data);e=Date.parse(e);if(isNaN(e))throw a.g.warn("Unable to parse date from UTC timing response"),Error("Date value invalid.");return e-Date.now()})},iO=function(a,b){return a.find(c=>hO.get(c.fc)===b)},kO=function(a){const b=_.Gn;var c=b.Xb(a.node,SM,"pro");if(!c)return jO.warn(zM,a),null;c=b.f(c);if(!c)return jO.warn(rM,a),null;a=_.Pk(c);a=_.Ln(a);a=_.Cn(a.a);return{keyId:null,fc:WM,node:b.Sc(),init:[{initData:_.lB(a),
|
|
34
|
+
initDataType:_.Vc,keyId:null}]}},lO=function(a,b){b=void 0===b?"4.0.0.0":b;const c=_.Gn;a=c.Xb(a.node,TM,"pssh");if(!a)return null;a=c.f(a);if(!a)return null;a=_.Pk(a);a=_.En(a);return a?(b=_.mB(b,a.a))?{keyId:null,fc:VM,node:c.Sc(),init:[{initData:_.lB(b),initDataType:_.Vc,keyId:null}]}:null:(_.A("Unable to parse WV PSSH data. Can not create PR data!"),null)},mO=function(a,b){const c=_.Gn;var d=c.Xb(a.node,SM,"pro");if(!d)return _.A(zM,a),null;d=c.f(d);if(!d)return _.A(rM,a),null;a=_.Pk(d);a=_.Ln(a);
|
|
35
|
+
return a.version!==b&&(_.rh(`Parsing from ${a.version} to ${b}.`),a=_.nB(a,b))?{keyId:null,fc:VM,node:c.Sc(),init:[{initData:_.lB(a),initDataType:_.Vc,keyId:null}]}:null},pO=function(a,b,c,d){const e=nO(a);let f=null;a=[];let g=[];const h=iO(e,_.td),k=iO(e,_.rd);if(k&&d){var l=mO(k,d);l&&(e[e.indexOf(k)]=l)}k&&!h&&(l=kO(k))&&e.push(l);h&&!k&&(d=lO(h,d||void 0))&&e.push(d);d=new Set(e.map(m=>m.keyId));d.delete(null);if(1<d.size)throw new _.J(_.C,4,4010);b||(g=e.filter(m=>"urn:mpeg:dash:mp4protection:2011"===
|
|
36
|
+
m.fc?(f=m.init||f,!1):!0),g.length&&(a=oO(f,g,c),0===a.length&&(a=[_.yB(_.Be,f,c)])));if(e.length&&(b||!g.length)){a=[];for(const m of hO.values())m!==_.Le&&a.push(_.yB(m,f,c))}if(b=Array.from(d)[0]||null)for(const m of a)for(const n of m.initData)n.keyId=b;return{xd:b,Bj:f,drmInfos:a,kg:!0}},nO=function(a){const b=[];for(const c of a)(a=qO(c))&&b.push(a);return b},oO=function(a,b,c){const d=[];for(const f of b){var e=hO.get(f.fc);if(e){b=_.yB(e,f.init||a,c);if(e=rO.get(e))(e=e(f))?(b.licenseServerUri=
|
|
37
|
+
e.licenseUrl,b.licenseServerUriOrigin=e.origin):b.licenseServerUri="";d.push(b)}}return d},sO=function(a,b,c,d,e){const f=pO(a,c,d,e);if(b.kg){a=1===b.drmInfos.length&&!b.drmInfos[0].keySystem;c=0===f.drmInfos.length;if(0===b.drmInfos.length||a&&!c)b.drmInfos=f.drmInfos;b.xd=f.xd||b.xd;b.kg=!1}else if(0<f.drmInfos.length&&(b.drmInfos=b.drmInfos.filter(g=>f.drmInfos.some(h=>h.keySystem===g.keySystem)),0===b.drmInfos.length))throw new _.J(_.C,4,4008);return f.xd||b.xd},tO=function(a){const b=_.Gn;a=
|
|
38
|
+
b.Dc(a.node,"https://dashif.org/CPS","Laurl").map(c=>b.f(c)).filter(Boolean);return 0===a.length?null:1===a.length?a[0]:a[dN(a.length)]},qO=function(a){const b=_.Gn;let c=a.getAttribute(PM),d=b.getAttributeNS(a,TM,"default_KID");const e=b.Dc(a,TM,"pssh").map(b.f),f=b.Xb(a,SM,"pro");if(!c)return _.sh("Missing required schemeIdUri attribute on","ContentProtection element",a),null;c=c.toLowerCase();if(d&&(d=d.replace(/-/g,"").toLowerCase(),d.includes(" ")))throw new _.J(_.C,4,4009);let g=[];try{if(g=
|
|
39
|
+
e.map(h=>({initDataType:_.Vc,initData:_.Pk(h),keyId:null})),0===g.length&&f&&b.f(f))try{const h=b.f(f),k=_.Pk(h),l=_.Ln(k);g.push({initDataType:_.Vc,initData:_.lB(l),keyId:null})}catch(h){_.A("Unable to parse ms:pro payload",h),g=[]}}catch(h){throw new _.J(_.C,4,4007);}return{node:a,fc:c,keyId:d,init:0<g.length?g:null}},uO=function(a,b,c){if(a.length){c=c||`${"__clpp_baseUriCollection_"}
|
|
40
|
+
${b.length}`;const d=[];a.forEach(e=>{const f=e.getAttribute("serviceLocation");e=_.Gn.f(e);f&&e&&d.push({serviceLocationId:f,uri:e,params:{}})});if(d.length)return a=new _.LI(c,d),b.push(a),a}return null},wO=function(a,b){a=vO(a).filter(c=>c.getLastSegmentEndTime).map(c=>c.getLastSegmentEndTime());0<a.length&&(a=Math.min(...a),_.rC(b.presentationTimeline,a+b.$a.start))},xO=function(a,b){return _.hC(_.Kl(a,b))?_.I:a.split("/")[0]},vO=function(a){const b=new Set;a.forEach(c=>{c.variants.forEach(d=>
|
|
41
|
+
{d.audio&&b.add(d.audio);d.video&&b.add(d.video)})});return Array.from(b)},zO=function(a){return _.v(function*(){var b=a.w?a.w.getBaseUriCollectionById(yM):null;var c=[];b&&(c=_.aD(b,""));0===c.length&&(c=a.o);var d=_.fk(c,a.a.attemptParameters);d.type=1;c=Date.now();d=a.D.networkingEngine.fetch(d);_.wk(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 yO(a,e.data,e.uri);f.manifest.contentSteering&&(a.w=yield a.D.onContentSteeringInfoFound(f.manifest.contentSteering));
|
|
42
|
+
if(a.w&&b){0!==e.request.uriIndex&&a.w.banLocation(b.qa[0].serviceLocationId);var g=e.request,h=e.timeMs;e=e.data.byteLength;h&&e&&a.w.notifyThroughput(b.qa[g.uriIndex].serviceLocationId,h,e)}b=(Date.now()-c)/1E3;_.eC(a.I,1,b);if(d&&a.D.onUpdate)a.D.onUpdate(f.manifest);if(f.hj){if(a.D.onTurnedStatic)a.D.onTurnedStatic();a.D.onEvent(new _.H(_.ve))}return b})},AO=function(a,b){0>a.l||a.B.la(Math.max(3,a.l-b,_.fC(a.I)))},yO=function(a,b,c){return _.v(function*(){var d=_.wi(b);_.Nn(NM);d=_.Gn.j(d,"MPD");
|
|
43
|
+
_.Nn("parse.xml.end");_.Pn(NM,NM,"parse.xml.end");if(!d)throw new _.J(_.C,4,4001,c);d=wN(d,a.a.attemptParameters,a.a.xlinkFailGracefully,c,a.D.networkingEngine);_.wk(a.A,d);d=yield d.V;return BO(a,d,c)})},BO=function(a,b,c){return _.v(function*(){var d=_.Gn;const e=[];var f=[c],g=d.a(b,yM),h=g.map(d.f).filter(_.vj);0<h.length&&(f=_.xB(f,h),a.o=f,uO(g,e,yM));g=d.a(b,sM);h=g.map(d.f);var k=_.xB(f,h);uO(g,e,sM);f=b.getAttribute("type")||QM;a.l=d.aa(b,"minimumUpdatePeriod",fN,-1);f===QM&&0<=a.l&&(a.g.warn("Invalid manifest - a static manifest should not contain the `minimumUpdatePeriod` attribute. The attribute will be ignored."),
|
|
44
|
+
a.l=-1,a.B.stop());g=d.aa(b,"maxSegmentDuration",fN);if(d=f===QM&&"dynamic"===a.C)a.g.info("MPD dynamic to static transition."),f="dynamic";h=f===QM;var l="dynamic"===f;if(a.f)var m=a.f.presentationTimeline;else{var n=_.Gn;m=a.a.timeline||{};var p=n.aa(b,"suggestedPresentationDelay",fN),u=n.aa(b,"minBufferTime",fN,0);p=null!=a.a.suggestedPresentationDelay?a.a.suggestedPresentationDelay:a.a.lowLatencyMode?0:null!=p?p:3*u;n=n.aa(b,"availabilityStartTime",eN);m=new _.GI(m,n,p,h,!!a.a.autoCorrectDrift,
|
|
45
|
+
!!a.a.lowLatencyMode);m=h?m:gO(a.J,b,k,m)}m=yield m;n=_.Gn.aa(b,"timeShiftBufferDepth",fN);n=l&&a.a.availabilityWindowOverride&&!isNaN(a.a.availabilityWindowOverride)?a.a.availabilityWindowOverride:null===n?Infinity:n;m.A=n;if(!a.D)throw new _.J(_.C,7,7001);n={Ue:l,zg:null!=a.f,presentationTimeline:m,Ma:null,$a:null,xa:null,O:null,bandwidth:0,Ye:!1,ki:d,hc:null,Pd:null};k=CO(a,n,k,e,b);p=k.duration;l=k.periods;d&&(wO(l,n),m.C=!0);if(h||!d&&!k.hg)m.f=p||Infinity;if(2===a.a.timeline.version){h=p;n=
|
|
46
|
+
l[0].startTime;if(null==h||Infinity===h)h=DO(l);p=m.a;_.lC(p,n,n+h);d&&(p.f=!0)}_.uC(m,g||1);m.isLive()||Infinity!==m.f&&!m.o||2===m.j.version&&m.a.getDuration();if(!a.f){a.f={presentationTimeline:m,periods:l,minBufferTime:0,cues:[]};a:{l=_.Gn;if(m=l.h(b,"ContentSteering"))if(g=m.getAttribute("defaultServiceLocation")||"",h=l.f(m)){l=l.aa(m,"queryBeforeStart",lN,!1);g={manifestType:_.tc,contentSteeringServerUri:h,defaultServiceLocation:g,queryBeforeStart:l||!1,baseUriCollections:[]};break a}g=null}g&&
|
|
47
|
+
(a.f.contentSteering=g,a.f.contentSteering.baseUriCollections=e)}a.f.cues=k.cues;a.C=f;return{manifest:a.f,hj:d}})},CO=function(a,b,c,d,e){const f=_.Gn,g=f.aa(e,"mediaPresentationDuration",fN),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 x=0;x<e.length;x++){var n=e[x];m=f.aa(n,_.Kf,fN,m);var p=f.aa(n,IM,fN);let y=null;if(x!==e.length-1){var u=f.aa(e[x+1],_.Kf,fN);null!=u&&(y=u-m)}else null!=g&&(y=g-m);u=_.nu;y&&p&&Math.abs(y-p)>u&&a.g.warn("There is a gap/overlap between Periods",
|
|
48
|
+
n);null==y&&(y=p);n=EO(a,b,c,d,{start:m,duration:y,node:n,ii:null==y||x===e.length-1});p=n.Ma;l.push(p);k=k.concat(n.cues);a.G.includes(p.id)||(a.G.push(p.id),a.f&&(a.D.filterNewPeriod(p),a.f.periods.push(p)));if(null==y){x!==e.length-1&&a.g.warn("Skipping Period",x+1,"and any subsequent Periods:","Period",x+1,"does not have a valid start time.",l[x+1]);m=null;break}m+=y}null==a.f&&a.D.filterAllPeriods(l);h&&(b=l.find(x=>x.id===h.id))&&(h.endTime=b.endTime);k=FO(a,k);return null!=g?(m!==g&&a.g.warn("@mediaPresentationDuration does not match the total duration of ",
|
|
49
|
+
"all Periods."),{periods:l,duration:g,hg:!1,cues:k}):{periods:l,duration:m,hg:!0,cues:k}},DO=function(a){return a.map(b=>b.variants[0].video||b.variants[0].audio).reduce((b,c)=>c?c.getDuration():0+b,0)},EO=function(a,b,c,d,e){var f=_.Gn;b.Ma=GO(a,e.node,null,c,d);b.$a=e;c=b.Ma.id||`__clpp_period_${e.start}`;b.Ma.id||(a.g.info("No Period ID given for Period with start time "+e.start+`, Assigning a default: ${c}.`),b.Ma.id=c);d=f.a(e.node,"EventStream").flatMap(B=>HO(a,e.start,e.duration,B));f=f.a(e.node,
|
|
50
|
+
_.ha).map(B=>IO(a,b,B)).filter(_.vj);if(b.Ue){var g=[];for(var h of f)for(var k of h.Oi)g.push(k);if(g.length!==(new Set(g)).size)throw new _.J(_.C,4,4018);}h=f.filter(B=>!B.Hf);k=f.filter(B=>B.Hf);for(var l of k){l.streams.forEach(B=>{B.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=JO(f,_.t);n=JO(h,_.q);if(!m.length&&!n.length)throw new _.J(_.C,4,4004);n.length||(n=[null]);m.length||(m=[null]);l=[];for(var p of n)for(var u of m)KO(a,
|
|
51
|
+
p,u,l);u=[...JO(h,_.I),...JO(h,_.eB)];p=[];for(var x of u)p.push.apply(p,x.streams);u=JO(h,_.ae);x=[];for(var y of u)x.push.apply(x,y.streams);y=LO(e,h);return{Ma:{id:c,configurationId:a.D.configurationId,startTime:e.start,endTime:y,textStreams:p,thumbStreams:x,variants:l},cues:d}},FO=function(a,b){const c=new Set(b.map(zN));a.j.forEach((d,e)=>{c.has(e)||a.j.delete(e)});b.forEach(d=>{const e=zN(d);a.j.has(e)||a.j.set(e,d)});return Array.from(a.j.values())},GO=function(a,b,c,d,e){const f=_.Gn;c=c||
|
|
52
|
+
{contentType:"",mimeType:"",codecs:"",emsgSchemeIdUris:[],frameRate:void 0,cf:null,Ia:e?e.find(u=>u.id===sM)||null:null};d=d||c.qa;var g=f.a(b,sM);const h=g.map(f.f);e=e?uO(g,e,b.getAttribute("id")||void 0):null;g=b.getAttribute("contentType")||c.contentType;const k=b.getAttribute(_.se)||c.mimeType,l=b.getAttribute(_.md)||c.codecs,m=f.aa(b,"frameRate",kN)||c.frameRate,n=MO(f.a(b,"InbandEventStream"),c.emsgSchemeIdUris),p=f.a(b,"AudioChannelConfiguration");a=NO(a,p)||c.cf;g||(g=xO(k,l));return{qa:_.xB(d,
|
|
53
|
+
h),Ia:e||c.Ia,Wd:f.h(b,"SegmentBase")||c.Wd,sc:f.h(b,"SegmentList")||c.sc,tc:f.h(b,"SegmentTemplate")||c.tc,width:f.aa(b,_.Gg,jN)||c.width,height:f.aa(b,_.Xd,jN)||c.height,contentType:g,mimeType:k,codecs:l,frameRate:m,emsgSchemeIdUris:n,id:b.getAttribute("id")||"",cf:a}},HO=function(a,b,c,d){const e=_.Gn,f=d.getAttribute(PM)||"",g=d.getAttribute(_.lg)||"",h=e.aa(d,RM,jN)||1,k=e.aa(d,OM,jN)||0,l=[];for(const n of e.a(d,"Event")){d=e.aa(n,"presentationTime",jN)||0;var m=e.aa(n,IM,jN)||0;d=b+d/h-k/h;
|
|
54
|
+
m=d+m/h;null!=c&&(d=Math.min(d,b+c),m=Math.min(m,b+c));let p=_.fg;f.startsWith(_.hg)?p=_.cj:"urn:mpeg:dash:event:callback:2015"===f&&(p=_.we);const u={configurationId:a.D.configurationId,schemeIdUri:f,value:g,startTime:d,endTime:m,id:n.getAttribute("id")||"",type:p,eventElement:e.Zd(n)};u.type===_.we&&(u.xe=()=>{if(u.eventElement){var x=u.eventElement.getAttribute("messageData")||"";x&&x.startsWith("http")&&(x=_.fk(x),x.type=_.ek,a.D.networkingEngine.fetch(x))}});l.push(u)}return l},IO=function(a,
|
|
55
|
+
b,c){var d=_.Gn;b.xa=GO(a,c,b.Ma,null,null);var e=b.xa.contentType===_.I;const f=OO(c),{kind:g,Rd:h,roles:k}=PO(c,e);let l=null;try{l=QO(c)}catch(y){return null}const m=d.a(c,"Accessibility"),n=RO(m);var p=d.a(c,uM);const u=pO(p,a.a.ignoreDrmInfo,b.Ma.id,a.a.playreadyVersion||null),x=c.getAttribute("lang")||_.eg;p=_.Uj(x);d=d.a(c,_.kb);c=d.map(y=>SO(a,b,u,g,x,f||"",h,k,n,y)).filter(_.vj);if(0===c.length){if(e)return null;throw new _.J(_.C,4,4003);}if(!b.xa.contentType||b.xa.contentType===HM){b.xa.contentType=
|
|
56
|
+
xO(c[0].mimeType,c[0].codecs);for(const y of c)y.type=b.xa.contentType}for(const y of c)for(const B of u.drmInfos)y.keyId&&!B.keyIds.includes(y.keyId)&&B.keyIds.push(y.keyId);c=TO(c,b.xa.contentType,m);e=d.map(y=>y.getAttribute("id")).filter(_.vj);return{id:b.xa.id||"__fake__"+a.h++,contentType:b.xa.contentType,language:p,originalLanguage:x,Rd:h,streams:c,drmInfos:u.drmInfos,Hf:l,Oi:e}},JO=function(a,b){return a.filter(c=>c.contentType===b)},KO=function(a,b,c,d){if(b||c)if(b&&c){if(_.CB(b.drmInfos,
|
|
57
|
+
c.drmInfos)){var e=_.BB(b.drmInfos,c.drmInfos);for(var f of b.streams)for(const h of c.streams){var g=(h.bandwidth||0)+(f.bandwidth||0);g={id:a.h++,language:b.language,primary:b.Rd||c.Rd,audio:f,video:h,bandwidth:g,drmInfos:e,allowedByApplication:!0,allowedByKeySystem:!0};d.push(g)}}}else{f=b||c;for(e of f.streams)g=e.bandwidth||0,g={id:a.h++,language:f.language||_.eg,primary:f.Rd,audio:b?e:null,video:c?e:null,bandwidth:g,drmInfos:f.drmInfos,allowedByApplication:!0,allowedByKeySystem:!0},d.push(g)}},
|
|
58
|
+
LO=function(a,b){return null!==a.duration?a.start+a.duration:0<b.length?(b=b.filter(c=>0<c.streams.length).map(c=>c.streams).flat().filter(c=>c.getLastSegmentEndTime).map(c=>c.getLastSegmentEndTime()),0<b.length?a.start+Math.min(...b):null):null},OO=function(a){let b=null;const c=_.Gn.a(a,"Label").map(_.Gn.f).filter(_.vj);c&&0<c.length&&(b=c[c.length-1]);null==b&&(b=a.getAttribute("label"));return b},PO=function(a,b){let c=!1;const d=_.Gn.a(a,"Role");a=d.map(f=>f.getAttribute(_.lg)).filter(_.vj);
|
|
59
|
+
let e=void 0;b&&(e=_.eB);for(const f of d)if(b=f.getAttribute(PM),null==b||"urn:mpeg:dash:role:2011"===b||"urn:mpeg:dash:role"===b)switch(b=f.getAttribute(_.lg),b){case _.ne:c=!0;break;case _.NA:case _.eB:e=b;break;case "forced-subtitle":case "forced_subtitle":case _.Ud:e=_.Ud}return{Rd:c,roles:a,kind:e}},QO=function(a){var b=_.Gn.a(a,wM);a=null;for(const c of b){b=c.getAttribute(PM)||"";const d=c.getAttribute(_.lg);if(b!==JM&&!UO.includes(b)||void 0===d)throw new _.wj("Unrecognized essential property");
|
|
60
|
+
b===JM&&(a=d.split(" "))}return a},RO=function(a){const b=new Map;for(const e of a)if(a=e.getAttribute(PM),"urn:scte:dash:cc:cea-608:2015"===a||"urn:scte:dash:cc:cea-708:2015"===a){a=1;var c=e.getAttribute(_.lg);if(null!=c)for(const f of c.split(";")){if(f.includes("\x3d")){var d=f.split("\x3d");c=d[0].startsWith("CC")?d[0]:"CC"+d[0];d=d[1].split(",")[0].split(":").pop()}else c="CC"+a,a+=2,d=f;b.set(c,_.Uj(d))}else b.set("CC1",_.eg)}return b},SO=function(a,b,c,d,e,f,g,h,k,l){const m=_.Gn,n=_.Uj(e);
|
|
61
|
+
b.O=GO(a,l,b.xa,null,null);if(!VO(a,b.O))return a.g.warn("Skipping Representation",b.O),null;b.hc=`${b.Ma.id} ${b.O.id}`;b.Pd=a.F.get(b.hc);b.bandwidth=m.aa(l,"bandwidth",iN)||0;const p=WO(a,b);if(!p)return null;a.F.set(b.hc,p.Na);var u=m.a(l,uM);a=sO(u,c,a.a.ignoreDrmInfo,b.Ma.id,a.a.playreadyVersion||null);u=!1;m.a(l,"SupplementalProperty").some(x=>"tag:dolby.com,2018:dash:EC3_ExtensionType:2018"===x.getAttribute(PM)&&"JOC"===x.getAttribute(_.lg))&&(b.O.mimeType="audio/eac3-joc",u=!0);l=XO(b,l);
|
|
62
|
+
return{id:_.DI++,originalId:b.O.id,createSegmentIndex:p.createSegmentIndex,findSegmentPosition:p.findSegmentPosition,getSegmentReference:p.getSegmentReference,initSegmentReference:p.initSegmentReference,adjustSegmentDurations:p.adjustSegmentDurations,getLastSegmentEndTime:p.getLastSegmentEndTime,getDuration:p.getDuration,segmentLookupStrategy:_.UA,mimeType:b.O.mimeType,codecs:b.O.codecs,frameRate:b.O.frameRate,bandwidth:b.bandwidth,width:b.O.width,height:b.O.height,kind:d,encrypted:0<c.drmInfos.length,
|
|
63
|
+
keyId:a,language:n,originalLanguage:e,label:f,type:b.xa.contentType,primary:g,trickModeVideo:null,emsgSchemeIdUris:b.O.emsgSchemeIdUris,roles:h,channelsCount:b.O.cf,spatialAudio:u,closedCaptions:k,horizontalTiles:l.horizontalTiles,verticalTiles:l.verticalTiles,durationPerTile:l.durationPerTile}},TO=function(a,b,c){const d=b===_.eB?_.I:b;b=c.map(e=>({scheme:e.getAttribute(PM)||"",id:e.getAttribute("id")||void 0,value:e.getAttribute(_.lg)||"",protocol:"DASH",type:d}));for(const e of a)e.accessibility=
|
|
64
|
+
b;return a},VO=function(a,b){let c;c=b.Wd?1:0;c+=b.sc?1:0;c+=b.tc?1:0;if(0===c){if(b.contentType===_.I||b.contentType===HM)return!0;a.g.warn("Representation does not contain a segment information source:","the Representation must contain one of SegmentBase, SegmentList,",'SegmentTemplate, or explicitly indicate that it is "text".',b);return!1}1!==c&&(a.g.warn("Representation contains multiple segment information sources:","the Representation should only contain one of SegmentBase,","SegmentList, or SegmentTemplate.",
|
|
65
|
+
b),b.Wd?(a.g.info("Using SegmentBase by default."),b.sc=null):a.g.info("Using SegmentList by default."),b.tc=null);return!0},WO=function(a,b){var c=b.O.contentType;c=c===_.I||c===HM;try{if(b.O.Wd){{const F=Number(sN(b,NN,OM))||0,G=sN(b,NN,RM);var d=1;G&&(d=iN(G)||1);var e=F/d||0,f=MN(b,NN);{d=f;var g=e;const D=b.O.mimeType.split("/")[1];if(b.O.contentType!==_.I&&"mp4"!==D&&"webm"!==D)throw _.sh("SegmentBase specifies an unsupported container type.",b.O),new _.J(_.C,4,4006);if("webm"===D&&!d)throw _.sh(BM,
|
|
66
|
+
"the SegmentBase uses a WebM container,","but does not contain an Initialization element.",b.O),new _.J(_.C,4,4005);const ka=tN(b,NN,"RepresentationIndex"),Da=sN(b,NN,"indexRange");let Xa=b.O.qa,Hb=gN(Da||"");if(ka){const sb=ka.getAttribute("sourceURL");sb&&(Xa=_.xB(b.O.qa,[sb]));Hb=_.Gn.aa(ka,"range",gN,Hb)}if(!Hb)throw _.sh(BM,"the SegmentBase does not contain @indexRange","or a RepresentationIndex element.",b.O),new _.J(_.C,4,4002);aN(b.O.contentType)&&(b.presentationTimeline.B=null);var h=PN(b,
|
|
67
|
+
d,Xa,Hb.start,Hb.end,D,g)}var k={createSegmentIndex:h.createSegmentIndex,findSegmentPosition:h.findSegmentPosition,getSegmentReference:h.getSegmentReference,adjustSegmentDurations:h.adjustSegmentDurations,getDuration:h.getDuration,initSegmentReference:f,getLastSegmentEndTime:h.getLastSegmentEndTime,Na:e}}}else{if(b.O.sc){{var l=a.H;const F=MN(b,cO);{const ka=dO(b),Da=vN(b,cO);let Xa=Da.Nc;0===Xa&&(_.A("SegmentList@startNumber must be \x3e 0"),Xa=1);h=0;Da.ab?h=Da.ab*(Xa-1):Da.wa&&0<Da.wa.a&&(h=Da.wa.j);
|
|
68
|
+
var m={ab:Da.ab,startTime:h,Nc:Xa,Ub:Da.Ub,wa:Da.wa,Lc:ka}}if(!m.ab&&!m.wa&&1<m.Lc.length)throw _.A(CM,"the SegmentList specifies multiple segments,","but does not specify a segment duration or timeline.",b.O),new _.J(_.C,4,4002);if(!m.ab&&!b.$a.duration&&!m.wa&&1===m.Lc.length)throw _.A(CM,"the SegmentList specifies one segment,","but does not specify a segment duration, period duration,","or timeline.",b.O),new _.J(_.C,4,4002);if(m.wa&&0===m.wa.a)throw _.A(CM,"the SegmentList has an empty timeline.",
|
|
69
|
+
b.O),new _.J(_.C,4,4002);{let ka=m.Lc.length;m.wa&&m.wa.a!==m.Lc.length&&(ka=Math.min(m.wa.a,m.Lc.length),_.A("The number of items in the segment timeline and the number of","segment URLs do not match, truncating",m.Lc.length,"to",ka));var n=ka}const G=new YO(m,b.O.qa,b.O.Ia,b.$a.duration,n),D=ZN(b,G,l);if(aN(b.O.contentType)){const ka=TN(D);ka&&yN(b,ka)}d={createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:D.findSegmentPosition.bind(D),getSegmentReference:D.getSegmentReference.bind(D),
|
|
70
|
+
adjustSegmentDurations:D.adjustSegmentDurations.bind(D),getDuration:D.getDuration.bind(D),initSegmentReference:F,getLastSegmentEndTime:D.getLastSegmentEndTime.bind(D),Na:m.Ub}}}else{if(b.O.tc){{var p=a.H,u=!!a.f;const F=aO(b);{const D=vN(b,$N),ka=sN(b,$N,"media"),Da=sN(b,$N,"index");e={ab:D.ab,timescale:D.timescale,Nc:D.Nc,Ve:D.Ve,Ub:D.Ub,Jf:D.Jf,wa:D.wa,bf:ka,Md:Da,Oe:D.Oe}}{let D;D=e.Md?1:0;D+=e.wa?1:0;D+=e.ab?1:0;if(0===D)throw _.sh("SegmentTemplate does not contain any segment information:","the SegmentTemplate must contain either an index URL template",
|
|
71
|
+
"a SegmentTimeline, or a segment duration.",b.O),new _.J(_.C,4,4002);1!==D&&(_.A("SegmentTemplate contains multiple segment information sources:","the SegmentTemplate should only contain an index URL template,","a SegmentTimeline or a segment duration.",b.O),e.Md?(_.qh("Using the index URL template by default."),e.wa=null):_.qh("Using the SegmentTimeline by default."),e.ab=null);if(!e.Md&&!e.bf)throw _.sh(DM,"the SegmentTemplate's media URL template is missing.",b.O),new _.J(_.C,4,4002);}const G=
|
|
72
|
+
aN(b.O.contentType);h=null;if(e.Md){G&&(b.presentationTimeline.B=null);{f=F;const D=b.O.mimeType.split("/")[1];if("mp4"!==D&&"webm"!==D)throw _.sh("SegmentTemplate specifies an unsupported container type.",b.O),new _.J(_.C,4,4006);if("webm"===D&&!f)throw _.sh(DM,"the SegmentTemplate uses a WebM container,","but does not contain an initialization URL template.",b.O),new _.J(_.C,4,4005);const ka=rN(e.Md,b.O.id,null,b.bandwidth||null,null),Da=_.xB(b.O.qa,[ka]);h=PN(b,f,Da,0,null,D,e.Ub)}}else if(e.ab){if(!u&&
|
|
73
|
+
G){b.presentationTimeline.B=null;var x=b.presentationTimeline;x.G=Math.max(x.G,e.Oe);x.g.debug("notifyAvailabilityTimeOffset: maxAvailabilityTimeOffset\x3d"+x.G);_.uC(b.presentationTimeline,e.ab);var y=b.presentationTimeline,B=b.$a.start;y.l=null==y.l?B:Math.min(y.l,B)}h=bO(b,e)}else{const D=ZN(b,new ZO(e,b.O.id,b.bandwidth||null,b.O.qa,b.O.Ia),p);if(G){const ka=TN(D);ka&&yN(b,ka)}h={createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:D.findSegmentPosition.bind(D),getSegmentReference:D.getSegmentReference.bind(D),
|
|
74
|
+
adjustSegmentDurations:D.adjustSegmentDurations.bind(D),getDuration:D.getDuration.bind(D),getLastSegmentEndTime:D.getLastSegmentEndTime.bind(D)}}g={createSegmentIndex:h.createSegmentIndex,findSegmentPosition:h.findSegmentPosition,getSegmentReference:h.getSegmentReference,adjustSegmentDurations:h.adjustSegmentDurations,getDuration:h.getDuration,initSegmentReference:F,getLastSegmentEndTime:h.getLastSegmentEndTime,Na:e.Ub}}}else g=$O(b);d=g}k=d}return k}catch(F){if(c&&4002===F.code)return a.g.debug("Ignoring DASH_NO_SEGMENT_INFO error in a text stream",
|
|
75
|
+
F),null;throw F;}},XO=function(a,b){const c={};if(a.O.contentType===_.ae){var d=(b=_.Gn.h(b,wM))&&b.getAttribute(PM);d=d||"";aP.includes(d)&&(b=_.AB(b.getAttribute(_.lg)||""))&&(c.horizontalTiles=b.Jd,c.verticalTiles=b.ae,a.xa.tc&&(d=_.Gn.aa(a.xa.tc,IM,jN)||0,a=_.Gn.aa(a.xa.tc,RM,jN)||1,a=d/a))&&(c.durationPerTile=a/b.dj)}return c},$O=function(a){const b=a.O.qa,c=a.$a.duration||0,d=()=>c;return{createSegmentIndex:()=>Promise.resolve(),findSegmentPosition:e=>0<=e&&e<c?1:null,getSegmentReference:e=>
|
|
76
|
+
1!==e?null:new _.CI(1,0,c,()=>b,0,null,0,null,null,null,null,null,null,null,null,()=>"",a.O.Ia),adjustSegmentDurations:()=>{},getDuration:d,getLastSegmentEndTime:d,verticalTiles:void 0,horizontalTiles:void 0,initSegmentReference:null,Na:0}},MO=function(a,b){b=b.slice();for(const c of a)(a=c.getAttribute(PM))&&!b.includes(a)&&b.push(a);return b},NO=function(a,b){for(const d of b){b=d.getAttribute(PM);if(!b)continue;const e=d.getAttribute(_.lg);if(e)switch(b){case "urn:mpeg:dash:outputChannelPositionList:2012":return e.trim().split(/ +/).length;
|
|
77
|
+
case "urn:mpeg:dash:23003:3:audio_channel_configuration:2011":case "urn:dts:dash:audio_channel_configuration:2012":var c=parseInt(e,10);if(!c){a.g.warn(tM,b,e);continue}return c;case "tag:dolby.com,2014:dash:audio_channel_configuration:2011":case "urn:dolby:dash:audio_channel_configuration:2011":c=parseInt(e,16);if(!c){a.g.warn(tM,b,e);continue}for(a=0;c;)c&1&&++a,c>>=1;return a;default:a.g.warn("Unrecognized audio channel scheme:",b,e)}}return null};_.fv.prototype.Zd=XM(19,function(a){return a});
|
|
78
|
+
_.RB.prototype.Zd=XM(18,function(a){const b=Array.from(a.a.entries()).map(([d,e])=>`xmlns:${e}="${d}"`).join(" "),c=(new DOMParser).parseFromString(`<?xml version="1.0"?><${a.tagName} `+`${b}/>`,_.Uf).childNodes[0];Object.keys(a.attributes).forEach(d=>{c.setAttribute(d,a.attributes[d])});a.childNodes.forEach(d=>{d.tagName===_.da?c.textContent+=d.textContent:c.appendChild(this.Zd(d))});return c});
|
|
79
|
+
_.fv.prototype.Ee=XM(17,function(a,b){Array.from(a.attributes).forEach(c=>{c.namespaceURI===b&&a.removeAttributeNS(c.namespaceURI,c.localName)})});_.RB.prototype.Ee=XM(16,function(a,b){if(b=a.a.get(b)){var c=`${b}:`;Object.keys(a.attributes).forEach(d=>{d.startsWith(c)&&delete a.attributes[d]})}});_.fv.prototype.te=XM(15,function(a,b){for(const c of a.attributes)b.setAttributeNS(c.namespaceURI,c.nodeName,c.value)});
|
|
80
|
+
_.RB.prototype.te=XM(14,function(a,b){Object.keys(a.attributes).forEach(c=>{b.attributes[c]=a.attributes[c]})});_.fv.prototype.ue=XM(13,function(a,b){Array.from(a.childNodes).forEach(c=>{a.removeChild(c);b.appendChild(c)})});_.RB.prototype.ue=XM(12,function(a,b){b.childNodes.push(...a.childNodes);a.childNodes=[]});_.fv.prototype.De=XM(11,function(a){Array.from(a.childNodes).forEach(b=>{a.removeChild(b)})});_.RB.prototype.De=XM(10,function(a){a.childNodes=[]});_.fv.prototype.Sc=XM(9,function(){return document.createElement("null")});
|
|
81
|
+
_.RB.prototype.Sc=XM(8,function(){return new _.PB("NULL",null,{},[],null,null,new Map)});_.fv.prototype.pe=XM(7,function(a){return Array.from(a.childNodes).filter(b=>b instanceof Element)});_.RB.prototype.pe=XM(6,function(a){return a.childNodes});_.fv.prototype.aa=XM(5,function(a,b,c,d=null){let e=null;a=a.getAttribute(b);null!=a&&(e=c(a));return null==e?d:e});_.RB.prototype.aa=XM(4,function(a,b,c,d=null){let e=null;a=a.getAttribute(b);null!=a&&(e=c(a));return null==e?d:e});
|
|
82
|
+
_.fv.prototype.Dc=XM(3,function(a,b,c){return Array.from(a.childNodes).filter(d=>d instanceof Element&&d.localName===c&&d.namespaceURI===b)});_.RB.prototype.Dc=XM(2,function(a,b,c){b=a.a.get(b);if(!b)return[];const d=`${b}:${c}`;return a.childNodes.filter(e=>e.tagName===d)});_.fv.prototype.Xb=XM(1,function(a,b,c){a=this.Dc(a,b,c);return 1!==a.length?null:a[0]});_.RB.prototype.Xb=XM(0,function(a,b,c){a=this.Dc(a,b,c);return 1!==a.length?null:a[0]});var YO=class{constructor(a,b,c,d,e){this.l=a.Nc;this.j=e;this.I=a.Lc;this.a=a.startTime;this.h=a.ab;this.f=a.wa;this.H=a.Ub;this.G=b;this.F=c;this.A=d;this.g=new _.S("clpp.dash.SegmentListSource")}o(){return this.j}w(){return this.l}B(a){a=nN(this,a);return null==a?null:null!=this.h?(a=this.a+a*this.h,{startTime:a,endTime:a+this.h}):this.f?(a=pN(this.f,a),{startTime:a.startTime,endTime:a.endTime}):null==this.A?(this.g.warn(vM),null):{startTime:this.a,endTime:this.a+this.A}}findSegmentPosition(a){return 0<
|
|
83
|
+
this.j?a<this.a?this.l:null!=this.h?(a=this.l+Math.floor((a-this.a)/this.h),a>this.l+this.j-1?null:a):this.f?(a=qN(this.f,a),null==a?null:this.l+a):null==this.A?(this.g.warn(vM),null):a<this.a+this.A?this.l:null:null}getSegmentReference(a,b){const c=nN(this,a);if(null==c)return null;b=null==b?a:b;a=this.B(a);if(null==a)return null;const d=this.I[c],e=_.xB(this.G,[d.Bg]);return new _.CI(b,a.startTime,a.endTime,()=>e,d.start,d.end,this.H,null,null,null,null,null,null,null,null,()=>d.Bg,this.F)}C(){return 0<
|
|
84
|
+
this.j?null!=this.h?{oc:this.a,bc:this.a+this.j*this.h,cc:this.h}:this.f?{oc:pN(this.f,0).startTime,bc:pN(this.f,this.j-1).endTime,cc:this.f.h}:null==this.A?null:{oc:this.a,bc:this.a+this.A,cc:this.A}:null}};var uN=class{constructor(a){this.f=a;this.a=a.reduce((b,c)=>b+c.count,0);this.j=0<this.a?a[0].startTime:0;this.h=oN(a)}};var aP=["http://dashif.org/thumbnail_tile","http://dashif.org/guidelines/thumbnail_tile"],UO=["urn:mpeg:mpegB:cicp:ColourPrimaries","urn:mpeg:mpegB:cicp:MatrixCoefficients","urn:mpeg:mpegB:cicp:TransferCharacteristics"];var ZO=class{constructor(a,b,c,d,e){const f=a.wa;this.h=a.Nc;this.f=f.a;this.a=f;this.G=a.bf;this.H=b;this.j=c;this.A=d;this.l=e;this.F=a.Ub;this.I=a.Jf}o(){return this.f}w(){return this.h}B(a){a=BN(this,a);if(null==a)return null;a=pN(this.a,a);return{startTime:a.startTime,endTime:a.endTime}}findSegmentPosition(a){if(!(0<this.f))return null;a=qN(this.a,a);return null==a?null:this.h+a}getSegmentReference(a,b){var c=BN(this,a);if(null==c)return null;b=null==b?a:b;c=pN(this.a,c);const d=c.kj+this.I,
|
|
85
|
+
e=()=>rN(this.G,this.H,a,this.j,d);return new _.CI(b,c.startTime,c.endTime,()=>{const f=e();return _.xB(this.A,[f])},0,null,this.F,null,null,null,null,null,null,null,null,e,this.l)}C(){return 0<this.f?{oc:pN(this.a,0).startTime,bc:pN(this.a,this.f-1).endTime,cc:this.a.h}:null}};var JN=class{constructor(a){this.f=a;this.a=new _.Dn(a,!1)}},FN=[[255],[127,255],[63,255,255],[31,255,255,255],[15,255,255,255,255],[7,255,255,255,255,255],[3,255,255,255,255,255,255],[1,255,255,255,255,255,255,255]],GN=class{constructor(a,b){this.id=a;this.a=b}};var ON=class{parse(a,b,c,d){var e;b=new JN(new DataView(b));if(440786851!==HN(b).id)throw _.sh("Not an EBML element."),new _.J(_.C,3,3008);var f=HN(b);if(408125543!==f.id)throw _.sh("Not a Segment element."),new _.J(_.C,3,3009);b=f.a.byteOffset;f=new JN(f.a);for(e=null;_.Cm(f.a);){var g=HN(f);if(357149030===g.id){e=g;break}}if(!e)throw _.sh("Not an Info element."),new _.J(_.C,3,3010);e=new JN(e.a);g=1E6;for(f=null;_.Cm(e.a);){const h=HN(e);if(2807729===h.id)g=IN(h);else if(17545===h.id)if(f=h,4===
|
|
86
|
+
f.a.byteLength)f=f.a.getFloat32(0);else if(8===f.a.byteLength)f=f.a.getFloat64(0);else throw new _.J(_.C,3,3003);}if(null==f)throw new _.J(_.C,3,3011);e=g/=1E9;f*=g;a=HN(new JN(new DataView(a)));if(475249515!==a.id)throw _.sh("Not a Cues element."),new _.J(_.C,3,3007);return LN(a,b,e,f,c,d)}};var YN=class{constructor(a){this.a=a;this.f=0;this.l=0<a.o()?a.w():0;this.h=[];this.j=null;this.g=new _.S("clpp.dash.SegmentSourceAdapter")}findSegmentPosition(a){const b=QN(this);if(!b)return null;if(!(0<this.h.length||null!=this.j))return a=this.a.findSegmentPosition(a),null==a||a>b.$b?null:a<b.Lb?b.Lb+this.f:a+this.f;for(var c=b.$b;c>=b.Lb;c--){const d=RN(this,c);if(a>=d.startTime&&a<d.endTime)return c+this.f}c=RN(this,b.Lb);return a<c.startTime?b.Lb+this.f:null}getSegmentReference(a){var b=a-
|
|
87
|
+
this.f;if(!SN(this,b))return null;a=this.a.getSegmentReference(b,a);if(!a)return null;b=RN(this,b);return new _.CI(a.position,b.startTime,b.endTime,a.Da,a.na,a.ka,a.Na,a.keyInfo,a.Vc,a.timescale,a.horizontalTiles,a.verticalTiles,a.durationPerTile,a.a,a.initSegment,a.$c,a.Ia)}adjustSegmentDurations(a,b){if(SN(this,a-this.f)){this.g.warn(`Adjusting segment duration by drift ${b} at ${a}`);var c=this.h.find(d=>d.position===a);c?c.ke+=b:this.h.push({position:a,ke:b})}}getDuration(){const a=QN(this);if(!a)return 0;
|
|
88
|
+
const b=RN(this,a.Lb);return RN(this,a.$b).endTime-b.startTime}getLastSegmentEndTime(){const a=QN(this);return a?RN(this,a.$b).endTime:0}};var bP=class{constructor(a,b){this.g=a;this.f=b;this.a={clockSyncUri:void 0}}};var hO=(new Map).set("urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b",_.Le).set(WM,_.td).set(VM,_.rd).set("urn:uuid:79f0049a-4098-8642-ab92-e65be0885f95",_.rd).set("urn:uuid:94ce86fb-07ff-4f43-adb8-93d2fa968ca2",_.pd).set("urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb",_.od),rO=(new Map).set(_.td,function(a){const b=tO(a);if(b)return{licenseUrl:b,origin:_.SA};if(a=_.Gn.Xb(a.node,"urn:microsoft","laurl"))if(a=a.getAttribute("licenseUrl"))return{licenseUrl:a,origin:"ms:laurl"};return null}).set(_.rd,
|
|
89
|
+
function(a){var b=_.Gn;const c=tO(a);if(c)return{licenseUrl:c,origin:_.SA};a=b.Xb(a.node,SM,"pro");if(!a)return null;b=b.f(a);if(!b)return null;b=_.Pk(b);return(b=_.Ln(b).h)?{licenseUrl:b,origin:"mspr:pro"}:null}),jO=new _.S("clpp.dash.ContentProtection");var cP=class{constructor(){this.D=this.a=null;this.o=[];this.f=null;this.G=[];this.h=1;this.H={};this.l=0;this.I=new _.EI(5);this.B=new _.Kh(()=>{this.ec()});this.A=new _.ru;this.j=new Map;this.g=new _.S("clpp.dash.DashParser");this.C=null;this.J=new bP(this.g,(a,b)=>{a=_.fk(a,this.a.attemptParameters);a.type=5;a.method=b;b=this.D.networkingEngine.fetch(a);_.wk(this.A,b);return b.V});this.F=new Map;this.K=!1;this.w=null}configure(a){this.a=a;this.J.a={clockSyncUri:a.clockSyncUri}}start(a,b){const c=
|
|
90
|
+
this;return _.v(function*(){c.o=[a];c.D=b;const d=yield zO(c);c.D&&AO(c,d);if(!c.D)throw new _.J(_.C,7,7001);return c.f})}requestStop(){this.K=!0}stop(){this.a=this.D=null;this.o=[];this.f=null;this.G=[];this.H={};this.C=null;this.l=-1;this.B.stop();this.F.clear();this.j.clear();return this.A.destroy()}update(){zO(this).catch(a=>{if(this.D&&a)this.D.onError(a)})}setCurrentVariant(){}ec(){const a=this;return _.v(function*(){a.g.debug(_.IA);let b=0;try{b=yield zO(a)}catch(c){if(a.D&&c.a&&(a.D.onError(c),
|
|
91
|
+
c.severity===_.C))return}a.D&&(a.K?yield a.stop():AO(a,b))})}loadVariant(a){return _.v(function*(){return a})}loadTextStream(a,b){const c=this;return _.v(function*(){let d;const e=c.f.periods.find(f=>f.id===b);e&&(d=e.textStreams.find(f=>f.id===a)||null);if(!d)throw new _.wj(`Could not load text stream with id: ${a}`);return d})}};_.w("clpp.dash.DashComponent",class extends _.Fv{install(){_.Nt.mpd=cP;_.Mt[_.tc]=cP}uninstall(){_.YC("mpd");_.ZC(_.tc)}id(){return"dash"}});};f.call(g, window);
|
package/cl.freewheel.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
b.push("videoAssetId");if(b.length)throw new _.J(1,9,12001,{missingKeys:b.join(", ")});},
|
|
3
|
-
a.Z.bind(a));a.l.on(a.a,tv.freewheel.SDK.EVENT_SLOT_ENDED,a.W.bind(a));a.l.on(a.a,tv.freewheel.SDK.EVENT_AD,a.S.bind(a));a.l.on(a.m,_.$f,a.R.bind(a));a.l.on(a.m,_.bf,a.P.bind(a))},
|
|
4
|
-
null;a.a&&c&&(c.adInstance||c.slot)&&(c=(d=c.adInstance||null)?d.getSlot():c.slot,d={ad:new X(a.a,c,d)});a.m.trigger(new _.H(b,d))},
|
|
5
|
-
this.f=this.a=null)}id(){return
|
|
6
|
-
0}getPosition(){return 0}getSkipTimeOffset(){return 0}
|
|
7
|
-
case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:return _.
|
|
8
|
-
X.prototype.getVideoElement=X.prototype.zb;X.prototype.getWrapperCreativeIds=X.prototype.getWrapperCreativeIds;X.prototype.getWrapperAdSystems=X.prototype.getWrapperAdSystems;X.prototype.canSeek=X.prototype.canSeek;X.prototype.getWrapperAdIds=X.prototype.getWrapperAdIds;X.prototype.getSequenceLength=X.prototype.
|
|
9
|
-
X.prototype.getMediaBitrate=X.prototype.Ba;X.prototype.getMediaHeight=X.prototype.
|
|
10
|
-
X.prototype.getAdSystem=X.prototype.getAdSystem;X.prototype.getApiFramework=X.prototype.getApiFramework;X.prototype.getSourceId=X.prototype.yb;X.prototype.getCreativeId=X.prototype.getCreativeId;X.prototype.getId=X.prototype.getId;X.prototype.getTechnology=X.prototype.
|
|
11
|
-
|
|
12
|
-
typeof b.siteSectionId!==_.Of&&typeof b.siteSectionId!==_.r||a.a.setSiteSection(b.siteSectionId);const c=yield
|
|
13
|
-
!1,tv.freewheel.SDK.PARAMETER_LEVEL_GLOBAL);if(Array.isArray(b.parameters))for(const d of b.parameters)a.a.setParameter(d.name,d.value,d.level);
|
|
14
|
-
a;this.a&&(a?this.a.setAdVolume(0):this.a.setAdVolume(this.G))}isMuted(){return this.C}
|
|
15
|
-
this.I=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL),this.L=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL),this.m.trigger(new _.H(_.oc,{adsTimeline:new
|
|
16
|
-
tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL||this.m.play()}S(a){const b=a.subType;this.g.debug("ad event",b);switch(b){case tv.freewheel.SDK.EVENT_AD_IMPRESSION:this.setMuted(this.C);this.h(this.G);this.J=!0;this.F=!1;
|
|
17
|
-
_.mc,a);break;case tv.freewheel.SDK.EVENT_AD_COMPLETE:
|
|
18
|
-
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]}))}}R(){if(!this.f){var a=this.m.getPosition();if(this.f=this.I.find(b=>.5>Math.abs(a-b.getTimePosition()))||null){const b=this.I.findIndex(c=>c===this.f);this.I.splice(b,1);this.m.pause();
|
|
19
|
-
case 10:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PAUSED);break;case 11:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_COMPLETED);this.L.length?(
|
|
20
|
-
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var nU="clpp-freewheel",oU="clpp.freewheel.AdsManagerFactory",pU="freewheel",qU=function(a){switch(a){case 0:return tv.freewheel.SDK.ADUNIT_PREROLL;case _.Qj:return tv.freewheel.SDK.ADUNIT_MIDROLL;case _.Nj:return tv.freewheel.SDK.ADUNIT_POSTROLL;default:return""}},rU=function(a){const b=[];typeof a.networkId!==_.r&&b.push("networkId");typeof a.serverUrl!==_.Of&&b.push("serverUrl");typeof a.profileId!==_.Of&&b.push("profileId");typeof a.videoAssetId!==_.Of&&typeof a.videoAssetId!==_.r&&
|
|
2
|
+
b.push("videoAssetId");if(b.length)throw new _.J(1,9,12001,{missingKeys:b.join(", ")});},sU=function(){return _.v(function*(){var a=new _.Qv;let b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_NONE;const c=yield a.canPlay(!1);a=yield a.canPlay(!0);c?b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_ATTENDED:a&&(b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_UNATTENDED);return b})},tU=function(a){a.l.on(a.a,tv.freewheel.SDK.EVENT_REQUEST_COMPLETE,a.U.bind(a));a.l.on(a.a,tv.freewheel.SDK.EVENT_SLOT_STARTED,
|
|
3
|
+
a.Z.bind(a));a.l.on(a.a,tv.freewheel.SDK.EVENT_SLOT_ENDED,a.W.bind(a));a.l.on(a.a,tv.freewheel.SDK.EVENT_AD,a.S.bind(a));a.l.on(a.m,_.$f,a.R.bind(a));a.l.on(a.m,_.bf,a.P.bind(a))},uU=function(a){const b=a.m.Ed(pU).Yc();b&&a.m.getSurface().hide(b);a.m.getSurface().showMediaElement()},vU=function(a){const b=a.m.Ed(pU).Yc();b&&(a.m.getSurface().show(b),a.m.getSurface().hideMediaElement(),a.a.registerVideoDisplayBase(nU),a.m.isMuted()?a.setVolume(0):a.setVolume(a.m.getVolume()||1))},wU=function(a,b,c){var d=
|
|
4
|
+
null;a.a&&c&&(c.adInstance||c.slot)&&(c=(d=c.adInstance||null)?d.getSlot():c.slot,d={ad:new X(a.a,c,d)});a.m.trigger(new _.H(b,d))},xU=class extends _.$v{constructor(){super();this.f=this.a=null}onPlayerCreated(a){if(window.tv&&tv.freewheel&&tv.freewheel.SDK)this.a=_.Ep(_.Ad,{id:nU}),this.f=_.Ep(_.t,{"class":_.$c}),this.a.appendChild(this.f),a.getSurface().addElementToContainer(this.a,!0),a.getSurface().hide(this.a);else a.onError(new _.J(1,9,12E3))}onPlayerWillDestroy(a){this.a&&(a.getSurface().removeElementFromContainer(this.a),
|
|
5
|
+
this.f=this.a=null)}id(){return pU}Yc(){return this.a}Sh(){return this.f}};_.w("clpp.freewheel.FreeWheelPlugin",xU);xU.prototype.getAdVideo=xU.prototype.Sh;xU.prototype.getAdContainer=xU.prototype.Yc;xU.Id=pU;xU.AD_CONTAINER_ID=nU;var yU=class{create(){return new xU}};var X=class{constructor(a,b,c){this.h=a;this.f=b;this.a=c}gb(){return"FreeWheel AdManager SDK"}hb(){return tv.freewheel.SDK.version}jb(){return 0}getId(){return this.a?this.a.getAdId():""}getCreativeId(){const a=(this.a||{})._creativeId;return typeof a===_.Of?a:""}yb(){return""}getApiFramework(){return this.a?this.a.getActiveCreativeRendition().getCreativeApi():""}getAdSystem(){return""}getAdvertiserName(){return""}getTitle(){return""}getDuration(){return this.a?this.a.getActiveCreativeRendition().getDuration():
|
|
6
|
+
0}getPosition(){return 0}getSkipTimeOffset(){return 0}Bb(){return!1}Ta(){return this.a&&this.a.getEventCallbackUrls(tv.freewheel.SDK.EVENT_AD_CLICK,tv.freewheel.SDK.EVENT_TYPE_CLICK)[0]||""}getMediaUrl(){return this.a?this.a.getActiveCreativeRendition().getPrimaryCreativeRenditionAsset().getUrl():""}Xa(){return this.a?this.a.getActiveCreativeRendition().getWidth():0}Wa(){return this.a?this.a.getActiveCreativeRendition().getHeight():0}Ba(){return 0}Ca(){switch(this.f.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:return 0;
|
|
7
|
+
case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:return _.Nj;default:return _.Qj}}getPodIndex(){switch(this.Ca()){case 0:return 0;case _.Nj:return-1}return this.h.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL).indexOf(this.f)+1}pb(){switch(this.Ca()){case 0:return 0;case _.Nj:return-1;default:return this.f.getTimePosition()}}ib(){return this.a?this.f.getAdInstances().indexOf(this.a)+1:1}Ya(){return this.f.getAdCount()}getWrapperAdIds(){return[]}canSeek(){return!1}getWrapperAdSystems(){return[]}getWrapperCreativeIds(){return[]}zb(){return null}};
|
|
8
|
+
X.prototype.getVideoElement=X.prototype.zb;X.prototype.getWrapperCreativeIds=X.prototype.getWrapperCreativeIds;X.prototype.getWrapperAdSystems=X.prototype.getWrapperAdSystems;X.prototype.canSeek=X.prototype.canSeek;X.prototype.getWrapperAdIds=X.prototype.getWrapperAdIds;X.prototype.getSequenceLength=X.prototype.Ya;X.prototype.getPositionInSequence=X.prototype.ib;X.prototype.getPodTimeOffset=X.prototype.pb;X.prototype.getPodIndex=X.prototype.getPodIndex;X.prototype.getPodType=X.prototype.Ca;
|
|
9
|
+
X.prototype.getMediaBitrate=X.prototype.Ba;X.prototype.getMediaHeight=X.prototype.Wa;X.prototype.getMediaWidth=X.prototype.Xa;X.prototype.getMediaUrl=X.prototype.getMediaUrl;X.prototype.getClickThroughUrl=X.prototype.Ta;X.prototype.isBumper=X.prototype.Bb;X.prototype.getSkipTimeOffset=X.prototype.getSkipTimeOffset;X.prototype.getPosition=X.prototype.getPosition;X.prototype.getDuration=X.prototype.getDuration;X.prototype.getTitle=X.prototype.getTitle;X.prototype.getAdvertiserName=X.prototype.getAdvertiserName;
|
|
10
|
+
X.prototype.getAdSystem=X.prototype.getAdSystem;X.prototype.getApiFramework=X.prototype.getApiFramework;X.prototype.getSourceId=X.prototype.yb;X.prototype.getCreativeId=X.prototype.getCreativeId;X.prototype.getId=X.prototype.getId;X.prototype.getTechnology=X.prototype.jb;X.prototype.getAdManagerVersion=X.prototype.hb;X.prototype.getAdManagerName=X.prototype.gb;var zU=class{constructor(a){this.a=a}getCuePoints(){return this.a.getTemporalSlots().map(a=>{switch(a.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:return 0;case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:return-1;default:return a.getTimePosition()}})}Qb(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL).length}Ab(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL).length}};
|
|
11
|
+
zU.prototype.hasPostroll=zU.prototype.Ab;zU.prototype.hasPreroll=zU.prototype.Qb;zU.prototype.getCuePoints=zU.prototype.getCuePoints;var AU=class{constructor(a){this.g=new _.S("clpp.freewheel.AdsManager");this.m=a;this.l=new _.Ut;this.K=new tv.freewheel.SDK.AdManager;this.f=this.a=null;this.M=[];this.I=[];this.L=[];this.H=new _.xk;this.B=null;this.C=!1;this.G=1;this.J=!1;this.F=!0}load(){const a=this;return _.v(function*(){const b=a.m.getConfiguration().freewheel||{};try{rU(b)}catch(d){return a.m.onError(d),a.H.resolve(),a.H}a.K.setNetwork(b.networkId);a.K.setServer(b.serverUrl);a.a=a.K.newContext();a.a.setProfile(b.profileId);
|
|
12
|
+
typeof b.siteSectionId!==_.Of&&typeof b.siteSectionId!==_.r||a.a.setSiteSection(b.siteSectionId);const c=yield sU();a.a.setVideoAsset(b.videoAssetId,a.m.getDuration(),void 0,void 0,c);if(Array.isArray(b.pods))for(const d of b.pods)a.a.addTemporalSlot(d.id,qU(d.type),d.position,d.slotProfile,d.cuepointSequence,d.maxDuration,d.minDuration,d.acceptContentType);b.keyValues&&typeof b.keyValues===_.Ce&&Object.keys(b.keyValues).forEach(d=>a.a.addKeyValue(d,b.keyValues[d]));a.a.setParameter(tv.freewheel.SDK.PARAMETER_EXTENSION_CONTENT_VIDEO_ENABLED,
|
|
13
|
+
!1,tv.freewheel.SDK.PARAMETER_LEVEL_GLOBAL);if(Array.isArray(b.parameters))for(const d of b.parameters)a.a.setParameter(d.name,d.value,d.level);tU(a);a.a.submitRequest();return a.H})}j(){if(this.M.length){vU(this);this.f=this.M.shift();this.f.play();var a=!1}else this.f?(this.f.resume(),a=!1):(uU(this),a=!0);return a}A(){}La(){this.f&&this.f.pause()}skip(){this.f&&this.f.skipCurrentAd()}getAdVolume(){return!this.a||this.C?this.G:this.a.getAdVolume()}h(a){this.G=a;this.C||this.a&&this.a.setAdVolume(a)}setMuted(a){this.C=
|
|
14
|
+
a;this.a&&(a?this.a.setAdVolume(0):this.a.setAdVolume(this.G))}isMuted(){return this.C}Ka(){return this.J}isPaused(){return this.F}getPosition(){return this.f?this.f.getPlayheadTime():-1}setVolume(a){this.h(a)}getVolume(){return this.getAdVolume()}pause(){this.La()}resume(){this.j()}w(){return!0}o(){const a=this;return _.v(function*(){a.l.release();a.B&&(a.B.stop(),a.B=null);uU(a);a.a&&(a.a.dispose(),a.a=null)})}U(a){if(a.success)this.M=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL),
|
|
15
|
+
this.I=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL),this.L=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL),this.m.trigger(new _.H(_.oc,{adsTimeline:new zU(this.a)})),this.B=new _.Ov(this.m.getSurface(),(b,c)=>this.a.resize(b,c),this.m.Ed(pU).f);else this.m.onError(new _.J(1,9,10003,{errorType:0},void 0));this.H.resolve()}Z(a){wU(this,_.Sb,a);this.B.start()}W(a){this.f=null;a=a.slot;wU(this,_.Tb);this.B.stop();uU(this);a&&a.getTimePositionClass()===
|
|
16
|
+
tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL||this.m.play()}S(a){const b=a.subType;this.g.debug("ad event",b);switch(b){case tv.freewheel.SDK.EVENT_AD_IMPRESSION:this.setMuted(this.C);this.h(this.G);this.J=!0;this.F=!1;wU(this,_.jc,a);wU(this,_.ac,a);break;case tv.freewheel.SDK.EVENT_AD_IMPRESSION_END:wU(this,_.lc,a);this.F=this.J=!1;break;case tv.freewheel.SDK.EVENT_AD_FIRST_QUARTILE:wU(this,_.Xb,a);break;case tv.freewheel.SDK.EVENT_AD_MIDPOINT:wU(this,_.cc,a);break;case tv.freewheel.SDK.EVENT_AD_THIRD_QUARTILE:wU(this,
|
|
17
|
+
_.mc,a);break;case tv.freewheel.SDK.EVENT_AD_COMPLETE:wU(this,_.Wb,a);break;case tv.freewheel.SDK.EVENT_AD_CLICK:wU(this,_.Vb,a);break;case tv.freewheel.SDK.EVENT_AD_PAUSE:this.F=!0;wU(this,_.dc,a);break;case tv.freewheel.SDK.EVENT_AD_RESUME:this.F=!1;wU(this,_.fc,a);break;case tv.freewheel.SDK.EVENT_AD_SKIPPED:wU(this,_.gc,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_START:wU(this,_.Ub,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_END:wU(this,_.ec,a);break;case tv.freewheel.SDK.EVENT_ERROR:this.m.onError(new _.J(1,
|
|
18
|
+
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]}))}}R(){if(!this.f){var a=this.m.getPosition();if(this.f=this.I.find(b=>.5>Math.abs(a-b.getTimePosition()))||null){const b=this.I.findIndex(c=>c===this.f);this.I.splice(b,1);this.m.pause();vU(this);this.f.play()}}}P(a){if((a=a.detail)&&this.a)switch(a.currentState){case 8:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PLAYING);break;
|
|
19
|
+
case 10:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PAUSED);break;case 11:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_COMPLETED);this.L.length?(vU(this),this.f=this.L.shift(),this.f.play()):uU(this);break;case 0:case 3:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_STOPPED)}}};AU.prototype.resume=AU.prototype.resume;AU.prototype.pause=AU.prototype.pause;AU.prototype.getVolume=AU.prototype.getVolume;AU.prototype.setVolume=AU.prototype.setVolume;AU.prototype.getPosition=AU.prototype.getPosition;
|
|
20
|
+
AU.prototype.skip=AU.prototype.skip;_.qp(new class{constructor(){this.Ea=new _.S(oU)}name(){return oU}a(a,b){return a.namespace()!==_.gd&&b&&b.freewheel?window.tv&&tv.freewheel&&tv.freewheel.SDK?!0:(this.Ea.warn("FreeWheel SDK is not loaded."),!1):!1}create(a){return new AU(a)}});_.Tr(new yU);};f.call(g, window);
|