@castlabs/prestoplay 6.32.0-beta.2 → 6.32.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 +5 -0
- package/cjs/cl.adobe.js +3 -3
- package/cjs/cl.airplay.js +3 -3
- package/cjs/cl.broadpeak.js +18 -18
- package/cjs/cl.cast.js +126 -126
- package/cjs/cl.conviva.js +32 -32
- package/cjs/cl.core.js +604 -604
- package/cjs/cl.crypto.js +9 -9
- package/cjs/cl.dash.js +101 -101
- package/cjs/cl.externs.js +1 -29
- package/cjs/cl.freewheel.js +26 -26
- package/cjs/cl.hls.js +77 -77
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +30 -30
- package/cjs/cl.ima.js +26 -26
- package/cjs/cl.mediatailor.js +3 -3
- package/cjs/cl.mse.js +352 -352
- package/cjs/cl.muxdata.js +14 -14
- package/cjs/cl.onboard.js +4 -4
- package/cjs/cl.persistent.js +14 -14
- package/cjs/cl.playlist.js +6 -6
- package/cjs/cl.simid.js +16 -16
- package/cjs/cl.smooth.js +71 -71
- package/cjs/cl.thumbnails.js +25 -25
- package/cjs/cl.tizen.js +71 -71
- package/cjs/cl.ttml.js +29 -29
- package/cjs/cl.verimatrix.js +5 -5
- package/cjs/cl.vimond.js +12 -12
- package/cjs/cl.vr.js +18 -18
- package/cjs/cl.vtt.js +14 -14
- package/cjs/cl.yospace.js +4 -4
- package/cjs/cl.youbora.js +38 -38
- package/cjs/polyfill.min.js +2 -2
- package/cl.adobe.js +3 -3
- package/cl.airplay.js +3 -3
- package/cl.broadpeak.js +14 -14
- package/cl.cast.js +100 -100
- package/cl.conviva.js +27 -27
- package/cl.core.js +488 -487
- package/cl.crypto.js +8 -8
- package/cl.dash.js +75 -75
- package/cl.externs.js +1 -25
- package/cl.freewheel.js +20 -20
- package/cl.hls.js +65 -65
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +26 -26
- package/cl.ima.js +19 -19
- package/cl.mediatailor.js +2 -2
- package/cl.mse.js +200 -200
- package/cl.muxdata.js +12 -12
- package/cl.onboard.js +3 -3
- package/cl.persistent.js +8 -8
- package/cl.playlist.js +4 -4
- package/cl.simid.js +2 -2
- package/cl.smooth.js +47 -47
- package/cl.thumbnails.js +12 -12
- package/cl.tizen.js +41 -41
- package/cl.ttml.js +10 -10
- package/cl.verimatrix.js +4 -4
- package/cl.vimond.js +8 -8
- package/cl.vr.js +3 -3
- package/cl.vtt.js +11 -11
- package/cl.yospace.js +3 -3
- package/cl.youbora.js +27 -27
- package/package.json +1 -1
- package/typings.d.ts +6 -22
- package/cjs/cl.cdn.js +0 -13
- package/cl.cdn.js +0 -7
package/cjs/cl.smooth.js
CHANGED
|
@@ -1,75 +1,75 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var
|
|
3
|
-
b,a.h),a.a+=2}catch(c){_.
|
|
4
|
-
a);this.version=b;this.flags=c},
|
|
5
|
-
"mvex")},
|
|
6
|
-
a);this.w=!0},
|
|
7
|
-
this.sb[0][2];this.level=this.sb[0][3]},
|
|
8
|
-
|
|
9
|
-
new Uint8Array(0)},
|
|
10
|
-
a:a+"/Manifest"},
|
|
11
|
-
|
|
12
|
-
(Number(c[4])||0)/1E3+(Number(c[3])||0)+60*(Number(c[2])||0)+3600*(Number(c[1])||0)},
|
|
13
|
-
3600*b-60*c);d-=a;10>b&&(b="0"+b);10>c&&(c="0"+c);10>a&&(a="0"+a);0===d?d="000":d=Math.round(1E3*d);return b+":"+c+":"+a+"."+d},
|
|
14
|
-
_.v([_.
|
|
15
|
-
a.id),e=(new
|
|
16
|
-
[l]),l=new
|
|
17
|
-
function(m){var n=new
|
|
18
|
-
d=p}).da("trun",function(m){var n=m.reader.
|
|
19
|
-
e=p}).da("sdtp",function(m){var n=_.
|
|
20
|
-
n}}).N(_.Pe,function(m){var n=new
|
|
21
|
-
if(c){e=_.R.
|
|
22
|
-
p.getAttribute(q);else{q=p.attributes;for(var
|
|
23
|
-
6*c.f[m].
|
|
24
|
-
return{initData:_.
|
|
25
|
-
c.baseDelay=a.f.attemptParameters.baseDelay,c.backoffFactor=a.f.attemptParameters.backoffFactor,c.fuzzFactor=a.f.attemptParameters.fuzzFactor,c.type=1,d=a.F.networkingEngine.fetch(c),_.
|
|
26
|
-
m="TRUE"===d.getAttribute("IsLive"),n=+d.getAttribute("LookAheadCount"),p=+d.getAttribute("DVRWindowLength")||Infinity,q=c.aa(d,"Protection")[0];if(!1===/^[2].[0-2]$/.test(""+f+"."+g))throw a.g.error("Smooth Streaming version must be 2.0, 2.1 or 2.2"),new _.O(_.P,4,4036,a.o);m?(
|
|
27
|
-
"ProtectionHeader")[0],D=_.
|
|
28
|
-
Uc=+V.getAttribute(_.db),
|
|
29
|
-
|
|
30
|
-
td=new Uint16Array(1),td[0]=(Nb[0]<<8)+Nb[1],
|
|
31
|
-
new _.O(_.P,4,4037,U.o);0===
|
|
32
|
-
|
|
33
|
-
endTime:
|
|
34
|
-
a.f.timeline||{};
|
|
35
|
-
l.zc.type&&m.bitrate===l.zc.bitrate}}(e))){
|
|
36
|
-
{td:0};f.td<d.length;f={td:f.td},f.td++){var g=d[f.td].tracks.map(function(k){return function(l){var m=d[k.td],n=
|
|
37
|
-
l.
|
|
38
|
-
originalLanguage:m.Qd,label:m.name,type:m.type,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:l.
|
|
39
|
-
c.type===_.
|
|
40
|
-
c.bandwidth:0)+(b?b.bandwidth:0),e=c?c.language:_.Gg;return c||b?{id:a.h++,language:e,primary:!1,audio:c,video:b,bandwidth:d,drmInfos:a.w,allowedByApplication:!0,allowedByKeySystem:!0}:null},
|
|
41
|
-
a.l&&(window.clearTimeout(a.l),a.l=null,a.B=null);a.M=b},
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
Z.prototype.write=function(a){
|
|
45
|
-
_.w(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
_.w(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
_.w(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
_.w(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
_.r.update=function(){var a=this;if(this.
|
|
70
|
-
_.r.
|
|
71
|
-
_.r.
|
|
72
|
-
!0,e.data=k,3E3===k.code&&(e.code=4039)}if(d||!f)return Promise.reject(e);a.data=f;return Promise.resolve(a)};_.r.loadVariant=function(a){return _.I(function(b){return b["return"](a)})};_.r.loadTextStream=function(a,b){var c=this,d,e;return _.I(function(f){(e=c.j.periods.find(function(g){return g.id===b}))&&(d=e.textStreams.find(function(g){return g.id===a})||null);if(!d)throw new _.
|
|
2
|
+
var f=function(window){var VQ="Full MP4 box must have flags defined",WQ="clpp.smooth.SmoothMP4Processor",XQ="codecPrivateData",YQ=function(a,b){var c=Math.floor(b/Math.pow(2,32)),d=b-c*Math.pow(2,32);_.W(a,c);_.W(a,d)},ZQ=function(a,b){try{a.f.setUint8(a.a,b),a.a+=1}catch(c){_.cq()}},$Q=function(a,b){ZQ(a,b>>16&255);ZQ(a,b>>8&255);ZQ(a,b&255)},aR=function(a,b){try{a.f.setUint16(a.a,b,a.h),a.a+=2}catch(c){_.cq()}},bR=function(a,b){try{a.f.setInt32(a.a,b,a.h),a.a+=4}catch(c){_.cq()}},cR=function(a,b){try{a.f.setInt16(a.a,
|
|
3
|
+
b,a.h),a.a+=2}catch(c){_.cq()}},dR=function(a,b){for(var c=0;c<a.a.length;++c)if(a.a[c].endTime>b)return a.a.splice(0,c);c=a.a;a.a=[];return c},eR=function(a,b){if(void 0!==b){for(var c=new Uint8Array(b),d=Math.min(a.length,b),e=0;e<d;++e)c[e]=a.charCodeAt(e);for(;e<b;e++)c[e]=0;return c}c=new Uint8Array(a.length);for(d=0;d<a.length;++d)c[d]=a.charCodeAt(d);return c},fR=function(a){this.type=a;this.size=this.start=0;this.parent=null;this.w=!1;this.entries=[];this.children=[]},Z=function(a,b,c){fR.call(this,
|
|
4
|
+
a);this.version=b;this.flags=c},gR=function(a,b,c){fR.call(this,a);this.f=b;this.offset=c},hR=function(a,b,c,d,e){Z.call(this,a,b,c);this.f=d;this.offset=e},iR=function(a,b,c){fR.call(this,"ftyp");this.h=a;this.fj=b;this.f=c},jR=function(){fR.call(this,_.We)},kR=function(){fR.call(this,_.Dg)},lR=function(a,b,c){Z.call(this,"mvhd",1,0);this.timescale=a;this.duration=b;this.volume=256;this.h=c+1;this.f=[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0]},mR=function(){fR.call(this,
|
|
5
|
+
"mvex")},nR=function(a){Z.call(this,"trex",0,0);this.f=a},oR=function(a,b,c,d,e){Z.call(this,"tkhd",1,7);this.h=a;this.duration=b;this.timescale=c;this.width=d;this.height=e;this.volume=1;this.f=[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0]},pR=function(a,b){Z.call(this,"mdhd",1,0);this.timescale=a;this.duration=b;this.language=21956},qR=function(a){Z.call(this,"hdlr",0,0);this.f=a},rR=function(){Z.call(this,"vmhd",0,1);this.f=new Uint8Array([0,0,0,0,0,0])},sR=function(a){fR.call(this,
|
|
6
|
+
a);this.w=!0},tR=function(a){sR.call(this,a);this.height=this.width=0;this.depth=24},uR=function(a,b,c,d){sR.call(this,a);this.channelCount=b;this.sampleSize=c;this.sampleRate=d},vR=function(a,b){tR.call(this,"avc1");this.width=a;this.height=b},wR=function(a,b){vR.call(this,a,b);this.type="encv"},xR=function(a,b,c){uR.call(this,"mp4a",a,b,c)},yR=function(a,b,c){xR.call(this,a,b,c);this.type="enca"},zR=function(a,b){fR.call(this,"avcC");this.sb=a;this.Kc=b;this.version=1;this.f=this.sb[0][1];this.h=
|
|
7
|
+
this.sb[0][2];this.level=this.sb[0][3]},AR=function(a){Z.call(this,"esds",0,0);this.Ac=a},BR=function(a){a=void 0===a?"":a;Z.call(this,"url ",0,1);this.location=a},CR=function(){Z.call(this,"dref",0,0)},DR=function(){fR.call(this,_.mg)},ER=function(){Z.call(this,_.og,0,0)},FR=function(){Z.call(this,"stts",0,0)},GR=function(){Z.call(this,"stsc",0,0)},HR=function(){Z.call(this,"stco",0,0)},IR=function(){Z.call(this,"stsz",0,0)},JR=function(){Z.call(this,"smhd",0,0)},KR=function(){fR.call(this,"dinf")},
|
|
8
|
+
LR=function(){fR.call(this,_.Ve)},MR=function(){fR.call(this,_.Qe)},NR=function(a,b){Z.call(this,"tfdt",a,0);this.baseMediaDecodeTime=b},OR=function(){Z.call(this,"mfhd",0,0);this.f=0},PR=function(a,b){Z.call(this,"trun",a,b);this.l=this.j=this.f=0;this.o=[];this.sampleSize=[];this.A=[];this.h=[]},QR=function(a,b){Z.call(this,"tfhd",a,b);this.f=255;this.l=this.o=this.j=this.A=this.h=0},RR=function(){fR.call(this,"traf")},SR=function(){fR.call(this,"moof")},TR=function(){fR.call(this,_.Pe);this.f=
|
|
9
|
+
new Uint8Array(0)},UR=function(){Z.call(this,"tenc",0,0);this.f=1;this.h=8;this.l="";this.j=[]},VR=function(a,b){Z.call(this,"schm",0,0);this.f=a;this.h=b;this.tc=""},WR=function(a){fR.call(this,"frma");this.f=a},YR=function(){Z.call(this,"saio",0,0);this.offset=[0]},ZR=function(a,b,c){Z.call(this,"saiz",0,0);this.f=a;this.j=b;this.h=c},$R=function(a,b){Z.call(this,"senc",a,b);this.h=0;this.j=8;this.f=[]},aS=function(a){var b=a.split("/");return b[b.length-1].toLowerCase().match("manifest(\\(.+\\))?")?
|
|
10
|
+
a:a+"/Manifest"},bS=function(a,b,c,d){c=b.Bi[c];b=b.tp;a=a.replace("Manifest","");b=b.replace("{bitrate}",String(d.bitrate)).replace("{Bitrate}",String(d.bitrate)).replace("{start time}",String(c.t)).replace("{start_time}",String(c.t));return _.zC([a],[b])[0]},cS=function(a,b){if(a.type!==b.type)return!1;var c=[];a.type===_.Tg?c=["maxWidth","maxHeight","bitrate",XQ,"fourCC"]:a.type===_.Tc&&(c=["bitrate",XQ,"channels","bitsPerSample","samplingRate","fourCC"]);return _.N.ua(a,b,c,["id","segmentIndex"])},
|
|
11
|
+
dS=function(a,b,c){var d=c.zf.split("00000001");a={id:1,type:c.type,duration:a/b,timescale:b,sb:null,Kc:null,width:NaN,height:NaN,Ac:null,We:NaN,sampleSize:NaN,channelCount:NaN};switch(c.type){case _.Tg:a.sb=[_.Mm(d[1])];a.Kc=[_.Mm(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.Tc:a.Ac=_.Mm(c.zf),a.sampleSize=c.xk||16,a.We=c.We,a.channelCount=c.Wh}return a},eS=function(a,b){return a.filter(function(c){return c.type===b})},fS=function(a,b){var c=a.exec(b);return null==c||""===c[0]?null:
|
|
12
|
+
(Number(c[4])||0)/1E3+(Number(c[3])||0)+60*(Number(c[2])||0)+3600*(Number(c[1])||0)},mS=function(a,b,c){var d=null;if(gS.test(a)){a=gS.exec(a);d=Number(a[1]);var e=Number(a[2]),f=Number(a[3]),g=Number(a[4]);g+=(Number(a[5])||0)/c.f;f+=g/c.frameRate;d=f+60*e+3600*d}else hS.test(a)?d=fS(hS,a):iS.test(a)?d=fS(iS,a):jS.test(a)?(a=jS.exec(a),d=Number(a[1])/c.frameRate):kS.test(a)?(a=kS.exec(a),d=Number(a[1])/c.a):lS.test(a)&&(d=fS(lS,a));d+=b;b=Math.floor(d/3600);c=Math.floor((d-3600*b)/60);a=Math.floor(d-
|
|
13
|
+
3600*b-60*c);d-=a;10>b&&(b="0"+b);10>c&&(c="0"+c);10>a&&(a="0"+a);0===d?d="000":d=Math.round(1E3*d);return b+":"+c+":"+a+"."+d},nS=function(a,b,c,d){this.frameRate=Number(a)||30;this.f=Number(b)||1;this.a=Number(d);0===this.a&&(this.a=a?this.frameRate*this.f:1);c&&(a=/^(\d+) (\d+)$/g.exec(c))&&(this.frameRate*=parseInt(a[1],10)/parseInt(a[2],10))},pS=function(a){this.a=a;this.f=oS(this)},oS=function(a){for(var b=0,c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.bq(b)},qS=function(a,b,c){a:{var d=
|
|
14
|
+
_.v([_.Nd,_.Ld]);for(var e=d.next();!e.done;e=d.next())if((e=c.If(e.value))&&e.keyId){d=e.keyId;break a}_.Rh(WQ,"Could not get default Key ID for DRM init data!");d=null}c=new fR("xxxx");a.type===_.Tg?c=new wR(a.width,a.height):c=new yR(a.channelCount,a.sampleSize,a.We);a=new UR;a.f=1;a.h=8;a.l=d||"00000000000000000000000000000000";a=(new fR("schi")).append([a]);b=(new fR(_.gg)).append([new WR(b),new VR(_.nd,65536),a]);c.append([b]);return c},rS=function(a,b){var c=b.Kf(),d=new lR(a.timescale,a.duration,
|
|
15
|
+
a.id),e=(new mR).append([new nR(a.id)]),f=new oR(a.id,a.duration,a.timescale,a.width,a.height),g=new pR(a.timescale,a.duration),k=new qR(a.type),l=null,m=new CR;m.entries=[new BR];var n=new ER;switch(a.type){case _.Tg:var p=new zR(a.sb,a.Kc);c?(l=qS(a,"avc1",b),l.append([p]),n.entries=[l]):(l=(new vR(a.width,a.height)).append([p]),n.entries=[l]);l=new rR;break;case _.Tc:p=new AR(a.Ac),c?(l=qS(a,"mp4a",b),l.append([p]),n.entries=[l]):(l=(new xR(a.channelCount,a.sampleSize,a.We)).append([p]),n.entries=
|
|
16
|
+
[l]),l=new JR}n=(new DR).append([n,new FR,new GR,new IR,new HR]);m=(new KR).append([m]);m=(new LR).append([l,m,n]);g=(new MR).append([g,k,m]);f=(new kR).append([f,g]);d=(new jR).append([d,f,e]);e=new iR("dash",0,["iso6","mp41","avc1"]);c&&(c=b.If(_.Ld),f=b.If(_.Nd),c&&d.append([new gR("pssh",c.initData,8)]),f&&d.append([new gR("pssh",f.initData,8)]),c||f||_.Rh(WQ,"Could not get PSSH init data!"));c=new pS([e,d]);return _.Ri(c.write())},tS=function(a,b){var c,d,e,f,g,k;(new _.oq).N("moof",_.pq).da("mfhd",
|
|
17
|
+
function(m){var n=new OR;n.f=_.jq(m.reader);c=n}).N("traf",_.pq).da("tfhd",function(m){var n=m.reader.bb();if(null===m.flags)throw new _.O(_.P,3,3019,VQ);var p=new QR(m.version||0,m.flags||0);p.f=_.jq(m.reader);0<n-m.reader.getPosition()&&m.flags&1&&(p.h=_.lq(m.reader));0<n-m.reader.getPosition()&&m.flags&2&&(p.A=_.jq(m.reader));0<n-m.reader.getPosition()&&m.flags&8&&(p.j=_.jq(m.reader));0<n-m.reader.getPosition()&&m.flags&16&&(p.o=_.jq(m.reader));0<n-m.reader.getPosition()&&m.flags&32&&(p.l=_.jq(m.reader));
|
|
18
|
+
d=p}).da("trun",function(m){var n=m.reader.bb();if(null===m.flags)throw new _.O(_.P,3,3019,VQ);var p=new PR(m.version||0,m.flags||0);p.f=_.jq(m.reader);0<n-m.reader.getPosition()&&m.flags&1&&(p.j=_.kq(m.reader));0<n-m.reader.getPosition()&&m.flags&4&&(p.l=_.jq(m.reader));if(0<n-m.reader.getPosition())for(n=0;n<p.f;n++)m.flags&256&&p.o.push(_.jq(m.reader)),m.flags&512&&p.sampleSize.push(_.jq(m.reader)),m.flags&1024&&p.A.push(_.jq(m.reader)),m.flags&2048&&(0===m.version?p.h.push(_.jq(m.reader)):p.h.push(_.kq(m.reader)));
|
|
19
|
+
e=p}).da("sdtp",function(m){var n=_.nq(m.reader,m.reader.bb());f=new hR("sdtp",m.version||0,m.flags||0,n,0)}).N("uuid",function(m){var n=_.nq(m.reader,16);if(_.Om(n,sS)){n=_.jq(m.reader);m.version=n>>>24;m.flags=n&16777215;n=new $R(m.version,m.flags);n.h=_.jq(m.reader);m.flags&1&&(n.j=_.hq(m.reader));for(var p=0;p<n.h;p++){var q={Ti:_.nq(m.reader,8),Wd:0,rh:[]};if(m.flags&2){q.Wd=_.iq(m.reader);for(var t=0;t<q.Wd;t++){var u={Sh:0,Th:0};u.Sh=_.iq(m.reader);u.Th=_.jq(m.reader);q.rh.push(u)}}n.f.push(q)}g=
|
|
20
|
+
n}}).N(_.Pe,function(m){var n=new TR;0<m.reader.bb()?n.f=_.nq(m.reader,m.reader.bb()):(_.Rh(WQ,"mdat box is empty!"),n.f=new Uint8Array(0));k=n}).parse(a,!1);if(!k)return null;var l=(new RR).append([d,e]);f&&l.append([f]);b.Kf()&&g&&l.append([g]);l=(new SR).append([c,l]);return new pS([l,k])},uS=function(a,b,c,d){var e=d.Kf(),f=parseInt(c*b,10);b=a.data||new ArrayBuffer(0);var g=tS(b,d);if(null===g)return a.request.contentType===_.Cn?a.data:g;d=g.get(_.Pe);if(a.request.contentType===_.Cn){e=d.f.buffer;
|
|
21
|
+
if(c){e=_.R.xe(e);if((e=(new DOMParser).parseFromString(e,_.vg))&&"tt"===e.documentElement.tagName.toLowerCase())var k=e.documentElement;if(k&&(d=new nS(k.getAttribute("ttp:frameRate"),k.getAttribute("ttp:subFrameRate"),k.getAttribute("ttp:frameRateMultiplier"),k.getAttribute("ttp:tickRate")),k=k.getElementsByTagName("body")[0]))for(k=k.getElementsByTagName("p"),a=0,b=k.length;a<b;a++){f=k[a];g=c;for(var l=["begin",_.pe],m=0,n=l.length;m<n;m++){b:{var p=f;var q=l[m],t=new RegExp("\\w+:"+q),u=0;if(p.hasAttribute(q))p=
|
|
22
|
+
p.getAttribute(q);else{q=p.attributes;for(var y=q.length;u<y;u++){var B=q[u].name;if(B=B.match(t)){p=p.getAttribute(B[0]);break b}}p=null}}f.setAttribute(l[m],mS(p||"",g,d))}}e=(new XMLSerializer).serializeToString(e);c=_.R.ub(e).buffer}else c=e;return c}k=new SR;a=g.get("mfhd");b=new RR;l=g.get("tfhd");m=new NR(1,f);f=g.get("trun");n=g.get("sdtp");c=g.get("senc");l.f=1;l.flags&=16777214;l.flags|=131072;b.append([l,m,f]);n&&b.append([n]);if(e){g=0;l=[];if(c.flags&2)for(l=[],m=0;m<c.h;m++)l.push(10+
|
|
23
|
+
6*c.f[m].Wd);else g=8;b.append([c,new YR,new ZR(g,l,c.h)])}k.append([a,b]);f.flags|=1;f.j=k.a()+8;d=new pS([k,d]);k=d.write();e&&(e=d.get("saio"),d=d.f,e.offset[0]=c.start+16,d.seek(e.start),e.write(d),k=d.buffer);return k},vS=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,periodId:null}},wS=function(a,b,c){a=_.Qr(a);c&&a.version!==c&&(a=_.pC(a,c));
|
|
24
|
+
return{initData:_.nC(a),initDataType:_.nd,keyId:b,periodId:null}},yS=function(){this.A=this.j=this.f=this.F=null;this.h=1;this.P=0;this.o="";this.D=this.a=null;this.g=new _.M("clpp.smooth.SmoothParser");this.K=!1;this.l=this.B=null;this.M=xS;this.I=0;this.G=this.J=Infinity;this.w=[];this.L=this.Mo.bind(this);this.H=new Map},zS=function(a,b){var c,d,e;return _.I(function(f){if(1==f.a)return c=_.Zk(b),c.timeout=a.f.attemptParameters.timeout,c.maxAttempts=Math.max(a.f.attemptParameters.maxAttempts,b.length),
|
|
25
|
+
c.baseDelay=a.f.attemptParameters.baseDelay,c.backoffFactor=a.f.attemptParameters.backoffFactor,c.fuzzFactor=a.f.attemptParameters.fuzzFactor,c.type=1,d=a.F.networkingEngine.fetch(c),_.x(f,d.U,2);e=f.f;a.o=e.uri;return f["return"](e)})},GS=function(a,b){var c=_.Lr,d=null;try{var e=_.R.xe(b);d=c.Ue(e,_.Jb)}catch(aY){}if(!d)throw a.g.error("Unable to parse manifest"),new _.O(_.P,4,4033,a.o);var f=+AS(a,d,"MajorVersion"),g=+AS(a,d,"MinorVersion"),k=+d.getAttribute("TimeScale")||1E7,l=+AS(a,d,"Duration"),
|
|
26
|
+
m="TRUE"===d.getAttribute("IsLive"),n=+d.getAttribute("LookAheadCount"),p=+d.getAttribute("DVRWindowLength")||Infinity,q=c.aa(d,"Protection")[0];if(!1===/^[2].[0-2]$/.test(""+f+"."+g))throw a.g.error("Smooth Streaming version must be 2.0, 2.1 or 2.2"),new _.O(_.P,4,4036,a.o);m?(BS(a,CS),a.B=typeof a.f.liveRefreshPeriod===_.h?1E3*a.f.liveRefreshPeriod:Math.min(1E3*a.I,1E4),l=Infinity):BS(a,xS);a.a={startTime:0,delay:0,duration:l/k,Fg:p/k,Oe:0};if(q){var t=a.f.playreadyVersion,u=_.Lr,y=[],B=u.aa(q,
|
|
27
|
+
"ProtectionHeader")[0],D=_.Lm(u.va(B)||""),C=_.Qr(D).a;y.push(vS(_.Nd,{initData:_.nC(_.Ir(C)),initDataType:_.nd,keyId:C,periodId:null},[C]));y.push(vS(_.Ld,wS(D,C,t),[C]));a.w=y}var E=[],z=_.Lr.aa(d,"StreamIndex");if(!z.length)throw a.g.error("No streams found!"),new _.O(_.P,4,4034,a.o);for(var K=0;K<z.length;K++){for(var L,U=a,V=z[K],ta=AS(U,V,"Type"),za=+V.getAttribute("Chunks"),va=V.getAttribute("Subtype")||"",qa=V.getAttribute("Language")||_.Gg,Fa=_.ro(qa),sc=V.getAttribute("Name")||"",ab=+V.getAttribute(_.eb),
|
|
28
|
+
Uc=+V.getAttribute(_.db),Od=AS(U,V,"Url"),Ef=+V.getAttribute("TimeScale")||null,tc=[],di=_.Lr.aa(V,_.yb),Gf=0;Gf<di.length;Gf++){var td=void 0,Nb=void 0,ec=void 0,Qd=U,vc=di[Gf],Hg=ta,DW=+vc.getAttribute("Index"),EW=+AS(Qd,vc,"Bitrate"),uJ=NaN,vJ=NaN,Go=NaN,Ev=NaN,wJ=NaN,xJ=NaN,yJ=NaN,zJ=vc.getAttribute("FourCC")||"";switch(Hg){case _.Tg:uJ=+AS(Qd,vc,_.db);vJ=+AS(Qd,vc,_.eb);break;case _.Tc:Ev=+vc.getAttribute("Channels")||2,Go=+AS(Qd,vc,"SamplingRate"),xJ=+AS(Qd,vc,"AudioTag"),wJ=+AS(Qd,vc,"BitsPerSample"),
|
|
29
|
+
yJ=+AS(Qd,vc,"PacketSize")}var Fv=String(vc.getAttribute("CodecPrivateData"));if(Hg===_.Tc&&!Fv){var AJ=Ev,BJ={96E3:0,88200:1,64E3:2,48E3:3,44100:4,32E3:5,24E3:6,22050:7,16E3:8,12E3:9,11025:10,8E3:11,7350:12},Ho=BJ[Go];if("AACH"===zJ){Nb=new Uint8Array(4);var CJ=BJ[2*Go];Nb[0]=40|Ho>>1;Nb[1]=Ho<<7|AJ<<3|CJ>>1;Nb[2]=CJ<<7|8;Nb[3]=0;td=new Uint16Array(2);td[0]=(Nb[0]<<8)+Nb[1];td[1]=(Nb[2]<<8)+Nb[3];ec=td[0].toString(16)+td[1].toString(16)}else Nb=new Uint8Array(2),Nb[0]=16|Ho>>1,Nb[1]=Ho<<7|AJ<<3,
|
|
30
|
+
td=new Uint16Array(1),td[0]=(Nb[0]<<8)+Nb[1],ec=td[0].toString(16);Fv=ec.toUpperCase()}var FW={id:Qd.P++,type:Hg,index:DW,bitrate:EW,zf:Fv,maxHeight:uJ,maxWidth:vJ,We:Go,Wh:Ev,Kp:xJ,xk:wJ,aq:yJ,nm:zJ,segmentIndex:null};tc.push(FW)}L=tc;for(var Te=[],DJ=_.Lr.aa(V,"c"),vk=0;vk<DJ.length;vk++){var Gv=DJ[vk],le=parseInt(Gv.getAttribute("t"),10),hi=parseInt(Gv.getAttribute("d"),10),Hv=parseInt(Gv.getAttribute("r"),10),wk=0;if(isNaN(le)&&isNaN(hi))throw U.g.error("Either one or both FragmentDuration and FragmentTime field MUST be present in StreamFragmentElement"),
|
|
31
|
+
new _.O(_.P,4,4037,U.o);0===vk&&isNaN(le)&&(wk=le=0);if(0<vk){var Jg=Te[Te.length-1];wk=Jg.n+1;Jg.d||(Jg.d=le-Jg.t);le||(le=Jg.t+Jg.d);hi||(hi=le-Jg.t)}Te.push({n:wk,d:hi,t:le});if(Hv){Hv--;for(var EJ=0;EJ<Hv;EJ++){var Io=Te[Te.length-1];wk=Io.n+1;le=Io.t+Io.d;hi=Io.d;Te.push({n:wk,d:hi,t:le})}}}U.ne()||Te.length===za||U.g.warn("Number of fragments ("+za+") differs from number of chunks ("+Te.length+").");E.push({type:ta,Pp:za,ap:va,language:Fa,Qd:qa,name:sc,maxWidth:ab,maxHeight:Uc,tp:Od,tracks:L,
|
|
32
|
+
Bi:Te,timescale:Ef})}var If={Zp:f,fj:g,timescale:k,duration:l,isLive:m,Yp:n,Fg:p,Lg:!1,streams:E};if(a.j&&a.A)return DS(a,If),Promise.resolve();a.H.clear();var Iv=If.timescale,Jo=If.duration,HW=eS(If.streams,_.Tc),IW=eS(If.streams,_.Tg),JW=eS(If.streams,_.Cn),FJ=[],Ko=ES(a,Jo,Iv,HW),Lo=ES(a,Jo,Iv,IW),KW=ES(a,Jo,Iv,JW);Ko.length||(Ko=[null]);Lo.length||(Lo=[null]);for(var Kv=0;Kv<Lo.length;Kv++)for(var Lv=0;Lv<Ko.length;Lv++)FJ.push(FS(a,Lo[Kv],Ko[Lv]));var GJ={id:"ID",configurationId:void 0,startTime:0,
|
|
33
|
+
endTime:Jo,variants:FJ,textStreams:KW,thumbStreams:[]};var MW=If.streams,Mv=a.a.startTime,HJ=a.a.delay,Nv=a.J,IJ=Math.min(a.a.duration||Infinity,Nv),Ov=a.ne(),NW=a.a.Fg,OW=a.a.Oe,JJ=a.I,KJ=isFinite(a.G)?a.G:0;if(Ov)IJ=Infinity,Mv=Date.now()/1E3-OW,a.a.startTime=Mv,HJ=3*JJ;else for(var PW=isFinite(Nv)?Nv:a.a.duration,LJ=_.v(MW),Pv=LJ.next();!Pv.done;Pv=LJ.next())for(var MJ=_.v(Pv.value.tracks),Qv=MJ.next();!Qv.done;Qv=MJ.next()){var NJ=Qv.value;NJ.segmentIndex.offset(-KJ);_.dD(NJ.segmentIndex,PW)}var OJ=
|
|
34
|
+
a.f.timeline||{};OJ.type=void 0;a.D=new _.qD(OJ,Mv,HJ,!Ov,!0);a.D.f=IJ;_.yD(a.D,JJ);a.D.A=NW;Ov||a.D.offset(-KJ);a.F.filterAllPeriods([GJ]);a.j={presentationTimeline:a.D,periods:[GJ],minBufferTime:0,cues:[]};Promise.resolve();a.K||(a.F.networkingEngine.ee(a.L),a.K=!0);a.A=If;return Promise.resolve()},DS=function(a,b){for(var c=0;c<a.A.streams.length;c++)for(var d=b.streams[c],e={},f=_.v(a.A.streams[c].tracks),g=f.next();!g.done;e={zc:e.zc},g=f.next())if(e.zc=g.value,g=d.tracks.find(function(l){return function(m){return m.type===
|
|
35
|
+
l.zc.type&&m.bitrate===l.zc.bitrate}}(e))){cS(e.zc,g)||a.g.warn("The current stream is updated with a stream that seems to have different base properties!");var k=HS(a,a.A.timescale,d,g);g=e.zc.segmentIndex;g.ta(k);(k=a.a.Fg)&&dR(g,(g.a.length?g.a[g.a.length-1].endTime:0)-k).forEach(function(l){l.Ia().forEach(function(m){a.H["delete"](m)})})}else a.g.warn("Cannot find satisfying update for "+e.zc.type+" track with bitrate "+(e.zc.bitrate+". Skipping update."))},ES=function(a,b,c,d){for(var e=[],f=
|
|
36
|
+
{td:0};f.td<d.length;f={td:f.td},f.td++){var g=d[f.td].tracks.map(function(k){return function(l){var m=d[k.td],n=HS(a,c,m,l);n=new _.ND(n);var p=null;m.type!==_.Cn&&(p=IS(a,b,c,m,l));l.segmentIndex=n;var q=_.cK++,t=Promise.resolve.bind(Promise),u=n.yf.bind(n),y=n.get.bind(n),B=n.tg.bind(n),D=n.getDuration.bind(n),C=JS[m.type],E="";switch(m.type){case _.Tg:E=l.zf;var z=/00000001[0-9]7/.exec(E);E="avc1."+(z&&z[0]?E.substr(E.indexOf(z[0])+10,6):"42c00c");a.g.debug("VIDEO CODECS: ",E);break;case _.Tc:E=
|
|
37
|
+
l.zf,z=2,"AACH"===l.nm?z=5:E&&(z=(parseInt(E.substr(0,2),16)&248)>>3),E="mp4a.40."+z,a.g.debug("AUDIO CODECS: ",E)}z=m.type===_.Cn?KS[m.ap]:void 0;return{id:q,originalId:null,eq:null,createSegmentIndex:t,findSegmentPosition:u,getSegmentReference:y,adjustSegmentDurations:B,getDuration:D,segmentIndex:n,segmentLookupStrategy:_.WB,initSegmentReference:p,mimeType:C,codecs:E,frameRate:void 0,bandwidth:l.bitrate,width:l.maxWidth||void 0,height:l.maxHeight||void 0,kind:z,encrypted:a.Og(),keyId:null,language:m.language,
|
|
38
|
+
originalLanguage:m.Qd,label:m.name,type:m.type,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:l.Wh||null,spatialAudio:!1,closedCaptions:null}}}(f));e=e.concat(g)}return e},HS=function(a,b,c,d){var e=0,f=[],g=c.timescale||b;c.Bi.forEach(function(k,l){var m=k.d/g;if(0===l){var n=k.t/g;a.G=Math.min(a.G,n)}else n=f[l-1].endTime;var p=n+m,q=bS(a.o,c,l,d);a.I=Math.max(a.I,m);f.push(new _.Sp(l,n,p,function(){return[q]},0,null,0,null,!0,g));a.H.set(q,n);e+=m});if(c.type===_.Tg||
|
|
39
|
+
c.type===_.Tc)b=f[f.length-1],a.J=Math.min(a.J,e),0===a.a.Oe?a.a.Oe=b.endTime:a.a.Oe=Math.min(a.a.Oe,b.endTime);return f},IS=function(a,b,c,d,e){b=dS(b,d.timescale||c,e);c={isLive:a.ne.bind(a),Kf:a.Og.bind(a),xm:function(){return 1},If:a.Gi.bind(a)};d=new Uint8Array(0);try{d=rS(b,c)}catch(g){throw a.g.error("Failed to generate initialization segment."),new _.O(_.P,3,4035,g);}var f="data:text/plain;base64,"+_.Km(d);return new _.NC(function(){return[f]},0,null,null,!0)},FS=function(a,b,c){var d=(c?
|
|
40
|
+
c.bandwidth:0)+(b?b.bandwidth:0),e=c?c.language:_.Gg;return c||b?{id:a.h++,language:e,primary:!1,audio:c,video:b,bandwidth:d,drmInfos:a.w,allowedByApplication:!0,allowedByKeySystem:!0}:null},AS=function(a,b,c){if(b=b.getAttribute(c))return b;a.g.error("required attribute not provided: "+c);throw new _.O(_.P,4,4038,a.o,c);},LS=function(a,b){null!=a.B&&null!=b&&(a.l=window.setTimeout(a.rc.bind(a),b))},BS=function(a,b){var c=b===xS;a.j&&a.j.presentationTimeline&&_.tD(a.j.presentationTimeline,c);c&&null!=
|
|
41
|
+
a.l&&(window.clearTimeout(a.l),a.l=null,a.B=null);a.M=b},MS=function(){};fR.prototype.append=function(a){a=void 0===a?[]:a;for(var b=0;b<a.length;b++)this.children.push(a[b]),a[b].parent=this;return this};fR.prototype.get=function(a){if(this.type===a)return this;for(var b=0;b<this.children.length;b++){if(this.children[b].type===a)return this.children[b];var c=this.children[b].get(a);if(c)return c}return null};
|
|
42
|
+
fR.prototype.a=function(){var a=Math.pow(2,32)-1;var b=4+this.type.length;"uuid"===this.type&&(b+=16);if(0<this.children.length)for(var c=0;c<this.children.length;c++)b+=this.children[c].a();this.size>a&&(b+=8);return b};
|
|
43
|
+
fR.prototype.write=function(a){var b=Math.pow(2,32)-1;this.start=a.getPosition();this.size=this.a();this.size>b?_.W(a,1):_.W(a,this.size);_.dq(a,eR(this.type));this.size>b&&YQ(a,this.size);"uuid"===this.type&&_.dq(a,null);if(0<this.children.length&&!this.w)for(b=0;b<this.children.length;b++)this.children[b].write(a),this.children[b].a(),a.getPosition()};_.w(Z,fR);Z.prototype.a=function(){return 4+fR.prototype.a.call(this)};
|
|
44
|
+
Z.prototype.write=function(a){fR.prototype.write.call(this,a);ZQ(a,this.version);$Q(a,this.flags)};_.w(gR,fR);gR.prototype.a=function(){return this.f.byteLength+fR.prototype.a.call(this)-this.offset};gR.prototype.write=function(a){fR.prototype.write.call(this,a);_.dq(a,this.f,this.offset);a.getPosition()};_.w(hR,Z);hR.prototype.a=function(){return this.f.byteLength+Z.prototype.a.call(this)-this.offset};hR.prototype.write=function(a){Z.prototype.write.call(this,a);_.dq(a,this.f,this.offset);a.getPosition()};
|
|
45
|
+
_.w(iR,fR);iR.prototype.a=function(){var a=this.h.length;a=a+4+this.f.join("").length;return a+fR.prototype.a.call(this)};iR.prototype.write=function(a){fR.prototype.write.call(this,a);_.dq(a,eR(this.h));_.W(a,this.fj);_.dq(a,eR(this.f.join("")));a.getPosition()};_.w(jR,fR);_.w(kR,fR);_.w(lR,Z);lR.prototype.a=function(){var a=0;a=1===this.version?a+28:a+16;a=a+44+this.f.length;return a+=Z.prototype.a.call(this)};
|
|
46
|
+
lR.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(YQ(a,0),YQ(a,0),_.W(a,this.timescale),YQ(a,this.duration*this.timescale)):(_.W(a,0),_.W(a,0),_.W(a,this.timescale),_.W(a,this.duration*this.timescale));_.W(a,65536);aR(a,this.volume);aR(a,0);_.W(a,0);_.W(a,0);for(var b=0;b<this.f.length;b++)ZQ(a,this.f[b]);_.W(a,0);_.W(a,0);_.W(a,0);_.W(a,0);_.W(a,0);_.W(a,0);_.W(a,this.h);a.getPosition()};_.w(mR,fR);_.w(nR,Z);nR.prototype.a=function(){return 20+Z.prototype.a.call(this)};
|
|
47
|
+
nR.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.f);_.W(a,1);_.W(a,0);_.W(a,0);_.W(a,0);a.getPosition()};_.w(oR,Z);oR.prototype.a=function(){var a=0;a=1===this.version?a+32:a+20;a=a+24+this.f.length;return a+Z.prototype.a.call(this)};
|
|
48
|
+
oR.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(YQ(a,0),YQ(a,0),_.W(a,this.h),_.W(a,0),YQ(a,this.duration*this.timescale)):(_.W(a,0),_.W(a,0),_.W(a,this.h),_.W(a,0),_.W(a,this.duration*this.timescale));_.W(a,0);_.W(a,0);aR(a,0);aR(a,0);aR(a,this.volume);aR(a,0);for(var b=0;b<this.f.length;b++)ZQ(a,this.f[b]);aR(a,this.width);aR(a,0);aR(a,this.height);aR(a,0);a.getPosition()};_.w(pR,Z);pR.prototype.a=function(){var a=0;a=1===this.version?a+28:a+16;return a+4+Z.prototype.a.call(this)};
|
|
49
|
+
pR.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(YQ(a,0),YQ(a,0),_.W(a,this.timescale),YQ(a,this.duration*this.timescale)):(_.W(a,0),_.W(a,0),_.W(a,this.timescale),_.W(a,this.duration*this.timescale));aR(a,this.language);aR(a,0);a.getPosition()};_.w(qR,Z);qR.prototype.a=function(){return 33+Z.prototype.a.call(this)};
|
|
50
|
+
qR.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,0);this.f===_.Tg?_.dq(a,eR("vide")):_.dq(a,eR("soun"));_.W(a,0);_.W(a,0);_.W(a,0);this.f===_.Tg?_.dq(a,eR("VideoHandler\x00")):_.dq(a,eR("SoundHandler\x00"));a.getPosition()};_.w(rR,Z);rR.prototype.a=function(){return 2+this.f.byteLength+Z.prototype.a.call(this)};rR.prototype.write=function(a){Z.prototype.write.call(this,a);aR(a,0);_.dq(a,this.f);a.getPosition()};_.w(sR,fR);sR.prototype.a=function(){return 8+fR.prototype.a.call(this)};
|
|
51
|
+
sR.prototype.write=function(a){fR.prototype.write.call(this,a);_.W(a,0);aR(a,0);aR(a,1)};_.w(tR,sR);tR.prototype.a=function(){return 70+sR.prototype.a.call(this)};tR.prototype.write=function(a){sR.prototype.write.call(this,a);aR(a,0);aR(a,0);_.W(a,0);_.W(a,0);_.W(a,0);aR(a,this.width);aR(a,this.height);_.W(a,4718592);_.W(a,4718592);_.W(a,0);aR(a,1);ZQ(a,10);_.dq(a,eR("AVC Coding",31));aR(a,this.depth);cR(a,-1)};_.w(uR,sR);uR.prototype.a=function(){return 20+sR.prototype.a.call(this)};
|
|
52
|
+
uR.prototype.write=function(a){sR.prototype.write.call(this,a);_.W(a,0);_.W(a,0);aR(a,this.channelCount);aR(a,this.sampleSize);cR(a,0);aR(a,0);aR(a,this.sampleRate);aR(a,0)};_.w(vR,tR);vR.prototype.write=function(a){tR.prototype.write.call(this,a);for(var b=0;b<this.children.length;b++)this.children[b].write(a);a.getPosition()};_.w(wR,vR);_.w(xR,uR);xR.prototype.write=function(a){uR.prototype.write.call(this,a);for(var b=0;b<this.children.length;b++)this.children[b].write(a);a.getPosition()};
|
|
53
|
+
_.w(yR,xR);_.w(zR,fR);zR.prototype.a=function(){for(var a=7,b=0;b<this.sb.length;b++)a+=2,a+=this.sb[b].byteLength;for(b=0;b<this.sb.length;b++)a+=2,a+=this.Kc[b].byteLength;return a+fR.prototype.a.call(this)};
|
|
54
|
+
zR.prototype.write=function(a){fR.prototype.write.call(this,a);ZQ(a,this.version);ZQ(a,this.f);ZQ(a,this.h);ZQ(a,this.level);ZQ(a,255);ZQ(a,224|this.sb.length);for(var b=0;b<this.sb.length;b++)aR(a,this.sb[b].length),_.dq(a,this.sb[b]);ZQ(a,this.Kc.length);for(b=0;b<this.Kc.length;b++)aR(a,this.Kc[b].length),_.dq(a,this.Kc[b]);a.getPosition()};_.w(AR,Z);AR.prototype.a=function(){return 22+(this.Ac.byteLength+3)+Z.prototype.a.call(this)};
|
|
55
|
+
AR.prototype.write=function(a){Z.prototype.write.call(this,a);ZQ(a,3);ZQ(a,23+this.Ac.byteLength);aR(a,1);ZQ(a,0);ZQ(a,4);ZQ(a,15+this.Ac.byteLength);ZQ(a,64);ZQ(a,21);$Q(a,0);_.W(a,0);_.W(a,0);ZQ(a,5);ZQ(a,this.Ac.byteLength);_.dq(a,this.Ac);_.dq(a,new Uint8Array([6,1,2]));a.getPosition()};_.w(BR,Z);BR.prototype.a=function(){return this.location.length+Z.prototype.a.call(this)};BR.prototype.write=function(a){Z.prototype.write.call(this,a);0<this.location.length&&_.dq(a,eR(this.location));a.getPosition()};
|
|
56
|
+
_.w(CR,Z);CR.prototype.a=function(){for(var a=4,b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+Z.prototype.a.call(this)};CR.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.w(DR,fR);_.w(ER,Z);ER.prototype.a=function(){for(var a=4,b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+Z.prototype.a.call(this)};
|
|
57
|
+
ER.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.w(FR,Z);FR.prototype.a=function(){for(var a=4,b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+Z.prototype.a.call(this)};FR.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.w(GR,Z);
|
|
58
|
+
GR.prototype.a=function(){for(var a=4,b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+Z.prototype.a.call(this)};GR.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.w(HR,Z);HR.prototype.a=function(){for(var a=4,b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+Z.prototype.a.call(this)};
|
|
59
|
+
HR.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.w(IR,Z);IR.prototype.a=function(){return 8+Z.prototype.a.call(this)};IR.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,0);_.W(a,0);a.getPosition()};_.w(JR,Z);JR.prototype.a=function(){return 4+Z.prototype.a.call(this)};JR.prototype.write=function(a){Z.prototype.write.call(this,a);cR(a,0);aR(a,0);a.getPosition()};
|
|
60
|
+
_.w(KR,fR);_.w(LR,fR);_.w(MR,fR);_.w(NR,Z);NR.prototype.a=function(){var a=0;a=1===this.version?a+8:a+4;return a+Z.prototype.a.call(this)};NR.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?YQ(a,this.baseMediaDecodeTime):_.W(a,this.baseMediaDecodeTime);a.getPosition()};_.w(OR,Z);OR.prototype.a=function(){return 4+Z.prototype.a.call(this)};OR.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.f);a.getPosition()};_.w(PR,Z);
|
|
61
|
+
PR.prototype.a=function(){var a=4;this.flags&1&&(a+=4);this.flags&4&&(a+=4);for(var b=0;b<this.f;b++)this.flags&256&&(a+=4),this.flags&512&&(a+=4),this.flags&1024&&(a+=4),this.flags&2048&&(a+=4);return a+Z.prototype.a.call(this)};
|
|
62
|
+
PR.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.f);this.flags&1&&(a.getPosition(),bR(a,this.j));this.flags&4&&_.W(a,this.l);for(var b=0;b<this.f;b++)this.flags&256&&_.W(a,this.o[b]),this.flags&512&&_.W(a,this.sampleSize[b]),this.flags&1024&&_.W(a,this.A[b]),this.flags&2048&&(0===this.version?_.W(a,this.h[b]):bR(a,this.h[b]));a.getPosition()};_.w(QR,Z);
|
|
63
|
+
QR.prototype.a=function(){var a=4;this.flags&1&&(a+=8);this.flags&2&&(a+=4);this.flags&8&&(a+=4);this.flags&16&&(a+=4);this.flags&32&&(a+=4);return a+Z.prototype.a.call(this)};QR.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.f);this.flags&1&&YQ(a,this.h);this.flags&2&&_.W(a,this.A);this.flags&8&&_.W(a,this.j);this.flags&16&&_.W(a,this.o);this.flags&32&&_.W(a,this.l);a.getPosition()};_.w(RR,fR);_.w(SR,fR);_.w(TR,fR);TR.prototype.a=function(){return this.f.byteLength+fR.prototype.a.call(this)};
|
|
64
|
+
TR.prototype.write=function(a){fR.prototype.write.call(this,a);0<this.f.byteLength&&_.dq(a,this.f)};_.w(UR,Z);UR.prototype.a=function(){var a=20;1===this.f&&0===this.h&&(a=a+1+this.j.length);return a+Z.prototype.a.call(this)};UR.prototype.write=function(a){Z.prototype.write.call(this,a);ZQ(a,0);0===this.version?ZQ(a,0):ZQ(a,0);ZQ(a,this.f);ZQ(a,this.h);_.dq(a,_.Mm(this.l));if(1===this.f&&0===this.h){ZQ(a,0);for(var b=0;b<this.j.length;b++)ZQ(a,this.j[b])}a.getPosition()};_.w(VR,Z);
|
|
65
|
+
VR.prototype.a=function(){var a=8;this.flags&1&&(a+=eR(this.tc).byteLength);return a+Z.prototype.a.call(this)};VR.prototype.write=function(a){Z.prototype.write.call(this,a);_.dq(a,eR(this.f));_.W(a,this.h);this.flags&1&&_.dq(a,eR(this.tc));a.getPosition()};_.w(WR,fR);WR.prototype.a=function(){return eR(this.f).byteLength+fR.prototype.a.call(this)};WR.prototype.write=function(a){fR.prototype.write.call(this,a);_.dq(a,eR(this.f));a.getPosition()};_.w(YR,Z);
|
|
66
|
+
YR.prototype.a=function(){var a=0;this.flags&1&&(a+=8);a+=4;for(var b=0;1>b;b++)a=0===this.version?a+4:a+8;return a+Z.prototype.a.call(this)};YR.prototype.write=function(a){Z.prototype.write.call(this,a);this.flags&1&&(_.W(a,0),_.W(a,0));_.W(a,1);for(var b=0;1>b;b++)0===this.version?_.W(a,this.offset[b]):YQ(a,this.offset[b]);a.getPosition()};_.w(ZR,Z);ZR.prototype.a=function(){var a=0;this.flags&1&&(a+=8);a+=5;0===this.f&&(a+=this.j.length);return a+Z.prototype.a.call(this)};
|
|
67
|
+
ZR.prototype.write=function(a){Z.prototype.write.call(this,a);this.flags&1&&(_.W(a,0),_.W(a,0));ZQ(a,this.f);_.W(a,this.h);if(0===this.f)for(var b=0;b<this.h;b++)ZQ(a,this.j[b]);a.getPosition()};_.w($R,Z);$R.prototype.a=function(){var a=4;this.flags&1&&(a+=1);for(var b=0;b<this.h;b++)if(a+=this.f[b].Ti.byteLength,this.flags&2){a+=2;for(var c=0;c<this.f[b].Wd;c++)a+=2,a+=4}return a+Z.prototype.a.call(this)};
|
|
68
|
+
$R.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.h);this.flags&1&&ZQ(a,this.j);for(var b=0;b<this.h;b++)if(_.dq(a,this.f[b].Ti),this.flags&2){aR(a,this.f[b].Wd);for(var c=0;c<this.f[b].Wd;c++)aR(a,this.f[b].rh[c].Sh),_.W(a,this.f[b].rh[c].Th)}a.getPosition()};var gS=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,hS=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,iS=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,jS=/^(\d*\.?\d*)f$/,kS=/^(\d*\.?\d*)t$/,lS=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/;pS.prototype.get=function(a){for(var b=0;b<this.a.length;b++){var c=this.a[b].get(a);if(c)return c}return null};pS.prototype.write=function(){this.f=oS(this);for(var a=0;a<this.a.length;a++)this.a[a].write(this.f);return this.f.buffer};var sS=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);_.r=yS.prototype;_.r.configure=function(a){this.f=a};_.r.start=function(a,b){var c=this;this.F=b;var d=_.qh(new Set([a,aS(a)])).concat();return zS(this,d).then(function(e){return GS(c,e.data).then(function(){LS(c,c.B);return c.j})})};_.r.requestStop=function(){};_.r.stop=function(){this.F&&this.F.networkingEngine.dg(this.L);this.B=this.A=this.j=this.f=this.F=null;this.l&&(clearTimeout(this.l),this.l=null);this.K=!1;this.J=this.G=Infinity;return Promise.resolve()};
|
|
69
|
+
_.r.update=function(){var a=this;if(this.ne())return zS(this,[this.o]).then(function(b){return GS(a,b.data).then(function(){return a.j})})["catch"](function(b){if(a.F)a.F.onError(b)})};_.r.setCurrentVariant=function(){};_.r.rc=function(){var a=this;this.g.debug(_.NB);this.F&&(this.l=null,this.update().then(function(){LS(a,a.B)})["catch"](function(b){a.F&&(a.F.onError(b),1===b.severity&&LS(a,100))}))};_.r.ne=function(){return this.M===CS};_.r.Og=function(){return 0<this.w.length};
|
|
70
|
+
_.r.Gi=function(a){var b=null;if(this.w.length)for(var c=0;c<this.w.length;c++)if(this.w[c].keySystem===a){b=this.w[c].initData[0];break}return b};
|
|
71
|
+
_.r.Mo=function(a){if(2!==a.request.type||a.uri.startsWith("data:"))return Promise.resolve(a);var b=a.request.timescale||this.A.timescale,c={isLive:this.ne.bind(this),Kf:this.Og.bind(this),xm:function(){return 1},If:this.Gi.bind(this)},d=!1,e=new _.O(_.P,3,4035,null),f=null;try{var g=this.H.get(a.request.uris[a.request.uriIndex])||a.request.startTime||0;g!==a.request.startTime&&this.g.debug("Using base media decode time "+g+" instead of segment reference time "+a.request.startTime);f=uS(a,b,g,c)}catch(k){d=
|
|
72
|
+
!0,e.data=k,3E3===k.code&&(e.code=4039)}if(d||!f)return Promise.reject(e);a.data=f;return Promise.resolve(a)};_.r.loadVariant=function(a){return _.I(function(b){return b["return"](a)})};_.r.loadTextStream=function(a,b){var c=this,d,e;return _.I(function(f){(e=c.j.periods.find(function(g){return g.id===b}))&&(d=e.textStreams.find(function(g){return g.id===a})||null);if(!d)throw new _.vi(_.DB+a);return f["return"](d)})};var JS={video:_.Vg,audio:_.Yc,text:_.Qc},xS=_.Vb,CS="LIVE",KS={wp:_.id,Dp:_.qg};_.w(MS,_.fv);MS.prototype.install=function(){_.aw.ism=yS;_.$v[_.Rc]=yS};MS.prototype.uninstall=function(){_.lE("ism");_.mE(_.Rc)};MS.prototype.id=function(){return _.hg};_.J("clpp.smooth.SmoothComponent",MS);};
|
|
73
73
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
74
74
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
75
75
|
else{_=this.clpp._;(f.call(g,this));}
|
package/cjs/cl.thumbnails.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var
|
|
3
|
-
e,c,d)})},
|
|
4
|
-
this.f=null;this.o=this.h=1;this.j=0}
|
|
5
|
-
_.
|
|
6
|
-
b.thumbStreams.length})},
|
|
7
|
-
|
|
2
|
+
var f=function(window){var Pz="No thumbnail found for position: ",Qz="Position is out of range: ",Rz="Thumbnail URL is mandatory",Sz="Wrong gridSize format",Tz="clpp.thumbnails",Uz=function(){this.log=new _.M(Tz);this.player=null;this.a=[];this.w=!1},Wz=function(a,b){b.reduce(function(c,d){var e=d,f=!1;typeof d===_.$e&&(e=d.step,f=d.preloadWhileBuffering);return c.then(function(){return Vz(a,0,e,!!f)})},Promise.resolve())},Vz=function(a,b,c,d){if(a.w||b>=a.a.length)return Promise.resolve();var e=b+c;return Xz(a,d).then(function(){return a.a[b].load()}).then(function(){return Vz(a,
|
|
3
|
+
e,c,d)})},Xz=function(a,b){return new Promise(function(c){if(b||2!==a.player.getState())c();else a.player.one(_.ed,function(){c()})})},Yz=function(a,b,c,d,e,f,g,k,l,m,n,p){d=void 0===d?0:d;e=void 0===e?0:e;f=void 0===f?0:f;g=void 0===g?0:g;k=void 0===k?1:k;l=void 0===l?1:l;m=void 0===m?0:m;n=void 0===n?0:n;p=void 0===p?new Image:p;this.time=b;this.src=a;this.duration=c;this.x=d;this.y=e;this.width=f;this.height=g;this.a=p;this.h=k;this.o=l;this.j=m;this.l=n;this.f=null},Zz=function(){Uz.call(this);
|
|
4
|
+
this.f=null;this.o=this.h=1;this.j=0},$z=function(a,b){this.time=a;this.duration=0;this.offset=b;this.length=0;this.Rd=new _.nm},aA=function(){this.g=new _.M(Tz);this.f=new ArrayBuffer(0);this.a=[];this.h=new _.nm},bA=function(a){var b=a.f.byteLength;a.a.forEach(function(c){c.offset+c.length<b&&c.Rd.resolve()})},dA=function(a,b){return cA(a,b).then(function(c){return new Yz(c,b.time,b.duration)})},cA=function(a,b){return b.load().then(function(){var c=_.Ri(a.f,b.offset,b.length);return"data:image/jpeg;base64,"+
|
|
5
|
+
_.Jm(c)})},eA=function(){Uz.call(this);this.f=null},fA=function(a){a=a.split(/\.|:/).map(parseFloat);var b=0,c,d={3:.001,2:1,1:60,0:3600};for(c=a.length-1;0<=c;c--)b+=a[c]*d[c];return b},gA=function(){Uz.apply(this,arguments)},hA=function(a,b){var c=a.horizontalTiles||b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{He:c,Bh:d,Si:e,durationPerTile:a.durationPerTile||b.durationPerTile||(a.endTime-a.startTime)/e}},iA=function(){this.g=new _.M(Tz);this.a=this.m=null},jA=function(a){return a.some(function(b){return 0<
|
|
6
|
+
b.thumbStreams.length})},oA=function(a){return a?a===kA||a===lA?new Zz:a===mA?new eA:a===nA?new aA:null:null},pA=function(a){if(!a)return null;a=new _.vn(a);return a.path.match(/.*\.vtt$/i)?mA:a.path.match(/.*\.bif$/i)?nA:a.path.match(/.*\.(png|jpg|jpeg)$/i)?kA:null},qA=function(){};Uz.prototype.init=function(a,b){var c=this;this.player=a;a.one(_.Sf,function(){c.w=!0});a.isLive()||this.l().then(function(){b&&b.preload&&Wz(c,b.preload)})};Yz.prototype.raw=function(){return this.a.cloneNode(!1)};
|
|
7
|
+
Yz.prototype.element=function(a,b){var c=this.width,d=this.height,e=this.width/this.height;void 0!==a&&void 0===b&&(b=0);null!==a&&void 0!==a&&(c=a);null!==b&&void 0!==b&&(d=b);c||(c=Math.ceil(d*e));d||(d=Math.ceil(c/e));e=document.createElement(_.Yd);e.style.width=c+_.Pf;e.style.height=d+_.Pf;e.style.backgroundColor="#000";e.style.backgroundRepeat="no-repeat";e.style.backgroundImage='url("'+this.src+'")';e.style.backgroundSize=Math.ceil(c/this.width*(this.a.naturalWidth||this.a.width))+"px "+Math.ceil(d/
|
|
8
8
|
this.height*(this.a.naturalHeight||this.a.height))+_.Pf;var f=this.y/this.height;e.style.backgroundPositionX="-"+this.x/this.width*c+_.Pf;e.style.backgroundPositionY="-"+f*d+_.Pf;return e};
|
|
9
|
-
|
|
10
|
-
g))};a.a.addEventListener(_.Ke,f);a.a.addEventListener(_.
|
|
11
|
-
|
|
12
|
-
new _.O(1,9,7100,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
d.substr(0,d.lastIndexOf("/"))+"/"+k);t=
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
b();g=f.findSegmentPosition(a-e.startTime);if(null===g||void 0===g)throw c.log.error("Could not find segment index for specified position",a),b();k=f.getSegmentReference(g);if(!k)return B.C(2);l=
|
|
23
|
-
t,u));return n?_.
|
|
24
|
-
|
|
25
|
-
_.r.onContentWillLoad=function(a){var b=this,c=a.getConfiguration().thumbnails;if(c)if(!1===c.enabled)this.g.info("Thumbnails disabled.");else{var d=c.mode||null;d||(d=
|
|
26
|
-
_.r.onContentLoaded=function(a,b){for(var c=1;c<arguments.length;++c);if(!this.a&&(c=(c=a.getConfiguration())&&c.thumbnails,!c||void 0===c.enabled||c.enabled)){var d=a.getPeriods();if(
|
|
27
|
-
|
|
9
|
+
Yz.prototype.load=function(){var a=this;this.f||(this.f=new Promise(function(b,c){function d(){a.width||(a.width=(a.a.naturalWidth||a.a.width)/a.h);a.height||(a.height=(a.a.naturalHeight||a.a.height)/a.o);a.x||(a.x=a.width*a.j);a.y||(a.y=a.height*a.l)}if(a.a.src&&a.a.complete)d(),b(a);else{var e=null,f=function(){d();a.a.removeEventListener(_.Ke,f);a.a.removeEventListener(_.re,e);b(a)};e=function(g){a.a.removeEventListener(_.Ke,f);a.a.removeEventListener(_.re,e);c(new _.O(1,9,2014,"Failed to load thumbnail.",
|
|
10
|
+
g))};a.a.addEventListener(_.Ke,f);a.a.addEventListener(_.re,e);a.a.src=a.src}}));return this.f};_.J("clpp.thumbnails.Thumbnail",Yz);Yz.prototype.load=Yz.prototype.load;Yz.prototype.element=Yz.prototype.element;Yz.prototype.raw=Yz.prototype.raw;_.w(Zz,Uz);
|
|
11
|
+
Zz.prototype.init=function(a,b){if(!b||!b.url)throw new _.O(1,9,7100,Rz);if("GRID"===b.mode&&!b.gridSize)throw new _.O(1,9,7100,"Grid size is mandatory for GRID mode");if(!b.duration)throw new _.O(1,9,7100,"Duration is mandatory");this.f=b;this.j=this.f.duration;if(this.f.gridSize)try{var c=this.f.gridSize.split(/x/).map(function(d){return parseInt(d,10)}).filter(function(d){return 0<d});if(2===c.length)this.h=c[0],this.o=c[1];else throw new _.O(1,9,7100,Sz);}catch(d){throw this.log.error("Error during parsing gridSize",d),
|
|
12
|
+
new _.O(1,9,7100,Sz);}Uz.prototype.init.call(this,a,b)};Zz.prototype.get=function(a){var b=this,c,d,e,f;return _.I(function(g){if(1==g.a){c=b.player.getDuration();if(0>a||a>c)throw new _.O(1,9,2014,Qz+a);d=b.f.duration;e=Math.floor(a/d);f=b.a[e];if(!f)throw new _.O(1,9,2014,"No thumbnail found for position "+a+" at index "+e);return _.x(g,f.load(),2)}return g["return"](f)})};
|
|
13
|
+
Zz.prototype.l=function(){if(0<this.a.length)return Promise.resolve();var a=this.player.getDuration(),b=this.h*this.o;a=Math.ceil(Math.ceil(a/this.j)/b);for(var c=this.f.templateKey||"$index$",d=0;d<a;d++)for(var e=this.f.url.replace(c,String(d+1)),f=new Image,g=0;g<b;g++)this.a.push(new Yz(e,this.j*(d*b+g),this.j,0,0,0,0,this.h,this.o,g%this.h,Math.floor(g/this.h),f));return Promise.resolve()};$z.prototype.load=function(){return this.Rd};
|
|
14
|
+
aA.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.O(1,9,7100,Rz);var d=b.url,e=_.Zk(d);e.type=_.Yk;a.getNetworkEngine().fetch(e).U.then(function(f){f=f.data;var g=_.Ri(c.f);f=_.Ri(f);for(var k=g.byteLength+f.byteLength,l=new ArrayBuffer(k),m=new DataView(l),n=0,p=0,q=g.byteLength;p<q;p++)m.setUint8(n,g[p]),n+=1;g=0;for(p=f.byteLength;g<p;g++)m.setUint8(n,f[g]),n+=1;c.f=l;c.g.info("Appended "+f.byteLength+" bytes.Total data now "+(k+" bytes."));l=c.f;f=_.Ri(l);n=String.fromCharCode.apply(null,
|
|
15
|
+
rA);g=Array.prototype.slice.call(f,0,8);f=64;k=0;m=!1;if(n===String.fromCharCode.apply(null,g))for(l=new DataView(l,16,20),l=l.getUint32(0,!0),0===l&&(l=1E3);!m;){k+=1;g=l;n=new DataView(c.f,f);m=n.getUint32(0,!0);g=m*g/1E3;n=n.getUint32(4,!0);n=new $z(g,n);if(g=c.a.length)g=c.a[g-1],g.length=n.offset-g.offset,g.duration=n.time-g.time;c.a.push(n);f+=8;(m=4294967295===m)&&c.h.resolve();if(1E5<k)throw Error("There was a problem during reading BIF entries");}else throw Error("The file is not a valid BIF format");
|
|
16
|
+
bA(c)})["catch"](function(f){c.g.error("[BIF] Error while loading thumbnails '\n + 'URL: "+d,f);a.onError(new _.O(1,9,2013,"Error while loading and parsing BIF thumbnails.",f))})};aA.prototype.get=function(a){var b=this,c,d;return _.I(function(e){switch(e.a){case 1:if(0>a)throw new _.O(1,9,2014,Qz+a);return _.x(e,b.h,2);case 2:c=b.a.find(function(f){return a>=f.time&&a<f.time+f.duration});if(!c)throw new _.O(1,9,2014,Pz+a);return _.x(e,dA(b,c),3);case 3:return d=e.f,_.x(e,d.load(),4);case 4:return e["return"](d)}})};
|
|
17
|
+
aA.prototype.Zb=function(){return 0<this.a.length};var rA=[137,66,73,70,13,10,26,10];_.w(eA,Uz);
|
|
18
|
+
eA.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.O(1,9,7100,Rz);var d=b.url,e=_.Zk(d);e.type=_.Yk;this.f=a.getNetworkEngine().fetch(e).U.then(function(f){f=f.data;if(!f)throw Error("No data in the response");f=_.R.ga(f).split(/\n/);for(var g=0;g<f.length;g++){var k=f[g],l=k.split(" --\x3e ");if(2===l.length){k=f[++g];var m=k.indexOf("\x3d"),n=0>m?[]:k.substr(m+1).split(/,/).map(parseFloat);m=n[0];var p=n[1],q=n[2];n=n[3];var t=k.indexOf("#");k=0>t?k:k.substr(0,t);k.match(/^http|^\/\//)||(k=
|
|
19
|
+
d.substr(0,d.lastIndexOf("/"))+"/"+k);t=fA(l[0]);l=fA(l[1])-t;c.a.push(new Yz(k,t,l,m,p,q,n,0,0))}}})["catch"](function(f){c.log.error("[VTT] Error while loading thumbnails URL: "+d,f);a.onError(new _.O(1,9,2013,"Error while loading VTT thumbnails.",f))});Uz.prototype.init.call(this,a,b)};
|
|
20
|
+
eA.prototype.get=function(a){var b=this,c;return _.I(function(d){if(1==d.a){if(0>a)throw new _.O(1,9,2014,Qz+a);return _.x(d,b.f,2)}if(3!=d.a){c=b.a.find(function(e){return a>=e.time&&a<e.time+e.duration});if(!c)throw new _.O(1,9,2014,Pz+a);return _.x(d,c.load(),3)}return d["return"](c)})};eA.prototype.l=function(){return this.f};_.w(gA,Uz);
|
|
21
|
+
gA.prototype.get=function(a){function b(){return new _.O(1,9,2014,Pz+a)}var c=this,d,e,f,g,k,l,m,n,p,q,t,u,y;return _.I(function(B){if(1==B.a){if(0>a)throw c.log.error("Position must be greater than 0 but is "+a),new _.O(1,9,2014,Qz+a);d=c.player.getPeriods();for(var D=null,C=_.v(d),E=C.next();!E.done;E=C.next())E=E.value,E.startTime<=a&&(D=E);e=D;if(!e)throw c.log.error("Could not find period for specified position",a),b();f=e.thumbStreams.sort(c.f)[0];if(!f)throw c.log.error("Could not find thumb stream for specified position",a),
|
|
22
|
+
b();g=f.findSegmentPosition(a-e.startTime);if(null===g||void 0===g)throw c.log.error("Could not find segment index for specified position",a),b();k=f.getSegmentReference(g);if(!k)return B.C(2);l=hA(k,f);m=Math.floor((a-k.startTime)/l.durationPerTile);0<c.a.length?(p=f.findSegmentPosition(0),null!==p&&(n=c.a[(g-p)*l.Si+m])):(q=k.Ia())&&0<q.length&&(u=t=0,y=k.startTime,1<l.Si&&(t=m%l.He,u=Math.floor(m/l.He),y+=m*l.durationPerTile),n=new Yz(q[0],y,l.durationPerTile,void 0,void 0,void 0,void 0,l.He,l.Bh,
|
|
23
|
+
t,u));return n?_.x(B,n.load(),4):B.C(2)}if(2!=B.a)return B["return"](n);c.log.error("segment reference for specified segment index does not exist",g);throw b();})};gA.prototype.f=function(a,b){return void 0!==a.bandwidth&&void 0!==b.bandwidth?a.bandwidth-b.bandwidth:0};
|
|
24
|
+
gA.prototype.l=function(){if(0<this.a.length)return Promise.resolve();var a=this.player.getPeriods();a=_.v(a);for(var b=a.next();!b.done;b=a.next())if(b=b.value.thumbStreams.sort(this.f)[0])for(var c=b.findSegmentPosition(0),d=void 0;null!==c&&!_.N.R(d=b.getSegmentReference(c++));)for(var e=hA(d,b),f=d.Ia()[0],g=new Image,k=d.startTime,l=0;l<e.Bh;++l)for(var m=0;m<e.He;++m)this.a.push(new Yz(f,k,e.durationPerTile,void 0,void 0,void 0,void 0,e.He,e.Bh,m,l,g)),k+=e.durationPerTile;return Promise.resolve()};_.r=iA.prototype;_.r.onPlayerCreated=function(a){this.m=a};_.r.onPlayerWillDestroy=function(){this.m=null};_.r.onPlayerWillRelease=function(){this.a=null};
|
|
25
|
+
_.r.onContentWillLoad=function(a){var b=this,c=a.getConfiguration().thumbnails;if(c)if(!1===c.enabled)this.g.info("Thumbnails disabled.");else{var d=c.mode||null;d||(d=pA(c.url||null));(this.a=oA(d))?(this.g.info("Loading thumbs configuration",c),this.m.one(_.Me,function(){b.g.info("Initialize thumbnails provider");try{b.a.init(a,c)}catch(e){b.m.onError(e)}})):this.g.warn("Unknown thumbnail mode",d)}else this.a=null};
|
|
26
|
+
_.r.onContentLoaded=function(a,b){for(var c=1;c<arguments.length;++c);if(!this.a&&(c=(c=a.getConfiguration())&&c.thumbnails,!c||void 0===c.enabled||c.enabled)){var d=a.getPeriods();if(jA(d)){this.a=new gA;try{this.a.init(a,c)}catch(e){this.m.onError(e)}}}};_.r.get=function(a){return this.a?this.a.get(a):Promise.reject(new _.O(1,9,2014,"Thumbnail format is not supported"))};_.r.id=function(){return"thumbnails"};_.J("clpp.thumbnails.ThumbnailsPlugin",iA);iA.prototype.get=iA.prototype.get;iA.Id="thumbnails";
|
|
27
|
+
qA.prototype.create=function(){return new iA};var kA="SINGLE",lA="GRID",mA="WEBVTT",nA="BIF";_.bp(new qA);};
|
|
28
28
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
29
29
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
30
30
|
else{_=this.clpp._;(f.call(g,this));}
|