@castlabs/prestoplay 6.9.0 → 6.10.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 +39 -0
- package/cjs/cl.adobe.js +3 -3
- package/cjs/cl.airplay.js +3 -3
- package/cjs/cl.broadpeak.js +6 -6
- package/cjs/cl.cast.js +105 -104
- package/cjs/cl.conviva.js +33 -33
- package/cjs/cl.core.js +420 -417
- package/cjs/cl.crypto.js +10 -9
- package/cjs/cl.dash.js +71 -71
- package/cjs/cl.externs.js +11 -12
- package/cjs/cl.freewheel.js +21 -21
- package/cjs/cl.hls.js +72 -71
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +29 -31
- package/cjs/cl.ima.js +22 -22
- package/cjs/cl.mse.js +273 -272
- package/cjs/cl.muxdata.js +14 -15
- package/cjs/cl.onboard.js +3 -3
- package/cjs/cl.persistent.js +13 -13
- package/cjs/cl.playlist.js +6 -6
- package/cjs/cl.smooth.js +71 -71
- package/cjs/cl.thumbnails.js +24 -24
- package/cjs/cl.tizen.js +68 -68
- package/cjs/cl.ttml.js +27 -27
- package/cjs/cl.verimatrix.js +5 -5
- package/cjs/cl.vimond.js +13 -13
- package/cjs/cl.vr.js +19 -19
- package/cjs/cl.vtt.js +14 -14
- package/cjs/cl.youbora.js +16 -16
- package/cl.adobe.js +3 -3
- package/cl.airplay.js +3 -3
- package/cl.broadpeak.js +5 -5
- package/cl.cast.js +87 -87
- package/cl.conviva.js +27 -27
- package/cl.core.js +363 -359
- package/cl.crypto.js +9 -9
- package/cl.dash.js +67 -67
- package/cl.externs.js +11 -12
- package/cl.freewheel.js +17 -17
- package/cl.hls.js +61 -61
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +26 -25
- package/cl.ima.js +17 -17
- package/cl.mse.js +235 -236
- package/cl.muxdata.js +12 -12
- package/cl.onboard.js +4 -4
- package/cl.persistent.js +9 -9
- package/cl.playlist.js +5 -5
- package/cl.smooth.js +59 -58
- package/cl.thumbnails.js +17 -17
- package/cl.tizen.js +57 -57
- package/cl.ttml.js +22 -22
- package/cl.verimatrix.js +4 -4
- package/cl.vimond.js +8 -8
- package/cl.vr.js +14 -14
- package/cl.vtt.js +12 -12
- package/cl.youbora.js +13 -13
- package/package.json +1 -1
- package/typings.d.ts +47 -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
|
|
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
|
|
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);
|
|
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&
|
|
6
|
-
|
|
7
|
-
24^f[
|
|
8
|
-
return new Promise(a=>a())}C(a){return a<<24|(a&65280)<<8|(a&16711680)>>8|a>>>24}};var
|
|
9
|
-
this.j.
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var RK=function(a){a=_.Fg(a);const b=new Uint32Array(4);for(let c=0;4>c;c++)b[c]=a.getUint32(4*c);return b},TK=function(a,b,c){return _.y(function*(){let d=new ArrayBuffer(0);try{d=yield SK(a,c.url)}catch(e){return a.m.warn("Could not fetch AES key",e),a.l.onError(new _.H(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 _.H(1,3,3103,null,e)),b}})},SK=function(a,b){return _.y(function*(){const c=
|
|
2
|
+
_.nh(b),d=(new _.ig(b)).Fa.endsWith(".drmtoday.com");if(d){var e=a.l.getConfiguration();_.ck(c,e)}e=b+JSON.stringify(c.headers);if(a.o[e])return a.o[e];try{const f=yield a.j.fetch(c).P;return a.o[e]=f.data}catch(f){throw d&&1001===f.code&&412===f.data.status&&a.m.warn("Wrong DRMtoday credentials, server responded with 412."),f;}})},UK=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),
|
|
3
|
+
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=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 v=q^q<<1^q<<2^q<<3^q<<4;v=v>>>8^v&255^99;c[n]=v;d[v]=n;const x=m[n],A=m[x],D=m[A];let E=257*m[v]^
|
|
4
|
+
16843008*v;e[n]=E<<24|E>>>8;f[n]=E<<16|E>>>16;g[n]=E<<8|E>>>24;a[n]=E;E=16843009*D^65537*A^257*x^16843008*n;h[v]=E<<24|E>>>8;k[v]=E<<16|E>>>16;l[v]=E<<8|E>>>24;b[v]=E;n?(n=x^m[m[m[D^x]]],q^=m[m[q]]):n=q=1}}}importKey(a){a=RK(a);for(var b=!0,c=0;c<a.length&&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);
|
|
5
|
+
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&&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&
|
|
6
|
+
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=RK(b);b=m[0];let n=m[1],q=m[2];m=m[3];a=_.Eg(a);const t=new Int32Array(a.length);let v,x,A;let D,E,I,na,hc,jd,Ob,Ta,sb;const ic=this.C.bind(this);for(;c<a.length;){na=ic(a[c]);hc=ic(a[c+1]);jd=ic(a[c+2]);Ob=ic(a[c+3]);D=na^e[0];E=Ob^e[1];I=jd^e[2];var xa=hc^e[3];Ta=4;for(sb=1;sb<d;sb++)v=h[D>>>24]^k[E>>16&255]^l[I>>8&255]^g[xa&255]^e[Ta],x=h[E>>>
|
|
7
|
+
24]^k[I>>16&255]^l[xa>>8&255]^g[D&255]^e[Ta+1],A=h[I>>>24]^k[xa>>16&255]^l[D>>8&255]^g[E&255]^e[Ta+2],xa=h[xa>>>24]^k[D>>16&255]^l[E>>8&255]^g[I&255]^e[Ta+3],D=v,E=x,I=A,Ta+=4;v=f[D>>>24]<<24^f[E>>16&255]<<16^f[I>>8&255]<<8^f[xa&255]^e[Ta];x=f[E>>>24]<<24^f[I>>16&255]<<16^f[xa>>8&255]<<8^f[D&255]^e[Ta+1];A=f[I>>>24]<<24^f[xa>>16&255]<<16^f[D>>8&255]<<8^f[E&255]^e[Ta+2];xa=f[xa>>>24]<<24^f[D>>16&255]<<16^f[E>>8&255]<<8^f[I&255]^e[Ta+3];Ta+=3;t[c]=ic(v^b);t[c+1]=ic(xa^n);t[c+2]=ic(A^q);t[c+3]=ic(x^
|
|
8
|
+
m);b=na;n=hc;q=jd;m=Ob;c+=4}return new Promise(hb=>{{var Ma=t.buffer;const bb=Ma.byteLength,lc=bb&&(new DataView(Ma)).getUint8(bb-1);Ma=lc?Ma.slice(0,bb-lc):Ma}hb(Ma)})}destroy(){this.A=this.h=this.f=this.j=this.B=this.m=this.w=this.g=this.a=this.o=null;return new Promise(a=>a())}C(a){return a<<24|(a&65280)<<8|(a&16711680)>>8|a>>>24}};var VK=class{constructor(){this.a=null}importKey(a){const b=this;return _.y(function*(){b.a=yield crypto.subtle.importKey("raw",a,{name:"AES-CBC"},!1,["decrypt"])})}decrypt(a,b){const c=this;return _.y(function*(){return yield crypto.subtle.decrypt({name:"AES-CBC",iv:b},c.a,a)})}destroy(){this.a=null;return new Promise(a=>a())}};_.z("clpp.crypto.CryptoComponent",class extends _.Fp{constructor(){super();this.j=this.l=null;this.w=this.A.bind(this);this.o={};this.h=null;this.m=new _.Q("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===_.cd&&typeof a===_.cd}else a=!1;a?this.h=new VK:(this.m.warn("No WebCrypto APIs found. Will fallback to software AES"),this.h=new UK);this.j=this.l.getNetworkEngine();this.j.Uc(this.w)}release(){this.j&&
|
|
9
|
+
this.j.md(this.w);this.h&&(this.h.destroy(),this.h=null);this.j=null;this.o={}}id(){return"crypto"}A(a){const b=this;return _.y(function*(){const c=a.request||null;c&&2===c.type&&c.keyInfo&&a.data&&(b.m.debug("Decrypting AES-128-encrypted video segment"),a.data=yield TK(b,a.data,c.keyInfo));return a})}});};f.call(g, window);
|
package/cl.dash.js
CHANGED
|
@@ -1,67 +1,67 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
|
|
3
|
-
a.A)},
|
|
4
|
-
c)?a.getAttributeNS(b,c):null},
|
|
5
|
-
Number(b[2]||null)+86400*Number(b[3]||null)+3600*Number(b[4]||null)+60*Number(b[5]||null)+Number(b[6]||null);return isFinite(a)?a:null},
|
|
6
|
-
Number(b[1])/Number(b[2]):Number(a);return isNaN(a)?null:a},
|
|
7
|
-
let m=f[h];if(null==m)return _.
|
|
8
|
-
10)||1;return Array(Math.max(0,k-g.length)+1).join("0")+g})},
|
|
9
|
-
d,f=a.
|
|
10
|
-
'if the next "S" element does not have a valid start time:',
|
|
11
|
-
"the content may have errors in it.",t),A[A.length-1].end=
|
|
12
|
-
b,c,d,e,f){const g=
|
|
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
|
|
14
|
-
b,c,d,e,f)))}return
|
|
15
|
-
var h=_.
|
|
16
|
-
const d=new Uint8Array(c);d[0]=b;for(b=1;b<c;b++)d[b]=_.
|
|
17
|
-
e=new DataView(a.f.buffer,a.f.byteOffset+a.a.getPosition(),c);a.a.skip(c);return new
|
|
18
|
-
f,h,l,n-1,f)),k=m,l=n)}}null!=k&&g.push(new _.
|
|
19
|
-
d&&(c=_.
|
|
20
|
-
4,4005);const g=
|
|
21
|
-
getDuration:a.getDuration,initSegmentReference:d,getLastSegmentEndTime:a.getLastSegmentEndTime,sa:c}},
|
|
22
|
-
n);return
|
|
23
|
-
a.wa.id+","+a.O.id,h=c[b]);d=
|
|
24
|
-
findSegmentPosition:g.findSegmentPosition,getSegmentReference:g.getSegmentReference,adjustSegmentDurations:g.adjustSegmentDurations,getDuration:g.getDuration,initSegmentReference:e,getLastSegmentEndTime:g.getLastSegmentEndTime,sa:f.jb}},
|
|
25
|
-
return{za:b.za,timescale:b.timescale,dc:b.dc,
|
|
26
|
-
"a SegmentTimeline or a segment duration.",a.O),b.
|
|
27
|
-
"but does not contain an initialization URL template.",a.O),new _.H(_.G,4,4005);var f=
|
|
28
|
-
const t=n*d;let
|
|
29
|
-
null,a.O.Qa,e,b.timeline[d].
|
|
30
|
-
getSegmentReference:e.get.bind(e),adjustSegmentDurations:e.g.bind(e),getDuration:e.getDuration.bind(e),initSegmentReference:c,getLastSegmentEndTime:()=>_.
|
|
31
|
-
"the SegmentList specifies multiple segments,","but does not specify a segment duration or timeline.",a.O),new _.H(_.G,4,4002);if(!b.za&&!a.fa.duration&&!b.timeline&&1==b.ac.length)throw _.
|
|
32
|
-
d.timeline.length!=d.ac.length&&(e=Math.min(d.timeline.length,d.ac.length),_.
|
|
33
|
-
c)=>0<b.length?b:c).map(b=>{b.getAttribute("indexRange")&&!a.
|
|
34
|
-
c.push({scheme:
|
|
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(
|
|
36
|
-
try{const f=yield
|
|
37
|
-
_.
|
|
38
|
-
|
|
39
|
-
a=_.
|
|
40
|
-
(a=
|
|
41
|
-
c,d,e){const f=
|
|
42
|
-
"ContentProtection element",a),null;b=b.toLowerCase();if(c&&(c=c.replace(/-/g,"").toLowerCase(),c.includes(" ")))throw new _.H(_.G,4,4009);let e=[];try{e=d.map(f=>({initDataType:_.
|
|
43
|
-
b))?_.
|
|
44
|
-
a.h-b,_.
|
|
45
|
-
e===
|
|
46
|
-
null!=k?k:3*d,e===
|
|
47
|
-
x);null==
|
|
48
|
-
duration:k,
|
|
49
|
-
d.start+", Assigning a default"),b.wa.id="__clpp_period_"+d.start);c=_.
|
|
50
|
-
4,4004);l.length||(l=[null]);k.length||(k=[null]);h=[];for(var m of l)for(var n of k)
|
|
51
|
-
const g=b.getAttribute(_.
|
|
52
|
-
codecs:h,frameRate:k,emsgSchemeIdUris:m,id:b.getAttribute("id"),
|
|
53
|
-
m.type===_.
|
|
54
|
-
l.getAttribute(
|
|
55
|
-
n)for(
|
|
56
|
-
b.va.contentType==
|
|
57
|
-
c.drmInfos)){var e=_.
|
|
58
|
-
|
|
59
|
-
1!=
|
|
60
|
-
(l=
|
|
61
|
-
width:b.O.width,height:b.O.height,kind:d,encrypted:0<c.drmInfos.length,keyId:
|
|
62
|
-
b;return a}
|
|
63
|
-
b),b.
|
|
64
|
-
parseInt(e,10);if(!c){a.a.warn(
|
|
65
|
-
"urn:mpeg:mpegB:cicp:TransferCharacteristics"];var
|
|
66
|
-
f.a.getFloat32(0);else if(8==f.a.byteLength)f=f.a.getFloat64(0);else throw new _.H(_.G,3,3003);}if(null==f)throw new _.H(_.G,3,3011);e=g/=1E9;f*=g;a=
|
|
67
|
-
c.D=b;const d=yield
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var cD="Channel parsing failure! Ignoring scheme and value",dD="ContentProtection",eD="EssentialProperty",fD="Failed to parse UTCTiming tags.",gD="Missing \x3cms:pro/\x3e node in ContentProtection element",hD="No UTCTiming elements found.",iD="SegmentBase does not contain sufficient segment information:",jD="SegmentList does not contain sufficient segment information:",kD="SegmentTemplate does not contain sufficient segment information:",lD="SegmentTimeline",mD='The last "S" element cannot have a negative repeat',
|
|
2
|
+
nD="application",oD="duration",pD="http://dashif.org/guidelines/trickmode",qD="http://www.w3.org/1999/xlink",rD='ignoring the last "S" element.',sD='ignoring the remaining "S" elements.',tD="presentationTimeOffset",uD="schemeIdUri",vD="static",wD="timescale",xD="urn:microsoft:playready",yD="urn:mpeg:cenc:2013",zD="urn:mpeg:dash:utc:http-head:2014",AD="urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95",BD="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed",CD=function(a,b){a.A=Math.max(a.A,b);a.C.debug("notifyAvailabilityTimeOffset: maxAvailabilityTimeOffset\x3d"+
|
|
3
|
+
a.A)},DD=function(a,b){return a.reduce(((c,d,e)=>d.catch(c.bind(null,e))).bind(null,b),Promise.reject())},ED=function(a){return new _.Zl(Promise.reject(a),()=>Promise.resolve())},FD=function(a){return new _.Zl(Promise.all(a.map(b=>b.P)),()=>Promise.all(a.map(b=>b.abort())))},GD=function(a,b,c){return Array.prototype.filter.call(a.childNodes,d=>d instanceof Element&&d.localName==c&&d.namespaceURI==b)},HD=function(a,b,c){a=GD(a,b,c);return 1!=a.length?null:a[0]},ID=function(a,b,c){return a.hasAttributeNS(b,
|
|
4
|
+
c)?a.getAttributeNS(b,c):null},JD=function(a,b,c,d=null){let e=null;a=a.getAttribute(b);null!=a&&(e=c(a));return null==e?d:e},KD=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)},LD=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 _.C("Invalid duration string:",a),null;a=31536E3*Number(b[1]||null)+2592E3*
|
|
5
|
+
Number(b[2]||null)+86400*Number(b[3]||null)+3600*Number(b[4]||null)+60*Number(b[5]||null)+Number(b[6]||null);return isFinite(a)?a:null},MD=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},ND=function(a){a=Number(a);return 0===a%1?a:null},OD=function(a){a=Number(a);return 0===a%1&&0<a?a:null},PD=function(a){a=Number(a);return 0===a%1&&0<=a?a:null},QD=function(a){let b;a=(b=a.match(/^(\d+)\/(\d+)$/))?
|
|
6
|
+
Number(b[1])/Number(b[2]):Number(a);return isNaN(a)?null:a},RD=function(a,b){try{const c=_.Ig(a);return _.Su(c,b)}catch(c){return null}},SD=function(a){var b=void 0===b?1024:b;if(!(a instanceof Uint8Array))return"";if(typeof b!==_.r||0>=b)b=1024;return(a.byteLength>b?a.subarray(0,b):a).toString()},TD=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("$$"==g)return"$";
|
|
7
|
+
let m=f[h];if(null==m)return _.C("URL template does not have an available substitution ","for identifier",'"'+h+'":',a),g;"RepresentationID"==h&&k&&(_.C("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})},WD=function(a,b){var c=UD(a,b,wD);let d=1;c&&(d=OD(c)||1);c=UD(a,b,oD);(c=OD(c||""))&&(c/=d);let e=Number(UD(a,b,tD))||0,f=e/d||0;a.Xf&&null!=a.Lc&&a.Lc!==f&&(_.C("The stream is non-compliant with the DASH spec. The value of `presentationTimeOffset` has changed during the transition from dynamic to static manifest, which is not allowed. The last "+`value will be ignored. (Period ID: ${a.wa.id}, `+`Representation ID: ${a.O.id})`),e=a.Lc*
|
|
9
|
+
d,f=a.Lc);var g=UD(a,b,"startNumber");let h=PD(g||"");if(null==g||null==h)h=1;g=UD(a,b,"endNumber");g=null!==g?PD(g||""):null;var k=VD(a,b,lD),l=null;if(k){{l=d;var m=e,n=a.fa.duration||Infinity;k=_.Pu(k,"S");const A=[];var q=0;for(let D=0;D<k.length;++D){var t=k[D],v=JD(t,"t",PD);const E=JD(t,"d",PD);var x=JD(t,"r",ND);null!=v&&(v-=m);if(!E){_.C('"S" element must have a duration:',sD,t);break}v=null!=v?v:q;x=x||0;if(0>x)if(D+1<k.length){x=JD(k[D+1],"t",PD);if(null==x){_.C('An "S" element cannot have a negative repeat',
|
|
10
|
+
'if the next "S" element does not have a valid start time:',sD,t);break}else if(v>=x){_.C('An "S" element cannot have a negative repeat if its start ','time exceeds the next "S" element\'s start time:',sD,t);break}x=Math.ceil((x-v)/E)-1}else{if(Infinity==n){_.C(mD,"if the Period has an infinite duration:",rD,t);break}else if(v/l>=n){_.C(mD,"if its start time exceeds the Period's duration:",rD,t);break}x=Math.ceil((n*l-v)/E)-1}0<A.length&&v!=q&&(Math.abs((v-q)/l)>=_.Io&&_.C("SegmentTimeline contains a large gap/overlap:",
|
|
11
|
+
"the content may have errors in it.",t),A[A.length-1].end=v/l);for(t=0;t<=x;++t)q=v+E,A.push({start:v/l,end:q/l,ug:v}),v=q}l=A}}a=UD(a,b,"availabilityTimeOffset");b=Number(a||"");b=isNaN(b)?null:b;if(null==a||null==b)b=0;return{timescale:d,za:c,dc:h,yd:g,jb:f,le:e,timeline:l,qd:b}},UD=function(a,b,c){return[b(a.O),b(a.va),b(a.wa)].filter(_.fg).map(d=>d.getAttribute(c)).reduce((d,e)=>d||e)},VD=function(a,b,c){return[b(a.O),b(a.va),b(a.wa)].filter(_.fg).map(d=>_.Qu(d,c)).reduce((d,e)=>d||e)},YD=function(a,
|
|
12
|
+
b,c,d,e,f){const g=ID(a,qD,"href"),h=ID(a,qD,"actuate")||"onRequest";for(let l=0;l<a.attributes.length;l++){const m=a.attributes[l];m.namespaceURI==qD&&(a.removeAttributeNS(m.namespaceURI,m.localName),--l)}if(5<=f)return ED(new _.H(_.G,4,4028));if("onLoad"!=h)return ED(new _.H(_.G,4,4027));const k=_.xu([d],[g]);d=_.nh(k,b);d.type=1;return e.fetch(d).Xc(l=>{l=RD(l.data,a.tagName);if(!l)return ED(new _.H(_.G,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 XD(a,b,c,k[0],e,f+1)})},XD=function(a,b,c,d,e,f=0){if(ID(a,qD,"href")){var g=YD(a,b,c,d,e,f);c&&(g=g.Xc(void 0,()=>XD(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"==ID(k,qD,"href")?(a.removeChild(k),--h):k.tagName!=lD&&g.push(XD(k,
|
|
14
|
+
b,c,d,e,f)))}return FD(g).Xc(()=>a)},$D=function(a,b,c,d){let e;var f=(new _.Qj).Z("sidx",g=>{e=ZD(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);_.If('Invalid box type. Expected "sidx", but received:',a,"from:",g,"byte range:",f);throw new _.H(_.G,3,3004,{url:g,Hg:f,size:a.byteLength,Ug:SD(a)});}},ZD=function(a,b,c,d){const e=[];d.reader.skip(4);const f=_.P(d.reader);if(0==f)throw _.If("Invalid timescale."),new _.H(_.G,3,3005);if(0==d.version){var g=_.P(d.reader);
|
|
15
|
+
var h=_.P(d.reader)}else g=_.Ej(d.reader),h=_.Ej(d.reader);d.reader.skip(2);const k=_.Cj(d.reader);a=a+d.size+h;for(h=0;h<k;h++){var l=_.P(d.reader);const m=(l&2147483648)>>>31;l&=2147483647;const n=_.P(d.reader);d.reader.skip(4);if(1==m)throw _.If("Hierarchical SIDXs are not supported."),new _.H(_.G,3,3006);e.push(new _.Av(e.length,g/f-b,(g+n)/f-b,()=>c,a,a+l-1,b));g+=n;a+=l}d.parser.stop();return e},aE=function(a){var b=_.Bj(a.a);let c;for(c=1;8>=c&&!(b&1<<8-c);c++);if(8<c)throw new _.H(_.G,3,3002);
|
|
16
|
+
const d=new Uint8Array(c);d[0]=b;for(b=1;b<c;b++)d[b]=_.Bj(a.a);return d},dE=function(a){var b=aE(a);if(7<b.length)throw new _.H(_.G,3,3002);var c=0;for(var d=0;d<b.length;d++)c=256*c+b[d];b=c;c=aE(a);a:{for(e of bE)if(_.ch(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 _.H(_.G,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();
|
|
17
|
+
e=new DataView(a.f.buffer,a.f.byteOffset+a.a.getPosition(),c);a.a.skip(c);return new cE(b,e)},eE=function(a){if(8<a.a.byteLength)throw new _.H(_.G,3,3002);if(8==a.a.byteLength&&a.a.getUint8(0)&224)throw new _.H(_.G,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},hE=function(a,b,c,d,e,f){const g=[],h=()=>e;a=new fE(a.a);let k=null,l=null;for(;_.zj(a.a);){var m=dE(a);if(187==m.id){var n=gE(m);n&&(m=c*n.vg,n=b+n.ig,null!=k&&g.push(new _.Av(g.length,k-f,m-
|
|
18
|
+
f,h,l,n-1,f)),k=m,l=n)}}null!=k&&g.push(new _.Av(g.length,k-f,d-f,h,l,null,f));return g},gE=function(a){var b=new fE(a.a);a=dE(b);if(179!=a.id)throw _.C("Not a CueTime element."),new _.H(_.G,3,3013);a=eE(a);b=dE(b);if(183!=b.id)throw _.C("Not a CueTrackPositions element."),new _.H(_.G,3,3012);b=new fE(b.a);let c=0;for(;_.zj(b.a);){const d=dE(b);if(241==d.id){c=eE(d);break}}return{vg:a,ig:c}},iE=function(a,b){b=VD(a,b,"Initialization");if(!b)return null;let c=a.O.Qa;var d=b.getAttribute("sourceURL");
|
|
19
|
+
d&&(c=_.xu(a.O.Qa,[d]));a=0;d=null;if(b=JD(b,"range",MD))a=b.start,d=b.end;return new _.Wz(()=>c,a,d)},lE=function(a,b){var c=Number(UD(a,jE,tD))||0,d=UD(a,jE,wD),e=1;d&&(e=OD(d)||1);c=c/e||0;d=iE(a,jE);{e=a.O.mimeType.split("/")[1];if(a.O.contentType!=_.u&&e!=_.zd&&"webm"!=e)throw _.If("SegmentBase specifies an unsupported container type.",a.O),new _.H(_.G,4,4006);if("webm"==e&&!d)throw _.If(iD,"the SegmentBase uses a WebM container,","but does not contain an Initialization element.",a.O),new _.H(_.G,
|
|
20
|
+
4,4005);const g=VD(a,jE,"RepresentationIndex");var f=UD(a,jE,"indexRange");let h=a.O.Qa;f=MD(f||"");if(g){const k=g.getAttribute("sourceURL");k&&(h=_.xu(a.O.Qa,[k]));f=JD(g,"range",MD,f)}if(!f)throw _.If(iD,"the SegmentBase does not contain @indexRange","or a RepresentationIndex element.",a.O),new _.H(_.G,4,4002);a=kE(a,b,d,h,f.start,f.end,e,c)}return{createSegmentIndex:a.createSegmentIndex,findSegmentPosition:a.findSegmentPosition,getSegmentReference:a.getSegmentReference,adjustSegmentDurations:a.adjustSegmentDurations,
|
|
21
|
+
getDuration:a.getDuration,initSegmentReference:d,getLastSegmentEndTime:a.getLastSegmentEndTime,sa:c}},jE=function(a){return a.Qc},kE=function(a,b,c,d,e,f,g,h){const k=a.presentationTimeline,l=!a.nc||!a.fa.Kd,m=a.fa.start,n=a.fa.duration;let q=b,t=null;return{createSegmentIndex:function(){return _.y(function*(){var v=[q(d,e,f),"webm"==g?q(c.Ia(),c.ua,c.ha):null];q=null;v=yield Promise.all(v);var x=v[0];const A=v[1]||null;x=g==_.zd?$D(x,e,d,h):(new mE).parse(x,A,d,h);_.qv(k,x,m);t=new _.$z(x);l&&_.iv(t,
|
|
22
|
+
n);return v})},findSegmentPosition:function(v){return t.f(v)},getSegmentReference:function(v){return t.get(v)},adjustSegmentDurations:function(v,x){return t.g(v,x)},getDuration:function(){return t.getDuration()},getLastSegmentEndTime:()=>n}},tE=function(a,b,c,d){const e=nE(a),f=oE(a);pE(a,f);var g=null;if(f.Ic)g=qE(a,b,e,f);else if(f.za)d||(CD(a.presentationTimeline,f.qd),_.rv(a.presentationTimeline,f.za),_.pv(a.presentationTimeline,a.fa.start)),g=rE(a,f);else{let h=null;b=null;a.wa.id&&a.O.id&&(b=
|
|
23
|
+
a.wa.id+","+a.O.id,h=c[b]);d=sE(a,f);g=!a.nc||!a.fa.Kd;h?(g&&_.iv(new _.$z(d),a.fa.duration),_.Bv(h,d),_.Cv(h,_.uv(a.presentationTimeline)-a.fa.start)):(_.qv(a.presentationTimeline,d,a.fa.start),h=new _.$z(d),b&&a.nc&&(c[b]=h));g&&_.iv(h,a.fa.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:()=>_.zv(h)}}return{createSegmentIndex:g.createSegmentIndex,
|
|
24
|
+
findSegmentPosition:g.findSegmentPosition,getSegmentReference:g.getSegmentReference,adjustSegmentDurations:g.adjustSegmentDurations,getDuration:g.getDuration,initSegmentReference:e,getLastSegmentEndTime:g.getLastSegmentEndTime,sa:f.jb}},nE=function(a){const b=UD(a,uE,"initialization");if(!b)return null;const c=a.O.id,d=a.bandwidth||null,e=a.O.Qa;return new _.Wz(function(){const f=TD(b,c,null,d,null);return _.xu(e,[f])},0,null)},oE=function(a){const b=WD(a,uE),c=UD(a,uE,"media");a=UD(a,uE,"index");
|
|
25
|
+
return{za:b.za,timescale:b.timescale,dc:b.dc,yd:b.yd,jb:b.jb,le:b.le,timeline:b.timeline,Rd:c,Ic:a,qd:b.qd}},pE=function(a,b){let c;c=b.Ic?1:0;c+=b.timeline?1:0;c+=b.za?1:0;if(0==c)throw _.If("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 _.H(_.G,4,4002);1!=c&&(_.C("SegmentTemplate contains multiple segment information sources:","the SegmentTemplate should only contain an index URL template,",
|
|
26
|
+
"a SegmentTimeline or a segment duration.",a.O),b.Ic?(_.Cf("Using the index URL template by default."),b.timeline=null):_.Cf("Using the SegmentTimeline by default."),b.za=null);if(!b.Ic&&!b.Rd)throw _.If(kD,"the SegmentTemplate's media URL template is missing.",a.O),new _.H(_.G,4,4002);},qE=function(a,b,c,d){const e=a.O.mimeType.split("/")[1];if(e!=_.zd&&"webm"!=e)throw _.If("SegmentTemplate specifies an unsupported container type.",a.O),new _.H(_.G,4,4006);if("webm"==e&&!c)throw _.If(kD,"the SegmentTemplate uses a WebM container,",
|
|
27
|
+
"but does not contain an initialization URL template.",a.O),new _.H(_.G,4,4005);var f=TD(d.Ic,a.O.id,null,a.bandwidth||null,null);f=_.xu(a.O.Qa,[f]);return kE(a,b,c,f,0,null,e,d.jb)},rE=function(a,b){const c=a.fa.duration,d=b.za,e=b.dc,f=b.yd,g=b.timescale,h=b.Rd,k=a.bandwidth||null,l=a.O.id,m=a.O.Qa;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;
|
|
28
|
+
const t=n*d;let v=t+d;c&&(v=Math.min(v,c));return 0>v||c&&t>=c?null:new _.Av(n,t,v,function(){const x=TD(h,l,q,k,t*g);return _.xu(m,[x])},0,null,b.jb)},adjustSegmentDurations:function(){},getDuration:function(){return c},getLastSegmentEndTime:()=>c}},sE=function(a,b){const c=[];for(let d=0;d<b.timeline.length;d++){const e=d+b.dc;c.push(new _.Av(e,b.timeline[d].start,b.timeline[d].end,function(f,g,h,k,l,m){f=TD(f,g,l,h,m);return _.xu(k,[f]).map(n=>n.toString())}.bind(null,b.Rd,a.O.id,a.bandwidth||
|
|
29
|
+
null,a.O.Qa,e,b.timeline[d].ug+b.le),0,null,b.jb))}return c},uE=function(a){return a.bc},zE=function(a,b){const c=iE(a,vE),d=wE(a);xE(a,d);let e=null,f=null;a.wa.id&&a.O.id&&(f=a.wa.id+","+a.O.id,e=b[f]);const g=yE(a.fa.duration,d.dc,a.O.Qa,d);e?(_.Bv(e,g),_.Cv(e,_.uv(a.presentationTimeline)-a.fa.start)):(_.qv(a.presentationTimeline,g,a.fa.start),e=new _.$z(g),f&&a.nc&&(b[f]=e));a.nc&&a.fa.Kd||_.iv(e,a.fa.duration);return{createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:e.f.bind(e),
|
|
30
|
+
getSegmentReference:e.get.bind(e),adjustSegmentDurations:e.g.bind(e),getDuration:e.getDuration.bind(e),initSegmentReference:c,getLastSegmentEndTime:()=>_.zv(e),sa:d.jb}},vE=function(a){return a.Ob},wE=function(a){const b=AE(a);a=WD(a,vE);let c=a.dc;0==c&&(_.C("SegmentList@startNumber must be \x3e 0"),c=1);let d=0;a.za?d=a.za*(c-1):a.timeline&&0<a.timeline.length&&(d=a.timeline[0].start);return{za:a.za,startTime:d,dc:c,jb:a.jb,timeline:a.timeline,ac:b}},xE=function(a,b){if(!b.za&&!b.timeline&&1<b.ac.length)throw _.C(jD,
|
|
31
|
+
"the SegmentList specifies multiple segments,","but does not specify a segment duration or timeline.",a.O),new _.H(_.G,4,4002);if(!b.za&&!a.fa.duration&&!b.timeline&&1==b.ac.length)throw _.C(jD,"the SegmentList specifies one segment,","but does not specify a segment duration, period duration,","or timeline.",a.O),new _.H(_.G,4,4002);if(b.timeline&&0==b.timeline.length)throw _.C(jD,"the SegmentList has an empty timeline.",a.O),new _.H(_.G,4,4002);},yE=function(a,b,c,d){let e=d.ac.length;d.timeline&&
|
|
32
|
+
d.timeline.length!=d.ac.length&&(e=Math.min(d.timeline.length,d.ac.length),_.C("The number of items in the segment timeline and the number of","segment URLs do not match, truncating",d.ac.length,"to",e));const f=[];var g=d.startTime;for(let h=0;h<e;h++){const k=d.ac[h],l=_.xu(c,[k.ag]);let m;m=null!=d.za?g+d.za:d.timeline?d.timeline[h].end:g+a;f.push(new _.Av(h+b,g,m,()=>l,k.start,k.end,d.jb));g=m}return f},AE=function(a){return[a.O.Ob,a.va.Ob,a.wa.Ob].filter(_.fg).map(b=>_.Pu(b,"SegmentURL")).reduce((b,
|
|
33
|
+
c)=>0<b.length?b:c).map(b=>{b.getAttribute("indexRange")&&!a.Jd&&(a.Jd=!0,_.C("We do not support the SegmentURL@indexRange attribute on SegmentList. We only use the SegmentList@duration attribute or SegmentTimeline, which must be accurate."));const c=b.getAttribute("media");b=JD(b,"mediaRange",MD,{start:0,end:null});return{ag:c,start:b.start,end:b.end}})},CE=function(a,b,c){c=c.map(e=>({scheme:e.getAttribute(uD),value:e.getAttribute(_.Ge)}));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:zD,value:d}));return 0===c.length?(a.a.warn(hD),Promise.reject(Error(hD))):DD(c,e=>{const f=e.scheme;e=e.value;switch(f){case zD:case "urn:mpeg:dash:utc:http-head:2012":return BE(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 BE(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(fD);return Promise.reject(Error(fD))})},DE=function(a,b,c,d){return _.y(function*(){const e=_.Pu(b,"UTCTiming");
|
|
36
|
+
try{const f=yield CE(a,c,e);d.B=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})},BE=function(a,b,c,d){return _.y(function*(){var e=_.xu(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
|
+
_.Ig(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()})},FE=function(a,b){return a.find(c=>EE.get(c.Ab)===b)},GE=function(a){const b=HD(a.node,xD,"pro");if(!b)return _.C(gD,a),null;a=_.$g(b.textContent);a=_.$u(a);a=_.vk(a.a);return{keyId:null,Ab:BD,node:document.createElement("null"),init:[{initData:_.qu(a),initDataType:_.uc,keyId:null}]}},HE=function(a,b){b=void 0===b?"4.0.0.0":b;const c=HD(a.node,
|
|
38
|
+
yD,"pssh");if(!c)return _.C("Missing \x3ccenc:pssh/\x3e node in ContentProtection element",a),null;a=_.$g(c.textContent);a=_.xk(a);return a?(b=_.Wu(b,a.a))?{keyId:null,Ab:AD,node:document.createElement("null"),init:[{initData:_.qu(b),initDataType:_.uc,keyId:null}]}:null:(_.C("Unable to parse WV PSSH data. Can not create PR data!"),null)},IE=function(a,b){const c=HD(a.node,xD,"pro");if(!c)return _.C(gD,a),null;a=_.$g(c.textContent);a=_.$u(a);return a.version!==b&&(_.Hf(`Parsing from ${a.version} to ${b}.`),
|
|
39
|
+
a=_.Xu(a,b))?{keyId:null,Ab:AD,node:document.createElement("null"),init:[{initData:_.qu(a),initDataType:_.uc,keyId:null}]}:null},LE=function(a,b,c,d){const e=JE(a);let f=null;a=[];let g=[];const h=FE(e,_.Lc),k=FE(e,_.Kc);if(k&&d){var l=IE(k,d);l&&(e[e.indexOf(k)]=l)}k&&!h&&(l=GE(k))&&e.push(l);h&&!k&&(d=HE(h,d||void 0))&&e.push(d);d=new Set(e.map(m=>m.keyId));d.delete(null);if(1<d.size)throw new _.H(_.G,4,4010);b||(g=e.filter(m=>"urn:mpeg:dash:mp4protection:2011"==m.Ab?(f=m.init||f,!1):!0),g.length&&
|
|
40
|
+
(a=KE(f,g,c),0==a.length&&(a=[_.yu(_.Cd,f,c)])));if(e.length&&(b||!g.length)){a=[];for(const m of EE.values())m!=_.Ld&&a.push(_.yu(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{Dc:b,Kg:f,drmInfos:a,De:!0}},JE=function(a){const b=[];for(const c of a)(a=ME(c))&&b.push(a);return b},KE=function(a,b,c){const d=[];for(const f of b){var e=EE.get(f.Ab);if(e){b=_.yu(e,f.init||a,c);if(e=NE.get(e))b.licenseServerUri=e(f);d.push(b)}}return d},OE=function(a,b,
|
|
41
|
+
c,d,e){const f=LE(a,c,d,e);if(b.De){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.Dc=f.Dc||b.Dc;b.De=!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 _.H(_.G,4,4008);return f.Dc||b.Dc},ME=function(a){let b=a.getAttribute(uD),c=ID(a,yD,"default_KID");const d=GD(a,yD,"pssh").map(_.Ru);if(!b)return _.If("Missing required schemeIdUri attribute on",
|
|
42
|
+
"ContentProtection element",a),null;b=b.toLowerCase();if(c&&(c=c.replace(/-/g,"").toLowerCase(),c.includes(" ")))throw new _.H(_.G,4,4009);let e=[];try{e=d.map(f=>({initDataType:_.uc,initData:_.$g(f),keyId:null}))}catch(f){throw new _.H(_.G,4,4007);}return{node:a,Ab:b,keyId:c,init:0<e.length?e:null}},QE=function(a,b){PE(a).forEach(c=>{c=c.getLastSegmentEndTime?c.getLastSegmentEndTime():0;if(0<c){var d=b.presentationTimeline;d.g=Math.max(d.g||0,c+b.fa.start)}})},RE=function(a,b){return _.Jv(_.Zh(a,
|
|
43
|
+
b))?_.u:a.split("/")[0]},PE=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)},TE=function(a){return _.y(function*(){var b=_.nh(a.j,a.f.attemptParameters);b.type=1;var c=Date.now();b=a.D.networkingEngine.fetch(b);_.uh(a.m,b);b=yield b.P;if(!a.D)return 0;b.uri&&!a.j.includes(b.uri)&&a.j.unshift(b.uri);yield SE(a,b.data,b.uri);c=(Date.now()-c)/1E3;_.kv(a.G,1,c);return c})},UE=function(a,b){0>a.h||a.w.da(Math.max(3,
|
|
44
|
+
a.h-b,_.lv(a.G)))},SE=function(a,b,c){return _.y(function*(){var d=RD(b,"MPD");if(!d)throw new _.H(_.G,4,4001,c);d=XD(d,a.f.attemptParameters,a.f.xlinkFailGracefully,c,a.D.networkingEngine);_.uh(a.m,d);d=yield d.P;return VE(a,d,c)})},VE=function(a,b,c){return _.y(function*(){var d=[c],e=_.Pu(b,"Location").map(_.Ru).filter(_.fg);0<e.length&&(d=_.xu(d,e),a.j=d);e=_.Pu(b,"BaseURL").map(_.Ru);var f=_.xu(d,e);d=JD(b,"minBufferTime",LD,0);e=b.getAttribute("type")||vD;a.h=JD(b,"minimumUpdatePeriod",LD,-1);
|
|
45
|
+
e===vD&&0<=a.h&&(a.a.warn("Invalid manifest - a static manifest should not contain the `minimumUpdatePeriod` attribute. The attribute will be ignored."),a.h=-1,a.w.stop());var g=JD(b,"availabilityStartTime",KD);let h=JD(b,"timeShiftBufferDepth",LD);var k=JD(b,"suggestedPresentationDelay",LD);const l=JD(b,"maxSegmentDuration",LD),m=e===vD&&"dynamic"===a.A;m&&(a.a.info("MPD dynamic to static transition."),e="dynamic");const n=e===vD;var q="dynamic"===e;if(a.g)g=a.g.presentationTimeline;else if(g=new _.Zz(g,
|
|
46
|
+
null!=k?k:3*d,e===vD,!!a.f.autoCorrectDrift),q&&(g=yield DE(a.H,b,f,g),!a.D))return;q={nc:q,presentationTimeline:g,wa:null,fa:null,va:null,O:null,bandwidth:0,Jd:!1,Xf:m,fe:null,Lc:null};{k=JD(b,"mediaPresentationDuration",LD);var t=[],v=0;const E=_.Pu(b,"Period");for(let I=0;I<E.length;I++){var x=E[I];v=JD(x,_.le,LD,v);var A=JD(x,oD,LD);let na=null;if(I!=E.length-1){var D=JD(E[I+1],_.le,LD);null!=D&&(na=D-v)}else null!=k&&(na=k-v);D=_.Io;na&&A&&Math.abs(na-A)>D&&a.a.warn("There is a gap/overlap between Periods",
|
|
47
|
+
x);null==na&&(na=A);x=WE(a,q,f,{start:v,duration:na,node:x,Kd:null==na||I==E.length-1});t.push(x);A=q.wa.id;a.C.includes(A)||(a.C.push(A),a.g&&(a.D.filterNewPeriod(x),a.g.periods.push(x)));if(null==na){I!=E.length-1&&a.a.warn("Skipping Period",I+1,"and any subsequent Periods:","Period",I+1,"does not have a valid start time.",t[I+1]);v=null;break}v+=na}null==a.g&&a.D.filterAllPeriods(t);null!=k?(v!=k&&a.a.warn("@mediaPresentationDuration does not match the total duration of ","all Periods."),f={periods:t,
|
|
48
|
+
duration:k,Ae:!1}):f={periods:t,duration:v,Ae:!0}}k=f.duration;t=f.periods;m&&(QE(t,q),g.o=!0,a.D.onEvent(new _.F(_.Ad)));if(n||!m&&!f.Ae)g.f=k||Infinity;g.isLive()&&a.f.availabilityWindowOverride&&!isNaN(a.f.availabilityWindowOverride)&&(h=a.f.availabilityWindowOverride);null==h&&(h=Infinity);g.j=h;_.rv(g,l||1);g.isLive();a.g||(a.g={presentationTimeline:g,periods:t,offlineSessionIds:[],minBufferTime:d||0});a.A=e})},WE=function(a,b,c,d){b.wa=XE(a,d.node,null,c);b.fa=d;b.wa.id||(a.a.info("No Period ID given for Period with start time "+
|
|
49
|
+
d.start+", Assigning a default"),b.wa.id="__clpp_period_"+d.start);c=_.Pu(d.node,"EventStream");for(var e of c)YE(a,d.start,d.duration,e);e=_.Pu(d.node,_.ea).map(t=>ZE(a,b,t)).filter(_.fg);if(b.nc){c=[];for(var f of e)for(var g of f.kg)c.push(g);if(c.length!=(new Set(c)).size)throw new _.H(_.G,4,4018);}f=e.filter(t=>!t.ke);g=e.filter(t=>t.ke);for(var h of g){g=h.streams[0];e=h.ke;for(var k of f)if(k.id==e)for(var l of k.streams)l.trickModeVideo=g}k=$E(f,_.w);l=$E(f,_.p);if(!k.length&&!l.length)throw new _.H(_.G,
|
|
50
|
+
4,4004);l.length||(l=[null]);k.length||(k=[null]);h=[];for(var m of l)for(var n of k)aF(a,m,n,h);n=[...$E(f,_.u),...$E(f,_.lu)];m=[];for(var q of n)m.push.apply(m,q.streams);q=$E(f,_.fd);n=[];for(const t of q)n.push.apply(n,t.streams);return{startTime:d.start,textStreams:m,thumbStreams:n,variants:h}},XE=function(a,b,c,d){c=c||{contentType:"",mimeType:"",codecs:"",emsgSchemeIdUris:[],frameRate:void 0,Sd:null};d=d||c.Qa;const e=_.Pu(b,"BaseURL").map(_.Ru);let f=b.getAttribute("contentType")||c.contentType;
|
|
51
|
+
const g=b.getAttribute(_.wd)||c.mimeType,h=b.getAttribute(_.Gc)||c.codecs,k=JD(b,"frameRate",QD)||c.frameRate;var l=_.Pu(b,"InbandEventStream");var m=c.emsgSchemeIdUris.slice();for(var n of l)l=n.getAttribute(uD),m.includes(l)||m.push(l);n=_.Pu(b,"AudioChannelConfiguration");a=bF(a,n)||c.Sd;f||(f=RE(g,h));return{Qa:_.xu(d,e),Qc:_.Qu(b,"SegmentBase")||c.Qc,Ob:_.Qu(b,"SegmentList")||c.Ob,bc:_.Qu(b,"SegmentTemplate")||c.bc,width:JD(b,_.Xe,PD)||c.width,height:JD(b,_.dd,PD)||c.height,contentType:f,mimeType:g,
|
|
52
|
+
codecs:h,frameRate:k,emsgSchemeIdUris:m,id:b.getAttribute("id"),Sd:a}},YE=function(a,b,c,d){const e=d.getAttribute(uD)||"",f=d.getAttribute(_.Ge)||"",g=JD(d,wD,PD)||1;for(const k of _.Pu(d,"Event")){d=JD(k,"presentationTime",PD)||0;var h=JD(k,oD,PD)||0;d=d/g+b;h=d+h/g;null!=c&&(d=Math.min(d,b+c),h=Math.min(h,b+c));let l=_.Pf;e.startsWith(_.Ce)?l=_.Rf:"urn:mpeg:dash:event:callback:2015"===e&&(l=_.Bd);const m={schemeIdUri:e,value:f,startTime:d,endTime:h,id:k.getAttribute("id")||"",type:l,eventElement:k};
|
|
53
|
+
m.type===_.Bd&&(m.jd=()=>{if(m.eventElement){var n=m.eventElement.getAttribute("messageData")||"";n&&n.startsWith("http")&&(n=_.nh(n),n.type=_.mh,a.D.networkingEngine.fetch(n))}});a.D.onTimelineCueAdded(m)}},ZE=function(a,b,c){b.va=XE(a,c,b.wa,null);let d=!1;var e=_.Pu(c,"Role");const f=e.map(I=>I.getAttribute(_.Ge)).filter(_.fg);let g=null;var h=_.Pu(c,"Label").map(I=>I.textContent).filter(_.fg);h&&0<h.length&&(g=h[h.length-1]);let k=void 0;(h=b.va.contentType==_.u)&&(k=_.lu);for(var l of e)if(e=
|
|
54
|
+
l.getAttribute(uD),null==e||"urn:mpeg:dash:role:2011"===e||"urn:mpeg:dash:role"===e)switch(e=l.getAttribute(_.Ge),e){case "main":d=!0;break;case "caption":case _.lu:k=e}e=_.Pu(c,eD);l=null;for(var m of e){e=m.getAttribute(uD);var n=m.getAttribute(_.Ge);if(e!==pD&&!cF.includes(e)||void 0===n)return null;e===pD&&(l=n)}m=_.Pu(c,"Accessibility");const q=new Map;for(var t of m)if(e=t.getAttribute(uD),"urn:scte:dash:cc:cea-608:2015"==e||"urn:scte:dash:cc:cea-708:2015"==e)if(e=1,n=t.getAttribute(_.Ge),null!=
|
|
55
|
+
n)for(var v of n.split(";")){if(v.includes("\x3d")){var x=v.split("\x3d");n=x[0].startsWith("CC")?x[0]:"CC"+x[0];x=x[1].split(",")[0].split(":").pop()}else n="CC"+e,e+=2,x=v;q.set(n,_.vg(x))}else q.set("CC1",_.Ae);t=_.Pu(c,dD);const A=LE(t,a.f.ignoreDrmInfo,b.wa.id,a.f.playreadyVersion||null),D=c.getAttribute("lang")||_.Ae;t=_.vg(D);null==g&&(g=c.getAttribute("label"));v=_.Pu(c,_.ab);c=v.map(I=>dF(a,b,A,k,D,g,d,f,q,I)).filter(I=>!!I);if(0==c.length){if(h)return null;throw new _.H(_.G,4,4003);}if(!b.va.contentType||
|
|
56
|
+
b.va.contentType==nD){b.va.contentType=RE(c[0].mimeType,c[0].codecs);for(var E of c)E.type=b.va.contentType}for(const I of c)for(const na of A.drmInfos)I.keyId&&!na.keyIds.includes(I.keyId)&&na.keyIds.push(I.keyId);c=eF(c,b.va.contentType,m);E=v.map(I=>I.getAttribute("id")).filter(_.fg);return{id:b.va.id||"__fake__"+a.o++,contentType:b.va.contentType,language:t,originalLanguage:D,Pd:d,streams:c,drmInfos:A.drmInfos,ke:l,kg:E}},$E=function(a,b){return a.filter(c=>c.contentType==b)},aF=function(a,b,
|
|
57
|
+
c,d){if(b||c)if(b&&c){if(_.Fu(b.drmInfos,c.drmInfos)){var e=_.Eu(b.drmInfos,c.drmInfos);for(var f of b.streams)for(const h of c.streams){var g=(h.bandwidth||0)+(f.bandwidth||0);g={id:a.o++,language:b.language,primary:b.Pd||c.Pd,audio:f,video:h,bandwidth:g,drmInfos:e,allowedByApplication:!0,allowedByKeySystem:!0};d.push(g)}}}else{f=b||c;for(e of f.streams)g=e.bandwidth||0,g={id:a.o++,language:f.language||_.Ae,primary:f.Pd,audio:b?e:null,video:c?e:null,bandwidth:g,drmInfos:f.drmInfos,allowedByApplication:!0,
|
|
58
|
+
allowedByKeySystem:!0},d.push(g)}},dF=function(a,b,c,d,e,f,g,h,k,l){const m=_.vg(e);b.O=XE(a,l,b.va,null);if(!fF(a,b.O))return a.a.warn("Skipping Representation",b.O),null;b.fe=`${b.wa.id} ${b.O.id}`;b.Lc=a.B.get(b.fe);b.bandwidth=JD(l,"bandwidth",OD)||0;let n;var q=b.O.contentType,t=q==_.u||q==nD,v=q==_.fd;try{if(q=(x,A,D)=>gF(a,x,A,D),b.O.Qc)n=lE(b,q);else if(b.O.Ob)n=zE(b,a.F);else if(b.O.bc)n=tE(b,q,a.F,!!a.g);else{const x=b.O.Qa,A=b.fa.duration||0;n={createSegmentIndex:()=>Promise.resolve(),
|
|
59
|
+
findSegmentPosition:D=>0<=D&&D<A?1:null,getSegmentReference:D=>1!=D?null:new _.Av(1,0,A,()=>x,0,null,0),adjustSegmentDurations:()=>{},getLastSegmentEndTime:()=>A,getDuration:()=>A,initSegmentReference:null,sa:0}}}catch(x){if(t&&4002==x.code)return null;throw x;}a.B.set(b.fe,n.sa);t=_.Pu(l,dD);t=OE(t,c,a.f.ignoreDrmInfo,b.wa.id,a.f.playreadyVersion||null);q=void 0;v&&(v=(v=(l=_.Qu(l,eD))&&l.getAttribute(uD))||"",hF.includes(v)&&(l=(l=l.getAttribute(_.Ge))&&l.split("x").map(x=>parseInt(x,10)))&&2==
|
|
60
|
+
l.length&&(n.horizontalTiles=l[0],n.verticalTiles=l[1],b.va.bc&&(l=n.horizontalTiles*n.verticalTiles,q=(q=JD(b.va.bc,oD,PD)||0)?q/l:void 0)));return{id:a.o++,originalId:b.O.id,createSegmentIndex:n.createSegmentIndex,findSegmentPosition:n.findSegmentPosition,getSegmentReference:n.getSegmentReference,initSegmentReference:n.initSegmentReference,adjustSegmentDurations:n.adjustSegmentDurations,getLastSegmentEndTime:n.getLastSegmentEndTime,getDuration:n.getDuration,segmentLookupStrategy:_.du,mimeType:b.O.mimeType,
|
|
61
|
+
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:t,language:m,originalLanguage:e,label:f,type:b.va.contentType,primary:g,trickModeVideo:null,emsgSchemeIdUris:b.O.emsgSchemeIdUris,roles:h,channelsCount:b.O.Sd,closedCaptions:k,horizontalTiles:n.horizontalTiles,verticalTiles:n.verticalTiles,durationPerTile:q}},eF=function(a,b,c){const d=b===_.lu?_.u:b;b=c.map(e=>({scheme:e.getAttribute(uD)||"",id:e.getAttribute("id")||
|
|
62
|
+
void 0,value:e.getAttribute(_.Ge)||"",protocol:"DASH",type:d}));for(const e of a)e.accessibility=b;return a},fF=function(a,b){let c;c=b.Qc?1:0;c+=b.Ob?1:0;c+=b.bc?1:0;if(0==c){if(b.contentType==_.u||b.contentType==nD)return!0;a.a.warn("Representation does not contain a segment information source:","the Representation must contain one of SegmentBase, SegmentList,",'SegmentTemplate, or explicitly indicate that it is "text".',b);return!1}1!=c&&(a.a.warn("Representation contains multiple segment information sources:",
|
|
63
|
+
"the Representation should only contain one of SegmentBase,","SegmentList, or SegmentTemplate.",b),b.Qc?(a.a.info("Using SegmentBase by default."),b.Ob=null):a.a.info("Using SegmentList by default."),b.bc=null);return!0},gF=function(a,b,c,d){return _.y(function*(){var e=_.mv(b,c,d,a.f.attemptParameters);e.type=2;e=a.D.networkingEngine.fetch(e);_.uh(a.m,e);return(yield e.P).data})},bF=function(a,b){for(const d of b){b=d.getAttribute(uD);if(!b)continue;const e=d.getAttribute(_.Ge);if(e)switch(b){case "urn:mpeg:dash:outputChannelPositionList:2012":return e.trim().split(/ +/).length;
|
|
64
|
+
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.a.warn(cD,b,e);continue}return c;case "tag:dolby.com,2014:dash:audio_channel_configuration:2011":case "urn:dolby:dash:audio_channel_configuration:2011":c=parseInt(e,16);if(!c){a.a.warn(cD,b,e);continue}for(a=0;c;)c&1&&++a,c>>=1;return a;default:a.a.warn("Unrecognized audio channel scheme:",b,e)}}return null},hF=["http://dashif.org/thumbnail_tile","http://dashif.org/guidelines/thumbnail_tile"],
|
|
65
|
+
cF=["urn:mpeg:mpegB:cicp:ColourPrimaries","urn:mpeg:mpegB:cicp:MatrixCoefficients","urn:mpeg:mpegB:cicp:TransferCharacteristics"];var fE=class{constructor(a){this.f=a;this.a=new _.wk(a,!1)}},bE=[[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]],cE=class{constructor(a,b){this.id=a;this.a=b}};var mE=class{parse(a,b,c,d){var e;b=new fE(new DataView(b));if(440786851!=dE(b).id)throw _.If("Not an EBML element."),new _.H(_.G,3,3008);var f=dE(b);if(408125543!=f.id)throw _.If("Not a Segment element."),new _.H(_.G,3,3009);b=f.a.byteOffset;f=new fE(f.a);for(e=null;_.zj(f.a);){var g=dE(f);if(357149030==g.id){e=g;break}}if(!e)throw _.If("Not an Info element."),new _.H(_.G,3,3010);e=new fE(e.a);g=1E6;for(f=null;_.zj(e.a);){const h=dE(e);if(2807729==h.id)g=eE(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 _.H(_.G,3,3003);}if(null==f)throw new _.H(_.G,3,3011);e=g/=1E9;f*=g;a=dE(new fE(new DataView(a)));if(475249515!=a.id)throw _.If("Not a Cues element."),new _.H(_.G,3,3007);return hE(a,b,e,f,c,d)}};var iF=class{constructor(a,b){this.a=a;this.g=b;this.f={clockSyncUri:void 0}}};var EE=(new Map).set("urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b",_.Ld).set(BD,_.Lc).set(AD,_.Kc).set("urn:uuid:79f0049a-4098-8642-ab92-e65be0885f95",_.Kc).set("urn:uuid:94ce86fb-07ff-4f43-adb8-93d2fa968ca2",_.Jc).set("urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb",_.Ic),NE=(new Map).set(_.Lc,function(a){return(a=HD(a.node,"urn:microsoft","laurl"))?a.getAttribute("licenseUrl")||"":""}).set(_.Kc,function(a){a=HD(a.node,xD,"pro");if(!a)return"";a=_.$g(a.textContent);return _.$u(a).g||""});var jF=class{constructor(){this.D=this.f=null;this.j=[];this.g=null;this.C=[];this.o=1;this.F={};this.h=0;this.G=new _.Yz(5);this.w=new _.ci(()=>{this.yb()});this.m=new _.Oo;this.a=new _.Q("clpp.dash.DashParser");this.A=null;this.H=new iF(this.a,(a,b)=>{a=_.nh(a,this.f.attemptParameters);a.type=5;a.method=b;b=this.D.networkingEngine.fetch(a);_.uh(this.m,b);return b.P});this.B=new Map}configure(a){this.f=a;this.H.f={clockSyncUri:a.clockSyncUri}}start(a,b){const c=this;return _.y(function*(){c.j=[a];
|
|
67
|
+
c.D=b;const d=yield TE(c);c.D&&UE(c,d);if(!c.D)throw new _.H(_.G,7,7001);return c.g})}stop(){this.f=this.D=null;this.j=[];this.g=null;this.C=[];this.F={};this.A=null;this.h=-1;this.w.stop();this.B.clear();return this.m.destroy()}update(){TE(this).catch(a=>{if(this.D&&a)this.D.onError(a)})}onExpirationUpdated(){}setCurrentVariant(){}yb(){const a=this;return _.y(function*(){a.a.debug(_.Wt);let b=0;try{b=yield TE(a)}catch(c){if(a.D&&c.a&&(a.D.onError(c),c.severity===_.G))return}a.D&&UE(a,b)})}};_.z("clpp.dash.DashComponent",class extends _.Fp{constructor(){super()}f(){_.Fn.mpd=jF;_.Dn[_.Ub]=jF}a(){_.Hv("mpd");_.Iv(_.Ub)}g(){}release(){}id(){return"dash"}});};f.call(g, window);
|
package/cl.externs.js
CHANGED
|
@@ -137,7 +137,7 @@ clpp.EventTarget.prototype.removeEventListener = function(type, listener) {
|
|
|
137
137
|
/**
|
|
138
138
|
* @param {(HTMLMediaElement|null|string)} element
|
|
139
139
|
* @param {{abr: {bandwidthDowngradeTarget: number, bandwidthUpgradeTarget: number, defaultBandwidthEstimate: number, enabled: boolean, initialRestrictions: (undefined|{maxBandwidth: number, maxHeight: number, maxPixels: number, maxWidth: number, minBandwidth: number, minHeight: number, minPixels: number, minWidth: number}), restrictions: {maxBandwidth: number, maxHeight: number, maxPixels: number, maxWidth: number, minBandwidth: number, minHeight: number, minPixels: number, minWidth: number}, switchInterval: number, useSwitchIntervalForInitialSwitch: boolean}, autoplay: (boolean|undefined), broadpeak: (undefined|{analyticsAddress: (string|undefined), broadpeakDomainNames: (string|undefined), customParameters: (Object|null|undefined), nanoCDNHost: (string|undefined), uuid: (string|undefined)}), connectivityCheck: (undefined|{attemptParameters: (undefined|{backoffFactor: number, baseDelay: number, fatalStatusCodes: (Array<number>|undefined), fuzzFactor: number, maxAttempts: number, timeout: number}), method: (string|undefined), url: string}), conviva: (undefined|{connectionType: (string|undefined), customTags: (Object|null|undefined), customerKey: string, defaultResource: (string|undefined), deviceBrand: (string|undefined), deviceCategory: (string|undefined), deviceMetadata: (Object|null|undefined), deviceType: (string|undefined), enableAdInsights: boolean, playerName: (string|undefined), serviceUrl: (string|undefined), viewerId: string}), drm: (null|{attemptParameters: (undefined|{backoffFactor: number, baseDelay: number, fatalStatusCodes: (Array<number>|undefined), fuzzFactor: number, maxAttempts: number, timeout: number}), customData: (Object<string,*>|null|undefined), delayLicenseRequestUntilPlayed: (boolean|undefined), emeApi: (string|undefined), enableSessionCacheForSkd: (boolean|undefined), enforceSingleSession: (boolean|undefined), env: string, ignoreUnrecognizedInitData: (boolean|undefined), offlineId: (string|undefined), preferredDrmSystem: (string|undefined)}), enableHtmlCue: (boolean|undefined), fmts: (undefined|{asidConfig: (Object<string,*>|undefined), enableDrmToday: boolean}), forceWaitForTracks: (boolean|undefined), freewheel: (undefined|{keyValues: (Object<string,string>|undefined), networkId: number, parameters: (Array<{level: number, name: string, value: *}>|undefined), pods: (Array<{acceptContentType: (string|undefined), cuepointSequence: (number|undefined), id: string, maxDuration: (number|undefined), minDuration: (number|undefined), position: number, slotProfile: (string|undefined), type: number}>|undefined), profileId: string, serverUrl: string, siteSectionId: (number|string|undefined), videoAssetId: (number|string)}), hlssmpte: (undefined|{patchMetadataTrack: (boolean|undefined), timestampOffset: (number|undefined)}), htmlcue: (undefined|{enableResizeObserver: boolean, stretchSmpteImage: boolean}), ima: (undefined|{adTagUrl: string, bitrate: (number|undefined), disableCustomPlayback: (boolean|undefined), enablePreloading: (boolean|undefined), loadVideoTimeout: (number|undefined), mimeTypes: (Array<string>|null|undefined), playAdsAfterTime: (number|undefined), uiElements: (Array<string>|null|undefined), useStyledLinearAds: (boolean|undefined)}), license: string, loop: (boolean|undefined), lowLatencyMode: (boolean|undefined), manifest: {attemptParameters: {backoffFactor: number, baseDelay: number, fatalStatusCodes: (Array<number>|undefined), fuzzFactor: number, maxAttempts: number, timeout: number}, autoCorrectDrift: (boolean|undefined), availabilityWindowOverride: number, clockSyncUri: (string|undefined), hlsDefaultCodecs: (string|undefined), hlsLowLatency: (boolean|undefined), ignoreDrmInfo: boolean, liveRefreshPeriod: (number|undefined), playreadyVersion: (string|undefined), xlinkFailGracefully: boolean}, muted: (boolean|undefined), muxdata: (undefined|{envKey: string, muxLib: (Object|undefined), muxOptionsOverride: (undefined|{data: (undefined|{env_key: string, player_mux_plugin_name: (string|undefined), player_mux_plugin_version: (string|undefined), player_software_name: (string|undefined), player_software_version: (string|undefined), player_version: (string|undefined), video_id: (string|undefined), video_title: (string|undefined), viewer_user_id: (string|undefined)}), debug: (boolean|undefined)})}), pauseWhenInBackground: (boolean|undefined), preferredAudioChannelCount: number, preferredAudioCodec: (Array<string>|string), preferredAudioLanguage: (Array<string>|null|string), preferredAudioRole: string, preferredTextLanguage: (Array<string>|null|string), preferredTextRole: string, preferredVideoCodec: (Array<string>|string), remoteTextTracks: (Array<{codec: (string|undefined), kind: string, label: (string|undefined), language: string, mimeType: string, url: string}>|null|undefined), restrictions: {maxBandwidth: number, maxHeight: number, maxPixels: number, maxWidth: number, minBandwidth: number, minHeight: number, minPixels: number, minWidth: number}, safari: (undefined|{enableHlsVideoTrackInfo: (boolean|undefined), enableMetadata: (boolean|undefined)}), source: (Array<(string|{audioMimeType: (string|undefined), drmProtected: (boolean|undefined), isLive: (boolean|undefined), name: (string|undefined), type: (null|string|undefined), url: string, videoMimeType: (string|undefined)})>|null|string|{audioMimeType: (string|undefined), drmProtected: (boolean|undefined), isLive: (boolean|undefined), name: (string|undefined), type: (null|string|undefined), url: string, videoMimeType: (string|undefined)}), startTime: (null|number), streaming: {addMissingTimelineCues: (boolean|undefined), alwaysStreamText: boolean, attemptParameters: {backoffFactor: number, baseDelay: number, fatalStatusCodes: (Array<number>|undefined), fuzzFactor: number, maxAttempts: number, timeout: number}, bufferBehind: number, bufferLimitUpdateInterval: (number|undefined), bufferingGoal: number, chaseJumpDistance: number, chasingRate: number, disableAudioTracks: (boolean|undefined), disableFragmentSupport: (boolean|null), disableMergedFragments: (boolean|null), disableVideoTracks: (boolean|undefined), durationBackoff: number, enableLiveEdgeChasing: boolean, forceNativeTS: boolean, gapDetectionThreshold: number, ignoreDrift: boolean, ignoreManagedMediaSourceStreamingHints: (boolean|undefined), ignoreTextStreamFailures: boolean, jumpLargeGaps: boolean, maxSegmentToMediaOffset: number, overridePasp: boolean, patchEdgeWhenMixedContent: boolean, preferNativeHlsOnSafari: boolean, rebufferingGoal: number, relativeTextTimestamp: boolean, safeSeekOffset: number, smallGapLimit: number, stallEnabled: boolean, stallSkip: number, stallThreshold: number, startAtSegmentBoundary: boolean, startChasingAt: number, stopChasingAt: number}, suggestedPresentationDelay: (number|undefined), textStyle: (undefined|{backgroundColor: (string|undefined), edgeColor: (string|undefined), edgeType: (string|undefined), fontColor: (string|undefined), fontFamily: (string|undefined), fontSize: (string|undefined), fontSizePercent: (number|undefined), windowColor: (string|undefined)}), thumbnails: (undefined|{duration: (number|undefined), enabled: (boolean|undefined), gridSize: (string|undefined), mode: (string|undefined), preload: (Array<(number|{preloadWhileBuffering: (boolean|undefined), step: number})>|null|undefined), templateKey: (string|undefined), url: (string|undefined)}), tizen: (undefined|{sideStreamText: boolean}), ttml: (undefined|{containerHeight: number, containerWidth: number, fontSizeRadix: number}), viewerId: (string|undefined), vimond: (undefined|{authToken: string, failIfUnreachable: boolean, failOnError: boolean, playerEventRequest: {body: {client: {buildName: string, buildVersion: string, deviceId: string, drm: string, envPlatform: string, envVersion: string, pageUrl: string, playerEvent: string, playerState: (null|string), streamUrl: string, userAgent: string, videoFormat: string, videoProtocol: string, viewingSession: string}, originator: string, progress: {eventNumber: number, live: (undefined|{liveResumePossible: boolean, onLiveEdge: boolean, position: string}), vod: (undefined|{position: number})}, timestamp: string}, eventInterval: number, uri: string}}), volume: (null|number|undefined), vr: (undefined|{attachMouseListener: (boolean|undefined), enable: (boolean|undefined), fieldOfView: (number|undefined), invertHorizontalControl: (boolean|undefined), invertVerticalControl: (boolean|undefined), sensitivity: (number|undefined)}), youbora: (undefined|{errorFilter: (function(!clpp.Error): (null|{code: string, message: string, metadata: (Object|undefined), severity: number})|undefined)})}=} opt_configuration
|
|
140
|
-
* @param {{containerEl: (Element|null), crossorigin: string, disableContainer: boolean}=} opt_viewConfiguration
|
|
140
|
+
* @param {{containerEl: (Element|null), crossorigin: string, disableContainer: boolean, webOSStartupPatch: boolean}=} opt_viewConfiguration
|
|
141
141
|
* @extends {clpp.EventTarget}
|
|
142
142
|
* @implements {cl.api.IEventTarget}
|
|
143
143
|
* @implements {cl.api.IPlayer}
|
|
@@ -244,6 +244,11 @@ clpp.Player.prototype.getTextDisplayer = function() {
|
|
|
244
244
|
*/
|
|
245
245
|
clpp.Player.prototype.getTimelineCues = function() {
|
|
246
246
|
};
|
|
247
|
+
/**
|
|
248
|
+
* @return {(null|{offsetDateTime: number, seekRangeStartDateTime: number})}
|
|
249
|
+
*/
|
|
250
|
+
clpp.Player.prototype.getTimelineOffset = function() {
|
|
251
|
+
};
|
|
247
252
|
/**
|
|
248
253
|
* @return {(clpp.TrackManager|null)}
|
|
249
254
|
*/
|
|
@@ -535,7 +540,7 @@ clpp.Playlist.prototype.stop = function() {
|
|
|
535
540
|
/**
|
|
536
541
|
* @param {string} id
|
|
537
542
|
* @param {!clpp.Track} track
|
|
538
|
-
* @implements {{bandwidth: (null|number), codec: (null|string), drmInfo: (null|string), height: (null|number), id: string, originalId: (null|string), track: {channelsCount: (null|number), frameRate: (null|number), id: string, kind: (null|string), label: (null|string), language: (null|string), mimeType: (null|string), renditions: !Array<*>, roles: !Array<string>, src: (null|string), type: string}, width: (null|number)}}
|
|
543
|
+
* @implements {{bandwidth: (null|number), codec: (null|string), drmInfo: (null|string), height: (null|number), id: string, originalId: (null|string), track: {channelsCount: (null|number), frameRate: (null|number), id: string, kind: (null|string), label: (null|string), language: (null|string), mimeType: (null|string), originalLanguage: (null|string), renditions: !Array<*>, roles: !Array<string>, src: (null|string), type: string}, width: (null|number)}}
|
|
539
544
|
* @constructor
|
|
540
545
|
*/
|
|
541
546
|
clpp.Rendition = function(id, track) {
|
|
@@ -553,7 +558,7 @@ clpp.TimelineCueType = {SCTE35:1, DASH_CALLBACK:2, UNKNOWN:3};
|
|
|
553
558
|
/**
|
|
554
559
|
* @param {string} id
|
|
555
560
|
* @param {string} type
|
|
556
|
-
* @implements {{channelsCount: (null|number), frameRate: (null|number), id: string, kind: (null|string), label: (null|string), language: (null|string), mimeType: (null|string), renditions: !Array<*>, roles: !Array<string>, src: (null|string), type: string}}
|
|
561
|
+
* @implements {{channelsCount: (null|number), frameRate: (null|number), id: string, kind: (null|string), label: (null|string), language: (null|string), mimeType: (null|string), originalLanguage: (null|string), renditions: !Array<*>, roles: !Array<string>, src: (null|string), type: string}}
|
|
557
562
|
* @constructor
|
|
558
563
|
*/
|
|
559
564
|
clpp.Track = function(id, type) {
|
|
@@ -568,6 +573,7 @@ clpp.Track.prototype.kind;
|
|
|
568
573
|
clpp.Track.prototype.label;
|
|
569
574
|
clpp.Track.prototype.language;
|
|
570
575
|
clpp.Track.prototype.mimeType;
|
|
576
|
+
clpp.Track.prototype.originalLanguage;
|
|
571
577
|
clpp.Track.prototype.renditions;
|
|
572
578
|
clpp.Track.prototype.roles;
|
|
573
579
|
clpp.Track.prototype.src;
|
|
@@ -3615,17 +3621,10 @@ clpp.utils.Uint8ArrayUtils.toStandardBase64 = function(data) {
|
|
|
3615
3621
|
clpp.utils.dataview;
|
|
3616
3622
|
/**
|
|
3617
3623
|
* @param {!DataView} dataView
|
|
3618
|
-
* @param {boolean=}
|
|
3624
|
+
* @param {boolean=} endian
|
|
3619
3625
|
* @constructor
|
|
3620
3626
|
*/
|
|
3621
|
-
clpp.utils.dataview.DataViewReader = function(dataView,
|
|
3622
|
-
};
|
|
3623
|
-
clpp.utils.dataview.DataViewWriter;
|
|
3624
|
-
/**
|
|
3625
|
-
* @param {number} position
|
|
3626
|
-
* @return {undefined}
|
|
3627
|
-
*/
|
|
3628
|
-
clpp.utils.dataview.DataViewWriter.prototype.seek = function(position) {
|
|
3627
|
+
clpp.utils.dataview.DataViewReader = function(dataView, endian) {
|
|
3629
3628
|
};
|
|
3630
3629
|
clpp.utils.dom;
|
|
3631
3630
|
/**
|
package/cl.freewheel.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
if(b.length)throw new _.H(1,9,12001,{missingKeys:b.join(", ")});},
|
|
3
|
-
tv.freewheel.SDK.EVENT_SLOT_ENDED,a.I.bind(a));a.g.on(a.a,tv.freewheel.SDK.EVENT_AD,a.G.bind(a));a.g.on(a.l,_.
|
|
4
|
-
a.l.isMuted()?a.setVolume(0):a.setVolume(a.l.getVolume()||1))},
|
|
5
|
-
!0),a.getSurface().hide(this.a);else a.onError(new _.H(1,9,12E3))}onPlayerWillDestroy(a){this.a&&(a.getSurface().removeElementFromContainer(this.a),this.f=this.a=null)}id(){return
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var BK="clpp-freewheel",CK="clpp.freewheel.AdsManagerFactory",DK="freewheel",EK=function(a){switch(a){case 0:return tv.freewheel.SDK.ADUNIT_PREROLL;case 1:return tv.freewheel.SDK.ADUNIT_MIDROLL;case 2:return tv.freewheel.SDK.ADUNIT_POSTROLL;default:return""}},FK=function(a){const b=[];typeof a.networkId!==_.r&&b.push("networkId");typeof a.serverUrl!==_.pe&&b.push("serverUrl");typeof a.profileId!==_.pe&&b.push("profileId");typeof a.videoAssetId!==_.pe&&typeof a.videoAssetId!==_.r&&b.push("videoAssetId");
|
|
2
|
+
if(b.length)throw new _.H(1,9,12001,{missingKeys:b.join(", ")});},GK=function(){return _.y(function*(){var a=new _.$p;let b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_NONE;const c=yield a.canPlay(!1);a=yield a.canPlay(!0);c?b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_ATTENDED:a&&(b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_UNATTENDED);return b})},HK=function(a){a.g.on(a.a,tv.freewheel.SDK.EVENT_REQUEST_COMPLETE,a.H.bind(a));a.g.on(a.a,tv.freewheel.SDK.EVENT_SLOT_STARTED,a.J.bind(a));a.g.on(a.a,
|
|
3
|
+
tv.freewheel.SDK.EVENT_SLOT_ENDED,a.I.bind(a));a.g.on(a.a,tv.freewheel.SDK.EVENT_AD,a.G.bind(a));a.g.on(a.l,_.xe,a.F.bind(a));a.g.on(a.l,_.me,a.C.bind(a))},KK=function(a){return _.y(function*(){a.A.length?(IK(a),a.f=a.A.shift(),a.f.play()):(JK(a),yield a.l.a.play())})},JK=function(a){const b=a.l.Wb(DK).rc();b&&a.l.getSurface().hide(b);a.l.getSurface().showMediaElement()},IK=function(a){const b=a.l.Wb(DK).rc();b&&(a.l.getSurface().show(b),a.l.getSurface().hideMediaElement(),a.a.registerVideoDisplayBase(BK),
|
|
4
|
+
a.l.isMuted()?a.setVolume(0):a.setVolume(a.l.getVolume()||1))},LK=function(a){a.w.length?(IK(a),a.f=a.w.shift(),a.f.play()):JK(a)},MK=function(a,b,c){var d=null;a.a&&c&&(c.adInstance||c.slot)&&(c=(d=c.adInstance||null)?d.getSlot():c.slot,d={ad:new Y(a.a,c,d)});a.l.trigger(new _.F(b,d))},NK=class extends _.fq{constructor(){super();this.f=this.a=null}onPlayerCreated(a){if(window.tv&&tv.freewheel&&tv.freewheel.SDK)this.a=_.gm(_.Rc,{id:BK}),this.f=_.gm(_.w,{"class":_.zc}),this.a.appendChild(this.f),a.getSurface().addElementToContainer(this.a,
|
|
5
|
+
!0),a.getSurface().hide(this.a);else a.onError(new _.H(1,9,12E3))}onPlayerWillDestroy(a){this.a&&(a.getSurface().removeElementFromContainer(this.a),this.f=this.a=null)}id(){return DK}rc(){return this.a}Kf(){return this.f}};_.z("clpp.freewheel.FreeWheelPlugin",NK);NK.prototype.getAdVideo=NK.prototype.Kf;NK.prototype.getAdContainer=NK.prototype.rc;NK.Id=DK;NK.AD_CONTAINER_ID=BK;_.Nm(new class{create(){return new NK}});var Y=class{constructor(a,b,c){this.g=a;this.f=b;this.a=c}pb(){return"FreeWheel AdManager SDK"}qb(){return tv.freewheel.SDK.version}vb(){return 0}getId(){return this.a?this.a.getAdId():""}getCreativeId(){const a=(this.a||{})._creativeId;return typeof a===_.pe?a:""}getApiFramework(){return this.a?this.a.getActiveCreativeRendition().getCreativeApi():""}getAdSystem(){return""}getAdvertiserName(){return""}getTitle(){return""}getDuration(){return this.a?this.a.getActiveCreativeRendition().getDuration():
|
|
6
6
|
0}getSkipTimeOffset(){return 0}$b(){return!1}Hb(){return this.a&&this.a.getEventCallbackUrls(tv.freewheel.SDK.EVENT_AD_CLICK,tv.freewheel.SDK.EVENT_TYPE_CLICK)[0]||""}getMediaUrl(){return this.a?this.a.getActiveCreativeRendition().getPrimaryCreativeRenditionAsset().getUrl():""}sb(){return this.a?this.a.getActiveCreativeRendition().getWidth():0}rb(){return this.a?this.a.getActiveCreativeRendition().getHeight():0}gb(){return 0}Sa(){switch(this.f.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:return 0;
|
|
7
7
|
case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:return 2;default:return 1}}getPodIndex(){switch(this.Sa()){case 0:return 0;case 2:return-1}return this.g.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL).indexOf(this.f)+1}Ib(){switch(this.Sa()){case 0:return 0;case 2:return-1;default:return this.f.getTimePosition()}}Jb(){return this.a?this.f.getAdInstances().indexOf(this.a)+1:1}ub(){return this.f.getAdCount()}getWrapperAdIds(){return[]}getWrapperAdSystems(){return[]}getWrapperCreativeIds(){return[]}};
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
_.r||a.a.setSiteSection(b.siteSectionId);const c=yield
|
|
13
|
-
if(Array.isArray(b.parameters))for(const d of b.parameters)a.a.setParameter(d.name,d.value,d.level);
|
|
14
|
-
a.h&&(a.h.stop(),a.h=null);
|
|
15
|
-
9,10003,{errorType:0},void 0));this.j.resolve()}J(a){
|
|
16
|
-
_.
|
|
17
|
-
_.
|
|
18
|
-
.5>Math.abs(a-b.getTimePosition()))||null){const b=this.m.findIndex(c=>c===this.f);this.m.splice(b,1);this.l.pause();
|
|
19
|
-
|
|
8
|
+
Y.prototype.getWrapperCreativeIds=Y.prototype.getWrapperCreativeIds;Y.prototype.getWrapperAdSystems=Y.prototype.getWrapperAdSystems;Y.prototype.getWrapperAdIds=Y.prototype.getWrapperAdIds;Y.prototype.getSequenceLength=Y.prototype.ub;Y.prototype.getPositionInSequence=Y.prototype.Jb;Y.prototype.getPodTimeOffset=Y.prototype.Ib;Y.prototype.getPodIndex=Y.prototype.getPodIndex;Y.prototype.getPodType=Y.prototype.Sa;Y.prototype.getMediaBitrate=Y.prototype.gb;Y.prototype.getMediaHeight=Y.prototype.rb;
|
|
9
|
+
Y.prototype.getMediaWidth=Y.prototype.sb;Y.prototype.getMediaUrl=Y.prototype.getMediaUrl;Y.prototype.getClickThroughUrl=Y.prototype.Hb;Y.prototype.isBumper=Y.prototype.$b;Y.prototype.getSkipTimeOffset=Y.prototype.getSkipTimeOffset;Y.prototype.getDuration=Y.prototype.getDuration;Y.prototype.getTitle=Y.prototype.getTitle;Y.prototype.getAdvertiserName=Y.prototype.getAdvertiserName;Y.prototype.getAdSystem=Y.prototype.getAdSystem;Y.prototype.getApiFramework=Y.prototype.getApiFramework;
|
|
10
|
+
Y.prototype.getCreativeId=Y.prototype.getCreativeId;Y.prototype.getId=Y.prototype.getId;Y.prototype.getTechnology=Y.prototype.vb;Y.prototype.getAdManagerVersion=Y.prototype.qb;Y.prototype.getAdManagerName=Y.prototype.pb;var OK=class{constructor(a){this.a=a}getCuePoints(){return this.a.getTemporalSlots().map(a=>{switch(a.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:return 0;case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:return-1;default:return a.getTimePosition()}})}Kb(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL).length}hb(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL).length}};
|
|
11
|
+
OK.prototype.hasPostroll=OK.prototype.hb;OK.prototype.hasPreroll=OK.prototype.Kb;OK.prototype.getCuePoints=OK.prototype.getCuePoints;var PK=class{constructor(a){this.B=new _.Q("clpp.freewheel.AdsManager");this.l=a;this.g=new _.po;this.o=new tv.freewheel.SDK.AdManager;this.f=this.a=null;this.A=[];this.m=[];this.w=[];this.j=new _.Sk;this.h=null}load(){const a=this;return _.y(function*(){const b=a.l.getConfiguration().freewheel||{};try{FK(b)}catch(d){return a.l.onError(d),a.j.resolve(),a.j}a.o.setNetwork(b.networkId);a.o.setServer(b.serverUrl);a.a=a.o.newContext();a.a.setProfile(b.profileId);typeof b.siteSectionId!==_.pe&&typeof b.siteSectionId!==
|
|
12
|
+
_.r||a.a.setSiteSection(b.siteSectionId);const c=yield GK();a.a.setVideoAsset(b.videoAssetId,a.l.getDuration(),void 0,void 0,c);if(Array.isArray(b.pods))for(const d of b.pods)a.a.addTemporalSlot(d.id,EK(d.type),d.position,d.slotProfile,d.cuepointSequence,d.maxDuration,d.minDuration,d.acceptContentType);b.keyValues&&typeof b.keyValues===_.Dd&&Object.keys(b.keyValues).forEach(d=>a.a.addKeyValue(d,b.keyValues[d]));a.a.setParameter(tv.freewheel.SDK.PARAMETER_EXTENSION_CONTENT_VIDEO_ENABLED,!1,tv.freewheel.SDK.PARAMETER_LEVEL_GLOBAL);
|
|
13
|
+
if(Array.isArray(b.parameters))for(const d of b.parameters)a.a.setParameter(d.name,d.value,d.level);HK(a);a.a.submitRequest();return a.j})}start(){const a=this;return _.y(function*(){yield KK(a)})}resume(){this.f&&this.f.resume()}pause(){this.f&&this.f.pause()}skip(){this.f&&this.f.skipCurrentAd()}getVolume(){return this.a?this.a.getAdVolume():1}setVolume(a){this.a&&this.a.setAdVolume(a)}getPosition(){return this.f?this.f.getPlayheadTime():-1}dispose(){const a=this;return _.y(function*(){a.g.release();
|
|
14
|
+
a.h&&(a.h.stop(),a.h=null);JK(a);a.a&&(a.a.dispose(),a.a=null)})}H(a){if(a.success)this.A=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL),this.m=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL),this.w=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL),this.l.trigger(new _.F(_.Nb,{adsTimeline:new OK(this.a)})),this.h=new _.Yp(this.l.getSurface(),(b,c)=>this.a.resize(b,c),this.l.Wb(DK).f);else this.l.onError(new _.H(1,
|
|
15
|
+
9,10003,{errorType:0},void 0));this.j.resolve()}J(a){MK(this,_.wb,a);this.h.start()}I(a){this.f=null;a=a.slot;MK(this,_.xb);this.h.stop();if(a)switch(a.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:KK(this);break;case tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL:JK(this);this.l.play();break;case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:LK(this)}}G(a){const b=a.subType;this.B.debug("ad event",b);switch(b){case tv.freewheel.SDK.EVENT_AD_IMPRESSION:MK(this,_.Jb,a);MK(this,
|
|
16
|
+
_.Cb,a);break;case tv.freewheel.SDK.EVENT_AD_IMPRESSION_END:MK(this,_.Kb,a);break;case tv.freewheel.SDK.EVENT_AD_FIRST_QUARTILE:MK(this,_.Bb,a);break;case tv.freewheel.SDK.EVENT_AD_MIDPOINT:MK(this,_.Eb,a);break;case tv.freewheel.SDK.EVENT_AD_THIRD_QUARTILE:MK(this,_.Lb,a);break;case tv.freewheel.SDK.EVENT_AD_COMPLETE:MK(this,_.Ab,a);break;case tv.freewheel.SDK.EVENT_AD_CLICK:MK(this,_.zb,a);break;case tv.freewheel.SDK.EVENT_AD_PAUSE:MK(this,_.Fb,a);break;case tv.freewheel.SDK.EVENT_AD_RESUME:MK(this,
|
|
17
|
+
_.Hb,a);break;case tv.freewheel.SDK.EVENT_AD_SKIPPED:MK(this,_.Ib,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_START:MK(this,_.yb,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_END:MK(this,_.Gb,a);break;case tv.freewheel.SDK.EVENT_ERROR:this.l.onError(new _.H(1,9,10003,{errorType:1},{fwCode:a[tv.freewheel.SDK.INFO_KEY_ERROR_CODE],fwInfo:a[tv.freewheel.SDK.INFO_KEY_ERROR_INFO],fwModule:a[tv.freewheel.SDK.INFO_KEY_ERROR_MODULE]}))}}F(){if(!this.f){var a=this.l.getPosition();if(this.f=this.m.find(b=>
|
|
18
|
+
.5>Math.abs(a-b.getTimePosition()))||null){const b=this.m.findIndex(c=>c===this.f);this.m.splice(b,1);this.l.pause();IK(this);this.f.play()}}}C(a){if((a=a.detail)&&this.a)switch(a.currentState){case _.Nl:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PLAYING);break;case _.Ml:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PAUSED);break;case _.Cl:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_COMPLETED);LK(this);break;case _.Kl:case _.Jl:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_STOPPED)}}};
|
|
19
|
+
PK.prototype.getPosition=PK.prototype.getPosition;PK.prototype.setVolume=PK.prototype.setVolume;PK.prototype.getVolume=PK.prototype.getVolume;PK.prototype.skip=PK.prototype.skip;PK.prototype.pause=PK.prototype.pause;PK.prototype.resume=PK.prototype.resume;PK.prototype.start=PK.prototype.start;var QK=class{constructor(){this.a=new _.Q(CK)}name(){return CK}ea(a,b){return a.namespace()===_.Bc?!1:window.tv&&tv.freewheel&&tv.freewheel.SDK?!(!b||!b.freewheel):(this.a.warn("FreeWheel SDK is not loaded."),!1)}create(a){return new PK(a)}};QK.prototype.create=QK.prototype.create;QK.prototype.isSupported=QK.prototype.ea;QK.prototype.name=QK.prototype.name;_.dm(new QK);};f.call(g, window);
|