@castlabs/prestoplay 6.6.1 → 6.7.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 +13 -1
- package/cjs/cl.adobe.js +3 -3
- package/cjs/cl.airplay.js +3 -3
- package/cjs/cl.broadpeak.js +6 -6
- package/cjs/cl.cast.js +110 -110
- package/cjs/cl.conviva.js +33 -33
- package/cjs/cl.core.js +423 -423
- package/cjs/cl.crypto.js +10 -10
- package/cjs/cl.dash.js +71 -71
- package/cjs/cl.externs.js +47 -41
- package/cjs/cl.freewheel.js +24 -24
- package/cjs/cl.hls.js +68 -49
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +31 -31
- package/cjs/cl.ima.js +24 -23
- package/cjs/cl.mse.js +263 -260
- package/cjs/cl.muxdata.js +11 -12
- package/cjs/cl.onboard.js +3 -3
- package/cjs/cl.persistent.js +14 -14
- package/cjs/cl.playlist.js +6 -6
- package/cjs/cl.smooth.js +71 -71
- package/cjs/cl.thumbnails.js +23 -23
- package/cjs/cl.tizen.js +71 -71
- package/cjs/cl.ttml.js +27 -27
- package/cjs/cl.verimatrix.js +5 -5
- package/cjs/cl.vimond.js +13 -13
- package/cjs/cl.vr.js +19 -19
- package/cjs/cl.vtt.js +14 -14
- package/cjs/cl.youbora.js +19 -19
- 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 +346 -344
- package/cl.crypto.js +8 -8
- package/cl.dash.js +67 -67
- package/cl.externs.js +47 -41
- package/cl.freewheel.js +19 -19
- package/cl.hls.js +57 -40
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +25 -25
- package/cl.ima.js +17 -16
- package/cl.mse.js +228 -228
- package/cl.muxdata.js +9 -8
- package/cl.onboard.js +4 -4
- package/cl.persistent.js +10 -10
- package/cl.playlist.js +5 -5
- package/cl.smooth.js +58 -59
- package/cl.thumbnails.js +17 -17
- 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 +15 -15
- package/cl.vtt.js +12 -12
- package/cl.youbora.js +14 -14
- package/package.json +1 -1
- package/typings.d.ts +108 -7
package/cl.muxdata.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
if(c){const
|
|
3
|
-
video_title:a.m&&a.m.name||"",player_name:_.oa,player_software_name:_.oa,player_software_version:_.da,player_mux_plugin_name:"CastlabsPlayer built-in Mux Plugin",player_mux_plugin_version:_.da};(a=a.l.getConfiguration().viewerId)&&(b.viewer_user_id=a);return b},
|
|
4
|
-
_.
|
|
5
|
-
(Math.random()*Math.pow(36,6)<<0).toString(36)).slice(-6);this.a=new _.uo;this.f=b;this.o=this.j=this.h=this.w=!1}initialize(a,b){this.g=a;this.m=b;this.w=!1;if(!this.h){try{this.h=!0,
|
|
6
|
-
this.o?this.f.debug(_.fa):(this.o=!0,this.h&&this.w&&
|
|
7
|
-
if(this.h&&(a=a.detail||null))if(10003===a.code)
|
|
8
|
-
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Ct=function(a){let b={debug:!0,data:Bt(a)};a.g&&a.g.muxOptionsOverride&&_.nf(a.g.muxOptionsOverride)&&(b=_.kf(b,a.g.muxOptionsOverride));b=_.kf(b,{getPlayheadTime:()=>1E3*a.l.getPosition(),getStateData:()=>{{a.f.debug("getStateData()");var c=a.l.getLoadedSource(),d=a.l.getTrackManager();const f=a.l.getSurface();var e={player_is_paused:a.l.isPaused(),player_is_fullscreen:f.isFullscreen(),video_source_duration:1E3*a.l.getDuration(),player_autoplay_on:!!a.l.getConfiguration().autoplay};
|
|
2
|
+
if(c){const k=new _.Kj(c.url);e.video_source_url=_.Ah(k);e.video_source_mime_type=c.type;c.name&&(e.video_title=c.name)}if(c=f.getContainer())e.player_width=c.offsetWidth,e.player_height=c.offsetHeight;(c=a.l.getSurface().getMedia())?c={videoWidth:c.videoWidth,videoHeight:c.videoHeight}:(c=a.l.getTrackManager().ia(),c={videoWidth:c.width,videoHeight:c.height});const {videoWidth:g,videoHeight:h}=c;a.f.debug(`Video dimensions: ${g}x${h}`);g&&h&&(e.video_source_height=g,e.video_source_width=h);(d=d.na())&&
|
|
3
|
+
d.language&&(e.player_language_code=d.language)}return e}});a.f.debug("Mux SDK options",b);return b},Dt=function(a,b,c){a.f.debug(`Event: ${b}`);a.A.emit(a.B,b,c)},Bt=function(a){const b={env_key:a.g.envKey,video_title:a.m&&a.m.name||"",player_name:_.oa,player_software_name:_.oa,player_software_version:_.da,player_mux_plugin_name:"CastlabsPlayer built-in Mux Plugin",player_mux_plugin_version:_.da};(a=a.l.getConfiguration().viewerId)&&(b.viewer_user_id=a);return b},Et=function(a){a.a.on(a.l,_.ve,()=>
|
|
4
|
+
{const b={player_playhead_time:1E3*a.l.getPosition()};Dt(a,_.ve,b)});a.a.on(a.l,_.Sd,()=>Dt(a,_.Sd));a.a.on(a.l,_.hc,a.C.bind(a));a.a.on(a.l,_.ke,a.G.bind(a));a.a.on(a.l,_.De,()=>Dt(a,_.fe));a.a.on(a.l,_.Ce,()=>Dt(a,_.ee));a.a.on(a.l,_.$c,a.F.bind(a));a.a.on(a.l,_.xb,()=>Dt(a,"adbreakstart"));a.a.on(a.l,_.yb,()=>Dt(a,"adbreakend"));a.a.on(a.l,_.Kb,()=>{Dt(a,"adplay");Dt(a,"adplaying")});a.a.on(a.l,_.Gb,()=>Dt(a,"adpause"));a.a.on(a.l,_.Ib,()=>{Dt(a,"adplay");Dt(a,"adplaying")});a.a.on(a.l,_.Lb,()=>
|
|
5
|
+
Dt(a,"adended"));a.a.on(a.l,_.Cb,()=>Dt(a,"adfirstquartile"));a.a.on(a.l,_.Fb,()=>Dt(a,"admidpoint"));a.a.on(a.l,_.Mb,()=>Dt(a,"adthirdquartile"))},Ft=class{constructor(a,b){this.l=a;this.m=this.g=null;this.B=("000000"+(Math.random()*Math.pow(36,6)<<0).toString(36)).slice(-6);this.a=new _.uo;this.f=b;this.o=this.j=this.h=this.w=!1;this.A=null}initialize(a,b,c){this.g=a;this.m=b;this.A=c;this.w=!1;if(!this.h){try{this.h=!0,this.A.init(this.B,Ct(this))}catch(d){throw this.h=!1,_.Nf(this.a),new _.H(1,
|
|
6
|
+
9,9302,null,d);}Dt(this,"playerready")}this.j&&!this.o&&(a=Bt(this),Dt(this,"videochange",a),this.j=!1);Et(this)}release(){this.f.debug("release()");this.j?this.f.debug(_.ha):(_.Nf(this.a),this.j=!0,this.m=this.g=null)}destroy(){this.f.debug(_.Oc);this.o?this.f.debug(_.fa):(this.o=!0,this.h&&this.w&&Dt(this,"viewend"),Dt(this,"destroy"))}C(a){this.f.debug(_.Cd);var b=a.detail;a=this.l.getTrackManager();b&&b.bandwidth&&(b=b.bandwidth,(a=a.Da())&&a.bandwidth&&(b+=a.bandwidth),Dt(this,"renditionchange",
|
|
7
|
+
{video_source_bitrate:b}))}G(a){this.f.debug(_.Gd);switch(a.detail.currentState){case _.Ql:this.l.getConfiguration().autoplay&&Dt(this,_.Sd);break;case _.Sl:Dt(this,_.Td);break;case _.Rl:Dt(this,_.Od);break;case _.Hl:this.w=!0,Dt(this,_.Zc)}}F(a){this.f.debug(_.Dd);if(this.h&&(a=a.detail||null))if(10003===a.code)Dt(this,"aderror");else if(a.severity===_.G){var b=a.message||"Player error";if(1===a.category||6100===a.code||6007===a.code)b="Download error",6100===a.code?b="Certificate request error":
|
|
8
|
+
6007===a.code&&(b="License request error"),b=`${b} castlabs-error-data:${JSON.stringify(a.data)}`;Dt(this,_.$c,{player_error_code:a.code,player_error_message:b})}}};var Gt=class extends _.kq{constructor(){super();this.f=null;this.a=!1;this.g=new _.O("clpp.muxdata")}onPlayerCreated(a){this.f=new Ft(a,this.g)}onContentWillLoad(a,b){var c=a.getConfiguration();var d=null;(this.a=!_.B(c.muxdata)&&typeof c.muxdata===_.Bd)?(c=c.muxdata,d=c.muxLib,d="undefined"!==typeof d&&typeof d.init===_.bd&&typeof d.emit===_.bd?c.muxLib:window.mux,"undefined"===d&&(this.g.warn("Mux SDK is not loaded. Will do nothing."),this.a=!1,c=new _.H(1,9,9301),this.T(a,c))):this.g.warn("Mux plugin is loaded but not configured. Will do nothing.");
|
|
9
|
+
if(this.a){c=a.getConfiguration();c=_.lf(c.muxdata||{});try{{const e=[];typeof c===_.Bd&&(c.envKey||e.push("envKey"));if(0<e.length)throw new _.H(1,9,9300,{missingKeys:e});}this.f.initialize(c,b,d)}catch(e){this.a=!1,this.T(a,e)}}}onContentLoaded(){}onPlayerWillDestroy(){this.a&&(this.f.destroy(),this.f=null)}onPlayerWillRelease(){this.a&&this.f.release()}id(){return"mux"}T(a,b){a.trigger(new _.F(_.$c,{detail:b}))}};_.z("clpp.muxdata.MuxDataPlugin",Gt);Gt.Id="mux";_.Sm(new class{create(){return new Gt}});};f.call(g, window);
|
package/cl.onboard.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
certificateUrl:b,modifiers:{licenseRequest:_.bk,licenseResponse:_.ck,extractContentId:_.dk,certificateRequest:_.ek}});a.
|
|
3
|
-
_.
|
|
4
|
-
_.
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var At=function(a,b){let c=b.baseUrl;_.Ng(c,"/")||(c+="/");const d=g=>g&&(_.Mg(g,"https://")||_.Mg(g,"http://")||_.Mg(g,"//"))?g:`${c}${g}`,e=d(b.widevineUrl||"widevine"),f=d(b.playreadyUrl||"playready");b=d(b.fairplayUrl||"fairplay");a=new _.hp(a);a.Ia(_.Kc,{licenseUrl:e,videoRobustness:[_.fb,void 0],audioRobustness:[_.eb,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:_.Yj,licenseResponse:_.Zj}});a.Ia(_.Ic,{licenseUrl:b,
|
|
2
|
+
certificateUrl:b,modifiers:{licenseRequest:_.bk,licenseResponse:_.ck,extractContentId:_.dk,certificateRequest:_.ek}});a.Ia(_.Jc,{licenseUrl:f,modifiers:{licenseRequest:_.Yj}});_.nj(a)};
|
|
3
|
+
_.z("clpp.onboard.OnboardComponent",class extends _.Mp{constructor(){super();this.l=null;this.h=new _.O("clpp.onboard")}f(a){this.l=a}a(){this.l=null}g(){var a=this.l.getConfiguration().drm,b;if(b=!(!a||!a.env))b=a&&a.customData,b=!(!b||!b.baseUrl);b&&(b=a.env,a=a.customData,a={baseUrl:a.baseUrl,widevineUrl:a.widevineUrl,playreadyUrl:a.playreadyUrl,fairplayUrl:a.fairplayUrl},this.h.info(`Registering the DRMtoday Onboard environment, name='${b}'`),At(b,a))}release(){}id(){return"onboard"}});
|
|
4
|
+
_.z("clpp.onboard.register",At);};f.call(g, window);
|
package/cl.persistent.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
audioRobustness:"",videoRobustness:"",serverCertificate:d,initData:null,keyIds:null}]});return _.Tk(a,g)},
|
|
3
|
-
d.drm=a;a=new _.am({
|
|
4
|
-
licenseServerUri:h.licenseServerUri,serverCertificate:h.serverCertificate,audioCapabilities:[],videoCapabilities:k,drmConfig:a};yield d.store(e,f)}catch(h){throw
|
|
5
|
-
f=JSON.stringify(b.videoCapabilities);c=JSON.stringify({sessionIds:c,keySystem:b.keySystem,licenseServerUri:encodeURIComponent(b.licenseServerUri),serverCertificate:d,audioCapabilities:e,videoCapabilities:f,drmConfig:JSON.stringify(b.drmConfig)})}window.localStorage.setItem(encodeURIComponent(a),btoa(c))})}get(a){return _.
|
|
6
|
-
f=JSON.parse(b.serverCertificate),g=JSON.parse(b.drmConfig);b={sessionIds:c,keySystem:b.keySystem,licenseServerUri:decodeURIComponent(b.licenseServerUri),serverCertificate:f?new Uint8Array(f):null,audioCapabilities:d,videoCapabilities:e,drmConfig:g}}}else b=null;return b})}delete(a){return _.
|
|
7
|
-
_.
|
|
8
|
-
const l=yield k.start(f.url,{networkingEngine:d,filterAllPeriods:()=>{},filterNewPeriod:()=>{},onTimelineCueAdded:()=>{},onEvent:()=>{},onError:()=>{}});if(!l.periods.length)throw e(null,new _.
|
|
9
|
-
_.
|
|
10
|
-
new _.
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var lt="A persistent DRM session already exists for: ",mt="No DRM configuration.",nt="clpp.persistent",ot=function(a,b){const c=[];for(const d of a)c.push(b(d));return c},qt=function(a,b){a.H=pt;a.I=[];a.C=!0;return _.Uk(a,b)},st=function(a,b,c,d,e,f){a.H=rt;const g=new Map,h=_.Ik(b);g.set(h,{audioCapabilities:e,videoCapabilities:f,distinctiveIdentifier:_.Id,persistentState:_.be,sessionTypes:[_.Qd],label:h,drmInfos:[{keySystem:b,licenseServerUri:c,distinctiveIdentifierRequired:!1,persistentStateRequired:!0,
|
|
2
|
+
audioRobustness:"",videoRobustness:"",serverCertificate:d,initData:null,keyIds:null}]});return _.Tk(a,g)},tt=function(a,b){return _.y(function*(){const c=yield _.kl(a,b);if(c){var d=[],e=a.g.get(c);e&&a.A&&(e.kb=new _.Xk,d.push(e.kb));a.a.debug("Attempting to remove session",b);d.push(c.remove());return Promise.all(d)}a.a.debug("Ignoring attempt to remove missing session",b)})},ut=function(a){a=a.g.keys();a=ot(a,b=>b.sessionId);return Array.from(a)},vt=function(a,b){const c=_.pj(a),d=_.cj({drm:a});
|
|
3
|
+
d.drm=a;a=new _.am({wb:b,onError:()=>{},Od:()=>{},onExpirationUpdated:()=>{},onEvent:()=>{},getConfiguration:()=>d,rc:()=>null});a.h=c;return a},yt=function(a,b,c){return _.y(function*(){const d=wt;if(a){var e=a.offlineId;if(0!==e.length){var f=yield d.get(e);if(f)xt.debug(lt,e);else{var g=vt(a,c);try{yield qt(g,b);yield _.il(g);yield _.ll(g);const h=g.getDrmInfo(),k=b.map(l=>({contentType:_.Vh(l.video.mimeType,l.video.codecs),robustness:h.videoRobustness}));f={sessionIds:ut(g),keySystem:h.keySystem,
|
|
4
|
+
licenseServerUri:h.licenseServerUri,serverCertificate:h.serverCertificate,audioCapabilities:[],videoCapabilities:k,drmConfig:a};yield d.store(e,f)}catch(h){throw xt.error("Error while persisting DRM session"),new _.H(1,6,6200,null,h);}finally{yield g.destroy()}}}}else xt.debug(mt)})},pt=1,rt=2,zt=class{store(a,b){return _.y(function*(){{var c=JSON.stringify(b.sessionIds);var d=b.serverCertificate?Array.from(b.serverCertificate):null;d=JSON.stringify(d);const e=JSON.stringify(b.audioCapabilities),
|
|
5
|
+
f=JSON.stringify(b.videoCapabilities);c=JSON.stringify({sessionIds:c,keySystem:b.keySystem,licenseServerUri:encodeURIComponent(b.licenseServerUri),serverCertificate:d,audioCapabilities:e,videoCapabilities:f,drmConfig:JSON.stringify(b.drmConfig)})}window.localStorage.setItem(encodeURIComponent(a),btoa(c))})}get(a){return _.y(function*(){var b=window.localStorage.getItem(encodeURIComponent(a));if(b){{b=JSON.parse(atob(b));const c=JSON.parse(b.sessionIds),d=JSON.parse(b.audioCapabilities),e=JSON.parse(b.videoCapabilities),
|
|
6
|
+
f=JSON.parse(b.serverCertificate),g=JSON.parse(b.drmConfig);b={sessionIds:c,keySystem:b.keySystem,licenseServerUri:decodeURIComponent(b.licenseServerUri),serverCertificate:f?new Uint8Array(f):null,audioCapabilities:d,videoCapabilities:e,drmConfig:g}}}else b=null;return b})}delete(a){return _.y(function*(){window.localStorage.removeItem(encodeURIComponent(a))})}clear(){return _.y(function*(){window.localStorage.clear()})}getName(){return"clpp.persistent.SimpleSessionStorage"}};_.z("clpp.persistent.useStorage",function(a){{var b=["store","get","delete","clear","getName"];const c=[];_.B(a)||(_.of(a.store)||c.push("store"),_.of(a.get)||c.push("get"),_.of(a.delete)||c.push("delete"),_.of(a.clear)||c.push("clear"),_.of(a.getName)||c.push("getName"),b=c)}if(0<b.length)throw xt.warn("Invalid session storage implementation"),new _.H(1,6,6202,{missingMethods:b});wt=a});
|
|
7
|
+
_.z("clpp.persistent.fetchLicense",function(a,b,...c){return _.y(function*(){var d=wt,e=(l,m)=>new _.H(1,6,6200,l,m);const f=_.Vl(a).shift();if(!f)throw e("No source specified.");if(!b)throw e(mt);var g=b.offlineId;if(typeof g!==_.ne||!g.length)throw e("Missing offline id.");if(yield d.get(g))xt.debug(lt,g);else{var h=_.cj();d=new _.Pm;g=[];for(var k of c){const l=new k;_.fj(l.id())||(l.f(null),_.hj(l),g.push(l))}k=null;try{k=yield _.Hn(f.url,d,h.manifest.attemptParameters,f.type||null);k.configure(h.manifest);
|
|
8
|
+
const l=yield k.start(f.url,{networkingEngine:d,filterAllPeriods:()=>{},filterNewPeriod:()=>{},onTimelineCueAdded:()=>{},onEvent:()=>{},onError:()=>{}});if(!l.periods.length)throw e(null,new _.H(_.G,4,4014));const m=_.Fn(l.periods);yield yt(b,m,d)}catch(l){if(l instanceof _.H&&6200===l.code)throw l;throw e(null,l);}finally{for(;g.length;)e=g.shift(),e.a(),_.ej.delete(e.id());e=[];k&&e.push(k.stop());e.push(d.destroy());yield Promise.all(e)}}})});
|
|
9
|
+
_.z("clpp.persistent.removeLicense",function(a){return _.y(function*(){var b=wt;if(_.qf(a)&&0!==a.length){var c=null,d=null;try{const e=yield b.get(a);e?(e.drmConfig.delayLicenseRequestUntilPlayed=!0,d=new _.Pm,c=vt(e.drmConfig,d),yield st(c,e.keySystem,e.licenseServerUri,e.serverCertificate,e.audioCapabilities,e.videoCapabilities),yield _.il(c),yield Promise.all(e.sessionIds.map(f=>_.y(function*(){yield tt(c,f);xt.debug("successfully removed session with id",f)}))),yield b.delete(a)):xt.debug("No persistent DRM session found")}catch(e){throw xt.error("Failed to remove session"),
|
|
10
|
+
new _.H(1,6,6201,null,e);}finally{b=[],c&&b.push(c.destroy()),d&&b.push(d.destroy()),yield Promise.all(b)}}else xt.warn("Invalid offlineId")})});var wt=new zt,xt=new _.O(nt);_.z("clpp.persistent.PersistentLicenseComponent",class extends _.Mp{constructor(){super();this.l=null;this.j=wt;this.h=new _.O(nt)}f(a){this.l=a}a(){this.l=null}release(){}g(){this.j=wt}id(){return _.Pd}o(a,b,c){const d=this;return _.y(function*(){if(a)try{yield yt(a,b,c),d.l.trigger(new _.F(_.Tc,{offlineId:a.offlineId}))}catch(e){d.l.onError(e)}else d.h.debug("No DRM configuration found for loaded source.")})}m(a){const b=this;return _.y(function*(){try{const c=yield b.j.get(a);if(c)return c.sessionIds;
|
|
11
11
|
b.h.debug(`No offline session found for ${a}`);return[]}catch(c){return b.h.warn("Error while loading session info from storage"),[]}})}});};f.call(g, window);
|
package/cl.playlist.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
this.a.length&&
|
|
3
|
-
c.trigger(new _.
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var it=function(a,b){return 0<=b&&b<a.a.length},jt=function(a){a.trigger(new _.F(_.Vd))},kt=class extends _.cp{on(a,b,c){return super.on(a,b,c)}one(a,b,c){return super.one(a,b,c)}off(a,b){return super.off(a,b)}constructor(a,b){b=void 0===b?()=>Promise.resolve():b;super();this.l=a;this.j=b;this.f=0;this.a=[];this.g=!1;this.h=this.Ee.bind(this)}getPosition(){return this.f}Ff(){return this.a}ud(){return 0<this.a.length&&it(this,this.f)?this.a[this.f]:null}Gf(){const a=this.f+1;return 0<
|
|
2
|
+
this.a.length&&it(this,a)?this.a[a]:null}Nf(){return this.g}start(){this.g||(this.g=!0,this.l.on(_.Zc,this.h),this.Yc(this.f,!0))}stop(){this.g=!1;this.l.off(_.Zc,this.h)}Ee(){this.next()}next(){const a=this;return _.y(function*(){yield a.Yc(Math.min(a.a.length-1,a.f+1))})}$f(){const a=this;return _.y(function*(){yield a.Yc(Math.max(0,a.f-1))})}Yc(a,b){b=void 0===b?!1:b;const c=this;return _.y(function*(){if(0<c.a.length&&it(c,a)&&(b||c.f!==a)){c.f=a;var d=c.ud();d&&(yield c.j(d),yield c.l.load(d.configuration),
|
|
3
|
+
c.trigger(new _.F(_.Ud,{item:d})))}})}append(a){this.a.push(a);jt(this)}Mf(a,b){if(0<=b&&b<=this.a.length){const c=this.ud();this.a.splice(b,0,a);c&&(this.f=this.a.indexOf(c));jt(this)}}remove(a){if(0<this.a.length&&it(this,a)){if(this.f===a)throw Error("Can't remove the current item");this.a.splice(a,1);jt(this)}}clear(){this.stop();this.f=0;this.a=[];this.g=!1;jt(this)}};_.z("clpp.Playlist",kt);kt.prototype.clear=kt.prototype.clear;kt.prototype.remove=kt.prototype.remove;kt.prototype.insert=kt.prototype.Mf;
|
|
4
|
+
kt.prototype.append=kt.prototype.append;kt.prototype.goTo=kt.prototype.Yc;kt.prototype.previous=kt.prototype.$f;kt.prototype.next=kt.prototype.next;kt.prototype.onEnded=kt.prototype.Ee;kt.prototype.stop=kt.prototype.stop;kt.prototype.start=kt.prototype.start;kt.prototype.isStarted=kt.prototype.Nf;kt.prototype.getUpcoming=kt.prototype.Gf;kt.prototype.getCurrent=kt.prototype.ud;kt.prototype.getQueue=kt.prototype.Ff;kt.prototype.getPosition=kt.prototype.getPosition;kt.prototype.off=kt.prototype.off;
|
|
5
|
+
kt.prototype.one=kt.prototype.one;kt.prototype.on=kt.prototype.on;};f.call(g, window);
|
package/cl.smooth.js
CHANGED
|
@@ -1,59 +1,58 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
b,a.g),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 _.
|
|
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 _.Oj(b)},
|
|
7
|
-
|
|
8
|
-
(a=(new
|
|
9
|
-
|
|
10
|
-
0<l-k.reader.getPosition()&&k.flags&32&&(m.m=_.
|
|
11
|
-
2048&&(0===k.version?m.h.push(_.
|
|
12
|
-
t.
|
|
13
|
-
g;d=g.get(_.qd);if(a.request.contentType===_.
|
|
14
|
-
A;
|
|
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.g[m].
|
|
16
|
-
periodId:null}},
|
|
17
|
-
c.type=1;c=yield a.D.networkingEngine.fetch(c).P;a.m=c.uri;return c})},
|
|
18
|
-
1E7;let g=+
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
new _.
|
|
24
|
-
tracks:
|
|
25
|
-
var
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
this.
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
0
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
`segment reference time ${a.request.startTime}`);f=tG(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)}},JG={video:_.Je,audio:_.ec,text:_.Yb},BG="VOD",AG="LIVE",KG={bg:"caption",cg:_.fu};_.x("clpp.smooth.SmoothComponent",class extends _.Lp{constructor(){super()}f(){_.Kn.ism=$G;_.In[_.Zb]=$G}a(){_.jv("ism");_.kv(_.Zb)}id(){return"smooth"}});};f.call(g, window);
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var hG="Full MP4 box must have flags defined",iG="clpp.smooth.SmoothMP4Processor",jG="codecPrivateData",kG=function(a,b){const c=Math.floor(b/Math.pow(2,32));b-=c*Math.pow(2,32);_.M(a,c);_.M(a,b)},lG=function(a,b){try{a.f.setUint8(a.a,b),a.a+=1}catch(c){_.tj()}},mG=function(a,b){lG(a,b>>16&255);lG(a,b>>8&255);lG(a,b&255)},nG=function(a,b){try{a.f.setUint16(a.a,b,a.g),a.a+=2}catch(c){_.tj()}},oG=function(a,b){try{a.f.setInt32(a.a,b,a.g),a.a+=4}catch(c){_.tj()}},pG=function(a,b){try{a.f.setInt16(a.a,
|
|
2
|
+
b,a.g),a.a+=2}catch(c){_.tj()}},qG=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},rG=function(a){const b=a.split("/");return b[b.length-1].toLowerCase().match("manifest(\\(.+\\))?")?a:`${a}/Manifest`},sG=function(a,b,c,d){c=b.te[c];b=b.og;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 _.yu([a],[b])[0]},tG=function(a,b){if(a.type!==b.type)return!1;let c=[];a.type===_.w?c=["maxWidth","maxHeight","bitrate",jG,"fourCC"]:a.type===_.p&&(c=["bitrate",jG,"channels","bitsPerSample","samplingRate","fourCC"]);return _.sf(a,b,c,["id","segmentIndex"])},uG=function(a,b,c){const d=c.Tc.split("00000001");a={id:1,type:c.type,duration:a/b,timescale:b,Ja:null,Lb:null,width:NaN,height:NaN,Db:null,Lc:NaN,
|
|
4
|
+
sampleSize:NaN,channelCount:NaN};switch(c.type){case _.w:a.Ja=[_.Yg(d[1])];a.Lb=[_.Yg(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.p:a.Db=_.Yg(c.Tc),a.sampleSize=c.gf||16,a.Lc=c.Lc,a.channelCount=c.ne}return a},vG=function(a,b){return a.filter(c=>c.type===b)},wG=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)},DG=function(a,b,c){var d=null;if(xG.test(a)){{a=xG.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 yG.test(a)?d=wG(yG,a):zG.test(a)?d=wG(zG,a):AG.test(a)?(a=AG.exec(a),d=Number(a[1])/c.frameRate):BG.test(a)?(a=BG.exec(a),d=Number(a[1])/c.a):CG.test(a)&&(d=wG(CG,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},EG=function(a){let b=
|
|
6
|
+
0;for(let c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.Oj(b)},LG=function(a,b,c){a:{var d=[_.Kc,_.Jc];for(e of d)if((d=c.Wc(e))&&d.keyId){var e=d.keyId;break a}_.C(iG,"Could not get default Key ID for DRM init data!");e=null}c=new FG("xxxx");a.type===_.w?c=new GG(a.width,a.height):c=new HG(a.channelCount,a.sampleSize,a.Lc);a=new IG;a.g=1;a.h=8;a.m=e||"00000000000000000000000000000000";a=(new FG("schi")).append([a]);b=(new FG(_.he)).append([new JG(b),new KG(_.tc,65536),a]);c.append([b]);return c},
|
|
7
|
+
nH=function(a,b){var c=b.$c(),d=new MG(a.timescale,a.duration,a.id),e=(new NG).append([new OG(a.id)]),f=new PG(a.id,a.duration,a.timescale,a.width,a.height),g=new QG(a.timescale,a.duration);const h=new RG(a.type);var k=null,l=new SG;l.entries=[new TG];var m=new UG;switch(a.type){case _.w:k=new VG(a.Ja,a.Lb);c?(a=LG(a,"avc1",b),a.append([k]),m.entries=[a]):(a=(new WG(a.width,a.height)).append([k]),m.entries=[a]);k=new XG;break;case _.p:k=new YG(a.Db),c?(a=LG(a,"mp4a",b),a.append([k]),m.entries=[a]):
|
|
8
|
+
(a=(new ZG(a.channelCount,a.sampleSize,a.Lc)).append([k]),m.entries=[a]),k=new $G}m=(new aH).append([m,new bH,new cH,new dH,new eH]);l=(new fH).append([l]);l=(new gH).append([k,l,m]);g=(new hH).append([g,h,l]);f=(new iH).append([f,g]);d=(new jH).append([d,f,e]);e=new kH("dash",0,["iso6","mp41","avc1"]);c&&(c=b.Wc(_.Jc),b=b.Wc(_.Kc),c&&d.append([new lH("pssh",c.initData,8)]),b&&d.append([new lH("pssh",b.initData,8)]),c||b||_.C(iG,"Could not get PSSH init data!"));b=new mH([e,d]);return _.I(b.write())},
|
|
9
|
+
xH=function(a,b){let c,d,e,f,g,h;(new _.Mj).L("moof",_.Fj).Y("mfhd",k=>{{const l=new oH;l.g=_.N(k.reader);c=l}}).L("traf",_.Fj).Y("tfhd",k=>{{const l=k.reader.za();if(null===k.flags)throw new _.H(_.G,3,3019,hG);const m=new pH(k.version||0,k.flags||0);m.g=_.N(k.reader);0<l-k.reader.getPosition()&&k.flags&1&&(m.h=_.Bj(k.reader));0<l-k.reader.getPosition()&&k.flags&2&&(m.A=_.N(k.reader));0<l-k.reader.getPosition()&&k.flags&8&&(m.j=_.N(k.reader));0<l-k.reader.getPosition()&&k.flags&16&&(m.o=_.N(k.reader));
|
|
10
|
+
0<l-k.reader.getPosition()&&k.flags&32&&(m.m=_.N(k.reader));d=m}}).Y("trun",k=>{{var l=k.reader.za();if(null===k.flags)throw new _.H(_.G,3,3019,hG);const m=new qH(k.version||0,k.flags||0);m.g=_.N(k.reader);0<l-k.reader.getPosition()&&k.flags&1&&(m.j=_.zj(k.reader));0<l-k.reader.getPosition()&&k.flags&4&&(m.m=_.N(k.reader));if(0<l-k.reader.getPosition())for(l=0;l<m.g;l++)k.flags&256&&m.o.push(_.N(k.reader)),k.flags&512&&m.sampleSize.push(_.N(k.reader)),k.flags&1024&&m.A.push(_.N(k.reader)),k.flags&
|
|
11
|
+
2048&&(0===k.version?m.h.push(_.N(k.reader)):m.h.push(_.zj(k.reader)));e=m}}).Y("sdtp",k=>{{const l=_.Cj(k.reader,k.reader.za());f=new rH("sdtp",k.version||0,k.flags||0,l,0)}}).L("uuid",k=>{var l=_.Cj(k.reader,16);if(_.$g(l,sH)){l=_.N(k.reader);k.version=l>>>24;k.flags=l&16777215;l=new tH(k.version,k.flags);l.h=_.N(k.reader);k.flags&1&&(l.j=_.xj(k.reader));for(let m=0;m<l.h;m++){const n={xe:_.Cj(k.reader,8),xc:0,Zd:[]};if(k.flags&2){n.xc=_.yj(k.reader);for(let q=0;q<n.xc;q++){const t={le:0,me:0};
|
|
12
|
+
t.le=_.yj(k.reader);t.me=_.N(k.reader);n.Zd.push(t)}}l.g.push(n)}g=l}}).L(_.qd,k=>{{const l=new uH;0<k.reader.za()?l.g=_.Cj(k.reader,k.reader.za()):(_.C(iG,"mdat box is empty!"),l.g=new Uint8Array(0));h=l}}).parse(a,!1);if(!h)return null;a=(new vH).append([d,e]);f&&a.append([f]);b.$c()&&g&&a.append([g]);b=(new wH).append([c,a]);return new mH([b,h])},CH=function(a,b,c,d){var e=d.$c(),f=parseInt(c*b,10);b=a.data||new ArrayBuffer(0);var g=xH(b,d);if(null===g)return a.request.contentType===_.v?a.data:
|
|
13
|
+
g;d=g.get(_.qd);if(a.request.contentType===_.v){e=d.g.buffer;if(c){e=_.Ig(e);if((e=(new DOMParser).parseFromString(e,_.ue))&&"tt"===e.documentElement.tagName.toLowerCase())var h=e.documentElement;if(h&&(d=new yH(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 t=0,u=f.length;t<u;t++){h=f[t];a=c;b=d;g=["begin",_.Yc];for(let x=0,A=g.length;x<
|
|
14
|
+
A;x++){b:{var k=h;var l=g[x],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 q=l[n].name;if(q=q.match(m)){k=k.getAttribute(q[0]);break b}}k=null}h.setAttribute(g[x],DG(k||"",a,b))}}}e=(new XMLSerializer).serializeToString(e);c=_.Jg(e).buffer}else c=e;return c}h=new wH;a=g.get("mfhd");b=new vH;k=g.get("tfhd");m=new zH(1,f);f=g.get("trun");n=g.get("sdtp");c=g.get("senc");k.g=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.g[m].xc);else g=8;b.append([c,new AH,new BH(g,k,c.h)])}h.append([a,b]);f.flags|=1;f.j=h.a()+8;d=new mH([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},DH=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,
|
|
16
|
+
periodId:null}},EH=function(a){return{initData:_.pu(_.uk(a)),initDataType:_.tc,keyId:a,periodId:null}},FH=function(a,b,c){a=_.Ck(a);c&&a.version!==c&&(a=_.ru(a,c));return{initData:_.pu(a),initDataType:_.tc,keyId:b,periodId:null}},GH=function(a,b){return _.y(function*(){var c=_.kh(b);c.timeout=a.g.attemptParameters.timeout;c.maxAttempts=Math.max(a.g.attemptParameters.maxAttempts,b.length);c.baseDelay=a.g.attemptParameters.baseDelay;c.backoffFactor=a.g.attemptParameters.backoffFactor;c.fuzzFactor=a.g.attemptParameters.fuzzFactor;
|
|
17
|
+
c.type=1;c=yield a.D.networkingEngine.fetch(c).P;a.m=c.uri;return c})},OH=function(a,b){let c=null;try{{const qa=new DOMParser;let jb,Ma;try{const cb=_.Ig(b);Ma=qa.parseFromString(cb.trim(),_.ue)}catch(cb){throw cb;}Ma&&Ma.documentElement.tagName==_.kb&&(jb=Ma.documentElement);c=jb&&0<jb.getElementsByTagName("parsererror").length?null:jb}}catch(qa){}if(!c)throw a.a.error("Unable to parse manifest"),new _.H(_.G,4,4033,a.m);const d=+HH(a,c,"MajorVersion"),e=+HH(a,c,"MinorVersion"),f=+c.getAttribute("TimeScale")||
|
|
18
|
+
1E7;let g=+HH(a,c,"Duration");const h="TRUE"===c.getAttribute("IsLive"),k=+c.getAttribute("LookAheadCount"),l=+c.getAttribute("DVRWindowLength")||Infinity,m=_.ok(c,"Protection")[0];if(!1===/^[2].[0-2]$/.test(""+d+"."+e))throw a.a.error("Smooth Streaming version must be 2.0, 2.1 or 2.2"),new _.H(_.G,4,4036,a.m);h?(IH(a,JH),a.A=typeof a.g.liveRefreshPeriod===_.r?1E3*a.g.liveRefreshPeriod:Math.min(1E3*a.H,1E4),g=Infinity):IH(a,KH);a.f={startTime:0,delay:0,duration:g/f,qd:l/f,Gc:0};if(m){{var n=a.g.playreadyVersion;
|
|
19
|
+
const qa=[],jb=_.ok(m,"ProtectionHeader")[0],Ma=_.Xg(_.qk(jb)||""),cb=_.Ck(Ma).a;qa.push(DH(_.Kc,EH(cb),[cb]));qa.push(DH(_.Jc,FH(Ma,cb,n),[cb]));var q=qa}a.o=q}{const qa=[],jb=_.ok(c,"StreamIndex");if(!jb.length)throw a.a.error("No streams found!"),new _.H(_.G,4,4034,a.m);for(let Ma=0;Ma<jb.length;Ma++){{var t=a,u=jb[Ma];const cb=HH(t,u,"Type"),kc=+u.getAttribute("Chunks"),Ug=u.getAttribute("Subtype"),He=_.sg(u.getAttribute("Language")||_.ye),Md=u.getAttribute("Name")||"",Vg=+u.getAttribute(_.La),
|
|
20
|
+
Bf=+u.getAttribute(_.Ka),Cf=HH(t,u,"Url"),Ek=+u.getAttribute("TimeScale")||null;{const lc=[],si=_.ok(u,_.Ya);for(let Nd=0;Nd<si.length;Nd++){{let mc,Ia,hd;var x=t,A=si[Nd],E=cb;const ti=+A.getAttribute("Index"),Df=+HH(x,A,"Bitrate");let Rb=NaN,Ef=NaN,Fk=NaN,Fp=NaN,kz=NaN,lz=NaN,mz=NaN;const nz=A.getAttribute("FourCC");switch(E){case _.w:Rb=+HH(x,A,_.Ka);Ef=+HH(x,A,_.La);break;case _.p:Fp=+A.getAttribute("Channels")||2,Fk=+HH(x,A,"SamplingRate"),lz=+HH(x,A,"AudioTag"),kz=+HH(x,A,"BitsPerSample"),mz=
|
|
21
|
+
+HH(x,A,"PacketSize")}let Gp=String(A.getAttribute("CodecPrivateData"));if(E===_.p&&!Gp){{var D=Fp;const oz={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},Gk=oz[Fk];if("AACH"===nz){Ia=new Uint8Array(4);const pz=oz[2*Fk];Ia[0]=40|Gk>>1;Ia[1]=Gk<<7|D<<3|pz>>1;Ia[2]=pz<<7|8;Ia[3]=0;mc=new Uint16Array(2);mc[0]=(Ia[0]<<8)+Ia[1];mc[1]=(Ia[2]<<8)+Ia[3];hd=mc[0].toString(16)+mc[1].toString(16)}else Ia=new Uint8Array(2),Ia[0]=16|Gk>>1,Ia[1]=Gk<<7|D<<3,mc=
|
|
22
|
+
new Uint16Array(1),mc[0]=(Ia[0]<<8)+Ia[1],hd=mc[0].toString(16);Gp=hd.toUpperCase()}}var X={id:x.W++,type:E,index:ti,bitrate:Df,Tc:Gp,maxHeight:Rb,maxWidth:Ef,Lc:Fk,ne:Fp,xg:lz,gf:kz,Ig:mz,yf:nz,segmentIndex:null}}lc.push(X)}var na=lc}{const lc=[],si=_.ok(u,"c");for(let Nd=0;Nd<si.length;Nd++){const mc=si[Nd];let Ia=parseInt(mc.getAttribute("t"),10),hd=parseInt(mc.getAttribute("d"),10),ti=parseInt(mc.getAttribute("r"),10),Df=0;if(isNaN(Ia)&&isNaN(hd))throw t.a.error("Either one or both FragmentDuration and FragmentTime field MUST be present in StreamFragmentElement"),
|
|
23
|
+
new _.H(_.G,4,4037,t.m);0===Nd&&isNaN(Ia)&&(Df=Ia=0);if(0<Nd){const Rb=lc[lc.length-1];Df=Rb.n+1;Rb.d||(Rb.d=Ia-Rb.t);Ia||(Ia=Rb.t+Rb.d);hd||(hd=Ia-Rb.t)}lc.push({n:Df,d:hd,t:Ia});if(ti){ti--;for(let Rb=0;Rb<ti;Rb++){const Ef=lc[lc.length-1];Df=Ef.n+1;Ia=Ef.t+Ef.d;hd=Ef.d;lc.push({n:Df,d:hd,t:Ia})}}}t.C()||lc.length===kc||t.a.warn("Number of fragments ("+kc+") differs from number of chunks ("+lc.length+").");var tb=lc}var Jd={type:cb,Ag:kc,jg:Ug,language:He,name:Md,maxWidth:Vg,maxHeight:Bf,og:Cf,
|
|
24
|
+
tracks:na,te:tb,timescale:Ek}}qa.push(Jd)}var Pb=qa}const Qa={Hg:d,Ae:e,timescale:f,duration:g,isLive:h,Gg:k,qd:l,zd:!1,streams:Pb};if(a.h&&a.w)return LH(a,Qa),Promise.resolve();a.G.clear();{const qa=Qa.timescale,jb=Qa.duration,Ma=vG(Qa.streams,_.p),cb=vG(Qa.streams,_.w),kc=vG(Qa.streams,_.v),Ug=[];let He=MH(a,jb,qa,Ma),Md=MH(a,jb,qa,cb);const Vg=MH(a,jb,qa,kc);He.length||(He=[null]);Md.length||(Md=[null]);for(let Bf=0;Bf<Md.length;Bf++)for(let Cf=0;Cf<He.length;Cf++)Ug.push(NH(a,Md[Bf],He[Cf]));
|
|
25
|
+
var Fe={startTime:0,variants:Ug,textStreams:Vg,thumbStreams:[]}}{var bb=Qa.streams;let qa=a.f.startTime,jb=a.f.delay;const Ma=a.I;let cb=Math.min(a.f.duration||Infinity,Ma);const kc=a.C(),Ug=a.f.qd,He=a.f.Gc,Md=a.H,Vg=isFinite(a.F)?a.F:0;if(kc)cb=Infinity,qa=Date.now()/1E3-He,a.f.startTime=qa,jb=3*Md;else{const Bf=isFinite(Ma)?Ma:a.f.duration;for(const Cf of bb)for(const Ek of Cf.tracks)Ek.segmentIndex.offset(-Vg),_.kv(Ek.segmentIndex,Bf)}a.B=new _.Gz(qa,jb,!kc,!0);a.B.f=cb;_.Yu(a.B,Md);a.B.j=Ug;
|
|
26
|
+
kc||a.B.offset(-Vg)}a.D.filterAllPeriods([Fe]);a.h={presentationTimeline:a.B,periods:[Fe],offlineSessionIds:[],minBufferTime:0};Promise.resolve();a.K||(a.D.networkingEngine.hd(a.M),a.K=!0);a.w=Qa;return Promise.resolve()},PH=function(a,b){null!=a.A&&null!=b&&(a.j=window.setTimeout(a.xb.bind(a),b))},HH=function(a,b,c){if(b=b.getAttribute(c))return b;a.a.error("required attribute not provided: "+c);throw new _.H(_.G,4,4038,a.m,c);},IH=function(a,b){const c=b===KH;a.h&&a.h.presentationTimeline&&_.Uu(a.h.presentationTimeline,
|
|
27
|
+
c);c&&null!=a.j&&(window.clearTimeout(a.j),a.j=null,a.A=null);a.R=b},LH=function(a,b){for(let e=0;e<a.w.streams.length;e++){const f=b.streams[e];for(const g of a.w.streams[e].tracks){var c=f.tracks.find(h=>h.type===g.type&&h.bitrate===g.bitrate);if(c){tG(g,c)||a.a.warn("The current stream is updated with a stream that seems to have different base properties!");var d=QH(a,a.w.timescale,f,c);c=g.segmentIndex;_.gv(c,d);(d=a.f.qd)&&_.hv(c,_.ev(c)-d).forEach(h=>{h.Fa().forEach(k=>{a.G.delete(k)})})}else a.a.warn(`Cannot find satisfying update for ${g.type} `+
|
|
28
|
+
`track with bitrate ${g.bitrate}. Skipping update.`)}}},QH=function(a,b,c,d){let e=0;const f=[],g=c.timescale||b;c.te.forEach((h,k)=>{const l=h.d/g;0===k?(h=h.t/g,a.F=Math.min(a.F,h)):h=f[k-1].endTime;const m=h+l,n=sG(a.m,c,k,d);a.H=Math.max(a.H,l);f.push(new _.fv(k,h,m,()=>[n],0,null,0,null,!0,g));a.G.set(n,h);e+=l});if(c.type===_.w||c.type===_.p)b=f[f.length-1],a.I=Math.min(a.I,e),0===a.f.Gc?a.f.Gc=b.endTime:a.f.Gc=Math.min(a.f.Gc,b.endTime);return f},MH=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=QH(a,c,k,h),m=new _.Hz(l),n=null;k.type!==_.v&&(n=RH(a,b,c,k,h));h.segmentIndex=m;l=a.O++;var q=Promise.resolve.bind(Promise),t=m.f.bind(m),u=m.get.bind(m),x=m.g.bind(m);m=m.getDuration.bind(m);var A=SH[k.type];var E="";switch(k.type){case _.w:E=h.Tc;var D=/00000001[0-9]7/.exec(E);E="avc1."+(D&&D[0]?E.substr(E.indexOf(D[0])+10,6):"42c00c");a.a.debug("VIDEO CODECS: ",E);break;case _.p:E=h.Tc,D=2,"AACH"===h.yf?D=5:E&&(D=(parseInt(E.substr(0,2),
|
|
30
|
+
16)&248)>>3),E="mp4a.40."+D,a.a.debug("AUDIO CODECS: ",E)}D=k.type===_.v?TH[k.jg]:void 0;return h={id:l,originalId:null,Kg:null,createSegmentIndex:q,findSegmentPosition:t,getSegmentReference:u,adjustSegmentDurations:x,getDuration:m,segmentIndex:null,segmentLookupStrategy:_.$t,initSegmentReference:n,mimeType:A,codecs:E,frameRate:void 0,bandwidth:h.bitrate,width:h.maxWidth||void 0,height:h.maxHeight||void 0,kind:D,encrypted:a.J(),keyId:null,language:k.language,label:k.name,type:k.type,primary:!1,trickModeVideo:null,
|
|
31
|
+
emsgSchemeIdUris:null,roles:[],channelsCount:h.ne||null,closedCaptions:null}});e=e.concat(g)}return e},NH=function(a,b,c){const d=(c?c.bandwidth:0)+(b?b.bandwidth:0),e=c?c.language:_.ye;return c||b?{id:a.O++,language:e,primary:!1,audio:c,video:b,bandwidth:d,drmInfos:a.o,allowedByApplication:!0,allowedByKeySystem:!0}:null},RH=function(a,b,c,d,e){b=uG(b,d.timescale||c,e);c={isLive:a.C.bind(a),$c:a.J.bind(a),Df:()=>1,Wc:a.S.bind(a)};d=new Uint8Array(0);try{d=nH(b,c)}catch(g){throw a.a.error("Failed to generate initialization segment."),
|
|
32
|
+
new _.H(_.G,3,4035,g);}const f="data:text/plain;base64,"+_.Wg(d);return new _.Ez(()=>[f],0,null,null,!0)},FG=class{constructor(a){this.type=a;this.size=this.start=0;this.parent=null;this.w=!1;this.entries=[];this.f=[]}append(a=[]){for(let b=0;b<a.length;b++)this.f.push(a[b]),a[b].parent=this;return this}get(a){if(this.type===a)return this;for(let b=0;b<this.f.length;b++){if(this.f[b].type===a)return this.f[b];{const c=this.f[b].get(a);if(c)return c}}return null}a(){const a=Math.pow(2,32)-1;let b;
|
|
33
|
+
b=4+this.type.length;"uuid"===this.type&&(b+=16);if(0<this.f.length)for(let c=0;c<this.f.length;c++)b+=this.f[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?_.M(a,1):_.M(a,this.size);_.uj(a,qG(this.type));this.size>b&&kG(a,this.size);"uuid"===this.type&&_.uj(a,null);if(0<this.f.length&&!this.w)for(b=0;b<this.f.length;b++)this.f[b].write(a),this.f[b].a(),a.getPosition()}},UH=class extends FG{constructor(a,b,c){super(a);
|
|
34
|
+
this.version=b;this.flags=c}a(){return 4+super.a()}write(a){super.write(a);lG(a,this.version);mG(a,this.flags)}},lH=class extends FG{constructor(a,b,c){super(a);this.g=b;this.offset=c}a(){return this.g.byteLength+super.a()-this.offset}write(a){super.write(a);_.uj(a,this.g,this.offset);a.getPosition()}},rH=class extends UH{constructor(a,b,c,d,e){super(a,b,c);this.g=d;this.offset=e}a(){return this.g.byteLength+super.a()-this.offset}write(a){super.write(a);_.uj(a,this.g,this.offset);a.getPosition()}},
|
|
35
|
+
kH=class extends FG{constructor(a,b,c){super("ftyp");this.h=a;this.Ae=b;this.g=c}a(){let a=this.h.length;a=a+4+this.g.join("").length;return a+super.a()}write(a){super.write(a);_.uj(a,qG(this.h));_.M(a,this.Ae);_.uj(a,qG(this.g.join("")));a.getPosition()}},jH=class extends FG{constructor(){super(_.wd)}},iH=class extends FG{constructor(){super(_.we)}},MG=class extends UH{constructor(a,b,c){super("mvhd",1,0);this.timescale=a;this.duration=b;this.volume=256;this.h=c+1;this.g=[0,1,0,0,0,0,0,0,0,0,0,0,
|
|
36
|
+
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.g.length;return a+=super.a()}write(a){super.write(a);1===this.version?(kG(a,0),kG(a,0),_.M(a,this.timescale),kG(a,this.duration*this.timescale)):(_.M(a,0),_.M(a,0),_.M(a,this.timescale),_.M(a,this.duration*this.timescale));_.M(a,65536);nG(a,this.volume);nG(a,0);_.M(a,0);_.M(a,0);for(let b=0;b<this.g.length;b++)lG(a,this.g[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()}},
|
|
37
|
+
NG=class extends FG{constructor(){super("mvex")}},OG=class extends UH{constructor(a){super("trex",0,0);this.g=a}a(){return 20+super.a()}write(a){super.write(a);_.M(a,this.g);_.M(a,1);_.M(a,0);_.M(a,0);_.M(a,0);a.getPosition()}},PG=class extends UH{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.g=[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+
|
|
38
|
+
this.g.length;return a+super.a()}write(a){super.write(a);1===this.version?(kG(a,0),kG(a,0),_.M(a,this.h),_.M(a,0),kG(a,this.duration*this.timescale)):(_.M(a,0),_.M(a,0),_.M(a,this.h),_.M(a,0),_.M(a,this.duration*this.timescale));_.M(a,0);_.M(a,0);nG(a,0);nG(a,0);nG(a,this.volume);nG(a,0);for(let b=0;b<this.g.length;b++)lG(a,this.g[b]);nG(a,this.width);nG(a,0);nG(a,this.height);nG(a,0);a.getPosition()}},QG=class extends UH{constructor(a,b){super("mdhd",1,0);this.timescale=a;this.duration=b;this.language=
|
|
39
|
+
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?(kG(a,0),kG(a,0),_.M(a,this.timescale),kG(a,this.duration*this.timescale)):(_.M(a,0),_.M(a,0),_.M(a,this.timescale),_.M(a,this.duration*this.timescale));nG(a,this.language);nG(a,0);a.getPosition()}},RG=class extends UH{constructor(a){super("hdlr",0,0);this.g=a}a(){return 33+super.a()}write(a){super.write(a);_.M(a,0);this.g===_.w?_.uj(a,qG("vide")):_.uj(a,qG("soun"));_.M(a,0);_.M(a,0);_.M(a,
|
|
40
|
+
0);this.g===_.w?_.uj(a,qG("VideoHandler\x00")):_.uj(a,qG("SoundHandler\x00"));a.getPosition()}},XG=class extends UH{constructor(){super("vmhd",0,1);this.g=new Uint8Array([0,0,0,0,0,0])}a(){return 2+this.g.byteLength+super.a()}write(a){super.write(a);nG(a,0);_.uj(a,this.g);a.getPosition()}},VH=class extends FG{constructor(a){super(a);this.w=!0}a(){return 8+super.a()}write(a){super.write(a);_.M(a,0);nG(a,0);nG(a,1)}},WH=class extends VH{constructor(a){super(a);this.height=this.width=0;this.depth=24}a(){return 70+
|
|
41
|
+
super.a()}write(a){super.write(a);nG(a,0);nG(a,0);_.M(a,0);_.M(a,0);_.M(a,0);nG(a,this.width);nG(a,this.height);_.M(a,4718592);_.M(a,4718592);_.M(a,0);nG(a,1);lG(a,10);_.uj(a,qG("AVC Coding",31));nG(a,this.depth);pG(a,-1)}},XH=class extends VH{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);nG(a,this.channelCount);nG(a,this.sampleSize);pG(a,0);nG(a,0);nG(a,this.sampleRate);nG(a,0)}},WG=class extends WH{constructor(a,
|
|
42
|
+
b){super("avc1");this.width=a;this.height=b}write(a){super.write(a);for(let b=0;b<this.f.length;b++)this.f[b].write(a);a.getPosition()}},GG=class extends WG{constructor(a,b){super(a,b);this.type="encv"}},ZG=class extends XH{constructor(a,b,c){super("mp4a",a,b,c)}write(a){super.write(a);for(let b=0;b<this.f.length;b++)this.f[b].write(a);a.getPosition()}},HG=class extends ZG{constructor(a,b,c){super(a,b,c);this.type="enca"}},VG=class extends FG{constructor(a,b){super("avcC");this.Ja=a;this.Lb=b;this.version=
|
|
43
|
+
1;this.g=this.Ja[0][1];this.h=this.Ja[0][2];this.level=this.Ja[0][3]}a(){let a=7;for(var b=0;b<this.Ja.length;b++)a+=2,a+=this.Ja[b].byteLength;for(b=0;b<this.Ja.length;b++)a+=2,a+=this.Lb[b].byteLength;return a+super.a()}write(a){super.write(a);lG(a,this.version);lG(a,this.g);lG(a,this.h);lG(a,this.level);lG(a,255);lG(a,224|this.Ja.length);for(var b=0;b<this.Ja.length;b++)nG(a,this.Ja[b].length),_.uj(a,this.Ja[b]);lG(a,this.Lb.length);for(b=0;b<this.Lb.length;b++)nG(a,this.Lb[b].length),_.uj(a,this.Lb[b]);
|
|
44
|
+
a.getPosition()}},YG=class extends UH{constructor(a){super("esds",0,0);this.Db=a}a(){return 22+(this.Db.byteLength+3)+super.a()}write(a){super.write(a);lG(a,3);lG(a,23+this.Db.byteLength);nG(a,1);lG(a,0);lG(a,4);lG(a,15+this.Db.byteLength);lG(a,64);lG(a,21);mG(a,0);_.M(a,0);_.M(a,0);lG(a,5);lG(a,this.Db.byteLength);_.uj(a,this.Db);_.uj(a,new Uint8Array([6,1,2]));a.getPosition()}},TG=class extends UH{constructor(a=""){super("url ",0,1);this.location=a}a(){return this.location.length+super.a()}write(a){super.write(a);
|
|
45
|
+
0<this.location.length&&_.uj(a,qG(this.location));a.getPosition()}},SG=class extends UH{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);_.M(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},aH=class extends FG{constructor(){super(_.me)}},UG=class extends UH{constructor(){super(_.oe,0,0)}a(){let a=4;for(let b=0;b<this.entries.length;b++)a+=this.entries[b].a();
|
|
46
|
+
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()}},bH=class extends UH{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()}},cH=class extends UH{constructor(){super("stsc",0,0)}a(){let a=4;for(let b=
|
|
47
|
+
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()}},eH=class extends UH{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()}},dH=class extends UH{constructor(){super("stsz",
|
|
48
|
+
0,0)}a(){return 8+super.a()}write(a){super.write(a);_.M(a,0);_.M(a,0);a.getPosition()}},$G=class extends UH{constructor(){super("smhd",0,0)}a(){return 4+super.a()}write(a){super.write(a);pG(a,0);nG(a,0);a.getPosition()}},fH=class extends FG{constructor(){super("dinf")}},gH=class extends FG{constructor(){super(_.vd)}},hH=class extends FG{constructor(){super(_.rd)}},zH=class extends UH{constructor(a,b){super("tfdt",a,0);this.g=b}a(){let a=0;a=1===this.version?a+8:a+4;return a+super.a()}write(a){super.write(a);
|
|
49
|
+
1===this.version?kG(a,this.g):_.M(a,this.g);a.getPosition()}},oH=class extends UH{constructor(){super("mfhd",0,0);this.g=0}a(){return 4+super.a()}write(a){super.write(a);_.M(a,this.g);a.getPosition()}},qH=class extends UH{constructor(a,b){super("trun",a,b);this.m=this.j=this.g=0;this.o=[];this.sampleSize=[];this.A=[];this.h=[]}a(){let a=4;this.flags&YH&&(a+=4);this.flags&ZH&&(a+=4);for(let b=0;b<this.g;b++)this.flags&$H&&(a+=4),this.flags&aI&&(a+=4),this.flags&bI&&(a+=4),this.flags&cI&&(a+=4);return a+
|
|
50
|
+
super.a()}write(a){super.write(a);_.M(a,this.g);this.flags&YH&&(a.getPosition(),oG(a,this.j));this.flags&ZH&&_.M(a,this.m);for(let b=0;b<this.g;b++)this.flags&$H&&_.M(a,this.o[b]),this.flags&aI&&_.M(a,this.sampleSize[b]),this.flags&bI&&_.M(a,this.A[b]),this.flags&cI&&(0===this.version?_.M(a,this.h[b]):oG(a,this.h[b]));a.getPosition()}},YH=1,ZH=4,$H=256,aI=512,bI=1024,cI=2048,pH=class extends UH{constructor(a,b){super("tfhd",a,b);this.g=255;this.m=this.o=this.j=this.A=this.h=0}a(){let a=4;this.flags&
|
|
51
|
+
dI&&(a+=8);this.flags&eI&&(a+=4);this.flags&fI&&(a+=4);this.flags&gI&&(a+=4);this.flags&hI&&(a+=4);return a+super.a()}write(a){super.write(a);_.M(a,this.g);this.flags&dI&&kG(a,this.h);this.flags&eI&&_.M(a,this.A);this.flags&fI&&_.M(a,this.j);this.flags&gI&&_.M(a,this.o);this.flags&hI&&_.M(a,this.m);a.getPosition()}},dI=1,eI=2,fI=8,gI=16,hI=32,vH=class extends FG{constructor(){super("traf")}},wH=class extends FG{constructor(){super("moof")}},uH=class extends FG{constructor(){super(_.qd);this.g=new Uint8Array(0)}a(){return this.g.byteLength+
|
|
52
|
+
super.a()}write(a){super.write(a);0<this.g.byteLength&&_.uj(a,this.g)}},IG=class extends UH{constructor(){super("tenc",0,0);this.g=1;this.h=8;this.m="";this.j=[]}a(){let a;a=20;1===this.g&&0===this.h&&(a=a+1+this.j.length);return a+super.a()}write(a){super.write(a);lG(a,0);0===this.version?lG(a,0):lG(a,0);lG(a,this.g);lG(a,this.h);_.uj(a,_.Yg(this.m));if(1===this.g&&0===this.h){lG(a,0);for(let b=0;b<this.j.length;b++)lG(a,this.j[b])}a.getPosition()}},KG=class extends UH{constructor(a,b){super("schm",
|
|
53
|
+
0,0);this.g=a;this.h=b;this.zb=""}a(){let a=8;this.flags&1&&(a+=qG(this.zb).byteLength);return a+super.a()}write(a){super.write(a);_.uj(a,qG(this.g));_.M(a,this.h);this.flags&1&&_.uj(a,qG(this.zb));a.getPosition()}},JG=class extends FG{constructor(a){super("frma");this.g=a}a(){return qG(this.g).byteLength+super.a()}write(a){super.write(a);_.uj(a,qG(this.g));a.getPosition()}},AH=class extends UH{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=
|
|
54
|
+
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===this.version?_.M(a,this.offset[b]):kG(a,this.offset[b]);a.getPosition()}},BH=class extends UH{constructor(a,b,c){super("saiz",0,0);this.g=a;this.j=b;this.h=c}a(){let a=0;this.flags&1&&(a+=8);a+=5;0===this.g&&(a+=this.j.length);return a+super.a()}write(a){super.write(a);this.flags&1&&(_.M(a,0),_.M(a,0));lG(a,this.g);_.M(a,this.h);if(0===this.g)for(let b=0;b<this.h;b++)lG(a,
|
|
55
|
+
this.j[b]);a.getPosition()}},tH=class extends UH{constructor(a,b){super("senc",a,b);this.h=0;this.j=8;this.g=[]}a(){let a=4;this.flags&1&&(a+=1);for(let b=0;b<this.h;b++)if(a+=this.g[b].xe.byteLength,this.flags&2){a+=2;for(let c=0;c<this.g[b].xc;c++)a+=2,a+=4}return a+super.a()}write(a){super.write(a);_.M(a,this.h);this.flags&1&&lG(a,this.j);for(let b=0;b<this.h;b++)if(_.uj(a,this.g[b].xe),this.flags&2){nG(a,this.g[b].xc);for(let c=0;c<this.g[b].xc;c++)nG(a,this.g[b].Zd[c].le),_.M(a,this.g[b].Zd[c].me)}a.getPosition()}};var yH=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))}},xG=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,yG=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,zG=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,AG=/^(\d*\.?\d*)f$/,BG=/^(\d*\.?\d*)t$/,CG=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/;var mH=class{constructor(a){this.a=a;this.f=EG(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=EG(this);for(let a=0;a<this.a.length;a++)this.a[a].write(this.f);return this.f.buffer}};var sH=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);var iI=class{constructor(){this.w=this.h=this.g=this.D=null;this.O=1;this.W=0;this.m="";this.B=this.f=null;this.a=new _.O("clpp.smooth.SmoothParser");this.K=!1;this.j=this.A=null;this.R=KH;this.H=0;this.F=this.I=Infinity;this.o=[];this.M=this.U.bind(this);this.G=new Map}configure(a){this.g=a}start(a,b){this.D=b;a=[...new Set([a,rG(a)])];return GH(this,a).then(c=>OH(this,c.data).then(()=>{PH(this,this.A);return this.h}))}stop(){this.D&&this.D.networkingEngine.Sd(this.M);this.A=this.w=this.h=this.g=
|
|
56
|
+
this.D=null;this.j&&(clearTimeout(this.j),this.j=null);this.K=!1;this.I=this.F=Infinity;return Promise.resolve()}update(){if(this.C())return GH(this,[this.m]).then(a=>OH(this,a.data).then(()=>this.h)).catch(a=>{if(this.D)this.D.onError(a)})}onExpirationUpdated(){}setCurrentVariant(){}xb(){this.a.debug(_.St);this.D&&(this.j=null,this.update().then(()=>{PH(this,this.A)}).catch(a=>{this.D&&(this.D.onError(a),1===a.severity&&PH(this,100))}))}C(){return this.R===JH}J(){return 0<this.o.length}S(a){let b=
|
|
57
|
+
null;if(this.o.length)for(let c=0;c<this.o.length;c++)if(this.o[c].keySystem===a){b=this.o[c].initData[0];break}return b}U(a){if(2!==a.request.type||a.uri.startsWith("data:"))return Promise.resolve(a);const b=a.request.timescale||this.w.timescale,c={isLive:this.C.bind(this),$c:this.J.bind(this),Df:()=>1,Wc:this.S.bind(this)};let d=!1;const e=new _.H(_.G,3,4035,null);let f=null;try{const g=this.G.get(a.request.uris[a.request.uriIndex])||a.request.startTime||0;g!==a.request.startTime&&this.a.debug(`Using base media decode time ${g} instead of `+
|
|
58
|
+
`segment reference time ${a.request.startTime}`);f=CH(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)}},SH={video:_.Ke,audio:_.ec,text:_.Zb},KH=_.Tt,JH="LIVE",TH={tg:"caption",ug:_.hu};_.z("clpp.smooth.SmoothComponent",class extends _.Mp{constructor(){super()}f(){_.Kn.ism=iI;_.In[_.$b]=iI}a(){_.nv("ism");_.ov(_.$b)}id(){return"smooth"}});};f.call(g, window);
|
package/cl.thumbnails.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
c,d))},
|
|
3
|
-
1;0<=c;c--)b+=a[c]*d[c];return b},
|
|
4
|
-
a.path.match(/.*\.(png|jpg|jpeg)$/i)?"SINGLE":null};var
|
|
5
|
-
c+_.Xd;a.style.height=d+_.Xd;a.style.backgroundColor="#000";a.style.backgroundRepeat="no-repeat";a.style.backgroundImage=`url("${this.src}")`;a.style.backgroundSize=`${Math.ceil(c/this.width*(this.
|
|
6
|
-
(this.width=(this.
|
|
7
|
-
d);this.
|
|
8
|
-
0<f);if(2===e.length)this.h=e[0],this.o=e[1];else throw new _.
|
|
9
|
-
var a=this.g.getDuration();const b=this.h*this.o;a=Math.ceil(Math.ceil(a/this.j)/b);const c=this.f.templateKey||"$index$";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.f=g;this.g.info(`Appended ${e.byteLength} bytes.`+`Total data now ${f} bytes.`)}}).then(()=>{{var d=this.f,e=_.
|
|
11
|
-
this.a[g-1],g.length=f.offset-g.offset,g.duration=f.time-g.time;this.a.push(f);e+=8;(h=4294967295===h)&&this.h.resolve();if(1E5<k)throw Error("There was a problem during reading BIF entries");}else throw Error("The file is not a valid BIF format");}}).then(()=>{
|
|
12
|
-
+ 'URL: ${c}`,d);a.onError(new _.
|
|
13
|
-
c.substr(0,c.lastIndexOf("/"))+"/"+f);l=
|
|
14
|
-
a),Promise.reject();var d=c.getSegmentReference(b);if(d){const e=
|
|
15
|
-
b);return Promise.reject()}f(a,b){return void 0!==a.bandwidth&&void 0!==b.bandwidth?a.bandwidth-b.bandwidth:0}m(){if(0<this.a.length)return Promise.resolve();var a=this.g.getPeriods();for(const b of a)if(a=b.thumbStreams.sort(this.f)[0]){let c=a.findSegmentPosition(0),d;for(;null!==c&&!_.
|
|
16
|
-
e.
|
|
17
|
-
this.a.init(a,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();
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Js="No thumbnail duration or URL specified",Ks="No thumbnail found for position ",Ls="Position is out of range: ",Ms="Thumbnail URL is mandatory",Ns="Wrong gridSize format",Os="clpp.thumbnails",Qs=function(a,b){b.reduce((c,d)=>{let e=d,f=!1;typeof d===_.Bd&&(e=d.step,f=d.preloadWhileBuffering);return c.then(()=>Ps(a,0,e,!!f))},Promise.resolve())},Ps=function(a,b,c,d){if(a.w||b>=a.a.length)return Promise.resolve();const e=b+c;return Rs(a,d).then(()=>a.a[b].load()).then(()=>Ps(a,e,
|
|
2
|
+
c,d))},Rs=function(a,b){return new Promise(c=>{if(b||a.g.getState()!==_.Kl)c();else a.g.one(_.jc,()=>{c()})})},Ss=function(a){const b=a.f.byteLength;a.a.forEach(c=>{c.offset+c.length<b&&c.ze.resolve()})},Vs=function(a,b){return Ts(a,b).then(c=>new Us(c,b.time,b.duration))},Ts=function(a,b){return b.load().then(()=>{const c=_.I(a.f,b.offset,b.length);return"data:image/jpeg;base64,"+_.Tg(c)})},Ws=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-
|
|
3
|
+
1;0<=c;c--)b+=a[c]*d[c];return b},Xs=function(a,b){let c=null;for(const d of a)d.startTime<=b&&(c=d);return c},Ys=function(a,b){const c=a.horizontalTiles||b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{Ec:c,fe:d,we:e,durationPerTile:a.durationPerTile||b.durationPerTile||(a.endTime-a.startTime)/e}},Zs=function(a){return a.some(b=>0<b.thumbStreams.length)},$s=function(a){if(!a)return null;a=new _.Kj(a);return a.path.match(/.*\.vtt$/i)?"WEBVTT":a.path.match(/.*\.bif$/i)?"BIF":
|
|
4
|
+
a.path.match(/.*\.(png|jpg|jpeg)$/i)?"SINGLE":null};var at=class{constructor(){this.log=new _.O(Os);this.g=null;this.a=[];this.w=!1}init(a,b){this.g=a;a.one(_.$d,()=>{this.w=!0});a.isLive()||this.m().then(()=>{b&&b.preload&&Qs(this,b.preload)})}};var Us=class{constructor(a,b,c,d=0,e=0,f=0,g=0,h=1,k=1,l=0,m=0,n=new Image){this.time=b;this.src=a;this.duration=c;this.x=d;this.y=e;this.width=f;this.height=g;this.ka=n;this.nf=h;this.eg=k;this.Hf=l;this.If=m;this.ra=null}raw(){return this.ka.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&&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(_.Qc);a.style.width=
|
|
5
|
+
c+_.Xd;a.style.height=d+_.Xd;a.style.backgroundColor="#000";a.style.backgroundRepeat="no-repeat";a.style.backgroundImage=`url("${this.src}")`;a.style.backgroundSize=`${Math.ceil(c/this.width*(this.ka.naturalWidth||this.ka.width))}px ${Math.ceil(d/this.height*(this.ka.naturalHeight||this.ka.height))}px`;b=this.y/this.height;a.style.backgroundPositionX="-"+this.x/this.width*c+_.Xd;a.style.backgroundPositionY="-"+b*d+_.Xd;return a}load(){this.ra||(this.ra=new Promise((a,b)=>{const c=()=>{this.width||
|
|
6
|
+
(this.width=(this.ka.naturalWidth||this.ka.width)/this.nf);this.height||(this.height=(this.ka.naturalHeight||this.ka.height)/this.eg);this.x||(this.x=this.width*this.Hf);this.y||(this.y=this.height*this.If)};if(this.ka.src&&this.ka.complete)c(),a(this);else{var d=null,e=()=>{c();this.ka.removeEventListener("load",e);this.ka.removeEventListener(_.$c,d);a(this)};d=()=>{this.ka.removeEventListener("load",e);this.ka.removeEventListener(_.$c,d);b()};this.ka.addEventListener("load",e);this.ka.addEventListener(_.$c,
|
|
7
|
+
d);this.ka.src=this.src}}));return this.ra}};_.z("clpp.thumbnails.Thumbnail",Us);Us.prototype.load=Us.prototype.load;Us.prototype.element=Us.prototype.element;Us.prototype.raw=Us.prototype.raw;var bt=class extends at{constructor(){super();this.f=null;this.o=this.h=1;this.j=0}init(a,b){if(!b||!b.url)throw new _.H(_.G,7,7100,Ms);if("GRID"===b.mode&&!b.gridSize)throw new _.H(_.G,7,7100,"Grid size is mandatory for GRID mode");if(!b.duration)throw new _.H(_.G,7,7100,"Duration is mandatory");this.f=b;const c=this.f.duration,d=this.f.url;if(!c||!d)throw this.log.error(Js,c,d),new _.H(_.G,7,7100,Js);this.j=c;if(this.f.gridSize)try{const e=this.f.gridSize.split(/x/).map(f=>parseInt(f,10)).filter(f=>
|
|
8
|
+
0<f);if(2===e.length)this.h=e[0],this.o=e[1];else throw new _.H(_.G,7,7100,Ns);}catch(e){throw this.log.error("Error during parsing gridSize",e),new _.H(_.G,7,7100,Ns);}super.init(a,b)}get(a){const b=this.g.getDuration();if(void 0===this.f.duration)return Promise.reject("Duration configuration not defined");const c=Math.floor(a/this.f.duration);if(0>a||a>b)return Promise.reject(Ls+a);const d=this.a[c];return d?d.load().then(()=>d):Promise.reject(Ks+a+" at index "+c)}m(){if(0<this.a.length)return Promise.resolve();
|
|
9
|
+
var a=this.g.getDuration();const b=this.h*this.o;a=Math.ceil(Math.ceil(a/this.j)/b);const c=this.f.templateKey||"$index$";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 Us(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 ct=class{constructor(a,b){this.time=a;this.duration=0;this.offset=b;this.length=0;this.ze=new _.Xk}load(){return this.ze}},et=class{constructor(){this.g=new _.O(Os);this.f=new ArrayBuffer(0);this.a=[];this.h=new _.Xk}init(a,b){if(!b||!b.url)throw new _.H(_.G,7,7100,Ms);const c=b.url;b=_.kh(c);b.type=_.jh;a.getNetworkEngine().fetch(b).P.then(d=>{{var e=d.data;d=_.I(this.f);e=_.I(e);const f=d.byteLength+e.byteLength,g=new ArrayBuffer(f),h=new DataView(g);let 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.f=g;this.g.info(`Appended ${e.byteLength} bytes.`+`Total data now ${f} bytes.`)}}).then(()=>{{var d=this.f,e=_.I(d),f=String.fromCharCode.apply(null,dt),g=Array.prototype.slice.call(e,0,8);e=64;let k=0;var h=!1;if(f===String.fromCharCode.apply(null,g))for(d=new DataView(d,16,20),d=d.getUint32(0,!0),0===d&&(d=1E3);!h;){k+=1;g=d;f=new DataView(this.f,e);h=f.getUint32(0,!0);g=h*g/1E3;f=f.getUint32(4,!0);f=new ct(g,f);if(g=this.a.length)g=
|
|
11
|
+
this.a[g-1],g.length=f.offset-g.offset,g.duration=f.time-g.time;this.a.push(f);e+=8;(h=4294967295===h)&&this.h.resolve();if(1E5<k)throw Error("There was a problem during reading BIF entries");}else throw Error("The file is not a valid BIF format");}}).then(()=>{Ss(this)}).catch(d=>{this.g.error(`[BIF] Error while loading thumbnails '
|
|
12
|
+
+ 'URL: ${c}`,d);a.onError(new _.H(1,7,2013,"Error while loading and parsing BIF thumbnails.",d))})}get(a){return 0>a?Promise.reject(Ls+a):this.h.then(()=>{for(let b=0;b<this.a.length;b++){const c=this.a[b];if(a>=c.time&&a<c.time+c.duration)return Vs(this,c).then(d=>d.load().then(()=>d))}return Promise.reject(Ks+a)})}},dt=[137,66,73,70,13,10,26,10];var ft=class extends at{constructor(){super();this.f=null}init(a,b){if(!b||!b.url)throw new _.H(_.G,7,7100,Ms);const c=b.url,d=_.kh(c);d.type=_.jh;this.f=a.getNetworkEngine().fetch(d).P.then(e=>{if(e=e.data){e=_.Fg(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],q=k[2];k=k[3];var l=f.indexOf("#");f=0>l?f:f.substr(0,l);f.match(/^http|^\/\//)||(f=
|
|
13
|
+
c.substr(0,c.lastIndexOf("/"))+"/"+f);l=Ws(g[0]);g=Ws(g[1])-l;this.a.push(new Us(f,l,g,h,n,q,k,0,0))}}}}).catch(e=>{this.log.error("[VTT] Error while loading thumbnails "+`URL: ${c}`,e);a.onError(new _.H(1,7,2013,"Error while loading VTT thumbnails.",e))});super.init(a,b)}get(a){return 0>a?Promise.reject(Ls+a):this.f.then(()=>{for(let b=0;b<this.a.length;b++){const c=this.a[b];if(a>=c.time&&a<c.time+c.duration)return c.load().then(()=>c)}return Promise.reject(Ks+a)})}m(){return this.f}};var gt=class extends at{get(a){if(0>a)return this.log.error("Position must be greater than 0 but is "+a),Promise.reject();var b=this.g.getPeriods();b=Xs(b,a);if(!b)return this.log.error("Could not find period for specified position",a),Promise.reject();var c=b.thumbStreams.sort(this.f)[0];if(!c)return this.log.error("Could not find thumb stream for specified position",a),Promise.reject();b=c.findSegmentPosition(a-b.startTime);if(null===b||void 0===b)return this.log.error("Could not find segment index for specified position",
|
|
14
|
+
a),Promise.reject();var d=c.getSegmentReference(b);if(d){const e=Ys(d,c);a=Math.floor((a-d.startTime)/e.durationPerTile);let f;if(0<this.a.length)d=c.findSegmentPosition(0),null!==d&&(f=this.a[(b-d)*e.we+a]);else if((c=d.Fa())&&0<c.length){let g=0,h=0;d=d.startTime;1<e.we&&(g=a%e.Ec,h=Math.floor(a/e.Ec),d+=a*e.durationPerTile);f=new Us(c[0],d,e.durationPerTile,void 0,void 0,void 0,void 0,e.Ec,e.fe,g,h)}if(f)return f.load().then(()=>f)}this.log.error("segment reference for specified segment index does not exist",
|
|
15
|
+
b);return Promise.reject()}f(a,b){return void 0!==a.bandwidth&&void 0!==b.bandwidth?a.bandwidth-b.bandwidth:0}m(){if(0<this.a.length)return Promise.resolve();var a=this.g.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=Ys(d,a),f=d.Fa()[0],g=new Image;let h=d.startTime;for(let k=0;k<e.fe;++k)for(let l=0;l<e.Ec;++l)this.a.push(new Us(f,h,e.durationPerTile,void 0,void 0,void 0,void 0,e.Ec,
|
|
16
|
+
e.fe,l,k,g)),h+=e.durationPerTile}}return Promise.resolve()}};var ht=class{constructor(){this.f=new _.O(Os);this.a=this.l=null}onPlayerCreated(a){this.l=a}onPlayerWillDestroy(){this.l=null}onPlayerWillRelease(){this.a=null}onContentWillLoad(a){var b=a.getConfiguration();if(b.thumbnails){var c=b.thumbnails;c&&(void 0===c.enabled||c.enabled)&&((b=c.mode)||(b=$s(c.url||null)),b&&("SINGLE"===b||"GRID"===b?this.a=new bt:"WEBVTT"===b?this.a=new ft:"BIF"===b&&(this.a=new et)),this.a&&(this.f.info("Loading thumbs configuration",c),this.l.one(_.od,()=>{this.f.info("Initialize thumbnails provider");
|
|
17
|
+
this.a.init(a,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();Zs(c)&&(this.a=new gt,this.a.init(a,b))}}}get(a){return this.a?this.a.get(a):Promise.reject()}id(){return"thumbnails"}};_.z("clpp.thumbnails.ThumbnailsPlugin",ht);ht.prototype.get=ht.prototype.get;ht.Id="thumbnails";_.Sm(new class{create(){return new ht}});};f.call(g, window);
|