@castlabs/prestoplay 6.2.7 → 6.2.8
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 +31 -0
- 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 +101 -101
- package/cjs/cl.conviva.js +31 -31
- package/cjs/cl.core.js +367 -366
- package/cjs/cl.crypto.js +9 -9
- package/cjs/cl.dash.js +68 -67
- package/cjs/cl.externs.js +30 -30
- package/cjs/cl.freewheel.js +23 -23
- package/cjs/cl.hls.js +44 -43
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +29 -29
- package/cjs/cl.ima.js +21 -21
- package/cjs/cl.mse.js +249 -249
- package/cjs/cl.muxdata.js +11 -11
- package/cjs/cl.onboard.js +3 -3
- package/cjs/cl.persistent.js +13 -13
- package/cjs/cl.playlist.js +5 -5
- package/cjs/cl.smooth.js +68 -68
- package/cjs/cl.thumbnails.js +22 -22
- package/cjs/cl.tizen.js +68 -68
- package/cjs/cl.ttml.js +26 -26
- package/cjs/cl.verimatrix.js +5 -5
- package/cjs/cl.vimond.js +11 -11
- package/cjs/cl.vr.js +18 -18
- package/cjs/cl.vtt.js +14 -14
- package/cjs/cl.youbora.js +15 -15
- package/cl.adobe.js +3 -3
- package/cl.airplay.js +3 -3
- package/cl.broadpeak.js +5 -5
- package/cl.cast.js +81 -81
- package/cl.conviva.js +27 -27
- package/cl.core.js +326 -323
- package/cl.crypto.js +8 -8
- package/cl.dash.js +64 -62
- package/cl.externs.js +30 -30
- package/cl.freewheel.js +17 -17
- package/cl.hls.js +37 -36
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +24 -24
- package/cl.ima.js +14 -14
- package/cl.mse.js +218 -218
- package/cl.muxdata.js +9 -9
- package/cl.onboard.js +4 -4
- package/cl.persistent.js +9 -9
- package/cl.playlist.js +4 -4
- package/cl.smooth.js +57 -57
- package/cl.thumbnails.js +17 -17
- package/cl.tizen.js +57 -57
- package/cl.ttml.js +21 -21
- 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.youbora.js +13 -13
- package/package.json +1 -1
package/cl.muxdata.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
if(c){const h=new _.
|
|
3
|
-
video_title:a.m&&a.m.name||"",player_software_name:_.la,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.pow(36,6)<<0).toString(36)).slice(-6);this.a=new _.
|
|
6
|
-
switch(a.detail.currentState){case _.
|
|
7
|
-
|
|
8
|
-
if(this.a){c=a.getConfiguration();c=_.
|
|
9
|
-
this.f.release()}id(){return"mux"}U(a,b){a.trigger(new _.F(_.
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var us=function(a){let b={debug:!0,data:ts(a)};a.g&&a.g.muxOptionsOverride&&_.gf(a.g.muxOptionsOverride)&&(b=_.df(b,a.g.muxOptionsOverride,{getPlayheadTime:()=>1E3*a.l.getPosition(),getStateData:()=>{{a.f.debug("getStateData()");var c=a.l.getLoadedSource(),d=a.l.getTrackManager();const f=a.l.getSurface(),g=d.fa();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 h=new _.Vi(c.url);e.video_source_url=_.Ri(h);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;g&&g.height&&g.width&&(e.video_source_height=g.height,e.video_source_width=g.width);(d=d.ha())&&d.language&&(e.player_language_code=d.language)}return e}}));a.f.debug("Mux SDK options",b);return b},vs=function(a,b,c){a.f.debug(`Event: ${b}`);mux.emit(a.A,b,c)},ts=function(a){const b={env_key:a.g.envKey,
|
|
3
|
+
video_title:a.m&&a.m.name||"",player_software_name:_.la,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},ws=function(a){a.a.on(a.l,_.pe,()=>{vs(a,_.pe,{player_playhead_time:1E3*a.l.getPosition()})});a.a.on(a.l,_.Ld,()=>vs(a,_.Ld));a.a.on(a.l,_.$b,a.B.bind(a));a.a.on(a.l,_.ee,a.D.bind(a));a.a.on(a.l,_.ze,()=>vs(a,_.Zd));a.a.on(a.l,_.xe,()=>vs(a,_.Yd));a.a.on(a.l,
|
|
4
|
+
_.Qc,a.C.bind(a));a.a.on(a.l,_.ob,()=>vs(a,"adbreakstart"));a.a.on(a.l,_.pb,()=>vs(a,"adbreakend"));a.a.on(a.l,_.Bb,()=>{vs(a,"adplay");vs(a,"adplaying")});a.a.on(a.l,_.xb,()=>vs(a,"adpause"));a.a.on(a.l,_.zb,()=>{vs(a,"adplay");vs(a,"adplaying")});a.a.on(a.l,_.Cb,()=>vs(a,"adended"));a.a.on(a.l,_.tb,()=>vs(a,"adfirstquartile"));a.a.on(a.l,_.wb,()=>vs(a,"admidpoint"));a.a.on(a.l,_.Db,()=>vs(a,"adthirdquartile"))},xs=class{constructor(a,b){this.l=a;this.m=this.g=null;this.A=("000000"+(Math.random()*
|
|
5
|
+
Math.pow(36,6)<<0).toString(36)).slice(-6);this.a=new _.mn;this.f=b;this.o=this.j=this.h=this.w=!1}release(){this.f.debug("release()");this.j?this.f.debug(_.ha):(_.Gf(this.a),this.j=!0,this.m=this.g=null)}destroy(){this.f.debug(_.Ec);this.o?this.f.debug(_.fa):(this.o=!0,this.h&&this.w&&vs(this,"viewend"),vs(this,"destroy"))}B(a){this.f.debug(_.ud);var b=a.detail;a=this.l.getTrackManager();b&&b.bandwidth&&(b=b.bandwidth,(a=a.xa())&&a.bandwidth&&(b+=a.bandwidth),vs(this,"renditionchange",{video_source_bitrate:b}))}D(a){this.f.debug(_.zd);
|
|
6
|
+
switch(a.detail.currentState){case _.Jk:this.l.getConfiguration().autoplay&&vs(this,_.Ld);break;case _.Lk:vs(this,_.Md);break;case _.Kk:vs(this,_.Hd);break;case _.Ak:this.w=!0,vs(this,_.Pc)}}C(a){this.f.debug(_.wd);if(this.h&&(a=a.detail||null))if(10003===a.code)vs(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":6007===a.code&&(b="License request error"),b=`${b} castlabs-error-data:${JSON.stringify(a.data)}`;
|
|
7
|
+
vs(this,_.Qc,{player_error_code:a.code,player_error_message:b})}}};var ys=class extends _.bp{constructor(){super();this.f=null;this.a=!1;this.g=new _.O("clpp.muxdata")}onPlayerCreated(a){this.f=new xs(a,this.g)}onContentWillLoad(a,b){var c=a.getConfiguration();if(this.a=!_.y(c.muxdata)&&typeof c.muxdata===_.td){var d=c.muxdata;if(c="undefined"===typeof window.mux)c=d.muxLib,d="undefined"!==typeof c&&typeof c.init===_.Sc&&typeof c.emit===_.Sc,window.mux=c,c=d,c=!c;c&&(this.g.warn("Mux SDK is not loaded. Will do nothing."),this.a=!1,c=new _.H(1,9,9301),this.U(a,c))}else this.g.warn("Mux plugin is loaded but not configured. Will do nothing.");
|
|
8
|
+
if(this.a){c=a.getConfiguration();c=_.ef(c.muxdata||{});try{d=[];typeof c===_.td&&(c.envKey||d.push("envKey"));if(0<d.length)throw new _.H(1,9,9300,{missingKeys:d});var e=this.f;e.g=c;e.m=b;e.w=!1;if(!e.h){try{e.h=!0,mux.init(e.A,us(e))}catch(f){throw e.h=!1,_.Gf(e.a),new _.H(1,9,9302,null,f);}vs(e,"playerready")}e.j&&!e.o&&(vs(e,"videochange",ts(e)),e.j=!1);ws(e)}catch(f){this.a=!1,this.U(a,f)}}}onContentLoaded(){}onPlayerWillDestroy(){this.a&&(this.f.destroy(),this.f=null)}onPlayerWillRelease(){this.a&&
|
|
9
|
+
this.f.release()}id(){return"mux"}U(a,b){a.trigger(new _.F(_.Qc,{detail:b}))}};_.x("clpp.muxdata.MuxDataPlugin",ys);ys.Id="mux";_.Ll(new class{create(){return new ys}});};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:_.
|
|
3
|
-
_.x("clpp.onboard.OnboardComponent",class extends _.
|
|
4
|
-
_.x("clpp.onboard.register",
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var ss=function(a,b){let c=b.baseUrl;_.rg(c,"/")||(c+="/");const d=g=>g&&(_.qg(g,"https://")||_.qg(g,"http://")||_.qg(g,"//"))?g:`${c}${g}`,e=d(b.widevineUrl||"widevine"),f=d(b.playreadyUrl||"playready");b=d(b.fairplayUrl||"fairplay");a=new _.Wn(a);a.Ba(_.Ac,{licenseUrl:e,videoRobustness:[_.cb,void 0],audioRobustness:[_.Za,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:_.ij,licenseResponse:_.jj}});a.Ba(_.yc,{licenseUrl:b,
|
|
2
|
+
certificateUrl:b,modifiers:{licenseRequest:_.lj,licenseResponse:_.mj,extractContentId:_.nj,certificateRequest:_.oj}});a.Ba(_.zc,{licenseUrl:f,modifiers:{licenseRequest:_.ij}});_.wi(a)};
|
|
3
|
+
_.x("clpp.onboard.OnboardComponent",class extends _.zo{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}'`),ss(b,a))}release(){}id(){return"onboard"}});
|
|
4
|
+
_.x("clpp.onboard.register",ss);};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 _.
|
|
3
|
-
d.drm=a;a=new _.
|
|
4
|
-
licenseServerUri:h.licenseServerUri,serverCertificate:h.serverCertificate,audioCapabilities:[],videoCapabilities:k,drmConfig:a};yield d.store(e,f)}catch(h){throw
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var ds="A persistent DRM session already exists for: ",es="No DRM configuration.",fs="clpp.persistent",gs=function(a,b){const c=[];for(const d of a)c.push(b(d));return c},is=function(a,b){a.I=hs;a.H=[];a.C=!0;return _.Mj(a,b)},ks=function(a,b,c,d,e,f){a.I=js;const g=new Map,h=_.Aj(b);g.set(h,{audioCapabilities:e,videoCapabilities:f,distinctiveIdentifier:_.Cd,persistentState:_.Vd,sessionTypes:[_.Jd],label:h,drmInfos:[{keySystem:b,licenseServerUri:c,distinctiveIdentifierRequired:!1,persistentStateRequired:!0,
|
|
2
|
+
audioRobustness:"",videoRobustness:"",serverCertificate:d,initData:null,keyIds:null}]});return _.Lj(a,g)},ls=function(a,b){return _.v(function*(){const c=yield _.bk(a,b);if(c){var d=[],e=a.g.get(c);e&&a.A&&(e.eb=new _.Pj,d.push(e.eb));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)})},ms=function(a){a=a.g.keys();a=gs(a,b=>b.sessionId);return Array.from(a)},ns=function(a,b){const c=_.yi(a),d=_.ci({drm:a});
|
|
3
|
+
d.drm=a;a=new _.Uk({pb:b,onError:()=>{},Cd:()=>{},onExpirationUpdated:()=>{},onEvent:()=>{},getConfiguration:()=>d,jc:()=>null});a.h=c;return a},qs=function(a,b,c){return _.v(function*(){const d=os;if(a){var e=a.offlineId;if(0!==e.length){var f=yield d.get(e);if(f)ps.debug(ds,e);else{var g=ns(a,c);try{yield is(g,b);yield _.ak(g);yield _.ck(g);const h=g.getDrmInfo(),k=b.map(l=>({contentType:_.Lg(l.video.mimeType,l.video.codecs),robustness:h.videoRobustness}));f={sessionIds:ms(g),keySystem:h.keySystem,
|
|
4
|
+
licenseServerUri:h.licenseServerUri,serverCertificate:h.serverCertificate,audioCapabilities:[],videoCapabilities:k,drmConfig:a};yield d.store(e,f)}catch(h){throw ps.error("Error while persisting DRM session"),new _.H(1,6,6200,null,h);}finally{yield g.destroy()}}}}else ps.debug(es)})},hs=1,js=2,rs=class{store(a,b){return _.v(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
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 _.v(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 _.v(function*(){window.localStorage.removeItem(encodeURIComponent(a))})}clear(){return _.v(function*(){window.localStorage.clear()})}getName(){return"clpp.persistent.SimpleSessionStorage"}};_.x("clpp.persistent.useStorage",function(a){{var b=["store","get","delete","clear","getName"];const c=[];_.y(a)||(_.
|
|
7
|
-
_.x("clpp.persistent.fetchLicense",function(a,b,...c){return _.v(function*(){var d=
|
|
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=_.
|
|
9
|
-
_.x("clpp.persistent.removeLicense",function(a){return _.v(function*(){var b=
|
|
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
|
|
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 _.v(function*(){window.localStorage.removeItem(encodeURIComponent(a))})}clear(){return _.v(function*(){window.localStorage.clear()})}getName(){return"clpp.persistent.SimpleSessionStorage"}};_.x("clpp.persistent.useStorage",function(a){{var b=["store","get","delete","clear","getName"];const c=[];_.y(a)||(_.hf(a.store)||c.push("store"),_.hf(a.get)||c.push("get"),_.hf(a.delete)||c.push("delete"),_.hf(a.clear)||c.push("clear"),_.hf(a.getName)||c.push("getName"),b=c)}if(0<b.length)throw ps.warn("Invalid session storage implementation"),new _.H(1,6,6202,{missingMethods:b});os=a});
|
|
7
|
+
_.x("clpp.persistent.fetchLicense",function(a,b,...c){return _.v(function*(){var d=os,e=(l,m)=>new _.H(1,6,6200,l,m);const f=_.Ok(a).shift();if(!f)throw e("No source specified.");if(!b)throw e(es);var g=b.offlineId;if(typeof g!==_.he||!g.length)throw e("Missing offline id.");if(yield d.get(g))ps.debug(ds,g);else{var h=_.ci();d=new _.Il;g=[];for(var k of c){const l=new k;_.fi(l.id())||(l.f(null),_.ji(l),g.push(l))}k=null;try{k=yield _.zm(f.url,d,h.manifest.attemptParameters,f.type);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=_.xm(l.periods);yield qs(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(),_.ei.delete(e.id());e=[];k&&e.push(k.stop());e.push(d.destroy());yield Promise.all(e)}}})});
|
|
9
|
+
_.x("clpp.persistent.removeLicense",function(a){return _.v(function*(){var b=os;if(_.jf(a)&&0!==a.length){var c=null,d=null;try{const e=yield b.get(a);e?(e.drmConfig.delayLicenseRequestUntilPlayed=!0,d=new _.Il,c=ns(e.drmConfig,d),yield ks(c,e.keySystem,e.licenseServerUri,e.serverCertificate,e.audioCapabilities,e.videoCapabilities),yield _.ak(c),yield Promise.all(e.sessionIds.map(f=>_.v(function*(){yield ls(c,f);ps.debug("successfully removed session with id",f)}))),yield b.delete(a)):ps.debug("No persistent DRM session found")}catch(e){throw ps.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 ps.warn("Invalid offlineId")})});var os=new rs,ps=new _.O(fs);_.x("clpp.persistent.PersistentLicenseComponent",class extends _.zo{constructor(){super();this.l=null;this.j=os;this.h=new _.O(fs)}f(a){this.l=a}a(){this.l=null}release(){}g(){this.j=os}id(){return _.Id}o(a,b,c){const d=this;return _.v(function*(){if(a)try{yield qs(a,b,c),d.l.trigger(new _.F(_.Jc,{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 _.v(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,4 +1,4 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
this.h),this.Kc(this.f,!0))}stop(){this.g=!1;this.l.off(_.
|
|
3
|
-
b&&b<=this.a.length){const c=this.fd();this.a.splice(b,0,a);c&&(this.f=this.a.indexOf(c));
|
|
4
|
-
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var as=function(a,b){return 0<=b&&b<a.a.length},bs=function(a){a.trigger(new _.F(_.Od))},cs=class extends _.In{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.ne.bind(this)}getPosition(){return this.f}ff(){return this.a}fd(){return 0<this.a.length&&as(this,this.f)?this.a[this.f]:null}gf(){const a=this.f+1;return 0<this.a.length&&as(this,a)?this.a[a]:null}kf(){return this.g}start(){this.g||(this.g=!0,this.l.on(_.Pc,
|
|
2
|
+
this.h),this.Kc(this.f,!0))}stop(){this.g=!1;this.l.off(_.Pc,this.h)}ne(){this.next()}next(){const a=this;return _.v(function*(){yield a.Kc(Math.min(a.a.length-1,a.f+1))})}sf(){const a=this;return _.v(function*(){yield a.Kc(Math.max(0,a.f-1))})}Kc(a,b){b=void 0===b?!1:b;const c=this;return _.v(function*(){if(0<c.a.length&&as(c,a)&&(b||c.f!==a)){c.f=a;var d=c.fd();d&&(yield c.j(d),yield c.l.load(d.configuration),c.trigger(new _.F(_.Nd,{item:d})))}})}append(a){this.a.push(a);bs(this)}jf(a,b){if(0<=
|
|
3
|
+
b&&b<=this.a.length){const c=this.fd();this.a.splice(b,0,a);c&&(this.f=this.a.indexOf(c));bs(this)}}remove(a){if(0<this.a.length&&as(this,a)){if(this.f===a)throw Error("Can't remove the current item");this.a.splice(a,1);bs(this)}}clear(){this.stop();this.f=0;this.a=[];this.g=!1;bs(this)}};_.x("clpp.Playlist",cs);cs.prototype.clear=cs.prototype.clear;cs.prototype.remove=cs.prototype.remove;cs.prototype.insert=cs.prototype.jf;cs.prototype.append=cs.prototype.append;cs.prototype.goTo=cs.prototype.Kc;
|
|
4
|
+
cs.prototype.previous=cs.prototype.sf;cs.prototype.next=cs.prototype.next;cs.prototype.onEnded=cs.prototype.ne;cs.prototype.stop=cs.prototype.stop;cs.prototype.start=cs.prototype.start;cs.prototype.isStarted=cs.prototype.kf;cs.prototype.getUpcoming=cs.prototype.gf;cs.prototype.getCurrent=cs.prototype.fd;cs.prototype.getQueue=cs.prototype.ff;cs.prototype.getPosition=cs.prototype.getPosition;};f.call(g, window);
|
package/cl.smooth.js
CHANGED
|
@@ -1,58 +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 _.u:a.Ca=[_.
|
|
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
|
-
b=(new
|
|
8
|
-
k=new
|
|
9
|
-
d,e,f,g,h;(new _.
|
|
10
|
-
k.G.ya();if(null===k.flags)throw new _.H(_.G,3,3019,
|
|
11
|
-
0,k.flags||0,l,0)}}).M("uuid",k=>{var l=_.
|
|
12
|
-
!1);if(!h)return null;a=(new
|
|
13
|
-
if(h&&(c=new
|
|
14
|
-
k.getAttribute(q[0]);break b}}k=null}h.setAttribute(g[
|
|
15
|
-
c]);h=c.write();d&&(d=c.get("saio"),c=c.f,d.offset[0]=e.start+16,c.seek(d.start),d.write(c),h=c.buffer);return h},
|
|
16
|
-
initDataType:_.
|
|
17
|
-
Ia=ta.parseFromString(
|
|
18
|
-
Infinity,m=_.
|
|
19
|
-
|
|
20
|
-
Ga,Vc;var
|
|
21
|
-
32E3:5,24E3:6,22050:7,16E3:8,12E3:9,11025:10,8E3:11,7350:12},
|
|
22
|
-
maxWidth:yf,yc:
|
|
23
|
-
1];xf=
|
|
24
|
-
duration:g,isLive:h,
|
|
25
|
-
hb=a.a.delay;const Ia=a.I;let
|
|
26
|
-
Promise.resolve();a.K||(a.g.networkingEngine.Vc(a.L),a.K=!0);a.B=
|
|
27
|
-
b.streams[e];for(const g of a.B.streams[e].tracks){var c=f.tracks.find(h=>h.type===g.type&&h.bitrate===g.bitrate);if(c){
|
|
28
|
-
b;c.ee.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=
|
|
29
|
-
m;l=a.N++;var q=Promise.resolve.bind(Promise),t=m.h.bind(m),w=m.get.bind(m),
|
|
30
|
-
findSegmentPosition:t,getSegmentReference:w,adjustSegmentDurations:
|
|
31
|
-
_.
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var xD="Full MP4 box must have flags defined",yD="clpp.smooth.SmoothMP4Processor",zD="codecPrivateData",AD=function(a,b){const c=Math.floor(b/Math.pow(2,32));b-=c*Math.pow(2,32);_.M(a,c);_.M(a,b)},BD=function(a,b){try{a.f.setUint8(a.a,b),a.a+=1}catch(c){_.Ci()}},CD=function(a,b){BD(a,b>>16&255);BD(a,b>>8&255);BD(a,b&255)},DD=function(a,b){try{a.f.setUint16(a.a,b,a.g),a.a+=2}catch(c){_.Ci()}},ED=function(a,b){try{a.f.setInt32(a.a,b,a.g),a.a+=4}catch(c){_.Ci()}},FD=function(a,b){try{a.f.setInt16(a.a,
|
|
2
|
+
b,a.g),a.a+=2}catch(c){_.Ci()}},GD=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},HD=function(a){const b=a.split("/");return b[b.length-1].toLowerCase().match("manifest(\\(.+\\))?")?a:`${a}/Manifest`},ID=function(a,b,c,d){c=b.ee[c];b=b.Ff;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 _.lt([a],[b])[0]},JD=function(a,b){if(a.type!==b.type)return!1;let c=[];a.type===_.u?c=["maxWidth","maxHeight","bitrate",zD,"fourCC"]:a.type===_.Tb&&(c=["bitrate",zD,"channels","bitsPerSample","samplingRate","fourCC"]);return _.lf(a,b,c,["id","segmentIndex"])},KD=function(a,b,c){const d=c.Ec.split("00000001");a={id:1,type:c.type,duration:a/b,timescale:b,Ca:null,Db:null,width:NaN,height:NaN,xb:null,yc:NaN,
|
|
4
|
+
sampleSize:NaN,channelCount:NaN};switch(c.type){case _.u:a.Ca=[_.oi(d[1])];a.Db=[_.oi(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.Tb:a.xb=_.oi(c.Ec),a.sampleSize=c.Ne||16,a.yc=c.yc,a.channelCount=c.$d}return a},LD=function(a,b){return a.filter(c=>c.type===b)},MD=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)},TD=function(a,b,c){var d=null;if(ND.test(a)){{a=ND.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 OD.test(a)?d=MD(OD,a):PD.test(a)?d=MD(PD,a):QD.test(a)?(a=QD.exec(a),d=Number(a[1])/c.frameRate):RD.test(a)?(a=RD.exec(a),d=Number(a[1])/c.a):SD.test(a)&&(d=MD(SD,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},UD=function(a){let b=
|
|
6
|
+
0;for(let c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.Zi(b)},VD=function(a){const b=_.Yh();a="ie"===b.browser||"edge"===b.browser?a.gd(_.zc):a.gd(_.Ac);null===a&&(_.z(yD,"Could not get PSSH box!"),a={initData:new Uint8Array(0),initDataType:_.lc,keyId:"",periodId:null});return a},bE=function(a,b,c){const d=VD(c);c=new WD("xxxx");a.type===_.u?c=new XD(a.width,a.height):c=new YD(a.channelCount,a.sampleSize,a.yc);a=new ZD;a.g=1;a.h=8;a.m=d.keyId||"00000000000000000000000000000000";a=(new WD("schi")).append([a]);
|
|
7
|
+
b=(new WD(_.ae)).append([new $D(b),new aE(_.lc,65536),a]);c.append([b]);return c},EE=function(a,b){const c=b.Nc();var d=new cE(a.timescale,a.duration,a.id),e=(new dE).append([new eE(a.id)]),f=new fE(a.id,a.duration,a.timescale,a.width,a.height),g=new gE(a.timescale,a.duration);const h=new hE(a.type);var k=null,l=new iE;l.entries=[new jE];var m=new kE;switch(a.type){case _.u:k=new lE(a.Ca,a.Db);c?(a=bE(a,"avc1",b),a.append([k]),m.entries=[a]):(a=(new mE(a.width,a.height)).append([k]),m.entries=[a]);
|
|
8
|
+
k=new nE;break;case _.Tb:k=new oE(a.xb),c?(a=bE(a,"mp4a",b),a.append([k]),m.entries=[a]):(a=(new pE(a.channelCount,a.sampleSize,a.yc)).append([k]),m.entries=[a]),k=new qE}m=(new rE).append([m,new sE,new tE,new uE,new vE]);l=(new wE).append([l]);l=(new xE).append([k,l,m]);g=(new yE).append([g,h,l]);f=(new zE).append([f,g]);d=(new AE).append([d,f,e]);e=new BE("dash",0,["iso6","mp41","avc1"]);c&&(b=VD(b).initData,d.append([new CE("pssh",b,8)]));b=new DE([e,d]);return _.L(b.write())},OE=function(a,b){let c,
|
|
9
|
+
d,e,f,g,h;(new _.Xi).M("moof",_.Ni).X("mfhd",k=>{{const l=new FE;l.g=_.N(k.G);c=l}}).M("traf",_.Ni).X("tfhd",k=>{{const l=k.G.ya();if(null===k.flags)throw new _.H(_.G,3,3019,xD);const m=new GE(k.version||0,k.flags||0);m.g=_.N(k.G);0<l-k.G.getPosition()&&k.flags&1&&(m.h=_.Ji(k.G));0<l-k.G.getPosition()&&k.flags&2&&(m.A=_.N(k.G));0<l-k.G.getPosition()&&k.flags&8&&(m.j=_.N(k.G));0<l-k.G.getPosition()&&k.flags&16&&(m.o=_.N(k.G));0<l-k.G.getPosition()&&k.flags&32&&(m.m=_.N(k.G));d=m}}).X("trun",k=>{{var l=
|
|
10
|
+
k.G.ya();if(null===k.flags)throw new _.H(_.G,3,3019,xD);const m=new HE(k.version||0,k.flags||0);m.g=_.N(k.G);0<l-k.G.getPosition()&&k.flags&1&&(m.j=_.Ii(k.G));0<l-k.G.getPosition()&&k.flags&4&&(m.m=_.N(k.G));if(0<l-k.G.getPosition())for(l=0;l<m.g;l++)k.flags&256&&m.o.push(_.N(k.G)),k.flags&512&&m.sampleSize.push(_.N(k.G)),k.flags&1024&&m.A.push(_.N(k.G)),k.flags&2048&&(0===k.version?m.h.push(_.N(k.G)):m.h.push(_.Ii(k.G)));e=m}}).X("sdtp",k=>{{const l=_.Ki(k.G,k.G.ya());f=new IE("sdtp",k.version||
|
|
11
|
+
0,k.flags||0,l,0)}}).M("uuid",k=>{var l=_.Ki(k.G,16);if(_.qi(l,JE)){l=_.N(k.G);k.version=l>>>24;k.flags=l&16777215;l=new KE(k.version,k.flags);l.h=_.N(k.G);k.flags&1&&(l.j=_.Gi(k.G));for(let m=0;m<l.h;m++){const n={he:_.Ki(k.G,8),oc:0,Nd:[]};if(k.flags&2){n.oc=_.Hi(k.G);for(let q=0;q<n.oc;q++){const t={Yd:0,Zd:0};t.Yd=_.Hi(k.G);t.Zd=_.N(k.G);n.Nd.push(t)}}l.g.push(n)}g=l}}).M(_.hd,k=>{{const l=new LE;0<k.G.ya()?l.g=_.Ki(k.G,k.G.ya()):(_.z(yD,"mdat box is empty!"),l.g=new Uint8Array(0));h=l}}).parse(a,
|
|
12
|
+
!1);if(!h)return null;a=(new ME).append([d,e]);f&&a.append([f]);b.Nc()&&g&&a.append([g]);b=(new NE).append([c,a]);return new DE([b,h])},TE=function(a,b,c){var d=c.Nc(),e=a.request.startTime,f=parseInt(e*b,10);b=a.data||new ArrayBuffer(0);var g=OE(b,c);if(null===g)return a.request.contentType===_.r?a.data:g;c=g.get(_.hd);if(a.request.contentType===_.r){d=c.g.buffer;if(e){d=_.mg(d);if((d=(new DOMParser).parseFromString(d,_.oe))&&"tt"===d.documentElement.tagName.toLowerCase())var h=d.documentElement;
|
|
13
|
+
if(h&&(c=new PE(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,w=f.length;t<w;t++){h=f[t];a=e;b=c;g=["begin",_.Oc];for(let B=0,A=g.length;B<A;B++){b:{var k=h;var l=g[B],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=
|
|
14
|
+
k.getAttribute(q[0]);break b}}k=null}h.setAttribute(g[B],TD(k||"",a,b))}}}d=(new XMLSerializer).serializeToString(d);e=_.ng(d).buffer}else e=d;return e}h=new NE;a=g.get("mfhd");b=new ME;k=g.get("tfhd");m=new QE(1,f);f=g.get("trun");n=g.get("sdtp");e=g.get("senc");k.g=1;k.flags&=16777214;k.flags|=131072;b.append([k,m,f]);n&&b.append([n]);if(d){g=0;k=[];if(e.flags&2)for(k=[],m=0;m<e.h;m++)k.push(10+6*e.g[m].oc);else g=8;b.append([e,new RE,new SE(g,k,e.h)])}h.append([a,b]);f.flags|=1;f.j=h.a()+8;c=new DE([h,
|
|
15
|
+
c]);h=c.write();d&&(d=c.get("saio"),c=c.f,d.offset[0]=e.start+16,c.seek(d.start),d.write(c),h=c.buffer);return h},UE=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,periodId:null}},VE=function(a){return{initData:_.xt(_.At(a)),initDataType:_.lc,keyId:a,periodId:null}},WE=function(a,b,c){a=_.Gt(a);c&&a.version!==c&&(a=_.Ft(a,c));return{initData:_.xt(a),
|
|
16
|
+
initDataType:_.lc,keyId:b,periodId:null}},XE=function(a,b){return _.v(function*(){var c=_.zg(b);c.timeout=a.h.attemptParameters.timeout;c.maxAttempts=Math.max(a.h.attemptParameters.maxAttempts,b.length);c.baseDelay=a.h.attemptParameters.baseDelay;c.backoffFactor=a.h.attemptParameters.backoffFactor;c.fuzzFactor=a.h.attemptParameters.fuzzFactor;c.type=1;c=yield a.g.networkingEngine.fetch(c).O;a.o=c.uri;return c})},eF=function(a,b){let c=null;try{{const ta=new DOMParser;let hb,Ia;try{const ab=_.mg(b);
|
|
17
|
+
Ia=ta.parseFromString(ab.trim(),_.oe)}catch(ab){throw ab;}Ia&&Ia.documentElement.tagName==_.eb&&(hb=Ia.documentElement);c=hb&&0<hb.getElementsByTagName("parsererror").length?null:hb}}catch(ta){}if(!c)throw a.f.error("Unable to parse manifest"),new _.H(_.G,4,4033,a.o);const d=+YE(a,c,"MajorVersion"),e=+YE(a,c,"MinorVersion"),f=+c.getAttribute("TimeScale")||1E7;let g=+YE(a,c,"Duration");const h="TRUE"===c.getAttribute("IsLive"),k=+c.getAttribute("LookAheadCount"),l=+c.getAttribute("DVRWindowLength")||
|
|
18
|
+
Infinity,m=_.st(c,"Protection")[0];if(!1===/^[2].[0-2]$/.test(""+d+"."+e))throw a.f.error("Smooth Streaming version must be 2.0, 2.1 or 2.2"),new _.H(_.G,4,4036,a.o);h?(ZE(a,$E),a.C=typeof a.h.liveRefreshPeriod===_.p?1E3*a.h.liveRefreshPeriod:Math.min(1E3*a.H,1E4),g=Infinity):ZE(a,aF);a.a={startTime:0,delay:0,duration:g/f,bd:l/f,uc:0};if(m){{var n=a.h.playreadyVersion;const ta=[],hb=_.st(m,"ProtectionHeader")[0],Ia=_.ni(_.ut(hb)||""),ab=_.Gt(Ia).a;ta.push(UE(_.Ac,VE(ab),[ab]));ta.push(UE(_.zc,WE(Ia,
|
|
19
|
+
ab,n),[ab]));var q=ta}a.A=q}{const ta=[],hb=_.st(c,"StreamIndex");if(!hb.length)throw a.f.error("No streams found!"),new _.H(_.G,4,4034,a.o);for(let Ia=0;Ia<hb.length;Ia++){{var t=a,w=hb[Ia];const ab=YE(t,w,"Type"),dc=+w.getAttribute("Chunks"),Qg=w.getAttribute("Subtype"),ye=_.Jg(w.getAttribute("Language")||_.se),Fd=w.getAttribute("Name")||"",Rg=+w.getAttribute(_.Ka),vf=+w.getAttribute(_.Ja),wf=YE(t,w,"Url"),pk=+w.getAttribute("TimeScale")||null;{const ec=[],hi=_.st(w,_.Va);for(let Gd=0;Gd<hi.length;Gd++){{let fc,
|
|
20
|
+
Ga,Vc;var B=t,A=hi[Gd],E=ab;const ii=+A.getAttribute("Index"),xf=+YE(B,A,"Bitrate");let Kb=NaN,yf=NaN,qk=NaN,Xo=NaN,Mx=NaN,Nx=NaN,Ox=NaN;const Px=A.getAttribute("FourCC");switch(E){case _.u:Kb=+YE(B,A,_.Ja);yf=+YE(B,A,_.Ka);break;case _.Tb:Xo=+A.getAttribute("Channels")||2,qk=+YE(B,A,"SamplingRate"),Nx=+YE(B,A,"AudioTag"),Mx=+YE(B,A,"BitsPerSample"),Ox=+YE(B,A,"PacketSize")}let Yo=String(A.getAttribute("CodecPrivateData"));if(E===_.Tb&&!Yo){{var C=Xo;const Qx={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},rk=Qx[qk];if("AACH"===Px){Ga=new Uint8Array(4);const Rx=Qx[2*qk];Ga[0]=40|rk>>1;Ga[1]=rk<<7|C<<3|Rx>>1;Ga[2]=Rx<<7|8;Ga[3]=0;fc=new Uint16Array(2);fc[0]=(Ga[0]<<8)+Ga[1];fc[1]=(Ga[2]<<8)+Ga[3];Vc=fc[0].toString(16)+fc[1].toString(16)}else Ga=new Uint8Array(2),Ga[0]=16|rk>>1,Ga[1]=rk<<7|C<<3,fc=new Uint16Array(1),fc[0]=(Ga[0]<<8)+Ga[1],Vc=fc[0].toString(16);Yo=Vc.toUpperCase()}}var oa={id:B.W++,type:E,index:ii,bitrate:xf,Ec:Yo,maxHeight:Kb,
|
|
22
|
+
maxWidth:yf,yc:qk,$d:Xo,Of:Nx,Ne:Mx,Zf:Ox,Ye:Px,ab:null}}ec.push(oa)}var $a=ec}{const ec=[],hi=_.st(w,"c");for(let Gd=0;Gd<hi.length;Gd++){const fc=hi[Gd];let Ga=parseInt(fc.getAttribute("t"),10),Vc=parseInt(fc.getAttribute("d"),10),ii=parseInt(fc.getAttribute("r"),10),xf=0;if(isNaN(Ga)&&isNaN(Vc))throw t.f.error("Either one or both FragmentDuration and FragmentTime field MUST be present in StreamFragmentElement"),new _.H(_.G,4,4037,t.o);0===Gd&&isNaN(Ga)&&(xf=Ga=0);if(0<Gd){const Kb=ec[ec.length-
|
|
23
|
+
1];xf=Kb.n+1;Kb.d||(Kb.d=Ga-Kb.t);Ga||(Ga=Kb.t+Kb.d);Vc||(Vc=Ga-Kb.t)}ec.push({n:xf,d:Vc,t:Ga});if(ii){ii--;for(let Kb=0;Kb<ii;Kb++){const yf=ec[ec.length-1];xf=yf.n+1;Ga=yf.t+yf.d;Vc=yf.d;ec.push({n:xf,d:Vc,t:Ga})}}}t.D()||ec.length===dc||t.f.warn("Number of fragments ("+dc+") differs from number of chunks ("+ec.length+").");var rf=ec}var we={type:ab,Qf:dc,Bf:Qg,language:ye,name:Fd,maxWidth:Rg,maxHeight:vf,Ff:wf,tracks:$a,ee:rf,timescale:pk}}ta.push(we)}var Bd=ta}const bb={Xf:d,ke:e,timescale:f,
|
|
24
|
+
duration:g,isLive:h,Wf:k,bd:l,md:!1,streams:Bd};if(a.j&&a.B)return bF(a,bb),Promise.resolve();{const ta=bb.timescale,hb=bb.duration,Ia=LD(bb.streams,_.Tb),ab=LD(bb.streams,_.u),dc=LD(bb.streams,_.r),Qg=[];let ye=cF(a,hb,ta,Ia),Fd=cF(a,hb,ta,ab);const Rg=cF(a,hb,ta,dc);ye.length||(ye=[null]);Fd.length||(Fd=[null]);for(let vf=0;vf<Fd.length;vf++)for(let wf=0;wf<ye.length;wf++)Qg.push(dF(a,Fd[vf],ye[wf]));var Sg={startTime:0,variants:Qg,textStreams:Rg,thumbStreams:[]}}{var Wc=bb.streams;let ta=a.a.startTime,
|
|
25
|
+
hb=a.a.delay;const Ia=a.I;let ab=Math.min(a.a.duration||Infinity,Ia);const dc=a.D(),Qg=a.a.bd,ye=a.a.uc,Fd=a.H,Rg=isFinite(a.F)?a.F:0;if(dc)ab=Infinity,ta=Date.now()/1E3-ye,a.a.startTime=ta,hb=3*Fd;else{const vf=isFinite(Ia)?Ia:a.a.duration;for(const wf of Wc)for(const pk of wf.tracks)pk.ab.offset(-Rg),_.Wt(pk.ab,vf)}a.w=new _.ky(ta,hb,!0);a.w.f=!dc;a.w.Hb(ab);_.Nt(a.w,Fd);a.w.Xb=Qg;dc||a.w.offset(-Rg)}a.g.filterAllPeriods([Sg]);a.j={presentationTimeline:a.w,periods:[Sg],offlineSessionIds:[],minBufferTime:0};
|
|
26
|
+
Promise.resolve();a.K||(a.g.networkingEngine.Vc(a.L),a.K=!0);a.B=bb;return Promise.resolve()},fF=function(a,b){null!=a.C&&null!=b&&(a.m=window.setTimeout(a.T.bind(a),b))},YE=function(a,b,c){if(b=b.getAttribute(c))return b;a.f.error("required attribute not provided: "+c);throw new _.H(_.G,4,4038,a.o,c);},ZE=function(a,b){const c=b===aF;a.j&&a.j.presentationTimeline&&(a.j.presentationTimeline.f=c);c&&null!=a.m&&(window.clearTimeout(a.m),a.m=null,a.C=null);a.R=b},bF=function(a,b){for(let e=0;e<a.B.streams.length;e++){const f=
|
|
27
|
+
b.streams[e];for(const g of a.B.streams[e].tracks){var c=f.tracks.find(h=>h.type===g.type&&h.bitrate===g.bitrate);if(c){JD(g,c)||a.f.warn("The current stream is updated with a stream that seems to have different base properties!");var d=gF(a,a.B.timescale,f,c);c=g.ab;_.Ut(c,d);(d=a.a.bd)&&_.Vt(c,(c.a.length?c.a[c.a.length-1].endTime:0)-d)}else a.f.warn(`Cannot find satisfying update for ${g.type} `+`track with bitrate ${g.bitrate}. Skipping update.`)}}},gF=function(a,b,c,d){let e=0;const f=[],g=c.timescale||
|
|
28
|
+
b;c.ee.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=ID(a.o,c,k,d);a.H=Math.max(a.H,l);f.push(new _.Tt(k,h,m,()=>[n],0,null,0,null,!0,g));e+=l});if(c.type===_.u||c.type===_.Tb)b=f[f.length-1],a.I=Math.min(a.I,e),0===a.a.uc?a.a.uc=b.endTime:a.a.uc=Math.min(a.a.uc,b.endTime);return f},cF=function(a,b,c,d){let e=[];for(let f=0;f<d.length;f++){const g=d[f].tracks.map(h=>{var k=d[f],l=gF(a,c,k,h),m=new _.ly(l),n=null;k.type!==_.r&&(n=hF(a,b,c,k,h));h.ab=
|
|
29
|
+
m;l=a.N++;var q=Promise.resolve.bind(Promise),t=m.h.bind(m),w=m.get.bind(m),B=m.f.bind(m);m=m.getDuration.bind(m);var A=iF[k.type];var E="";switch(k.type){case _.u:E=h.Ec;var C=/00000001[0-9]7/.exec(E);E="avc1."+(C&&C[0]?E.substr(E.indexOf(C[0])+10,6):"42c00c");a.f.debug("VIDEO CODECS: ",E);break;case _.Tb:E=h.Ec,C=2,"AACH"===h.Ye?C=5:E&&(C=(parseInt(E.substr(0,2),16)&248)>>3),E="mp4a.40."+C,a.f.debug("AUDIO CODECS: ",E)}C=k.type===_.r?jF[k.Bf]:void 0;return h={id:l,originalId:null,ag:null,createSegmentIndex:q,
|
|
30
|
+
findSegmentPosition:t,getSegmentReference:w,adjustSegmentDurations:B,getDuration:m,initSegmentReference:n,mimeType:A,codecs:E,frameRate:void 0,bandwidth:h.bitrate,width:h.maxWidth||void 0,height:h.maxHeight||void 0,kind:C,encrypted:a.J(),keyId:null,language:k.language,label:k.name,type:k.type,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:h.$d||null,closedCaptions:null}});e=e.concat(g)}return e},dF=function(a,b,c){const d=(c?c.bandwidth:0)+(b?b.bandwidth:0),e=c?c.language:
|
|
31
|
+
_.se;return c||b?{id:a.N++,language:e,primary:!1,audio:c,video:b,bandwidth:d,drmInfos:a.A,allowedByApplication:!0,allowedByKeySystem:!0}:null},hF=function(a,b,c,d,e){b=KD(b,d.timescale||c,e);c={isLive:a.D.bind(a),Nc:a.J.bind(a),df:()=>1,gd:a.S.bind(a)};d=new Uint8Array(0);try{d=EE(b,c)}catch(g){throw a.f.error("Failed to generate initialization segment."),new _.H(_.G,3,4035,g);}const f="data:text/plain;base64,"+_.mi(d);return new _.jy(()=>[f],0,null,null,!0)},WD=class{constructor(a){this.type=a;this.size=
|
|
32
32
|
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;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=
|
|
33
|
-
Math.pow(2,32)-1;this.start=a.getPosition();this.size=this.a();this.size>b?_.M(a,1):_.M(a,this.size);_.
|
|
34
|
-
this.g=b;this.offset=c}a(){return this.g.byteLength+super.a()-this.offset}write(a){super.write(a);_.
|
|
35
|
-
_.
|
|
36
|
-
0),
|
|
37
|
-
this.g);_.M(a,1);_.M(a,0);_.M(a,0);_.M(a,0);a.getPosition()}},
|
|
38
|
-
0),_.M(a,this.h),_.M(a,0),_.M(a,this.duration*this.timescale));_.M(a,0);_.M(a,0);
|
|
39
|
-
this.timescale)):(_.M(a,0),_.M(a,0),_.M(a,this.timescale),_.M(a,this.duration*this.timescale));
|
|
40
|
-
0,0,0,0,0])}a(){return 2+this.g.byteLength+super.a()}write(a){super.write(a);
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
for(b=0;b<this.Ca.length;b++)a+=2,a+=this.Db[b].byteLength;return a+super.a()}write(a){super.write(a);
|
|
44
|
-
|
|
45
|
-
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()}},
|
|
46
|
-
a.getPosition()}},
|
|
47
|
-
this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},
|
|
48
|
-
0,0)}a(){return 4+super.a()}write(a){super.write(a);
|
|
49
|
-
super.a()}write(a){super.write(a);_.M(a,this.g);a.getPosition()}},
|
|
50
|
-
0;b<this.g;b++)this.flags&
|
|
51
|
-
_.M(a,this.g);this.flags&
|
|
52
|
-
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);
|
|
53
|
-
_.
|
|
54
|
-
this.version?_.M(a,this.offset[b]):
|
|
55
|
-
1&&(a+=1);for(let b=0;b<this.h;b++)if(a+=this.g[b].he.byteLength,this.flags&2){a+=2;for(let c=0;c<this.g[b].oc;c++)a+=2,a+=4}return a+super.a()}write(a){super.write(a);_.M(a,this.h);this.flags&1&&
|
|
56
|
-
(clearTimeout(this.m),this.m=null);this.K=!1;this.I=this.F=Infinity;return Promise.resolve()}update(){if(this.D())return
|
|
57
|
-
a){b=this.A[c].initData[0];break}return b}V(a){if(2!==a.request.type||a.uri.startsWith("data:"))return Promise.resolve(a);const b=a.request.timescale||this.B.timescale,c={isLive:this.D.bind(this),Nc:this.J.bind(this),df:()=>1,gd:this.S.bind(this)};let d=!1;const e=new _.H(_.G,3,4035,null);let f=null;try{f=
|
|
58
|
-
Lf:_.
|
|
33
|
+
Math.pow(2,32)-1;this.start=a.getPosition();this.size=this.a();this.size>b?_.M(a,1):_.M(a,this.size);_.Di(a,GD(this.type));this.size>b&&AD(a,this.size);"uuid"===this.type&&_.Di(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()}},kF=class extends WD{constructor(a,b,c){super(a);this.version=b;this.flags=c}a(){return 4+super.a()}write(a){super.write(a);BD(a,this.version);CD(a,this.flags)}},CE=class extends WD{constructor(a,b,c){super(a);
|
|
34
|
+
this.g=b;this.offset=c}a(){return this.g.byteLength+super.a()-this.offset}write(a){super.write(a);_.Di(a,this.g,this.offset);a.getPosition()}},IE=class extends kF{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);_.Di(a,this.g,this.offset);a.getPosition()}},BE=class extends WD{constructor(a,b,c){super("ftyp");this.h=a;this.ke=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);
|
|
35
|
+
_.Di(a,GD(this.h));_.M(a,this.ke);_.Di(a,GD(this.g.join("")));a.getPosition()}},AE=class extends WD{constructor(){super(_.nd)}},zE=class extends WD{constructor(){super(_.qe)}},cE=class extends kF{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,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?(AD(a,
|
|
36
|
+
0),AD(a,0),_.M(a,this.timescale),AD(a,this.duration*this.timescale)):(_.M(a,0),_.M(a,0),_.M(a,this.timescale),_.M(a,this.duration*this.timescale));_.M(a,65536);DD(a,this.volume);DD(a,0);_.M(a,0);_.M(a,0);for(let b=0;b<this.g.length;b++)BD(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()}},dE=class extends WD{constructor(){super("mvex")}},eE=class extends kF{constructor(a){super("trex",0,0);this.g=a}a(){return 20+super.a()}write(a){super.write(a);_.M(a,
|
|
37
|
+
this.g);_.M(a,1);_.M(a,0);_.M(a,0);_.M(a,0);a.getPosition()}},fE=class extends kF{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+this.g.length;return a+super.a()}write(a){super.write(a);1===this.version?(AD(a,0),AD(a,0),_.M(a,this.h),_.M(a,0),AD(a,this.duration*this.timescale)):(_.M(a,0),_.M(a,
|
|
38
|
+
0),_.M(a,this.h),_.M(a,0),_.M(a,this.duration*this.timescale));_.M(a,0);_.M(a,0);DD(a,0);DD(a,0);DD(a,this.volume);DD(a,0);for(let b=0;b<this.g.length;b++)BD(a,this.g[b]);DD(a,this.width);DD(a,0);DD(a,this.height);DD(a,0);a.getPosition()}},gE=class extends kF{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?(AD(a,0),AD(a,0),_.M(a,this.timescale),AD(a,this.duration*
|
|
39
|
+
this.timescale)):(_.M(a,0),_.M(a,0),_.M(a,this.timescale),_.M(a,this.duration*this.timescale));DD(a,this.language);DD(a,0);a.getPosition()}},hE=class extends kF{constructor(a){super("hdlr",0,0);this.g=a}a(){return 33+super.a()}write(a){super.write(a);_.M(a,0);this.g===_.u?_.Di(a,GD("vide")):_.Di(a,GD("soun"));_.M(a,0);_.M(a,0);_.M(a,0);this.g===_.u?_.Di(a,GD("VideoHandler\x00")):_.Di(a,GD("SoundHandler\x00"));a.getPosition()}},nE=class extends kF{constructor(){super("vmhd",0,1);this.g=new Uint8Array([0,
|
|
40
|
+
0,0,0,0,0])}a(){return 2+this.g.byteLength+super.a()}write(a){super.write(a);DD(a,0);_.Di(a,this.g);a.getPosition()}},lF=class extends WD{constructor(a){super(a);this.w=!0}a(){return 8+super.a()}write(a){super.write(a);_.M(a,0);DD(a,0);DD(a,1)}},mF=class extends lF{constructor(a){super(a);this.height=this.width=0;this.depth=24}a(){return 70+super.a()}write(a){super.write(a);DD(a,0);DD(a,0);_.M(a,0);_.M(a,0);_.M(a,0);DD(a,this.width);DD(a,this.height);_.M(a,4718592);_.M(a,4718592);_.M(a,0);DD(a,1);
|
|
41
|
+
BD(a,10);_.Di(a,GD("AVC Coding",31));DD(a,this.depth);FD(a,-1)}},nF=class extends lF{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);DD(a,this.channelCount);DD(a,this.sampleSize);FD(a,0);DD(a,0);DD(a,this.sampleRate);DD(a,0)}},mE=class extends mF{constructor(a,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()}},
|
|
42
|
+
XD=class extends mE{constructor(a,b){super(a,b);this.type="encv"}},pE=class extends nF{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()}},YD=class extends pE{constructor(a,b,c){super(a,b,c);this.type="enca"}},lE=class extends WD{constructor(a,b){super("avcC");this.Ca=a;this.Db=b;this.version=1;this.g=this.Ca[0][1];this.h=this.Ca[0][2];this.level=this.Ca[0][3]}a(){let a=7;for(var b=0;b<this.Ca.length;b++)a+=2,a+=this.Ca[b].byteLength;
|
|
43
|
+
for(b=0;b<this.Ca.length;b++)a+=2,a+=this.Db[b].byteLength;return a+super.a()}write(a){super.write(a);BD(a,this.version);BD(a,this.g);BD(a,this.h);BD(a,this.level);BD(a,255);BD(a,224|this.Ca.length);for(var b=0;b<this.Ca.length;b++)DD(a,this.Ca[b].length),_.Di(a,this.Ca[b]);BD(a,this.Db.length);for(b=0;b<this.Db.length;b++)DD(a,this.Db[b].length),_.Di(a,this.Db[b]);a.getPosition()}},oE=class extends kF{constructor(a){super("esds",0,0);this.xb=a}a(){return 22+(this.xb.byteLength+3)+super.a()}write(a){super.write(a);
|
|
44
|
+
BD(a,3);BD(a,23+this.xb.byteLength);DD(a,1);BD(a,0);BD(a,4);BD(a,15+this.xb.byteLength);BD(a,64);BD(a,21);CD(a,0);_.M(a,0);_.M(a,0);BD(a,5);BD(a,this.xb.byteLength);_.Di(a,this.xb);_.Di(a,new Uint8Array([6,1,2]));a.getPosition()}},jE=class extends kF{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&&_.Di(a,GD(this.location));a.getPosition()}},iE=class extends kF{constructor(){super("dref",0,0)}a(){let a=4;
|
|
45
|
+
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()}},rE=class extends WD{constructor(){super(_.ge)}},kE=class extends kF{constructor(){super(_.ie,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);
|
|
46
|
+
a.getPosition()}},sE=class extends kF{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()}},tE=class extends kF{constructor(){super("stsc",0,0)}a(){let a=4;for(let b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+super.a()}write(a){super.write(a);_.M(a,this.entries.length);for(let b=0;b<
|
|
47
|
+
this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},vE=class extends kF{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()}},uE=class extends kF{constructor(){super("stsz",0,0)}a(){return 8+super.a()}write(a){super.write(a);_.M(a,0);_.M(a,0);a.getPosition()}},qE=class extends kF{constructor(){super("smhd",
|
|
48
|
+
0,0)}a(){return 4+super.a()}write(a){super.write(a);FD(a,0);DD(a,0);a.getPosition()}},wE=class extends WD{constructor(){super("dinf")}},xE=class extends WD{constructor(){super(_.md)}},yE=class extends WD{constructor(){super(_.id)}},QE=class extends kF{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);1===this.version?AD(a,this.g):_.M(a,this.g);a.getPosition()}},FE=class extends kF{constructor(){super("mfhd",0,0);this.g=0}a(){return 4+
|
|
49
|
+
super.a()}write(a){super.write(a);_.M(a,this.g);a.getPosition()}},HE=class extends kF{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&oF&&(a+=4);this.flags&pF&&(a+=4);for(let b=0;b<this.g;b++)this.flags&qF&&(a+=4),this.flags&rF&&(a+=4),this.flags&sF&&(a+=4),this.flags&tF&&(a+=4);return a+super.a()}write(a){super.write(a);_.M(a,this.g);this.flags&oF&&(a.getPosition(),ED(a,this.j));this.flags&pF&&_.M(a,this.m);for(let b=
|
|
50
|
+
0;b<this.g;b++)this.flags&qF&&_.M(a,this.o[b]),this.flags&rF&&_.M(a,this.sampleSize[b]),this.flags&sF&&_.M(a,this.A[b]),this.flags&tF&&(0===this.version?_.M(a,this.h[b]):ED(a,this.h[b]));a.getPosition()}},oF=1,pF=4,qF=256,rF=512,sF=1024,tF=2048,GE=class extends kF{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&uF&&(a+=8);this.flags&vF&&(a+=4);this.flags&wF&&(a+=4);this.flags&xF&&(a+=4);this.flags&yF&&(a+=4);return a+super.a()}write(a){super.write(a);
|
|
51
|
+
_.M(a,this.g);this.flags&uF&&AD(a,this.h);this.flags&vF&&_.M(a,this.A);this.flags&wF&&_.M(a,this.j);this.flags&xF&&_.M(a,this.o);this.flags&yF&&_.M(a,this.m);a.getPosition()}},uF=1,vF=2,wF=8,xF=16,yF=32,ME=class extends WD{constructor(){super("traf")}},NE=class extends WD{constructor(){super("moof")}},LE=class extends WD{constructor(){super(_.hd);this.g=new Uint8Array(0)}a(){return this.g.byteLength+super.a()}write(a){super.write(a);0<this.g.byteLength&&_.Di(a,this.g)}},ZD=class extends kF{constructor(){super("tenc",
|
|
52
|
+
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);BD(a,0);0===this.version?BD(a,0):BD(a,0);BD(a,this.g);BD(a,this.h);_.Di(a,_.oi(this.m));if(1===this.g&&0===this.h){BD(a,0);for(let b=0;b<this.j.length;b++)BD(a,this.j[b])}a.getPosition()}},aE=class extends kF{constructor(a,b){super("schm",0,0);this.g=a;this.h=b;this.rb=""}a(){let a=8;this.flags&1&&(a+=GD(this.rb).byteLength);return a+super.a()}write(a){super.write(a);
|
|
53
|
+
_.Di(a,GD(this.g));_.M(a,this.h);this.flags&1&&_.Di(a,GD(this.rb));a.getPosition()}},$D=class extends WD{constructor(a){super("frma");this.g=a}a(){return GD(this.g).byteLength+super.a()}write(a){super.write(a);_.Di(a,GD(this.g));a.getPosition()}},RE=class extends kF{constructor(){super("saio",0,0);this.offset=[0]}a(){let a=0;this.flags&1&&(a+=8);a+=4;for(let b=0;1>b;b++)a=0===this.version?a+4:a+8;return a+super.a()}write(a){super.write(a);this.flags&1&&(_.M(a,0),_.M(a,0));_.M(a,1);for(let b=0;1>b;b++)0===
|
|
54
|
+
this.version?_.M(a,this.offset[b]):AD(a,this.offset[b]);a.getPosition()}},SE=class extends kF{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));BD(a,this.g);_.M(a,this.h);if(0===this.g)for(let b=0;b<this.h;b++)BD(a,this.j[b]);a.getPosition()}},KE=class extends kF{constructor(a,b){super("senc",a,b);this.h=0;this.j=8;this.g=[]}a(){let a=4;this.flags&
|
|
55
|
+
1&&(a+=1);for(let b=0;b<this.h;b++)if(a+=this.g[b].he.byteLength,this.flags&2){a+=2;for(let c=0;c<this.g[b].oc;c++)a+=2,a+=4}return a+super.a()}write(a){super.write(a);_.M(a,this.h);this.flags&1&&BD(a,this.j);for(let b=0;b<this.h;b++)if(_.Di(a,this.g[b].he),this.flags&2){DD(a,this.g[b].oc);for(let c=0;c<this.g[b].oc;c++)DD(a,this.g[b].Nd[c].Yd),_.M(a,this.g[b].Nd[c].Zd)}a.getPosition()}};var PE=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))}},ND=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,OD=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,PD=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,QD=/^(\d*\.?\d*)f$/,RD=/^(\d*\.?\d*)t$/,SD=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/;var DE=class{constructor(a){this.a=a;this.f=UD(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=UD(this);for(let a=0;a<this.a.length;a++)this.a[a].write(this.f);return this.f.buffer}};var JE=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);var zF=class{constructor(){this.B=this.j=this.h=this.g=null;this.N=1;this.W=0;this.o="";this.w=this.a=null;this.f=new _.O("clpp.smooth.SmoothParser");this.K=!1;this.m=this.C=null;this.R=aF;this.H=0;this.F=this.I=Infinity;this.A=[];this.L=this.V.bind(this)}configure(a){this.h=a}start(a,b){this.g=b;a=[...new Set([a,HD(a)])];return XE(this,a).then(c=>eF(this,c.data).then(()=>{fF(this,this.C);return this.j}))}stop(){this.g&&this.g.networkingEngine.Gd(this.L);this.C=this.B=this.j=this.h=this.g=null;this.m&&
|
|
56
|
+
(clearTimeout(this.m),this.m=null);this.K=!1;this.I=this.F=Infinity;return Promise.resolve()}update(){if(this.D())return XE(this,[this.o]).then(a=>eF(this,a.data).then(()=>this.j)).catch(a=>{if(this.g)this.g.onError(a)})}onExpirationUpdated(){}T(){this.f.debug(_.Is);this.g&&(this.m=null,this.update().then(()=>{fF(this,this.C)}).catch(a=>{this.g&&(this.g.onError(a),1===a.severity&&fF(this,100))}))}D(){return this.R===$E}J(){return 0<this.A.length}S(a){let b=null;if(this.A.length)for(let c=0;c<this.A.length;c++)if(this.A[c].keySystem===
|
|
57
|
+
a){b=this.A[c].initData[0];break}return b}V(a){if(2!==a.request.type||a.uri.startsWith("data:"))return Promise.resolve(a);const b=a.request.timescale||this.B.timescale,c={isLive:this.D.bind(this),Nc:this.J.bind(this),df:()=>1,gd:this.S.bind(this)};let d=!1;const e=new _.H(_.G,3,4035,null);let f=null;try{f=TE(a,b,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)}},iF={video:_.Ee,audio:_.Xb,text:_.Pb},aF="VOD",$E="LIVE",jF={Jf:"caption",
|
|
58
|
+
Lf:_.Ss};_.x("clpp.smooth.SmoothComponent",class extends _.zo{constructor(){super()}f(){_.Cm.ism=zF;_.Am[_.Qb]=zF}a(){_.Zt("ism");_.$t(_.Qb)}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
|
-
|
|
3
|
-
a[c]*d[c];return b},
|
|
4
|
-
"SINGLE":null},
|
|
5
|
-
c+_.
|
|
6
|
-
(this.a.naturalWidth||this.a.width)/this.g);this.height||(this.height=(this.a.naturalHeight||this.a.height)/this.m);this.x||(this.x=this.width*this.h);this.y||(this.y=this.height*this.j)};if(this.a.src&&this.a.complete)c(),a(this);else{var d=null,e=()=>{c();this.a.removeEventListener("load",e);this.a.removeEventListener(_.
|
|
7
|
-
return this.f}};_.x("clpp.thumbnails.Thumbnail",
|
|
8
|
-
|
|
9
|
-
this.a
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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&&!_.y(d=a.getSegmentReference(c++));){const e=
|
|
16
|
-
e.Td,l,k,g)),h+=e.durationPerTile}}return Promise.resolve()}};var
|
|
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();this.f.info(_.
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Br="No thumbnail duration or URL specified",Cr="No thumbnail found for position ",Dr="Position is out of range: ",Er="Thumbnail URL is mandatory",Fr="Wrong gridSize format",Gr="clpp.thumbnails",Ir=function(a,b){b.reduce((c,d)=>{let e=d,f=!1;typeof d===_.td&&(e=d.step,f=d.preloadWhileBuffering);return c.then(()=>Hr(a,0,e,!!f))},Promise.resolve())},Hr=function(a,b,c,d){if(a.w||b>=a.a.length)return Promise.resolve();const e=b+c;return Jr(a,d).then(()=>a.a[b].load()).then(()=>Hr(a,e,
|
|
2
|
+
c,d))},Jr=function(a,b){return new Promise(c=>{if(b||a.g.getState()!==_.Dk)c();else a.g.one(_.bc,()=>{c()})})},Kr=function(a){const b=a.f.byteLength;a.a.forEach(c=>{c.offset+c.length<b&&c.a.resolve()})},Nr=function(a,b){return Lr(a,b).then(c=>new Mr(c,b.time,b.duration))},Lr=function(a,b){return b.load().then(()=>{const c=_.L(a.f,b.offset,b.length);return"data:image/jpeg;base64,"+_.li(c)})},Or=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},Pr=function(a,b){let c=null;for(const d of a)d.startTime<=b&&(c=d);return c},Qr=function(a,b){const c=a.horizontalTiles||b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{sc:c,Td:d,ge:e,durationPerTile:a.durationPerTile||b.durationPerTile||(a.endTime-a.startTime)/e}},Rr=function(a){return a.some(b=>0<b.thumbStreams.length)},Sr=function(a){if(!a)return null;a=new _.Vi(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 Tr=class{constructor(){this.log=new _.O(Gr);this.g=null;this.a=[];this.w=!1}init(a,b){this.g=a;a.one(_.Td,()=>{this.w=!0});a.isLive()||this.m().then(()=>{b&&b.preload&&Ir(this,b.preload)})}};var Mr=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.a=n;this.g=h;this.m=k;this.h=l;this.j=m;this.f=null}raw(){return this.a.cloneNode(!1)}element(a,b){let c=this.width,d=this.height;const e=this.width/this.height;void 0!==a&&void 0===b&&(b=0);null!==a&&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(_.Gc);a.style.width=
|
|
5
|
+
c+_.Qd;a.style.height=d+_.Qd;a.style.backgroundColor="#000";a.style.backgroundRepeat="no-repeat";a.style.backgroundImage=`url("${this.src}")`;a.style.backgroundSize=`${Math.ceil(c/this.width*(this.a.naturalWidth||this.a.width))}px ${Math.ceil(d/this.height*(this.a.naturalHeight||this.a.height))}px`;b=this.y/this.height;a.style.backgroundPositionX="-"+this.x/this.width*c+_.Qd;a.style.backgroundPositionY="-"+b*d+_.Qd;return a}load(){this.f||(this.f=new Promise((a,b)=>{const c=()=>{this.width||(this.width=
|
|
6
|
+
(this.a.naturalWidth||this.a.width)/this.g);this.height||(this.height=(this.a.naturalHeight||this.a.height)/this.m);this.x||(this.x=this.width*this.h);this.y||(this.y=this.height*this.j)};if(this.a.src&&this.a.complete)c(),a(this);else{var d=null,e=()=>{c();this.a.removeEventListener("load",e);this.a.removeEventListener(_.Qc,d);a(this)};d=()=>{this.a.removeEventListener("load",e);this.a.removeEventListener(_.Qc,d);b()};this.a.addEventListener("load",e);this.a.addEventListener(_.Qc,d);this.a.src=this.src}}));
|
|
7
|
+
return this.f}};_.x("clpp.thumbnails.Thumbnail",Mr);Mr.prototype.load=Mr.prototype.load;Mr.prototype.element=Mr.prototype.element;Mr.prototype.raw=Mr.prototype.raw;var Ur=class extends Tr{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,Er);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(Br,c,d),new _.H(_.G,7,7100,Br);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,Fr);}catch(e){throw this.log.error("Error during parsing gridSize",e),new _.H(_.G,7,7100,Fr);}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(Dr+a);const d=this.a[c];return d?d.load().then(()=>d):Promise.reject(Cr+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 Mr(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 Vr=class{constructor(a,b){this.time=a;this.duration=0;this.offset=b;this.length=0;this.a=new _.Pj}load(){return this.a}},Xr=class{constructor(){this.g=new _.O(Gr);this.f=new ArrayBuffer(0);this.a=[];this.h=new _.Pj}init(a,b){if(!b||!b.url)throw new _.H(_.G,7,7100,Er);b=_.zg(b.url);b.type=_.yg;a.getNetworkEngine().fetch(b).O.then(c=>{{var d=c.data;c=_.L(this.f);d=_.L(d);const e=c.byteLength+d.byteLength,f=new ArrayBuffer(e),g=new DataView(f);let h=0;for(let k=0,l=c.byteLength;k<l;k++)g.setUint8(h,
|
|
10
|
+
c[k]),h+=1;for(let k=0,l=d.byteLength;k<l;k++)g.setUint8(h,d[k]),h+=1;this.f=f;this.g.info(`Appended ${d.byteLength} bytes.`+`Total data now ${e} bytes.`)}}).then(()=>{{var c=this.f,d=_.L(c),e=String.fromCharCode.apply(null,Wr),f=Array.prototype.slice.call(d,0,8);d=64;let h=0;var g=!1;if(e===String.fromCharCode.apply(null,f))for(c=new DataView(c,16,20),c=c.getUint32(0,!0),0===c&&(c=1E3);!g;){h+=1;f=c;e=new DataView(this.f,d);g=e.getUint32(0,!0);f=g*f/1E3;e=e.getUint32(4,!0);e=new Vr(f,e);if(f=this.a.length)f=
|
|
11
|
+
this.a[f-1],f.length=e.offset-f.offset,f.duration=e.time-f.time;this.a.push(e);d+=8;(g=4294967295===g)&&this.h.resolve();if(1E5<h)throw Error("There was a problem during reading BIF entries");}else throw Error("The file is not a valid BIF format");}}).then(()=>{Kr(this)}).catch(c=>{this.g.error("Error while loading thumbnail index",c)})}get(a){return 0>a?Promise.reject(Dr+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 Nr(this,c).then(d=>
|
|
12
|
+
d.load().then(()=>d))}return Promise.reject(Cr+a)})}},Wr=[137,66,73,70,13,10,26,10];var Yr=class extends Tr{constructor(){super();this.f=null}init(a,b){if(!b||!b.url)throw new _.H(_.G,7,7100,Er);const c=b.url,d=_.zg(c);d.type=_.yg;this.f=a.getNetworkEngine().fetch(d).O.then(e=>{if(e=e.data){e=_.jg(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=Or(g[0]);g=Or(g[1])-l;this.a.push(new Mr(f,l,g,h,n,q,k,0,0))}}}}).catch(e=>{this.log.error("[VTT] Error while loading thumbnail",e)});super.init(a,b)}get(a){return 0>a?Promise.reject(Dr+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(Cr+a)})}m(){return this.f}};var Zr=class extends Tr{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=Pr(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=Qr(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.ge+a]);else if((c=d.Ka())&&0<c.length){let g=0,h=0;d=d.startTime;1<e.ge&&(g=a%e.sc,h=Math.floor(a/e.sc),d+=a*e.durationPerTile);f=new Mr(c[0],d,e.durationPerTile,void 0,void 0,void 0,void 0,e.sc,e.Td,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&&!_.y(d=a.getSegmentReference(c++));){const e=Qr(d,a),f=d.Ka()[0],g=new Image;let h=d.startTime;for(let k=0;k<e.Td;++k)for(let l=0;l<e.sc;++l)this.a.push(new Mr(f,h,e.durationPerTile,void 0,void 0,void 0,void 0,e.sc,
|
|
16
|
+
e.Td,l,k,g)),h+=e.durationPerTile}}return Promise.resolve()}};var $r=class{constructor(){this.f=new _.O(Gr);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=Sr(c.url||null)),b&&("SINGLE"===b||"GRID"===b?this.a=new Ur:"WEBVTT"===b?this.a=new Yr:"BIF"===b&&(this.a=new Xr)),this.a&&(this.f.info("Loading thumbs configuration",c),this.l.one(_.fd,()=>{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();this.f.info(_.vd,c);Rr(c)&&(this.a=new Zr,this.a.init(a,b))}}}get(a){return this.a?this.a.get(a):Promise.reject()}id(){return"thumbnails"}};_.x("clpp.thumbnails.ThumbnailsPlugin",$r);$r.prototype.get=$r.prototype.get;$r.Id="thumbnails";_.Ll(new class{create(){return new $r}});};f.call(g, window);
|