@castlabs/prestoplay 6.2.8 → 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 +81 -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 +111 -106
- package/cjs/cl.conviva.js +33 -32
- package/cjs/cl.core.js +413 -390
- package/cjs/cl.crypto.js +10 -10
- package/cjs/cl.dash.js +72 -69
- package/cjs/cl.externs.js +123 -69
- 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 -30
- package/cjs/cl.ima.js +23 -23
- package/cjs/cl.mse.js +259 -259
- package/cjs/cl.muxdata.js +12 -11
- package/cjs/cl.onboard.js +3 -3
- package/cjs/cl.persistent.js +14 -14
- package/cjs/cl.playlist.js +6 -5
- package/cjs/cl.smooth.js +70 -70
- package/cjs/cl.thumbnails.js +24 -23
- package/cjs/cl.tizen.js +71 -71
- 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 -18
- package/cl.adobe.js +3 -3
- package/cl.airplay.js +3 -3
- package/cl.broadpeak.js +5 -5
- package/cl.cast.js +88 -83
- package/cl.conviva.js +27 -27
- package/cl.core.js +360 -343
- package/cl.crypto.js +8 -8
- package/cl.dash.js +67 -64
- package/cl.externs.js +123 -69
- package/cl.freewheel.js +19 -19
- package/cl.hls.js +40 -37
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +25 -24
- package/cl.ima.js +16 -16
- package/cl.mse.js +233 -226
- package/cl.muxdata.js +8 -9
- package/cl.onboard.js +4 -4
- package/cl.persistent.js +10 -10
- package/cl.playlist.js +5 -4
- 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 +16 -15
- package/package.json +2 -2
package/cjs/cl.crypto.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var
|
|
3
|
-
r;r++)n[r]=128>r?r<<1:r<<1^283;for(r=0;256>r;r++){var
|
|
4
|
-
null;this.j=this.
|
|
5
|
-
7,7104,null,e)),
|
|
6
|
-
|
|
7
|
-
24]<<24|b[m>>>16&255]<<16|b[m>>>8&255]<<8|b[m&255],m^=d[e/this.a|0]<<24):6<this.a&&4===e%this.a&&(m=b[m>>>24]<<24|b[m>>>16&255]<<16|b[m>>>8&255]<<8|b[m&255]),l=(this.f[e-this.a]^m)>>>0,this.f[e]=l);for(a=0;a<this.g;a++)e=this.g-a,m=a&3?this.f[e]:this.f[e-4],this.h[a]=4>a||4>=e?m:c[b[m>>>24]]^f[b[m>>>16&255]]^g[b[m>>>8&255]]^
|
|
8
|
-
|
|
9
|
-
16&255]^m[
|
|
10
|
-
var
|
|
11
|
-
_.
|
|
2
|
+
var f=function(window){var aK=function(){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;var a=this.w,b=this.m,c=this.B,d=c[0],e=c[1],f=c[2];c=c[3];var g=this.j,h=g[0],l=g[1],m=g[2];g=g[3];var n=new Uint32Array(256),p=0,q=0,r;for(r=0;256>
|
|
3
|
+
r;r++)n[r]=128>r?r<<1:r<<1^283;for(r=0;256>r;r++){var w=q^q<<1^q<<2^q<<3^q<<4;w=w>>>8^w&255^99;a[p]=w;b[w]=p;var x=n[p],B=n[x],D=n[B],E=257*n[w]^16843008*w;d[p]=E<<24|E>>>8;e[p]=E<<16|E>>>16;f[p]=E<<8|E>>>24;c[p]=E;E=16843009*D^65537*B^257*x^16843008*p;h[w]=E<<24|E>>>8;l[w]=E<<16|E>>>16;m[w]=E<<8|E>>>24;g[w]=E;p?(p=x^n[n[n[D^x]]],q^=n[n[q]]):p=q=1}},bK=function(a){a=_.Yg(a);for(var b=new Uint32Array(4),c=0;4>c;c++)b[c]=a.getUint32(4*c);return b},cK=function(){this.a=null},dK=function(){this.f=this.l=
|
|
4
|
+
null;this.j=this.Cj.bind(this);this.h={};this.a=null;this.g=new _.H("clpp.crypto")},eK=function(a,b){var c,d;return _.A(function(e){if(1==e.a){if(a.h[b])return e["return"](a.h[b]);c=_.vh(b);return _.y(e,a.f.fetch(c).P,2)}d=e.f;a.h[b]=d.data;return e["return"](d.data)})},fK=function(a,b,c){var d,e,f,g;return _.A(function(h){switch(h.a){case 1:return d=new ArrayBuffer(0),_.wf(h,2),_.y(h,eK(a,c.url),4);case 4:d=h.f;_.xf(h,3);break;case 2:return e=_.yf(h),a.g.debug("Could not fetch key"),a.l.onError(new _.L(1,
|
|
5
|
+
7,7104,null,e)),h["return"](b);case 3:return _.wf(h,5),_.y(h,a.a.importKey(d),7);case 7:return _.y(h,a.a.decrypt(b,c.iv),8);case 8:return f=h.f,h["return"](f);case 5:return g=_.yf(h),a.g.warn("Could not decrypt segment data!",g),a.l.onError(new _.L(1,3,3103,null,g)),h["return"](b)}})};
|
|
6
|
+
aK.prototype.importKey=function(a){a=bK(a);for(var b=!0,c=0;c<a.length&&b;)b=a[c]===this.o[c],c++;if(b)return new Promise(function(n){return n()});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;var d=this.A;var e=this.j;c=e[0];var f=e[1],g=e[2],h=e[3],l=0,m=0;for(e=0;e<this.g;e++)e<this.a?l=this.f[e]=a[e]:(m=l,0===e%this.a?(m=m<<8|m>>>24,m=b[m>>>
|
|
7
|
+
24]<<24|b[m>>>16&255]<<16|b[m>>>8&255]<<8|b[m&255],m^=d[e/this.a|0]<<24):6<this.a&&4===e%this.a&&(m=b[m>>>24]<<24|b[m>>>16&255]<<16|b[m>>>8&255]<<8|b[m&255]),l=(this.f[e-this.a]^m)>>>0,this.f[e]=l);for(a=0;a<this.g;a++)e=this.g-a,m=a&3?this.f[e]:this.f[e-4],this.h[a]=4>a||4>=e?m:c[b[m>>>24]]^f[b[m>>>16&255]]^g[b[m>>>8&255]]^h[b[m&255]],this.h[a]>>>=0;return new Promise(function(n){return n()})};
|
|
8
|
+
aK.prototype.decrypt=function(a,b){var c=0,d=this.a+6,e=this.h,f=this.m,g=this.j,h=g[0],l=g[1],m=g[2];g=g[3];var n=bK(b),p=n[0],q=n[1],r=n[2];n=n[3];for(var w=_.Xg(a),x=new Int32Array(w.length),B,D,E,G,I,O,S,Ca,da,fa,xa,ha,qa,Ba=this.C.bind(this);c<w.length;){Ca=Ba(w[c]);da=Ba(w[c+1]);fa=Ba(w[c+2]);xa=Ba(w[c+3]);I=Ca^e[0];O=xa^e[1];S=fa^e[2];G=da^e[3];ha=4;for(qa=1;qa<d;qa++)B=h[I>>>24]^l[O>>16&255]^m[S>>8&255]^g[G&255]^e[ha],D=h[O>>>24]^l[S>>16&255]^m[G>>8&255]^g[I&255]^e[ha+1],E=h[S>>>24]^l[G>>
|
|
9
|
+
16&255]^m[I>>8&255]^g[O&255]^e[ha+2],G=h[G>>>24]^l[I>>16&255]^m[O>>8&255]^g[S&255]^e[ha+3],I=B,O=D,S=E,ha+=4;B=f[I>>>24]<<24^f[O>>16&255]<<16^f[S>>8&255]<<8^f[G&255]^e[ha];D=f[O>>>24]<<24^f[S>>16&255]<<16^f[G>>8&255]<<8^f[I&255]^e[ha+1];E=f[S>>>24]<<24^f[G>>16&255]<<16^f[I>>8&255]<<8^f[O&255]^e[ha+2];G=f[G>>>24]<<24^f[I>>16&255]<<16^f[O>>8&255]<<8^f[S&255]^e[ha+3];ha+=3;x[c]=Ba(B^p);x[c+1]=Ba(G^q);x[c+2]=Ba(E^r);x[c+3]=Ba(D^n);p=Ca;q=da;r=fa;n=xa;c+=4}return new Promise(function($a){var Ka=x.buffer;
|
|
10
|
+
var ab=Ka.byteLength,Db=ab&&(new DataView(Ka)).getUint8(ab-1);Ka=Db?Ka.slice(0,ab-Db):Ka;$a(Ka)})};aK.prototype.destroy=function(){this.A=this.h=this.f=this.j=this.B=this.m=this.w=this.g=this.a=this.o=null;return new Promise(function(a){return a()})};aK.prototype.C=function(a){return a<<24|(a&65280)<<8|(a&16711680)>>8|a>>>24};cK.prototype.importKey=function(a){var b=this,c;return _.A(function(d){if(1==d.a)return c=b,_.y(d,crypto.subtle.importKey("raw",a,{name:"AES-CBC"},!1,["decrypt"]),2);c.a=d.f;_.z(d)})};cK.prototype.decrypt=function(a,b){var c=this,d;return _.A(function(e){if(1==e.a)return _.y(e,crypto.subtle.decrypt({name:"AES-CBC",iv:b},c.a,a),2);d=e.f;return e["return"](d)})};cK.prototype.destroy=function(){this.a=null;return new Promise(function(a){return a()})};_.v(dK,_.Zn);_.t=dK.prototype;_.t.Ja=function(a){this.l=a};_.t.Ca=function(){this.l=null};_.t.Wb=function(){if(window.crypto&&crypto.subtle){var a=crypto.subtle.decrypt;a=typeof crypto.subtle.importKey===_.fd&&typeof a===_.fd}else a=!1;a?this.a=new cK:(this.g.warn("No WebCrypto APIs found. Will fallback to software AES"),this.a=new aK);this.f=this.l.getNetworkEngine();this.f.ae(this.j)};_.t.release=function(){this.f&&this.f.Qe(this.j);this.a&&(this.a.destroy(),this.a=null);this.f=null;this.h={}};
|
|
11
|
+
_.t.id=function(){return"crypto"};_.t.Cj=function(a){var b=this,c,d;return _.A(function(e){if(1==e.a){c=a.request||null;if(!c||2!==c.type||!c.keyInfo||!a.data)return e.H(2);b.g.debug("Decrypt data");d=a;return _.y(e,fK(b,a.data,c.keyInfo),4)}2!=e.a&&(d.data=e.f);return e["return"](a)})};_.C("clpp.crypto.CryptoComponent",dK);};
|
|
12
12
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
13
13
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
14
14
|
else{_=this.clpp._;(f.call(g,this));}
|
package/cjs/cl.dash.js
CHANGED
|
@@ -1,73 +1,76 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var
|
|
3
|
-
|
|
4
|
-
function(){return Promise.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Number(
|
|
8
|
-
"for identifier",'"'+
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
a.a
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
a.
|
|
22
|
-
e,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
a.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
g.
|
|
35
|
-
c.
|
|
36
|
-
(a.a.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
b&&(_.
|
|
41
|
-
n.
|
|
42
|
-
|
|
43
|
-
a.next();!c.done;c=a.next())(c=
|
|
44
|
-
keyId:c,init:0<e.length?e:null}}
|
|
45
|
-
a.f.attemptParameters),b.type=1,c=a.a.networkingEngine,d=Date.now(),e=c.fetch(b),_.
|
|
46
|
-
f);return _.
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
_.
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
2
|
+
var f=function(window){var SB="Channel parsing failure! Ignoring scheme and value",TB="ContentProtection",UB="EssentialProperty",VB="Failed to parse UTCTiming tags.",WB="Missing \x3cms:pro/\x3e node in ContentProtection element",XB="No UTCTiming elements found.",ZB="SegmentBase does not contain sufficient segment information:",$B="SegmentList does not contain sufficient segment information:",vC="SegmentTemplate does not contain sufficient segment information:",wC="SegmentTimeline",xC='The last "S" element cannot have a negative repeat',
|
|
3
|
+
yC="duration",zC="http://www.w3.org/1999/xlink",AC='ignoring the last "S" element.',BC='ignoring the remaining "S" elements.',CC="presentationTimeOffset",DC="schemeIdUri",EC="static",FC="timescale",GC="urn:microsoft:playready",HC="urn:mpeg:cenc:2013",IC="urn:mpeg:dash:utc:http-head:2014",JC="urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95",KC="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed",LC=function(a,b){a.w=Math.max(a.w,b);a.B.debug("notifyAvailabilityTimeOffset: maxAvailabilityTimeOffset\x3d"+a.w)},
|
|
4
|
+
MC=function(a){return new _.bi(Promise.reject(a),function(){return Promise.resolve()})},NC=function(a){return new _.bi(Promise.all(a.map(function(b){return b.P})),function(){return Promise.all(a.map(function(b){return b.abort()}))})},OC=function(a,b,c){return Array.prototype.filter.call(a.childNodes,function(d){return d instanceof Element&&d.localName==c&&d.namespaceURI==b})},PC=function(a,b,c){a=OC(a,b,c);return 1!=a.length?null:a[0]},QC=function(a,b,c){return a.hasAttributeNS(b,c)?a.getAttributeNS(b,
|
|
5
|
+
c):null},RC=function(a,b,c,d){d=void 0===d?null:d;var e=null;a=a.getAttribute(b);null!=a&&(e=c(a));return null==e?d:e},SC=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)},TC=function(a){if(!a)return null;var 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 _.F("Invalid duration string:",a),null;a=31536E3*Number(b[1]||null)+2592E3*Number(b[2]||
|
|
6
|
+
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},UC=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},VC=function(a){a=Number(a);return 0===a%1?a:null},WC=function(a){a=Number(a);return 0===a%1&&0<a?a:null},XC=function(a){a=Number(a);return 0===a%1&&0<=a?a:null},YC=function(a){var b;a=(b=a.match(/^(\d+)\/(\d+)$/))?
|
|
7
|
+
Number(b[1])/Number(b[2]):Number(a);return isNaN(a)?null:a},ZC=function(a,b){try{var c=_.ah(a);return _.Sk(c,b)}catch(d){return null}},$C=function(a,b){return a.reduce(function(c,d,e){return d["catch"](c.bind(null,e))}.bind(null,b),Promise.reject())},aD=function(a){var b=void 0===b?1024:b;if(!(a instanceof Uint8Array))return"";if(typeof b!==_.k||0>=b)b=1024;return(a.byteLength>b?a.subarray(0,b):a).toString()},bD=function(a,b,c,d,e){var f={RepresentationID:b,Number:c,Bandwidth:d,Time:e};return a.replace(/\$(RepresentationID|Number|Bandwidth|Time)?(?:%0([0-9]+)([diouxX]))?\$/g,
|
|
8
|
+
function(g,h,l,m){if("$$"==g)return"$";var n=f[h];if(null==n)return _.F("URL template does not have an available substitution ","for identifier",'"'+h+'":',a),g;"RepresentationID"==h&&l&&(_.F("URL template should not contain a width specifier for identifier",'"RepresentationID":',a),l=void 0);"Time"==h&&(n=Math.round(n));switch(m){case void 0:case "d":case "i":case "u":g=n.toString();break;case "o":g=n.toString(8);break;case "x":g=n.toString(16);break;case "X":g=n.toString(16).toUpperCase();break;
|
|
9
|
+
default:g=n.toString()}l=window.parseInt(l,10)||1;return Array(Math.max(0,l-g.length)+1).join("0")+g})},eD=function(a,b){var c=cD(a,b,FC),d=1;c&&(d=WC(c)||1);c=cD(a,b,yC);(c=WC(c||""))&&(c/=d);var e=Number(cD(a,b,CC))||0,f=e/d||0;a.si&&null!=a.cd&&a.cd!==f&&(_.F("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: ")+
|
|
10
|
+
(a.N.id+")")),e=a.cd*d,f=a.cd);var g=cD(a,b,"startNumber"),h=XC(g||"");if(null==g||null==h)h=1;g=cD(a,b,"endNumber");g=null!==g?XC(g||""):null;var l=dD(a,b,wC),m=null;if(l){m=d;var n=e,p=a.ba.duration||Infinity;l=_.Pk(l,"S");for(var q=[],r=0,w=0;w<l.length;++w){var x=l[w],B=RC(x,"t",XC),D=RC(x,"d",XC),E=RC(x,"r",VC);null!=B&&(B-=n);if(!D){_.F('"S" element must have a duration:',BC,x);break}B=null!=B?B:r;E=E||0;if(0>E)if(w+1<l.length){E=RC(l[w+1],"t",XC);if(null==E){_.F('An "S" element cannot have a negative repeat',
|
|
11
|
+
'if the next "S" element does not have a valid start time:',BC,x);break}else if(B>=E){_.F('An "S" element cannot have a negative repeat if its start ','time exceeds the next "S" element\'s start time:',BC,x);break}E=Math.ceil((E-B)/D)-1}else{if(Infinity==p){_.F(xC,"if the Period has an infinite duration:",AC,x);break}else if(B/m>=p){_.F(xC,"if its start time exceeds the Period's duration:",AC,x);break}E=Math.ceil((p*m-B)/D)-1}0<q.length&&B!=r&&(Math.abs((B-r)/m)>=_.hq&&_.F("SegmentTimeline contains a large gap/overlap:",
|
|
12
|
+
"the content may have errors in it.",x),q[q.length-1].end=B/m);for(x=0;x<=E;++x)r=B+D,q.push({start:B/m,end:r/m,Nj:B}),B=r}m=q}n=cD(a,b,"availabilityTimeOffset");p=Number(n||"");p=isNaN(p)?null:p;if(null==n||null==p)p=0;return{timescale:d,wa:c,kc:h,le:g,kb:f,af:e,timeline:m,be:p}},cD=function(a,b,c){return[b(a.N),b(a.na),b(a.qa)].filter(_.Yl).map(function(d){return d.getAttribute(c)}).reduce(function(d,e){return d||e})},dD=function(a,b,c){return[b(a.N),b(a.na),b(a.qa)].filter(_.Yl).map(function(d){return _.Qk(d,
|
|
13
|
+
c)}).reduce(function(d,e){return d||e})},gD=function(a,b,c,d,e,f){for(var g=QC(a,zC,"href"),h=QC(a,zC,"actuate")||"onRequest",l=0;l<a.attributes.length;l++){var m=a.attributes[l];m.namespaceURI==zC&&(a.removeAttributeNS(m.namespaceURI,m.localName),--l)}if(5<=f)return MC(new _.L(_.M,4,4028));if("onLoad"!=h)return MC(new _.L(_.M,4,4027));var n=_.jv([d],[g]);d=_.vh(n,b);d.type=1;return e.fetch(d).qd(function(p){p=ZC(p.data,a.tagName);if(!p)return MC(new _.L(_.M,4,4001,{uri:g}));for(;a.childNodes.length;)a.removeChild(a.childNodes[0]);
|
|
14
|
+
for(;p.childNodes.length;){var q=p.childNodes[0];p.removeChild(q);a.appendChild(q)}for(q=0;q<p.attributes.length;q++){var r=p.attributes[q].nodeName,w=p.getAttribute(r);a.setAttribute(r,w)}return fD(a,b,c,n[0],e,f+1)})},fD=function(a,b,c,d,e,f){f=void 0===f?0:f;if(QC(a,zC,"href")){var g=gD(a,b,c,d,e,f);c&&(g=g.qd(void 0,function(){return fD(a,b,c,d,e,f)}));return g}g=[];for(var h=0;h<a.childNodes.length;h++){var l=a.childNodes[h];l instanceof Element&&("urn:mpeg:dash:resolve-to-zero:2013"==QC(l,zC,
|
|
15
|
+
"href")?(a.removeChild(l),--h):l.tagName!=wC&&g.push(fD(l,b,c,d,e,f)))}return NC(g).qd(function(){return a})},iD=function(a,b,c,d){var e,f=(new _.Zj).V("sidx",function(h){e=hD(b,d,c,h)});a&&f.parse(a);if(e)return e;f=b+"-"+(b+a.byteLength-1);var g=c[0];a=_.R(a);_.Qf('Invalid box type. Expected "sidx", but received:',a,"from:",g,"byte range:",f);throw new _.L(_.M,3,3004,{url:g,fk:f,size:a.byteLength,tk:aD(a)});},hD=function(a,b,c,d){var e=[];d.F.skip(4);var f=_.U(d.F);if(0==f)throw _.Qf("Invalid timescale."),
|
|
16
|
+
new _.L(_.M,3,3005);if(0==d.version){var g=_.U(d.F);var h=_.U(d.F)}else g=_.Xj(d.F),h=_.Xj(d.F);d.F.skip(2);var l=_.Uj(d.F);a=a+d.size+h;for(h=0;h<l;h++){var m=_.U(d.F),n=(m&2147483648)>>>31;m&=2147483647;var p=_.U(d.F);d.F.skip(4);if(1==n)throw _.Qf("Hierarchical SIDXs are not supported."),new _.L(_.M,3,3006);e.push(new _.yv(e.length,g/f-b,(g+p)/f-b,function(){return c},a,a+m-1,b));g+=p;a+=m}d.Wa.stop();return e},jD=function(a){this.f=a;this.a=new _.Qj(a,!1)},nD=function(a){var b=kD(a);if(7<b.length)throw new _.L(_.M,
|
|
17
|
+
3,3002);for(var c=0,d=0;d<b.length;d++)c=256*c+b[d];b=c;c=kD(a);a:{d=_.u(lD);for(var e=d.next();!e.done;e=d.next())if(_.zj(c,new Uint8Array(e.value))){d=!0;break a}d=!1}if(d)c=a.f.byteLength-a.a.getPosition();else{if(8==c.length&&c[1]&224)throw new _.L(_.M,3,3001);d=c[0]&(1<<8-c.length)-1;for(e=1;e<c.length;e++)d=256*d+c[e];c=d}c=a.a.getPosition()+c<=a.f.byteLength?c:a.f.byteLength-a.a.getPosition();d=new DataView(a.f.buffer,a.f.byteOffset+a.a.getPosition(),c);a.a.skip(c);return new mD(b,d)},kD=function(a){var b=
|
|
18
|
+
_.Tj(a.a),c;for(c=1;8>=c&&!(b&1<<8-c);c++);if(8<c)throw new _.L(_.M,3,3002);var d=new Uint8Array(c);d[0]=b;for(b=1;b<c;b++)d[b]=_.Tj(a.a);return d},mD=function(a,b){this.id=a;this.a=b},oD=function(a){if(8<a.a.byteLength)throw new _.L(_.M,3,3002);if(8==a.a.byteLength&&a.a.getUint8(0)&224)throw new _.L(_.M,3,3001);for(var b=0,c=0;c<a.a.byteLength;c++){var d=a.a.getUint8(c);b=256*b+d}return b},pD=function(){},rD=function(a,b,c,d,e,f){function g(){return e}var h=[];a=new jD(a.a);for(var l=null,m=null;_.Rj(a.a);){var n=
|
|
19
|
+
nD(a);if(187==n.id){var p=qD(n);p&&(n=c*p.Oj,p=b+p.wj,null!=l&&h.push(new _.yv(h.length,l-f,n-f,g,m,p-1,f)),l=n,m=p)}}null!=l&&h.push(new _.yv(h.length,l-f,d-f,g,m,null,f));return h},qD=function(a){var b=new jD(a.a);a=nD(b);if(179!=a.id)throw _.F("Not a CueTime element."),new _.L(_.M,3,3013);a=oD(a);b=nD(b);if(183!=b.id)throw _.F("Not a CueTrackPositions element."),new _.L(_.M,3,3012);b=new jD(b.a);for(var c=0;_.Rj(b.a);){var d=nD(b);if(241==d.id){c=oD(d);break}}return{Oj:a,wj:c}},sD=function(a,b){var c=
|
|
20
|
+
dD(a,b,"Initialization");if(!c)return null;var d=a.N.Sa,e=c.getAttribute("sourceURL");e&&(d=_.jv(a.N.Sa,[e]));e=0;var f=null;if(c=RC(c,"range",UC))e=c.start,f=c.end;return new _.xv(function(){return d},e,f)},vD=function(a,b){var c=Number(cD(a,tD,CC))||0,d=cD(a,tD,FC),e=1;d&&(e=WC(d)||1);c=c/e||0;d=sD(a,tD);e=a.N.mimeType.split("/")[1];if(a.N.contentType!=_.ze&&e!=_.Ad&&"webm"!=e)throw _.Qf("SegmentBase specifies an unsupported container type.",a.N),new _.L(_.M,4,4006);if("webm"==e&&!d)throw _.Qf(ZB,
|
|
21
|
+
"the SegmentBase uses a WebM container,","but does not contain an Initialization element.",a.N),new _.L(_.M,4,4005);var f=dD(a,tD,"RepresentationIndex"),g=cD(a,tD,"indexRange"),h=a.N.Sa;g=UC(g||"");if(f){var l=f.getAttribute("sourceURL");l&&(h=_.jv(a.N.Sa,[l]));g=RC(f,"range",UC,g)}if(!g)throw _.Qf(ZB,"the SegmentBase does not contain @indexRange","or a RepresentationIndex element.",a.N),new _.L(_.M,4,4002);e=uD(a,b,d,h,g.start,g.end,e,c);return{createSegmentIndex:e.createSegmentIndex,findSegmentPosition:e.findSegmentPosition,
|
|
22
|
+
getSegmentReference:e.getSegmentReference,adjustSegmentDurations:e.adjustSegmentDurations,getDuration:e.getDuration,initSegmentReference:d,getLastSegmentEndTime:e.getLastSegmentEndTime,Aa:c}},uD=function(a,b,c,d,e,f,g,h){var l=a.presentationTimeline,m=!a.Cc||!a.ba.te,n=a.ba.start,p=a.ba.duration,q=b,r=null;return{createSegmentIndex:function(){var w,x,B,D,E,G;return _.A(function(I){if(1==I.a)return w=[q(d,e,f),"webm"==g?q(c.Ha(),c.Pa,c.Ea):null],q=null,_.y(I,Promise.all(w),2);x=I.f;B=x[0];D=x[1]||
|
|
23
|
+
null;E=null;g==_.Ad?E=iD(B,e,d,h):(G=new pD,E=G.parse(B,D,d,h));_.Cv(l,E,n);r=new _.Mv(E);m&&_.Qv(r,p);return I["return"](x)})},findSegmentPosition:function(w){return r.zc(w)},getSegmentReference:function(w){return r.get(w)},adjustSegmentDurations:function(w,x){return r.Oc(w,x)},getDuration:function(){return r.getDuration()},getLastSegmentEndTime:function(){return p}}},tD=function(a){return a.hd},CD=function(a,b,c,d){var e=wD(a),f=xD(a);yD(a,f);var g=null;if(f.$c)g=zD(a,b,e,f);else if(f.wa)d||(LC(a.presentationTimeline,
|
|
24
|
+
f.be),_.Dv(a.presentationTimeline,f.wa),_.Bv(a.presentationTimeline,a.ba.start)),g=AD(a,f);else{var h=null;b=null;a.qa.id&&a.N.id&&(b=a.qa.id+","+a.N.id,h=c[b]);d=BD(a,f);g=!a.Cc||!a.ba.te;h?(g&&_.Qv(new _.Mv(d),a.ba.duration),h.Va(d),_.Ov(h,_.Fv(a.presentationTimeline)-a.ba.start)):(_.Cv(a.presentationTimeline,d,a.ba.start),h=new _.Mv(d),b&&a.Cc&&(c[b]=h));g&&_.Qv(h,a.ba.duration);g={createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:h.zc.bind(h),getSegmentReference:h.get.bind(h),
|
|
25
|
+
adjustSegmentDurations:h.Oc.bind(h),getDuration:h.getDuration.bind(h),getLastSegmentEndTime:function(){return _.Nv(h)}}}return{createSegmentIndex:g.createSegmentIndex,findSegmentPosition:g.findSegmentPosition,getSegmentReference:g.getSegmentReference,adjustSegmentDurations:g.adjustSegmentDurations,getDuration:g.getDuration,initSegmentReference:e,getLastSegmentEndTime:g.getLastSegmentEndTime,Aa:f.kb}},DD=function(a){return a.ic},xD=function(a){var b=eD(a,DD),c=cD(a,DD,"media");a=cD(a,DD,"index");return{wa:b.wa,
|
|
26
|
+
timescale:b.timescale,kc:b.kc,le:b.le,kb:b.kb,af:b.af,timeline:b.timeline,Ae:c,$c:a,be:b.be}},yD=function(a,b){var c=b.$c?1:0;c+=b.timeline?1:0;c+=b.wa?1:0;if(0==c)throw _.Qf("SegmentTemplate does not contain any segment information:","the SegmentTemplate must contain either an index URL template","a SegmentTimeline, or a segment duration.",a.N),new _.L(_.M,4,4002);1!=c&&(_.F("SegmentTemplate contains multiple segment information sources:","the SegmentTemplate should only contain an index URL template,",
|
|
27
|
+
"a SegmentTimeline or a segment duration.",a.N),b.$c?(_.Of("Using the index URL template by default."),b.timeline=null):_.Of("Using the SegmentTimeline by default."),b.wa=null);if(!b.$c&&!b.Ae)throw _.Qf(vC,"the SegmentTemplate's media URL template is missing.",a.N),new _.L(_.M,4,4002);},zD=function(a,b,c,d){var e=a.N.mimeType.split("/")[1];if(e!=_.Ad&&"webm"!=e)throw _.Qf("SegmentTemplate specifies an unsupported container type.",a.N),new _.L(_.M,4,4006);if("webm"==e&&!c)throw _.Qf(vC,"the SegmentTemplate uses a WebM container,",
|
|
28
|
+
"but does not contain an initialization URL template.",a.N),new _.L(_.M,4,4005);var f=bD(d.$c,a.N.id,null,a.bandwidth||null,null);f=_.jv(a.N.Sa,[f]);return uD(a,b,c,f,0,null,e,d.kb)},AD=function(a,b){var c=a.ba.duration,d=b.wa,e=b.kc,f=b.le,g=b.timescale,h=b.Ae,l=a.bandwidth||null,m=a.N.id,n=a.N.Sa;return{createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:function(p){return 0>p||c&&p>=c?null:Math.floor(p/d)},getSegmentReference:function(p){var q=p+e;if(null!==f&&q>f)return null;
|
|
29
|
+
var r=p*d,w=r+d;c&&(w=Math.min(w,c));return 0>w||c&&r>=c?null:new _.yv(p,r,w,function(){var x=bD(h,m,q,l,r*g);return _.jv(n,[x])},0,null,b.kb)},adjustSegmentDurations:function(){},getDuration:function(){return c},getLastSegmentEndTime:function(){return c}}},BD=function(a,b){for(var c=[],d=0;d<b.timeline.length;d++){var e=d+b.kc;c.push(new _.yv(e,b.timeline[d].start,b.timeline[d].end,function(f,g,h,l,m,n){f=bD(f,g,m,h,n);return _.jv(l,[f]).map(function(p){return p.toString()})}.bind(null,b.Ae,a.N.id,
|
|
30
|
+
a.bandwidth||null,a.N.Sa,e,b.timeline[d].Nj+b.af),0,null,b.kb))}return c},wD=function(a){var b=cD(a,DD,"initialization");if(!b)return null;var c=a.N.id,d=a.bandwidth||null,e=a.N.Sa;return new _.xv(function(){var f=bD(b,c,null,d,null);return _.jv(e,[f])},0,null)},ID=function(a,b){var c=sD(a,ED),d=FD(a);GD(a,d);var e=null,f=null;a.qa.id&&a.N.id&&(f=a.qa.id+","+a.N.id,e=b[f]);var g=HD(a.ba.duration,d.kc,a.N.Sa,d);e?(e.Va(g),_.Ov(e,_.Fv(a.presentationTimeline)-a.ba.start)):(_.Cv(a.presentationTimeline,
|
|
31
|
+
g,a.ba.start),e=new _.Mv(g),f&&a.Cc&&(b[f]=e));a.Cc&&a.ba.te||_.Qv(e,a.ba.duration);return{createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:e.zc.bind(e),getSegmentReference:e.get.bind(e),adjustSegmentDurations:e.Oc.bind(e),getDuration:e.getDuration.bind(e),initSegmentReference:c,getLastSegmentEndTime:function(){return _.Nv(e)},Aa:d.kb}},ED=function(a){return a.Qb},FD=function(a){var b=JD(a);a=eD(a,ED);var c=a.kc;0==c&&(_.F("SegmentList@startNumber must be \x3e 0"),c=1);var d=0;
|
|
32
|
+
a.wa?d=a.wa*(c-1):a.timeline&&0<a.timeline.length&&(d=a.timeline[0].start);return{wa:a.wa,startTime:d,kc:c,kb:a.kb,timeline:a.timeline,ec:b}},GD=function(a,b){if(!b.wa&&!b.timeline&&1<b.ec.length)throw _.F($B,"the SegmentList specifies multiple segments,","but does not specify a segment duration or timeline.",a.N),new _.L(_.M,4,4002);if(!b.wa&&!a.ba.duration&&!b.timeline&&1==b.ec.length)throw _.F($B,"the SegmentList specifies one segment,","but does not specify a segment duration, period duration,",
|
|
33
|
+
"or timeline.",a.N),new _.L(_.M,4,4002);if(b.timeline&&0==b.timeline.length)throw _.F($B,"the SegmentList has an empty timeline.",a.N),new _.L(_.M,4,4002);},HD=function(a,b,c,d){var e=d.ec.length;d.timeline&&d.timeline.length!=d.ec.length&&(e=Math.min(d.timeline.length,d.ec.length),_.F("The number of items in the segment timeline and the number of","segment URLs do not match, truncating",d.ec.length,"to",e));for(var f=[],g=d.startTime,h={},l=0;l<e;h={Wd:h.Wd},l++){var m=d.ec[l];h.Wd=_.jv(c,[m.zi]);
|
|
34
|
+
var n=void 0;n=null!=d.wa?g+d.wa:d.timeline?d.timeline[l].end:g+a;f.push(new _.yv(l+b,g,n,function(p){return function(){return p.Wd}}(h),m.start,m.end,d.kb));g=n}return f},JD=function(a){return[a.N.Qb,a.na.Qb,a.qa.Qb].filter(_.Yl).map(function(b){return _.Pk(b,"SegmentURL")}).reduce(function(b,c){return 0<b.length?b:c}).map(function(b){b.getAttribute("indexRange")&&!a.se&&(a.se=!0,_.F("We do not support the SegmentURL@indexRange attribute on SegmentList. We only use the SegmentList@duration attribute or SegmentTimeline, which must be accurate."));
|
|
35
|
+
var c=b.getAttribute("media");b=RC(b,"mediaRange",UC,{start:0,end:null});return{zi:c,start:b.start,end:b.end}})},KD=function(a,b){this.a=a;this.g=b;this.f={clockSyncUri:void 0}},MD=function(a,b,c,d){var e,f;return _.A(function(g){switch(g.a){case 1:return e=_.Pk(b,"UTCTiming"),_.wf(g,2),_.y(g,LD(a,c,e),4);case 4:f=g.f;d.A=f;a.a.info("Clock synchronized. The difference between server and client clock was "+(f+" ms."));_.xf(g,3);break;case 2:_.yf(g),a.a.warn("Failed to synchronize clocks. This content may not play on clients with bad clocks!");
|
|
36
|
+
case 3:return g["return"](d)}})},LD=function(a,b,c){c=c.map(function(e){return{scheme:e.getAttribute(DC),value:e.getAttribute(_.Le)}});var d=a.f.clockSyncUri;!c.length&&d&&(a.a.info("No UTCTiming elements found, falling back on clockSyncUri from config to synchronize clocks."),c.push({scheme:IC,value:d}));return 0===c.length?(a.a.warn(XB),Promise.reject(Error(XB))):$C(c,function(e){var f=e.scheme;e=e.value;switch(f){case IC:case "urn:mpeg:dash:utc:http-head:2012":return ND(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 ND(a,
|
|
37
|
+
b,e,"GET");case "urn:mpeg:dash:utc:direct:2014":case "urn:mpeg:dash:utc:direct:2012":var g=Date.parse(e);return isNaN(g)?(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"](function(){a.a.warn(VB);
|
|
38
|
+
return Promise.reject(Error(VB))})},ND=function(a,b,c,d){var e,f,g,h;return _.A(function(l){if(1==l.a)return e=_.jv(b,[c]),_.y(l,a.g(e,d),2);f=l.f;if("HEAD"==d){if(!f.headers||!f.headers.date)throw a.a.warn("UTC timing response is missing","expected date header"),Error("Date HTTP header missing.");g=f.headers.date}else g=_.ah(f.data);h=Date.parse(g);if(isNaN(h))throw a.a.warn("Unable to parse date from UTC timing response"),Error("Date value invalid.");return l["return"](h-Date.now())})},PD=function(a,
|
|
39
|
+
b){return a.find(function(c){return OD.get(c.Bb)===b})},QD=function(a){var b=PC(a.node,GC,"pro");if(!b)return _.F(WB,a),null;a=_.wj(b.textContent);a=_.dl(a);a=_.Wk(a.a);return{keyId:null,Bb:KC,node:document.createElement("null"),init:[{initData:_.Su(a),initDataType:_.xc,keyId:null}]}},RD=function(a,b){b=void 0===b?"4.0.0.0":b;var c=PC(a.node,HC,"pssh");if(!c)return _.F("Missing \x3ccenc:pssh/\x3e node in ContentProtection element",a),null;c=_.wj(c.textContent);c=_.Xk(c);return c?(c=_.Tu(b,c.a))?{keyId:null,
|
|
40
|
+
Bb:JC,node:document.createElement("null"),init:[{initData:_.Su(c),initDataType:_.xc,keyId:null}]}:null:(_.F("Unable to parse WV PSSH data. Can not create PR data!"),null)},SD=function(a,b){var c=PC(a.node,GC,"pro");if(!c)return _.F(WB,a),null;c=_.wj(c.textContent);c=_.dl(c);return c.version!==b&&(_.Pf("Parsing from "+c.version+" to "+b+"."),c=_.Uu(c,b))?{keyId:null,Bb:JC,node:document.createElement("null"),init:[{initData:_.Su(c),initDataType:_.xc,keyId:null}]}:null},VD=function(a,b,c,d){var e=TD(a),
|
|
41
|
+
f=null;a=[];var g=[],h=PD(e,_.Nc),l=PD(e,_.Mc);if(l&&d){var m=SD(l,d);m&&(e[e.indexOf(l)]=m)}l&&!h&&(m=QD(l))&&e.push(m);h&&!l&&(d=RD(h,d||void 0))&&e.push(d);d=new Set(e.map(function(n){return n.keyId}));d["delete"](null);if(1<d.size)throw new _.L(_.M,4,4010);b||(g=e.filter(function(n){return"urn:mpeg:dash:mp4protection:2011"==n.Bb?(f=n.init||f,!1):!0}),g.length&&(a=UD(f,g,c),0==a.length&&(a=[_.kv(_.Fd,f,c)])));if(e.length&&(b||!g.length))for(a=[],b=_.u(OD.values()),e=b.next();!e.done;e=b.next())e=
|
|
42
|
+
e.value,e!=_.Od&&a.push(_.kv(e,f,c));if(c=Array.from(d)[0]||null)for(b=_.u(a),e=b.next();!e.done;e=b.next())for(e=_.u(e.value.initData),g=e.next();!g.done;g=e.next())g.value.keyId=c;return{Vc:c,ik:f,drmInfos:a,Df:!0}},WD=function(a,b,c,d,e){var f=VD(a,c,d,e);if(b.Df){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.Vc=f.Vc||b.Vc;b.Df=!1}else if(0<f.drmInfos.length&&(b.drmInfos=b.drmInfos.filter(function(g){return f.drmInfos.some(function(h){return h.keySystem==
|
|
43
|
+
g.keySystem})}),0==b.drmInfos.length))throw new _.L(_.M,4,4008);return f.Vc||b.Vc},UD=function(a,b,c){var d=[];b=_.u(b);for(var e=b.next();!e.done;e=b.next()){e=e.value;var f=OD.get(e.Bb);if(f){var g=_.kv(f,e.init||a,c);if(f=XD.get(f))g.licenseServerUri=f(e);d.push(g)}}return d},TD=function(a){var b=[];a=_.u(a);for(var c=a.next();!c.done;c=a.next())(c=YD(c.value))&&b.push(c);return b},YD=function(a){var b=a.getAttribute(DC),c=QC(a,HC,"default_KID"),d=OC(a,HC,"pssh").map(_.Rk);if(!b)return _.Qf("Missing required schemeIdUri attribute on",
|
|
44
|
+
"ContentProtection element",a),null;b=b.toLowerCase();if(c&&(c=c.replace(/-/g,"").toLowerCase(),c.includes(" ")))throw new _.L(_.M,4,4009);var e=[];try{e=d.map(function(f){return{initDataType:_.xc,initData:_.wj(f),keyId:null}})}catch(f){throw new _.L(_.M,4,4007);}return{node:a,Bb:b,keyId:c,init:0<e.length?e:null}},$D=function(){var a=this;this.a=this.g=null;this.m=[];this.h=null;this.D=[];this.w=1;this.G={};this.j=0;this.I=new _.sv(5);this.A=new _.Ch(function(){ZD(a)});this.o=new _.ei;this.f=new _.H("clpp.dash.DashParser");
|
|
45
|
+
this.B=null;this.J=new KD(this.f,function(b,c){var d=_.vh(b,a.g.attemptParameters);d.type=5;d.method=c;d=a.a.networkingEngine.fetch(d);_.fi(a.o,d);return d.P});this.C=new Map},bE=function(a){var b,c,d,e,f,g,h;return _.A(function(l){if(1==l.a)return b=_.vh(a.m,a.g.attemptParameters),b.type=1,c=a.a.networkingEngine,d=Date.now(),e=c.fetch(b),_.fi(a.o,e),_.y(l,e.P,2);if(3!=l.a){f=l.f;if(!a.a)return l["return"](0);f.uri&&!a.m.includes(f.uri)&&a.m.unshift(f.uri);return _.y(l,aE(a,f.data,f.uri),3)}g=Date.now();
|
|
46
|
+
h=(g-d)/1E3;_.uv(a.I,1,h);return l["return"](h)})},aE=function(a,b,c){var d,e,f,g;return _.A(function(h){if(1==h.a){d=ZC(b,"MPD");if(!d)throw new _.L(_.M,4,4001,c);e=a.g.xlinkFailGracefully;f=fD(d,a.g.attemptParameters,e,c,a.a.networkingEngine);_.fi(a.o,f);return _.y(h,f.P,2)}g=h.f;return h["return"](cE(a,g,c))})},cE=function(a,b,c){var d,e,f,g,h,l,m,n,p,q,r,w,x,B,D,E,G,I,O,S,Ca,da;return _.A(function(fa){if(1==fa.a){d=[c];e=_.Pk(b,"Location").map(_.Rk).filter(_.Yl);0<e.length&&(f=_.jv(d,e),d=a.m=
|
|
47
|
+
f);g=_.Pk(b,"BaseURL").map(_.Rk);h=_.jv(d,g);l=RC(b,"minBufferTime",TC,0);m=b.getAttribute("type")||EC;a.j=RC(b,"minimumUpdatePeriod",TC,-1);m===EC&&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());n=RC(b,"availabilityStartTime",SC);p=RC(b,"timeShiftBufferDepth",TC);q=RC(b,"suggestedPresentationDelay",TC);r=RC(b,"maxSegmentDuration",TC);if(w=m===EC&&"dynamic"===a.B)a.f.info("MPD dynamic to static transition."),
|
|
48
|
+
m="dynamic";x=m===EC;B="dynamic"===m;if(a.h)return D=a.h.presentationTimeline,fa.H(2);E=3*l;G=null!=q?q:E;D=new _.zv(n,G,m===EC,!!a.g.autoCorrectDrift);return B?_.y(fa,MD(a.J,b,h,D),4):fa.H(2)}if(2!=fa.a&&(D=fa.f,!a.a))return fa["return"]();I={Cc:B,presentationTimeline:D,qa:null,ba:null,na:null,N:null,bandwidth:0,se:!1,si:w,We:null,cd:null};var xa=RC(b,"mediaPresentationDuration",TC);for(var ha=[],qa=0,Ba=_.Pk(b,"Period"),$a=0;$a<Ba.length;$a++){var Ka=Ba[$a];qa=RC(Ka,_.ne,TC,qa);var ab=RC(Ka,yC,
|
|
49
|
+
TC),Db=null;if($a!=Ba.length-1){var le=RC(Ba[$a+1],_.ne,TC);null!=le&&(Db=le-qa)}else null!=xa&&(Db=xa-qa);le=_.hq;Db&&ab&&Math.abs(Db-ab)>le&&a.f.warn("There is a gap/overlap between Periods",Ka);null==Db&&(Db=ab);Ka=dE(a,I,h,{start:qa,duration:Db,node:Ka,te:null==Db||$a==Ba.length-1});ha.push(Ka);ab=I.qa.id;a.D.includes(ab)||(a.D.push(ab),a.h&&(a.a.filterNewPeriod(Ka),a.h.periods.push(Ka)));if(null==Db){$a!=Ba.length-1&&a.f.warn("Skipping Period",$a+1,"and any subsequent Periods:","Period",$a+1,
|
|
50
|
+
"does not have a valid start time.",ha[$a+1]);qa=null;break}qa+=Db}null==a.h&&a.a.filterAllPeriods(ha);null!=xa?(qa!=xa&&a.f.warn("@mediaPresentationDuration does not match the total duration of ","all Periods."),xa={periods:ha,duration:xa,zf:!1}):xa={periods:ha,duration:qa,zf:!0};O=xa;S=O.duration;Ca=O.periods;w&&(eE(Ca,I),D.m=!0,a.a.onEvent(new _.J(_.Bd)));(x||!w&&!O.zf)&&D.Rb(S||Infinity);(da=D.isLive())&&a.g.availabilityWindowOverride&&!isNaN(a.g.availabilityWindowOverride)&&(p=a.g.availabilityWindowOverride);
|
|
51
|
+
null==p&&(p=Infinity);D.hc=p;_.Dv(D,r||1);D.isLive();a.h||(a.h={presentationTimeline:D,periods:Ca,offlineSessionIds:[],minBufferTime:l||0});a.B=m;_.z(fa)})},dE=function(a,b,c,d){b.qa=fE(a,d.node,null,c);b.ba=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=_.Pk(d.node,"EventStream");c=_.u(c);for(var e=c.next();!e.done;e=c.next())gE(a,d.start,d.duration,e.value);e=_.Pk(d.node,_.ja).map(function(n){return hE(a,
|
|
52
|
+
b,n)}).filter(_.Yl);if(b.Cc){c=[];for(var f=_.u(e),g=f.next();!g.done;g=f.next()){g=_.u(g.value.Aj);for(var h=g.next();!h.done;h=g.next())c.push(h.value)}if(c.length!=(new Set(c)).size)throw new _.L(_.M,4,4018);}c=e.filter(function(n){return!n.$e});e=e.filter(function(n){return n.$e});e=_.u(e);for(f=e.next();!f.done;f=e.next()){g=f.value;f=g.streams[0];g=g.$e;h=_.u(c);for(var l=h.next();!l.done;l=h.next())if(l=l.value,l.id==g){l=_.u(l.streams);for(var m=l.next();!m.done;m=l.next())m.value.trickModeVideo=
|
|
53
|
+
f}}f=iE(c,_.Oe);g=iE(c,_.gc);if(!f.length&&!g.length)throw new _.L(_.M,4,4004);g.length||(g=[null]);f.length||(f=[null]);e=[];g=_.u(g);for(h=g.next();!h.done;h=g.next())for(h=h.value,l=_.u(f),m=l.next();!m.done;m=l.next())jE(a,h,m.value,e);g=_.jf(iE(c,_.ze)).concat(_.jf(iE(c,_.ve)));f=[];g=_.u(g);for(h=g.next();!h.done;h=g.next())f.push.apply(f,h.value.streams);g=iE(c,_.id);c=[];g=_.u(g);for(h=g.next();!h.done;h=g.next())c.push.apply(c,h.value.streams);return{startTime:d.start,textStreams:f,thumbStreams:c,
|
|
54
|
+
variants:e}},iE=function(a,b){return a.filter(function(c){return c.contentType==b})},jE=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<_.gv(e,f).length:1){f=_.gv(b.drmInfos,c.drmInfos);var g=_.u(b.streams);for(e=g.next();!e.done;e=g.next()){var h=e.value,l=_.u(c.streams);for(e=l.next();!e.done;e=l.next()){var m=e.value;e=(m.bandwidth||0)+(h.bandwidth||0);e={id:a.w++,language:b.language,primary:b.ze||c.ze,audio:h,video:m,bandwidth:e,drmInfos:f,allowedByApplication:!0,
|
|
55
|
+
allowedByKeySystem:!0};d.push(e)}}}}else for(f=b||c,g=_.u(f.streams),e=g.next();!e.done;e=g.next())h=e.value,e=h.bandwidth||0,e={id:a.w++,language:f.language||_.Fe,primary:f.ze,audio:b?h:null,video:c?h:null,bandwidth:e,drmInfos:f.drmInfos,allowedByApplication:!0,allowedByKeySystem:!0},d.push(e)},hE=function(a,b,c){b.na=fE(a,c,b.qa,null);var d=!1,e=_.Pk(c,"Role"),f=e.map(function(I){return I.getAttribute(_.Le)}).filter(_.Yl),g=null,h=_.Pk(c,"Label").map(function(I){return I.textContent}).filter(_.Yl);
|
|
56
|
+
h&&0<h.length&&(g=h[h.length-1]);var l=void 0;(h=b.na.contentType==_.ze)&&(l=_.ve);e=_.u(e);for(var m=e.next();!m.done;m=e.next()){m=m.value;var n=m.getAttribute(DC);if(null==n||"urn:mpeg:dash:role:2011"===n||"urn:mpeg:dash:role"===n)switch(m=m.getAttribute(_.Le),m){case "main":d=!0;break;case "caption":case _.ve:l=m}}m=_.Pk(c,UB);e=null;n=!1;m=_.u(m);for(var p=m.next();!p.done;p=m.next()){var q=p.value;"http://dashif.org/guidelines/trickmode"==q.getAttribute(DC)?e=q.getAttribute(_.Le):n=!0}m=_.Pk(c,
|
|
57
|
+
"Accessibility");var r=new Map;q=_.u(m);for(p=q.next();!p.done;p=q.next()){var w=p.value;p=w.getAttribute(DC);if("urn:scte:dash:cc:cea-608:2015"==p||"urn:scte:dash:cc:cea-708:2015"==p)if(p=1,w=w.getAttribute(_.Le),null!=w){w=_.u(w.split(";"));for(var x=w.next();!x.done;x=w.next()){var B=x.value,D=x=void 0;B.includes("\x3d")?(B=B.split("\x3d"),x=B[0].startsWith("CC")?B[0]:"CC"+B[0],D=B[1].split(",")[0].split(":").pop()):(x="CC"+p,p+=2,D=B);r.set(x,_.Gh(D))}}else r.set("CC1",_.Fe)}if(n)return null;
|
|
58
|
+
n=_.Pk(c,TB);var E=VD(n,a.g.ignoreDrmInfo,b.qa.id,a.g.playreadyVersion||null),G=_.Gh(c.getAttribute("lang")||_.Fe);null==g&&(g=c.getAttribute("label"));n=_.Pk(c,_.ib);c=n.map(function(I){return kE(a,b,E,l,G,g,d,f,r,I)}).filter(function(I){return!!I});if(0==c.length){if(h)return null;throw new _.L(_.M,4,4003);}if(!b.na.contentType||b.na.contentType==_.Xb)for(b.na.contentType=lE(c[0].mimeType,c[0].codecs),h=_.u(c),q=h.next();!q.done;q=h.next())q.value.type=b.na.contentType;h=_.u(c);for(q=h.next();!q.done;q=
|
|
59
|
+
h.next())for(q=q.value,p=_.u(E.drmInfos),w=p.next();!w.done;w=p.next())w=w.value,q.keyId&&!w.keyIds.includes(q.keyId)&&w.keyIds.push(q.keyId);c=mE(c,b.na.contentType,m);h=n.map(function(I){return I.getAttribute("id")}).filter(_.Yl);return{id:b.na.id||"__fake__"+a.w++,contentType:b.na.contentType,language:G,ze:d,streams:c,drmInfos:E.drmInfos,$e:e,Aj:h}},mE=function(a,b,c){var d=b===_.ve?_.ze:b;b=c.map(function(f){return{scheme:f.getAttribute(DC)||"",id:f.getAttribute("id")||void 0,value:f.getAttribute(_.Le)||
|
|
60
|
+
"",protocol:"DASH",type:d}});c=_.u(a);for(var e=c.next();!e.done;e=c.next())e.value.accessibility=b;return a},kE=function(a,b,c,d,e,f,g,h,l,m){b.N=fE(a,m,b.na,null);if(!nE(a,b.N))return a.f.warn("Skipping Representation",b.N),null;b.We=b.qa.id+" "+b.N.id;b.cd=a.C.get(b.We);b.bandwidth=RC(m,"bandwidth",WC)||0;var n=b.N.contentType,p=n==_.ze||n==_.Xb,q=n==_.id;try{if(n=function(B,D,E){return oE(a,B,D,E)},b.N.hd)var r=vD(b,n);else if(b.N.Qb)r=ID(b,a.G);else if(b.N.ic)r=CD(b,n,a.G,!!a.h);else{var w=b.N.Sa,
|
|
61
|
+
x=b.ba.duration||0;r={createSegmentIndex:function(){return Promise.resolve()},findSegmentPosition:function(B){return 0<=B&&B<x?1:null},getSegmentReference:function(B){return 1!=B?null:new _.yv(1,0,x,function(){return w},0,null,0)},adjustSegmentDurations:function(){},getLastSegmentEndTime:function(){return x},getDuration:function(){return x},initSegmentReference:null,Aa:0}}}catch(B){if(p&&4002==B.code)return null;throw B;}a.C.set(b.We,r.Aa);p=_.Pk(m,TB);p=WD(p,c,a.g.ignoreDrmInfo,b.qa.id,a.g.playreadyVersion||
|
|
62
|
+
null);n=void 0;q&&(q=(m=_.Qk(m,UB))&&m.getAttribute(DC),pE.includes(q||"")&&(m=(m=m.getAttribute(_.Le))&&m.split("x").map(function(B){return parseInt(B,10)}))&&2==m.length&&(r.horizontalTiles=m[0],r.verticalTiles=m[1],b.na.ic&&(m=r.horizontalTiles*r.verticalTiles,n=(n=RC(b.na.ic,yC,XC)||0)?n/m:void 0)));return{id:a.w++,originalId:b.N.id,createSegmentIndex:r.createSegmentIndex,findSegmentPosition:r.findSegmentPosition,getSegmentReference:r.getSegmentReference,initSegmentReference:r.initSegmentReference,
|
|
63
|
+
adjustSegmentDurations:r.adjustSegmentDurations,getLastSegmentEndTime:r.getLastSegmentEndTime,getDuration:r.getDuration,segmentLookupStrategy:_.Fu,mimeType:b.N.mimeType,codecs:b.N.codecs,frameRate:b.N.frameRate,bandwidth:b.bandwidth,width:b.N.width,height:b.N.height,kind:d,encrypted:0<c.drmInfos.length,keyId:p,language:e,label:f,type:b.na.contentType,primary:g,trickModeVideo:null,emsgSchemeIdUris:b.N.emsgSchemeIdUris,roles:h,channelsCount:b.N.Ce,closedCaptions:l,horizontalTiles:r.horizontalTiles,
|
|
64
|
+
verticalTiles:r.verticalTiles,durationPerTile:n}},ZD=function(a){var b,c,d;_.A(function(e){switch(e.a){case 1:return a.f.debug(_.yu),b=0,_.wf(e,2),_.y(e,bE(a),4);case 4:b=e.f;_.xf(e,3);break;case 2:if(c=_.yf(e),a.a&&c.a&&(a.a.onError(c),d=c,d.severity===_.M))return e["return"]();case 3:if(!a.a)return e["return"]();qE(a,b);_.z(e)}})},qE=function(a,b){0>a.j||a.A.$(Math.max(3,a.j-b,_.vv(a.I)))},fE=function(a,b,c,d){c=c||{contentType:"",mimeType:"",codecs:"",emsgSchemeIdUris:[],frameRate:void 0,Ce:null};
|
|
65
|
+
d=d||c.Sa;var e=_.Pk(b,"BaseURL").map(_.Rk),f=b.getAttribute("contentType")||c.contentType,g=b.getAttribute(_.xd)||c.mimeType,h=b.getAttribute(_.Ic)||c.codecs,l=RC(b,"frameRate",YC)||c.frameRate,m=_.Pk(b,"InbandEventStream"),n=c.emsgSchemeIdUris.slice();m=_.u(m);for(var p=m.next();!p.done;p=m.next())p=p.value.getAttribute(DC),n.includes(p)||n.push(p);m=_.Pk(b,"AudioChannelConfiguration");a=rE(a,m)||c.Ce;f||(f=lE(g,h));return{Sa:_.jv(d,e),hd:_.Qk(b,"SegmentBase")||c.hd,Qb:_.Qk(b,"SegmentList")||c.Qb,
|
|
66
|
+
ic:_.Qk(b,"SegmentTemplate")||c.ic,width:RC(b,_.cf,XC)||c.width,height:RC(b,_.gd,XC)||c.height,contentType:f,mimeType:g,codecs:h,frameRate:l,emsgSchemeIdUris:n,id:b.getAttribute("id"),Ce:a}},rE=function(a,b){for(var c=_.u(b),d=c.next();!d.done;d=c.next()){var e=d.value;if(d=e.getAttribute(DC))if(e=e.getAttribute(_.Le))switch(d){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 f=
|
|
67
|
+
parseInt(e,10);if(!f){a.f.warn(SB,d,e);continue}return f;case "tag:dolby.com,2014:dash:audio_channel_configuration:2011":case "urn:dolby:dash:audio_channel_configuration:2011":f=parseInt(e,16);if(!f){a.f.warn(SB,d,e);continue}for(c=0;f;)f&1&&++c,f>>=1;return c;default:a.f.warn("Unrecognized audio channel scheme:",d,e)}}return null},nE=function(a,b){var c=b.hd?1:0;c+=b.Qb?1:0;c+=b.ic?1:0;if(0==c){if(b.contentType==_.ze||b.contentType==_.Xb)return!0;a.f.warn("Representation does not contain a segment information source:",
|
|
68
|
+
"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.hd?(a.f.info("Using SegmentBase by default."),b.Qb=null):a.f.info("Using SegmentList by default."),b.ic=null);return!0},gE=function(a,b,c,d){var e=d.getAttribute(DC)||"",f=d.getAttribute(_.Le)||
|
|
69
|
+
"",g=RC(d,FC,XC)||1,h={};d=_.u(_.Pk(d,"Event"));for(var l=d.next();!l.done;h={pc:h.pc},l=d.next()){l=l.value;var m=RC(l,"presentationTime",XC)||0,n=RC(l,yC,XC)||0;m=m/g+b;n=m+n/g;null!=c&&(m=Math.min(m,b+c),n=Math.min(n,b+c));var p=_.jg;e.startsWith(_.He)?p=_.lg:"urn:mpeg:dash:event:callback:2015"===e&&(p=_.Dd);h.pc={schemeIdUri:e,value:f,startTime:m,endTime:n,id:l.getAttribute("id")||"",type:p,eventElement:l};h.pc.type===_.Dd&&(h.pc.Ld=function(q){return function(){var r=q.pc;r.eventElement&&(r=
|
|
70
|
+
r.eventElement.getAttribute("messageData")||"")&&r.startsWith("http")&&(r=_.vh(r),r.type=_.uh,a.a.networkingEngine.fetch(r))}}(h));a.a.onTimelineCueAdded(h.pc)}},oE=function(a,b,c,d){var e,f,g,h;return _.A(function(l){if(1==l.a)return e=_.wv(b,c,d,a.g.attemptParameters),e.type=2,f=a.a.networkingEngine,g=f.fetch(e),_.fi(a.o,g),_.y(l,g.P,2);h=l.f;return l["return"](h.data)})},lE=function(a,b){return _.aw(_.Jh(a,b))?_.ze:a.split("/")[0]},sE=function(a){var b=new Set;a.forEach(function(c){c.variants.forEach(function(d){d.audio&&
|
|
71
|
+
b.add(d.audio);d.video&&b.add(d.video)})});return Array.from(b)},eE=function(a,b){sE(a).forEach(function(c){c=c.getLastSegmentEndTime?c.getLastSegmentEndTime():0;if(0<c){var d=b.presentationTimeline;d.f=Math.max(d.f||0,c+b.ba.start)}})},tE=function(){},pE=["http://dashif.org/thumbnail_tile","http://dashif.org/guidelines/thumbnail_tile"];var lD=[[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]];pD.prototype.parse=function(a,b,c,d){b=new jD(new DataView(b));if(440786851!=nD(b).id)throw _.Qf("Not an EBML element."),new _.L(_.M,3,3008);var e=nD(b);if(408125543!=e.id)throw _.Qf("Not a Segment element."),new _.L(_.M,3,3009);b=e.a.byteOffset;e=new jD(e.a);for(var f=null;_.Rj(e.a);){var g=nD(e);if(357149030==g.id){f=g;break}}if(!f)throw _.Qf("Not an Info element."),new _.L(_.M,3,3010);f=new jD(f.a);g=1E6;for(e=null;_.Rj(f.a);){var h=nD(f);if(2807729==h.id)g=oD(h);else if(17545==h.id)if(4==h.a.byteLength)e=
|
|
72
|
+
h.a.getFloat32(0);else if(8==h.a.byteLength)e=h.a.getFloat64(0);else throw new _.L(_.M,3,3003);}if(null==e)throw new _.L(_.M,3,3011);f=g/1E9;e*=f;a=nD(new jD(new DataView(a)));if(475249515!=a.id)throw _.Qf("Not a Cues element."),new _.L(_.M,3,3007);return rD(a,b,f,e,c,d)};var OD=(new Map).set("urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b",_.Od).set(KC,_.Nc).set(JC,_.Mc).set("urn:uuid:79f0049a-4098-8642-ab92-e65be0885f95",_.Mc).set("urn:uuid:94ce86fb-07ff-4f43-adb8-93d2fa968ca2",_.Lc).set("urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb",_.Kc),XD=(new Map).set(_.Nc,function(a){return(a=PC(a.node,"urn:microsoft","laurl"))?a.getAttribute("licenseUrl")||"":""}).set(_.Mc,function(a){a=PC(a.node,GC,"pro");if(!a)return"";a=_.wj(a.textContent);return _.dl(a).g||""});_.t=$D.prototype;_.t.configure=function(a){this.g=a;this.J.f={clockSyncUri:a.clockSyncUri}};_.t.start=function(a,b){var c=this,d;return _.A(function(e){if(1==e.a)return c.m=[a],c.a=b,_.y(e,bE(c),2);d=e.f;c.a&&qE(c,d);if(!c.a)throw new _.L(_.M,7,7001);return e["return"](c.h)})};_.t.stop=function(){this.g=this.a=null;this.m=[];this.h=null;this.D=[];this.G={};this.B=null;this.j=-1;this.A.stop();this.C.clear();return this.o.destroy()};
|
|
73
|
+
_.t.update=function(){var a=this;bE(this)["catch"](function(b){if(a.a&&b)a.a.onError(b)})};_.t.onExpirationUpdated=function(){};_.t.setCurrentVariant=function(){};_.v(tE,_.Zn);_.t=tE.prototype;_.t.Ja=function(){_.Zo.mpd=$D;_.Xo[_.Zb]=$D};_.t.Ca=function(){_.Vv("mpd");_.Wv(_.Zb)};_.t.Wb=function(){};_.t.release=function(){};_.t.id=function(){return"dash"};_.C("clpp.dash.DashComponent",tE);};
|
|
71
74
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
72
75
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
73
76
|
else{_=this.clpp._;(f.call(g,this));}
|