@castlabs/prestoplay 6.3.0 → 6.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +48 -1
- package/cjs/cl.adobe.js +3 -3
- package/cjs/cl.airplay.js +3 -3
- package/cjs/cl.broadpeak.js +6 -6
- package/cjs/cl.cast.js +108 -107
- package/cjs/cl.conviva.js +33 -33
- package/cjs/cl.core.js +410 -398
- package/cjs/cl.crypto.js +10 -10
- package/cjs/cl.dash.js +72 -69
- package/cjs/cl.externs.js +55 -52
- package/cjs/cl.freewheel.js +24 -24
- package/cjs/cl.hls.js +49 -44
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +32 -32
- package/cjs/cl.ima.js +22 -22
- package/cjs/cl.mse.js +259 -254
- package/cjs/cl.muxdata.js +12 -12
- package/cjs/cl.onboard.js +3 -3
- package/cjs/cl.persistent.js +14 -14
- package/cjs/cl.playlist.js +6 -6
- package/cjs/cl.smooth.js +69 -69
- package/cjs/cl.thumbnails.js +24 -23
- package/cjs/cl.tizen.js +69 -69
- package/cjs/cl.ttml.js +27 -26
- package/cjs/cl.verimatrix.js +5 -5
- package/cjs/cl.vimond.js +13 -13
- package/cjs/cl.vr.js +18 -18
- package/cjs/cl.vtt.js +14 -14
- package/cjs/cl.youbora.js +20 -19
- package/cl.adobe.js +3 -3
- package/cl.airplay.js +3 -3
- package/cl.broadpeak.js +5 -5
- package/cl.cast.js +88 -87
- package/cl.conviva.js +27 -27
- package/cl.core.js +353 -345
- package/cl.crypto.js +8 -8
- package/cl.dash.js +67 -63
- package/cl.externs.js +55 -52
- package/cl.freewheel.js +19 -19
- package/cl.hls.js +40 -37
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +25 -25
- package/cl.ima.js +16 -16
- package/cl.mse.js +232 -221
- package/cl.muxdata.js +8 -8
- package/cl.onboard.js +4 -4
- package/cl.persistent.js +10 -10
- package/cl.playlist.js +5 -5
- package/cl.smooth.js +58 -58
- package/cl.thumbnails.js +17 -17
- package/cl.tizen.js +57 -57
- package/cl.ttml.js +22 -21
- package/cl.verimatrix.js +4 -4
- package/cl.vimond.js +8 -8
- package/cl.vr.js +14 -14
- package/cl.vtt.js +12 -12
- package/cl.youbora.js +15 -14
- package/package.json +2 -2
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
|
-
var c=_.
|
|
3
|
-
this.j;const h=b[0],k=b[1],l=b[2];b=b[3];const m=new Uint32Array(256);let n=0,q=0,
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var rI=function(a){a=_.mg(a);const b=new Uint32Array(4);for(let c=0;4>c;c++)b[c]=a.getUint32(4*c);return b},tI=function(a,b,c){return _.w(function*(){let d=new ArrayBuffer(0);try{d=yield sI(a,c.url)}catch(e){return a.m.debug("Could not fetch key"),a.l.onError(new _.G(1,7,7104,null,e)),b}try{return yield a.h.importKey(d),yield a.h.decrypt(b,c.iv)}catch(e){return a.m.warn("Could not decrypt segment data!",e),a.l.onError(new _.G(1,3,3103,null,e)),b}})},sI=function(a,b){return _.w(function*(){if(a.o[b])return a.o[b];
|
|
2
|
+
var c=_.Hg(b);c=yield a.j.fetch(c).P;return a.o[b]=c.data})},uI=class{constructor(){this.A=[0,1,2,4,8,16,32,64,128,27,54];this.B=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)];this.j=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)];this.w=new Uint32Array(256);this.m=new Uint32Array(256);this.o=new Uint32Array(0);this.g=this.a=this.h=this.f=null;{const c=this.w,d=this.m;var a=this.B;const e=a[0],f=a[1],g=a[2];a=a[3];var b=
|
|
3
|
+
this.j;const h=b[0],k=b[1],l=b[2];b=b[3];const m=new Uint32Array(256);let n=0,q=0,t;for(t=0;256>t;t++)m[t]=128>t?t<<1:t<<1^283;for(t=0;256>t;t++){let u=q^q<<1^q<<2^q<<3^q<<4;u=u>>>8^u&255^99;c[n]=u;d[u]=n;const x=m[n],A=m[x],E=m[A];let D=257*m[u]^16843008*u;e[n]=D<<24|D>>>8;f[n]=D<<16|D>>>16;g[n]=D<<8|D>>>24;a[n]=D;D=16843009*E^65537*A^257*x^16843008*n;h[u]=D<<24|D>>>8;k[u]=D<<16|D>>>16;l[u]=D<<8|D>>>24;b[u]=D;n?(n=x^m[m[m[E^x]]],q^=m[m[q]]):n=q=1}}}importKey(a){a=rI(a);for(var b=!0,c=0;c<a.length&&
|
|
4
4
|
b;)b=a[c]===this.o[c],c++;if(b)return new Promise(m=>m());this.o=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.g=4*(this.a+7);this.f=new Uint32Array(this.g);this.h=new Uint32Array(this.g);b=this.w;const d=this.A;var e=this.j;c=e[0];const f=e[1],g=e[2],h=e[3];let k=0,l=0;for(e=0;e<this.g;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&255],l^=d[e/this.a|0]<<24):6<this.a&&
|
|
5
|
-
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.g;a++)e=this.g-a,l=a&3?this.f[e]:this.f[e-4],this.h[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.h[a]>>>=0;return new Promise(m=>m())}decrypt(a,b){let c=0;const d=this.a+6,e=this.h,f=this.m;var g=this.j;const h=g[0],k=g[1],l=g[2];g=g[3];var m=
|
|
6
|
-
D,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
this.j.
|
|
5
|
+
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.g;a++)e=this.g-a,l=a&3?this.f[e]:this.f[e-4],this.h[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.h[a]>>>=0;return new Promise(m=>m())}decrypt(a,b){let c=0;const d=this.a+6,e=this.h,f=this.m;var g=this.j;const h=g[0],k=g[1],l=g[2];g=g[3];var m=rI(b);b=m[0];let n=m[1],q=m[2];m=m[3];a=_.lg(a);const t=new Int32Array(a.length);let u,x,A;let E,
|
|
6
|
+
D,T,ia,tf,uf,vf,Pa,bd;const ed=this.C.bind(this);for(;c<a.length;){ia=ed(a[c]);tf=ed(a[c+1]);uf=ed(a[c+2]);vf=ed(a[c+3]);E=ia^e[0];D=vf^e[1];T=uf^e[2];var xa=tf^e[3];Pa=4;for(bd=1;bd<d;bd++)u=h[E>>>24]^k[D>>16&255]^l[T>>8&255]^g[xa&255]^e[Pa],x=h[D>>>24]^k[T>>16&255]^l[xa>>8&255]^g[E&255]^e[Pa+1],A=h[T>>>24]^k[xa>>16&255]^l[E>>8&255]^g[D&255]^e[Pa+2],xa=h[xa>>>24]^k[E>>16&255]^l[D>>8&255]^g[T&255]^e[Pa+3],E=u,D=x,T=A,Pa+=4;u=f[E>>>24]<<24^f[D>>16&255]<<16^f[T>>8&255]<<8^f[xa&255]^e[Pa];x=f[D>>>24]<<
|
|
7
|
+
24^f[T>>16&255]<<16^f[xa>>8&255]<<8^f[E&255]^e[Pa+1];A=f[T>>>24]<<24^f[xa>>16&255]<<16^f[E>>8&255]<<8^f[D&255]^e[Pa+2];xa=f[xa>>>24]<<24^f[E>>16&255]<<16^f[D>>8&255]<<8^f[T&255]^e[Pa+3];Pa+=3;t[c]=ed(u^b);t[c+1]=ed(xa^n);t[c+2]=ed(A^q);t[c+3]=ed(x^m);b=ia;n=tf;q=uf;m=vf;c+=4}return new Promise(ib=>{{var La=t.buffer;const bb=La.byteLength,gc=bb&&(new DataView(La)).getUint8(bb-1);La=gc?La.slice(0,bb-gc):La}ib(La)})}destroy(){this.A=this.h=this.f=this.j=this.B=this.m=this.w=this.g=this.a=this.o=null;
|
|
8
|
+
return new Promise(a=>a())}C(a){return a<<24|(a&65280)<<8|(a&16711680)>>8|a>>>24}};var vI=class{constructor(){this.a=null}importKey(a){const b=this;return _.w(function*(){b.a=yield crypto.subtle.importKey("raw",a,{name:"AES-CBC"},!1,["decrypt"])})}decrypt(a,b){const c=this;return _.w(function*(){return yield crypto.subtle.decrypt({name:"AES-CBC",iv:b},c.a,a)})}destroy(){this.a=null;return new Promise(a=>a())}};_.y("clpp.crypto.CryptoComponent",class extends _.bp{constructor(){super();this.j=this.l=null;this.w=this.A.bind(this);this.o={};this.h=null;this.m=new _.N("clpp.crypto")}f(a){this.l=a}a(){this.l=null}g(){if(window.crypto&&crypto.subtle){var a=crypto.subtle.decrypt;a=typeof crypto.subtle.importKey===_.Vc&&typeof a===_.Vc}else a=!1;a?this.h=new vI:(this.m.warn("No WebCrypto APIs found. Will fallback to software AES"),this.h=new uI);this.j=this.l.getNetworkEngine();this.j.bd(this.w)}release(){this.j&&
|
|
9
|
+
this.j.Nd(this.w);this.h&&(this.h.destroy(),this.h=null);this.j=null;this.o={}}id(){return"crypto"}A(a){const b=this;return _.w(function*(){const c=a.request||null;c&&2===c.type&&c.keyInfo&&a.data&&(b.m.debug("Decrypt data"),a.data=yield tI(b,a.data,c.keyInfo));return a})}});};f.call(g, window);
|
package/cl.dash.js
CHANGED
|
@@ -1,63 +1,67 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
|
|
3
|
-
b.
|
|
4
|
-
return isNaN(a)?null:Math.floor(a/1E3)},
|
|
5
|
-
b=Number(b[2]);return isFinite(b)?{start:a,end:b}:null},
|
|
6
|
-
|
|
7
|
-
h&&k&&(_.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
c){return[b(a.
|
|
12
|
-
|
|
13
|
-
(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
getDuration:
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
{a.a.warn(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
c
|
|
42
|
-
|
|
43
|
-
"
|
|
44
|
-
|
|
45
|
-
"
|
|
46
|
-
(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
n.
|
|
53
|
-
|
|
54
|
-
"
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
""
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var IA="Channel parsing failure! Ignoring scheme and value",JA="ContentProtection",KA="EssentialProperty",LA="Failed to parse UTCTiming tags.",MA="Missing \x3cms:pro/\x3e node in ContentProtection element",NA="No UTCTiming elements found.",OA="SegmentBase does not contain sufficient segment information:",PA="SegmentList does not contain sufficient segment information:",QA="SegmentTemplate does not contain sufficient segment information:",RA="SegmentTimeline",SA='The last "S" element cannot have a negative repeat',
|
|
2
|
+
TA="application",UA="duration",VA="http://www.w3.org/1999/xlink",WA='ignoring the last "S" element.',XA='ignoring the remaining "S" elements.',YA="presentationTimeOffset",ZA="schemeIdUri",$A="static",aB="timescale",bB="urn:microsoft:playready",cB="urn:mpeg:cenc:2013",dB="urn:mpeg:dash:utc:http-head:2014",eB="urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95",fB="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed",gB=function(a,b){a.w=Math.max(a.w,b);a.B.debug("notifyAvailabilityTimeOffset: maxAvailabilityTimeOffset\x3d"+
|
|
3
|
+
a.w)},hB=function(a){return new _.xl(Promise.reject(a),()=>Promise.resolve())},iB=function(a){return new _.xl(Promise.all(a.map(b=>b.P)),()=>Promise.all(a.map(b=>b.abort())))},jB=function(a,b,c){return Array.prototype.filter.call(a.childNodes,d=>d instanceof Element&&d.localName==c&&d.namespaceURI==b)},kB=function(a,b,c){a=jB(a,b,c);return 1!=a.length?null:a[0]},lB=function(a,b,c){return a.hasAttributeNS(b,c)?a.getAttributeNS(b,c):null},mB=function(a,b,c,d=null){let e=null;a=a.getAttribute(b);null!=
|
|
4
|
+
a&&(e=c(a));return null==e?d:e},nB=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:Math.floor(a/1E3)},oB=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 _.B("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]||
|
|
5
|
+
null);return isFinite(a)?a:null},pB=function(a){var b=/([0-9]+)-([0-9]+)/.exec(a);if(!b)return null;a=Number(b[1]);if(!isFinite(a))return null;b=Number(b[2]);return isFinite(b)?{start:a,end:b}:null},qB=function(a){a=Number(a);return 0===a%1?a:null},rB=function(a){a=Number(a);return 0===a%1&&0<a?a:null},sB=function(a){a=Number(a);return 0===a%1&&0<=a?a:null},tB=function(a){let b;a=(b=a.match(/^(\d+)\/(\d+)$/))?Number(b[1])/Number(b[2]):Number(a);return isNaN(a)?null:a},uB=function(a,b){try{const c=
|
|
6
|
+
_.pg(a);return _.Jj(c,b)}catch(c){return null}},vB=function(a,b){return a.reduce(((c,d,e)=>d.catch(c.bind(null,e))).bind(null,b),Promise.reject())},wB=function(a){var b=void 0===b?1024:b;if(!(a instanceof Uint8Array))return"";if(typeof b!==_.p||0>=b)b=1024;return(a.byteLength>b?a.subarray(0,b):a).toString()},xB=function(a,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("$$"==
|
|
7
|
+
g)return"$";let m=f[h];if(null==m)return _.B("URL template does not have an available substitution ","for identifier",'"'+h+'":',a),g;"RepresentationID"==h&&k&&(_.B("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=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,
|
|
8
|
+
10)||1;return Array(Math.max(0,k-g.length)+1).join("0")+g})},AB=function(a,b){var c=yB(a,b,aB);let d=1;c&&(d=rB(c)||1);c=yB(a,b,UA);(c=rB(c||""))&&(c/=d);let e=Number(yB(a,b,YA))||0,f=e/d||0;a.wf&&null!=a.Ac&&a.Ac!==f&&(_.B("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 "+`value will be ignored. (Period ID: ${a.qa.id}, `+`Representation ID: ${a.O.id})`),e=a.Ac*
|
|
9
|
+
d,f=a.Ac);var g=yB(a,b,"startNumber");let h=sB(g||"");if(null==g||null==h)h=1;g=yB(a,b,"endNumber");g=null!==g?sB(g||""):null;var k=zB(a,b,RA),l=null;if(k){{l=d;var m=e,n=a.ca.duration||Infinity;k=_.Gj(k,"S");const A=[];var q=0;for(let E=0;E<k.length;++E){var t=k[E],u=mB(t,"t",sB);const D=mB(t,"d",sB);var x=mB(t,"r",qB);null!=u&&(u-=m);if(!D){_.B('"S" element must have a duration:',XA,t);break}u=null!=u?u:q;x=x||0;if(0>x)if(E+1<k.length){x=mB(k[E+1],"t",sB);if(null==x){_.B('An "S" element cannot have a negative repeat',
|
|
10
|
+
'if the next "S" element does not have a valid start time:',XA,t);break}else if(u>=x){_.B('An "S" element cannot have a negative repeat if its start ','time exceeds the next "S" element\'s start time:',XA,t);break}x=Math.ceil((x-u)/D)-1}else{if(Infinity==n){_.B(SA,"if the Period has an infinite duration:",WA,t);break}else if(u/l>=n){_.B(SA,"if its start time exceeds the Period's duration:",WA,t);break}x=Math.ceil((n*l-u)/D)-1}0<A.length&&u!=q&&(Math.abs((u-q)/l)>=_.Ko&&_.B("SegmentTimeline contains a large gap/overlap:",
|
|
11
|
+
"the content may have errors in it.",t),A[A.length-1].end=u/l);for(t=0;t<=x;++t)q=u+D,A.push({start:u/l,end:q/l,Rf:u}),u=q}l=A}}a=yB(a,b,"availabilityTimeOffset");b=Number(a||"");b=isNaN(b)?null:b;if(null==a||null==b)b=0;return{timescale:d,ta:c,ac:h,kd:g,gb:f,Yd:e,timeline:l,cd:b}},yB=function(a,b,c){return[b(a.O),b(a.oa),b(a.qa)].filter(_.Qk).map(d=>d.getAttribute(c)).reduce((d,e)=>d||e)},zB=function(a,b,c){return[b(a.O),b(a.oa),b(a.qa)].filter(_.Qk).map(d=>_.Hj(d,c)).reduce((d,e)=>d||e)},CB=function(a,
|
|
12
|
+
b,c,d,e,f){const g=lB(a,VA,"href"),h=lB(a,VA,"actuate")||"onRequest";for(let l=0;l<a.attributes.length;l++){const m=a.attributes[l];m.namespaceURI==VA&&(a.removeAttributeNS(m.namespaceURI,m.localName),--l)}if(5<=f)return hB(new _.G(_.F,4,4028));if("onLoad"!=h)return hB(new _.G(_.F,4,4027));const k=_.au([d],[g]);d=_.Hg(k,b);d.type=1;return e.fetch(d).Ic(l=>{l=uB(l.data,a.tagName);if(!l)return hB(new _.G(_.F,4,4001,{uri:g}));for(;a.childNodes.length;)a.removeChild(a.childNodes[0]);for(;l.childNodes.length;){var m=
|
|
13
|
+
l.childNodes[0];l.removeChild(m);a.appendChild(m)}for(m=0;m<l.attributes.length;m++){const n=l.attributes[m].nodeName,q=l.getAttribute(n);a.setAttribute(n,q)}return BB(a,b,c,k[0],e,f+1)})},BB=function(a,b,c,d,e,f=0){if(lB(a,VA,"href")){var g=CB(a,b,c,d,e,f);c&&(g=g.Ic(void 0,()=>BB(a,b,c,d,e,f)));return g}g=[];for(let h=0;h<a.childNodes.length;h++){const k=a.childNodes[h];k instanceof Element&&("urn:mpeg:dash:resolve-to-zero:2013"==lB(k,VA,"href")?(a.removeChild(k),--h):k.tagName!=RA&&g.push(BB(k,
|
|
14
|
+
b,c,d,e,f)))}return iB(g).Ic(()=>a)},EB=function(a,b,c,d){let e;var f=(new _.ej).X("sidx",g=>{e=DB(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);_.Ff('Invalid box type. Expected "sidx", but received:',a,"from:",g,"byte range:",f);throw new _.G(_.F,3,3004,{url:g,cg:f,size:a.byteLength,pg:wB(a)});}},DB=function(a,b,c,d){const e=[];d.G.skip(4);const f=_.M(d.G);if(0==f)throw _.Ff("Invalid timescale."),new _.G(_.F,3,3005);if(0==d.version){var g=_.M(d.G);var h=
|
|
15
|
+
_.M(d.G)}else g=_.Ri(d.G),h=_.Ri(d.G);d.G.skip(2);const k=_.Oi(d.G);a=a+d.size+h;for(h=0;h<k;h++){var l=_.M(d.G);const m=(l&2147483648)>>>31;l&=2147483647;const n=_.M(d.G);d.G.skip(4);if(1==m)throw _.Ff("Hierarchical SIDXs are not supported."),new _.G(_.F,3,3006);e.push(new _.vu(e.length,g/f-b,(g+n)/f-b,()=>c,a,a+l-1,b));g+=n;a+=l}d.Pa.stop();return e},FB=function(a){var b=_.Ni(a.a);let c;for(c=1;8>=c&&!(b&1<<8-c);c++);if(8<c)throw new _.G(_.F,3,3002);const d=new Uint8Array(c);d[0]=b;for(b=1;b<c;b++)d[b]=
|
|
16
|
+
_.Ni(a.a);return d},IB=function(a){var b=FB(a);if(7<b.length)throw new _.G(_.F,3,3002);var c=0;for(var d=0;d<b.length;d++)c=256*c+b[d];b=c;c=FB(a);a:{for(e of GB)if(_.xi(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 _.G(_.F,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(),
|
|
17
|
+
c);a.a.skip(c);return new HB(b,e)},JB=function(a){if(8<a.a.byteLength)throw new _.G(_.F,3,3002);if(8==a.a.byteLength&&a.a.getUint8(0)&224)throw new _.G(_.F,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},MB=function(a,b,c,d,e,f){const g=[],h=()=>e;a=new KB(a.a);let k=null,l=null;for(;_.Li(a.a);){var m=IB(a);if(187==m.id){var n=LB(m);n&&(m=c*n.Sf,n=b+n.Gf,null!=k&&g.push(new _.vu(g.length,k-f,m-f,h,l,n-1,f)),k=m,l=n)}}null!=k&&g.push(new _.vu(g.length,
|
|
18
|
+
k-f,d-f,h,l,null,f));return g},LB=function(a){var b=new KB(a.a);a=IB(b);if(179!=a.id)throw _.B("Not a CueTime element."),new _.G(_.F,3,3013);a=JB(a);b=IB(b);if(183!=b.id)throw _.B("Not a CueTrackPositions element."),new _.G(_.F,3,3012);b=new KB(b.a);let c=0;for(;_.Li(b.a);){const d=IB(b);if(241==d.id){c=JB(d);break}}return{Sf:a,Gf:c}},NB=function(a,b){b=zB(a,b,"Initialization");if(!b)return null;let c=a.O.Ma;var d=b.getAttribute("sourceURL");d&&(c=_.au(a.O.Ma,[d]));a=0;d=null;if(b=mB(b,"range",pB))a=
|
|
19
|
+
b.start,d=b.end;return new _.Qy(()=>c,a,d)},QB=function(a,b){var c=Number(yB(a,OB,YA))||0,d=yB(a,OB,aB),e=1;d&&(e=rB(d)||1);c=c/e||0;d=NB(a,OB);{e=a.O.mimeType.split("/")[1];if(a.O.contentType!=_.r&&e!=_.sd&&"webm"!=e)throw _.Ff("SegmentBase specifies an unsupported container type.",a.O),new _.G(_.F,4,4006);if("webm"==e&&!d)throw _.Ff(OA,"the SegmentBase uses a WebM container,","but does not contain an Initialization element.",a.O),new _.G(_.F,4,4005);const g=zB(a,OB,"RepresentationIndex");var f=
|
|
20
|
+
yB(a,OB,"indexRange");let h=a.O.Ma;f=pB(f||"");if(g){const k=g.getAttribute("sourceURL");k&&(h=_.au(a.O.Ma,[k]));f=mB(g,"range",pB,f)}if(!f)throw _.Ff(OA,"the SegmentBase does not contain @indexRange","or a RepresentationIndex element.",a.O),new _.G(_.F,4,4002);a=PB(a,b,d,h,f.start,f.end,e,c)}return{createSegmentIndex:a.createSegmentIndex,findSegmentPosition:a.findSegmentPosition,getSegmentReference:a.getSegmentReference,adjustSegmentDurations:a.adjustSegmentDurations,getDuration:a.getDuration,initSegmentReference:d,
|
|
21
|
+
getLastSegmentEndTime:a.getLastSegmentEndTime,xa:c}},OB=function(a){return a.Fc},PB=function(a,b,c,d,e,f,g,h){const k=a.presentationTimeline,l=!a.jc||!a.ca.td,m=a.ca.start,n=a.ca.duration;let q=b,t=null;return{createSegmentIndex:function(){return _.w(function*(){var u=[q(d,e,f),"webm"==g?q(c.Ea(),c.Ka,c.Ba):null];q=null;u=yield Promise.all(u);var x=u[0];const A=u[1]||null;x=g==_.sd?EB(x,e,d,h):(new RB).parse(x,A,d,h);_.mu(k,x,m);t=new _.Sy(x);l&&_.Au(t,n);return u})},findSegmentPosition:function(u){return t.f(u)},
|
|
22
|
+
getSegmentReference:function(u){return t.get(u)},adjustSegmentDurations:function(u,x){return t.g(u,x)},getDuration:function(){return t.getDuration()},getLastSegmentEndTime:()=>n}},YB=function(a,b,c,d){const e=SB(a),f=TB(a);UB(a,f);var g=null;if(f.yc)g=VB(a,b,e,f);else if(f.ta)d||(gB(a.presentationTimeline,f.cd),_.nu(a.presentationTimeline,f.ta),_.lu(a.presentationTimeline,a.ca.start)),g=WB(a,f);else{let h=null;b=null;a.qa.id&&a.O.id&&(b=a.qa.id+","+a.O.id,h=c[b]);d=XB(a,f);g=!a.jc||!a.ca.td;h?(g&&
|
|
23
|
+
_.Au(new _.Sy(d),a.ca.duration),_.wu(h,d),_.xu(h,_.pu(a.presentationTimeline)-a.ca.start)):(_.mu(a.presentationTimeline,d,a.ca.start),h=new _.Sy(d),b&&a.jc&&(c[b]=h));g&&_.Au(h,a.ca.duration);g={createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:h.f.bind(h),getSegmentReference:h.get.bind(h),adjustSegmentDurations:h.g.bind(h),getDuration:h.getDuration.bind(h),getLastSegmentEndTime:()=>_.uu(h)}}return{createSegmentIndex:g.createSegmentIndex,findSegmentPosition:g.findSegmentPosition,
|
|
24
|
+
getSegmentReference:g.getSegmentReference,adjustSegmentDurations:g.adjustSegmentDurations,getDuration:g.getDuration,initSegmentReference:e,getLastSegmentEndTime:g.getLastSegmentEndTime,xa:f.gb}},SB=function(a){const b=yB(a,ZB,"initialization");if(!b)return null;const c=a.O.id,d=a.bandwidth||null,e=a.O.Ma;return new _.Qy(function(){const f=xB(b,c,null,d,null);return _.au(e,[f])},0,null)},TB=function(a){const b=AB(a,ZB),c=yB(a,ZB,"media");a=yB(a,ZB,"index");return{ta:b.ta,timescale:b.timescale,ac:b.ac,
|
|
25
|
+
kd:b.kd,gb:b.gb,Yd:b.Yd,timeline:b.timeline,zd:c,yc:a,cd:b.cd}},UB=function(a,b){let c;c=b.yc?1:0;c+=b.timeline?1:0;c+=b.ta?1:0;if(0==c)throw _.Ff("SegmentTemplate does not contain any segment information:","the SegmentTemplate must contain either an index URL template","a SegmentTimeline, or a segment duration.",a.O),new _.G(_.F,4,4002);1!=c&&(_.B("SegmentTemplate contains multiple segment information sources:","the SegmentTemplate should only contain an index URL template,","a SegmentTimeline or a segment duration.",
|
|
26
|
+
a.O),b.yc?(_.Df("Using the index URL template by default."),b.timeline=null):_.Df("Using the SegmentTimeline by default."),b.ta=null);if(!b.yc&&!b.zd)throw _.Ff(QA,"the SegmentTemplate's media URL template is missing.",a.O),new _.G(_.F,4,4002);},VB=function(a,b,c,d){const e=a.O.mimeType.split("/")[1];if(e!=_.sd&&"webm"!=e)throw _.Ff("SegmentTemplate specifies an unsupported container type.",a.O),new _.G(_.F,4,4006);if("webm"==e&&!c)throw _.Ff(QA,"the SegmentTemplate uses a WebM container,","but does not contain an initialization URL template.",
|
|
27
|
+
a.O),new _.G(_.F,4,4005);var f=xB(d.yc,a.O.id,null,a.bandwidth||null,null);f=_.au(a.O.Ma,[f]);return PB(a,b,c,f,0,null,e,d.gb)},WB=function(a,b){const c=a.ca.duration,d=b.ta,e=b.ac,f=b.kd,g=b.timescale,h=b.zd,k=a.bandwidth||null,l=a.O.id,m=a.O.Ma;return{createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:function(n){return 0>n||c&&n>=c?null:Math.floor(n/d)},getSegmentReference:function(n){const q=n+e;if(null!==f&&q>f)return null;const t=n*d;let u=t+d;c&&(u=Math.min(u,c));return 0>
|
|
28
|
+
u||c&&t>=c?null:new _.vu(n,t,u,function(){const x=xB(h,l,q,k,t*g);return _.au(m,[x])},0,null,b.gb)},adjustSegmentDurations:function(){},getDuration:function(){return c},getLastSegmentEndTime:()=>c}},XB=function(a,b){const c=[];for(let d=0;d<b.timeline.length;d++){const e=d+b.ac;c.push(new _.vu(e,b.timeline[d].start,b.timeline[d].end,function(f,g,h,k,l,m){f=xB(f,g,l,h,m);return _.au(k,[f]).map(n=>n.toString())}.bind(null,b.zd,a.O.id,a.bandwidth||null,a.O.Ma,e,b.timeline[d].Rf+b.Yd),0,null,b.gb))}return c},
|
|
29
|
+
ZB=function(a){return a.Zb},dC=function(a,b){const c=NB(a,$B),d=aC(a);bC(a,d);let e=null,f=null;a.qa.id&&a.O.id&&(f=a.qa.id+","+a.O.id,e=b[f]);const g=cC(a.ca.duration,d.ac,a.O.Ma,d);e?(_.wu(e,g),_.xu(e,_.pu(a.presentationTimeline)-a.ca.start)):(_.mu(a.presentationTimeline,g,a.ca.start),e=new _.Sy(g),f&&a.jc&&(b[f]=e));a.jc&&a.ca.td||_.Au(e,a.ca.duration);return{createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:e.f.bind(e),getSegmentReference:e.get.bind(e),adjustSegmentDurations:e.g.bind(e),
|
|
30
|
+
getDuration:e.getDuration.bind(e),initSegmentReference:c,getLastSegmentEndTime:()=>_.uu(e),xa:d.gb}},$B=function(a){return a.Ib},aC=function(a){const b=eC(a);a=AB(a,$B);let c=a.ac;0==c&&(_.B("SegmentList@startNumber must be \x3e 0"),c=1);let d=0;a.ta?d=a.ta*(c-1):a.timeline&&0<a.timeline.length&&(d=a.timeline[0].start);return{ta:a.ta,startTime:d,ac:c,gb:a.gb,timeline:a.timeline,Wb:b}},bC=function(a,b){if(!b.ta&&!b.timeline&&1<b.Wb.length)throw _.B(PA,"the SegmentList specifies multiple segments,",
|
|
31
|
+
"but does not specify a segment duration or timeline.",a.O),new _.G(_.F,4,4002);if(!b.ta&&!a.ca.duration&&!b.timeline&&1==b.Wb.length)throw _.B(PA,"the SegmentList specifies one segment,","but does not specify a segment duration, period duration,","or timeline.",a.O),new _.G(_.F,4,4002);if(b.timeline&&0==b.timeline.length)throw _.B(PA,"the SegmentList has an empty timeline.",a.O),new _.G(_.F,4,4002);},cC=function(a,b,c,d){let e=d.Wb.length;d.timeline&&d.timeline.length!=d.Wb.length&&(e=Math.min(d.timeline.length,
|
|
32
|
+
d.Wb.length),_.B("The number of items in the segment timeline and the number of","segment URLs do not match, truncating",d.Wb.length,"to",e));const f=[];var g=d.startTime;for(let h=0;h<e;h++){const k=d.Wb[h],l=_.au(c,[k.yf]);let m;m=null!=d.ta?g+d.ta:d.timeline?d.timeline[h].end:g+a;f.push(new _.vu(h+b,g,m,()=>l,k.start,k.end,d.gb));g=m}return f},eC=function(a){return[a.O.Ib,a.oa.Ib,a.qa.Ib].filter(_.Qk).map(b=>_.Gj(b,"SegmentURL")).reduce((b,c)=>0<b.length?b:c).map(b=>{b.getAttribute("indexRange")&&
|
|
33
|
+
!a.sd&&(a.sd=!0,_.B("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=mB(b,"mediaRange",pB,{start:0,end:null});return{yf:c,start:b.start,end:b.end}})},gC=function(a,b,c){c=c.map(e=>({scheme:e.getAttribute(ZA),value:e.getAttribute(_.Ae)}));const d=a.f.clockSyncUri;!c.length&&d&&(a.a.info("No UTCTiming elements found, falling back on clockSyncUri from config to synchronize clocks."),
|
|
34
|
+
c.push({scheme:dB,value:d}));return 0===c.length?(a.a.warn(NA),Promise.reject(Error(NA))):vB(c,e=>{const f=e.scheme;e=e.value;switch(f){case dB:case "urn:mpeg:dash:utc:http-head:2012":return fC(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 fC(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)?
|
|
35
|
+
(a.a.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.a.warn("NTP UTCTiming scheme is not supported"),Promise.reject();default:return a.a.warn("Unrecognized scheme in UTCTiming element",f),Promise.reject()}}).catch(()=>{a.a.warn(LA);return Promise.reject(Error(LA))})},hC=function(a,b,c,d){return _.w(function*(){const e=_.Gj(b,"UTCTiming");
|
|
36
|
+
try{const f=yield gC(a,c,e);d.A=f;a.a.info("Clock synchronized. The difference between server and "+`client clock was ${f} ms.`)}catch(f){a.a.warn("Failed to synchronize clocks. This content may not play on clients with bad clocks!")}return d})},fC=function(a,b,c,d){return _.w(function*(){var e=_.au(b,[c]);e=yield a.g(e,d);if("HEAD"==d){if(!e.headers||!e.headers.date)throw a.a.warn("UTC timing response is missing","expected date header"),Error("Date HTTP header missing.");e=e.headers.date}else e=
|
|
37
|
+
_.pg(e.data);e=Date.parse(e);if(isNaN(e))throw a.a.warn("Unable to parse date from UTC timing response"),Error("Date value invalid.");return e-Date.now()})},jC=function(a,b){return a.find(c=>iC.get(c.vb)===b)},kC=function(a){const b=kB(a.node,bB,"pro");if(!b)return _.B(MA,a),null;a=_.ui(b.textContent);a=_.Uj(a);a=_.Mj(a.a);return{keyId:null,vb:fB,node:document.createElement("null"),init:[{initData:_.It(a),initDataType:_.nc,keyId:null}]}},lC=function(a,b){b=void 0===b?"4.0.0.0":b;const c=kB(a.node,
|
|
38
|
+
cB,"pssh");if(!c)return _.B("Missing \x3ccenc:pssh/\x3e node in ContentProtection element",a),null;a=_.ui(c.textContent);a=_.Oj(a);return a?(b=_.Jt(b,a.a))?{keyId:null,vb:eB,node:document.createElement("null"),init:[{initData:_.It(b),initDataType:_.nc,keyId:null}]}:null:(_.B("Unable to parse WV PSSH data. Can not create PR data!"),null)},mC=function(a,b){const c=kB(a.node,bB,"pro");if(!c)return _.B(MA,a),null;a=_.ui(c.textContent);a=_.Uj(a);return a.version!==b&&(_.Ef(`Parsing from ${a.version} to ${b}.`),
|
|
39
|
+
a=_.Kt(a,b))?{keyId:null,vb:eB,node:document.createElement("null"),init:[{initData:_.It(a),initDataType:_.nc,keyId:null}]}:null},pC=function(a,b,c,d){const e=nC(a);let f=null;a=[];let g=[];const h=jC(e,_.Dc),k=jC(e,_.Cc);if(k&&d){var l=mC(k,d);l&&(e[e.indexOf(k)]=l)}k&&!h&&(l=kC(k))&&e.push(l);h&&!k&&(d=lC(h,d||void 0))&&e.push(d);d=new Set(e.map(m=>m.keyId));d.delete(null);if(1<d.size)throw new _.G(_.F,4,4010);b||(g=e.filter(m=>"urn:mpeg:dash:mp4protection:2011"==m.vb?(f=m.init||f,!1):!0),g.length&&
|
|
40
|
+
(a=oC(f,g,c),0==a.length&&(a=[_.bu(_.wd,f,c)])));if(e.length&&(b||!g.length)){a=[];for(const m of iC.values())m!=_.Fd&&a.push(_.bu(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{tc:b,fg:f,drmInfos:a,ke:!0}},nC=function(a){const b=[];for(const c of a)(a=qC(c))&&b.push(a);return b},oC=function(a,b,c){const d=[];for(const f of b){var e=iC.get(f.vb);if(e){b=_.bu(e,f.init||a,c);if(e=rC.get(e))b.licenseServerUri=e(f);d.push(b)}}return d},sC=function(a,b,
|
|
41
|
+
c,d,e){const f=pC(a,c,d,e);if(b.ke){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.tc=f.tc||b.tc;b.ke=!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 _.G(_.F,4,4008);return f.tc||b.tc},qC=function(a){let b=a.getAttribute(ZA),c=lB(a,cB,"default_KID");const d=jB(a,cB,"pssh").map(_.Ij);if(!b)return _.Ff("Missing required schemeIdUri attribute on",
|
|
42
|
+
"ContentProtection element",a),null;b=b.toLowerCase();if(c&&(c=c.replace(/-/g,"").toLowerCase(),c.includes(" ")))throw new _.G(_.F,4,4009);let e=[];try{e=d.map(f=>({initDataType:_.nc,initData:_.ui(f),keyId:null}))}catch(f){throw new _.G(_.F,4,4007);}return{node:a,vb:b,keyId:c,init:0<e.length?e:null}},uC=function(a,b){tC(a).forEach(c=>{c=c.getLastSegmentEndTime?c.getLastSegmentEndTime():0;if(0<c){var d=b.presentationTimeline;d.f=Math.max(d.f||0,c+b.ca.start)}})},vC=function(a,b){return _.Fu(_.Vg(a,
|
|
43
|
+
b))?_.r:a.split("/")[0]},tC=function(a){const b=new Set;a.forEach(c=>{c.variants.forEach(d=>{d.audio&&b.add(d.audio);d.video&&b.add(d.video)})});return Array.from(b)},yC=function(a){_.w(function*(){a.f.debug(_.lt);let b=0;try{b=yield wC(a)}catch(c){if(a.a&&c.a&&(a.a.onError(c),c.severity===_.F))return}a.a&&xC(a,b)})},wC=function(a){return _.w(function*(){var b=_.Hg(a.m,a.g.attemptParameters);b.type=1;var c=Date.now();b=a.a.networkingEngine.fetch(b);_.lh(a.o,b);b=yield b.P;if(!a.a)return 0;b.uri&&
|
|
44
|
+
!a.m.includes(b.uri)&&a.m.unshift(b.uri);yield zC(a,b.data,b.uri);c=(Date.now()-c)/1E3;_.iu(a.H,1,c);return c})},xC=function(a,b){0>a.j||a.A.ba(Math.max(3,a.j-b,_.ju(a.H)))},zC=function(a,b,c){return _.w(function*(){var d=uB(b,"MPD");if(!d)throw new _.G(_.F,4,4001,c);d=BB(d,a.g.attemptParameters,a.g.xlinkFailGracefully,c,a.a.networkingEngine);_.lh(a.o,d);d=yield d.P;return AC(a,d,c)})},AC=function(a,b,c){return _.w(function*(){var d=[c],e=_.Gj(b,"Location").map(_.Ij).filter(_.Qk);0<e.length&&(d=_.au(d,
|
|
45
|
+
e),a.m=d);e=_.Gj(b,"BaseURL").map(_.Ij);var f=_.au(d,e);d=mB(b,"minBufferTime",oB,0);e=b.getAttribute("type")||$A;a.j=mB(b,"minimumUpdatePeriod",oB,-1);e===$A&&0<=a.j&&(a.f.warn("Invalid manifest - a static manifest should not contain the `minimumUpdatePeriod` attribute. The attribute will be ignored."),a.j=-1,a.A.stop());var g=mB(b,"availabilityStartTime",nB);let h=mB(b,"timeShiftBufferDepth",oB);var k=mB(b,"suggestedPresentationDelay",oB);const l=mB(b,"maxSegmentDuration",oB),m=e===$A&&"dynamic"===
|
|
46
|
+
a.B;m&&(a.f.info("MPD dynamic to static transition."),e="dynamic");const n=e===$A;var q="dynamic"===e;if(a.h)g=a.h.presentationTimeline;else if(g=new _.Ry(g,null!=k?k:3*d,e===$A,!!a.g.autoCorrectDrift),q&&(g=yield hC(a.I,b,f,g),!a.a))return;q={jc:q,presentationTimeline:g,qa:null,ca:null,oa:null,O:null,bandwidth:0,sd:!1,wf:m,Td:null,Ac:null};{k=mB(b,"mediaPresentationDuration",oB);var t=[],u=0;const D=_.Gj(b,"Period");for(let T=0;T<D.length;T++){var x=D[T];u=mB(x,_.fe,oB,u);var A=mB(x,UA,oB);let ia=
|
|
47
|
+
null;if(T!=D.length-1){var E=mB(D[T+1],_.fe,oB);null!=E&&(ia=E-u)}else null!=k&&(ia=k-u);E=_.Ko;ia&&A&&Math.abs(ia-A)>E&&a.f.warn("There is a gap/overlap between Periods",x);null==ia&&(ia=A);x=BC(a,q,f,{start:u,duration:ia,node:x,td:null==ia||T==D.length-1});t.push(x);A=q.qa.id;a.D.includes(A)||(a.D.push(A),a.h&&(a.a.filterNewPeriod(x),a.h.periods.push(x)));if(null==ia){T!=D.length-1&&a.f.warn("Skipping Period",T+1,"and any subsequent Periods:","Period",T+1,"does not have a valid start time.",t[T+
|
|
48
|
+
1]);u=null;break}u+=ia}null==a.h&&a.a.filterAllPeriods(t);null!=k?(u!=k&&a.f.warn("@mediaPresentationDuration does not match the total duration of ","all Periods."),f={periods:t,duration:k,he:!1}):f={periods:t,duration:u,he:!0}}k=f.duration;t=f.periods;m&&(uC(t,q),g.m=!0,a.a.onEvent(new _.C(_.td)));(n||!m&&!f.he)&&g.Jb(k||Infinity);g.isLive()&&a.g.availabilityWindowOverride&&!isNaN(a.g.availabilityWindowOverride)&&(h=a.g.availabilityWindowOverride);null==h&&(h=Infinity);g.Yb=h;_.nu(g,l||1);g.isLive();
|
|
49
|
+
a.h||(a.h={presentationTimeline:g,periods:t,offlineSessionIds:[],minBufferTime:d||0});a.B=e})},BC=function(a,b,c,d){b.qa=CC(a,d.node,null,c);b.ca=d;b.qa.id||(a.f.info("No Period ID given for Period with start time "+d.start+", Assigning a default"),b.qa.id="__clpp_period_"+d.start);c=_.Gj(d.node,"EventStream");for(var e of c)DC(a,d.start,d.duration,e);e=_.Gj(d.node,_.ea).map(t=>EC(a,b,t)).filter(_.Qk);if(b.jc){c=[];for(var f of e)for(var g of f.Jf)c.push(g);if(c.length!=(new Set(c)).size)throw new _.G(_.F,
|
|
50
|
+
4,4018);}f=e.filter(t=>!t.Xd);g=e.filter(t=>t.Xd);for(var h of g){g=h.streams[0];e=h.Xd;for(var k of f)if(k.id==e)for(var l of k.streams)l.trickModeVideo=g}k=FC(f,_.v);l=FC(f,_.Vb);if(!k.length&&!l.length)throw new _.G(_.F,4,4004);l.length||(l=[null]);k.length||(k=[null]);h=[];for(var m of l)for(var n of k)GC(a,m,n,h);n=[...FC(f,_.r),...FC(f,_.At)];m=[];for(var q of n)m.push.apply(m,q.streams);q=FC(f,_.Yc);n=[];for(const t of q)n.push.apply(n,t.streams);return{startTime:d.start,textStreams:m,thumbStreams:n,
|
|
51
|
+
variants:h}},CC=function(a,b,c,d){c=c||{contentType:"",mimeType:"",codecs:"",emsgSchemeIdUris:[],frameRate:void 0,Cd:null};d=d||c.Ma;const e=_.Gj(b,"BaseURL").map(_.Ij);let f=b.getAttribute("contentType")||c.contentType;const g=b.getAttribute(_.pd)||c.mimeType,h=b.getAttribute(_.yc)||c.codecs,k=mB(b,"frameRate",tB)||c.frameRate;var l=_.Gj(b,"InbandEventStream");var m=c.emsgSchemeIdUris.slice();for(var n of l)l=n.getAttribute(ZA),m.includes(l)||m.push(l);n=_.Gj(b,"AudioChannelConfiguration");a=HC(a,
|
|
52
|
+
n)||c.Cd;f||(f=vC(g,h));return{Ma:_.au(d,e),Fc:_.Hj(b,"SegmentBase")||c.Fc,Ib:_.Hj(b,"SegmentList")||c.Ib,Zb:_.Hj(b,"SegmentTemplate")||c.Zb,width:mB(b,_.Se,sB)||c.width,height:mB(b,_.Wc,sB)||c.height,contentType:f,mimeType:g,codecs:h,frameRate:k,emsgSchemeIdUris:m,id:b.getAttribute("id"),Cd:a}},DC=function(a,b,c,d){const e=d.getAttribute(ZA)||"",f=d.getAttribute(_.Ae)||"",g=mB(d,aB,sB)||1;for(const k of _.Gj(d,"Event")){d=mB(k,"presentationTime",sB)||0;var h=mB(k,UA,sB)||0;d=d/g+b;h=d+h/g;null!=
|
|
53
|
+
c&&(d=Math.min(d,b+c),h=Math.min(h,b+c));let l=_.Mf;e.startsWith(_.we)?l=_.Of:"urn:mpeg:dash:event:callback:2015"===e&&(l=_.ud);const m={schemeIdUri:e,value:f,startTime:d,endTime:h,id:k.getAttribute("id")||"",type:l,eventElement:k};m.type===_.ud&&(m.Vc=()=>{if(m.eventElement){var n=m.eventElement.getAttribute("messageData")||"";n&&n.startsWith("http")&&(n=_.Hg(n),n.type=_.Gg,a.a.networkingEngine.fetch(n))}});a.a.onTimelineCueAdded(m)}},EC=function(a,b,c){b.oa=CC(a,c,b.qa,null);let d=!1;var e=_.Gj(c,
|
|
54
|
+
"Role");const f=e.map(T=>T.getAttribute(_.Ae)).filter(_.Qk);let g=null;var h=_.Gj(c,"Label").map(T=>T.textContent).filter(_.Qk);h&&0<h.length&&(g=h[h.length-1]);let k=void 0;(h=b.oa.contentType==_.r)&&(k=_.At);for(var l of e)if(e=l.getAttribute(ZA),null==e||"urn:mpeg:dash:role:2011"===e||"urn:mpeg:dash:role"===e)switch(e=l.getAttribute(_.Ae),e){case "main":d=!0;break;case "caption":case _.At:k=e}var m=_.Gj(c,KA);l=null;e=!1;for(var n of m)"http://dashif.org/guidelines/trickmode"==n.getAttribute(ZA)?
|
|
55
|
+
l=n.getAttribute(_.Ae):e=!0;n=_.Gj(c,"Accessibility");const q=new Map;for(var t of n)if(m=t.getAttribute(ZA),"urn:scte:dash:cc:cea-608:2015"==m||"urn:scte:dash:cc:cea-708:2015"==m){m=1;var u=t.getAttribute(_.Ae);if(null!=u)for(const T of u.split(";")){if(T.includes("\x3d")){var x=T.split("\x3d");u=x[0].startsWith("CC")?x[0]:"CC"+x[0];x=x[1].split(",")[0].split(":").pop()}else u="CC"+m,m+=2,x=T;q.set(u,_.Rg(x))}else q.set("CC1",_.ue)}if(e)return null;t=_.Gj(c,JA);const A=pC(t,a.g.ignoreDrmInfo,b.qa.id,
|
|
56
|
+
a.g.playreadyVersion||null),E=_.Rg(c.getAttribute("lang")||_.ue);null==g&&(g=c.getAttribute("label"));t=_.Gj(c,_.Ya);c=t.map(T=>IC(a,b,A,k,E,g,d,f,q,T)).filter(T=>!!T);if(0==c.length){if(h)return null;throw new _.G(_.F,4,4003);}if(!b.oa.contentType||b.oa.contentType==TA){b.oa.contentType=vC(c[0].mimeType,c[0].codecs);for(var D of c)D.type=b.oa.contentType}for(const T of c)for(const ia of A.drmInfos)T.keyId&&!ia.keyIds.includes(T.keyId)&&ia.keyIds.push(T.keyId);c=JC(c,b.oa.contentType,n);D=t.map(T=>
|
|
57
|
+
T.getAttribute("id")).filter(_.Qk);return{id:b.oa.id||"__fake__"+a.w++,contentType:b.oa.contentType,language:E,yd:d,streams:c,drmInfos:A.drmInfos,Xd:l,Jf:D}},FC=function(a,b){return a.filter(c=>c.contentType==b)},GC=function(a,b,c,d){if(b||c)if(b&&c){var e=b.drmInfos;var f=c.drmInfos;if(e.length&&f.length?0<_.Yt(e,f).length:1){f=_.Yt(b.drmInfos,c.drmInfos);for(var g of b.streams)for(const h of c.streams)e=(h.bandwidth||0)+(g.bandwidth||0),e={id:a.w++,language:b.language,primary:b.yd||c.yd,audio:g,
|
|
58
|
+
video:h,bandwidth:e,drmInfos:f,allowedByApplication:!0,allowedByKeySystem:!0},d.push(e)}}else{g=b||c;for(f of g.streams)e=f.bandwidth||0,e={id:a.w++,language:g.language||_.ue,primary:g.yd,audio:b?f:null,video:c?f:null,bandwidth:e,drmInfos:g.drmInfos,allowedByApplication:!0,allowedByKeySystem:!0},d.push(e)}},IC=function(a,b,c,d,e,f,g,h,k,l){b.O=CC(a,l,b.oa,null);if(!KC(a,b.O))return a.f.warn("Skipping Representation",b.O),null;b.Td=`${b.qa.id} ${b.O.id}`;b.Ac=a.C.get(b.Td);b.bandwidth=mB(l,"bandwidth",
|
|
59
|
+
rB)||0;let m;var n=b.O.contentType,q=n==_.r||n==TA,t=n==_.Yc;try{if(n=(u,x,A)=>LC(a,u,x,A),b.O.Fc)m=QB(b,n);else if(b.O.Ib)m=dC(b,a.F);else if(b.O.Zb)m=YB(b,n,a.F,!!a.h);else{const u=b.O.Ma,x=b.ca.duration||0;m={createSegmentIndex:()=>Promise.resolve(),findSegmentPosition:A=>0<=A&&A<x?1:null,getSegmentReference:A=>1!=A?null:new _.vu(1,0,x,()=>u,0,null,0),adjustSegmentDurations:()=>{},getLastSegmentEndTime:()=>x,getDuration:()=>x,initSegmentReference:null,xa:0}}}catch(u){if(q&&4002==u.code)return null;
|
|
60
|
+
throw u;}a.C.set(b.Td,m.xa);q=_.Gj(l,JA);q=sC(q,c,a.g.ignoreDrmInfo,b.qa.id,a.g.playreadyVersion||null);n=void 0;t&&(t=(t=(l=_.Hj(l,KA))&&l.getAttribute(ZA))||"",MC.includes(t)&&(l=(l=l.getAttribute(_.Ae))&&l.split("x").map(u=>parseInt(u,10)))&&2==l.length&&(m.horizontalTiles=l[0],m.verticalTiles=l[1],b.oa.Zb&&(l=m.horizontalTiles*m.verticalTiles,n=(n=mB(b.oa.Zb,UA,sB)||0)?n/l:void 0)));return{id:a.w++,originalId:b.O.id,createSegmentIndex:m.createSegmentIndex,findSegmentPosition:m.findSegmentPosition,
|
|
61
|
+
getSegmentReference:m.getSegmentReference,initSegmentReference:m.initSegmentReference,adjustSegmentDurations:m.adjustSegmentDurations,getLastSegmentEndTime:m.getLastSegmentEndTime,getDuration:m.getDuration,segmentLookupStrategy:_.st,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,keyId:q,language:e,label:f,type:b.oa.contentType,primary:g,trickModeVideo:null,emsgSchemeIdUris:b.O.emsgSchemeIdUris,
|
|
62
|
+
roles:h,channelsCount:b.O.Cd,closedCaptions:k,horizontalTiles:m.horizontalTiles,verticalTiles:m.verticalTiles,durationPerTile:n}},JC=function(a,b,c){const d=b===_.At?_.r:b;b=c.map(e=>({scheme:e.getAttribute(ZA)||"",id:e.getAttribute("id")||void 0,value:e.getAttribute(_.Ae)||"",protocol:"DASH",type:d}));for(const e of a)e.accessibility=b;return a},KC=function(a,b){let c;c=b.Fc?1:0;c+=b.Ib?1:0;c+=b.Zb?1:0;if(0==c){if(b.contentType==_.r||b.contentType==TA)return!0;a.f.warn("Representation does not contain a segment information source:",
|
|
63
|
+
"the Representation must contain one of SegmentBase, SegmentList,",'SegmentTemplate, or explicitly indicate that it is "text".',b);return!1}1!=c&&(a.f.warn("Representation contains multiple segment information sources:","the Representation should only contain one of SegmentBase,","SegmentList, or SegmentTemplate.",b),b.Fc?(a.f.info("Using SegmentBase by default."),b.Ib=null):a.f.info("Using SegmentList by default."),b.Zb=null);return!0},LC=function(a,b,c,d){return _.w(function*(){var e=_.ku(b,c,d,
|
|
64
|
+
a.g.attemptParameters);e.type=2;e=a.a.networkingEngine.fetch(e);_.lh(a.o,e);return(yield e.P).data})},HC=function(a,b){for(const d of b){b=d.getAttribute(ZA);if(!b)continue;const e=d.getAttribute(_.Ae);if(e)switch(b){case "urn:mpeg:dash:outputChannelPositionList:2012":return e.trim().split(/ +/).length;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.f.warn(IA,b,e);continue}return c;case "tag:dolby.com,2014:dash:audio_channel_configuration:2011":case "urn:dolby:dash:audio_channel_configuration:2011":c=
|
|
65
|
+
parseInt(e,16);if(!c){a.f.warn(IA,b,e);continue}for(a=0;c;)c&1&&++a,c>>=1;return a;default:a.f.warn("Unrecognized audio channel scheme:",b,e)}}return null},MC=["http://dashif.org/thumbnail_tile","http://dashif.org/guidelines/thumbnail_tile"];var KB=class{constructor(a){this.f=a;this.a=new _.Nj(a,!1)}},GB=[[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]],HB=class{constructor(a,b){this.id=a;this.a=b}};var RB=class{parse(a,b,c,d){var e;b=new KB(new DataView(b));if(440786851!=IB(b).id)throw _.Ff("Not an EBML element."),new _.G(_.F,3,3008);var f=IB(b);if(408125543!=f.id)throw _.Ff("Not a Segment element."),new _.G(_.F,3,3009);b=f.a.byteOffset;f=new KB(f.a);for(e=null;_.Li(f.a);){var g=IB(f);if(357149030==g.id){e=g;break}}if(!e)throw _.Ff("Not an Info element."),new _.G(_.F,3,3010);e=new KB(e.a);g=1E6;for(f=null;_.Li(e.a);){const h=IB(e);if(2807729==h.id)g=JB(h);else if(17545==h.id)if(f=h,4==f.a.byteLength)f=
|
|
66
|
+
f.a.getFloat32(0);else if(8==f.a.byteLength)f=f.a.getFloat64(0);else throw new _.G(_.F,3,3003);}if(null==f)throw new _.G(_.F,3,3011);e=g/=1E9;f*=g;a=IB(new KB(new DataView(a)));if(475249515!=a.id)throw _.Ff("Not a Cues element."),new _.G(_.F,3,3007);return MB(a,b,e,f,c,d)}};var NC=class{constructor(a,b){this.a=a;this.g=b;this.f={clockSyncUri:void 0}}};var iC=(new Map).set("urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b",_.Fd).set(fB,_.Dc).set(eB,_.Cc).set("urn:uuid:79f0049a-4098-8642-ab92-e65be0885f95",_.Cc).set("urn:uuid:94ce86fb-07ff-4f43-adb8-93d2fa968ca2",_.Bc).set("urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb",_.Ac),rC=(new Map).set(_.Dc,function(a){return(a=kB(a.node,"urn:microsoft","laurl"))?a.getAttribute("licenseUrl")||"":""}).set(_.Cc,function(a){a=kB(a.node,bB,"pro");if(!a)return"";a=_.ui(a.textContent);return _.Uj(a).g||""});var OC=class{constructor(){this.a=this.g=null;this.m=[];this.h=null;this.D=[];this.w=1;this.F={};this.j=0;this.H=new _.Py(5);this.A=new _.Dh(()=>{yC(this)});this.o=new _.ko;this.f=new _.N("clpp.dash.DashParser");this.B=null;this.I=new NC(this.f,(a,b)=>{a=_.Hg(a,this.g.attemptParameters);a.type=5;a.method=b;b=this.a.networkingEngine.fetch(a);_.lh(this.o,b);return b.P});this.C=new Map}configure(a){this.g=a;this.I.f={clockSyncUri:a.clockSyncUri}}start(a,b){const c=this;return _.w(function*(){c.m=[a];
|
|
67
|
+
c.a=b;const d=yield wC(c);c.a&&xC(c,d);if(!c.a)throw new _.G(_.F,7,7001);return c.h})}stop(){this.g=this.a=null;this.m=[];this.h=null;this.D=[];this.F={};this.B=null;this.j=-1;this.A.stop();this.C.clear();return this.o.destroy()}update(){wC(this).catch(a=>{if(this.a&&a)this.a.onError(a)})}onExpirationUpdated(){}setCurrentVariant(){}};_.y("clpp.dash.DashComponent",class extends _.bp{constructor(){super()}f(){_.cn.mpd=OC;_.an[_.Nb]=OC}a(){_.Du("mpd");_.Eu(_.Nb)}g(){}release(){}id(){return"dash"}});};f.call(g, window);
|