@castlabs/prestoplay 6.25.2 → 6.26.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 +15 -0
- package/README.md +5 -5
- package/cjs/cl.adobe.js +3 -3
- package/cjs/cl.airplay.js +3 -3
- package/cjs/cl.broadpeak.js +7 -7
- package/cjs/cl.cast.js +112 -112
- package/cjs/cl.conviva.js +32 -32
- package/cjs/cl.core.js +601 -600
- package/cjs/cl.crypto.js +9 -9
- package/cjs/cl.dash.js +89 -88
- package/cjs/cl.externs.js +37 -31
- package/cjs/cl.freewheel.js +24 -24
- 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 +23 -23
- package/cjs/cl.mediatailor.js +3 -3
- package/cjs/cl.mse.js +341 -334
- package/cjs/cl.muxdata.js +15 -15
- package/cjs/cl.onboard.js +3 -3
- package/cjs/cl.persistent.js +14 -14
- package/cjs/cl.playlist.js +6 -6
- package/cjs/cl.sessions.js +16 -16
- package/cjs/cl.simid.js +17 -17
- package/cjs/cl.smooth.js +72 -72
- 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 +12 -12
- 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 +38 -36
- package/cl.adobe.js +3 -3
- package/cl.airplay.js +3 -3
- package/cl.broadpeak.js +5 -5
- package/cl.cast.js +87 -87
- package/cl.conviva.js +27 -27
- package/cl.core.js +489 -488
- package/cl.crypto.js +9 -9
- package/cl.dash.js +82 -82
- package/cl.externs.js +37 -31
- package/cl.freewheel.js +19 -19
- package/cl.hls.js +79 -80
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +26 -26
- package/cl.ima.js +17 -17
- package/cl.mediatailor.js +3 -3
- package/cl.mse.js +299 -292
- 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.sessions.js +10 -10
- package/cl.simid.js +14 -14
- package/cl.smooth.js +60 -60
- package/cl.thumbnails.js +19 -19
- package/cl.tizen.js +57 -57
- package/cl.ttml.js +22 -22
- package/cl.verimatrix.js +4 -4
- package/cl.vimond.js +8 -8
- package/cl.vr.js +14 -14
- package/cl.vtt.js +12 -12
- package/cl.yospace.js +3 -3
- package/cl.youbora.js +28 -27
- package/package.json +3 -3
- package/typings.d.ts +41 -3
package/cjs/cl.smooth.js
CHANGED
|
@@ -1,76 +1,76 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var
|
|
3
|
-
b,a.h),a.a+=2}catch(c){_.
|
|
4
|
-
b,c,d,e){Z.call(this,a,b,c);this.f=d;this.offset=e},
|
|
5
|
-
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]},
|
|
6
|
-
|
|
7
|
-
a},
|
|
8
|
-
"tfdt",a,0);this.baseMediaDecodeTime=b},
|
|
9
|
-
function(a,b){Z.call(this,"schm",0,0);this.f=a;this.h=b;this.jc=""},
|
|
10
|
-
String(d.bitrate)).replace("{Bitrate}",String(d.bitrate)).replace("{start time}",String(c.t)).replace("{start_time}",String(c.t));return _.
|
|
11
|
-
tc:null,width:NaN,height:NaN,oc:null,
|
|
12
|
-
b,c){var d=null;if(
|
|
13
|
-
d);return b+":"+c+":"+a+"."+d},
|
|
14
|
-
"Could not get default Key ID for DRM init data!");d=null}c=new
|
|
15
|
-
a.duration),h=new
|
|
16
|
-
g=(new
|
|
17
|
-
if(null===m.flags)throw new _.N(_.O,3,3019,
|
|
18
|
-
var p=new
|
|
19
|
-
m.version||0,m.flags||0,n,0)}).M("uuid",function(m){var n=_.
|
|
20
|
-
(_.
|
|
21
|
-
e.documentElement;if(h&&(d=new
|
|
22
|
-
p.getAttribute(A[0]);break b}}p=null}}f.setAttribute(l[m]
|
|
23
|
-
new
|
|
24
|
-
this.
|
|
25
|
-
c.fuzzFactor=a.f.attemptParameters.fuzzFactor,c.type=1,d=a.
|
|
26
|
-
Infinity,q=c.$(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 _.N(_.O,4,4036,a.o);m?(
|
|
27
|
-
keyId:
|
|
28
|
-
_.Ab),
|
|
29
|
-
_.Pc&&!
|
|
30
|
-
{id:
|
|
31
|
-
isNaN(
|
|
32
|
-
{
|
|
33
|
-
textStreams:
|
|
34
|
-
|
|
35
|
-
l.nc.type&&m.bitrate===l.nc.bitrate}}(e))){
|
|
36
|
-
f.$c++){var g=d[f.$c].tracks.map(function(h){return function(l){var m=d[h.$c],n=
|
|
37
|
-
(
|
|
38
|
-
label:m.name,type:m.type,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:l.
|
|
39
|
-
1],a.J=Math.min(a.J,e),0===a.a.
|
|
40
|
-
0),e=c?c.language:_.
|
|
41
|
-
a.l=null,a.B=null);a.N=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
|
-
_.w(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
_.r.update=function(){var a=this;if(this.
|
|
71
|
-
_.r.
|
|
72
|
-
_.r.
|
|
73
|
-
!0,e.data=h,3E3===h.code&&(e.code=4039)}if(d||!f)return Promise.reject(e);a.data=f;return Promise.resolve(a)};_.r.loadVariant=function(a){return _.H(function(b){return b["return"](a)})};_.r.loadTextStream=function(a,b){var c=this,d,e;return _.H(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 ZR="Full MP4 box must have flags defined",$R="clpp.smooth.SmoothMP4Processor",aS="codecPrivateData",bS=function(a,b){var c=Math.floor(b/Math.pow(2,32)),d=b-c*Math.pow(2,32);_.V(a,c);_.V(a,d)},cS=function(a,b){try{a.f.setUint8(a.a,b),a.a+=1}catch(c){_.fn()}},dS=function(a,b){cS(a,b>>16&255);cS(a,b>>8&255);cS(a,b&255)},eS=function(a,b){try{a.f.setUint16(a.a,b,a.h),a.a+=2}catch(c){_.fn()}},fS=function(a,b){try{a.f.setInt32(a.a,b,a.h),a.a+=4}catch(c){_.fn()}},gS=function(a,b){try{a.f.setInt16(a.a,
|
|
3
|
+
b,a.h),a.a+=2}catch(c){_.fn()}},hS=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},iS=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){iS.call(this,a);this.version=b;this.flags=c},jS=function(a,b,c){iS.call(this,a);this.f=b;this.offset=c},kS=function(a,
|
|
4
|
+
b,c,d,e){Z.call(this,a,b,c);this.f=d;this.offset=e},lS=function(a,b,c){iS.call(this,"ftyp");this.h=a;this.Gi=b;this.f=c},mS=function(){iS.call(this,_.Ne)},nS=function(){iS.call(this,_.ug)},oS=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]},pS=function(){iS.call(this,"mvex")},qS=function(a){Z.call(this,"trex",0,0);this.f=a},rS=function(a,b,c,d,e){Z.call(this,"tkhd",
|
|
5
|
+
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]},sS=function(a,b){Z.call(this,"mdhd",1,0);this.timescale=a;this.duration=b;this.language=21956},tS=function(a){Z.call(this,"hdlr",0,0);this.f=a},uS=function(){Z.call(this,"vmhd",0,1);this.f=new Uint8Array([0,0,0,0,0,0])},vS=function(a){iS.call(this,a);this.w=!0},wS=function(a){vS.call(this,a);this.height=this.width=0;this.depth=24},
|
|
6
|
+
xS=function(a,b,c,d){vS.call(this,a);this.channelCount=b;this.sampleSize=c;this.sampleRate=d},yS=function(a,b){wS.call(this,"avc1");this.width=a;this.height=b},zS=function(a,b){yS.call(this,a,b);this.type="encv"},AS=function(a,b,c){xS.call(this,"mp4a",a,b,c)},BS=function(a,b,c){AS.call(this,a,b,c);this.type="enca"},CS=function(a,b){iS.call(this,"avcC");this.gb=a;this.tc=b;this.version=1;this.f=this.gb[0][1];this.h=this.gb[0][2];this.level=this.gb[0][3]},DS=function(a){Z.call(this,"esds",0,0);this.oc=
|
|
7
|
+
a},ES=function(a){a=void 0===a?"":a;Z.call(this,"url ",0,1);this.location=a},FS=function(){Z.call(this,"dref",0,0)},GS=function(){iS.call(this,_.eg)},HS=function(){Z.call(this,_.gg,0,0)},IS=function(){Z.call(this,"stts",0,0)},JS=function(){Z.call(this,"stsc",0,0)},KS=function(){Z.call(this,"stco",0,0)},LS=function(){Z.call(this,"stsz",0,0)},MS=function(){Z.call(this,"smhd",0,0)},NS=function(){iS.call(this,"dinf")},OS=function(){iS.call(this,_.Me)},PS=function(){iS.call(this,_.Ie)},QS=function(a,b){Z.call(this,
|
|
8
|
+
"tfdt",a,0);this.baseMediaDecodeTime=b},RS=function(){Z.call(this,"mfhd",0,0);this.f=0},SS=function(a,b){Z.call(this,"trun",a,b);this.l=this.j=this.f=0;this.o=[];this.sampleSize=[];this.A=[];this.h=[]},TS=function(a,b){Z.call(this,"tfhd",a,b);this.f=255;this.l=this.o=this.j=this.A=this.h=0},US=function(){iS.call(this,"traf")},VS=function(){iS.call(this,"moof")},WS=function(){iS.call(this,_.He);this.f=new Uint8Array(0)},XS=function(){Z.call(this,"tenc",0,0);this.f=1;this.h=8;this.l="";this.j=[]},YS=
|
|
9
|
+
function(a,b){Z.call(this,"schm",0,0);this.f=a;this.h=b;this.jc=""},ZS=function(a){iS.call(this,"frma");this.f=a},$S=function(){Z.call(this,"saio",0,0);this.offset=[0]},aT=function(a,b,c){Z.call(this,"saiz",0,0);this.f=a;this.j=b;this.h=c},bT=function(a,b){Z.call(this,"senc",a,b);this.h=0;this.j=8;this.f=[]},cT=function(a){var b=a.split("/");return b[b.length-1].toLowerCase().match("manifest(\\(.+\\))?")?a:a+"/Manifest"},dT=function(a,b,c,d){c=b.Zh[c];b=b.Po;a=a.replace("Manifest","");b=b.replace("{bitrate}",
|
|
10
|
+
String(d.bitrate)).replace("{Bitrate}",String(d.bitrate)).replace("{start time}",String(c.t)).replace("{start_time}",String(c.t));return _.ND([a],[b])[0]},eT=function(a,b){if(a.type!==b.type)return!1;var c=[];a.type===_.Jg?c=["maxWidth","maxHeight","bitrate",aS,"fourCC"]:a.type===_.Pc&&(c=["bitrate",aS,"channels","bitsPerSample","samplingRate","fourCC"]);return _.L.ra(a,b,c,["id","segmentIndex"])},fT=function(a,b,c){var d=c.af.split("00000001");a={id:1,type:c.type,duration:a/b,timescale:b,gb:null,
|
|
11
|
+
tc:null,width:NaN,height:NaN,oc:null,Ee:NaN,sampleSize:NaN,channelCount:NaN};switch(c.type){case _.Jg:a.gb=[_.Rm(d[1])];a.tc=[_.Rm(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.Pc:a.oc=_.Rm(c.af),a.sampleSize=c.Rj||16,a.Ee=c.Ee,a.channelCount=c.xh}return a},gT=function(a,b){return a.filter(function(c){return c.type===b})},hT=function(a,b){var c=a.exec(b);return null==c||""===c[0]?null:(Number(c[4])||0)/1E3+(Number(c[3])||0)+60*(Number(c[2])||0)+3600*(Number(c[1])||0)},oT=function(a,
|
|
12
|
+
b,c){var d=null;if(iT.test(a)){a=iT.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 jT.test(a)?d=hT(jT,a):kT.test(a)?d=hT(kT,a):lT.test(a)?(a=lT.exec(a),d=Number(a[1])/c.frameRate):mT.test(a)?(a=mT.exec(a),d=Number(a[1])/c.a):nT.test(a)&&(d=hT(nT,a));d+=b;b=Math.floor(d/3600);c=Math.floor((d-3600*b)/60);a=Math.floor(d-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*
|
|
13
|
+
d);return b+":"+c+":"+a+"."+d},pT=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))},rT=function(a){this.a=a;this.f=qT(this)},qT=function(a){for(var b=0,c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.en(b)},sT=function(a,b,c){a:{var d=_.v([_.Gd,_.Ed]);for(var e=d.next();!e.done;e=d.next())if((e=c.gf(e.value))&&e.keyId){d=e.keyId;break a}_.Kh($R,
|
|
14
|
+
"Could not get default Key ID for DRM init data!");d=null}c=new iS("xxxx");a.type===_.Jg?c=new zS(a.width,a.height):c=new BS(a.channelCount,a.sampleSize,a.Ee);a=new XS;a.f=1;a.h=8;a.l=d||"00000000000000000000000000000000";a=(new iS("schi")).append([a]);b=(new iS(_.Zf)).append([new ZS(b),new YS(_.hd,65536),a]);c.append([b]);return c},tT=function(a,b){var c=b.kf(),d=new oS(a.timescale,a.duration,a.id),e=(new pS).append([new qS(a.id)]),f=new rS(a.id,a.duration,a.timescale,a.width,a.height),g=new sS(a.timescale,
|
|
15
|
+
a.duration),h=new tS(a.type),l=null,m=new FS;m.entries=[new ES];var n=new HS;switch(a.type){case _.Jg:var p=new CS(a.gb,a.tc);c?(l=sT(a,"avc1",b),l.append([p]),n.entries=[l]):(l=(new yS(a.width,a.height)).append([p]),n.entries=[l]);l=new uS;break;case _.Pc:p=new DS(a.oc),c?(l=sT(a,"mp4a",b),l.append([p]),n.entries=[l]):(l=(new AS(a.channelCount,a.sampleSize,a.Ee)).append([p]),n.entries=[l]),l=new MS}n=(new GS).append([n,new IS,new JS,new LS,new KS]);m=(new NS).append([m]);m=(new OS).append([l,m,n]);
|
|
16
|
+
g=(new PS).append([g,h,m]);f=(new nS).append([f,g]);d=(new mS).append([d,f,e]);e=new lS("dash",0,["iso6","mp41","avc1"]);c&&(c=b.gf(_.Ed),f=b.gf(_.Gd),c&&d.append([new jS("pssh",c.initData,8)]),f&&d.append([new jS("pssh",f.initData,8)]),c||f||_.Kh($R,"Could not get PSSH init data!"));c=new rT([e,d]);return _.Oj(c.write())},vT=function(a,b){var c,d,e,f,g,h;(new _.sn).M("moof",_.tn).aa("mfhd",function(m){var n=new RS;n.f=_.nn(m.reader);c=n}).M("traf",_.tn).aa("tfhd",function(m){var n=m.reader.Va();
|
|
17
|
+
if(null===m.flags)throw new _.N(_.O,3,3019,ZR);var p=new TS(m.version||0,m.flags||0);p.f=_.nn(m.reader);0<n-m.reader.getPosition()&&m.flags&1&&(p.h=_.pn(m.reader));0<n-m.reader.getPosition()&&m.flags&2&&(p.A=_.nn(m.reader));0<n-m.reader.getPosition()&&m.flags&8&&(p.j=_.nn(m.reader));0<n-m.reader.getPosition()&&m.flags&16&&(p.o=_.nn(m.reader));0<n-m.reader.getPosition()&&m.flags&32&&(p.l=_.nn(m.reader));d=p}).aa("trun",function(m){var n=m.reader.Va();if(null===m.flags)throw new _.N(_.O,3,3019,ZR);
|
|
18
|
+
var p=new SS(m.version||0,m.flags||0);p.f=_.nn(m.reader);0<n-m.reader.getPosition()&&m.flags&1&&(p.j=_.on(m.reader));0<n-m.reader.getPosition()&&m.flags&4&&(p.l=_.nn(m.reader));if(0<n-m.reader.getPosition())for(n=0;n<p.f;n++)m.flags&256&&p.o.push(_.nn(m.reader)),m.flags&512&&p.sampleSize.push(_.nn(m.reader)),m.flags&1024&&p.A.push(_.nn(m.reader)),m.flags&2048&&(0===m.version?p.h.push(_.nn(m.reader)):p.h.push(_.on(m.reader)));e=p}).aa("sdtp",function(m){var n=_.rn(m.reader,m.reader.Va());f=new kS("sdtp",
|
|
19
|
+
m.version||0,m.flags||0,n,0)}).M("uuid",function(m){var n=_.rn(m.reader,16);if(_.Tm(n,uT)){n=_.nn(m.reader);m.version=n>>>24;m.flags=n&16777215;n=new bT(m.version,m.flags);n.h=_.nn(m.reader);m.flags&1&&(n.j=_.ln(m.reader));for(var p=0;p<n.h;p++){var q={ri:_.rn(m.reader,8),Gd:0,Tg:[]};if(m.flags&2){q.Gd=_.mn(m.reader);for(var t=0;t<q.Gd;t++){var u={th:0,uh:0};u.th=_.mn(m.reader);u.uh=_.nn(m.reader);q.Tg.push(u)}}n.f.push(q)}g=n}}).M(_.He,function(m){var n=new WS;0<m.reader.Va()?n.f=_.rn(m.reader,m.reader.Va()):
|
|
20
|
+
(_.Kh($R,"mdat box is empty!"),n.f=new Uint8Array(0));h=n}).parse(a,!1);if(!h)return null;var l=(new US).append([d,e]);f&&l.append([f]);b.kf()&&g&&l.append([g]);l=(new VS).append([c,l]);return new rT([l,h])},wT=function(a,b,c,d){var e=d.kf(),f=parseInt(c*b,10);b=a.data||new ArrayBuffer(0);var g=vT(b,d);if(null===g)return a.request.contentType===_.qj?a.data:g;d=g.get(_.He);if(a.request.contentType===_.qj){e=d.f.buffer;if(c){e=_.Q.ee(e);if((e=(new DOMParser).parseFromString(e,_.mg))&&"tt"===e.documentElement.tagName.toLowerCase())var h=
|
|
21
|
+
e.documentElement;if(h&&(d=new pT(h.getAttribute("ttp:frameRate"),h.getAttribute("ttp:subFrameRate"),h.getAttribute("ttp:frameRateMultiplier"),h.getAttribute("ttp:tickRate")),h=h.getElementsByTagName("body")[0]))for(h=h.getElementsByTagName("p"),a=0,b=h.length;a<b;a++){f=h[a];g=c;for(var l=["begin",_.ge],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=p.getAttribute(q);else{q=p.attributes;for(var y=q.length;u<y;u++){var A=q[u].name;if(A=A.match(t)){p=
|
|
22
|
+
p.getAttribute(A[0]);break b}}p=null}}f.setAttribute(l[m],oT(p||"",g,d))}}e=(new XMLSerializer).serializeToString(e);c=_.Q.hb(e).buffer}else c=e;return c}h=new VS;a=g.get("mfhd");b=new US;l=g.get("tfhd");m=new QS(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+6*c.f[m].Gd);else g=8;b.append([c,new $S,new aT(g,l,c.h)])}h.append([a,b]);f.flags|=1;f.j=h.a()+8;d=
|
|
23
|
+
new rT([h,d]);h=d.write();e&&(e=d.get("saio"),d=d.f,e.offset[0]=c.start+16,d.seek(e.start),e.write(d),h=d.buffer);return h},xT=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,periodId:null}},yT=function(a,b,c){a=_.ap(a);c&&a.version!==c&&(a=_.CD(a,c));return{initData:_.AD(a),initDataType:_.hd,keyId:b,periodId:null}},AT=function(){this.A=this.j=this.f=
|
|
24
|
+
this.C=null;this.h=1;this.P=0;this.o="";this.F=this.a=null;this.g=new _.J("clpp.smooth.SmoothParser");this.K=!1;this.l=this.B=null;this.N=zT;this.I=0;this.G=this.J=Infinity;this.w=[];this.L=this.ko.bind(this);this.H=new Map},BT=function(a,b){var c,d,e;return _.H(function(f){if(1==f.a)return c=_.ik(b),c.timeout=a.f.attemptParameters.timeout,c.maxAttempts=Math.max(a.f.attemptParameters.maxAttempts,b.length),c.baseDelay=a.f.attemptParameters.baseDelay,c.backoffFactor=a.f.attemptParameters.backoffFactor,
|
|
25
|
+
c.fuzzFactor=a.f.attemptParameters.fuzzFactor,c.type=1,d=a.C.networkingEngine.fetch(c),_.x(f,d.T,2);e=f.f;a.o=e.uri;return f["return"](e)})},IT=function(a,b){var c=_.Wo,d=null;try{var e=_.Q.ee(b);d=c.Be(e,_.Lb)}catch(SY){}if(!d)throw a.g.error("Unable to parse manifest"),new _.N(_.O,4,4033,a.o);var f=+CT(a,d,"MajorVersion"),g=+CT(a,d,"MinorVersion"),h=+d.getAttribute("TimeScale")||1E7,l=+CT(a,d,"Duration"),m="TRUE"===d.getAttribute("IsLive"),n=+d.getAttribute("LookAheadCount"),p=+d.getAttribute("DVRWindowLength")||
|
|
26
|
+
Infinity,q=c.$(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 _.N(_.O,4,4036,a.o);m?(DT(a,ET),a.B=typeof a.f.liveRefreshPeriod===_.k?1E3*a.f.liveRefreshPeriod:Math.min(1E3*a.I,1E4),l=Infinity):DT(a,zT);a.a={startTime:0,delay:0,duration:l/h,hg:p/h,we:0};if(q){var t=a.f.playreadyVersion,u=_.Wo,y=[],A=u.$(q,"ProtectionHeader")[0],B=_.Qm(u.sa(A)||""),E=_.ap(B).a;y.push(xT(_.Gd,{initData:_.AD(_.To(E)),initDataType:_.hd,
|
|
27
|
+
keyId:E,periodId:null},[E]));y.push(xT(_.Ed,yT(B,E,t),[E]));a.w=y}var C=[],G=_.Wo.$(d,"StreamIndex");if(!G.length)throw a.g.error("No streams found!"),new _.N(_.O,4,4034,a.o);for(var M=0;M<G.length;M++){for(var R,ka=a,U=G[M],ra=CT(ka,U,"Type"),Ba=+U.getAttribute("Chunks"),Ca=U.getAttribute("Subtype")||"",Da=U.getAttribute("Language")||_.xg,Na=_.Dj(Da),zb=U.getAttribute("Name")||"",pe=+U.getAttribute(_.fb),Df=+U.getAttribute(_.eb),Ig=CT(ka,U,"Url"),Ru=+U.getAttribute("TimeScale")||null,pd=[],Nn=_.Wo.$(U,
|
|
28
|
+
_.Ab),Gv=0;Gv<Nn.length;Gv++){var Ff=void 0,yc=void 0,Hv=void 0,Gf=ka,Qd=Nn[Gv],Iv=ra,vX=+Qd.getAttribute("Index"),wX=+CT(Gf,Qd,"Bitrate"),yJ=NaN,zJ=NaN,Ko=NaN,Jv=NaN,AJ=NaN,BJ=NaN,CJ=NaN,DJ=Qd.getAttribute("FourCC")||"";switch(Iv){case _.Jg:yJ=+CT(Gf,Qd,_.eb);zJ=+CT(Gf,Qd,_.fb);break;case _.Pc:Jv=+Qd.getAttribute("Channels")||2,Ko=+CT(Gf,Qd,"SamplingRate"),BJ=+CT(Gf,Qd,"AudioTag"),AJ=+CT(Gf,Qd,"BitsPerSample"),CJ=+CT(Gf,Qd,"PacketSize")}var Kv=String(Qd.getAttribute("CodecPrivateData"));if(Iv===
|
|
29
|
+
_.Pc&&!Kv){var EJ=Jv,FJ={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},Lo=FJ[Ko];if("AACH"===DJ){yc=new Uint8Array(4);var GJ=FJ[2*Ko];yc[0]=40|Lo>>1;yc[1]=Lo<<7|EJ<<3|GJ>>1;yc[2]=GJ<<7|8;yc[3]=0;Ff=new Uint16Array(2);Ff[0]=(yc[0]<<8)+yc[1];Ff[1]=(yc[2]<<8)+yc[3];Hv=Ff[0].toString(16)+Ff[1].toString(16)}else yc=new Uint8Array(2),yc[0]=16|Lo>>1,yc[1]=Lo<<7|EJ<<3,Ff=new Uint16Array(1),Ff[0]=(yc[0]<<8)+yc[1],Hv=Ff[0].toString(16);Kv=Hv.toUpperCase()}var xX=
|
|
30
|
+
{id:Gf.P++,type:Iv,index:vX,bitrate:wX,af:Kv,maxHeight:yJ,maxWidth:zJ,Ee:Ko,xh:Jv,gp:BJ,Rj:AJ,xp:CJ,Nl:DJ,segmentIndex:null};pd.push(xX)}R=pd;for(var Oe=[],HJ=_.Wo.$(U,"c"),Ck=0;Ck<HJ.length;Ck++){var Lv=HJ[Ck],qe=parseInt(Lv.getAttribute("t"),10),ji=parseInt(Lv.getAttribute("d"),10),Mv=parseInt(Lv.getAttribute("r"),10),Dk=0;if(isNaN(qe)&&isNaN(ji))throw ka.g.error("Either one or both FragmentDuration and FragmentTime field MUST be present in StreamFragmentElement"),new _.N(_.O,4,4037,ka.o);0===Ck&&
|
|
31
|
+
isNaN(qe)&&(Dk=qe=0);if(0<Ck){var Lg=Oe[Oe.length-1];Dk=Lg.n+1;Lg.d||(Lg.d=qe-Lg.t);qe||(qe=Lg.t+Lg.d);ji||(ji=qe-Lg.t)}Oe.push({n:Dk,d:ji,t:qe});if(Mv){Mv--;for(var IJ=0;IJ<Mv;IJ++){var Mo=Oe[Oe.length-1];Dk=Mo.n+1;qe=Mo.t+Mo.d;ji=Mo.d;Oe.push({n:Dk,d:ji,t:qe})}}}ka.Wd()||Oe.length===Ba||ka.g.warn("Number of fragments ("+Ba+") differs from number of chunks ("+Oe.length+").");C.push({type:ra,lp:Ba,Ao:Ca,language:Na,Bd:Da,name:zb,maxWidth:pe,maxHeight:Df,Po:Ig,tracks:R,Zh:Oe,timescale:Ru})}var Hf=
|
|
32
|
+
{vp:f,Gi:g,timescale:h,duration:l,isLive:m,up:n,hg:p,og:!1,streams:C};if(a.j&&a.A)return FT(a,Hf),Promise.resolve();a.H.clear();var Nv=Hf.timescale,No=Hf.duration,zX=gT(Hf.streams,_.Pc),AX=gT(Hf.streams,_.Jg),BX=gT(Hf.streams,_.qj),JJ=[],Oo=GT(a,No,Nv,zX),Po=GT(a,No,Nv,AX),CX=GT(a,No,Nv,BX);Oo.length||(Oo=[null]);Po.length||(Po=[null]);for(var Pv=0;Pv<Po.length;Pv++)for(var Qv=0;Qv<Oo.length;Qv++)JJ.push(HT(a,Po[Pv],Oo[Qv]));var KJ={id:"ID",configurationId:void 0,startTime:0,endTime:No,variants:JJ,
|
|
33
|
+
textStreams:CX,thumbStreams:[]};var EX=Hf.streams,Rv=a.a.startTime,LJ=a.a.delay,Sv=a.J,MJ=Math.min(a.a.duration||Infinity,Sv),Tv=a.Wd(),FX=a.a.hg,GX=a.a.we,NJ=a.I,OJ=isFinite(a.G)?a.G:0;if(Tv)MJ=Infinity,Rv=Date.now()/1E3-GX,a.a.startTime=Rv,LJ=3*NJ;else for(var HX=isFinite(Sv)?Sv:a.a.duration,PJ=_.v(EX),Uv=PJ.next();!Uv.done;Uv=PJ.next())for(var QJ=_.v(Uv.value.tracks),Vv=QJ.next();!Vv.done;Vv=QJ.next()){var RJ=Vv.value;RJ.segmentIndex.offset(-OJ);_.pE(RJ.segmentIndex,HX)}var SJ=a.f.timeline||{};
|
|
34
|
+
SJ.type=void 0;a.F=new _.xE(SJ,Rv,LJ,!Tv,!0);a.F.f=MJ;_.FE(a.F,NJ);a.F.A=FX;Tv||a.F.offset(-OJ);a.C.filterAllPeriods([KJ]);a.j={presentationTimeline:a.F,periods:[KJ],minBufferTime:0,cues:[]};Promise.resolve();a.K||(a.C.networkingEngine.gd(a.L),a.K=!0);a.A=Hf;return Promise.resolve()},FT=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={nc:e.nc},g=f.next())if(e.nc=g.value,g=d.tracks.find(function(l){return function(m){return m.type===
|
|
35
|
+
l.nc.type&&m.bitrate===l.nc.bitrate}}(e))){eT(e.nc,g)||a.g.warn("The current stream is updated with a stream that seems to have different base properties!");var h=JT(a,a.A.timescale,d,g);g=e.nc.segmentIndex;g.ua(h);(h=a.a.hg)&&_.VE(g,_.UE(g)-h).forEach(function(l){l.La().forEach(function(m){a.H["delete"](m)})})}else a.g.warn("Cannot find satisfying update for "+e.nc.type+" track with bitrate "+(e.nc.bitrate+". Skipping update."))},GT=function(a,b,c,d){for(var e=[],f={$c:0};f.$c<d.length;f={$c:f.$c},
|
|
36
|
+
f.$c++){var g=d[f.$c].tracks.map(function(h){return function(l){var m=d[h.$c],n=JT(a,c,m,l);n=new _.TE(n);var p=null;m.type!==_.qj&&(p=KT(a,b,c,m,l));l.segmentIndex=n;var q=_.qL++,t=Promise.resolve.bind(Promise),u=n.nd.bind(n),y=n.get.bind(n),A=n.Pd.bind(n),B=n.getDuration.bind(n),E=LT[m.type],C="";switch(m.type){case _.Jg:C=l.af;var G=/00000001[0-9]7/.exec(C);C="avc1."+(G&&G[0]?C.substr(C.indexOf(G[0])+10,6):"42c00c");a.g.debug("VIDEO CODECS: ",C);break;case _.Pc:C=l.af,G=2,"AACH"===l.Nl?G=5:C&&
|
|
37
|
+
(G=(parseInt(C.substr(0,2),16)&248)>>3),C="mp4a.40."+G,a.g.debug("AUDIO CODECS: ",C)}G=m.type===_.qj?MT[m.Ao]:void 0;return{id:q,originalId:null,Ap:null,createSegmentIndex:t,findSegmentPosition:u,getSegmentReference:y,adjustSegmentDurations:A,getDuration:B,segmentIndex:n,segmentLookupStrategy:_.kD,initSegmentReference:p,mimeType:E,codecs:C,frameRate:void 0,bandwidth:l.bitrate,width:l.maxWidth||void 0,height:l.maxHeight||void 0,kind:G,encrypted:a.rg(),keyId:null,language:m.language,originalLanguage:m.Bd,
|
|
38
|
+
label:m.name,type:m.type,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:l.xh||null,spatialAudio:!1,closedCaptions:null}}}(f));e=e.concat(g)}return e},JT=function(a,b,c,d){var e=0,f=[],g=c.timescale||b;c.Zh.forEach(function(h,l){var m=h.d/g;if(0===l){var n=h.t/g;a.G=Math.min(a.G,n)}else n=f[l-1].endTime;var p=n+m,q=dT(a.o,c,l,d);a.I=Math.max(a.I,m);f.push(new _.Aj(l,n,p,function(){return[q]},0,null,0,null,!0,g));a.H.set(q,n);e+=m});if(c.type===_.Jg||c.type===_.Pc)b=f[f.length-
|
|
39
|
+
1],a.J=Math.min(a.J,e),0===a.a.we?a.a.we=b.endTime:a.a.we=Math.min(a.a.we,b.endTime);return f},KT=function(a,b,c,d,e){b=fT(b,d.timescale||c,e);c={isLive:a.Wd.bind(a),kf:a.rg.bind(a),Wl:function(){return 1},gf:a.di.bind(a)};d=new Uint8Array(0);try{d=tT(b,c)}catch(g){throw a.g.error("Failed to generate initialization segment."),new _.N(_.O,3,4035,g);}var f="data:text/plain;base64,"+_.Pm(d);return new _.PD(function(){return[f]},0,null,null,!0)},HT=function(a,b,c){var d=(c?c.bandwidth:0)+(b?b.bandwidth:
|
|
40
|
+
0),e=c?c.language:_.xg;return c||b?{id:a.h++,language:e,primary:!1,audio:c,video:b,bandwidth:d,drmInfos:a.w,allowedByApplication:!0,allowedByKeySystem:!0}:null},CT=function(a,b,c){if(b=b.getAttribute(c))return b;a.g.error("required attribute not provided: "+c);throw new _.N(_.O,4,4038,a.o,c);},NT=function(a,b){null!=a.B&&null!=b&&(a.l=window.setTimeout(a.hc.bind(a),b))},DT=function(a,b){var c=b===zT;a.j&&a.j.presentationTimeline&&_.AE(a.j.presentationTimeline,c);c&&null!=a.l&&(window.clearTimeout(a.l),
|
|
41
|
+
a.l=null,a.B=null);a.N=b},OT=function(){};iS.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};iS.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
|
+
iS.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
|
+
iS.prototype.write=function(a){var b=Math.pow(2,32)-1;this.start=a.getPosition();this.size=this.a();this.size>b?_.V(a,1):_.V(a,this.size);_.gn(a,hS(this.type));this.size>b&&bS(a,this.size);"uuid"===this.type&&_.gn(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,iS);Z.prototype.a=function(){return 4+iS.prototype.a.call(this)};
|
|
44
|
+
Z.prototype.write=function(a){iS.prototype.write.call(this,a);cS(a,this.version);dS(a,this.flags)};_.w(jS,iS);jS.prototype.a=function(){return this.f.byteLength+iS.prototype.a.call(this)-this.offset};jS.prototype.write=function(a){iS.prototype.write.call(this,a);_.gn(a,this.f,this.offset);a.getPosition()};_.w(kS,Z);kS.prototype.a=function(){return this.f.byteLength+Z.prototype.a.call(this)-this.offset};kS.prototype.write=function(a){Z.prototype.write.call(this,a);_.gn(a,this.f,this.offset);a.getPosition()};
|
|
45
|
+
_.w(lS,iS);lS.prototype.a=function(){var a=this.h.length;a=a+4+this.f.join("").length;return a+iS.prototype.a.call(this)};lS.prototype.write=function(a){iS.prototype.write.call(this,a);_.gn(a,hS(this.h));_.V(a,this.Gi);_.gn(a,hS(this.f.join("")));a.getPosition()};_.w(mS,iS);_.w(nS,iS);_.w(oS,Z);oS.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
|
+
oS.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(bS(a,0),bS(a,0),_.V(a,this.timescale),bS(a,this.duration*this.timescale)):(_.V(a,0),_.V(a,0),_.V(a,this.timescale),_.V(a,this.duration*this.timescale));_.V(a,65536);eS(a,this.volume);eS(a,0);_.V(a,0);_.V(a,0);for(var b=0;b<this.f.length;b++)cS(a,this.f[b]);_.V(a,0);_.V(a,0);_.V(a,0);_.V(a,0);_.V(a,0);_.V(a,0);_.V(a,this.h);a.getPosition()};_.w(pS,iS);_.w(qS,Z);qS.prototype.a=function(){return 20+Z.prototype.a.call(this)};
|
|
47
|
+
qS.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.f);_.V(a,1);_.V(a,0);_.V(a,0);_.V(a,0);a.getPosition()};_.w(rS,Z);rS.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
|
+
rS.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(bS(a,0),bS(a,0),_.V(a,this.h),_.V(a,0),bS(a,this.duration*this.timescale)):(_.V(a,0),_.V(a,0),_.V(a,this.h),_.V(a,0),_.V(a,this.duration*this.timescale));_.V(a,0);_.V(a,0);eS(a,0);eS(a,0);eS(a,this.volume);eS(a,0);for(var b=0;b<this.f.length;b++)cS(a,this.f[b]);eS(a,this.width);eS(a,0);eS(a,this.height);eS(a,0);a.getPosition()};_.w(sS,Z);sS.prototype.a=function(){var a=0;a=1===this.version?a+28:a+16;return a+4+Z.prototype.a.call(this)};
|
|
49
|
+
sS.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(bS(a,0),bS(a,0),_.V(a,this.timescale),bS(a,this.duration*this.timescale)):(_.V(a,0),_.V(a,0),_.V(a,this.timescale),_.V(a,this.duration*this.timescale));eS(a,this.language);eS(a,0);a.getPosition()};_.w(tS,Z);tS.prototype.a=function(){return 33+Z.prototype.a.call(this)};
|
|
50
|
+
tS.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,0);this.f===_.Jg?_.gn(a,hS("vide")):_.gn(a,hS("soun"));_.V(a,0);_.V(a,0);_.V(a,0);this.f===_.Jg?_.gn(a,hS("VideoHandler\x00")):_.gn(a,hS("SoundHandler\x00"));a.getPosition()};_.w(uS,Z);uS.prototype.a=function(){return 2+this.f.byteLength+Z.prototype.a.call(this)};uS.prototype.write=function(a){Z.prototype.write.call(this,a);eS(a,0);_.gn(a,this.f);a.getPosition()};_.w(vS,iS);vS.prototype.a=function(){return 8+iS.prototype.a.call(this)};
|
|
51
|
+
vS.prototype.write=function(a){iS.prototype.write.call(this,a);_.V(a,0);eS(a,0);eS(a,1)};_.w(wS,vS);wS.prototype.a=function(){return 70+vS.prototype.a.call(this)};wS.prototype.write=function(a){vS.prototype.write.call(this,a);eS(a,0);eS(a,0);_.V(a,0);_.V(a,0);_.V(a,0);eS(a,this.width);eS(a,this.height);_.V(a,4718592);_.V(a,4718592);_.V(a,0);eS(a,1);cS(a,10);_.gn(a,hS("AVC Coding",31));eS(a,this.depth);gS(a,-1)};_.w(xS,vS);xS.prototype.a=function(){return 20+vS.prototype.a.call(this)};
|
|
52
|
+
xS.prototype.write=function(a){vS.prototype.write.call(this,a);_.V(a,0);_.V(a,0);eS(a,this.channelCount);eS(a,this.sampleSize);gS(a,0);eS(a,0);eS(a,this.sampleRate);eS(a,0)};_.w(yS,wS);yS.prototype.write=function(a){wS.prototype.write.call(this,a);for(var b=0;b<this.children.length;b++)this.children[b].write(a);a.getPosition()};_.w(zS,yS);_.w(AS,xS);AS.prototype.write=function(a){xS.prototype.write.call(this,a);for(var b=0;b<this.children.length;b++)this.children[b].write(a);a.getPosition()};
|
|
53
|
+
_.w(BS,AS);_.w(CS,iS);CS.prototype.a=function(){for(var a=7,b=0;b<this.gb.length;b++)a+=2,a+=this.gb[b].byteLength;for(b=0;b<this.gb.length;b++)a+=2,a+=this.tc[b].byteLength;return a+iS.prototype.a.call(this)};
|
|
54
|
+
CS.prototype.write=function(a){iS.prototype.write.call(this,a);cS(a,this.version);cS(a,this.f);cS(a,this.h);cS(a,this.level);cS(a,255);cS(a,224|this.gb.length);for(var b=0;b<this.gb.length;b++)eS(a,this.gb[b].length),_.gn(a,this.gb[b]);cS(a,this.tc.length);for(b=0;b<this.tc.length;b++)eS(a,this.tc[b].length),_.gn(a,this.tc[b]);a.getPosition()};_.w(DS,Z);DS.prototype.a=function(){return 22+(this.oc.byteLength+3)+Z.prototype.a.call(this)};
|
|
55
|
+
DS.prototype.write=function(a){Z.prototype.write.call(this,a);cS(a,3);cS(a,23+this.oc.byteLength);eS(a,1);cS(a,0);cS(a,4);cS(a,15+this.oc.byteLength);cS(a,64);cS(a,21);dS(a,0);_.V(a,0);_.V(a,0);cS(a,5);cS(a,this.oc.byteLength);_.gn(a,this.oc);_.gn(a,new Uint8Array([6,1,2]));a.getPosition()};_.w(ES,Z);ES.prototype.a=function(){return this.location.length+Z.prototype.a.call(this)};ES.prototype.write=function(a){Z.prototype.write.call(this,a);0<this.location.length&&_.gn(a,hS(this.location));a.getPosition()};
|
|
56
|
+
_.w(FS,Z);FS.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)};FS.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.w(GS,iS);_.w(HS,Z);HS.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
|
+
HS.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.w(IS,Z);IS.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)};IS.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.w(JS,Z);
|
|
58
|
+
JS.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)};JS.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.w(KS,Z);KS.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
|
+
KS.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.w(LS,Z);LS.prototype.a=function(){return 8+Z.prototype.a.call(this)};LS.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,0);_.V(a,0);a.getPosition()};_.w(MS,Z);MS.prototype.a=function(){return 4+Z.prototype.a.call(this)};MS.prototype.write=function(a){Z.prototype.write.call(this,a);gS(a,0);eS(a,0);a.getPosition()};
|
|
60
|
+
_.w(NS,iS);_.w(OS,iS);_.w(PS,iS);_.w(QS,Z);QS.prototype.a=function(){var a=0;a=1===this.version?a+8:a+4;return a+Z.prototype.a.call(this)};QS.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?bS(a,this.baseMediaDecodeTime):_.V(a,this.baseMediaDecodeTime);a.getPosition()};_.w(RS,Z);RS.prototype.a=function(){return 4+Z.prototype.a.call(this)};RS.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.f);a.getPosition()};_.w(SS,Z);
|
|
61
|
+
SS.prototype.a=function(){var a=4;this.flags&PT&&(a+=4);this.flags&QT&&(a+=4);for(var b=0;b<this.f;b++)this.flags&RT&&(a+=4),this.flags&ST&&(a+=4),this.flags&TT&&(a+=4),this.flags&UT&&(a+=4);return a+Z.prototype.a.call(this)};
|
|
62
|
+
SS.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.f);this.flags&PT&&(a.getPosition(),fS(a,this.j));this.flags&QT&&_.V(a,this.l);for(var b=0;b<this.f;b++)this.flags&RT&&_.V(a,this.o[b]),this.flags&ST&&_.V(a,this.sampleSize[b]),this.flags&TT&&_.V(a,this.A[b]),this.flags&UT&&(0===this.version?_.V(a,this.h[b]):fS(a,this.h[b]));a.getPosition()};var PT=1,QT=4,RT=256,ST=512,TT=1024,UT=2048;_.w(TS,Z);
|
|
63
|
+
TS.prototype.a=function(){var a=4;this.flags&VT&&(a+=8);this.flags&WT&&(a+=4);this.flags&XT&&(a+=4);this.flags&YT&&(a+=4);this.flags&ZT&&(a+=4);return a+Z.prototype.a.call(this)};TS.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.f);this.flags&VT&&bS(a,this.h);this.flags&WT&&_.V(a,this.A);this.flags&XT&&_.V(a,this.j);this.flags&YT&&_.V(a,this.o);this.flags&ZT&&_.V(a,this.l);a.getPosition()};var VT=1,WT=2,XT=8,YT=16,ZT=32;_.w(US,iS);_.w(VS,iS);_.w(WS,iS);
|
|
64
|
+
WS.prototype.a=function(){return this.f.byteLength+iS.prototype.a.call(this)};WS.prototype.write=function(a){iS.prototype.write.call(this,a);0<this.f.byteLength&&_.gn(a,this.f)};_.w(XS,Z);XS.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)};
|
|
65
|
+
XS.prototype.write=function(a){Z.prototype.write.call(this,a);cS(a,0);0===this.version?cS(a,0):cS(a,0);cS(a,this.f);cS(a,this.h);_.gn(a,_.Rm(this.l));if(1===this.f&&0===this.h){cS(a,0);for(var b=0;b<this.j.length;b++)cS(a,this.j[b])}a.getPosition()};_.w(YS,Z);YS.prototype.a=function(){var a=8;this.flags&1&&(a+=hS(this.jc).byteLength);return a+Z.prototype.a.call(this)};YS.prototype.write=function(a){Z.prototype.write.call(this,a);_.gn(a,hS(this.f));_.V(a,this.h);this.flags&1&&_.gn(a,hS(this.jc));a.getPosition()};
|
|
66
|
+
_.w(ZS,iS);ZS.prototype.a=function(){return hS(this.f).byteLength+iS.prototype.a.call(this)};ZS.prototype.write=function(a){iS.prototype.write.call(this,a);_.gn(a,hS(this.f));a.getPosition()};_.w($S,Z);$S.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)};
|
|
67
|
+
$S.prototype.write=function(a){Z.prototype.write.call(this,a);this.flags&1&&(_.V(a,0),_.V(a,0));_.V(a,1);for(var b=0;1>b;b++)0===this.version?_.V(a,this.offset[b]):bS(a,this.offset[b]);a.getPosition()};_.w(aT,Z);aT.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)};
|
|
68
|
+
aT.prototype.write=function(a){Z.prototype.write.call(this,a);this.flags&1&&(_.V(a,0),_.V(a,0));cS(a,this.f);_.V(a,this.h);if(0===this.f)for(var b=0;b<this.h;b++)cS(a,this.j[b]);a.getPosition()};_.w(bT,Z);bT.prototype.a=function(){var a=4;this.flags&1&&(a+=1);for(var b=0;b<this.h;b++)if(a+=this.f[b].ri.byteLength,this.flags&2){a+=2;for(var c=0;c<this.f[b].Gd;c++)a+=2,a+=4}return a+Z.prototype.a.call(this)};
|
|
69
|
+
bT.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.h);this.flags&1&&cS(a,this.j);for(var b=0;b<this.h;b++)if(_.gn(a,this.f[b].ri),this.flags&2){eS(a,this.f[b].Gd);for(var c=0;c<this.f[b].Gd;c++)eS(a,this.f[b].Tg[c].th),_.V(a,this.f[b].Tg[c].uh)}a.getPosition()};var iT=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,jT=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,kT=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,lT=/^(\d*\.?\d*)f$/,mT=/^(\d*\.?\d*)t$/,nT=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/;rT.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};rT.prototype.write=function(){this.f=qT(this);for(var a=0;a<this.a.length;a++)this.a[a].write(this.f);return this.f.buffer};var uT=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);_.r=AT.prototype;_.r.configure=function(a){this.f=a};_.r.start=function(a,b){var c=this;this.C=b;var d=_.hh(new Set([a,cT(a)])).concat();return BT(this,d).then(function(e){return IT(c,e.data).then(function(){NT(c,c.B);return c.j})})};_.r.requestStop=function(){};_.r.stop=function(){this.C&&this.C.networkingEngine.Ce(this.L);this.B=this.A=this.j=this.f=this.C=null;this.l&&(clearTimeout(this.l),this.l=null);this.K=!1;this.J=this.G=Infinity;return Promise.resolve()};
|
|
70
|
+
_.r.update=function(){var a=this;if(this.Wd())return BT(this,[this.o]).then(function(b){return IT(a,b.data).then(function(){return a.j})})["catch"](function(b){if(a.C)a.C.onError(b)})};_.r.setCurrentVariant=function(){};_.r.hc=function(){var a=this;this.g.debug(_.bD);this.C&&(this.l=null,this.update().then(function(){NT(a,a.B)})["catch"](function(b){a.C&&(a.C.onError(b),1===b.severity&&NT(a,100))}))};_.r.Wd=function(){return this.N===ET};_.r.rg=function(){return 0<this.w.length};
|
|
71
|
+
_.r.di=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};
|
|
72
|
+
_.r.ko=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.Wd.bind(this),kf:this.rg.bind(this),Wl:function(){return 1},gf:this.di.bind(this)},d=!1,e=new _.N(_.O,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=wT(a,b,g,c)}catch(h){d=
|
|
73
|
+
!0,e.data=h,3E3===h.code&&(e.code=4039)}if(d||!f)return Promise.reject(e);a.data=f;return Promise.resolve(a)};_.r.loadVariant=function(a){return _.H(function(b){return b["return"](a)})};_.r.loadTextStream=function(a,b){var c=this,d,e;return _.H(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 _.$i(_.SC+a);return f["return"](d)})};var LT={video:_.Mg,audio:_.Tc,text:_.Mc},zT=_.Wb,ET="LIVE",MT={So:_.dd,Zo:_.ig};_.w(OT,_.Fu);OT.prototype.f=function(){_.hv.ism=AT;_.fv[_.Nc]=AT};OT.prototype.a=function(){_.wF("ism");_.xF(_.Nc)};OT.prototype.id=function(){return _.$f};_.I("clpp.smooth.SmoothComponent",OT);};
|
|
74
74
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
75
75
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
76
76
|
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.
|
|
9
|
-
|
|
10
|
-
"Failed to load thumbnail.",g))};a.
|
|
11
|
-
|
|
12
|
-
new _.N(1,9,7100,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
d.substr(0,d.lastIndexOf("/"))+"/"+h);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();h=f.getSegmentReference(g);if(!h)return A.D(2);l=
|
|
23
|
-
t,
|
|
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 Wz="No thumbnail found for position: ",Xz="Position is out of range: ",Yz="Thumbnail URL is mandatory",Zz="Wrong gridSize format",$z="clpp.thumbnails",aA=function(){this.log=new _.J($z);this.player=null;this.a=[];this.w=!1},cA=function(a,b){b.reduce(function(c,d){var e=d,f=!1;typeof d===_.Se&&(e=d.step,f=d.preloadWhileBuffering);return c.then(function(){return bA(a,0,e,!!f)})},Promise.resolve())},bA=function(a,b,c,d){if(a.w||b>=a.a.length)return Promise.resolve();var e=b+c;return dA(a,d).then(function(){return a.a[b].load()}).then(function(){return bA(a,
|
|
3
|
+
e,c,d)})},dA=function(a,b){return new Promise(function(c){if(b||a.player.getState()!==_.Bq)c();else a.player.one(_.$c,function(){c()})})},eA=function(a,b,c,d,e,f,g,h,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;h=void 0===h?1:h;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.wa=p;this.ql=h;this.no=l;this.km=m;this.lm=n;this.sg=null},fA=function(){aA.call(this);
|
|
4
|
+
this.f=null;this.o=this.h=1;this.j=0},gA=function(a,b){this.time=a;this.duration=0;this.offset=b;this.length=0;this.Cd=new _.qk},hA=function(){this.g=new _.J($z);this.f=new ArrayBuffer(0);this.a=[];this.h=new _.qk},iA=function(a){var b=a.f.byteLength;a.a.forEach(function(c){c.offset+c.length<b&&c.Cd.resolve()})},kA=function(a,b){return jA(a,b).then(function(c){return new eA(c,b.time,b.duration)})},jA=function(a,b){return b.load().then(function(){var c=_.Oj(a.f,b.offset,b.length);return"data:image/jpeg;base64,"+
|
|
5
|
+
_.Om(c)})},lA=function(){aA.call(this);this.f=null},mA=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},nA=function(){aA.apply(this,arguments)},oA=function(a,b){var c=a.horizontalTiles||b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{pe:c,dh:d,pi:e,durationPerTile:a.durationPerTile||b.durationPerTile||(a.endTime-a.startTime)/e}},pA=function(){this.g=new _.J($z);this.a=this.m=null},qA=function(a){return a.some(function(b){return 0<
|
|
6
|
+
b.thumbStreams.length})},vA=function(a){return a?a===rA||a===sA?new fA:a===tA?new lA:a===uA?new hA:null:null},wA=function(a){if(!a)return null;a=new _.Xj(a);return a.path.match(/.*\.vtt$/i)?tA:a.path.match(/.*\.bif$/i)?uA:a.path.match(/.*\.(png|jpg|jpeg)$/i)?rA:null},xA=function(){};aA.prototype.init=function(a,b){var c=this;this.player=a;a.one(_.Lf,function(){c.w=!0});a.isLive()||this.l().then(function(){b&&b.preload&&cA(c,b.preload)})};eA.prototype.raw=function(){return this.wa.cloneNode(!1)};
|
|
7
|
+
eA.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(_.Pd);e.style.width=c+_.If;e.style.height=d+_.If;e.style.backgroundColor="#000";e.style.backgroundRepeat="no-repeat";e.style.backgroundImage='url("'+this.src+'")';e.style.backgroundSize=Math.ceil(c/this.width*(this.wa.naturalWidth||this.wa.width))+"px "+Math.ceil(d/
|
|
8
|
+
this.height*(this.wa.naturalHeight||this.wa.height))+_.If;var f=this.y/this.height;e.style.backgroundPositionX="-"+this.x/this.width*c+_.If;e.style.backgroundPositionY="-"+f*d+_.If;return e};
|
|
9
|
+
eA.prototype.load=function(){var a=this;this.sg||(this.sg=new Promise(function(b,c){function d(){a.width||(a.width=(a.wa.naturalWidth||a.wa.width)/a.ql);a.height||(a.height=(a.wa.naturalHeight||a.wa.height)/a.no);a.x||(a.x=a.width*a.km);a.y||(a.y=a.height*a.lm)}if(a.wa.src&&a.wa.complete)d(),b(a);else{var e=null,f=function(){d();a.wa.removeEventListener(_.Ce,f);a.wa.removeEventListener(_.ie,e);b(a)};e=function(g){a.wa.removeEventListener(_.Ce,f);a.wa.removeEventListener(_.ie,e);c(new _.N(1,9,2014,
|
|
10
|
+
"Failed to load thumbnail.",g))};a.wa.addEventListener(_.Ce,f);a.wa.addEventListener(_.ie,e);a.wa.src=a.src}}));return this.sg};_.I("clpp.thumbnails.Thumbnail",eA);eA.prototype.load=eA.prototype.load;eA.prototype.element=eA.prototype.element;eA.prototype.raw=eA.prototype.raw;_.w(fA,aA);
|
|
11
|
+
fA.prototype.init=function(a,b){if(!b||!b.url)throw new _.N(1,9,7100,Yz);if("GRID"===b.mode&&!b.gridSize)throw new _.N(1,9,7100,"Grid size is mandatory for GRID mode");if(!b.duration)throw new _.N(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 _.N(1,9,7100,Zz);}catch(d){throw this.log.error("Error during parsing gridSize",d),
|
|
12
|
+
new _.N(1,9,7100,Zz);}aA.prototype.init.call(this,a,b)};fA.prototype.get=function(a){var b=this,c,d,e,f;return _.H(function(g){if(1==g.a){c=b.player.getDuration();if(0>a||a>c)throw new _.N(1,9,2014,Xz+a);d=b.f.duration;e=Math.floor(a/d);f=b.a[e];if(!f)throw new _.N(1,9,2014,"No thumbnail found for position "+a+" at index "+e);return _.x(g,f.load(),2)}return g["return"](f)})};
|
|
13
|
+
fA.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 eA(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()};gA.prototype.load=function(){return this.Cd};
|
|
14
|
+
hA.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.N(1,9,7100,Yz);var d=b.url,e=_.ik(d);e.type=_.hk;a.getNetworkEngine().fetch(e).T.then(function(f){f=f.data;var g=_.Oj(c.f);f=_.Oj(f);for(var h=g.byteLength+f.byteLength,l=new ArrayBuffer(h),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 "+(h+" bytes."));l=c.f;f=_.Oj(l);n=String.fromCharCode.apply(null,
|
|
15
|
+
yA);g=Array.prototype.slice.call(f,0,8);f=64;h=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;){h+=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 gA(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<h)throw Error("There was a problem during reading BIF entries");}else throw Error("The file is not a valid BIF format");
|
|
16
|
+
iA(c)})["catch"](function(f){c.g.error("[BIF] Error while loading thumbnails '\n + 'URL: "+d,f);a.onError(new _.N(1,9,2013,"Error while loading and parsing BIF thumbnails.",f))})};hA.prototype.get=function(a){var b=this,c,d;return _.H(function(e){switch(e.a){case 1:if(0>a)throw new _.N(1,9,2014,Xz+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 _.N(1,9,2014,Wz+a);return _.x(e,kA(b,c),3);case 3:return d=e.f,_.x(e,d.load(),4);case 4:return e["return"](d)}})};
|
|
17
|
+
hA.prototype.Jc=function(){return 0<this.a.length};var yA=[137,66,73,70,13,10,26,10];_.w(lA,aA);
|
|
18
|
+
lA.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.N(1,9,7100,Yz);var d=b.url,e=_.ik(d);e.type=_.hk;this.f=a.getNetworkEngine().fetch(e).T.then(function(f){f=f.data;if(!f)throw Error("No data in the response");f=_.Q.ea(f).split(/\n/);for(var g=0;g<f.length;g++){var h=f[g],l=h.split(" --\x3e ");if(2===l.length){h=f[++g];var m=h.indexOf("\x3d"),n=0>m?[]:h.substr(m+1).split(/,/).map(parseFloat);m=n[0];var p=n[1],q=n[2];n=n[3];var t=h.indexOf("#");h=0>t?h:h.substr(0,t);h.match(/^http|^\/\//)||(h=
|
|
19
|
+
d.substr(0,d.lastIndexOf("/"))+"/"+h);t=mA(l[0]);l=mA(l[1])-t;c.a.push(new eA(h,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 _.N(1,9,2013,"Error while loading VTT thumbnails.",f))});aA.prototype.init.call(this,a,b)};
|
|
20
|
+
lA.prototype.get=function(a){var b=this,c;return _.H(function(d){if(1==d.a){if(0>a)throw new _.N(1,9,2014,Xz+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 _.N(1,9,2014,Wz+a);return _.x(d,c.load(),3)}return d["return"](c)})};lA.prototype.l=function(){return this.f};_.w(nA,aA);
|
|
21
|
+
nA.prototype.get=function(a){function b(){return new _.N(1,9,2014,Wz+a)}var c=this,d,e,f,g,h,l,m,n,p,q,t,u,y;return _.H(function(A){if(1==A.a){if(0>a)throw c.log.error("Position must be greater than 0 but is "+a),new _.N(1,9,2014,Xz+a);d=c.player.getPeriods();for(var B=null,E=_.v(d),C=E.next();!C.done;C=E.next())C=C.value,C.startTime<=a&&(B=C);e=B;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();h=f.getSegmentReference(g);if(!h)return A.D(2);l=oA(h,f);m=Math.floor((a-h.startTime)/l.durationPerTile);0<c.a.length?(p=f.findSegmentPosition(0),null!==p&&(n=c.a[(g-p)*l.pi+m])):(q=h.La())&&0<q.length&&(u=t=0,y=h.startTime,1<l.pi&&(t=m%l.pe,u=Math.floor(m/l.pe),y+=m*l.durationPerTile),n=new eA(q[0],y,l.durationPerTile,void 0,void 0,void 0,void 0,l.pe,l.dh,
|
|
23
|
+
t,u));return n?_.x(A,n.load(),4):A.D(2)}if(2!=A.a)return A["return"](n);c.log.error("segment reference for specified segment index does not exist",g);throw b();})};nA.prototype.f=function(a,b){return void 0!==a.bandwidth&&void 0!==b.bandwidth?a.bandwidth-b.bandwidth:0};
|
|
24
|
+
nA.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&&!_.L.R(d=b.getSegmentReference(c++));)for(var e=oA(d,b),f=d.La()[0],g=new Image,h=d.startTime,l=0;l<e.dh;++l)for(var m=0;m<e.pe;++m)this.a.push(new eA(f,h,e.durationPerTile,void 0,void 0,void 0,void 0,e.pe,e.dh,m,l,g)),h+=e.durationPerTile;return Promise.resolve()};_.r=pA.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=wA(c.url||null));(this.a=vA(d))?(this.g.info("Loading thumbs configuration",c),this.m.one(_.Ee,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(qA(d)){this.a=new nA;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 _.N(1,9,2014,"Thumbnail format is not supported"))};_.r.id=function(){return"thumbnails"};_.I("clpp.thumbnails.ThumbnailsPlugin",pA);pA.prototype.get=pA.prototype.get;pA.Id="thumbnails";
|
|
27
|
+
xA.prototype.create=function(){return new pA};_.bu(new xA);var rA="SINGLE",sA="GRID",tA="WEBVTT",uA="BIF";};
|
|
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));}
|