@castlabs/prestoplay 6.30.0 → 6.31.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 +247 -179
- package/cjs/cl.adobe.js +3 -3
- package/cjs/cl.airplay.js +3 -3
- package/cjs/cl.broadpeak.js +19 -7
- package/cjs/cl.cast.js +120 -120
- package/cjs/cl.conviva.js +31 -31
- package/cjs/cl.core.js +567 -566
- package/cjs/cl.crypto.js +10 -10
- package/cjs/cl.dash.js +95 -92
- package/cjs/cl.externs.js +224 -40
- package/cjs/cl.freewheel.js +26 -25
- package/cjs/cl.hls.js +79 -78
- package/cjs/cl.hlssmpte.js +4 -4
- package/cjs/cl.htmlcue.js +19 -19
- package/cjs/cl.ima.js +26 -25
- package/cjs/cl.mediatailor.js +3 -3
- package/cjs/cl.mse.js +352 -350
- package/cjs/cl.muxdata.js +13 -13
- package/cjs/cl.onboard.js +2 -2
- package/cjs/cl.persistent.js +13 -13
- package/cjs/cl.playlist.js +6 -6
- package/cjs/cl.simid.js +10 -10
- package/cjs/cl.smooth.js +71 -71
- package/cjs/cl.thumbnails.js +16 -16
- package/cjs/cl.tizen.js +72 -72
- package/cjs/cl.ttml.js +15 -15
- package/cjs/cl.verimatrix.js +5 -5
- package/cjs/cl.vimond.js +11 -11
- package/cjs/cl.vr.js +12 -12
- package/cjs/cl.vtt.js +12 -12
- package/cjs/cl.yospace.js +4 -4
- package/cjs/cl.youbora.js +35 -35
- package/cl.adobe.js +3 -3
- package/cl.airplay.js +3 -3
- package/cl.broadpeak.js +14 -6
- package/cl.cast.js +99 -98
- package/cl.conviva.js +26 -26
- package/cl.core.js +413 -412
- package/cl.crypto.js +8 -8
- package/cl.dash.js +87 -84
- package/cl.externs.js +225 -37
- package/cl.freewheel.js +20 -19
- package/cl.hls.js +76 -76
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +26 -26
- package/cl.ima.js +20 -19
- package/cl.mediatailor.js +2 -2
- package/cl.mse.js +299 -300
- package/cl.muxdata.js +12 -12
- 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 +62 -60
- package/cl.thumbnails.js +17 -17
- package/cl.tizen.js +55 -55
- package/cl.ttml.js +22 -22
- package/cl.verimatrix.js +4 -4
- package/cl.vimond.js +8 -8
- package/cl.vr.js +15 -15
- package/cl.vtt.js +12 -12
- package/cl.yospace.js +3 -3
- package/cl.youbora.js +31 -31
- package/package.json +8 -7
- package/typings.d.ts +85 -61
package/cl.smooth.js
CHANGED
|
@@ -1,60 +1,62 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";import './cl.mse.js';let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
b,a.h),a.a+=2}catch(c){_.Qo()}},
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
a)
|
|
34
|
-
|
|
35
|
-
b
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
this.
|
|
40
|
-
0
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
a
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
a.
|
|
47
|
-
|
|
48
|
-
return a+super.a()}write(a){super.write(a);_.M(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
a
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
this.
|
|
58
|
-
0;
|
|
59
|
-
|
|
60
|
-
|
|
1
|
+
import {clpp} from "./cl.core.js";import './cl.mse.js';let g={};const _ = clpp._;var f=function(window){'use strict';var lQ="Full MP4 box must have flags defined",mQ="clpp.smooth.SmoothMP4Processor",nQ="codecPrivateData",oQ=function(a,b){const c=Math.floor(b/Math.pow(2,32));b-=c*Math.pow(2,32);_.M(a,c);_.M(a,b)},pQ=function(a,b){try{a.f.setUint8(a.a,b),a.a+=1}catch(c){_.Qo()}},qQ=function(a,b){pQ(a,b>>16&255);pQ(a,b>>8&255);pQ(a,b&255)},rQ=function(a,b){try{a.f.setUint16(a.a,b,a.h),a.a+=2}catch(c){_.Qo()}},sQ=function(a,b){try{a.f.setInt32(a.a,b,a.h),a.a+=4}catch(c){_.Qo()}},tQ=function(a,b){try{a.f.setInt16(a.a,
|
|
2
|
+
b,a.h),a.a+=2}catch(c){_.Qo()}},uQ=function(a,b){let c=[];const d=[];for(var e=0,f=0;e<a.a.length&&f<b.length;){var g=a.a[e];const h=b[f];g.startTime<h.startTime?(c.push(g),e++):(g.startTime>h.startTime?0===e?d.push(h):a.g.info("Refusing to rewrite original references on update!"):(.1<Math.abs(g.endTime-h.endTime)?c.push(new _.pI(g.position,h.startTime,h.endTime,h.Da,h.na,h.ja,h.Ja,h.keyInfo,h.Pc,h.timescale,h.horizontalTiles,h.verticalTiles,h.durationPerTile,null,null,h.Uc,h.Ga)):c.push(g),e++),
|
|
3
|
+
f++)}for(;e<a.a.length;)c.push(a.a[e++]);if(c.length)for(e=c[c.length-1].position+1;f<b.length;)g=b[f++],g=new _.pI(e++,g.startTime,g.endTime,g.Da,g.na,g.ja,g.Ja,g.keyInfo,g.Pc,g.timescale,g.horizontalTiles,g.verticalTiles,g.durationPerTile,null,null,g.Uc,g.Ga),c.push(g);else c=b;b=c;if(d.length&&c.length){b=[];f=c[0].position;e=d.length;for(const h of d)b.push(new _.pI(f-e--,h.startTime,h.endTime,h.Da,h.na,h.ja,h.Ja,h.keyInfo,h.Pc,h.timescale,h.horizontalTiles,h.verticalTiles,h.durationPerTile,null,
|
|
4
|
+
null,h.Uc,h.Ga));for(const h of c)b.push(h)}a.a=b},vQ=function(a,b){for(let c=0;c<a.a.length;++c)if(a.a[c].endTime>b)return a.a.splice(0,c);b=a.a;a.a=[];return b},wQ=function(a,b){if(void 0!==b){var c=new Uint8Array(b);const d=Math.min(a.length,b);let e=0;for(;e<d;++e)c[e]=a.charCodeAt(e);for(;e<b;e++)c[e]=0;return c}b=new Uint8Array(a.length);for(c=0;c<a.length;++c)b[c]=a.charCodeAt(c);return b},xQ=function(a){const b=a.split("/");return b[b.length-1].toLowerCase().match("manifest(\\(.+\\))?")?a:
|
|
5
|
+
`${a}/Manifest`},yQ=function(a,b,c,d){c=b.jg[c];b=b.ij;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 _.oB([a],[b])[0]},zQ=function(a,b){if(a.type!==b.type)return!1;let c=[];a.type===_.t?c=["maxWidth","maxHeight","bitrate",nQ,"fourCC"]:a.type===_.q&&(c=["bitrate",nQ,"channels","bitsPerSample","samplingRate","fourCC"]);return _.lh(a,b,c,["id","segmentIndex"])},
|
|
6
|
+
AQ=function(a,b,c){const d=c.de.split("00000001");a={id:1,type:c.type,duration:a/b,timescale:b,jb:null,jc:null,width:NaN,height:NaN,fc:null,Pd:NaN,sampleSize:NaN,channelCount:NaN};switch(c.type){case _.t:a.jb=[_.bm(d[1])];a.jc=[_.bm(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.q:a.fc=_.bm(c.de),a.sampleSize=c.wh||16,a.Pd=c.Pd,a.channelCount=c.$f}return a},BQ=function(a,b){return a.filter(c=>c.type===b)},CQ=function(a,b){a=a.exec(b);return null==a||""===a[0]?null:(Number(a[4])||0)/1E3+
|
|
7
|
+
(Number(a[3])||0)+60*(Number(a[2])||0)+3600*(Number(a[1])||0)},JQ=function(a,b,c){var d=null;if(DQ.test(a)){{a=DQ.exec(a);d=Number(a[1]);const e=Number(a[2]);let 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 EQ.test(a)?d=CQ(EQ,a):FQ.test(a)?d=CQ(FQ,a):GQ.test(a)?(a=GQ.exec(a),d=Number(a[1])/c.frameRate):HQ.test(a)?(a=HQ.exec(a),d=Number(a[1])/c.a):IQ.test(a)&&(d=CQ(IQ,a));c=d;d=c+b;b=Math.floor(d/3600);c=Math.floor((d-3600*b)/60);a=Math.floor(d-3600*
|
|
8
|
+
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},KQ=function(a){let b=0;for(let c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.kp(b)},RQ=function(a,b,c){a:{var d=[_.wd,_.ud];for(e of d)if((d=c.ke(e))&&d.keyId){var e=d.keyId;break a}_.C(mQ,"Could not get default Key ID for DRM init data!");e=null}c=new LQ("xxxx");a.type===_.t?c=new MQ(a.width,a.height):c=new NQ(a.channelCount,a.sampleSize,a.Pd);a=new OQ;a.f=1;a.h=8;a.l=e||"00000000000000000000000000000000";
|
|
9
|
+
a=(new LQ("schi")).append([a]);b=(new LQ(_.Mf)).append([new PQ(b),new QQ(_.Wc,65536),a]);c.append([b]);return c},tR=function(a,b){var c=b.le(),d=new SQ(a.timescale,a.duration,a.id),e=(new TQ).append([new UQ(a.id)]),f=new VQ(a.id,a.duration,a.timescale,a.width,a.height),g=new WQ(a.timescale,a.duration);const h=new XQ(a.type);var k=null,l=new YQ;l.entries=[new ZQ];var m=new $Q;switch(a.type){case _.t:k=new aR(a.jb,a.jc);c?(a=RQ(a,"avc1",b),a.append([k]),m.entries=[a]):(a=(new bR(a.width,a.height)).append([k]),
|
|
10
|
+
m.entries=[a]);k=new cR;break;case _.q:k=new dR(a.fc),c?(a=RQ(a,"mp4a",b),a.append([k]),m.entries=[a]):(a=(new eR(a.channelCount,a.sampleSize,a.Pd)).append([k]),m.entries=[a]),k=new fR}m=(new gR).append([m,new hR,new iR,new jR,new kR]);l=(new lR).append([l]);l=(new mR).append([k,l,m]);g=(new nR).append([g,h,l]);f=(new oR).append([f,g]);d=(new pR).append([d,f,e]);e=new qR("dash",0,["iso6","mp41","avc1"]);c&&(c=b.ke(_.ud),b=b.ke(_.wd),c&&d.append([new rR("pssh",c.initData,8)]),b&&d.append([new rR("pssh",
|
|
11
|
+
b.initData,8)]),c||b||_.C(mQ,"Could not get PSSH init data!"));b=new sR([e,d]);return _.G(b.write())},DR=function(a,b){let c,d,e,f,g,h;(new _.ip).O("moof",_.bp).fa("mfhd",k=>{{const l=new uR;l.f=_.N(k.reader);c=l}}).O("traf",_.bp).fa("tfhd",k=>{{const l=k.reader.Sa();if(null===k.flags)throw new _.I(_.D,3,3019,lQ);const m=new vR(k.version||0,k.flags||0);m.f=_.N(k.reader);0<l-k.reader.getPosition()&&k.flags&1&&(m.h=_.Xo(k.reader));0<l-k.reader.getPosition()&&k.flags&2&&(m.A=_.N(k.reader));0<l-k.reader.getPosition()&&
|
|
12
|
+
k.flags&8&&(m.j=_.N(k.reader));0<l-k.reader.getPosition()&&k.flags&16&&(m.o=_.N(k.reader));0<l-k.reader.getPosition()&&k.flags&32&&(m.l=_.N(k.reader));d=m}}).fa("trun",k=>{{var l=k.reader.Sa();if(null===k.flags)throw new _.I(_.D,3,3019,lQ);const m=new wR(k.version||0,k.flags||0);m.f=_.N(k.reader);0<l-k.reader.getPosition()&&k.flags&1&&(m.j=_.Wo(k.reader));0<l-k.reader.getPosition()&&k.flags&4&&(m.l=_.N(k.reader));if(0<l-k.reader.getPosition())for(l=0;l<m.f;l++)k.flags&256&&m.o.push(_.N(k.reader)),
|
|
13
|
+
k.flags&512&&m.sampleSize.push(_.N(k.reader)),k.flags&1024&&m.A.push(_.N(k.reader)),k.flags&2048&&(0===k.version?m.h.push(_.N(k.reader)):m.h.push(_.Wo(k.reader)));e=m}}).fa("sdtp",k=>{{const l=_.Zo(k.reader,k.reader.Sa());f=new xR("sdtp",k.version||0,k.flags||0,l,0)}}).O("uuid",k=>{var l=_.Zo(k.reader,16);if(_.dm(l,yR)){l=_.N(k.reader);k.version=l>>>24;k.flags=l&16777215;l=new zR(k.version,k.flags);l.h=_.N(k.reader);k.flags&1&&(l.j=_.Uo(k.reader));for(let m=0;m<l.h;m++){const n={vg:_.Zo(k.reader,
|
|
14
|
+
8),ld:0,yf:[]};if(k.flags&2){n.ld=_.Vo(k.reader);for(let p=0;p<n.ld;p++){const u={Wf:0,Xf:0};u.Wf=_.Vo(k.reader);u.Xf=_.N(k.reader);n.yf.push(u)}}l.f.push(n)}g=l}}).O(_.xe,k=>{{const l=new AR;0<k.reader.Sa()?l.f=_.Zo(k.reader,k.reader.Sa()):(_.C(mQ,"mdat box is empty!"),l.f=new Uint8Array(0));h=l}}).parse(a,!1);if(!h)return null;a=(new BR).append([d,e]);f&&a.append([f]);b.le()&&g&&a.append([g]);b=(new CR).append([c,a]);return new sR([b,h])},IR=function(a,b,c,d){var e=d.le(),f=parseInt(c*b,10);b=a.data||
|
|
15
|
+
new ArrayBuffer(0);var g=DR(b,d);if(null===g)return a.request.contentType===_.K?a.data:g;d=g.get(_.xe);if(a.request.contentType===_.K){e=d.f.buffer;if(c){e=_.qi(e);if((e=(new DOMParser).parseFromString(e,_.$f))&&"tt"===e.documentElement.tagName.toLowerCase())var h=e.documentElement;if(h&&(d=new ER(h.getAttribute("ttp:frameRate"),h.getAttribute("ttp:subFrameRate"),h.getAttribute("ttp:frameRateMultiplier"),h.getAttribute("ttp:tickRate")),h=h.getElementsByTagName("body")[0])){f=h.getElementsByTagName("p");
|
|
16
|
+
for(let u=0,v=f.length;u<v;u++){h=f[u];a=c;b=d;g=["begin",_.Vd];for(let y=0,A=g.length;y<A;y++){b:{var k=h;var l=g[y],m=new RegExp("\\w+:"+l),n=0;if(k.hasAttribute(l)){k=k.getAttribute(l);break b}l=k.attributes;const E=l.length;for(;n<E;n++){var p=l[n].name;if(p=p.match(m)){k=k.getAttribute(p[0]);break b}}k=null}h.setAttribute(g[y],JQ(k||"",a,b))}}}e=(new XMLSerializer).serializeToString(e);c=_.ri(e).buffer}else c=e;return c}h=new CR;a=g.get("mfhd");b=new BR;k=g.get("tfhd");m=new FR(1,f);f=g.get("trun");
|
|
17
|
+
n=g.get("sdtp");c=g.get("senc");k.f=1;k.flags&=16777214;k.flags|=131072;b.append([k,m,f]);n&&b.append([n]);if(e){g=0;k=[];if(c.flags&2)for(k=[],m=0;m<c.h;m++)k.push(10+6*c.f[m].ld);else g=8;b.append([c,new GR,new HR(g,k,c.h)])}h.append([a,b]);f.flags|=1;f.j=h.a()+8;d=new sR([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},JR=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,
|
|
18
|
+
audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,periodId:null}},KR=function(a){return{initData:_.bB(_.$p(a)),initDataType:_.Wc,keyId:a,periodId:null}},LR=function(a,b,c){a=_.hq(a);c&&a.version!==c&&(a=_.dB(a,c));return{initData:_.bB(a),initDataType:_.Wc,keyId:b,periodId:null}},MR=function(a,b){return _.w(function*(){var c=_.vk(b);c.timeout=a.f.attemptParameters.timeout;c.maxAttempts=Math.max(a.f.attemptParameters.maxAttempts,b.length);c.baseDelay=a.f.attemptParameters.baseDelay;
|
|
19
|
+
c.backoffFactor=a.f.attemptParameters.backoffFactor;c.fuzzFactor=a.f.attemptParameters.fuzzFactor;c.type=1;c=yield a.D.networkingEngine.fetch(c).V;a.o=c.uri;return c})},UR=function(a,b){const c=_.O;let d=null;try{const jb=_.qi(b);d=c.j(jb,_.sb)}catch(jb){}if(!d)throw a.g.error("Unable to parse manifest"),new _.I(_.D,4,4033,a.o);const e=+NR(a,d,"MajorVersion"),f=+NR(a,d,"MinorVersion"),g=+d.getAttribute("TimeScale")||1E7;let h=+NR(a,d,"Duration");const k="TRUE"===d.getAttribute("IsLive"),l=+d.getAttribute("LookAheadCount"),
|
|
20
|
+
m=+d.getAttribute("DVRWindowLength")||Infinity,n=c.a(d,"Protection")[0];if(!1===/^[2].[0-2]$/.test(""+e+"."+f))throw a.g.error("Smooth Streaming version must be 2.0, 2.1 or 2.2"),new _.I(_.D,4,4036,a.o);k?(OR(a,PR),a.B=typeof a.f.liveRefreshPeriod===_.r?1E3*a.f.liveRefreshPeriod:Math.min(1E3*a.I,1E4),h=Infinity):OR(a,QR);a.a={startTime:0,delay:0,duration:h/g,Ne:m/g,Gd:0};if(n){{var p=a.f.playreadyVersion;const jb=_.O,xa=[],wb=jb.a(n,"ProtectionHeader")[0],wc=_.am(jb.f(wb)||""),hc=_.hq(wc).a;xa.push(JR(_.wd,
|
|
21
|
+
KR(hc),[hc]));xa.push(JR(_.ud,LR(wc,hc,p),[hc]));var u=xa}a.w=u}{const jb=[],xa=_.O.a(d,"StreamIndex");if(!xa.length)throw a.g.error("No streams found!"),new _.I(_.D,4,4034,a.o);for(let wb=0;wb<xa.length;wb++){{var v=a,y=xa[wb];const wc=NR(v,y,"Type"),hc=+y.getAttribute("Chunks"),Gh=y.getAttribute("Subtype")||"",ue=y.getAttribute("Language")||_.kg,ve=_.Gn(ue),Hh=y.getAttribute("Name")||"",lf=+y.getAttribute(_.Qa),ng=+y.getAttribute(_.Pa),zs=NR(v,y,"Url"),Dm=+y.getAttribute("TimeScale")||null;{const dd=
|
|
22
|
+
[],pj=_.O.a(y,_.lb);for(let we=0;we<pj.length;we++){{let ed,Na,Od;var A=v,E=pj[we],B=wc;const qj=+E.getAttribute("Index"),og=+NR(A,E,"Bitrate");let xc=NaN,pg=NaN,Em=NaN,As=NaN,JF=NaN,KF=NaN,LF=NaN;const MF=E.getAttribute("FourCC")||"";switch(B){case _.t:xc=+NR(A,E,_.Pa);pg=+NR(A,E,_.Qa);break;case _.q:As=+E.getAttribute("Channels")||2,Em=+NR(A,E,"SamplingRate"),KF=+NR(A,E,"AudioTag"),JF=+NR(A,E,"BitsPerSample"),LF=+NR(A,E,"PacketSize")}let Bs=String(E.getAttribute("CodecPrivateData"));if(B===_.q&&
|
|
23
|
+
!Bs){{var F=As;const NF={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},Fm=NF[Em];if("AACH"===MF){Na=new Uint8Array(4);const OF=NF[2*Em];Na[0]=40|Fm>>1;Na[1]=Fm<<7|F<<3|OF>>1;Na[2]=OF<<7|8;Na[3]=0;ed=new Uint16Array(2);ed[0]=(Na[0]<<8)+Na[1];ed[1]=(Na[2]<<8)+Na[3];Od=ed[0].toString(16)+ed[1].toString(16)}else Na=new Uint8Array(2),Na[0]=16|Fm>>1,Na[1]=Fm<<7|F<<3,ed=new Uint16Array(1),ed[0]=(Na[0]<<8)+Na[1],Od=ed[0].toString(16);Bs=Od.toUpperCase()}}var ka=
|
|
24
|
+
{id:A.U++,type:B,index:qj,bitrate:og,de:Bs,maxHeight:xc,maxWidth:pg,Pd:Em,$f:As,oj:KF,wh:JF,Bj:LF,Oh:MF,segmentIndex:null}}dd.push(ka)}var Ya=dd}{const dd=[],pj=_.O.a(y,"c");for(let we=0;we<pj.length;we++){const ed=pj[we];let Na=parseInt(ed.getAttribute("t"),10),Od=parseInt(ed.getAttribute("d"),10),qj=parseInt(ed.getAttribute("r"),10),og=0;if(isNaN(Na)&&isNaN(Od))throw v.g.error("Either one or both FragmentDuration and FragmentTime field MUST be present in StreamFragmentElement"),new _.I(_.D,4,4037,
|
|
25
|
+
v.o);0===we&&isNaN(Na)&&(og=Na=0);if(0<we){const xc=dd[dd.length-1];og=xc.n+1;xc.d||(xc.d=Na-xc.t);Na||(Na=xc.t+xc.d);Od||(Od=Na-xc.t)}dd.push({n:og,d:Od,t:Na});if(qj){qj--;for(let xc=0;xc<qj;xc++){const pg=dd[dd.length-1];og=pg.n+1;Na=pg.t+pg.d;Od=pg.d;dd.push({n:og,d:Od,t:Na})}}}v.F()||dd.length===hc||v.g.warn("Number of fragments ("+hc+") differs from number of chunks ("+dd.length+").");var db=dd}var tc={type:wc,sj:hc,Wi:Gh,language:ve,bd:ue,name:Hh,maxWidth:lf,maxHeight:ng,ij:zs,tracks:Ya,jg:db,
|
|
26
|
+
timescale:Dm}}jb.push(tc)}var Ob=jb}const ec={Aj:e,Bg:f,timescale:g,duration:h,isLive:k,zj:l,Ne:m,Ue:!1,streams:Ob};if(a.j&&a.A)return RR(a,ec),Promise.resolve();a.H.clear();{const jb=ec.timescale,xa=ec.duration,wb=BQ(ec.streams,_.q),wc=BQ(ec.streams,_.t),hc=BQ(ec.streams,_.K),Gh=[];let ue=SR(a,xa,jb,wb),ve=SR(a,xa,jb,wc);const Hh=SR(a,xa,jb,hc);ue.length||(ue=[null]);ve.length||(ve=[null]);for(let lf=0;lf<ve.length;lf++)for(let ng=0;ng<ue.length;ng++)Gh.push(TR(a,ve[lf],ue[ng]));var fc={id:"ID",
|
|
27
|
+
configurationId:void 0,startTime:0,endTime:xa,variants:Gh,textStreams:Hh,thumbStreams:[]}}{var Hb=ec.streams;let jb=a.a.startTime,xa=a.a.delay;const wb=a.J;let wc=Math.min(a.a.duration||Infinity,wb);const hc=a.F(),Gh=a.a.Ne,ue=a.a.Gd,ve=a.I,Hh=isFinite(a.G)?a.G:0;if(hc)wc=Infinity,jb=Date.now()/1E3-ue,a.a.startTime=jb,xa=3*ve;else{const ng=isFinite(wb)?wb:a.a.duration;for(const zs of Hb)for(const Dm of zs.tracks)Dm.segmentIndex.offset(-Hh),_.TB(Dm.segmentIndex,ng)}const lf=a.f.timeline||{};lf.type=
|
|
28
|
+
void 0;a.C=new _.sI(lf,jb,xa,!hc,!0);a.C.f=wc;_.kC(a.C,ve);a.C.A=Gh;hc||a.C.offset(-Hh)}a.D.filterAllPeriods([fc]);a.j={presentationTimeline:a.C,periods:[fc],minBufferTime:0,cues:[]};Promise.resolve();a.L||(a.D.networkingEngine.md(a.M),a.L=!0);a.A=ec;return Promise.resolve()},VR=function(a,b){null!=a.B&&null!=b&&(a.l=window.setTimeout(a.Yb.bind(a),b))},NR=function(a,b,c){if(b=b.getAttribute(c))return b;a.g.error("required attribute not provided: "+c);throw new _.I(_.D,4,4038,a.o,c);},OR=function(a,
|
|
29
|
+
b){const c=b===QR;a.j&&a.j.presentationTimeline&&_.fC(a.j.presentationTimeline,c);c&&null!=a.l&&(window.clearTimeout(a.l),a.l=null,a.B=null);a.N=b},RR=function(a,b){for(let e=0;e<a.A.streams.length;e++){const f=b.streams[e];for(const g of a.A.streams[e].tracks){var c=f.tracks.find(h=>h.type===g.type&&h.bitrate===g.bitrate);if(c){zQ(g,c)||a.g.warn("The current stream is updated with a stream that seems to have different base properties!");var d=WR(a,a.A.timescale,f,c);c=g.segmentIndex;uQ(c,d);(d=a.a.Ne)&&
|
|
30
|
+
vQ(c,(c.a.length?c.a[c.a.length-1].endTime:0)-d).forEach(h=>{h.Da().forEach(k=>{a.H.delete(k)})})}else a.g.warn(`Cannot find satisfying update for ${g.type} `+`track with bitrate ${g.bitrate}. Skipping update.`)}}},WR=function(a,b,c,d){let e=0;const f=[],g=c.timescale||b;c.jg.forEach((h,k)=>{const l=h.d/g;0===k?(h=h.t/g,a.G=Math.min(a.G,h)):h=f[k-1].endTime;const m=h+l,n=yQ(a.o,c,k,d);a.I=Math.max(a.I,l);f.push(new _.pI(k,h,m,()=>[n],0,null,0,null,!0,g));a.H.set(n,h);e+=l});if(c.type===_.t||c.type===
|
|
31
|
+
_.q)b=f[f.length-1],a.J=Math.min(a.J,e),0===a.a.Gd?a.a.Gd=b.endTime:a.a.Gd=Math.min(a.a.Gd,b.endTime);return f},SR=function(a,b,c,d){let e=[];for(let f=0;f<d.length;f++){const g=d[f].tracks.map(h=>{{var k=d[f],l=WR(a,c,k,h);const F=new _.tI(l);var m=null;k.type!==_.K&&(m=YR(a,b,c,k,h));h.segmentIndex=F;l=_.nI++;var n=Promise.resolve.bind(Promise),p=F.f.bind(F),u=F.get.bind(F),v=F.h.bind(F),y=F.getDuration.bind(F),A=ZR[k.type];var E="";switch(k.type){case _.t:E=h.de;var B=/00000001[0-9]7/.exec(E);
|
|
32
|
+
E="avc1."+(B&&B[0]?E.substr(E.indexOf(B[0])+10,6):"42c00c");a.g.debug("VIDEO CODECS: ",E);break;case _.q:E=h.de,B=2,"AACH"===h.Oh?B=5:E&&(B=(parseInt(E.substr(0,2),16)&248)>>3),E="mp4a.40."+B,a.g.debug("AUDIO CODECS: ",E)}B=k.type===_.K?$R[k.Wi]:void 0;h={id:l,originalId:null,Ej:null,createSegmentIndex:n,findSegmentPosition:p,getSegmentReference:u,adjustSegmentDurations:v,getDuration:y,segmentIndex:F,segmentLookupStrategy:_.JA,initSegmentReference:m,mimeType:A,codecs:E,frameRate:void 0,bandwidth:h.bitrate,
|
|
33
|
+
width:h.maxWidth||void 0,height:h.maxHeight||void 0,kind:B,encrypted:a.K(),keyId:null,language:k.language,originalLanguage:k.bd,label:k.name,type:k.type,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:h.$f||null,spatialAudio:!1,closedCaptions:null}}return h});e=e.concat(g)}return e},TR=function(a,b,c){const d=(c?c.bandwidth:0)+(b?b.bandwidth:0),e=c?c.language:_.kg;return c||b?{id:a.h++,language:e,primary:!1,audio:c,video:b,bandwidth:d,drmInfos:a.w,allowedByApplication:!0,
|
|
34
|
+
allowedByKeySystem:!0}:null},YR=function(a,b,c,d,e){b=AQ(b,d.timescale||c,e);c={isLive:a.F.bind(a),le:a.K.bind(a),Wh:()=>1,ke:a.R.bind(a)};d=new Uint8Array(0);try{d=tR(b,c)}catch(g){throw a.g.error("Failed to generate initialization segment."),new _.I(_.D,3,4035,g);}const f="data:text/plain;base64,"+_.$l(d);return new _.oI(()=>[f],0,null,null,!0)},LQ=class{constructor(a){this.type=a;this.size=this.start=0;this.parent=null;this.w=!1;this.entries=[];this.children=[]}append(a=[]){for(let b=0;b<a.length;b++)this.children.push(a[b]),
|
|
35
|
+
a[b].parent=this;return this}get(a){if(this.type===a)return this;for(let b=0;b<this.children.length;b++){if(this.children[b].type===a)return this.children[b];{const c=this.children[b].get(a);if(c)return c}}return null}a(){const a=Math.pow(2,32)-1;let b;b=4+this.type.length;"uuid"===this.type&&(b+=16);if(0<this.children.length)for(let c=0;c<this.children.length;c++)b+=this.children[c].a();this.size>a&&(b+=8);return b}write(a){var b=Math.pow(2,32)-1;this.start=a.getPosition();this.size=this.a();this.size>
|
|
36
|
+
b?_.M(a,1):_.M(a,this.size);_.Ro(a,wQ(this.type));this.size>b&&oQ(a,this.size);"uuid"===this.type&&_.Ro(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()}},aS=class extends LQ{constructor(a,b,c){super(a);this.version=b;this.flags=c}a(){return 4+super.a()}write(a){super.write(a);pQ(a,this.version);qQ(a,this.flags)}},rR=class extends LQ{constructor(a,b,c){super(a);this.f=b;this.offset=c}a(){return this.f.byteLength+
|
|
37
|
+
super.a()-this.offset}write(a){super.write(a);_.Ro(a,this.f,this.offset);a.getPosition()}},xR=class extends aS{constructor(a,b,c,d,e){super(a,b,c);this.f=d;this.offset=e}a(){return this.f.byteLength+super.a()-this.offset}write(a){super.write(a);_.Ro(a,this.f,this.offset);a.getPosition()}},qR=class extends LQ{constructor(a,b,c){super("ftyp");this.h=a;this.Bg=b;this.f=c}a(){let a=this.h.length;a=a+4+this.f.join("").length;return a+super.a()}write(a){super.write(a);_.Ro(a,wQ(this.h));_.M(a,this.Bg);
|
|
38
|
+
_.Ro(a,wQ(this.f.join("")));a.getPosition()}},pR=class extends LQ{constructor(){super(_.De)}},oR=class extends LQ{constructor(){super(_.hg)}},SQ=class extends aS{constructor(a,b,c){super("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]}a(){let a=0;a=1===this.version?a+28:a+16;a=a+44+this.f.length;return a+=super.a()}write(a){super.write(a);1===this.version?(oQ(a,0),oQ(a,0),_.M(a,this.timescale),
|
|
39
|
+
oQ(a,this.duration*this.timescale)):(_.M(a,0),_.M(a,0),_.M(a,this.timescale),_.M(a,this.duration*this.timescale));_.M(a,65536);rQ(a,this.volume);rQ(a,0);_.M(a,0);_.M(a,0);for(let b=0;b<this.f.length;b++)pQ(a,this.f[b]);_.M(a,0);_.M(a,0);_.M(a,0);_.M(a,0);_.M(a,0);_.M(a,0);_.M(a,this.h);a.getPosition()}},TQ=class extends LQ{constructor(){super("mvex")}},UQ=class extends aS{constructor(a){super("trex",0,0);this.f=a}a(){return 20+super.a()}write(a){super.write(a);_.M(a,this.f);_.M(a,1);_.M(a,0);_.M(a,
|
|
40
|
+
0);_.M(a,0);a.getPosition()}},VQ=class extends aS{constructor(a,b,c,d,e){super("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]}a(){let a=0;a=1===this.version?a+32:a+20;a=a+24+this.f.length;return a+super.a()}write(a){super.write(a);1===this.version?(oQ(a,0),oQ(a,0),_.M(a,this.h),_.M(a,0),oQ(a,this.duration*this.timescale)):(_.M(a,0),_.M(a,0),_.M(a,this.h),_.M(a,0),_.M(a,
|
|
41
|
+
this.duration*this.timescale));_.M(a,0);_.M(a,0);rQ(a,0);rQ(a,0);rQ(a,this.volume);rQ(a,0);for(let b=0;b<this.f.length;b++)pQ(a,this.f[b]);rQ(a,this.width);rQ(a,0);rQ(a,this.height);rQ(a,0);a.getPosition()}},WQ=class extends aS{constructor(a,b){super("mdhd",1,0);this.timescale=a;this.duration=b;this.language=21956}a(){let a=0;a=1===this.version?a+28:a+16;return a+4+super.a()}write(a){super.write(a);1===this.version?(oQ(a,0),oQ(a,0),_.M(a,this.timescale),oQ(a,this.duration*this.timescale)):(_.M(a,
|
|
42
|
+
0),_.M(a,0),_.M(a,this.timescale),_.M(a,this.duration*this.timescale));rQ(a,this.language);rQ(a,0);a.getPosition()}},XQ=class extends aS{constructor(a){super("hdlr",0,0);this.f=a}a(){return 33+super.a()}write(a){super.write(a);_.M(a,0);this.f===_.t?_.Ro(a,wQ("vide")):_.Ro(a,wQ("soun"));_.M(a,0);_.M(a,0);_.M(a,0);this.f===_.t?_.Ro(a,wQ("VideoHandler\x00")):_.Ro(a,wQ("SoundHandler\x00"));a.getPosition()}},cR=class extends aS{constructor(){super("vmhd",0,1);this.f=new Uint8Array([0,0,0,0,0,0])}a(){return 2+
|
|
43
|
+
this.f.byteLength+super.a()}write(a){super.write(a);rQ(a,0);_.Ro(a,this.f);a.getPosition()}},bS=class extends LQ{constructor(a){super(a);this.w=!0}a(){return 8+super.a()}write(a){super.write(a);_.M(a,0);rQ(a,0);rQ(a,1)}},cS=class extends bS{constructor(a){super(a);this.height=this.width=0;this.depth=24}a(){return 70+super.a()}write(a){super.write(a);rQ(a,0);rQ(a,0);_.M(a,0);_.M(a,0);_.M(a,0);rQ(a,this.width);rQ(a,this.height);_.M(a,4718592);_.M(a,4718592);_.M(a,0);rQ(a,1);pQ(a,10);_.Ro(a,wQ("AVC Coding",
|
|
44
|
+
31));rQ(a,this.depth);tQ(a,-1)}},dS=class extends bS{constructor(a,b,c,d){super(a);this.channelCount=b;this.sampleSize=c;this.sampleRate=d}a(){return 20+super.a()}write(a){super.write(a);_.M(a,0);_.M(a,0);rQ(a,this.channelCount);rQ(a,this.sampleSize);tQ(a,0);rQ(a,0);rQ(a,this.sampleRate);rQ(a,0)}},bR=class extends cS{constructor(a,b){super("avc1");this.width=a;this.height=b}write(a){super.write(a);for(let b=0;b<this.children.length;b++)this.children[b].write(a);a.getPosition()}},MQ=class extends bR{constructor(a,
|
|
45
|
+
b){super(a,b);this.type="encv"}},eR=class extends dS{constructor(a,b,c){super("mp4a",a,b,c)}write(a){super.write(a);for(let b=0;b<this.children.length;b++)this.children[b].write(a);a.getPosition()}},NQ=class extends eR{constructor(a,b,c){super(a,b,c);this.type="enca"}},aR=class extends LQ{constructor(a,b){super("avcC");this.jb=a;this.jc=b;this.version=1;this.f=this.jb[0][1];this.h=this.jb[0][2];this.level=this.jb[0][3]}a(){let a=7;for(var b=0;b<this.jb.length;b++)a+=2,a+=this.jb[b].byteLength;for(b=
|
|
46
|
+
0;b<this.jb.length;b++)a+=2,a+=this.jc[b].byteLength;return a+super.a()}write(a){super.write(a);pQ(a,this.version);pQ(a,this.f);pQ(a,this.h);pQ(a,this.level);pQ(a,255);pQ(a,224|this.jb.length);for(var b=0;b<this.jb.length;b++)rQ(a,this.jb[b].length),_.Ro(a,this.jb[b]);pQ(a,this.jc.length);for(b=0;b<this.jc.length;b++)rQ(a,this.jc[b].length),_.Ro(a,this.jc[b]);a.getPosition()}},dR=class extends aS{constructor(a){super("esds",0,0);this.fc=a}a(){return 22+(this.fc.byteLength+3)+super.a()}write(a){super.write(a);
|
|
47
|
+
pQ(a,3);pQ(a,23+this.fc.byteLength);rQ(a,1);pQ(a,0);pQ(a,4);pQ(a,15+this.fc.byteLength);pQ(a,64);pQ(a,21);qQ(a,0);_.M(a,0);_.M(a,0);pQ(a,5);pQ(a,this.fc.byteLength);_.Ro(a,this.fc);_.Ro(a,new Uint8Array([6,1,2]));a.getPosition()}},ZQ=class extends aS{constructor(a=""){super("url ",0,1);this.location=a}a(){return this.location.length+super.a()}write(a){super.write(a);0<this.location.length&&_.Ro(a,wQ(this.location));a.getPosition()}},YQ=class extends aS{constructor(){super("dref",0,0)}a(){let a=4;
|
|
48
|
+
for(let b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+super.a()}write(a){super.write(a);_.M(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},gR=class extends LQ{constructor(){super(_.Sf)}},$Q=class extends aS{constructor(){super(_.Uf,0,0)}a(){let a=4;for(let b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+super.a()}write(a){super.write(a);_.M(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);
|
|
49
|
+
a.getPosition()}},hR=class extends aS{constructor(){super("stts",0,0)}a(){let a=4;for(let b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+super.a()}write(a){super.write(a);_.M(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},iR=class extends aS{constructor(){super("stsc",0,0)}a(){let a=4;for(let b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+super.a()}write(a){super.write(a);_.M(a,this.entries.length);for(let b=0;b<
|
|
50
|
+
this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},kR=class extends aS{constructor(){super("stco",0,0)}a(){let a=4;for(let b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+super.a()}write(a){super.write(a);_.M(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},jR=class extends aS{constructor(){super("stsz",0,0)}a(){return 8+super.a()}write(a){super.write(a);_.M(a,0);_.M(a,0);a.getPosition()}},fR=class extends aS{constructor(){super("smhd",
|
|
51
|
+
0,0)}a(){return 4+super.a()}write(a){super.write(a);tQ(a,0);rQ(a,0);a.getPosition()}},lR=class extends LQ{constructor(){super("dinf")}},mR=class extends LQ{constructor(){super(_.Ce)}},nR=class extends LQ{constructor(){super(_.ye)}},FR=class extends aS{constructor(a,b){super("tfdt",a,0);this.baseMediaDecodeTime=b}a(){let a=0;a=1===this.version?a+8:a+4;return a+super.a()}write(a){super.write(a);1===this.version?oQ(a,this.baseMediaDecodeTime):_.M(a,this.baseMediaDecodeTime);a.getPosition()}},uR=class extends aS{constructor(){super("mfhd",
|
|
52
|
+
0,0);this.f=0}a(){return 4+super.a()}write(a){super.write(a);_.M(a,this.f);a.getPosition()}},wR=class extends aS{constructor(a,b){super("trun",a,b);this.l=this.j=this.f=0;this.o=[];this.sampleSize=[];this.A=[];this.h=[]}a(){let a=4;this.flags&1&&(a+=4);this.flags&4&&(a+=4);for(let 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+super.a()}write(a){super.write(a);_.M(a,this.f);this.flags&1&&(a.getPosition(),sQ(a,this.j));this.flags&
|
|
53
|
+
4&&_.M(a,this.l);for(let b=0;b<this.f;b++)this.flags&256&&_.M(a,this.o[b]),this.flags&512&&_.M(a,this.sampleSize[b]),this.flags&1024&&_.M(a,this.A[b]),this.flags&2048&&(0===this.version?_.M(a,this.h[b]):sQ(a,this.h[b]));a.getPosition()}},vR=class extends aS{constructor(a,b){super("tfhd",a,b);this.f=255;this.l=this.o=this.j=this.A=this.h=0}a(){let 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+super.a()}write(a){super.write(a);
|
|
54
|
+
_.M(a,this.f);this.flags&1&&oQ(a,this.h);this.flags&2&&_.M(a,this.A);this.flags&8&&_.M(a,this.j);this.flags&16&&_.M(a,this.o);this.flags&32&&_.M(a,this.l);a.getPosition()}},BR=class extends LQ{constructor(){super("traf")}},CR=class extends LQ{constructor(){super("moof")}},AR=class extends LQ{constructor(){super(_.xe);this.f=new Uint8Array(0)}a(){return this.f.byteLength+super.a()}write(a){super.write(a);0<this.f.byteLength&&_.Ro(a,this.f)}},OQ=class extends aS{constructor(){super("tenc",0,0);this.f=
|
|
55
|
+
1;this.h=8;this.l="";this.j=[]}a(){let a;a=20;1===this.f&&0===this.h&&(a=a+1+this.j.length);return a+super.a()}write(a){super.write(a);pQ(a,0);0===this.version?pQ(a,0):pQ(a,0);pQ(a,this.f);pQ(a,this.h);_.Ro(a,_.bm(this.l));if(1===this.f&&0===this.h){pQ(a,0);for(let b=0;b<this.j.length;b++)pQ(a,this.j[b])}a.getPosition()}},QQ=class extends aS{constructor(a,b){super("schm",0,0);this.f=a;this.h=b;this.$b=""}a(){let a=8;this.flags&1&&(a+=wQ(this.$b).byteLength);return a+super.a()}write(a){super.write(a);
|
|
56
|
+
_.Ro(a,wQ(this.f));_.M(a,this.h);this.flags&1&&_.Ro(a,wQ(this.$b));a.getPosition()}},PQ=class extends LQ{constructor(a){super("frma");this.f=a}a(){return wQ(this.f).byteLength+super.a()}write(a){super.write(a);_.Ro(a,wQ(this.f));a.getPosition()}},GR=class extends aS{constructor(){super("saio",0,0);this.offset=[0]}a(){let a=0;this.flags&1&&(a+=8);a+=4;for(let b=0;1>b;b++)a=0===this.version?a+4:a+8;return a+super.a()}write(a){super.write(a);this.flags&1&&(_.M(a,0),_.M(a,0));_.M(a,1);for(let b=0;1>b;b++)0===
|
|
57
|
+
this.version?_.M(a,this.offset[b]):oQ(a,this.offset[b]);a.getPosition()}},HR=class extends aS{constructor(a,b,c){super("saiz",0,0);this.f=a;this.j=b;this.h=c}a(){let a=0;this.flags&1&&(a+=8);a+=5;0===this.f&&(a+=this.j.length);return a+super.a()}write(a){super.write(a);this.flags&1&&(_.M(a,0),_.M(a,0));pQ(a,this.f);_.M(a,this.h);if(0===this.f)for(let b=0;b<this.h;b++)pQ(a,this.j[b]);a.getPosition()}},zR=class extends aS{constructor(a,b){super("senc",a,b);this.h=0;this.j=8;this.f=[]}a(){let a=4;this.flags&
|
|
58
|
+
1&&(a+=1);for(let b=0;b<this.h;b++)if(a+=this.f[b].vg.byteLength,this.flags&2){a+=2;for(let c=0;c<this.f[b].ld;c++)a+=2,a+=4}return a+super.a()}write(a){super.write(a);_.M(a,this.h);this.flags&1&&pQ(a,this.j);for(let b=0;b<this.h;b++)if(_.Ro(a,this.f[b].vg),this.flags&2){rQ(a,this.f[b].ld);for(let c=0;c<this.f[b].ld;c++)rQ(a,this.f[b].yf[c].Wf),_.M(a,this.f[b].yf[c].Xf)}a.getPosition()}};var ER=class{constructor(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))}},DQ=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,EQ=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,FQ=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,GQ=/^(\d*\.?\d*)f$/,HQ=/^(\d*\.?\d*)t$/,IQ=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/;var sR=class{constructor(a){this.a=a;this.f=KQ(this)}get(a){for(let b=0;b<this.a.length;b++){const c=this.a[b].get(a);if(c)return c}return null}write(){this.f=KQ(this);for(let a=0;a<this.a.length;a++)this.a[a].write(this.f);return this.f.buffer}};var yR=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);var eS=class{constructor(){this.A=this.j=this.f=this.D=null;this.h=1;this.U=0;this.o="";this.C=this.a=null;this.g=new _.T("clpp.smooth.SmoothParser");this.L=!1;this.l=this.B=null;this.N=QR;this.I=0;this.G=this.J=Infinity;this.w=[];this.M=this.S.bind(this);this.H=new Map}configure(a){this.f=a}start(a,b){this.D=b;a=[...new Set([a,xQ(a)])];return MR(this,a).then(c=>UR(this,c.data).then(()=>{VR(this,this.B);return this.j}))}requestStop(){}stop(){this.D&&this.D.networkingEngine.ze(this.M);this.B=this.A=
|
|
59
|
+
this.j=this.f=this.D=null;this.l&&(clearTimeout(this.l),this.l=null);this.L=!1;this.J=this.G=Infinity;return Promise.resolve()}update(){if(this.F())return MR(this,[this.o]).then(a=>UR(this,a.data).then(()=>this.j)).catch(a=>{if(this.D)this.D.onError(a)})}setCurrentVariant(){}Yb(){this.g.debug(_.zA);this.D&&(this.l=null,this.update().then(()=>{VR(this,this.B)}).catch(a=>{this.D&&(this.D.onError(a),1===a.severity&&VR(this,100))}))}F(){return this.N===PR}K(){return 0<this.w.length}R(a){let b=null;if(this.w.length)for(let c=
|
|
60
|
+
0;c<this.w.length;c++)if(this.w[c].keySystem===a){b=this.w[c].initData[0];break}return b}S(a){if(2!==a.request.type||a.uri.startsWith("data:"))return Promise.resolve(a);const b=a.request.timescale||this.A.timescale,c={isLive:this.F.bind(this),le:this.K.bind(this),Wh:()=>1,ke:this.R.bind(this)};let d=!1;const e=new _.I(_.D,3,4035,null);let f=null;try{const 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 `+
|
|
61
|
+
`segment reference time ${a.request.startTime}`);f=IR(a,b,g,c)}catch(g){d=!0,e.data=g,3E3===g.code&&(e.code=4039)}if(d||!f)return Promise.reject(e);a.data=f;return Promise.resolve(a)}loadVariant(a){return _.w(function*(){return a})}loadTextStream(a,b){const c=this;return _.w(function*(){let d;const e=c.j.periods.find(f=>f.id===b);e&&(d=e.textStreams.find(f=>f.id===a)||null);if(!d)throw new _.pl(`Could not load text stream with id: ${a}`);return d})}},ZR={video:_.zg,audio:_.Hc,text:_.Bc},QR=_.Eb,PR=
|
|
62
|
+
"LIVE",$R={kj:_.EA,lj:_.TA};_.x("clpp.smooth.SmoothComponent",class extends _.zv{install(){_.Ft.ism=eS;_.Et[_.Cc]=eS}uninstall(){_.OC("ism");_.PC(_.Cc)}id(){return _.Nf}});};f.call(g, window);
|
package/cl.thumbnails.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var My="Thumbnail URL is mandatory",Ny="Wrong gridSize format",Oy="clpp.thumbnails",Qy=function(a,b){b.reduce((c,d)=>{let e=d,f=!1;typeof d===_.He&&(e=d.step,f=d.preloadWhileBuffering);return c.then(()=>Py(a,0,e,!!f))},Promise.resolve())},Py=function(a,b,c,d){if(a.w||b>=a.a.length)return Promise.resolve();const e=b+c;return Ry(a,d).then(()=>a.a[b].load()).then(()=>Py(a,e,c,d))},Ry=function(a,b){return new Promise(c=>{if(b||2!==a.player.getState())c();else a.player.one(_.Oc,()=>{c()})})},
|
|
2
|
+
Sy=function(a){const b=a.a.byteLength;a.f.forEach(c=>{c.offset+c.length<b&&c.cd.resolve()})},Vy=function(a,b){return Ty(a,b).then(c=>new Uy(c,b.time,b.duration))},Ty=function(a,b){return b.load().then(()=>{const c=_.G(a.a,b.offset,b.length);return"data:image/jpeg;base64,"+_.Zl(c)})},Wy=function(a){a=a.split(/\.|:/).map(parseFloat);let b=0,c;const d={3:.001,2:1,1:60,0:3600};for(c=a.length-1;0<=c;c--)b+=a[c]*d[c];return b},Xy=function(a,b){let c=null;for(const d of a)d.startTime<=b&&(c=d);return c},
|
|
3
|
+
Yy=function(a,b){const c=a.horizontalTiles||b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{Dd:c,If:d,ug:e,durationPerTile:a.durationPerTile||b.durationPerTile||(a.endTime-a.startTime)/e}},Zy=function(a){return a.some(b=>0<b.thumbStreams.length)},gz=function(a){return a?a===$y||a===az?new bz:a===cz?new dz:a===ez?new fz:null:null},hz=function(a){if(!a)return null;a=new _.gp(a);return a.path.match(/.*\.vtt$/i)?cz:a.path.match(/.*\.bif$/i)?ez:a.path.match(/.*\.(png|jpg|jpeg)$/i)?
|
|
4
|
+
$y:null};var iz=class{constructor(){this.log=new _.T(Oy);this.player=null;this.a=[];this.w=!1}init(a,b){this.player=a;a.one(_.xf,()=>{this.w=!0});a.isLive()||this.l().then(()=>{b&&b.preload&&Qy(this,b.preload)})}};var Uy=class{constructor(a,b,c,d,e,f,g,h,k,l,m,n){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;k=void 0===k?1:k;l=void 0===l?0:l;m=void 0===m?0:m;n=void 0===n?new Image:n;this.time=b;this.src=a;this.duration=c;this.x=d;this.y=e;this.width=f;this.height=g;this.a=n;this.h=h;this.o=k;this.j=l;this.l=m;this.f=null}raw(){return this.a.cloneNode(!1)}element(a,b){let c=this.width,d=this.height;const e=this.width/this.height;void 0!==a&&void 0===b&&(b=0);null!==a&&
|
|
5
5
|
void 0!==a&&(c=a);null!==b&&void 0!==b&&(d=b);c||(c=Math.ceil(d*e));d||(d=Math.ceil(c/e));a=document.createElement(_.Fd);a.style.width=c+_.uf;a.style.height=d+_.uf;a.style.backgroundColor="#000";a.style.backgroundRepeat="no-repeat";a.style.backgroundImage=`url("${this.src}")`;a.style.backgroundSize=`${Math.ceil(c/this.width*(this.a.naturalWidth||this.a.width))}px ${Math.ceil(d/this.height*(this.a.naturalHeight||this.a.height))}px`;b=this.y/this.height;a.style.backgroundPositionX="-"+this.x/this.width*
|
|
6
6
|
c+_.uf;a.style.backgroundPositionY="-"+b*d+_.uf;return a}load(){this.f||(this.f=new Promise((a,b)=>{const c=()=>{this.width||(this.width=(this.a.naturalWidth||this.a.width)/this.h);this.height||(this.height=(this.a.naturalHeight||this.a.height)/this.o);this.x||(this.x=this.width*this.j);this.y||(this.y=this.height*this.l)};if(this.a.src&&this.a.complete)c(),a(this);else{var d=null,e=()=>{c();this.a.removeEventListener(_.pe,e);this.a.removeEventListener(_.Xd,d);a(this)};d=f=>{this.a.removeEventListener(_.pe,
|
|
7
|
-
e);this.a.removeEventListener(_.Xd,d);b(new _.I(1,9,2014,"Failed to load thumbnail.",f))};this.a.addEventListener(_.pe,e);this.a.addEventListener(_.Xd,d);this.a.src=this.src}}));return this.f}};_.x("clpp.thumbnails.Thumbnail",
|
|
8
|
-
c),new _.I(1,9,7100,
|
|
9
|
-
for(let d=0;d<a;d++){const e=this.f.url.replace(c,String(d+1)),f=new Image;for(let g=0;g<b;g++)this.a.push(new
|
|
10
|
-
d[l]),k+=1;for(let l=0,m=e.byteLength;l<m;l++)h.setUint8(k,e[l]),k+=1;this.a=g;this.g.info(`Appended ${e.byteLength} bytes.`+`Total data now ${f} bytes.`);f=this.a;d=_.G(f);h=String.fromCharCode.apply(null,
|
|
11
|
-
h.offset-k.offset,k.duration=h.time-k.time;this.f.push(h);d+=8;(g=4294967295===g)&&this.h.resolve();if(1E5<e)throw Error("There was a problem during reading BIF entries");}else throw Error("The file is not a valid BIF format");
|
|
12
|
-
+ 'URL: ${c}`,d);a.onError(new _.I(1,9,2013,"Error while loading and parsing BIF thumbnails.",d))})}get(a){const b=this;return _.w(function*(){if(0>a)throw new _.I(1,9,2014,`Position is out of range: ${a}`);yield b.h;var c=b.f.find(d=>a>=d.time&&a<d.time+d.duration);if(!c)throw new _.I(1,9,2014,`No thumbnail found for position: ${a}`);c=yield
|
|
13
|
-
l);f.match(/^http|^\/\//)||(f=c.substr(0,c.lastIndexOf("/"))+"/"+f);l=
|
|
14
|
-
yield c.load();return c})}l(){return this.f}};var
|
|
15
|
-
e.findSegmentPosition(a-d.startTime);if(null===d||void 0===d)throw b.log.error("Could not find segment index for specified position",a),c();var f=e.getSegmentReference(d);if(f){const h=
|
|
16
|
-
h.
|
|
17
|
-
0;k<e.
|
|
18
|
-
this.g.warn("Unknown thumbnail mode",c)}else this.a=null}onContentLoaded(a){if(!this.a){var b=a.getConfiguration();b=b&&b.thumbnails;if(!b||void 0===b.enabled||b.enabled){var c=a.getPeriods();if(
|
|
19
|
-
var
|
|
7
|
+
e);this.a.removeEventListener(_.Xd,d);b(new _.I(1,9,2014,"Failed to load thumbnail.",f))};this.a.addEventListener(_.pe,e);this.a.addEventListener(_.Xd,d);this.a.src=this.src}}));return this.f}};_.x("clpp.thumbnails.Thumbnail",Uy);Uy.prototype.load=Uy.prototype.load;Uy.prototype.element=Uy.prototype.element;Uy.prototype.raw=Uy.prototype.raw;var bz=class extends iz{constructor(){super();this.f=null;this.o=this.h=1;this.j=0}init(a,b){if(!b||!b.url)throw new _.I(1,9,7100,My);if("GRID"===b.mode&&!b.gridSize)throw new _.I(1,9,7100,"Grid size is mandatory for GRID mode");if(!b.duration)throw new _.I(1,9,7100,"Duration is mandatory");this.f=b;this.j=this.f.duration;if(this.f.gridSize)try{const c=this.f.gridSize.split(/x/).map(d=>parseInt(d,10)).filter(d=>0<d);if(2===c.length)this.h=c[0],this.o=c[1];else throw new _.I(1,9,7100,Ny);}catch(c){throw this.log.error("Error during parsing gridSize",
|
|
8
|
+
c),new _.I(1,9,7100,Ny);}super.init(a,b)}get(a){const b=this;return _.w(function*(){var c=b.player.getDuration();if(0>a||a>c)throw new _.I(1,9,2014,`Position is out of range: ${a}`);c=Math.floor(a/b.f.duration);const d=b.a[c];if(!d)throw new _.I(1,9,2014,"No thumbnail found for position "+a+" at index "+c);yield d.load();return d})}l(){if(0<this.a.length)return Promise.resolve();var a=this.player.getDuration();const b=this.h*this.o;a=Math.ceil(Math.ceil(a/this.j)/b);const c=this.f.templateKey||"$index$";
|
|
9
|
+
for(let d=0;d<a;d++){const e=this.f.url.replace(c,String(d+1)),f=new Image;for(let g=0;g<b;g++)this.a.push(new Uy(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()}};var jz=class{constructor(a,b){this.time=a;this.duration=0;this.offset=b;this.length=0;this.cd=new _.Gl}load(){return this.cd}},fz=class{constructor(){this.g=new _.T(Oy);this.a=new ArrayBuffer(0);this.f=[];this.h=new _.Gl}init(a,b){if(!b||!b.url)throw new _.I(1,9,7100,My);const c=b.url;b=_.vk(c);b.type=_.uk;a.getNetworkEngine().fetch(b).V.then(d=>{var e=d.data;d=_.G(this.a);e=_.G(e);var f=d.byteLength+e.byteLength,g=new ArrayBuffer(f),h=new DataView(g),k=0;for(let l=0,m=d.byteLength;l<m;l++)h.setUint8(k,
|
|
10
|
+
d[l]),k+=1;for(let l=0,m=e.byteLength;l<m;l++)h.setUint8(k,e[l]),k+=1;this.a=g;this.g.info(`Appended ${e.byteLength} bytes.`+`Total data now ${f} bytes.`);f=this.a;d=_.G(f);h=String.fromCharCode.apply(null,kz);k=Array.prototype.slice.call(d,0,8);d=64;e=0;g=!1;if(h===String.fromCharCode.apply(null,k))for(f=new DataView(f,16,20),f=f.getUint32(0,!0),0===f&&(f=1E3);!g;){e+=1;k=f;h=new DataView(this.a,d);g=h.getUint32(0,!0);k=g*k/1E3;h=h.getUint32(4,!0);h=new jz(k,h);if(k=this.f.length)k=this.f[k-1],k.length=
|
|
11
|
+
h.offset-k.offset,k.duration=h.time-k.time;this.f.push(h);d+=8;(g=4294967295===g)&&this.h.resolve();if(1E5<e)throw Error("There was a problem during reading BIF entries");}else throw Error("The file is not a valid BIF format");Sy(this)}).catch(d=>{this.g.error(`[BIF] Error while loading thumbnails '
|
|
12
|
+
+ 'URL: ${c}`,d);a.onError(new _.I(1,9,2013,"Error while loading and parsing BIF thumbnails.",d))})}get(a){const b=this;return _.w(function*(){if(0>a)throw new _.I(1,9,2014,`Position is out of range: ${a}`);yield b.h;var c=b.f.find(d=>a>=d.time&&a<d.time+d.duration);if(!c)throw new _.I(1,9,2014,`No thumbnail found for position: ${a}`);c=yield Vy(b,c);yield c.load();return c})}},kz=[137,66,73,70,13,10,26,10];var dz=class extends iz{constructor(){super();this.f=null}init(a,b){if(!b||!b.url)throw new _.I(1,9,7100,My);const c=b.url,d=_.vk(c);d.type=_.uk;this.f=a.getNetworkEngine().fetch(d).V.then(e=>{e=e.data;if(!e)throw Error("No data in the response");e=_.ni(e).split(/\n/);for(let m=0;m<e.length;m++){var f=e[m],g=f.split(" --\x3e ");if(2===g.length){f=e[++m];var h=f.indexOf("\x3d");var k=h=0>h?[]:f.substr(h+1).split(/,/).map(parseFloat);h=k[0];const n=k[1],p=k[2];k=k[3];var l=f.indexOf("#");f=0>l?f:f.substr(0,
|
|
13
|
+
l);f.match(/^http|^\/\//)||(f=c.substr(0,c.lastIndexOf("/"))+"/"+f);l=Wy(g[0]);g=Wy(g[1])-l;this.a.push(new Uy(f,l,g,h,n,p,k,0,0))}}}).catch(e=>{this.log.error("[VTT] Error while loading thumbnails "+`URL: ${c}`,e);a.onError(new _.I(1,9,2013,"Error while loading VTT thumbnails.",e))});super.init(a,b)}get(a){const b=this;return _.w(function*(){if(0>a)throw new _.I(1,9,2014,`Position is out of range: ${a}`);yield b.f;const c=b.a.find(d=>a>=d.time&&a<d.time+d.duration);if(!c)throw new _.I(1,9,2014,`No thumbnail found for position: ${a}`);
|
|
14
|
+
yield c.load();return c})}l(){return this.f}};var lz=class extends iz{get(a){const b=this;return _.w(function*(){function c(){return new _.I(1,9,2014,`No thumbnail found for position: ${a}`)}if(0>a)throw b.log.error("Position must be greater than 0 but is "+a),new _.I(1,9,2014,`Position is out of range: ${a}`);var d=b.player.getPeriods();d=Xy(d,a);if(!d)throw b.log.error("Could not find period for specified position",a),c();var e=d.thumbStreams.sort(b.f)[0];if(!e)throw b.log.error("Could not find thumb stream for specified position",a),c();d=
|
|
15
|
+
e.findSegmentPosition(a-d.startTime);if(null===d||void 0===d)throw b.log.error("Could not find segment index for specified position",a),c();var f=e.getSegmentReference(d);if(f){const h=Yy(f,e),k=Math.floor((a-f.startTime)/h.durationPerTile);var g;if(0<b.a.length)f=e.findSegmentPosition(0),null!==f&&(g=b.a[(d-f)*h.ug+k]);else if((e=f.Da())&&0<e.length){let l=g=0;f=f.startTime;1<h.ug&&(g=k%h.Dd,l=Math.floor(k/h.Dd),f+=k*h.durationPerTile);g=new Uy(e[0],f,h.durationPerTile,void 0,void 0,void 0,void 0,
|
|
16
|
+
h.Dd,h.If,g,l)}if(g)return yield g.load(),g}b.log.error("segment reference for specified segment index does not exist",d);throw c();})}f(a,b){return void 0!==a.bandwidth&&void 0!==b.bandwidth?a.bandwidth-b.bandwidth:0}l(){if(0<this.a.length)return Promise.resolve();var a=this.player.getPeriods();for(const b of a)if(a=b.thumbStreams.sort(this.f)[0]){let c=a.findSegmentPosition(0),d;for(;null!==c&&!_.z(d=a.getSegmentReference(c++));){const e=Yy(d,a),f=d.Da()[0],g=new Image;let h=d.startTime;for(let k=
|
|
17
|
+
0;k<e.If;++k)for(let l=0;l<e.Dd;++l)this.a.push(new Uy(f,h,e.durationPerTile,void 0,void 0,void 0,void 0,e.Dd,e.If,l,k,g)),h+=e.durationPerTile}}return Promise.resolve()}};var mz=class{constructor(){this.g=new _.T(Oy);this.a=this.m=null}onPlayerCreated(a){this.m=a}onPlayerWillDestroy(){this.m=null}onPlayerWillRelease(){this.a=null}onContentWillLoad(a){const b=a.getConfiguration().thumbnails;if(b)if(!1===b.enabled)this.g.info("Thumbnails disabled.");else{var c=b.mode||null;c||(c=hz(b.url||null));(this.a=gz(c))?(this.g.info("Loading thumbs configuration",b),this.m.one(_.re,()=>{this.g.info("Initialize thumbnails provider");try{this.a.init(a,b)}catch(d){this.m.onError(d)}})):
|
|
18
|
+
this.g.warn("Unknown thumbnail mode",c)}else this.a=null}onContentLoaded(a){if(!this.a){var b=a.getConfiguration();b=b&&b.thumbnails;if(!b||void 0===b.enabled||b.enabled){var c=a.getPeriods();if(Zy(c)){this.a=new lz;try{this.a.init(a,b)}catch(d){this.m.onError(d)}}}}}get(a){return this.a?this.a.get(a):Promise.reject(new _.I(1,9,2014,"Thumbnail format is not supported"))}id(){return"thumbnails"}};_.x("clpp.thumbnails.ThumbnailsPlugin",mz);mz.prototype.get=mz.prototype.get;mz.Id="thumbnails";
|
|
19
|
+
var $y="SINGLE",az="GRID",cz="WEBVTT",ez="BIF";_.Pn(new class{create(){return new mz}});};f.call(g, window);
|