@castlabs/prestoplay 6.31.1 → 6.32.0-beta.2
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 +32 -0
- package/README.md +2 -2
- 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 +127 -125
- package/cjs/cl.cdn.js +13 -0
- package/cjs/cl.conviva.js +32 -32
- package/cjs/cl.core.js +615 -610
- package/cjs/cl.crypto.js +9 -9
- package/cjs/cl.dash.js +101 -95
- package/cjs/cl.externs.js +113 -44
- package/cjs/cl.freewheel.js +26 -26
- package/cjs/cl.hls.js +78 -78
- 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 +351 -350
- 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 +26 -26
- 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 +11 -11
- package/cjs/cl.vr.js +19 -19
- package/cjs/cl.vtt.js +14 -14
- package/cjs/cl.yospace.js +4 -4
- package/cjs/cl.youbora.js +40 -40
- package/cl.adobe.js +3 -3
- package/cl.airplay.js +3 -3
- package/cl.broadpeak.js +14 -14
- package/cl.cast.js +102 -101
- package/cl.cdn.js +7 -0
- package/cl.conviva.js +27 -27
- package/cl.core.js +498 -495
- package/cl.crypto.js +9 -9
- package/cl.dash.js +91 -87
- package/cl.externs.js +109 -44
- package/cl.freewheel.js +20 -20
- package/cl.hls.js +82 -82
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +26 -26
- package/cl.ima.js +20 -20
- package/cl.mediatailor.js +2 -2
- package/cl.mse.js +301 -300
- package/cl.muxdata.js +13 -13
- package/cl.onboard.js +4 -4
- package/cl.persistent.js +10 -10
- package/cl.playlist.js +5 -5
- package/cl.simid.js +14 -14
- package/cl.smooth.js +61 -61
- package/cl.thumbnails.js +19 -19
- package/cl.tizen.js +56 -56
- 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.yospace.js +3 -3
- package/cl.youbora.js +31 -31
- package/package.json +7 -1
- package/typings.d.ts +328 -114
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.
|
|
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([_.Md,_.Kd]);for(var e=d.next();!e.done;e=d.next())if((e=c.
|
|
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(_.
|
|
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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
new _.O(_.P,4,4037,
|
|
32
|
-
|
|
33
|
-
endTime:
|
|
34
|
-
a.f.timeline||{};
|
|
35
|
-
l.
|
|
36
|
-
{
|
|
37
|
-
l.
|
|
38
|
-
originalLanguage:m.
|
|
39
|
-
c.type===_.Sc)b=f[f.length-1],a.J=Math.min(a.J,e),0===a.a.
|
|
40
|
-
c.bandwidth:0)+(b?b.bandwidth:0),e=c?c.language:_.
|
|
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 ZQ="Full MP4 box must have flags defined",$Q="clpp.smooth.SmoothMP4Processor",aR="codecPrivateData",bR=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)},cR=function(a,b){try{a.f.setUint8(a.a,b),a.a+=1}catch(c){_.hq()}},dR=function(a,b){cR(a,b>>16&255);cR(a,b>>8&255);cR(a,b&255)},eR=function(a,b){try{a.f.setUint16(a.a,b,a.h),a.a+=2}catch(c){_.hq()}},fR=function(a,b){try{a.f.setInt32(a.a,b,a.h),a.a+=4}catch(c){_.hq()}},gR=function(a,b){try{a.f.setInt16(a.a,
|
|
3
|
+
b,a.h),a.a+=2}catch(c){_.hq()}},hR=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},iR=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},jR=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){jR.call(this,
|
|
4
|
+
a);this.version=b;this.flags=c},kR=function(a,b,c){jR.call(this,a);this.f=b;this.offset=c},lR=function(a,b,c,d,e){Z.call(this,a,b,c);this.f=d;this.offset=e},mR=function(a,b,c){jR.call(this,"ftyp");this.h=a;this.ij=b;this.f=c},nR=function(){jR.call(this,_.We)},oR=function(){jR.call(this,_.Dg)},pR=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]},qR=function(){jR.call(this,
|
|
5
|
+
"mvex")},rR=function(a){Z.call(this,"trex",0,0);this.f=a},sR=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]},tR=function(a,b){Z.call(this,"mdhd",1,0);this.timescale=a;this.duration=b;this.language=21956},uR=function(a){Z.call(this,"hdlr",0,0);this.f=a},vR=function(){Z.call(this,"vmhd",0,1);this.f=new Uint8Array([0,0,0,0,0,0])},wR=function(a){jR.call(this,
|
|
6
|
+
a);this.w=!0},xR=function(a){wR.call(this,a);this.height=this.width=0;this.depth=24},yR=function(a,b,c,d){wR.call(this,a);this.channelCount=b;this.sampleSize=c;this.sampleRate=d},zR=function(a,b){xR.call(this,"avc1");this.width=a;this.height=b},AR=function(a,b){zR.call(this,a,b);this.type="encv"},BR=function(a,b,c){yR.call(this,"mp4a",a,b,c)},CR=function(a,b,c){BR.call(this,a,b,c);this.type="enca"},DR=function(a,b){jR.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]},ER=function(a){Z.call(this,"esds",0,0);this.Ac=a},FR=function(a){a=void 0===a?"":a;Z.call(this,"url ",0,1);this.location=a},GR=function(){Z.call(this,"dref",0,0)},HR=function(){jR.call(this,_.mg)},IR=function(){Z.call(this,_.og,0,0)},JR=function(){Z.call(this,"stts",0,0)},KR=function(){Z.call(this,"stsc",0,0)},LR=function(){Z.call(this,"stco",0,0)},MR=function(){Z.call(this,"stsz",0,0)},NR=function(){Z.call(this,"smhd",0,0)},OR=function(){jR.call(this,"dinf")},
|
|
8
|
+
PR=function(){jR.call(this,_.Ve)},QR=function(){jR.call(this,_.Qe)},RR=function(a,b){Z.call(this,"tfdt",a,0);this.baseMediaDecodeTime=b},SR=function(){Z.call(this,"mfhd",0,0);this.f=0},TR=function(a,b){Z.call(this,"trun",a,b);this.l=this.j=this.f=0;this.o=[];this.sampleSize=[];this.A=[];this.h=[]},UR=function(a,b){Z.call(this,"tfhd",a,b);this.f=255;this.l=this.o=this.j=this.A=this.h=0},VR=function(){jR.call(this,"traf")},WR=function(){jR.call(this,"moof")},YR=function(){jR.call(this,_.Pe);this.f=
|
|
9
|
+
new Uint8Array(0)},ZR=function(){Z.call(this,"tenc",0,0);this.f=1;this.h=8;this.l="";this.j=[]},$R=function(a,b){Z.call(this,"schm",0,0);this.f=a;this.h=b;this.tc=""},aS=function(a){jR.call(this,"frma");this.f=a},bS=function(){Z.call(this,"saio",0,0);this.offset=[0]},cS=function(a,b,c){Z.call(this,"saiz",0,0);this.f=a;this.j=b;this.h=c},dS=function(a,b){Z.call(this,"senc",a,b);this.h=0;this.j=8;this.f=[]},eS=function(a){var b=a.split("/");return b[b.length-1].toLowerCase().match("manifest(\\(.+\\))?")?
|
|
10
|
+
a:a+"/Manifest"},fS=function(a,b,c,d){c=b.Ei[c];b=b.xp;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 _.DC([a],[b])[0]},gS=function(a,b){if(a.type!==b.type)return!1;var c=[];a.type===_.Tg?c=["maxWidth","maxHeight","bitrate",aR,"fourCC"]:a.type===_.Sc&&(c=["bitrate",aR,"channels","bitsPerSample","samplingRate","fourCC"]);return _.N.ua(a,b,c,["id","segmentIndex"])},
|
|
11
|
+
hS=function(a,b,c){var d=c.Bf.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=[_.Qm(d[1])];a.Kc=[_.Qm(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.Sc:a.Ac=_.Qm(c.Bf),a.sampleSize=c.Ak||16,a.We=c.We,a.channelCount=c.Zh}return a},iS=function(a,b){return a.filter(function(c){return c.type===b})},jS=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)},qS=function(a,b,c){var d=null;if(kS.test(a)){a=kS.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 lS.test(a)?d=jS(lS,a):mS.test(a)?d=jS(mS,a):nS.test(a)?(a=nS.exec(a),d=Number(a[1])/c.frameRate):oS.test(a)?(a=oS.exec(a),d=Number(a[1])/c.a):pS.test(a)&&(d=jS(pS,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},rS=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))},tS=function(a){this.a=a;this.f=sS(this)},sS=function(a){for(var b=0,c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.gq(b)},uS=function(a,b,c){a:{var d=
|
|
14
|
+
_.v([_.Md,_.Kd]);for(var e=d.next();!e.done;e=d.next())if((e=c.Kf(e.value))&&e.keyId){d=e.keyId;break a}_.Vh($Q,"Could not get default Key ID for DRM init data!");d=null}c=new jR("xxxx");a.type===_.Tg?c=new AR(a.width,a.height):c=new CR(a.channelCount,a.sampleSize,a.We);a=new ZR;a.f=1;a.h=8;a.l=d||"00000000000000000000000000000000";a=(new jR("schi")).append([a]);b=(new jR(_.gg)).append([new aS(b),new $R(_.md,65536),a]);c.append([b]);return c},vS=function(a,b){var c=b.Mf(),d=new pR(a.timescale,a.duration,
|
|
15
|
+
a.id),e=(new qR).append([new rR(a.id)]),f=new sR(a.id,a.duration,a.timescale,a.width,a.height),g=new tR(a.timescale,a.duration),k=new uR(a.type),l=null,m=new GR;m.entries=[new FR];var n=new IR;switch(a.type){case _.Tg:var p=new DR(a.sb,a.Kc);c?(l=uS(a,"avc1",b),l.append([p]),n.entries=[l]):(l=(new zR(a.width,a.height)).append([p]),n.entries=[l]);l=new vR;break;case _.Sc:p=new ER(a.Ac),c?(l=uS(a,"mp4a",b),l.append([p]),n.entries=[l]):(l=(new BR(a.channelCount,a.sampleSize,a.We)).append([p]),n.entries=
|
|
16
|
+
[l]),l=new NR}n=(new HR).append([n,new JR,new KR,new MR,new LR]);m=(new OR).append([m]);m=(new PR).append([l,m,n]);g=(new QR).append([g,k,m]);f=(new oR).append([f,g]);d=(new nR).append([d,f,e]);e=new mR("dash",0,["iso6","mp41","avc1"]);c&&(c=b.Kf(_.Kd),f=b.Kf(_.Md),c&&d.append([new kR("pssh",c.initData,8)]),f&&d.append([new kR("pssh",f.initData,8)]),c||f||_.Vh($Q,"Could not get PSSH init data!"));c=new tS([e,d]);return _.Vi(c.write())},xS=function(a,b){var c,d,e,f,g,k;(new _.tq).N("moof",_.uq).da("mfhd",
|
|
17
|
+
function(m){var n=new SR;n.f=_.oq(m.reader);c=n}).N("traf",_.uq).da("tfhd",function(m){var n=m.reader.cb();if(null===m.flags)throw new _.O(_.P,3,3019,ZQ);var p=new UR(m.version||0,m.flags||0);p.f=_.oq(m.reader);0<n-m.reader.getPosition()&&m.flags&1&&(p.h=_.qq(m.reader));0<n-m.reader.getPosition()&&m.flags&2&&(p.A=_.oq(m.reader));0<n-m.reader.getPosition()&&m.flags&8&&(p.j=_.oq(m.reader));0<n-m.reader.getPosition()&&m.flags&16&&(p.o=_.oq(m.reader));0<n-m.reader.getPosition()&&m.flags&32&&(p.l=_.oq(m.reader));
|
|
18
|
+
d=p}).da("trun",function(m){var n=m.reader.cb();if(null===m.flags)throw new _.O(_.P,3,3019,ZQ);var p=new TR(m.version||0,m.flags||0);p.f=_.oq(m.reader);0<n-m.reader.getPosition()&&m.flags&1&&(p.j=_.pq(m.reader));0<n-m.reader.getPosition()&&m.flags&4&&(p.l=_.oq(m.reader));if(0<n-m.reader.getPosition())for(n=0;n<p.f;n++)m.flags&256&&p.o.push(_.oq(m.reader)),m.flags&512&&p.sampleSize.push(_.oq(m.reader)),m.flags&1024&&p.A.push(_.oq(m.reader)),m.flags&2048&&(0===m.version?p.h.push(_.oq(m.reader)):p.h.push(_.pq(m.reader)));
|
|
19
|
+
e=p}).da("sdtp",function(m){var n=_.sq(m.reader,m.reader.cb());f=new lR("sdtp",m.version||0,m.flags||0,n,0)}).N("uuid",function(m){var n=_.sq(m.reader,16);if(_.Sm(n,wS)){n=_.oq(m.reader);m.version=n>>>24;m.flags=n&16777215;n=new dS(m.version,m.flags);n.h=_.oq(m.reader);m.flags&1&&(n.j=_.mq(m.reader));for(var p=0;p<n.h;p++){var q={Wi:_.sq(m.reader,8),Xd:0,vh:[]};if(m.flags&2){q.Xd=_.nq(m.reader);for(var t=0;t<q.Xd;t++){var u={Vh:0,Wh:0};u.Vh=_.nq(m.reader);u.Wh=_.oq(m.reader);q.vh.push(u)}}n.f.push(q)}g=
|
|
20
|
+
n}}).N(_.Pe,function(m){var n=new YR;0<m.reader.cb()?n.f=_.sq(m.reader,m.reader.cb()):(_.Vh($Q,"mdat box is empty!"),n.f=new Uint8Array(0));k=n}).parse(a,!1);if(!k)return null;var l=(new VR).append([d,e]);f&&l.append([f]);b.Mf()&&g&&l.append([g]);l=(new WR).append([c,l]);return new tS([l,k])},yS=function(a,b,c,d){var e=d.Mf(),f=parseInt(c*b,10);b=a.data||new ArrayBuffer(0);var g=xS(b,d);if(null===g)return a.request.contentType===_.Gn?a.data:g;d=g.get(_.Pe);if(a.request.contentType===_.Gn){e=d.f.buffer;
|
|
21
|
+
if(c){e=_.R.we(e);if((e=(new DOMParser).parseFromString(e,_.vg))&&"tt"===e.documentElement.tagName.toLowerCase())var k=e.documentElement;if(k&&(d=new rS(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",_.oe],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 z=q.length;u<z;u++){var B=q[u].name;if(B=B.match(t)){p=p.getAttribute(B[0]);break b}}p=null}}f.setAttribute(l[m],qS(p||"",g,d))}}e=(new XMLSerializer).serializeToString(e);c=_.R.ub(e).buffer}else c=e;return c}k=new WR;a=g.get("mfhd");b=new VR;l=g.get("tfhd");m=new RR(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].Xd);else g=8;b.append([c,new bS,new cS(g,l,c.h)])}k.append([a,b]);f.flags|=1;f.j=k.a()+8;d=new tS([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},zS=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,periodId:null}},AS=function(a,b,c){a=_.Zr(a);c&&a.version!==c&&(a=_.tC(a,c));
|
|
24
|
+
return{initData:_.rC(a),initDataType:_.md,keyId:b,periodId:null}},CS=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=BS;this.I=0;this.G=this.J=Infinity;this.w=[];this.L=this.Qo.bind(this);this.H=new Map},DS=function(a,b){var c,d,e;return _.I(function(f){if(1==f.a)return c=_.dl(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),_.y(f,d.U,2);e=f.f;a.o=e.uri;return f["return"](e)})},KS=function(a,b){var c=_.Ur,d=null;try{var e=_.R.we(b);d=c.Te(e,_.Jb)}catch(lY){}if(!d)throw a.g.error("Unable to parse manifest"),new _.O(_.P,4,4033,a.o);var f=+ES(a,d,"MajorVersion"),g=+ES(a,d,"MinorVersion"),k=+d.getAttribute("TimeScale")||1E7,l=+ES(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?(FS(a,GS),a.B=typeof a.f.liveRefreshPeriod===_.h?1E3*a.f.liveRefreshPeriod:Math.min(1E3*a.I,1E4),l=Infinity):FS(a,BS);a.a={startTime:0,delay:0,duration:l/k,Ig:p/k,Ne:0};if(q){var t=a.f.playreadyVersion,u=_.Ur,z=[],B=u.aa(q,
|
|
27
|
+
"ProtectionHeader")[0],D=_.Pm(u.va(B)||""),C=_.Zr(D).a;z.push(zS(_.Md,{initData:_.rC(_.Rr(C)),initDataType:_.md,keyId:C,periodId:null},[C]));z.push(zS(_.Kd,AS(D,C,t),[C]));a.w=z}var E=[],x=_.Ur.aa(d,"StreamIndex");if(!x.length)throw a.g.error("No streams found!"),new _.O(_.P,4,4034,a.o);for(var J=0;J<x.length;J++){for(var L,U=a,V=x[J],ta=ES(U,V,"Type"),za=+V.getAttribute("Chunks"),va=V.getAttribute("Subtype")||"",qa=V.getAttribute("Language")||_.Gg,Fa=_.vo(qa),sc=V.getAttribute("Name")||"",ab=+V.getAttribute(_.eb),
|
|
28
|
+
Uc=+V.getAttribute(_.db),Pd=ES(U,V,"Url"),Ff=+V.getAttribute("TimeScale")||null,uc=[],ei=_.Ur.aa(V,_.yb),Hf=0;Hf<ei.length;Hf++){var td=void 0,Nb=void 0,fc=void 0,Rd=U,wc=ei[Hf],Ig=ta,JW=+wc.getAttribute("Index"),KW=+ES(Rd,wc,"Bitrate"),HJ=NaN,IJ=NaN,Jo=NaN,Mv=NaN,JJ=NaN,KJ=NaN,LJ=NaN,MJ=wc.getAttribute("FourCC")||"";switch(Ig){case _.Tg:HJ=+ES(Rd,wc,_.db);IJ=+ES(Rd,wc,_.eb);break;case _.Sc:Mv=+wc.getAttribute("Channels")||2,Jo=+ES(Rd,wc,"SamplingRate"),KJ=+ES(Rd,wc,"AudioTag"),JJ=+ES(Rd,wc,"BitsPerSample"),
|
|
29
|
+
LJ=+ES(Rd,wc,"PacketSize")}var Nv=String(wc.getAttribute("CodecPrivateData"));if(Ig===_.Sc&&!Nv){var NJ=Mv,OJ={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},Ko=OJ[Jo];if("AACH"===MJ){Nb=new Uint8Array(4);var PJ=OJ[2*Jo];Nb[0]=40|Ko>>1;Nb[1]=Ko<<7|NJ<<3|PJ>>1;Nb[2]=PJ<<7|8;Nb[3]=0;td=new Uint16Array(2);td[0]=(Nb[0]<<8)+Nb[1];td[1]=(Nb[2]<<8)+Nb[3];fc=td[0].toString(16)+td[1].toString(16)}else Nb=new Uint8Array(2),Nb[0]=16|Ko>>1,Nb[1]=Ko<<7|NJ<<3,
|
|
30
|
+
td=new Uint16Array(1),td[0]=(Nb[0]<<8)+Nb[1],fc=td[0].toString(16);Nv=fc.toUpperCase()}var LW={id:Rd.P++,type:Ig,index:JW,bitrate:KW,Bf:Nv,maxHeight:HJ,maxWidth:IJ,We:Jo,Zh:Mv,Np:KJ,Ak:JJ,eq:LJ,rm:MJ,segmentIndex:null};uc.push(LW)}L=uc;for(var Te=[],QJ=_.Ur.aa(V,"c"),wk=0;wk<QJ.length;wk++){var Ov=QJ[wk],le=parseInt(Ov.getAttribute("t"),10),ii=parseInt(Ov.getAttribute("d"),10),Pv=parseInt(Ov.getAttribute("r"),10),xk=0;if(isNaN(le)&&isNaN(ii))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===wk&&isNaN(le)&&(xk=le=0);if(0<wk){var Kg=Te[Te.length-1];xk=Kg.n+1;Kg.d||(Kg.d=le-Kg.t);le||(le=Kg.t+Kg.d);ii||(ii=le-Kg.t)}Te.push({n:xk,d:ii,t:le});if(Pv){Pv--;for(var RJ=0;RJ<Pv;RJ++){var Lo=Te[Te.length-1];xk=Lo.n+1;le=Lo.t+Lo.d;ii=Lo.d;Te.push({n:xk,d:ii,t:le})}}}U.me()||Te.length===za||U.g.warn("Number of fragments ("+za+") differs from number of chunks ("+Te.length+").");E.push({type:ta,Sp:za,fp:va,language:Fa,Qd:qa,name:sc,maxWidth:ab,maxHeight:Uc,xp:Pd,tracks:L,
|
|
32
|
+
Ei:Te,timescale:Ff})}var Jf={bq:f,ij:g,timescale:k,duration:l,isLive:m,aq:n,Ig:p,Og:!1,streams:E};if(a.j&&a.A)return HS(a,Jf),Promise.resolve();a.H.clear();var Qv=Jf.timescale,Mo=Jf.duration,NW=iS(Jf.streams,_.Sc),OW=iS(Jf.streams,_.Tg),PW=iS(Jf.streams,_.Gn),SJ=[],No=IS(a,Mo,Qv,NW),Oo=IS(a,Mo,Qv,OW),QW=IS(a,Mo,Qv,PW);No.length||(No=[null]);Oo.length||(Oo=[null]);for(var Sv=0;Sv<Oo.length;Sv++)for(var Tv=0;Tv<No.length;Tv++)SJ.push(JS(a,Oo[Sv],No[Tv]));var TJ={id:"ID",configurationId:void 0,startTime:0,
|
|
33
|
+
endTime:Mo,variants:SJ,textStreams:QW,thumbStreams:[]};var SW=Jf.streams,Uv=a.a.startTime,UJ=a.a.delay,Vv=a.J,VJ=Math.min(a.a.duration||Infinity,Vv),Wv=a.me(),TW=a.a.Ig,UW=a.a.Ne,WJ=a.I,XJ=isFinite(a.G)?a.G:0;if(Wv)VJ=Infinity,Uv=Date.now()/1E3-UW,a.a.startTime=Uv,UJ=3*WJ;else for(var VW=isFinite(Vv)?Vv:a.a.duration,YJ=_.v(SW),Xv=YJ.next();!Xv.done;Xv=YJ.next())for(var ZJ=_.v(Xv.value.tracks),Yv=ZJ.next();!Yv.done;Yv=ZJ.next()){var $J=Yv.value;$J.segmentIndex.offset(-XJ);_.hD($J.segmentIndex,VW)}var aK=
|
|
34
|
+
a.f.timeline||{};aK.type=void 0;a.D=new _.uD(aK,Uv,UJ,!Wv,!0);a.D.f=VJ;_.CD(a.D,WJ);a.D.A=TW;Wv||a.D.offset(-XJ);a.F.filterAllPeriods([TJ]);a.j={presentationTimeline:a.D,periods:[TJ],minBufferTime:0,cues:[]};Promise.resolve();a.K||(a.F.networkingEngine.yd(a.L),a.K=!0);a.A=Jf;return Promise.resolve()},HS=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))){gS(e.zc,g)||a.g.warn("The current stream is updated with a stream that seems to have different base properties!");var k=LS(a,a.A.timescale,d,g);g=e.zc.segmentIndex;g.ta(k);(k=a.a.Ig)&&hR(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."))},IS=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=LS(a,c,m,l);n=new _.RD(n);var p=null;m.type!==_.Gn&&(p=MS(a,b,c,m,l));l.segmentIndex=n;var q=_.gK++,t=Promise.resolve.bind(Promise),u=n.Af.bind(n),z=n.get.bind(n),B=n.wg.bind(n),D=n.getDuration.bind(n),C=NS[m.type],E="";switch(m.type){case _.Tg:E=l.Bf;var x=/00000001[0-9]7/.exec(E);E="avc1."+(x&&x[0]?E.substr(E.indexOf(x[0])+10,6):"42c00c");a.g.debug("VIDEO CODECS: ",E);break;case _.Sc:E=
|
|
37
|
+
l.Bf,x=2,"AACH"===l.rm?x=5:E&&(x=(parseInt(E.substr(0,2),16)&248)>>3),E="mp4a.40."+x,a.g.debug("AUDIO CODECS: ",E)}x=m.type===_.Gn?OS[m.fp]:void 0;return{id:q,originalId:null,hq:null,createSegmentIndex:t,findSegmentPosition:u,getSegmentReference:z,adjustSegmentDurations:B,getDuration:D,segmentIndex:n,segmentLookupStrategy:_.$B,initSegmentReference:p,mimeType:C,codecs:E,frameRate:void 0,bandwidth:l.bitrate,width:l.maxWidth||void 0,height:l.maxHeight||void 0,kind:x,encrypted:a.Rg(),keyId:null,language:m.language,
|
|
38
|
+
originalLanguage:m.Qd,label:m.name,type:m.type,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:l.Zh||null,spatialAudio:!1,closedCaptions:null}}}(f));e=e.concat(g)}return e},LS=function(a,b,c,d){var e=0,f=[],g=c.timescale||b;c.Ei.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=fS(a.o,c,l,d);a.I=Math.max(a.I,m);f.push(new _.Wp(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===_.Sc)b=f[f.length-1],a.J=Math.min(a.J,e),0===a.a.Ne?a.a.Ne=b.endTime:a.a.Ne=Math.min(a.a.Ne,b.endTime);return f},MS=function(a,b,c,d,e){b=hS(b,d.timescale||c,e);c={isLive:a.me.bind(a),Mf:a.Rg.bind(a),Bm:function(){return 1},Kf:a.Ji.bind(a)};d=new Uint8Array(0);try{d=vS(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,"+_.Om(d);return new _.RC(function(){return[f]},0,null,null,!0)},JS=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},ES=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);},PS=function(a,b){null!=a.B&&null!=b&&(a.l=window.setTimeout(a.rc.bind(a),b))},FS=function(a,b){var c=b===BS;a.j&&a.j.presentationTimeline&&_.xD(a.j.presentationTimeline,c);c&&null!=
|
|
41
|
+
a.l&&(window.clearTimeout(a.l),a.l=null,a.B=null);a.M=b},QS=function(){};jR.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};jR.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
|
+
jR.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
|
+
jR.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);_.iq(a,iR(this.type));this.size>b&&bR(a,this.size);"uuid"===this.type&&_.iq(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,jR);Z.prototype.a=function(){return 4+jR.prototype.a.call(this)};
|
|
44
|
+
Z.prototype.write=function(a){jR.prototype.write.call(this,a);cR(a,this.version);dR(a,this.flags)};_.w(kR,jR);kR.prototype.a=function(){return this.f.byteLength+jR.prototype.a.call(this)-this.offset};kR.prototype.write=function(a){jR.prototype.write.call(this,a);_.iq(a,this.f,this.offset);a.getPosition()};_.w(lR,Z);lR.prototype.a=function(){return this.f.byteLength+Z.prototype.a.call(this)-this.offset};lR.prototype.write=function(a){Z.prototype.write.call(this,a);_.iq(a,this.f,this.offset);a.getPosition()};
|
|
45
|
+
_.w(mR,jR);mR.prototype.a=function(){var a=this.h.length;a=a+4+this.f.join("").length;return a+jR.prototype.a.call(this)};mR.prototype.write=function(a){jR.prototype.write.call(this,a);_.iq(a,iR(this.h));_.W(a,this.ij);_.iq(a,iR(this.f.join("")));a.getPosition()};_.w(nR,jR);_.w(oR,jR);_.w(pR,Z);pR.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
|
+
pR.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(bR(a,0),bR(a,0),_.W(a,this.timescale),bR(a,this.duration*this.timescale)):(_.W(a,0),_.W(a,0),_.W(a,this.timescale),_.W(a,this.duration*this.timescale));_.W(a,65536);eR(a,this.volume);eR(a,0);_.W(a,0);_.W(a,0);for(var b=0;b<this.f.length;b++)cR(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(qR,jR);_.w(rR,Z);rR.prototype.a=function(){return 20+Z.prototype.a.call(this)};
|
|
47
|
+
rR.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(sR,Z);sR.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
|
+
sR.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(bR(a,0),bR(a,0),_.W(a,this.h),_.W(a,0),bR(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);eR(a,0);eR(a,0);eR(a,this.volume);eR(a,0);for(var b=0;b<this.f.length;b++)cR(a,this.f[b]);eR(a,this.width);eR(a,0);eR(a,this.height);eR(a,0);a.getPosition()};_.w(tR,Z);tR.prototype.a=function(){var a=0;a=1===this.version?a+28:a+16;return a+4+Z.prototype.a.call(this)};
|
|
49
|
+
tR.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(bR(a,0),bR(a,0),_.W(a,this.timescale),bR(a,this.duration*this.timescale)):(_.W(a,0),_.W(a,0),_.W(a,this.timescale),_.W(a,this.duration*this.timescale));eR(a,this.language);eR(a,0);a.getPosition()};_.w(uR,Z);uR.prototype.a=function(){return 33+Z.prototype.a.call(this)};
|
|
50
|
+
uR.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,0);this.f===_.Tg?_.iq(a,iR("vide")):_.iq(a,iR("soun"));_.W(a,0);_.W(a,0);_.W(a,0);this.f===_.Tg?_.iq(a,iR("VideoHandler\x00")):_.iq(a,iR("SoundHandler\x00"));a.getPosition()};_.w(vR,Z);vR.prototype.a=function(){return 2+this.f.byteLength+Z.prototype.a.call(this)};vR.prototype.write=function(a){Z.prototype.write.call(this,a);eR(a,0);_.iq(a,this.f);a.getPosition()};_.w(wR,jR);wR.prototype.a=function(){return 8+jR.prototype.a.call(this)};
|
|
51
|
+
wR.prototype.write=function(a){jR.prototype.write.call(this,a);_.W(a,0);eR(a,0);eR(a,1)};_.w(xR,wR);xR.prototype.a=function(){return 70+wR.prototype.a.call(this)};xR.prototype.write=function(a){wR.prototype.write.call(this,a);eR(a,0);eR(a,0);_.W(a,0);_.W(a,0);_.W(a,0);eR(a,this.width);eR(a,this.height);_.W(a,4718592);_.W(a,4718592);_.W(a,0);eR(a,1);cR(a,10);_.iq(a,iR("AVC Coding",31));eR(a,this.depth);gR(a,-1)};_.w(yR,wR);yR.prototype.a=function(){return 20+wR.prototype.a.call(this)};
|
|
52
|
+
yR.prototype.write=function(a){wR.prototype.write.call(this,a);_.W(a,0);_.W(a,0);eR(a,this.channelCount);eR(a,this.sampleSize);gR(a,0);eR(a,0);eR(a,this.sampleRate);eR(a,0)};_.w(zR,xR);zR.prototype.write=function(a){xR.prototype.write.call(this,a);for(var b=0;b<this.children.length;b++)this.children[b].write(a);a.getPosition()};_.w(AR,zR);_.w(BR,yR);BR.prototype.write=function(a){yR.prototype.write.call(this,a);for(var b=0;b<this.children.length;b++)this.children[b].write(a);a.getPosition()};
|
|
53
|
+
_.w(CR,BR);_.w(DR,jR);DR.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+jR.prototype.a.call(this)};
|
|
54
|
+
DR.prototype.write=function(a){jR.prototype.write.call(this,a);cR(a,this.version);cR(a,this.f);cR(a,this.h);cR(a,this.level);cR(a,255);cR(a,224|this.sb.length);for(var b=0;b<this.sb.length;b++)eR(a,this.sb[b].length),_.iq(a,this.sb[b]);cR(a,this.Kc.length);for(b=0;b<this.Kc.length;b++)eR(a,this.Kc[b].length),_.iq(a,this.Kc[b]);a.getPosition()};_.w(ER,Z);ER.prototype.a=function(){return 22+(this.Ac.byteLength+3)+Z.prototype.a.call(this)};
|
|
55
|
+
ER.prototype.write=function(a){Z.prototype.write.call(this,a);cR(a,3);cR(a,23+this.Ac.byteLength);eR(a,1);cR(a,0);cR(a,4);cR(a,15+this.Ac.byteLength);cR(a,64);cR(a,21);dR(a,0);_.W(a,0);_.W(a,0);cR(a,5);cR(a,this.Ac.byteLength);_.iq(a,this.Ac);_.iq(a,new Uint8Array([6,1,2]));a.getPosition()};_.w(FR,Z);FR.prototype.a=function(){return this.location.length+Z.prototype.a.call(this)};FR.prototype.write=function(a){Z.prototype.write.call(this,a);0<this.location.length&&_.iq(a,iR(this.location));a.getPosition()};
|
|
56
|
+
_.w(GR,Z);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,jR);_.w(IR,Z);IR.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
|
+
IR.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(JR,Z);JR.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)};JR.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(KR,Z);
|
|
58
|
+
KR.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)};KR.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(LR,Z);LR.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
|
+
LR.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(MR,Z);MR.prototype.a=function(){return 8+Z.prototype.a.call(this)};MR.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,0);_.W(a,0);a.getPosition()};_.w(NR,Z);NR.prototype.a=function(){return 4+Z.prototype.a.call(this)};NR.prototype.write=function(a){Z.prototype.write.call(this,a);gR(a,0);eR(a,0);a.getPosition()};
|
|
60
|
+
_.w(OR,jR);_.w(PR,jR);_.w(QR,jR);_.w(RR,Z);RR.prototype.a=function(){var a=0;a=1===this.version?a+8:a+4;return a+Z.prototype.a.call(this)};RR.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?bR(a,this.baseMediaDecodeTime):_.W(a,this.baseMediaDecodeTime);a.getPosition()};_.w(SR,Z);SR.prototype.a=function(){return 4+Z.prototype.a.call(this)};SR.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.f);a.getPosition()};_.w(TR,Z);
|
|
61
|
+
TR.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
|
+
TR.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.f);this.flags&1&&(a.getPosition(),fR(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]):fR(a,this.h[b]));a.getPosition()};_.w(UR,Z);
|
|
63
|
+
UR.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)};UR.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.f);this.flags&1&&bR(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(VR,jR);_.w(WR,jR);_.w(YR,jR);YR.prototype.a=function(){return this.f.byteLength+jR.prototype.a.call(this)};
|
|
64
|
+
YR.prototype.write=function(a){jR.prototype.write.call(this,a);0<this.f.byteLength&&_.iq(a,this.f)};_.w(ZR,Z);ZR.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)};ZR.prototype.write=function(a){Z.prototype.write.call(this,a);cR(a,0);0===this.version?cR(a,0):cR(a,0);cR(a,this.f);cR(a,this.h);_.iq(a,_.Qm(this.l));if(1===this.f&&0===this.h){cR(a,0);for(var b=0;b<this.j.length;b++)cR(a,this.j[b])}a.getPosition()};_.w($R,Z);
|
|
65
|
+
$R.prototype.a=function(){var a=8;this.flags&1&&(a+=iR(this.tc).byteLength);return a+Z.prototype.a.call(this)};$R.prototype.write=function(a){Z.prototype.write.call(this,a);_.iq(a,iR(this.f));_.W(a,this.h);this.flags&1&&_.iq(a,iR(this.tc));a.getPosition()};_.w(aS,jR);aS.prototype.a=function(){return iR(this.f).byteLength+jR.prototype.a.call(this)};aS.prototype.write=function(a){jR.prototype.write.call(this,a);_.iq(a,iR(this.f));a.getPosition()};_.w(bS,Z);
|
|
66
|
+
bS.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)};bS.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]):bR(a,this.offset[b]);a.getPosition()};_.w(cS,Z);cS.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
|
+
cS.prototype.write=function(a){Z.prototype.write.call(this,a);this.flags&1&&(_.W(a,0),_.W(a,0));cR(a,this.f);_.W(a,this.h);if(0===this.f)for(var b=0;b<this.h;b++)cR(a,this.j[b]);a.getPosition()};_.w(dS,Z);dS.prototype.a=function(){var a=4;this.flags&1&&(a+=1);for(var b=0;b<this.h;b++)if(a+=this.f[b].Wi.byteLength,this.flags&2){a+=2;for(var c=0;c<this.f[b].Xd;c++)a+=2,a+=4}return a+Z.prototype.a.call(this)};
|
|
68
|
+
dS.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.h);this.flags&1&&cR(a,this.j);for(var b=0;b<this.h;b++)if(_.iq(a,this.f[b].Wi),this.flags&2){eR(a,this.f[b].Xd);for(var c=0;c<this.f[b].Xd;c++)eR(a,this.f[b].vh[c].Vh),_.W(a,this.f[b].vh[c].Wh)}a.getPosition()};var kS=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,lS=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,mS=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,nS=/^(\d*\.?\d*)f$/,oS=/^(\d*\.?\d*)t$/,pS=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/;tS.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};tS.prototype.write=function(){this.f=sS(this);for(var a=0;a<this.a.length;a++)this.a[a].write(this.f);return this.f.buffer};var wS=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);_.r=CS.prototype;_.r.configure=function(a){this.f=a};_.r.start=function(a,b){var c=this;this.F=b;var d=_.uh(new Set([a,eS(a)])).concat();return DS(this,d).then(function(e){return KS(c,e.data).then(function(){PS(c,c.B);return c.j})})};_.r.requestStop=function(){};_.r.stop=function(){this.F&&this.F.networkingEngine.Ve(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.me())return DS(this,[this.o]).then(function(b){return KS(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(_.RB);this.F&&(this.l=null,this.update().then(function(){PS(a,a.B)})["catch"](function(b){a.F&&(a.F.onError(b),1===b.severity&&PS(a,100))}))};_.r.me=function(){return this.M===GS};_.r.Rg=function(){return 0<this.w.length};
|
|
70
|
+
_.r.Ji=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.Qo=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.me.bind(this),Mf:this.Rg.bind(this),Bm:function(){return 1},Kf:this.Ji.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=yS(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 _.zi(_.HB+a);return f["return"](d)})};var NS={video:_.Vg,audio:_.Xc,text:_.Pc},BS=_.Vb,GS="LIVE",OS={Ap:_.hd,Hp:_.qg};_.w(QS,_.jv);QS.prototype.install=function(){_.ew.ism=CS;_.dw[_.Qc]=CS};QS.prototype.uninstall=function(){_.pE("ism");_.qE(_.Qc)};QS.prototype.id=function(){return _.hg};_.K("clpp.smooth.SmoothComponent",QS);};
|
|
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
|
-
|
|
8
|
-
this.height*(this.a.naturalHeight||this.a.height))+_.
|
|
9
|
-
|
|
10
|
-
g))};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
|
|
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
|
-
|
|
2
|
+
var f=function(window){var Tz="No thumbnail found for position: ",Uz="Position is out of range: ",Vz="Thumbnail URL is mandatory",Wz="Wrong gridSize format",Xz="clpp.thumbnails",Yz=function(){this.log=new _.M(Xz);this.player=null;this.a=[];this.w=!1},$z=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 Zz(a,0,e,!!f)})},Promise.resolve())},Zz=function(a,b,c,d){if(a.w||b>=a.a.length)return Promise.resolve();var e=b+c;return aA(a,d).then(function(){return a.a[b].load()}).then(function(){return Zz(a,
|
|
3
|
+
e,c,d)})},aA=function(a,b){return new Promise(function(c){if(b||2!==a.player.getState())c();else a.player.one(_.dd,function(){c()})})},bA=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},cA=function(){Yz.call(this);
|
|
4
|
+
this.f=null;this.o=this.h=1;this.j=0},dA=function(a,b){this.time=a;this.duration=0;this.offset=b;this.length=0;this.Rd=new _.rm},eA=function(){this.g=new _.M(Xz);this.f=new ArrayBuffer(0);this.a=[];this.h=new _.rm},fA=function(a){var b=a.f.byteLength;a.a.forEach(function(c){c.offset+c.length<b&&c.Rd.resolve()})},hA=function(a,b){return gA(a,b).then(function(c){return new bA(c,b.time,b.duration)})},gA=function(a,b){return b.load().then(function(){var c=_.Vi(a.f,b.offset,b.length);return"data:image/jpeg;base64,"+
|
|
5
|
+
_.Nm(c)})},iA=function(){Yz.call(this);this.f=null},jA=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},kA=function(){Yz.apply(this,arguments)},lA=function(a,b){var c=a.horizontalTiles||b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{Ge:c,Fh:d,Vi:e,durationPerTile:a.durationPerTile||b.durationPerTile||(a.endTime-a.startTime)/e}},mA=function(){this.g=new _.M(Xz);this.a=this.m=null},nA=function(a){return a.some(function(b){return 0<
|
|
6
|
+
b.thumbStreams.length})},sA=function(a){return a?a===oA||a===pA?new cA:a===qA?new iA:a===rA?new eA:null:null},tA=function(a){if(!a)return null;a=new _.zn(a);return a.path.match(/.*\.vtt$/i)?qA:a.path.match(/.*\.bif$/i)?rA:a.path.match(/.*\.(png|jpg|jpeg)$/i)?oA:null},uA=function(){};Yz.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&&$z(c,b.preload)})};bA.prototype.raw=function(){return this.a.cloneNode(!1)};
|
|
7
|
+
bA.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(_.Xd);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
|
+
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
|
+
bA.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(_.qe,e);b(a)};e=function(g){a.a.removeEventListener(_.Ke,f);a.a.removeEventListener(_.qe,e);c(new _.O(1,9,2014,"Failed to load thumbnail.",
|
|
10
|
+
g))};a.a.addEventListener(_.Ke,f);a.a.addEventListener(_.qe,e);a.a.src=a.src}}));return this.f};_.K("clpp.thumbnails.Thumbnail",bA);bA.prototype.load=bA.prototype.load;bA.prototype.element=bA.prototype.element;bA.prototype.raw=bA.prototype.raw;_.w(cA,Yz);
|
|
11
|
+
cA.prototype.init=function(a,b){if(!b||!b.url)throw new _.O(1,9,7100,Vz);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,Wz);}catch(d){throw this.log.error("Error during parsing gridSize",d),
|
|
12
|
+
new _.O(1,9,7100,Wz);}Yz.prototype.init.call(this,a,b)};cA.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,Uz+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 _.y(g,f.load(),2)}return g["return"](f)})};
|
|
13
|
+
cA.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 bA(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()};dA.prototype.load=function(){return this.Rd};
|
|
14
|
+
eA.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.O(1,9,7100,Vz);var d=b.url,e=_.dl(d);e.type=_.bl;a.getNetworkEngine().fetch(e).U.then(function(f){f=f.data;var g=_.Vi(c.f);f=_.Vi(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=_.Vi(l);n=String.fromCharCode.apply(null,
|
|
15
|
+
vA);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 dA(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
|
+
fA(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))})};eA.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,Uz+a);return _.y(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,Tz+a);return _.y(e,hA(b,c),3);case 3:return d=e.f,_.y(e,d.load(),4);case 4:return e["return"](d)}})};
|
|
17
|
+
eA.prototype.Zb=function(){return 0<this.a.length};var vA=[137,66,73,70,13,10,26,10];_.w(iA,Yz);
|
|
18
|
+
iA.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.O(1,9,7100,Vz);var d=b.url,e=_.dl(d);e.type=_.bl;this.f=a.getNetworkEngine().fetch(e).U.then(function(f){f=f.data;if(!f)throw Error("No data in the response");f=_.R.ea(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=jA(l[0]);l=jA(l[1])-t;c.a.push(new bA(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))});Yz.prototype.init.call(this,a,b)};
|
|
20
|
+
iA.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,Uz+a);return _.y(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,Tz+a);return _.y(d,c.load(),3)}return d["return"](c)})};iA.prototype.l=function(){return this.f};_.w(kA,Yz);
|
|
21
|
+
kA.prototype.get=function(a){function b(){return new _.O(1,9,2014,Tz+a)}var c=this,d,e,f,g,k,l,m,n,p,q,t,u,z;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,Uz+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=lA(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.Vi+m])):(q=k.Ia())&&0<q.length&&(u=t=0,z=k.startTime,1<l.Vi&&(t=m%l.Ge,u=Math.floor(m/l.Ge),z+=m*l.durationPerTile),n=new bA(q[0],z,l.durationPerTile,void 0,void 0,void 0,void 0,l.Ge,l.Fh,
|
|
23
|
+
t,u));return n?_.y(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();})};kA.prototype.f=function(a,b){return void 0!==a.bandwidth&&void 0!==b.bandwidth?a.bandwidth-b.bandwidth:0};
|
|
24
|
+
kA.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=lA(d,b),f=d.Ia()[0],g=new Image,k=d.startTime,l=0;l<e.Fh;++l)for(var m=0;m<e.Ge;++m)this.a.push(new bA(f,k,e.durationPerTile,void 0,void 0,void 0,void 0,e.Ge,e.Fh,m,l,g)),k+=e.durationPerTile;return Promise.resolve()};_.r=mA.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=tA(c.url||null));(this.a=sA(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(nA(d)){this.a=new kA;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"};_.K("clpp.thumbnails.ThumbnailsPlugin",mA);mA.prototype.get=mA.prototype.get;mA.Id="thumbnails";
|
|
27
|
+
uA.prototype.create=function(){return new mA};var oA="SINGLE",pA="GRID",qA="WEBVTT",rA="BIF";_.fp(new uA);};
|
|
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));}
|