@castlabs/prestoplay 6.23.1 → 6.25.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 +35 -0
- 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 +116 -116
- package/cjs/cl.conviva.js +32 -32
- package/cjs/cl.core.js +607 -591
- package/cjs/cl.crypto.js +9 -9
- package/cjs/cl.dash.js +88 -86
- package/cjs/cl.externs.js +105 -54
- package/cjs/cl.freewheel.js +25 -24
- package/cjs/cl.hls.js +77 -71
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +30 -30
- package/cjs/cl.ima.js +24 -23
- package/cjs/cl.mse.js +352 -342
- package/cjs/cl.muxdata.js +15 -15
- package/cjs/cl.onboard.js +3 -3
- package/cjs/cl.persistent.js +15 -14
- package/cjs/cl.playlist.js +6 -6
- package/cjs/cl.sessions.js +16 -16
- package/cjs/cl.simid.js +15 -15
- package/cjs/cl.smooth.js +72 -72
- package/cjs/cl.thumbnails.js +26 -26
- package/cjs/cl.tizen.js +72 -72
- 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 +37 -37
- package/cl.adobe.js +3 -3
- package/cl.airplay.js +3 -3
- package/cl.broadpeak.js +5 -5
- package/cl.cast.js +88 -88
- package/cl.conviva.js +27 -27
- package/cl.core.js +491 -478
- package/cl.crypto.js +9 -9
- package/cl.dash.js +82 -80
- package/cl.externs.js +105 -54
- package/cl.freewheel.js +19 -19
- package/cl.hls.js +79 -74
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +26 -26
- package/cl.ima.js +18 -17
- package/cl.mse.js +310 -306
- 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 +13 -13
- package/cl.smooth.js +60 -59
- 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 -28
- package/package.json +1 -1
- package/typings.d.ts +54 -25
package/cl.smooth.js
CHANGED
|
@@ -1,59 +1,60 @@
|
|
|
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){_.
|
|
3
|
-
String(d.bitrate)).replace("{start time}",String(c.t)).replace("{start_time}",String(c.t));return _.
|
|
4
|
-
sampleSize:NaN,channelCount:NaN};switch(c.type){case _.w:a.
|
|
5
|
-
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
|
|
6
|
-
0;for(let c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.
|
|
7
|
-
|
|
8
|
-
(a=(new
|
|
9
|
-
|
|
10
|
-
0<l-k.reader.getPosition()&&k.flags&32&&(m.l=_.P(k.reader));d=m}}).
|
|
11
|
-
2048&&(0===k.version?m.h.push(_.P(k.reader)):m.h.push(_.
|
|
12
|
-
u.
|
|
13
|
-
g;d=g.get(_.
|
|
14
|
-
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
|
|
15
|
-
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].
|
|
16
|
-
periodId:null}},
|
|
17
|
-
c.type=1;c=yield a.D.networkingEngine.fetch(c).
|
|
18
|
-
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 _.
|
|
19
|
-
u}{const
|
|
20
|
-
|
|
21
|
-
32E3:5,24E3:6,22050:7,16E3:8,12E3:9,11025:10,8E3:11,7350:12},
|
|
22
|
-
maxWidth:
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
textStreams:
|
|
26
|
-
a.C.A=
|
|
27
|
-
c);c&&null!=a.l&&(window.clearTimeout(a.l),a.l=null,a.B=null);a.O=b},
|
|
28
|
-
`track with bitrate ${g.bitrate}. Skipping update.`)}}},
|
|
29
|
-
d.length;f++){const g=d[f].tracks.map(h=>{{var k=d[f],l=
|
|
30
|
-
2),16)&248)>>3),
|
|
31
|
-
primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:h.
|
|
32
|
-
try{d=
|
|
33
|
-
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>b?_.O(a,1):_.O(a,this.size);_.
|
|
34
|
-
!this.w)for(b=0;b<this.children.length;b++)this.children[b].write(a),this.children[b].a(),a.getPosition()}},
|
|
35
|
-
b,c);this.f=d;this.offset=e}a(){return this.f.byteLength+super.a()-this.offset}write(a){super.write(a);_.
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
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?(
|
|
39
|
-
this.width);
|
|
40
|
-
0,0);this.f=a}a(){return 33+super.a()}write(a){super.write(a);_.O(a,0);this.f===_.w?_.
|
|
41
|
-
super.a()}write(a){super.write(a);_.O(a,0);
|
|
42
|
-
super.a()}write(a){super.write(a);_.O(a,0);_.O(a,0);
|
|
43
|
-
a.getPosition()}},
|
|
44
|
-
for(var b=0;b<this.
|
|
45
|
-
_.
|
|
46
|
-
a.getPosition()}},
|
|
47
|
-
_.O(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},
|
|
48
|
-
return a+super.a()}write(a){super.write(a);_.O(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},
|
|
49
|
-
|
|
50
|
-
b);this.l=this.j=this.f=0;this.o=[];this.sampleSize=[];this.A=[];this.h=[]}a(){let a=4;this.flags&
|
|
51
|
-
this.flags&
|
|
52
|
-
|
|
53
|
-
return a+super.a()}write(a){super.write(a);
|
|
54
|
-
class extends
|
|
55
|
-
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&&(_.O(a,0),_.O(a,0));
|
|
56
|
-
2,a+=4}return a+super.a()}write(a){super.write(a);_.O(a,this.h);this.flags&1&&
|
|
57
|
-
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
|
|
58
|
-
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),
|
|
59
|
-
`segment reference time ${a.request.startTime}`);f=
|
|
1
|
+
import {clpp} from "./cl.core.js";import './cl.mse.js';let g={};const _ = clpp._;var f=function(window){'use strict';var JR="Full MP4 box must have flags defined",KR="clpp.smooth.SmoothMP4Processor",LR="codecPrivateData",MR=function(a,b){const c=Math.floor(b/Math.pow(2,32));b-=c*Math.pow(2,32);_.O(a,c);_.O(a,b)},NR=function(a,b){try{a.f.setUint8(a.a,b),a.a+=1}catch(c){_.km()}},OR=function(a,b){NR(a,b>>16&255);NR(a,b>>8&255);NR(a,b&255)},PR=function(a,b){try{a.f.setUint16(a.a,b,a.h),a.a+=2}catch(c){_.km()}},QR=function(a,b){try{a.f.setInt32(a.a,b,a.h),a.a+=4}catch(c){_.km()}},RR=function(a,b){try{a.f.setInt16(a.a,
|
|
2
|
+
b,a.h),a.a+=2}catch(c){_.km()}},SR=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},TR=function(a){const b=a.split("/");return b[b.length-1].toLowerCase().match("manifest(\\(.+\\))?")?a:`${a}/Manifest`},UR=function(a,b,c,d){c=b.Of[c];b=b.Di;a=a.replace("Manifest","");b=b.replace("{bitrate}",String(d.bitrate)).replace("{Bitrate}",
|
|
3
|
+
String(d.bitrate)).replace("{start time}",String(c.t)).replace("{start_time}",String(c.t));return _.gD([a],[b])[0]},VR=function(a,b){if(a.type!==b.type)return!1;let c=[];a.type===_.w?c=["maxWidth","maxHeight","bitrate",LR,"fourCC"]:a.type===_.p&&(c=["bitrate",LR,"channels","bitsPerSample","samplingRate","fourCC"]);return _.uh(a,b,c,["id","segmentIndex"])},WR=function(a,b,c){const d=c.Kd.split("00000001");a={id:1,type:c.type,duration:a/b,timescale:b,eb:null,fc:null,width:NaN,height:NaN,cc:null,xd:NaN,
|
|
4
|
+
sampleSize:NaN,channelCount:NaN};switch(c.type){case _.w:a.eb=[_.Zl(d[1])];a.fc=[_.Zl(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.p:a.cc=_.Zl(c.Kd),a.sampleSize=c.Tg||16,a.xd=c.xd,a.channelCount=c.Ff}return a},YR=function(a,b){return a.filter(c=>c.type===b)},ZR=function(a,b){a=a.exec(b);return null==a||""===a[0]?null:(Number(a[4])||0)/1E3+(Number(a[3])||0)+60*(Number(a[2])||0)+3600*(Number(a[1])||0)},fS=function(a,b,c){var d=null;if($R.test(a)){{a=$R.exec(a);d=Number(a[1]);const e=
|
|
5
|
+
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 aS.test(a)?d=ZR(aS,a):bS.test(a)?d=ZR(bS,a):cS.test(a)?(a=cS.exec(a),d=Number(a[1])/c.frameRate):dS.test(a)?(a=dS.exec(a),d=Number(a[1])/c.a):eS.test(a)&&(d=ZR(eS,a));c=d;d=c+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*d);return b+":"+c+":"+a+"."+d},gS=function(a){let b=
|
|
6
|
+
0;for(let c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.Fm(b)},nS=function(a,b,c){a:{var d=[_.Jd,_.Hd];for(e of d)if((d=c.Pd(e))&&d.keyId){var e=d.keyId;break a}_.C(KR,"Could not get default Key ID for DRM init data!");e=null}c=new hS("xxxx");a.type===_.w?c=new iS(a.width,a.height):c=new jS(a.channelCount,a.sampleSize,a.xd);a=new kS;a.f=1;a.h=8;a.l=e||"00000000000000000000000000000000";a=(new hS("schi")).append([a]);b=(new hS(_.Wf)).append([new lS(b),new mS(_.kd,65536),a]);c.append([b]);return c},
|
|
7
|
+
QS=function(a,b){var c=b.Sd(),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,a.duration);const h=new tS(a.type);var k=null,l=new uS;l.entries=[new vS];var m=new wS;switch(a.type){case _.w:k=new xS(a.eb,a.fc);c?(a=nS(a,"avc1",b),a.append([k]),m.entries=[a]):(a=(new yS(a.width,a.height)).append([k]),m.entries=[a]);k=new zS;break;case _.p:k=new AS(a.cc),c?(a=nS(a,"mp4a",b),a.append([k]),m.entries=[a]):
|
|
8
|
+
(a=(new BS(a.channelCount,a.sampleSize,a.xd)).append([k]),m.entries=[a]),k=new CS}m=(new DS).append([m,new ES,new FS,new GS,new HS]);l=(new IS).append([l]);l=(new JS).append([k,l,m]);g=(new KS).append([g,h,l]);f=(new LS).append([f,g]);d=(new MS).append([d,f,e]);e=new NS("dash",0,["iso6","mp41","avc1"]);c&&(c=b.Pd(_.Hd),b=b.Pd(_.Jd),c&&d.append([new OS("pssh",c.initData,8)]),b&&d.append([new OS("pssh",b.initData,8)]),c||b||_.C(KR,"Could not get PSSH init data!"));b=new PS([e,d]);return _.K(b.write())},
|
|
9
|
+
$S=function(a,b){let c,d,e,f,g,h;(new _.Dm).N("moof",_.wm).ea("mfhd",k=>{{const l=new RS;l.f=_.P(k.reader);c=l}}).N("traf",_.wm).ea("tfhd",k=>{{const l=k.reader.Sa();if(null===k.flags)throw new _.I(_.F,3,3019,JR);const m=new SS(k.version||0,k.flags||0);m.f=_.P(k.reader);0<l-k.reader.getPosition()&&k.flags&1&&(m.h=_.rm(k.reader));0<l-k.reader.getPosition()&&k.flags&2&&(m.A=_.P(k.reader));0<l-k.reader.getPosition()&&k.flags&8&&(m.j=_.P(k.reader));0<l-k.reader.getPosition()&&k.flags&16&&(m.o=_.P(k.reader));
|
|
10
|
+
0<l-k.reader.getPosition()&&k.flags&32&&(m.l=_.P(k.reader));d=m}}).ea("trun",k=>{{var l=k.reader.Sa();if(null===k.flags)throw new _.I(_.F,3,3019,JR);const m=new TS(k.version||0,k.flags||0);m.f=_.P(k.reader);0<l-k.reader.getPosition()&&k.flags&1&&(m.j=_.qm(k.reader));0<l-k.reader.getPosition()&&k.flags&4&&(m.l=_.P(k.reader));if(0<l-k.reader.getPosition())for(l=0;l<m.f;l++)k.flags&256&&m.o.push(_.P(k.reader)),k.flags&512&&m.sampleSize.push(_.P(k.reader)),k.flags&1024&&m.A.push(_.P(k.reader)),k.flags&
|
|
11
|
+
2048&&(0===k.version?m.h.push(_.P(k.reader)):m.h.push(_.qm(k.reader)));e=m}}).ea("sdtp",k=>{{const l=_.tm(k.reader,k.reader.Sa());f=new US("sdtp",k.version||0,k.flags||0,l,0)}}).N("uuid",k=>{var l=_.tm(k.reader,16);if(_.am(l,VS)){l=_.P(k.reader);k.version=l>>>24;k.flags=l&16777215;l=new WS(k.version,k.flags);l.h=_.P(k.reader);k.flags&1&&(l.j=_.om(k.reader));for(let m=0;m<l.h;m++){const n={$f:_.tm(k.reader,8),Vc:0,df:[]};if(k.flags&2){n.Vc=_.pm(k.reader);for(let r=0;r<n.Vc;r++){const u={Cf:0,Df:0};
|
|
12
|
+
u.Cf=_.pm(k.reader);u.Df=_.P(k.reader);n.df.push(u)}}l.f.push(n)}g=l}}).N(_.Ie,k=>{{const l=new XS;0<k.reader.Sa()?l.f=_.tm(k.reader,k.reader.Sa()):(_.C(KR,"mdat box is empty!"),l.f=new Uint8Array(0));h=l}}).parse(a,!1);if(!h)return null;a=(new YS).append([d,e]);f&&a.append([f]);b.Sd()&&g&&a.append([g]);b=(new ZS).append([c,a]);return new PS([b,h])},eT=function(a,b,c,d){var e=d.Sd(),f=parseInt(c*b,10);b=a.data||new ArrayBuffer(0);var g=$S(b,d);if(null===g)return a.request.contentType===_.H?a.data:
|
|
13
|
+
g;d=g.get(_.Ie);if(a.request.contentType===_.H){e=d.f.buffer;if(c){e=_.lj(e);if((e=(new DOMParser).parseFromString(e,_.ig))&&"tt"===e.documentElement.tagName.toLowerCase())var h=e.documentElement;if(h&&(d=new aT(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");for(let u=0,v=f.length;u<v;u++){h=f[u];a=c;b=d;g=["begin",_.ie];for(let y=0,A=g.length;y<
|
|
14
|
+
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 r=l[n].name;if(r=r.match(m)){k=k.getAttribute(r[0]);break b}}k=null}h.setAttribute(g[y],fS(k||"",a,b))}}}e=(new XMLSerializer).serializeToString(e);c=_.mj(e).buffer}else c=e;return c}h=new ZS;a=g.get("mfhd");b=new YS;k=g.get("tfhd");m=new bT(1,f);f=g.get("trun");n=g.get("sdtp");c=g.get("senc");k.f=1;k.flags&=16777214;k.flags|=131072;b.append([k,
|
|
15
|
+
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].Vc);else g=8;b.append([c,new cT,new dT(g,k,c.h)])}h.append([a,b]);f.flags|=1;f.j=h.a()+8;d=new PS([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},fT=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,
|
|
16
|
+
periodId:null}},gT=function(a){return{initData:_.UC(_.zn(a)),initDataType:_.kd,keyId:a,periodId:null}},hT=function(a,b,c){a=_.In(a);c&&a.version!==c&&(a=_.WC(a,c));return{initData:_.UC(a),initDataType:_.kd,keyId:b,periodId:null}},iT=function(a,b){return _.x(function*(){var c=_.Bj(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;c.fuzzFactor=a.f.attemptParameters.fuzzFactor;
|
|
17
|
+
c.type=1;c=yield a.D.networkingEngine.fetch(c).V;a.o=c.uri;return c})},qT=function(a,b){const c=_.Dn;let d=null;try{const ib=_.lj(b);d=c.j(ib,_.Hb)}catch(ib){}if(!d)throw a.g.error("Unable to parse manifest"),new _.I(_.F,4,4033,a.o);const e=+jT(a,d,"MajorVersion"),f=+jT(a,d,"MinorVersion"),g=+d.getAttribute("TimeScale")||1E7;let h=+jT(a,d,"Duration");const k="TRUE"===d.getAttribute("IsLive"),l=+d.getAttribute("LookAheadCount"),m=+d.getAttribute("DVRWindowLength")||Infinity,n=c.a(d,"Protection")[0];
|
|
18
|
+
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(_.F,4,4036,a.o);k?(kT(a,lT),a.B=typeof a.f.liveRefreshPeriod===_.t?1E3*a.f.liveRefreshPeriod:Math.min(1E3*a.I,1E4),h=Infinity):kT(a,mT);a.a={startTime:0,delay:0,duration:h/g,ve:m/g,od:0};if(n){{var r=a.f.playreadyVersion;const ib=_.Dn,va=[],wb=ib.a(n,"ProtectionHeader")[0],Ac=_.Yl(ib.f(wb)||""),hc=_.In(Ac).a;va.push(fT(_.Jd,gT(hc),[hc]));va.push(fT(_.Hd,hT(Ac,hc,r),[hc]));var u=va}a.w=
|
|
19
|
+
u}{const ib=[],va=_.Dn.a(d,"StreamIndex");if(!va.length)throw a.g.error("No streams found!"),new _.I(_.F,4,4034,a.o);for(let wb=0;wb<va.length;wb++){{var v=a,y=va[wb];const Ac=jT(v,y,"Type"),hc=+y.getAttribute("Chunks"),Vh=y.getAttribute("Subtype")||"",ye=y.getAttribute("Language")||_.tg,ze=_.Qi(ye),Wh=y.getAttribute("Name")||"",vf=+y.getAttribute(_.eb),xg=+y.getAttribute(_.db),Os=jT(v,y,"Url"),Pm=+y.getAttribute("TimeScale")||null;{const gd=[],Ej=_.Dn.a(y,_.zb);for(let Ae=0;Ae<Ej.length;Ae++){{let hd,
|
|
20
|
+
Na,$d;var A=v,E=Ej[Ae],G=Ac;const Fj=+E.getAttribute("Index"),yg=+jT(A,E,"Bitrate");let Bc=NaN,zg=NaN,Qm=NaN,Ps=NaN,uG=NaN,vG=NaN,wG=NaN;const xG=E.getAttribute("FourCC")||"";switch(G){case _.w:Bc=+jT(A,E,_.db);zg=+jT(A,E,_.eb);break;case _.p:Ps=+E.getAttribute("Channels")||2,Qm=+jT(A,E,"SamplingRate"),vG=+jT(A,E,"AudioTag"),uG=+jT(A,E,"BitsPerSample"),wG=+jT(A,E,"PacketSize")}let Qs=String(E.getAttribute("CodecPrivateData"));if(G===_.p&&!Qs){{var X=Ps;const yG={96E3:0,88200:1,64E3:2,48E3:3,44100:4,
|
|
21
|
+
32E3:5,24E3:6,22050:7,16E3:8,12E3:9,11025:10,8E3:11,7350:12},Rm=yG[Qm];if("AACH"===xG){Na=new Uint8Array(4);const zG=yG[2*Qm];Na[0]=40|Rm>>1;Na[1]=Rm<<7|X<<3|zG>>1;Na[2]=zG<<7|8;Na[3]=0;hd=new Uint16Array(2);hd[0]=(Na[0]<<8)+Na[1];hd[1]=(Na[2]<<8)+Na[3];$d=hd[0].toString(16)+hd[1].toString(16)}else Na=new Uint8Array(2),Na[0]=16|Rm>>1,Na[1]=Rm<<7|X<<3,hd=new Uint16Array(1),hd[0]=(Na[0]<<8)+Na[1],$d=hd[0].toString(16);Qs=$d.toUpperCase()}}var dd={id:A.U++,type:G,index:Fj,bitrate:yg,Kd:Qs,maxHeight:Bc,
|
|
22
|
+
maxWidth:zg,xd:Qm,Ff:Ps,Ii:vG,Tg:uG,Vi:wG,nh:xG,segmentIndex:null}}gd.push(dd)}var dc=gd}{const gd=[],Ej=_.Dn.a(y,"c");for(let Ae=0;Ae<Ej.length;Ae++){const hd=Ej[Ae];let Na=parseInt(hd.getAttribute("t"),10),$d=parseInt(hd.getAttribute("d"),10),Fj=parseInt(hd.getAttribute("r"),10),yg=0;if(isNaN(Na)&&isNaN($d))throw v.g.error("Either one or both FragmentDuration and FragmentTime field MUST be present in StreamFragmentElement"),new _.I(_.F,4,4037,v.o);0===Ae&&isNaN(Na)&&(yg=Na=0);if(0<Ae){const Bc=
|
|
23
|
+
gd[gd.length-1];yg=Bc.n+1;Bc.d||(Bc.d=Na-Bc.t);Na||(Na=Bc.t+Bc.d);$d||($d=Na-Bc.t)}gd.push({n:yg,d:$d,t:Na});if(Fj){Fj--;for(let Bc=0;Bc<Fj;Bc++){const zg=gd[gd.length-1];yg=zg.n+1;Na=zg.t+zg.d;$d=zg.d;gd.push({n:yg,d:$d,t:Na})}}}v.F()||gd.length===hc||v.g.warn("Number of fragments ("+hc+") differs from number of chunks ("+gd.length+").");var Mb=gd}var Zd={type:Ac,Mi:hc,ri:Vh,language:ze,Qc:ye,name:Wh,maxWidth:vf,maxHeight:xg,Di:Os,tracks:dc,Of:Mb,timescale:Pm}}ib.push(Zd)}var Nb=ib}const ec={Ui:e,
|
|
24
|
+
fg:f,timescale:g,duration:h,isLive:k,Ti:l,ve:m,Be:!1,streams:Nb};if(a.j&&a.A)return nT(a,ec),Promise.resolve();a.H.clear();{const ib=ec.timescale,va=ec.duration,wb=YR(ec.streams,_.p),Ac=YR(ec.streams,_.w),hc=YR(ec.streams,_.H),Vh=[];let ye=oT(a,va,ib,wb),ze=oT(a,va,ib,Ac);const Wh=oT(a,va,ib,hc);ye.length||(ye=[null]);ze.length||(ze=[null]);for(let vf=0;vf<ze.length;vf++)for(let xg=0;xg<ye.length;xg++)Vh.push(pT(a,ze[vf],ye[xg]));var fc={id:"ID",configurationId:void 0,startTime:0,endTime:va,variants:Vh,
|
|
25
|
+
textStreams:Wh,thumbStreams:[]}}{var Eb=ec.streams;let ib=a.a.startTime,va=a.a.delay;const wb=a.J;let Ac=Math.min(a.a.duration||Infinity,wb);const hc=a.F(),Vh=a.a.ve,ye=a.a.od,ze=a.I,Wh=isFinite(a.G)?a.G:0;if(hc)Ac=Infinity,ib=Date.now()/1E3-ye,a.a.startTime=ib,va=3*ze;else{const xg=isFinite(wb)?wb:a.a.duration;for(const Os of Eb)for(const Pm of Os.tracks)Pm.segmentIndex.offset(-Wh),_.LD(Pm.segmentIndex,xg)}const vf=a.f.timeline||{};vf.type=void 0;a.C=new _.iK(vf,ib,va,!hc,!0);a.C.f=Ac;_.ZD(a.C,ze);
|
|
26
|
+
a.C.A=Vh;hc||a.C.offset(-Wh)}a.D.filterAllPeriods([fc]);a.j={presentationTimeline:a.C,periods:[fc],minBufferTime:0,cues:[]};Promise.resolve();a.L||(a.D.networkingEngine.Ec(a.M),a.L=!0);a.A=ec;return Promise.resolve()},rT=function(a,b){null!=a.B&&null!=b&&(a.l=window.setTimeout(a.Xb.bind(a),b))},jT=function(a,b,c){if(b=b.getAttribute(c))return b;a.g.error("required attribute not provided: "+c);throw new _.I(_.F,4,4038,a.o,c);},kT=function(a,b){const c=b===mT;a.j&&a.j.presentationTimeline&&_.UD(a.j.presentationTimeline,
|
|
27
|
+
c);c&&null!=a.l&&(window.clearTimeout(a.l),a.l=null,a.B=null);a.O=b},nT=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){VR(g,c)||a.g.warn("The current stream is updated with a stream that seems to have different base properties!");var d=sT(a,a.A.timescale,f,c);c=g.segmentIndex;_.kE(c,d);(d=a.a.ve)&&_.lE(c,_.iE(c)-d).forEach(h=>{h.ab().forEach(k=>{a.H.delete(k)})})}else a.g.warn(`Cannot find satisfying update for ${g.type} `+
|
|
28
|
+
`track with bitrate ${g.bitrate}. Skipping update.`)}}},sT=function(a,b,c,d){let e=0;const f=[],g=c.timescale||b;c.Of.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=UR(a.o,c,k,d);a.I=Math.max(a.I,l);f.push(new _.jE(k,h,m,()=>[n],0,null,0,null,!0,g));a.H.set(n,h);e+=l});if(c.type===_.w||c.type===_.p)b=f[f.length-1],a.J=Math.min(a.J,e),0===a.a.od?a.a.od=b.endTime:a.a.od=Math.min(a.a.od,b.endTime);return f},oT=function(a,b,c,d){let e=[];for(let f=0;f<
|
|
29
|
+
d.length;f++){const g=d[f].tracks.map(h=>{{var k=d[f],l=sT(a,c,k,h);const X=new _.jK(l);var m=null;k.type!==_.H&&(m=tT(a,b,c,k,h));h.segmentIndex=X;l=_.fK++;var n=Promise.resolve.bind(Promise),r=X.f.bind(X),u=X.get.bind(X),v=X.h.bind(X),y=X.getDuration.bind(X),A=uT[k.type];var E="";switch(k.type){case _.w:E=h.Kd;var G=/00000001[0-9]7/.exec(E);E="avc1."+(G&&G[0]?E.substr(E.indexOf(G[0])+10,6):"42c00c");a.g.debug("VIDEO CODECS: ",E);break;case _.p:E=h.Kd,G=2,"AACH"===h.nh?G=5:E&&(G=(parseInt(E.substr(0,
|
|
30
|
+
2),16)&248)>>3),E="mp4a.40."+G,a.g.debug("AUDIO CODECS: ",E)}G=k.type===_.H?vT[k.ri]:void 0;h={id:l,originalId:null,Yi:null,createSegmentIndex:n,findSegmentPosition:r,getSegmentReference:u,adjustSegmentDurations:v,getDuration:y,segmentIndex:X,segmentLookupStrategy:_.BC,initSegmentReference:m,mimeType:A,codecs:E,frameRate:void 0,bandwidth:h.bitrate,width:h.maxWidth||void 0,height:h.maxHeight||void 0,kind:G,encrypted:a.K(),keyId:null,language:k.language,originalLanguage:k.Qc,label:k.name,type:k.type,
|
|
31
|
+
primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:h.Ff||null,spatialAudio:!1,closedCaptions:null}}return h});e=e.concat(g)}return e},pT=function(a,b,c){const d=(c?c.bandwidth:0)+(b?b.bandwidth:0),e=c?c.language:_.tg;return c||b?{id:a.h++,language:e,primary:!1,audio:c,video:b,bandwidth:d,drmInfos:a.w,allowedByApplication:!0,allowedByKeySystem:!0}:null},tT=function(a,b,c,d,e){b=WR(b,d.timescale||c,e);c={isLive:a.F.bind(a),Sd:a.K.bind(a),th:()=>1,Pd:a.R.bind(a)};d=new Uint8Array(0);
|
|
32
|
+
try{d=QS(b,c)}catch(g){throw a.g.error("Failed to generate initialization segment."),new _.I(_.F,3,4035,g);}const f="data:text/plain;base64,"+_.Xl(d);return new _.eK(()=>[f],0,null,null,!0)},hS=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]),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===
|
|
33
|
+
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>b?_.O(a,1):_.O(a,this.size);_.lm(a,SR(this.type));this.size>b&&MR(a,this.size);"uuid"===this.type&&_.lm(a,null);if(0<this.children.length&&
|
|
34
|
+
!this.w)for(b=0;b<this.children.length;b++)this.children[b].write(a),this.children[b].a(),a.getPosition()}},wT=class extends hS{constructor(a,b,c){super(a);this.version=b;this.flags=c}a(){return 4+super.a()}write(a){super.write(a);NR(a,this.version);OR(a,this.flags)}},OS=class extends hS{constructor(a,b,c){super(a);this.f=b;this.offset=c}a(){return this.f.byteLength+super.a()-this.offset}write(a){super.write(a);_.lm(a,this.f,this.offset);a.getPosition()}},US=class extends wT{constructor(a,b,c,d,e){super(a,
|
|
35
|
+
b,c);this.f=d;this.offset=e}a(){return this.f.byteLength+super.a()-this.offset}write(a){super.write(a);_.lm(a,this.f,this.offset);a.getPosition()}},NS=class extends hS{constructor(a,b,c){super("ftyp");this.h=a;this.fg=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);_.lm(a,SR(this.h));_.O(a,this.fg);_.lm(a,SR(this.f.join("")));a.getPosition()}},MS=class extends hS{constructor(){super(_.Oe)}},LS=class extends hS{constructor(){super(_.qg)}},
|
|
36
|
+
oS=class extends wT{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?(MR(a,0),MR(a,0),_.O(a,this.timescale),MR(a,this.duration*this.timescale)):(_.O(a,0),_.O(a,0),_.O(a,this.timescale),_.O(a,this.duration*this.timescale));_.O(a,65536);PR(a,this.volume);
|
|
37
|
+
PR(a,0);_.O(a,0);_.O(a,0);for(let b=0;b<this.f.length;b++)NR(a,this.f[b]);_.O(a,0);_.O(a,0);_.O(a,0);_.O(a,0);_.O(a,0);_.O(a,0);_.O(a,this.h);a.getPosition()}},pS=class extends hS{constructor(){super("mvex")}},qS=class extends wT{constructor(a){super("trex",0,0);this.f=a}a(){return 20+super.a()}write(a){super.write(a);_.O(a,this.f);_.O(a,1);_.O(a,0);_.O(a,0);_.O(a,0);a.getPosition()}},rS=class extends wT{constructor(a,b,c,d,e){super("tkhd",1,7);this.h=a;this.duration=b;this.timescale=c;this.width=
|
|
38
|
+
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?(MR(a,0),MR(a,0),_.O(a,this.h),_.O(a,0),MR(a,this.duration*this.timescale)):(_.O(a,0),_.O(a,0),_.O(a,this.h),_.O(a,0),_.O(a,this.duration*this.timescale));_.O(a,0);_.O(a,0);PR(a,0);PR(a,0);PR(a,this.volume);PR(a,0);for(let b=0;b<this.f.length;b++)NR(a,this.f[b]);PR(a,
|
|
39
|
+
this.width);PR(a,0);PR(a,this.height);PR(a,0);a.getPosition()}},sS=class extends wT{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?(MR(a,0),MR(a,0),_.O(a,this.timescale),MR(a,this.duration*this.timescale)):(_.O(a,0),_.O(a,0),_.O(a,this.timescale),_.O(a,this.duration*this.timescale));PR(a,this.language);PR(a,0);a.getPosition()}},tS=class extends wT{constructor(a){super("hdlr",
|
|
40
|
+
0,0);this.f=a}a(){return 33+super.a()}write(a){super.write(a);_.O(a,0);this.f===_.w?_.lm(a,SR("vide")):_.lm(a,SR("soun"));_.O(a,0);_.O(a,0);_.O(a,0);this.f===_.w?_.lm(a,SR("VideoHandler\x00")):_.lm(a,SR("SoundHandler\x00"));a.getPosition()}},zS=class extends wT{constructor(){super("vmhd",0,1);this.f=new Uint8Array([0,0,0,0,0,0])}a(){return 2+this.f.byteLength+super.a()}write(a){super.write(a);PR(a,0);_.lm(a,this.f);a.getPosition()}},xT=class extends hS{constructor(a){super(a);this.w=!0}a(){return 8+
|
|
41
|
+
super.a()}write(a){super.write(a);_.O(a,0);PR(a,0);PR(a,1)}},yT=class extends xT{constructor(a){super(a);this.height=this.width=0;this.depth=24}a(){return 70+super.a()}write(a){super.write(a);PR(a,0);PR(a,0);_.O(a,0);_.O(a,0);_.O(a,0);PR(a,this.width);PR(a,this.height);_.O(a,4718592);_.O(a,4718592);_.O(a,0);PR(a,1);NR(a,10);_.lm(a,SR("AVC Coding",31));PR(a,this.depth);RR(a,-1)}},zT=class extends xT{constructor(a,b,c,d){super(a);this.channelCount=b;this.sampleSize=c;this.sampleRate=d}a(){return 20+
|
|
42
|
+
super.a()}write(a){super.write(a);_.O(a,0);_.O(a,0);PR(a,this.channelCount);PR(a,this.sampleSize);RR(a,0);PR(a,0);PR(a,this.sampleRate);PR(a,0)}},yS=class extends yT{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()}},iS=class extends yS{constructor(a,b){super(a,b);this.type="encv"}},BS=class extends zT{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);
|
|
43
|
+
a.getPosition()}},jS=class extends BS{constructor(a,b,c){super(a,b,c);this.type="enca"}},xS=class extends hS{constructor(a,b){super("avcC");this.eb=a;this.fc=b;this.version=1;this.f=this.eb[0][1];this.h=this.eb[0][2];this.level=this.eb[0][3]}a(){let a=7;for(var b=0;b<this.eb.length;b++)a+=2,a+=this.eb[b].byteLength;for(b=0;b<this.eb.length;b++)a+=2,a+=this.fc[b].byteLength;return a+super.a()}write(a){super.write(a);NR(a,this.version);NR(a,this.f);NR(a,this.h);NR(a,this.level);NR(a,255);NR(a,224|this.eb.length);
|
|
44
|
+
for(var b=0;b<this.eb.length;b++)PR(a,this.eb[b].length),_.lm(a,this.eb[b]);NR(a,this.fc.length);for(b=0;b<this.fc.length;b++)PR(a,this.fc[b].length),_.lm(a,this.fc[b]);a.getPosition()}},AS=class extends wT{constructor(a){super("esds",0,0);this.cc=a}a(){return 22+(this.cc.byteLength+3)+super.a()}write(a){super.write(a);NR(a,3);NR(a,23+this.cc.byteLength);PR(a,1);NR(a,0);NR(a,4);NR(a,15+this.cc.byteLength);NR(a,64);NR(a,21);OR(a,0);_.O(a,0);_.O(a,0);NR(a,5);NR(a,this.cc.byteLength);_.lm(a,this.cc);
|
|
45
|
+
_.lm(a,new Uint8Array([6,1,2]));a.getPosition()}},vS=class extends wT{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&&_.lm(a,SR(this.location));a.getPosition()}},uS=class extends wT{constructor(){super("dref",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);_.O(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);
|
|
46
|
+
a.getPosition()}},DS=class extends hS{constructor(){super(_.bg)}},wS=class extends wT{constructor(){super(_.dg,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);_.O(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},ES=class extends wT{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);
|
|
47
|
+
_.O(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},FS=class extends wT{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);_.O(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},HS=class extends wT{constructor(){super("stco",0,0)}a(){let a=4;for(let b=0;b<this.entries.length;b++)a+=this.entries[b].a();
|
|
48
|
+
return a+super.a()}write(a){super.write(a);_.O(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},GS=class extends wT{constructor(){super("stsz",0,0)}a(){return 8+super.a()}write(a){super.write(a);_.O(a,0);_.O(a,0);a.getPosition()}},CS=class extends wT{constructor(){super("smhd",0,0)}a(){return 4+super.a()}write(a){super.write(a);RR(a,0);PR(a,0);a.getPosition()}},IS=class extends hS{constructor(){super("dinf")}},JS=class extends hS{constructor(){super(_.Ne)}},
|
|
49
|
+
KS=class extends hS{constructor(){super(_.Je)}},bT=class extends wT{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?MR(a,this.baseMediaDecodeTime):_.O(a,this.baseMediaDecodeTime);a.getPosition()}},RS=class extends wT{constructor(){super("mfhd",0,0);this.f=0}a(){return 4+super.a()}write(a){super.write(a);_.O(a,this.f);a.getPosition()}},TS=class extends wT{constructor(a,b){super("trun",a,
|
|
50
|
+
b);this.l=this.j=this.f=0;this.o=[];this.sampleSize=[];this.A=[];this.h=[]}a(){let a=4;this.flags&AT&&(a+=4);this.flags&BT&&(a+=4);for(let b=0;b<this.f;b++)this.flags&CT&&(a+=4),this.flags&DT&&(a+=4),this.flags&ET&&(a+=4),this.flags&FT&&(a+=4);return a+super.a()}write(a){super.write(a);_.O(a,this.f);this.flags&AT&&(a.getPosition(),QR(a,this.j));this.flags&BT&&_.O(a,this.l);for(let b=0;b<this.f;b++)this.flags&CT&&_.O(a,this.o[b]),this.flags&DT&&_.O(a,this.sampleSize[b]),this.flags&ET&&_.O(a,this.A[b]),
|
|
51
|
+
this.flags&FT&&(0===this.version?_.O(a,this.h[b]):QR(a,this.h[b]));a.getPosition()}},AT=1,BT=4,CT=256,DT=512,ET=1024,FT=2048,SS=class extends wT{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>&&(a+=8);this.flags&HT&&(a+=4);this.flags&IT&&(a+=4);this.flags&JT&&(a+=4);this.flags&KT&&(a+=4);return a+super.a()}write(a){super.write(a);_.O(a,this.f);this.flags>&&MR(a,this.h);this.flags&HT&&_.O(a,this.A);this.flags&IT&&_.O(a,this.j);this.flags&
|
|
52
|
+
JT&&_.O(a,this.o);this.flags&KT&&_.O(a,this.l);a.getPosition()}},GT=1,HT=2,IT=8,JT=16,KT=32,YS=class extends hS{constructor(){super("traf")}},ZS=class extends hS{constructor(){super("moof")}},XS=class extends hS{constructor(){super(_.Ie);this.f=new Uint8Array(0)}a(){return this.f.byteLength+super.a()}write(a){super.write(a);0<this.f.byteLength&&_.lm(a,this.f)}},kS=class extends wT{constructor(){super("tenc",0,0);this.f=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);
|
|
53
|
+
return a+super.a()}write(a){super.write(a);NR(a,0);0===this.version?NR(a,0):NR(a,0);NR(a,this.f);NR(a,this.h);_.lm(a,_.Zl(this.l));if(1===this.f&&0===this.h){NR(a,0);for(let b=0;b<this.j.length;b++)NR(a,this.j[b])}a.getPosition()}},mS=class extends wT{constructor(a,b){super("schm",0,0);this.f=a;this.h=b;this.Zb=""}a(){let a=8;this.flags&1&&(a+=SR(this.Zb).byteLength);return a+super.a()}write(a){super.write(a);_.lm(a,SR(this.f));_.O(a,this.h);this.flags&1&&_.lm(a,SR(this.Zb));a.getPosition()}},lS=
|
|
54
|
+
class extends hS{constructor(a){super("frma");this.f=a}a(){return SR(this.f).byteLength+super.a()}write(a){super.write(a);_.lm(a,SR(this.f));a.getPosition()}},cT=class extends wT{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&&(_.O(a,0),_.O(a,0));_.O(a,1);for(let b=0;1>b;b++)0===this.version?_.O(a,this.offset[b]):MR(a,this.offset[b]);a.getPosition()}},dT=class extends wT{constructor(a,
|
|
55
|
+
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&&(_.O(a,0),_.O(a,0));NR(a,this.f);_.O(a,this.h);if(0===this.f)for(let b=0;b<this.h;b++)NR(a,this.j[b]);a.getPosition()}},WS=class extends wT{constructor(a,b){super("senc",a,b);this.h=0;this.j=8;this.f=[]}a(){let a=4;this.flags&1&&(a+=1);for(let b=0;b<this.h;b++)if(a+=this.f[b].$f.byteLength,this.flags&2){a+=2;for(let c=0;c<this.f[b].Vc;c++)a+=
|
|
56
|
+
2,a+=4}return a+super.a()}write(a){super.write(a);_.O(a,this.h);this.flags&1&&NR(a,this.j);for(let b=0;b<this.h;b++)if(_.lm(a,this.f[b].$f),this.flags&2){PR(a,this.f[b].Vc);for(let c=0;c<this.f[b].Vc;c++)PR(a,this.f[b].df[c].Cf),_.O(a,this.f[b].df[c].Df)}a.getPosition()}};var aT=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))}},$R=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,aS=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,bS=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,cS=/^(\d*\.?\d*)f$/,dS=/^(\d*\.?\d*)t$/,eS=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/;var PS=class{constructor(a){this.a=a;this.f=gS(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=gS(this);for(let a=0;a<this.a.length;a++)this.a[a].write(this.f);return this.f.buffer}};var VS=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);var LT=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 _.S("clpp.smooth.SmoothParser");this.L=!1;this.l=this.B=null;this.O=mT;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,TR(a)])];return iT(this,a).then(c=>qT(this,c.data).then(()=>{rT(this,this.B);return this.j}))}requestStop(){}stop(){this.D&&this.D.networkingEngine.vd(this.M);this.B=this.A=
|
|
57
|
+
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 iT(this,[this.o]).then(a=>qT(this,a.data).then(()=>this.j)).catch(a=>{if(this.D)this.D.onError(a)})}setCurrentVariant(){}Xb(){this.g.debug(_.qC);this.D&&(this.l=null,this.update().then(()=>{rT(this,this.B)}).catch(a=>{this.D&&(this.D.onError(a),1===a.severity&&rT(this,100))}))}F(){return this.O===lT}K(){return 0<this.w.length}R(a){let b=null;if(this.w.length)for(let c=
|
|
58
|
+
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),Sd:this.K.bind(this),th:()=>1,Pd:this.R.bind(this)};let d=!1;const e=new _.I(_.F,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 `+
|
|
59
|
+
`segment reference time ${a.request.startTime}`);f=eT(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 _.x(function*(){return a})}loadTextStream(a,b){const c=this;return _.x(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 _.zi(`Could not load text stream with id: ${a}`);return d})}},uT={video:_.Ig,audio:_.Uc,text:_.Oc},mT=_.Ub,lT=
|
|
60
|
+
"LIVE",vT={Ei:_.wC,Fi:_.NC};_.z("clpp.smooth.SmoothComponent",class extends _.Kv{f(){_.et.ism=LT;_.ct[_.Pc]=LT}a(){_.IE("ism");_.JE(_.Pc)}id(){return _.Xf}});};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
|
-
|
|
5
|
-
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));a=document.createElement(_.
|
|
6
|
-
this.width*c+_.
|
|
7
|
-
{this.
|
|
8
|
-
c),new _.
|
|
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=_.K(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 _.
|
|
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
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Vy="Thumbnail URL is mandatory",Wy="Wrong gridSize format",Xy="clpp.thumbnails",Zy=function(a,b){b.reduce((c,d)=>{let e=d,f=!1;typeof d===_.Se&&(e=d.step,f=d.preloadWhileBuffering);return c.then(()=>Yy(a,0,e,!!f))},Promise.resolve())},Yy=function(a,b,c,d){if(a.w||b>=a.a.length)return Promise.resolve();const e=b+c;return $y(a,d).then(()=>a.a[b].load()).then(()=>Yy(a,e,c,d))},$y=function(a,b){return new Promise(c=>{if(b||a.player.getState()!==_.dp)c();else a.player.one(_.ad,()=>{c()})})},
|
|
2
|
+
az=function(a){const b=a.a.byteLength;a.f.forEach(c=>{c.offset+c.length<b&&c.Rc.resolve()})},dz=function(a,b){return bz(a,b).then(c=>new cz(c,b.time,b.duration))},bz=function(a,b){return b.load().then(()=>{const c=_.K(a.a,b.offset,b.length);return"data:image/jpeg;base64,"+_.Wl(c)})},ez=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},fz=function(a,b){let c=null;for(const d of a)d.startTime<=b&&(c=d);return c},
|
|
3
|
+
gz=function(a,b){const c=a.horizontalTiles||b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{ld:c,pf:d,Zf:e,durationPerTile:a.durationPerTile||b.durationPerTile||(a.endTime-a.startTime)/e}},hz=function(a){return a.some(b=>0<b.thumbStreams.length)},pz=function(a){return a?a===iz||a===jz?new kz:a===lz?new mz:a===nz?new oz:null:null},qz=function(a){if(!a)return null;a=new _.Bm(a);return a.path.match(/.*\.vtt$/i)?lz:a.path.match(/.*\.bif$/i)?nz:a.path.match(/.*\.(png|jpg|jpeg)$/i)?
|
|
4
|
+
iz:null};var rz=class{constructor(){this.log=new _.S(Xy);this.player=null;this.a=[];this.w=!1}init(a,b){this.player=a;a.one(_.If,()=>{this.w=!0});a.isLive()||this.l().then(()=>{b&&b.preload&&Zy(this,b.preload)})}};var cz=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.ta=n;this.ah=h;this.gi=k;this.Bh=l;this.Ch=m;this.Ce=null}raw(){return this.ta.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!==
|
|
5
|
+
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));a=document.createElement(_.Sd);a.style.width=c+_.Ff;a.style.height=d+_.Ff;a.style.backgroundColor="#000";a.style.backgroundRepeat="no-repeat";a.style.backgroundImage=`url("${this.src}")`;a.style.backgroundSize=`${Math.ceil(c/this.width*(this.ta.naturalWidth||this.ta.width))}px ${Math.ceil(d/this.height*(this.ta.naturalHeight||this.ta.height))}px`;b=this.y/this.height;a.style.backgroundPositionX="-"+this.x/
|
|
6
|
+
this.width*c+_.Ff;a.style.backgroundPositionY="-"+b*d+_.Ff;return a}load(){this.Ce||(this.Ce=new Promise((a,b)=>{const c=()=>{this.width||(this.width=(this.ta.naturalWidth||this.ta.width)/this.ah);this.height||(this.height=(this.ta.naturalHeight||this.ta.height)/this.gi);this.x||(this.x=this.width*this.Bh);this.y||(this.y=this.height*this.Ch)};if(this.ta.src&&this.ta.complete)c(),a(this);else{var d=null,e=()=>{c();this.ta.removeEventListener(_.De,e);this.ta.removeEventListener(_.q,d);a(this)};d=f=>
|
|
7
|
+
{this.ta.removeEventListener(_.De,e);this.ta.removeEventListener(_.q,d);b(new _.I(1,9,2014,"Failed to load thumbnail.",f))};this.ta.addEventListener(_.De,e);this.ta.addEventListener(_.q,d);this.ta.src=this.src}}));return this.Ce}};_.z("clpp.thumbnails.Thumbnail",cz);cz.prototype.load=cz.prototype.load;cz.prototype.element=cz.prototype.element;cz.prototype.raw=cz.prototype.raw;var kz=class extends rz{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,Vy);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,Wy);}catch(c){throw this.log.error("Error during parsing gridSize",
|
|
8
|
+
c),new _.I(1,9,7100,Wy);}super.init(a,b)}get(a){const b=this;return _.x(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 cz(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 sz=class{constructor(a,b){this.time=a;this.duration=0;this.offset=b;this.length=0;this.Rc=new _.rn}load(){return this.Rc}},oz=class{constructor(){this.g=new _.S(Xy);this.a=new ArrayBuffer(0);this.f=[];this.h=new _.rn}init(a,b){if(!b||!b.url)throw new _.I(1,9,7100,Vy);const c=b.url;b=_.Bj(c);b.type=_.Aj;a.getNetworkEngine().fetch(b).V.then(d=>{var e=d.data;d=_.K(this.a);e=_.K(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=_.K(f);h=String.fromCharCode.apply(null,tz);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 sz(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");az(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 _.x(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 dz(b,c);yield c.load();return c})}},tz=[137,66,73,70,13,10,26,10];var mz=class extends rz{constructor(){super();this.f=null}init(a,b){if(!b||!b.url)throw new _.I(1,9,7100,Vy);const c=b.url,d=_.Bj(c);d.type=_.Aj;this.f=a.getNetworkEngine().fetch(d).V.then(e=>{e=e.data;if(!e)throw Error("No data in the response");e=_.ij(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],r=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=ez(g[0]);g=ez(g[1])-l;this.a.push(new cz(f,l,g,h,n,r,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 _.x(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 uz=class extends rz{get(a){const b=this;return _.x(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=fz(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=gz(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.Zf+k]);else if((e=f.ab())&&0<e.length){let l=g=0;f=f.startTime;1<h.Zf&&(g=k%h.ld,l=Math.floor(k/h.ld),f+=k*h.durationPerTile);g=new cz(e[0],f,h.durationPerTile,void 0,void 0,void 0,void 0,
|
|
16
|
+
h.ld,h.pf,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&&!_.B(d=a.getSegmentReference(c++));){const e=gz(d,a),f=d.ab()[0],g=new Image;let h=d.startTime;for(let k=
|
|
17
|
+
0;k<e.pf;++k)for(let l=0;l<e.ld;++l)this.a.push(new cz(f,h,e.durationPerTile,void 0,void 0,void 0,void 0,e.ld,e.pf,l,k,g)),h+=e.durationPerTile}}return Promise.resolve()}};var vz=class{constructor(){this.g=new _.S(Xy);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=qz(b.url||null));(this.a=pz(c))?(this.g.info("Loading thumbs configuration",b),this.m.one(_.Fe,()=>{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(hz(c)){this.a=new uz;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"}};_.z("clpp.thumbnails.ThumbnailsPlugin",vz);vz.prototype.get=vz.prototype.get;vz.Id="thumbnails";_.Nr(new class{create(){return new vz}});
|
|
19
|
+
var iz="SINGLE",jz="GRID",lz="WEBVTT",nz="BIF";};f.call(g, window);
|