@castlabs/prestoplay 6.32.0-beta.3 → 6.32.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 +5 -0
- package/cjs/cl.adobe.js +3 -3
- package/cjs/cl.airplay.js +3 -3
- package/cjs/cl.broadpeak.js +18 -18
- package/cjs/cl.cast.js +126 -126
- package/cjs/cl.conviva.js +32 -32
- package/cjs/cl.core.js +604 -604
- package/cjs/cl.crypto.js +9 -9
- package/cjs/cl.dash.js +101 -101
- package/cjs/cl.externs.js +1 -29
- package/cjs/cl.freewheel.js +26 -26
- package/cjs/cl.hls.js +77 -77
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +30 -30
- package/cjs/cl.ima.js +26 -26
- package/cjs/cl.mediatailor.js +3 -3
- package/cjs/cl.mse.js +352 -352
- package/cjs/cl.muxdata.js +14 -14
- package/cjs/cl.onboard.js +4 -4
- package/cjs/cl.persistent.js +14 -14
- package/cjs/cl.playlist.js +6 -6
- package/cjs/cl.simid.js +16 -16
- package/cjs/cl.smooth.js +71 -71
- package/cjs/cl.thumbnails.js +25 -25
- package/cjs/cl.tizen.js +71 -71
- package/cjs/cl.ttml.js +29 -29
- package/cjs/cl.verimatrix.js +5 -5
- package/cjs/cl.vimond.js +12 -12
- package/cjs/cl.vr.js +18 -18
- package/cjs/cl.vtt.js +14 -14
- package/cjs/cl.yospace.js +4 -4
- package/cjs/cl.youbora.js +38 -38
- package/cjs/polyfill.min.js +2 -2
- package/cl.adobe.js +3 -3
- package/cl.airplay.js +3 -3
- package/cl.broadpeak.js +14 -14
- package/cl.cast.js +100 -100
- package/cl.conviva.js +27 -27
- package/cl.core.js +488 -487
- package/cl.crypto.js +8 -8
- package/cl.dash.js +75 -75
- package/cl.externs.js +1 -25
- package/cl.freewheel.js +20 -20
- package/cl.hls.js +65 -65
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +26 -26
- package/cl.ima.js +19 -19
- package/cl.mediatailor.js +2 -2
- package/cl.mse.js +200 -200
- package/cl.muxdata.js +12 -12
- package/cl.onboard.js +3 -3
- package/cl.persistent.js +8 -8
- package/cl.playlist.js +4 -4
- package/cl.simid.js +2 -2
- package/cl.smooth.js +47 -47
- package/cl.thumbnails.js +12 -12
- package/cl.tizen.js +41 -41
- package/cl.ttml.js +10 -10
- package/cl.verimatrix.js +4 -4
- package/cl.vimond.js +8 -8
- package/cl.vr.js +3 -3
- package/cl.vtt.js +11 -11
- package/cl.yospace.js +3 -3
- package/cl.youbora.js +27 -27
- package/package.json +1 -1
- package/typings.d.ts +6 -22
- package/cjs/cl.cdn.js +0 -13
- package/cl.cdn.js +0 -7
package/cl.muxdata.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var cA=function(a){switch(a.type){case 1:return $z;case 2:return aA;case 3:return bA}},eA=function(a){const b=Object.keys(a).find(c=>dA.includes(c.toLowerCase()));return void 0!==b?a[b]:void 0},gA=function(a){let b={debug:!0,data:fA(a)};a.f&&a.f.muxOptionsOverride&&_.
|
|
2
|
-
var e={player_is_paused:a.m.isPaused(),player_is_fullscreen:f.isFullscreen(),video_source_duration:1E3*a.m.getDuration(),player_autoplay_on:!!a.m.getConfiguration().autoplay};if(c){const k=new _.
|
|
3
|
-
videoHeight:c.height});const {videoWidth:g,videoHeight:h}=c;a.g.debug(`Video dimensions: ${g}x${h}`);g&&h&&(e.video_source_height=g,e.video_source_width=h);(d=d.ra())&&d.language&&(e.player_language_code=d.language)}return e}});a.g.debug("Mux SDK options",b);return b},hA=function(a){_.
|
|
4
|
-
player_mux_plugin_version:_.ea};(a=a.m.getConfiguration().viewerId)&&(b.viewer_user_id=a);return b},iA=function(a){a.a.on(a.m,_.gg,()=>{const b={player_playhead_time:1E3*a.m.getPosition()};a.emit(_.gg,b)});a.a.on(a.m,_.Xe,()=>a.emit(_.Xe));a.a.on(a.m,_.
|
|
5
|
-
{a.emit("adplay");a.emit("adplaying")});a.a.on(a.m,_.hc,()=>a.emit("adpause"));a.a.on(a.m,_.kc,()=>{a.emit("adplay");a.emit("adplaying")});a.a.on(a.m,_.nc,()=>a.emit("adended"));a.a.on(a.m,_.Zb,()=>a.emit("adfirstquartile"));a.a.on(a.m,_.ec,()=>a.emit("admidpoint"));a.a.on(a.m,_.oc,()=>a.emit("adthirdquartile"));a.j.
|
|
6
|
-
var d=new _.
|
|
7
|
-
a.g.debug("onRequestFailed()","Track event: requestfailed",b);a.emit("requestfailed",b)}}}})},jA=function(a,b){a.trigger(new _.H(_.
|
|
8
|
-
a),this.l=!1);iA(this)}release(){this.g.debug("release()");this.l?this.g.debug(_.ia):(hA(this),this.l=!0,this.o=this.f=null)}destroy(){this.g.debug(_.
|
|
9
|
-
switch(a.detail.currentState){case 1:this.m.getConfiguration().autoplay&&this.emit(_.Xe);break;case 3:this.emit(_.hf);break;case 4:this.emit(_.Te);break;case 5:this.emit(_.
|
|
10
|
-
this.emit(_.
|
|
11
|
-
request_response_end:a,request_response_headers:e,request_media_duration:c,request_url:_.
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var cA=function(a){switch(a.type){case 1:return $z;case 2:return aA;case 3:return bA}},eA=function(a){const b=Object.keys(a).find(c=>dA.includes(c.toLowerCase()));return void 0!==b?a[b]:void 0},gA=function(a){let b={debug:!0,data:fA(a)};a.f&&a.f.muxOptionsOverride&&_.hh(a.f.muxOptionsOverride)&&(b=_.dh(b,a.f.muxOptionsOverride));b=_.dh(b,{getPlayheadTime:()=>1E3*a.m.getPosition(),getStateData:()=>{{a.g.debug("getStateData()");var c=a.m.Ra(),d=a.m.getTrackManager();const f=a.m.getSurface();
|
|
2
|
+
var e={player_is_paused:a.m.isPaused(),player_is_fullscreen:f.isFullscreen(),video_source_duration:1E3*a.m.getDuration(),player_autoplay_on:!!a.m.getConfiguration().autoplay};if(c){const k=new _.gp(c.url);e.video_source_url=_.Mm(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.m.getSurface().getMedia())?c={videoWidth:c.videoWidth,videoHeight:c.videoHeight}:(c=a.m.getTrackManager().ta(),c={videoWidth:c.width,
|
|
3
|
+
videoHeight:c.height});const {videoWidth:g,videoHeight:h}=c;a.g.debug(`Video dimensions: ${g}x${h}`);g&&h&&(e.video_source_height=g,e.video_source_width=h);(d=d.ra())&&d.language&&(e.player_language_code=d.language)}return e}});a.g.debug("Mux SDK options",b);return b},hA=function(a){_.Xh(a.a);a.j.Ie(a.F);a.j.Xg(a.C)},fA=function(a){const b={env_key:a.f.envKey,video_title:a.o&&a.o.name||"",player_name:_.ra,player_software_name:_.ra,player_software_version:_.ea,player_mux_plugin_name:"CastlabsPlayer built-in Mux Plugin",
|
|
4
|
+
player_mux_plugin_version:_.ea};(a=a.m.getConfiguration().viewerId)&&(b.viewer_user_id=a);return b},iA=function(a){a.a.on(a.m,_.gg,()=>{const b={player_playhead_time:1E3*a.m.getPosition()};a.emit(_.gg,b)});a.a.on(a.m,_.Xe,()=>a.emit(_.Xe));a.a.on(a.m,_.Nc,a.G.bind(a));a.a.on(a.m,_.Rf,a.I.bind(a));a.a.on(a.m,_.ug,()=>a.emit(_.Jf));a.a.on(a.m,_.tg,()=>a.emit(_.If));a.a.on(a.m,_.Yd,a.H.bind(a));a.a.on(a.m,_.Ub,()=>a.emit("adbreakstart"));a.a.on(a.m,_.Vb,()=>a.emit("adbreakend"));a.a.on(a.m,_.mc,()=>
|
|
5
|
+
{a.emit("adplay");a.emit("adplaying")});a.a.on(a.m,_.hc,()=>a.emit("adpause"));a.a.on(a.m,_.kc,()=>{a.emit("adplay");a.emit("adplaying")});a.a.on(a.m,_.nc,()=>a.emit("adended"));a.a.on(a.m,_.Zb,()=>a.emit("adfirstquartile"));a.a.on(a.m,_.ec,()=>a.emit("admidpoint"));a.a.on(a.m,_.oc,()=>a.emit("adthirdquartile"));a.j.vd(a.F);a.j.Uf(a.C);a.a.on(a.m,_.Yd,b=>{if((b=b.detail)&&1===b.category){var c=b.data;c=c&&c.request;if(void 0!==c&&!0===(1===c.type||2===c.type||3===c.type))if(7001===b.code){b=c;c=b.requestStartTimestamp;
|
|
6
|
+
var d=new _.gp(b.uris[b.uriIndex]);b={request_start:c,request_type:cA(b),request_hostname:d.a};a.g.debug("onRequestCanceled()","Track event: requestcanceled",b);a.emit("requestcanceled",b)}else{{d=c.requestStartTimestamp;const f=new _.gp(c.uris[c.uriIndex]);var e=b.data;e=void 0===e?-1:void 0!==e.response?e.response.status:void 0!==e.status?e.status:-1;b={request_start:d,request_type:cA(c),request_hostname:f.a,request_error:`${cA(c)}${"LoadError"}`,request_error_code:e,request_error_text:b.toString()};
|
|
7
|
+
a.g.debug("onRequestFailed()","Track event: requestfailed",b);a.emit("requestfailed",b)}}}})},jA=function(a,b){a.trigger(new _.H(_.Yd,{detail:b}))},kA=function(a){return!_.z(a)&&typeof a.init===_.be&&typeof a.emit===_.be},$z="manifest",aA="media",bA="encryption",dA=["x-request-id","cf-ray","x-amz-cf-id","x-akamai-request-id"];var lA=class{constructor(a,b){this.m=a;this.o=this.f=null;this.B=("000000"+(Math.random()*Math.pow(36,6)<<0).toString(36)).slice(-6);this.a=new _.Qt;this.g=b;this.A=this.l=this.h=!1;this.w=null;this.j=a.getNetworkEngine();this.F=this.K.bind(this);this.C=this.J.bind(this)}initialize(a,b,c){this.f=a;this.o=b;this.w=c;if(!this.h){try{this.h=!0,this.w.init(this.B,gA(this))}catch(d){throw this.h=!1,hA(this),new _.I(1,9,9302,null,d);}this.emit("playerready")}this.l&&!this.A&&(a=fA(this),this.emit("videochange",
|
|
8
|
+
a),this.l=!1);iA(this)}release(){this.g.debug("release()");this.l?this.g.debug(_.ia):(hA(this),this.l=!0,this.o=this.f=null)}destroy(){this.g.debug(_.Ed);this.A?this.g.debug(_.ha):(this.A=!0,this.emit("destroy"))}emit(a,b){if(null===this.w)throw new _.I(1,9,9301);this.w.emit(this.B,a,b)}G(a){this.g.debug(_.Je);var b=a.detail;a=this.m.getTrackManager();b&&b.bandwidth&&(b=b.bandwidth,(a=a.Pa())&&a.bandwidth&&(b+=a.bandwidth),this.emit("renditionchange",{video_source_bitrate:b}))}I(a){this.g.debug(_.Oe);
|
|
9
|
+
switch(a.detail.currentState){case 1:this.m.getConfiguration().autoplay&&this.emit(_.Xe);break;case 3:this.emit(_.hf);break;case 4:this.emit(_.Te);break;case 5:this.emit(_.Xd)}}H(a){this.g.debug(_.Le);if(this.h&&(a=a.detail||null))if(10003===a.code)this.emit("aderror");else if(a.severity===_.D){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)}`;
|
|
10
|
+
this.emit(_.Yd,{player_error_code:a.code,player_error_message:b})}}K(a){var b=a.request;if(b=void 0!==b&&!0===(1===b.type||2===b.type||3===b.type))b=a.status,b=void 0!==b&&200<=b&&299>=b;if(b){{b=a.request;const e=a.headers,f=b.bytesLoaded,g=b.requestStartTimestamp;var c=b.startTime,d=b.endTime;const h=g+a.responseStartMs;a=g+a.timeMs;c=c&&d?d-c:void 0;d=new _.gp(b.uris[b.uriIndex]);a={request_start:g,request_type:cA(b),request_hostname:d.a,request_id:eA(e),request_bytes_loaded:f,request_response_start:h,
|
|
11
|
+
request_response_end:a,request_response_headers:e,request_media_duration:c,request_url:_.Mm(d)};this.g.debug("onRequestCompleted()","Track event: requestcompleted",a);this.emit("requestcompleted",a)}}}J(a){a.requestStartTimestamp=Date.now()}};var mA=class extends _.Uv{constructor(){super();this.f=this.m=null;this.a=!1;this.g=new _.T("clpp.muxdata")}onPlayerCreated(a){this.m=a;this.f=new lA(a,this.g)}onContentWillLoad(a,b){var c=a.getConfiguration();c=_.eh(c.muxdata);try{var d=[];typeof c===_.Ie&&(c.envKey||d.push("envKey"));if(0<d.length)throw new _.I(1,9,9300,{missingKeys:d});{const f=a.getConfiguration();d=null;if(this.a=!_.z(f.muxdata)&&typeof f.muxdata===_.Ie){const g=f.muxdata;d=kA(g.muxLib)?g.muxLib:window.mux;if(!kA(d)){this.g.warn("Mux SDK is not loaded. Will do nothing.");
|
|
12
12
|
this.a=!1;const h=new _.I(1,9,9301);jA(a,h)}}else this.g.debug("Mux plugin is loaded but not configured. Will do nothing.");var e=d}null!==e&&this.f.initialize(c,b,e)}catch(f){this.a=!1,jA(a,f)}}onContentLoaded(){}onPlayerWillDestroy(){this.a&&(this.f.destroy(),this.m=this.f=null)}onPlayerWillRelease(){this.a&&this.f.release()}id(){return"mux"}emit(a,b){try{this.f.emit(a,b)}catch(c){throw null!==this.m&&jA(this.m,c),c;}}};_.x("clpp.muxdata.MuxDataPlugin",mA);mA.prototype.emit=mA.prototype.emit;
|
|
13
|
-
mA.Id="mux";_.
|
|
13
|
+
mA.Id="mux";_.Pn(new class{create(){return new mA}});};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 Zz=function(a,b){let c=b.baseUrl;_.
|
|
2
|
-
a.
|
|
3
|
-
_.x("clpp.onboard.OnboardComponent",class extends _.Ev{constructor(){super();this.g=new _.T("clpp.onboard");this.a=new Set}uninstall(){for(const a of this.a)delete _.
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Zz=function(a,b){let c=b.baseUrl;_.vi(c,"/")||(c+="/");var d=h=>h&&(_.ui(h,_.ge)||_.ui(h,"http://")||_.ui(h,"//"))?h:`${c}${h}`;const e=d(b.widevineUrl||"widevine"),f=d(b.playreadyUrl||"playready");d=d(b.fairplayUrl||"fairplay");b=b.serverCertificate;const g=_.Oo("V2");a=new _.Eu(a);a.jb(_.xd,{licenseUrl:e,videoRobustness:[_.pb,void 0],audioRobustness:[_.ob,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:_.Po(b,g),modifiers:{licenseRequest:_.vp,
|
|
2
|
+
licenseResponse:_.wp}});a.jb(_.td,{licenseUrl:d,certificateUrl:d,modifiers:{licenseRequest:_.yp,licenseResponse:_.zp,extractContentId:_.Ap,certificateRequest:_.Bp}});a.jb(_.vd,{licenseUrl:f,modifiers:{licenseRequest:_.vp}});_.jn(a)};
|
|
3
|
+
_.x("clpp.onboard.OnboardComponent",class extends _.Ev{constructor(){super();this.g=new _.T("clpp.onboard");this.a=new Set}uninstall(){for(const a of this.a)delete _.hn[a];this.a.clear()}beforeLoad(a){a=a.getConfiguration().drm;var 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,serverCertificate:a.serverCertificate,playreadyUrl:a.playreadyUrl,fairplayUrl:a.fairplayUrl},this.g.info(`Registering the DRMtoday Onboard environment, name='${b}'`),
|
|
4
4
|
Zz(b,a),this.a.add(b))}id(){return"onboard"}});_.x("clpp.onboard.register",Zz);};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 Kz="A persistent DRM session already exists for: ",Lz="No DRM configuration.",Mz="clpp.persistent",Nz="clpp.persistent.SimpleSessionStorage",Pz=function(a,b,c,d,e,f){a.K=Oz;const g=new Map,h=_.
|
|
2
|
-
initData:null,keyIds:null}]});return _.
|
|
3
|
-
d.drm=a;a=new _.
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Kz="A persistent DRM session already exists for: ",Lz="No DRM configuration.",Mz="clpp.persistent",Nz="clpp.persistent.SimpleSessionStorage",Pz=function(a,b,c,d,e,f){a.K=Oz;const g=new Map,h=_.kq(b);g.set(h,{audioCapabilities:e,videoCapabilities:f,distinctiveIdentifier:_.Qe,persistentState:_.Af,sessionTypes:[_.Ve],label:h,drmInfos:[{keySystem:b,licenseServerUri:c,distinctiveIdentifierRequired:!1,persistentStateRequired:!0,audioRobustness:"",videoRobustness:"",serverCertificate:d,
|
|
2
|
+
initData:null,keyIds:null}]});return _.Dq(a,g)},Rz=function(a,b){a.K=Qz;a.L=[];a.G=!0;return _.Eq(a,b)},Sz=function(a,b){return _.w(function*(){const c=yield _.Vq(a,b);if(c){var d=[],e=a.h.get(c);e&&a.C&&(e.vc=new _.Gl,d.push(e.vc));a.g.debug("Attempting to remove session",b);d.push(c.remove());return Promise.all(d)}a.g.debug("Ignoring attempt to remove missing session",b)})},Tz=function(a){const b=[];for(const c of a.h.keys())b.push(c.sessionId);return b},Uz=function(a,b){const c=_.ln(a),d=_.an([{drm:a}]);
|
|
3
|
+
d.drm=a;a=new _.Is({Cb:b,onError:()=>{},lf:()=>{},kf:()=>{},onEvent:()=>{},getConfiguration:()=>d,bd:()=>null});a.f=c;return a},Xz=function(a,b,c){return _.w(function*(){const d=Vz;if(a){var e=a.offlineId;if(0!==e.length){var f=yield d.get(e);if(f)Wz.debug(Kz,e);else{var g=Uz(a,c);try{yield Rz(g,b);yield _.Tq(g);yield _.Wq(g);const h=g.getDrmInfo(),k=b.map(l=>({contentType:_.Tm(l.video.mimeType,l.video.codecs),robustness:h.videoRobustness}));f={sessionIds:Tz(g),keySystem:h.keySystem,licenseServerUri:h.licenseServerUri,
|
|
4
4
|
serverCertificate:h.serverCertificate,audioCapabilities:[],videoCapabilities:k,drmConfig:a};yield d.store(e,f)}catch(h){throw Wz.error(`Error while persisting DRM session ${e}`),new _.I(1,6,6200,null,h);}finally{yield g.destroy()}}}}else Wz.debug(Lz)})},Qz=1,Oz=2,Yz=class{constructor(){this.g=new _.T(Nz)}store(a,b){return _.w(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){const b=this;return _.w(function*(){const c=window.localStorage.getItem(encodeURIComponent(a));if(c)try{{const e=JSON.parse(atob(c)),f=JSON.parse(e.sessionIds),g=e.audioCapabilities||[],
|
|
6
|
-
h=e.videoCapabilities||[],k=e.serverCertificate||[],l=e.drmConfig||{};var d={sessionIds:f,keySystem:e.keySystem,licenseServerUri:decodeURIComponent(e.licenseServerUri||""),serverCertificate:k?new Uint8Array(k):null,audioCapabilities:g,videoCapabilities:h,drmConfig:l}}return d}catch(e){b.g.warn(`Error while loading offline items for ${a} from storage: `,e)}return null})}delete(a){return _.w(function*(){window.localStorage.removeItem(encodeURIComponent(a))})}clear(){return _.w(function*(){window.localStorage.clear()})}getName(){return Nz}};_.x("clpp.persistent.useStorage",function(a){{var b=["store","get","delete","clear","getName"];const c=[];_.z(a)||(_.
|
|
7
|
-
_.x("clpp.persistent.fetchLicense",function(a,b,...c){return _.w(function*(){var d=Vz,e=(l,m)=>new _.I(1,6,6200,l,m);const f=_.
|
|
8
|
-
const l=yield k.start(f.url,{configurationId:"",networkingEngine:d,onContentSteeringInfoFound:()=>null,filterAllPeriods:()=>{},filterNewPeriod:()=>{},onEvent:()=>{},onError:()=>{}});if(!l.periods.length)throw e(null,new _.I(_.D,4,4014));const m=_.
|
|
9
|
-
_.x("clpp.persistent.removeLicense",function(a){return _.w(function*(){var b=Vz;if(_.
|
|
10
|
-
new _.I(1,6,6201,null,e);}finally{b=[],c&&b.push(c.destroy()),d&&b.push(d.destroy()),yield Promise.all(b)}}else Wz.warn("Invalid offlineId")})});_.x("clpp.persistent.getSessionStorage",function(){return Vz});var Vz=new Yz,Wz=new _.T(Mz);_.x("clpp.persistent.PersistentLicenseComponent",class extends _.Ev{constructor(){super();this.g=new _.T(Mz)}id(){return _.Ue}f(a,b){const c=this;return _.w(function*(){const d=a.getConfiguration().drm;if(d){c.g.debug(`Persisting DRM session ID: ${d.offlineId}`);var e=a.getNetworkEngine();try{yield Xz(d,b,e),a.trigger(new _.H(_.
|
|
6
|
+
h=e.videoCapabilities||[],k=e.serverCertificate||[],l=e.drmConfig||{};var d={sessionIds:f,keySystem:e.keySystem,licenseServerUri:decodeURIComponent(e.licenseServerUri||""),serverCertificate:k?new Uint8Array(k):null,audioCapabilities:g,videoCapabilities:h,drmConfig:l}}return d}catch(e){b.g.warn(`Error while loading offline items for ${a} from storage: `,e)}return null})}delete(a){return _.w(function*(){window.localStorage.removeItem(encodeURIComponent(a))})}clear(){return _.w(function*(){window.localStorage.clear()})}getName(){return Nz}};_.x("clpp.persistent.useStorage",function(a){{var b=["store","get","delete","clear","getName"];const c=[];_.z(a)||(_.ih(a.store)||c.push("store"),_.ih(a.get)||c.push("get"),_.ih(a.delete)||c.push("delete"),_.ih(a.clear)||c.push("clear"),_.ih(a.getName)||c.push("getName"),b=c)}if(0<b.length)throw Wz.warn("Invalid session storage implementation"),new _.I(1,6,6202,{missingMethods:b});Vz=a});
|
|
7
|
+
_.x("clpp.persistent.fetchLicense",function(a,b,...c){return _.w(function*(){var d=Vz,e=(l,m)=>new _.I(1,6,6200,l,m);const f=_.en(a).shift();if(!f)throw e("No source specified.");if(!b)throw e(Lz);var g=b.offlineId;if(typeof g!==_.Uf||!g.length)throw e("Missing offline id.");if(yield d.get(g))Wz.debug(Kz,g);else{var h=_.Zm();d=new _.Dn;g=[];for(var k of c){const l=new k;_.Jh(l.id())||(l.install(),_.Nh(l),g.push(l))}k=null;try{k=yield _.It(f.url,d,h.manifest.attemptParameters,f.type||null);k.configure(h.manifest);
|
|
8
|
+
const l=yield k.start(f.url,{configurationId:"",networkingEngine:d,onContentSteeringInfoFound:()=>null,filterAllPeriods:()=>{},filterNewPeriod:()=>{},onEvent:()=>{},onError:()=>{}});if(!l.periods.length)throw e(null,new _.I(_.D,4,4014));const m=_.xt(l.periods);yield Xz(b,m,d)}catch(l){if(l instanceof _.I&&6200===l.code)throw l;throw e(null,l);}finally{for(;g.length;)e=g.shift(),e.uninstall(),_.Ih.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 _.w(function*(){var b=Vz;if(_.kh(a)&&0!==a.length){var c=null,d=null;try{const e=yield b.get(a);e?(e.drmConfig.delayLicenseRequestUntilPlayed=!0,d=new _.Dn,c=Uz(e.drmConfig,d),yield Pz(c,e.keySystem,e.licenseServerUri,e.serverCertificate,e.audioCapabilities,e.videoCapabilities),yield _.Tq(c),yield Promise.all(e.sessionIds.map(f=>_.w(function*(){yield Sz(c,f);Wz.debug("successfully removed session with id",f)}))),yield b.delete(a)):Wz.debug("No persistent DRM session found")}catch(e){throw Wz.error("Failed to remove session"),
|
|
10
|
+
new _.I(1,6,6201,null,e);}finally{b=[],c&&b.push(c.destroy()),d&&b.push(d.destroy()),yield Promise.all(b)}}else Wz.warn("Invalid offlineId")})});_.x("clpp.persistent.getSessionStorage",function(){return Vz});var Vz=new Yz,Wz=new _.T(Mz);_.x("clpp.persistent.PersistentLicenseComponent",class extends _.Ev{constructor(){super();this.g=new _.T(Mz)}id(){return _.Ue}f(a,b){const c=this;return _.w(function*(){const d=a.getConfiguration().drm;if(d){c.g.debug(`Persisting DRM session ID: ${d.offlineId}`);var e=a.getNetworkEngine();try{yield Xz(d,b,e),a.trigger(new _.H(_.Qd,{offlineId:d.offlineId}))}catch(f){a.onError(f)}}else c.g.debug("No DRM configuration found for loaded source.")})}a(a){const b=this;return _.w(function*(){b.g.debug(`Getting EME session IDs for ${a}`);
|
|
11
11
|
const c=Vz;try{const d=yield c.get(a);if(d)return d.sessionIds||[];b.g.debug(`No offline session found for ${a}`);return[]}catch(d){return b.g.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 Hz=function(a,b){return 0<=b&&b<a.a.length},Iz=function(a){a.trigger(new _.H(_.kf))},Jz=class extends _.
|
|
2
|
-
this.a.length&&Hz(this,a)?this.a[a]:null}
|
|
3
|
-
yield c.m.open(d.configuration),c.trigger(new _.H(_.jf,{item:d})))}})}append(a){this.a.push(a);Iz(this)}
|
|
4
|
-
Jz.prototype.insert=Jz.prototype.
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Hz=function(a,b){return 0<=b&&b<a.a.length},Iz=function(a){a.trigger(new _.H(_.kf))},Jz=class extends _.Tt{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.m=a;this.l=b;this.f=0;this.a=[];this.h=!1;this.j=this.Ea.bind(this)}getPosition(){return this.f}Hd(){return this.a}Mb(){return 0<this.a.length&&Hz(this,this.f)?this.a[this.f]:null}yg(){const a=this.f+1;return 0<
|
|
2
|
+
this.a.length&&Hz(this,a)?this.a[a]:null}cf(){return this.h}start(){this.h||(this.h=!0,this.m.on(_.Xd,this.j),this.ed(this.f,!0))}stop(){this.h=!1;this.m.off(_.Xd,this.j)}Ea(){this.next()}next(){const a=this;return _.w(function*(){yield a.ed(Math.min(a.a.length-1,a.f+1))})}Wd(){const a=this;return _.w(function*(){yield a.ed(Math.max(0,a.f-1))})}ed(a,b){b=void 0===b?!1:b;const c=this;return _.w(function*(){if(0<c.a.length&&Hz(c,a)&&(b||c.f!==a)){c.f=a;var d=c.Mb();d&&!1===d.skippable||!d||(yield c.l(d),
|
|
3
|
+
yield c.m.open(d.configuration),c.trigger(new _.H(_.jf,{item:d})))}})}append(a){this.a.push(a);Iz(this)}Cg(a,b){if(0<=b&&b<=this.a.length){const c=this.Mb();this.a.splice(b,0,a);c&&(this.f=this.a.indexOf(c));Iz(this)}}remove(a){if(0<this.a.length&&Hz(this,a)){if(this.f===a)throw Error("Can't remove the current item");this.a.splice(a,1);Iz(this)}}clear(){this.stop();this.f=0;this.a=[];this.h=!1;Iz(this)}};_.x("clpp.Playlist",Jz);Jz.prototype.clear=Jz.prototype.clear;Jz.prototype.remove=Jz.prototype.remove;
|
|
4
|
+
Jz.prototype.insert=Jz.prototype.Cg;Jz.prototype.append=Jz.prototype.append;Jz.prototype.goTo=Jz.prototype.ed;Jz.prototype.previous=Jz.prototype.Wd;Jz.prototype.next=Jz.prototype.next;Jz.prototype.onEnded=Jz.prototype.Ea;Jz.prototype.stop=Jz.prototype.stop;Jz.prototype.start=Jz.prototype.start;Jz.prototype.isStarted=Jz.prototype.cf;Jz.prototype.getUpcoming=Jz.prototype.yg;Jz.prototype.getCurrent=Jz.prototype.Mb;Jz.prototype.getQueue=Jz.prototype.Hd;Jz.prototype.getPosition=Jz.prototype.getPosition;
|
|
5
5
|
Jz.prototype.off=Jz.prototype.off;Jz.prototype.one=Jz.prototype.one;Jz.prototype.on=Jz.prototype.on;};f.call(g, window);
|
package/cl.simid.js
CHANGED
|
@@ -4,11 +4,11 @@ c)})},zz=function(a,b){_.w(function*(){a.h=b.sessionId;yz(a,b);try{{var c=a.f;co
|
|
|
4
4
|
value:void 0}))},vz=function(a,b){a.h?(b.type!==rz&&a.g.info(`Posting message [${b.messageId}] '${b.type}':`,b.args),a.a.contentWindow&&a.a.contentWindow.postMessage(JSON.stringify(b),"*")):a.g.warn(`WARNING: no session available to send message '${b.type}'`)},Az=function(a,b,c){return new ResizeObserver(()=>{if(a.a.h){var d=a.a,e={videoDimensions:{x:0,y:0,height:b.clientHeight,width:b.clientWidth},creativeDimensions:{x:0,y:0,height:b.clientHeight,width:b.clientWidth},fullscreen:c.isFullscreen()};
|
|
5
5
|
e=tz(d,"SIMID:Player:resize",e);vz(d,e)}})},Bz=function(a,b){a.g.info("SIMID Session created");a.a=b},Cz=function(a){a.g.info("Stopping creative");a.m.getSurface().getMedia().style.transition=".5s";setTimeout(()=>{a.m.getSurface().getMedia().style.transition=""},500);a.m.getSurface().getMedia().style.left="";a.m.getSurface().getMedia().style.top="";a.m.getSurface().getMedia().style.width="";a.m.getSurface().getMedia().style.height="";a.a.a.style.left="";a.a.a.style.top="";a.a.a.style.width="";a.a.a.style.height=
|
|
6
6
|
"";a.h=!1;a.m.trigger(new _.H(_.Mf))},Dz=function(a,b){var c=a.getContainer();a=c.clientWidth;c=c.clientHeight;return{top:`${b.y/c*100}%`,left:`${b.x/a*100}%`,width:`${b.width/a*100}%`,height:`${b.height/c*100}%`}},Ez=class{constructor(a,b){this.f=a;this.w=b;this.h="";this.l=0;this.j=new Map;this.a=document.createElement("iframe");this.a.style.opacity="0";(a=this.w.style)&&a.className?this.a.classList.add(a.className):(this.a.style.border=_.He,this.a.style.backgroundColor="transparent",this.a.style.transition=
|
|
7
|
-
"opacity .5s",this.a.style.transitionDelay=".5s",this.a.style.pointerEvents=_.He,this.a.style.overflow=_.
|
|
7
|
+
"opacity .5s",this.a.style.transitionDelay=".5s",this.a.style.pointerEvents=_.He,this.a.style.overflow=_.de);this.a.classList.add(_.bd);this.o=c=>{if(c.source===this.a.contentWindow&&(c=(c=c.data)?typeof c===_.Uf?JSON.parse(c):c:null))if(c.type)switch(this.g.info(`Received message [${c.messageId}] '${c.type}':`,c.args),c.type){case "createSession":zz(this,c);break;case "resolve":c=c.args;var d=this.j.get(c.messageId);d&&d.resolve(c);break;case "reject":c=c.args;(d=this.j.get(c.messageId))&&d.reject(c);
|
|
8
8
|
break;case "SIMID:Creative:requestResize":d=this.f;var e=c.args;d.g.info("Creative requested resize",e);if(d.m&&d.m.getSurface()&&d.m.getSurface().getMedia()&&e.mediaDimensions){d.h?d.m.getSurface().getMedia().style.transition="":(d.m.getSurface().getMedia().style.transition="left .5s, top .5s,width .5s, height .5s",d.h=!0);const f=Dz(d,e.mediaDimensions);d.m.getSurface().getMedia().style.left=f.left;d.m.getSurface().getMedia().style.top=f.top;d.m.getSurface().getMedia().style.width=f.width;d.m.getSurface().getMedia().style.height=
|
|
9
9
|
f.height}e.creativeDimensions&&(e=Dz(d,e.creativeDimensions),d.a.a.style.left=e.left,d.a.a.style.top=e.top,d.a.a.style.width=e.width,d.a.a.style.height=e.height);yz(this,c)}else this.g.warn("WARNING: received message without 'type' property")};this.g=new _.T("clpp.simid.SimidPlayer");Bz(this.f,this)}load(a){window.addEventListener(_.Ae,this.o);this.h="";this.l=0;const b=this.f.url();this.g.info(`Loading "${b}" as src of iFrame`);this.a.src=b;this.g.info("Attaching iFrame");a.appendChild(this.a)}unload(){Cz(this.f);
|
|
10
10
|
this.h=this.a.src="";this.l=0;this.a.style.opacity="0";window.removeEventListener(_.Ae,this.o);this.a.parentElement&&this.a.parentElement.removeChild(this.a)}},uz=class{constructor(a,b,c,d,e){e=void 0===e?-1:e;this.f=a;this.l=b;this.j=c;this.h=d;this.a=null;this.f.set(d.messageId,this);0<=e&&(this.a=setTimeout(()=>{this.resolve()},e))}resolve(a){null!==this.a&&(clearTimeout(this.a),this.a=null);this.f.delete(this.h.messageId);this.l(a)}reject(a){null!==this.a&&(clearTimeout(this.a),this.a=null);this.f.delete(this.h.messageId);
|
|
11
11
|
this.j(a)}};var Gz=class extends _.Uv{constructor(){super();this.g=new _.T("clpp.simid.Plugin");this.h=this.a=this.m=null;this.l=[];this.j=null;this.w=this.A.bind(this);this.f=null;this.o=!1}id(){return"simid"}onPlayerCreated(a){this.g.info("New player created");this.a&&(this.a.unload(),this.a=null);this.m=a;this.h&&this.h.release();this.h=new Fz(a)}onContentWillLoad(a){var b=a.getConfiguration();if(b.simid&&b.simid.creatives&&0!==b.simid.creatives.length){this.l=b.simid.creatives;this.g.info(`Setting up SIMID plugin for ${this.l.length} creatives`);
|
|
12
12
|
var c=this.m.getSurface();c?(this.g.info("Creating new session"),this.a=new Ez(this.h,b.simid),b=c.getContainer(),this.j=Az(this,b,c),this.j.observe(b),a.on(_.gg,this.w)):this.g.warn(qz)}}A(){var a=this.m.getPosition();a:if(this.f&&a<this.f.startTime+this.f.duration)var b=this.f;else{for(b=0;b<this.l.length;b++){var c=this.l[b];const d=c.startTime+c.duration;if(a>=c.startTime-(c.preload||5)&&a<d){b=c;break a}}b=null}b?b===this.f?(b=b.startTime,this.a&&(c=a>=b,!this.o&&c&&(xz(this.a),this.o=!0,this.g.info(sz)),
|
|
13
13
|
c&&(c=this.a,vz(c,tz(c,rz,{currentTime:a-b}))))):((a=this.m.getSurface())||this.g.warn(qz),a=a.getContainer(),this.f=b,this.o=!1,this.g.info("Loading session"),this.h.f=b,this.a.load(a)):this.f&&(this.a.unload(),this.f=null,this.o=!1)}onPlayerWillRelease(a){super.onPlayerWillRelease(a);this.m.getSurface()&&(this.j&&(this.j.disconnect(),this.j=null),a.off(_.gg,this.w),this.f&&(this.a.unload(),this.f=this.h.f=null))}},Fz=class{constructor(a){this.m=a;this.a=null;this.g=new _.T("clpp.simid.Loader");
|
|
14
|
-
this.h=!1;this.f=null}release(){this.g.info("Releasing loader")}getContainer(){const a=this.getSurface().getContainer();if(!a)throw this.g.error("No player container found. Can not create SIMID init data"),new _.I(1,10,10100,"No player container found");return a}getSurface(){const a=this.m.getSurface();if(!a)throw this.g.error("No player surface found. Can not create SIMID init data"),new _.I(1,10,10100,"No surface");return a}
|
|
14
|
+
this.h=!1;this.f=null}release(){this.g.info("Releasing loader")}getContainer(){const a=this.getSurface().getContainer();if(!a)throw this.g.error("No player container found. Can not create SIMID init data"),new _.I(1,10,10100,"No player container found");return a}getSurface(){const a=this.m.getSurface();if(!a)throw this.g.error("No player surface found. Can not create SIMID init data"),new _.I(1,10,10100,"No surface");return a}wg(){return this.a}url(){return this.f?this.f.url:""}};_.Pn(new class{create(){return new Gz}});};f.call(g, window);
|
package/cl.smooth.js
CHANGED
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";import './cl.mse.js';let g={};const _ = clpp._;var f=function(window){'use strict';var wQ="Full MP4 box must have flags defined",xQ="clpp.smooth.SmoothMP4Processor",yQ="codecPrivateData",zQ=function(a,b){const c=Math.floor(b/Math.pow(2,32));b-=c*Math.pow(2,32);_.M(a,c);_.M(a,b)},AQ=function(a,b){try{a.f.setUint8(a.a,b),a.a+=1}catch(c){_.
|
|
2
|
-
b,a.h),a.a+=2}catch(c){_.
|
|
3
|
-
f++)}for(;e<a.a.length;)c.push(a.a[e++]);if(c.length)for(e=c[c.length-1].position+1;f<b.length;)g=b[f++],g=new _.rI(e++,g.startTime,g.endTime,g.Da,g.na,g.ja,g.
|
|
4
|
-
null,h.cd,h.
|
|
5
|
-
`${a}/Manifest`},JQ=function(a,b,c,d){c=b.
|
|
6
|
-
LQ=function(a,b,c){const d=c.
|
|
1
|
+
import {clpp} from "./cl.core.js";import './cl.mse.js';let g={};const _ = clpp._;var f=function(window){'use strict';var wQ="Full MP4 box must have flags defined",xQ="clpp.smooth.SmoothMP4Processor",yQ="codecPrivateData",zQ=function(a,b){const c=Math.floor(b/Math.pow(2,32));b-=c*Math.pow(2,32);_.M(a,c);_.M(a,b)},AQ=function(a,b){try{a.f.setUint8(a.a,b),a.a+=1}catch(c){_.Qo()}},BQ=function(a,b){AQ(a,b>>16&255);AQ(a,b>>8&255);AQ(a,b&255)},CQ=function(a,b){try{a.f.setUint16(a.a,b,a.h),a.a+=2}catch(c){_.Qo()}},DQ=function(a,b){try{a.f.setInt32(a.a,b,a.h),a.a+=4}catch(c){_.Qo()}},EQ=function(a,b){try{a.f.setInt16(a.a,
|
|
2
|
+
b,a.h),a.a+=2}catch(c){_.Qo()}},FQ=function(a,b){let c=[];const d=[];for(var e=0,f=0;e<a.a.length&&f<b.length;){var g=a.a[e];const h=b[f];g.startTime<h.startTime?(c.push(g),e++):(g.startTime>h.startTime?0===e?d.push(h):a.g.info("Refusing to rewrite original references on update!"):(.1<Math.abs(g.endTime-h.endTime)?c.push(new _.rI(g.position,h.startTime,h.endTime,h.Da,h.na,h.ja,h.Ja,h.keyInfo,h.Xc,h.timescale,h.horizontalTiles,h.verticalTiles,h.durationPerTile,null,null,h.cd,h.Ga)):c.push(g),e++),
|
|
3
|
+
f++)}for(;e<a.a.length;)c.push(a.a[e++]);if(c.length)for(e=c[c.length-1].position+1;f<b.length;)g=b[f++],g=new _.rI(e++,g.startTime,g.endTime,g.Da,g.na,g.ja,g.Ja,g.keyInfo,g.Xc,g.timescale,g.horizontalTiles,g.verticalTiles,g.durationPerTile,null,null,g.cd,g.Ga),c.push(g);else c=b;b=c;if(d.length&&c.length){b=[];f=c[0].position;e=d.length;for(const h of d)b.push(new _.rI(f-e--,h.startTime,h.endTime,h.Da,h.na,h.ja,h.Ja,h.keyInfo,h.Xc,h.timescale,h.horizontalTiles,h.verticalTiles,h.durationPerTile,null,
|
|
4
|
+
null,h.cd,h.Ga));for(const h of c)b.push(h)}a.a=b},GQ=function(a,b){for(let c=0;c<a.a.length;++c)if(a.a[c].endTime>b)return a.a.splice(0,c);b=a.a;a.a=[];return b},HQ=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},IQ=function(a){const b=a.split("/");return b[b.length-1].toLowerCase().match("manifest(\\(.+\\))?")?a:
|
|
5
|
+
`${a}/Manifest`},JQ=function(a,b,c,d){c=b.qg[c];b=b.oj;a=a.replace("Manifest","");b=b.replace("{bitrate}",String(d.bitrate)).replace("{Bitrate}",String(d.bitrate)).replace("{start time}",String(c.t)).replace("{start_time}",String(c.t));return _.qB([a],[b])[0]},KQ=function(a,b){if(a.type!==b.type)return!1;let c=[];a.type===_.t?c=["maxWidth","maxHeight","bitrate",yQ,"fourCC"]:a.type===_.q&&(c=["bitrate",yQ,"channels","bitsPerSample","samplingRate","fourCC"]);return _.mh(a,b,c,["id","segmentIndex"])},
|
|
6
|
+
LQ=function(a,b,c){const d=c.me.split("00000001");a={id:1,type:c.type,duration:a/b,timescale:b,kb:null,rc:null,width:NaN,height:NaN,lc:null,Xd:NaN,sampleSize:NaN,channelCount:NaN};switch(c.type){case _.t:a.kb=[_.bm(d[1])];a.rc=[_.bm(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.q:a.lc=_.bm(c.me),a.sampleSize=c.Ch||16,a.Xd=c.Xd,a.channelCount=c.gg}return a},MQ=function(a,b){return a.filter(c=>c.type===b)},NQ=function(a,b){a=a.exec(b);return null==a||""===a[0]?null:(Number(a[4])||0)/1E3+
|
|
7
7
|
(Number(a[3])||0)+60*(Number(a[2])||0)+3600*(Number(a[1])||0)},UQ=function(a,b,c){var d=null;if(OQ.test(a)){{a=OQ.exec(a);d=Number(a[1]);const e=Number(a[2]);let f=Number(a[3]),g=Number(a[4]);g+=(Number(a[5])||0)/c.f;f+=g/c.frameRate;d=f+60*e+3600*d}}else PQ.test(a)?d=NQ(PQ,a):QQ.test(a)?d=NQ(QQ,a):RQ.test(a)?(a=RQ.exec(a),d=Number(a[1])/c.frameRate):SQ.test(a)?(a=SQ.exec(a),d=Number(a[1])/c.a):TQ.test(a)&&(d=NQ(TQ,a));c=d;d=c+b;b=Math.floor(d/3600);c=Math.floor((d-3600*b)/60);a=Math.floor(d-3600*
|
|
8
|
-
b-60*c);d-=a;10>b&&(b="0"+b);10>c&&(c="0"+c);10>a&&(a="0"+a);0===d?d="000":d=Math.round(1E3*d);return b+":"+c+":"+a+"."+d},VQ=function(a){let b=0;for(let c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.
|
|
9
|
-
a=(new WQ("schi")).append([a]);b=(new WQ(_.Nf)).append([new $Q(b),new aR(_.
|
|
10
|
-
m.entries=[a]);k=new nR;break;case _.q:k=new oR(a.lc),c?(a=bR(a,"mp4a",b),a.append([k]),m.entries=[a]):(a=(new pR(a.channelCount,a.sampleSize,a.
|
|
11
|
-
b.initData,8)]),c||b||_.B(xQ,"Could not get PSSH init data!"));b=new DR([e,d]);return _.G(b.write())},OR=function(a,b){let c,d,e,f,g,h;(new _.
|
|
12
|
-
k.flags&8&&(m.j=_.N(k.reader));0<l-k.reader.getPosition()&&k.flags&16&&(m.o=_.N(k.reader));0<l-k.reader.getPosition()&&k.flags&32&&(m.l=_.N(k.reader));d=m}}).fa("trun",k=>{{var l=k.reader.
|
|
13
|
-
k.flags&512&&m.sampleSize.push(_.N(k.reader)),k.flags&1024&&m.A.push(_.N(k.reader)),k.flags&2048&&(0===k.version?m.h.push(_.N(k.reader)):m.h.push(_.
|
|
14
|
-
8),
|
|
15
|
-
new ArrayBuffer(0);var g=OR(b,d);if(null===g)return a.request.contentType===_.K?a.data:g;d=g.get(_.ve);if(a.request.contentType===_.K){e=d.f.buffer;if(c){e=_.
|
|
16
|
-
for(let u=0,v=f.length;u<v;u++){h=f[u];a=c;b=d;g=["begin",_.
|
|
17
|
-
n=g.get("sdtp");c=g.get("senc");k.f=1;k.flags&=16777214;k.flags|=131072;b.append([k,m,f]);n&&b.append([n]);if(e){g=0;k=[];if(c.flags&2)for(k=[],m=0;m<c.h;m++)k.push(10+6*c.f[m].
|
|
18
|
-
audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,periodId:null}},VR=function(a){return{initData:_.dB(_
|
|
19
|
-
c.backoffFactor=a.f.attemptParameters.backoffFactor;c.fuzzFactor=a.f.attemptParameters.fuzzFactor;c.type=1;c=yield a.D.networkingEngine.fetch(c).V;a.o=c.uri;return c})},fS=function(a,b){const c=_.O;let d=null;try{const
|
|
20
|
-
m=+d.getAttribute("DVRWindowLength")||Infinity,n=c.a(d,"Protection")[0];if(!1===/^[2].[0-2]$/.test(""+e+"."+f))throw a.g.error("Smooth Streaming version must be 2.0, 2.1 or 2.2"),new _.I(_.D,4,4036,a.o);k?($R(a,aS),a.B=typeof a.f.liveRefreshPeriod===_.r?1E3*a.f.liveRefreshPeriod:Math.min(1E3*a.I,1E4),h=Infinity):$R(a,bS);a.a={startTime:0,delay:0,duration:h/g,
|
|
21
|
-
VR(ic),[ic]));
|
|
22
|
-
[],
|
|
23
|
-
!
|
|
24
|
-
{id:A.U++,type:F,index:
|
|
25
|
-
v.o);0===ye&&isNaN(Oa)&&(
|
|
26
|
-
timescale:
|
|
27
|
-
configurationId:void 0,startTime:0,endTime:
|
|
28
|
-
void 0;a.C=new _.uI(
|
|
29
|
-
b){const c=b===bS;a.j&&a.j.presentationTimeline&&_.hC(a.j.presentationTimeline,c);c&&null!=a.l&&(window.clearTimeout(a.l),a.l=null,a.B=null);a.P=b},cS=function(a,b){for(let e=0;e<a.A.streams.length;e++){const f=b.streams[e];for(const g of a.A.streams[e].tracks){var c=f.tracks.find(h=>h.type===g.type&&h.bitrate===g.bitrate);if(c){KQ(g,c)||a.g.warn("The current stream is updated with a stream that seems to have different base properties!");var d=hS(a,a.A.timescale,f,c);c=g.segmentIndex;FQ(c,d);(d=a.a.
|
|
30
|
-
GQ(c,(c.a.length?c.a[c.a.length-1].endTime:0)-d).forEach(h=>{h.Da().forEach(k=>{a.H.delete(k)})})}else a.g.warn(`Cannot find satisfying update for ${g.type} `+`track with bitrate ${g.bitrate}. Skipping update.`)}}},hS=function(a,b,c,d){let e=0;const f=[],g=c.timescale||b;c.
|
|
31
|
-
_.q)b=f[f.length-1],a.J=Math.min(a.J,e),0===a.a.Qd?a.a.Qd=b.endTime:a.a.Qd=Math.min(a.a.Qd,b.endTime);return f},dS=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=hS(a,c,k,h);const C=new _.vI(l);var m=null;k.type!==_.K&&(m=iS(a,b,c,k,h));h.segmentIndex=C;l=_.pI++;var n=Promise.resolve.bind(Promise),p=C.f.bind(C),u=C.get.bind(C),v=C.h.bind(C),y=C.getDuration.bind(C),A=jS[k.type];var E="";switch(k.type){case _.t:E=h.
|
|
32
|
-
E="avc1."+(F&&F[0]?E.substr(E.indexOf(F[0])+10,6):"42c00c");a.g.debug("VIDEO CODECS: ",E);break;case _.q:E=h.
|
|
33
|
-
width:h.maxWidth||void 0,height:h.maxHeight||void 0,kind:F,encrypted:a.K(),keyId:null,language:k.language,originalLanguage:k.kd,label:k.name,type:k.type,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:h.
|
|
34
|
-
allowedByKeySystem:!0}:null},iS=function(a,b,c,d,e){b=LQ(b,d.timescale||c,e);c={isLive:a.F.bind(a),
|
|
8
|
+
b-60*c);d-=a;10>b&&(b="0"+b);10>c&&(c="0"+c);10>a&&(a="0"+a);0===d?d="000":d=Math.round(1E3*d);return b+":"+c+":"+a+"."+d},VQ=function(a){let b=0;for(let c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.kp(b)},bR=function(a,b,c){a:{var d=[_.xd,_.vd];for(e of d)if((d=c.ue(e))&&d.keyId){var e=d.keyId;break a}_.B(xQ,"Could not get default Key ID for DRM init data!");e=null}c=new WQ("xxxx");a.type===_.t?c=new XQ(a.width,a.height):c=new YQ(a.channelCount,a.sampleSize,a.Xd);a=new ZQ;a.f=1;a.h=8;a.l=e||"00000000000000000000000000000000";
|
|
9
|
+
a=(new WQ("schi")).append([a]);b=(new WQ(_.Nf)).append([new $Q(b),new aR(_.Xc,65536),a]);c.append([b]);return c},ER=function(a,b){var c=b.ve(),d=new cR(a.timescale,a.duration,a.id),e=(new dR).append([new eR(a.id)]),f=new fR(a.id,a.duration,a.timescale,a.width,a.height),g=new gR(a.timescale,a.duration);const h=new hR(a.type);var k=null,l=new iR;l.entries=[new jR];var m=new kR;switch(a.type){case _.t:k=new lR(a.kb,a.rc);c?(a=bR(a,"avc1",b),a.append([k]),m.entries=[a]):(a=(new mR(a.width,a.height)).append([k]),
|
|
10
|
+
m.entries=[a]);k=new nR;break;case _.q:k=new oR(a.lc),c?(a=bR(a,"mp4a",b),a.append([k]),m.entries=[a]):(a=(new pR(a.channelCount,a.sampleSize,a.Xd)).append([k]),m.entries=[a]),k=new qR}m=(new rR).append([m,new sR,new tR,new uR,new vR]);l=(new wR).append([l]);l=(new xR).append([k,l,m]);g=(new yR).append([g,h,l]);f=(new zR).append([f,g]);d=(new AR).append([d,f,e]);e=new BR("dash",0,["iso6","mp41","avc1"]);c&&(c=b.ue(_.vd),b=b.ue(_.xd),c&&d.append([new CR("pssh",c.initData,8)]),b&&d.append([new CR("pssh",
|
|
11
|
+
b.initData,8)]),c||b||_.B(xQ,"Could not get PSSH init data!"));b=new DR([e,d]);return _.G(b.write())},OR=function(a,b){let c,d,e,f,g,h;(new _.ip).N("moof",_.bp).fa("mfhd",k=>{{const l=new FR;l.f=_.N(k.reader);c=l}}).N("traf",_.bp).fa("tfhd",k=>{{const l=k.reader.Sa();if(null===k.flags)throw new _.I(_.D,3,3019,wQ);const m=new GR(k.version||0,k.flags||0);m.f=_.N(k.reader);0<l-k.reader.getPosition()&&k.flags&1&&(m.h=_.Xo(k.reader));0<l-k.reader.getPosition()&&k.flags&2&&(m.A=_.N(k.reader));0<l-k.reader.getPosition()&&
|
|
12
|
+
k.flags&8&&(m.j=_.N(k.reader));0<l-k.reader.getPosition()&&k.flags&16&&(m.o=_.N(k.reader));0<l-k.reader.getPosition()&&k.flags&32&&(m.l=_.N(k.reader));d=m}}).fa("trun",k=>{{var l=k.reader.Sa();if(null===k.flags)throw new _.I(_.D,3,3019,wQ);const m=new HR(k.version||0,k.flags||0);m.f=_.N(k.reader);0<l-k.reader.getPosition()&&k.flags&1&&(m.j=_.Wo(k.reader));0<l-k.reader.getPosition()&&k.flags&4&&(m.l=_.N(k.reader));if(0<l-k.reader.getPosition())for(l=0;l<m.f;l++)k.flags&256&&m.o.push(_.N(k.reader)),
|
|
13
|
+
k.flags&512&&m.sampleSize.push(_.N(k.reader)),k.flags&1024&&m.A.push(_.N(k.reader)),k.flags&2048&&(0===k.version?m.h.push(_.N(k.reader)):m.h.push(_.Wo(k.reader)));e=m}}).fa("sdtp",k=>{{const l=_.Zo(k.reader,k.reader.Sa());f=new IR("sdtp",k.version||0,k.flags||0,l,0)}}).N("uuid",k=>{var l=_.Zo(k.reader,16);if(_.dm(l,JR)){l=_.N(k.reader);k.version=l>>>24;k.flags=l&16777215;l=new KR(k.version,k.flags);l.h=_.N(k.reader);k.flags&1&&(l.j=_.Uo(k.reader));for(let m=0;m<l.h;m++){const n={Bg:_.Zo(k.reader,
|
|
14
|
+
8),ud:0,Ff:[]};if(k.flags&2){n.ud=_.Vo(k.reader);for(let p=0;p<n.ud;p++){const u={cg:0,dg:0};u.cg=_.Vo(k.reader);u.dg=_.N(k.reader);n.Ff.push(u)}}l.f.push(n)}g=l}}).N(_.ve,k=>{{const l=new LR;0<k.reader.Sa()?l.f=_.Zo(k.reader,k.reader.Sa()):(_.B(xQ,"mdat box is empty!"),l.f=new Uint8Array(0));h=l}}).parse(a,!1);if(!h)return null;a=(new MR).append([d,e]);f&&a.append([f]);b.ve()&&g&&a.append([g]);b=(new NR).append([c,a]);return new DR([b,h])},TR=function(a,b,c,d){var e=d.ve(),f=parseInt(c*b,10);b=a.data||
|
|
15
|
+
new ArrayBuffer(0);var g=OR(b,d);if(null===g)return a.request.contentType===_.K?a.data:g;d=g.get(_.ve);if(a.request.contentType===_.K){e=d.f.buffer;if(c){e=_.qi(e);if((e=(new DOMParser).parseFromString(e,_.ag))&&"tt"===e.documentElement.tagName.toLowerCase())var h=e.documentElement;if(h&&(d=new PR(h.getAttribute("ttp:frameRate"),h.getAttribute("ttp:subFrameRate"),h.getAttribute("ttp:frameRateMultiplier"),h.getAttribute("ttp:tickRate")),h=h.getElementsByTagName("body")[0])){f=h.getElementsByTagName("p");
|
|
16
|
+
for(let u=0,v=f.length;u<v;u++){h=f[u];a=c;b=d;g=["begin",_.Wd];for(let y=0,A=g.length;y<A;y++){b:{var k=h;var l=g[y],m=new RegExp("\\w+:"+l),n=0;if(k.hasAttribute(l)){k=k.getAttribute(l);break b}l=k.attributes;const E=l.length;for(;n<E;n++){var p=l[n].name;if(p=p.match(m)){k=k.getAttribute(p[0]);break b}}k=null}h.setAttribute(g[y],UQ(k||"",a,b))}}}e=(new XMLSerializer).serializeToString(e);c=_.ri(e).buffer}else c=e;return c}h=new NR;a=g.get("mfhd");b=new MR;k=g.get("tfhd");m=new QR(1,f);f=g.get("trun");
|
|
17
|
+
n=g.get("sdtp");c=g.get("senc");k.f=1;k.flags&=16777214;k.flags|=131072;b.append([k,m,f]);n&&b.append([n]);if(e){g=0;k=[];if(c.flags&2)for(k=[],m=0;m<c.h;m++)k.push(10+6*c.f[m].ud);else g=8;b.append([c,new RR,new SR(g,k,c.h)])}h.append([a,b]);f.flags|=1;f.j=h.a()+8;d=new DR([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},UR=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,
|
|
18
|
+
audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,periodId:null}},VR=function(a){return{initData:_.dB(_.$p(a)),initDataType:_.Xc,keyId:a,periodId:null}},WR=function(a,b,c){a=_.hq(a);c&&a.version!==c&&(a=_.fB(a,c));return{initData:_.dB(a),initDataType:_.Xc,keyId:b,periodId:null}},YR=function(a,b){return _.w(function*(){var c=_.vk(b);c.timeout=a.f.attemptParameters.timeout;c.maxAttempts=Math.max(a.f.attemptParameters.maxAttempts,b.length);c.baseDelay=a.f.attemptParameters.baseDelay;
|
|
19
|
+
c.backoffFactor=a.f.attemptParameters.backoffFactor;c.fuzzFactor=a.f.attemptParameters.fuzzFactor;c.type=1;c=yield a.D.networkingEngine.fetch(c).V;a.o=c.uri;return c})},fS=function(a,b){const c=_.O;let d=null;try{const jb=_.qi(b);d=c.j(jb,_.sb)}catch(jb){}if(!d)throw a.g.error("Unable to parse manifest"),new _.I(_.D,4,4033,a.o);const e=+ZR(a,d,"MajorVersion"),f=+ZR(a,d,"MinorVersion"),g=+d.getAttribute("TimeScale")||1E7;let h=+ZR(a,d,"Duration");const k="TRUE"===d.getAttribute("IsLive"),l=+d.getAttribute("LookAheadCount"),
|
|
20
|
+
m=+d.getAttribute("DVRWindowLength")||Infinity,n=c.a(d,"Protection")[0];if(!1===/^[2].[0-2]$/.test(""+e+"."+f))throw a.g.error("Smooth Streaming version must be 2.0, 2.1 or 2.2"),new _.I(_.D,4,4036,a.o);k?($R(a,aS),a.B=typeof a.f.liveRefreshPeriod===_.r?1E3*a.f.liveRefreshPeriod:Math.min(1E3*a.I,1E4),h=Infinity):$R(a,bS);a.a={startTime:0,delay:0,duration:h/g,We:m/g,Qd:0};if(n){{var p=a.f.playreadyVersion;const jb=_.O,xa=[],xb=jb.a(n,"ProtectionHeader")[0],wc=_.am(jb.f(xb)||""),ic=_.hq(wc).a;xa.push(UR(_.xd,
|
|
21
|
+
VR(ic),[ic]));xa.push(UR(_.vd,WR(wc,ic,p),[ic]));var u=xa}a.w=u}{const jb=[],xa=_.O.a(d,"StreamIndex");if(!xa.length)throw a.g.error("No streams found!"),new _.I(_.D,4,4034,a.o);for(let xb=0;xb<xa.length;xb++){{var v=a,y=xa[xb];const wc=ZR(v,y,"Type"),ic=+y.getAttribute("Chunks"),Lh=y.getAttribute("Subtype")||"",we=y.getAttribute("Language")||_.lg,xe=_.Gn(we),Mh=y.getAttribute("Name")||"",of=+y.getAttribute(_.Ra),qg=+y.getAttribute(_.Qa),Cs=ZR(v,y,"Url"),Em=+y.getAttribute("TimeScale")||null;{const dd=
|
|
22
|
+
[],rj=_.O.a(y,_.lb);for(let ye=0;ye<rj.length;ye++){{let ed,Oa,Od;var A=v,E=rj[ye],F=wc;const sj=+E.getAttribute("Index"),rg=+ZR(A,E,"Bitrate");let xc=NaN,sg=NaN,Fm=NaN,Ds=NaN,QF=NaN,RF=NaN,SF=NaN;const TF=E.getAttribute("FourCC")||"";switch(F){case _.t:xc=+ZR(A,E,_.Qa);sg=+ZR(A,E,_.Ra);break;case _.q:Ds=+E.getAttribute("Channels")||2,Fm=+ZR(A,E,"SamplingRate"),RF=+ZR(A,E,"AudioTag"),QF=+ZR(A,E,"BitsPerSample"),SF=+ZR(A,E,"PacketSize")}let Es=String(E.getAttribute("CodecPrivateData"));if(F===_.q&&
|
|
23
|
+
!Es){{var C=Ds;const UF={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},Gm=UF[Fm];if("AACH"===TF){Oa=new Uint8Array(4);const VF=UF[2*Fm];Oa[0]=40|Gm>>1;Oa[1]=Gm<<7|C<<3|VF>>1;Oa[2]=VF<<7|8;Oa[3]=0;ed=new Uint16Array(2);ed[0]=(Oa[0]<<8)+Oa[1];ed[1]=(Oa[2]<<8)+Oa[3];Od=ed[0].toString(16)+ed[1].toString(16)}else Oa=new Uint8Array(2),Oa[0]=16|Gm>>1,Oa[1]=Gm<<7|C<<3,ed=new Uint16Array(1),ed[0]=(Oa[0]<<8)+Oa[1],Od=ed[0].toString(16);Es=Od.toUpperCase()}}var ja=
|
|
24
|
+
{id:A.U++,type:F,index:sj,bitrate:rg,me:Es,maxHeight:xc,maxWidth:sg,Xd:Fm,gg:Ds,uj:RF,Ch:QF,Hj:SF,Uh:TF,segmentIndex:null}}dd.push(ja)}var Ca=dd}{const dd=[],rj=_.O.a(y,"c");for(let ye=0;ye<rj.length;ye++){const ed=rj[ye];let Oa=parseInt(ed.getAttribute("t"),10),Od=parseInt(ed.getAttribute("d"),10),sj=parseInt(ed.getAttribute("r"),10),rg=0;if(isNaN(Oa)&&isNaN(Od))throw v.g.error("Either one or both FragmentDuration and FragmentTime field MUST be present in StreamFragmentElement"),new _.I(_.D,4,4037,
|
|
25
|
+
v.o);0===ye&&isNaN(Oa)&&(rg=Oa=0);if(0<ye){const xc=dd[dd.length-1];rg=xc.n+1;xc.d||(xc.d=Oa-xc.t);Oa||(Oa=xc.t+xc.d);Od||(Od=Oa-xc.t)}dd.push({n:rg,d:Od,t:Oa});if(sj){sj--;for(let xc=0;xc<sj;xc++){const sg=dd[dd.length-1];rg=sg.n+1;Oa=sg.t+sg.d;Od=sg.d;dd.push({n:rg,d:Od,t:Oa})}}}v.F()||dd.length===ic||v.g.warn("Number of fragments ("+ic+") differs from number of chunks ("+dd.length+").");var Xa=dd}var Ib={type:wc,yj:ic,bj:Lh,language:xe,kd:we,name:Mh,maxWidth:of,maxHeight:qg,oj:Cs,tracks:Ca,qg:Xa,
|
|
26
|
+
timescale:Em}}jb.push(Ib)}var ub=jb}const fc={Gj:e,Hg:f,timescale:g,duration:h,isLive:k,Fj:l,We:m,af:!1,streams:ub};if(a.j&&a.A)return cS(a,fc),Promise.resolve();a.H.clear();{const jb=fc.timescale,xa=fc.duration,xb=MQ(fc.streams,_.q),wc=MQ(fc.streams,_.t),ic=MQ(fc.streams,_.K),Lh=[];let we=dS(a,xa,jb,xb),xe=dS(a,xa,jb,wc);const Mh=dS(a,xa,jb,ic);we.length||(we=[null]);xe.length||(xe=[null]);for(let of=0;of<xe.length;of++)for(let qg=0;qg<we.length;qg++)Lh.push(eS(a,xe[of],we[qg]));var gc={id:"ID",
|
|
27
|
+
configurationId:void 0,startTime:0,endTime:xa,variants:Lh,textStreams:Mh,thumbStreams:[]}}{var Jb=fc.streams;let jb=a.a.startTime,xa=a.a.delay;const xb=a.J;let wc=Math.min(a.a.duration||Infinity,xb);const ic=a.F(),Lh=a.a.We,we=a.a.Qd,xe=a.I,Mh=isFinite(a.G)?a.G:0;if(ic)wc=Infinity,jb=Date.now()/1E3-we,a.a.startTime=jb,xa=3*xe;else{const qg=isFinite(xb)?xb:a.a.duration;for(const Cs of Jb)for(const Em of Cs.tracks)Em.segmentIndex.offset(-Mh),_.VB(Em.segmentIndex,qg)}const of=a.f.timeline||{};of.type=
|
|
28
|
+
void 0;a.C=new _.uI(of,jb,xa,!ic,!0);a.C.f=wc;_.mC(a.C,xe);a.C.A=Lh;ic||a.C.offset(-Mh)}a.D.filterAllPeriods([gc]);a.j={presentationTimeline:a.C,periods:[gc],minBufferTime:0,cues:[]};Promise.resolve();a.L||(a.D.networkingEngine.vd(a.M),a.L=!0);a.A=fc;return Promise.resolve()},gS=function(a,b){null!=a.B&&null!=b&&(a.l=window.setTimeout(a.dc.bind(a),b))},ZR=function(a,b,c){if(b=b.getAttribute(c))return b;a.g.error("required attribute not provided: "+c);throw new _.I(_.D,4,4038,a.o,c);},$R=function(a,
|
|
29
|
+
b){const c=b===bS;a.j&&a.j.presentationTimeline&&_.hC(a.j.presentationTimeline,c);c&&null!=a.l&&(window.clearTimeout(a.l),a.l=null,a.B=null);a.P=b},cS=function(a,b){for(let e=0;e<a.A.streams.length;e++){const f=b.streams[e];for(const g of a.A.streams[e].tracks){var c=f.tracks.find(h=>h.type===g.type&&h.bitrate===g.bitrate);if(c){KQ(g,c)||a.g.warn("The current stream is updated with a stream that seems to have different base properties!");var d=hS(a,a.A.timescale,f,c);c=g.segmentIndex;FQ(c,d);(d=a.a.We)&&
|
|
30
|
+
GQ(c,(c.a.length?c.a[c.a.length-1].endTime:0)-d).forEach(h=>{h.Da().forEach(k=>{a.H.delete(k)})})}else a.g.warn(`Cannot find satisfying update for ${g.type} `+`track with bitrate ${g.bitrate}. Skipping update.`)}}},hS=function(a,b,c,d){let e=0;const f=[],g=c.timescale||b;c.qg.forEach((h,k)=>{const l=h.d/g;0===k?(h=h.t/g,a.G=Math.min(a.G,h)):h=f[k-1].endTime;const m=h+l,n=JQ(a.o,c,k,d);a.I=Math.max(a.I,l);f.push(new _.rI(k,h,m,()=>[n],0,null,0,null,!0,g));a.H.set(n,h);e+=l});if(c.type===_.t||c.type===
|
|
31
|
+
_.q)b=f[f.length-1],a.J=Math.min(a.J,e),0===a.a.Qd?a.a.Qd=b.endTime:a.a.Qd=Math.min(a.a.Qd,b.endTime);return f},dS=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=hS(a,c,k,h);const C=new _.vI(l);var m=null;k.type!==_.K&&(m=iS(a,b,c,k,h));h.segmentIndex=C;l=_.pI++;var n=Promise.resolve.bind(Promise),p=C.f.bind(C),u=C.get.bind(C),v=C.h.bind(C),y=C.getDuration.bind(C),A=jS[k.type];var E="";switch(k.type){case _.t:E=h.me;var F=/00000001[0-9]7/.exec(E);
|
|
32
|
+
E="avc1."+(F&&F[0]?E.substr(E.indexOf(F[0])+10,6):"42c00c");a.g.debug("VIDEO CODECS: ",E);break;case _.q:E=h.me,F=2,"AACH"===h.Uh?F=5:E&&(F=(parseInt(E.substr(0,2),16)&248)>>3),E="mp4a.40."+F,a.g.debug("AUDIO CODECS: ",E)}F=k.type===_.K?kS[k.bj]:void 0;h={id:l,originalId:null,Kj:null,createSegmentIndex:n,findSegmentPosition:p,getSegmentReference:u,adjustSegmentDurations:v,getDuration:y,segmentIndex:C,segmentLookupStrategy:_.LA,initSegmentReference:m,mimeType:A,codecs:E,frameRate:void 0,bandwidth:h.bitrate,
|
|
33
|
+
width:h.maxWidth||void 0,height:h.maxHeight||void 0,kind:F,encrypted:a.K(),keyId:null,language:k.language,originalLanguage:k.kd,label:k.name,type:k.type,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:h.gg||null,spatialAudio:!1,closedCaptions:null}}return h});e=e.concat(g)}return e},eS=function(a,b,c){const d=(c?c.bandwidth:0)+(b?b.bandwidth:0),e=c?c.language:_.lg;return c||b?{id:a.h++,language:e,primary:!1,audio:c,video:b,bandwidth:d,drmInfos:a.w,allowedByApplication:!0,
|
|
34
|
+
allowedByKeySystem:!0}:null},iS=function(a,b,c,d,e){b=LQ(b,d.timescale||c,e);c={isLive:a.F.bind(a),ve:a.K.bind(a),bi:()=>1,ue:a.R.bind(a)};d=new Uint8Array(0);try{d=ER(b,c)}catch(g){throw a.g.error("Failed to generate initialization segment."),new _.I(_.D,3,4035,g);}const f="data:text/plain;base64,"+_.$l(d);return new _.qI(()=>[f],0,null,null,!0)},WQ=class{constructor(a){this.type=a;this.size=this.start=0;this.parent=null;this.w=!1;this.entries=[];this.children=[]}append(a=[]){for(let b=0;b<a.length;b++)this.children.push(a[b]),
|
|
35
35
|
a[b].parent=this;return this}get(a){if(this.type===a)return this;for(let b=0;b<this.children.length;b++){if(this.children[b].type===a)return this.children[b];{const c=this.children[b].get(a);if(c)return c}}return null}a(){const a=Math.pow(2,32)-1;let b;b=4+this.type.length;"uuid"===this.type&&(b+=16);if(0<this.children.length)for(let c=0;c<this.children.length;c++)b+=this.children[c].a();this.size>a&&(b+=8);return b}write(a){var b=Math.pow(2,32)-1;this.start=a.getPosition();this.size=this.a();this.size>
|
|
36
|
-
b?_.M(a,1):_.M(a,this.size);_.
|
|
37
|
-
super.a()-this.offset}write(a){super.write(a);_.
|
|
38
|
-
_.
|
|
36
|
+
b?_.M(a,1):_.M(a,this.size);_.Ro(a,HQ(this.type));this.size>b&&zQ(a,this.size);"uuid"===this.type&&_.Ro(a,null);if(0<this.children.length&&!this.w)for(b=0;b<this.children.length;b++)this.children[b].write(a),this.children[b].a(),a.getPosition()}},lS=class extends WQ{constructor(a,b,c){super(a);this.version=b;this.flags=c}a(){return 4+super.a()}write(a){super.write(a);AQ(a,this.version);BQ(a,this.flags)}},CR=class extends WQ{constructor(a,b,c){super(a);this.f=b;this.offset=c}a(){return this.f.byteLength+
|
|
37
|
+
super.a()-this.offset}write(a){super.write(a);_.Ro(a,this.f,this.offset);a.getPosition()}},IR=class extends lS{constructor(a,b,c,d,e){super(a,b,c);this.f=d;this.offset=e}a(){return this.f.byteLength+super.a()-this.offset}write(a){super.write(a);_.Ro(a,this.f,this.offset);a.getPosition()}},BR=class extends WQ{constructor(a,b,c){super("ftyp");this.h=a;this.Hg=b;this.f=c}a(){let a=this.h.length;a=a+4+this.f.join("").length;return a+super.a()}write(a){super.write(a);_.Ro(a,HQ(this.h));_.M(a,this.Hg);
|
|
38
|
+
_.Ro(a,HQ(this.f.join("")));a.getPosition()}},AR=class extends WQ{constructor(){super(_.Ee)}},zR=class extends WQ{constructor(){super(_.ig)}},cR=class extends lS{constructor(a,b,c){super("mvhd",1,0);this.timescale=a;this.duration=b;this.volume=256;this.h=c+1;this.f=[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0]}a(){let a=0;a=1===this.version?a+28:a+16;a=a+44+this.f.length;return a+=super.a()}write(a){super.write(a);1===this.version?(zQ(a,0),zQ(a,0),_.M(a,this.timescale),
|
|
39
39
|
zQ(a,this.duration*this.timescale)):(_.M(a,0),_.M(a,0),_.M(a,this.timescale),_.M(a,this.duration*this.timescale));_.M(a,65536);CQ(a,this.volume);CQ(a,0);_.M(a,0);_.M(a,0);for(let b=0;b<this.f.length;b++)AQ(a,this.f[b]);_.M(a,0);_.M(a,0);_.M(a,0);_.M(a,0);_.M(a,0);_.M(a,0);_.M(a,this.h);a.getPosition()}},dR=class extends WQ{constructor(){super("mvex")}},eR=class extends lS{constructor(a){super("trex",0,0);this.f=a}a(){return 20+super.a()}write(a){super.write(a);_.M(a,this.f);_.M(a,1);_.M(a,0);_.M(a,
|
|
40
40
|
0);_.M(a,0);a.getPosition()}},fR=class extends lS{constructor(a,b,c,d,e){super("tkhd",1,7);this.h=a;this.duration=b;this.timescale=c;this.width=d;this.height=e;this.volume=1;this.f=[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0]}a(){let a=0;a=1===this.version?a+32:a+20;a=a+24+this.f.length;return a+super.a()}write(a){super.write(a);1===this.version?(zQ(a,0),zQ(a,0),_.M(a,this.h),_.M(a,0),zQ(a,this.duration*this.timescale)):(_.M(a,0),_.M(a,0),_.M(a,this.h),_.M(a,0),_.M(a,
|
|
41
41
|
this.duration*this.timescale));_.M(a,0);_.M(a,0);CQ(a,0);CQ(a,0);CQ(a,this.volume);CQ(a,0);for(let b=0;b<this.f.length;b++)AQ(a,this.f[b]);CQ(a,this.width);CQ(a,0);CQ(a,this.height);CQ(a,0);a.getPosition()}},gR=class extends lS{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?(zQ(a,0),zQ(a,0),_.M(a,this.timescale),zQ(a,this.duration*this.timescale)):(_.M(a,
|
|
42
|
-
0),_.M(a,0),_.M(a,this.timescale),_.M(a,this.duration*this.timescale));CQ(a,this.language);CQ(a,0);a.getPosition()}},hR=class extends lS{constructor(a){super("hdlr",0,0);this.f=a}a(){return 33+super.a()}write(a){super.write(a);_.M(a,0);this.f===_.t?_.
|
|
43
|
-
this.f.byteLength+super.a()}write(a){super.write(a);CQ(a,0);_.
|
|
42
|
+
0),_.M(a,0),_.M(a,this.timescale),_.M(a,this.duration*this.timescale));CQ(a,this.language);CQ(a,0);a.getPosition()}},hR=class extends lS{constructor(a){super("hdlr",0,0);this.f=a}a(){return 33+super.a()}write(a){super.write(a);_.M(a,0);this.f===_.t?_.Ro(a,HQ("vide")):_.Ro(a,HQ("soun"));_.M(a,0);_.M(a,0);_.M(a,0);this.f===_.t?_.Ro(a,HQ("VideoHandler\x00")):_.Ro(a,HQ("SoundHandler\x00"));a.getPosition()}},nR=class extends lS{constructor(){super("vmhd",0,1);this.f=new Uint8Array([0,0,0,0,0,0])}a(){return 2+
|
|
43
|
+
this.f.byteLength+super.a()}write(a){super.write(a);CQ(a,0);_.Ro(a,this.f);a.getPosition()}},mS=class extends WQ{constructor(a){super(a);this.w=!0}a(){return 8+super.a()}write(a){super.write(a);_.M(a,0);CQ(a,0);CQ(a,1)}},nS=class extends mS{constructor(a){super(a);this.height=this.width=0;this.depth=24}a(){return 70+super.a()}write(a){super.write(a);CQ(a,0);CQ(a,0);_.M(a,0);_.M(a,0);_.M(a,0);CQ(a,this.width);CQ(a,this.height);_.M(a,4718592);_.M(a,4718592);_.M(a,0);CQ(a,1);AQ(a,10);_.Ro(a,HQ("AVC Coding",
|
|
44
44
|
31));CQ(a,this.depth);EQ(a,-1)}},oS=class extends mS{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);CQ(a,this.channelCount);CQ(a,this.sampleSize);EQ(a,0);CQ(a,0);CQ(a,this.sampleRate);CQ(a,0)}},mR=class extends nS{constructor(a,b){super("avc1");this.width=a;this.height=b}write(a){super.write(a);for(let b=0;b<this.children.length;b++)this.children[b].write(a);a.getPosition()}},XQ=class extends mR{constructor(a,
|
|
45
45
|
b){super(a,b);this.type="encv"}},pR=class extends oS{constructor(a,b,c){super("mp4a",a,b,c)}write(a){super.write(a);for(let b=0;b<this.children.length;b++)this.children[b].write(a);a.getPosition()}},YQ=class extends pR{constructor(a,b,c){super(a,b,c);this.type="enca"}},lR=class extends WQ{constructor(a,b){super("avcC");this.kb=a;this.rc=b;this.version=1;this.f=this.kb[0][1];this.h=this.kb[0][2];this.level=this.kb[0][3]}a(){let a=7;for(var b=0;b<this.kb.length;b++)a+=2,a+=this.kb[b].byteLength;for(b=
|
|
46
|
-
0;b<this.kb.length;b++)a+=2,a+=this.rc[b].byteLength;return a+super.a()}write(a){super.write(a);AQ(a,this.version);AQ(a,this.f);AQ(a,this.h);AQ(a,this.level);AQ(a,255);AQ(a,224|this.kb.length);for(var b=0;b<this.kb.length;b++)CQ(a,this.kb[b].length),_.
|
|
47
|
-
AQ(a,3);AQ(a,23+this.lc.byteLength);CQ(a,1);AQ(a,0);AQ(a,4);AQ(a,15+this.lc.byteLength);AQ(a,64);AQ(a,21);BQ(a,0);_.M(a,0);_.M(a,0);AQ(a,5);AQ(a,this.lc.byteLength);_.
|
|
46
|
+
0;b<this.kb.length;b++)a+=2,a+=this.rc[b].byteLength;return a+super.a()}write(a){super.write(a);AQ(a,this.version);AQ(a,this.f);AQ(a,this.h);AQ(a,this.level);AQ(a,255);AQ(a,224|this.kb.length);for(var b=0;b<this.kb.length;b++)CQ(a,this.kb[b].length),_.Ro(a,this.kb[b]);AQ(a,this.rc.length);for(b=0;b<this.rc.length;b++)CQ(a,this.rc[b].length),_.Ro(a,this.rc[b]);a.getPosition()}},oR=class extends lS{constructor(a){super("esds",0,0);this.lc=a}a(){return 22+(this.lc.byteLength+3)+super.a()}write(a){super.write(a);
|
|
47
|
+
AQ(a,3);AQ(a,23+this.lc.byteLength);CQ(a,1);AQ(a,0);AQ(a,4);AQ(a,15+this.lc.byteLength);AQ(a,64);AQ(a,21);BQ(a,0);_.M(a,0);_.M(a,0);AQ(a,5);AQ(a,this.lc.byteLength);_.Ro(a,this.lc);_.Ro(a,new Uint8Array([6,1,2]));a.getPosition()}},jR=class extends lS{constructor(a=""){super("url ",0,1);this.location=a}a(){return this.location.length+super.a()}write(a){super.write(a);0<this.location.length&&_.Ro(a,HQ(this.location));a.getPosition()}},iR=class extends lS{constructor(){super("dref",0,0)}a(){let a=4;
|
|
48
48
|
for(let b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+super.a()}write(a){super.write(a);_.M(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},rR=class extends WQ{constructor(){super(_.Tf)}},kR=class extends lS{constructor(){super(_.Vf,0,0)}a(){let a=4;for(let b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+super.a()}write(a){super.write(a);_.M(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);
|
|
49
49
|
a.getPosition()}},sR=class extends lS{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()}},tR=class extends lS{constructor(){super("stsc",0,0)}a(){let a=4;for(let b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+super.a()}write(a){super.write(a);_.M(a,this.entries.length);for(let b=0;b<
|
|
50
50
|
this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},vR=class extends lS{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()}},uR=class extends lS{constructor(){super("stsz",0,0)}a(){return 8+super.a()}write(a){super.write(a);_.M(a,0);_.M(a,0);a.getPosition()}},qR=class extends lS{constructor(){super("smhd",
|
|
51
51
|
0,0)}a(){return 4+super.a()}write(a){super.write(a);EQ(a,0);CQ(a,0);a.getPosition()}},wR=class extends WQ{constructor(){super("dinf")}},xR=class extends WQ{constructor(){super(_.De)}},yR=class extends WQ{constructor(){super(_.ze)}},QR=class extends lS{constructor(a,b){super("tfdt",a,0);this.baseMediaDecodeTime=b}a(){let a=0;a=1===this.version?a+8:a+4;return a+super.a()}write(a){super.write(a);1===this.version?zQ(a,this.baseMediaDecodeTime):_.M(a,this.baseMediaDecodeTime);a.getPosition()}},FR=class extends lS{constructor(){super("mfhd",
|
|
52
52
|
0,0);this.f=0}a(){return 4+super.a()}write(a){super.write(a);_.M(a,this.f);a.getPosition()}},HR=class extends lS{constructor(a,b){super("trun",a,b);this.l=this.j=this.f=0;this.o=[];this.sampleSize=[];this.A=[];this.h=[]}a(){let a=4;this.flags&1&&(a+=4);this.flags&4&&(a+=4);for(let b=0;b<this.f;b++)this.flags&256&&(a+=4),this.flags&512&&(a+=4),this.flags&1024&&(a+=4),this.flags&2048&&(a+=4);return a+super.a()}write(a){super.write(a);_.M(a,this.f);this.flags&1&&(a.getPosition(),DQ(a,this.j));this.flags&
|
|
53
53
|
4&&_.M(a,this.l);for(let b=0;b<this.f;b++)this.flags&256&&_.M(a,this.o[b]),this.flags&512&&_.M(a,this.sampleSize[b]),this.flags&1024&&_.M(a,this.A[b]),this.flags&2048&&(0===this.version?_.M(a,this.h[b]):DQ(a,this.h[b]));a.getPosition()}},GR=class extends lS{constructor(a,b){super("tfhd",a,b);this.f=255;this.l=this.o=this.j=this.A=this.h=0}a(){let a=4;this.flags&1&&(a+=8);this.flags&2&&(a+=4);this.flags&8&&(a+=4);this.flags&16&&(a+=4);this.flags&32&&(a+=4);return a+super.a()}write(a){super.write(a);
|
|
54
|
-
_.M(a,this.f);this.flags&1&&zQ(a,this.h);this.flags&2&&_.M(a,this.A);this.flags&8&&_.M(a,this.j);this.flags&16&&_.M(a,this.o);this.flags&32&&_.M(a,this.l);a.getPosition()}},MR=class extends WQ{constructor(){super("traf")}},NR=class extends WQ{constructor(){super("moof")}},LR=class extends WQ{constructor(){super(_.ve);this.f=new Uint8Array(0)}a(){return this.f.byteLength+super.a()}write(a){super.write(a);0<this.f.byteLength&&_.
|
|
55
|
-
1;this.h=8;this.l="";this.j=[]}a(){let a;a=20;1===this.f&&0===this.h&&(a=a+1+this.j.length);return a+super.a()}write(a){super.write(a);AQ(a,0);0===this.version?AQ(a,0):AQ(a,0);AQ(a,this.f);AQ(a,this.h);_.
|
|
56
|
-
_.
|
|
54
|
+
_.M(a,this.f);this.flags&1&&zQ(a,this.h);this.flags&2&&_.M(a,this.A);this.flags&8&&_.M(a,this.j);this.flags&16&&_.M(a,this.o);this.flags&32&&_.M(a,this.l);a.getPosition()}},MR=class extends WQ{constructor(){super("traf")}},NR=class extends WQ{constructor(){super("moof")}},LR=class extends WQ{constructor(){super(_.ve);this.f=new Uint8Array(0)}a(){return this.f.byteLength+super.a()}write(a){super.write(a);0<this.f.byteLength&&_.Ro(a,this.f)}},ZQ=class extends lS{constructor(){super("tenc",0,0);this.f=
|
|
55
|
+
1;this.h=8;this.l="";this.j=[]}a(){let a;a=20;1===this.f&&0===this.h&&(a=a+1+this.j.length);return a+super.a()}write(a){super.write(a);AQ(a,0);0===this.version?AQ(a,0):AQ(a,0);AQ(a,this.f);AQ(a,this.h);_.Ro(a,_.bm(this.l));if(1===this.f&&0===this.h){AQ(a,0);for(let b=0;b<this.j.length;b++)AQ(a,this.j[b])}a.getPosition()}},aR=class extends lS{constructor(a,b){super("schm",0,0);this.f=a;this.h=b;this.fc=""}a(){let a=8;this.flags&1&&(a+=HQ(this.fc).byteLength);return a+super.a()}write(a){super.write(a);
|
|
56
|
+
_.Ro(a,HQ(this.f));_.M(a,this.h);this.flags&1&&_.Ro(a,HQ(this.fc));a.getPosition()}},$Q=class extends WQ{constructor(a){super("frma");this.f=a}a(){return HQ(this.f).byteLength+super.a()}write(a){super.write(a);_.Ro(a,HQ(this.f));a.getPosition()}},RR=class extends lS{constructor(){super("saio",0,0);this.offset=[0]}a(){let a=0;this.flags&1&&(a+=8);a+=4;for(let b=0;1>b;b++)a=0===this.version?a+4:a+8;return a+super.a()}write(a){super.write(a);this.flags&1&&(_.M(a,0),_.M(a,0));_.M(a,1);for(let b=0;1>b;b++)0===
|
|
57
57
|
this.version?_.M(a,this.offset[b]):zQ(a,this.offset[b]);a.getPosition()}},SR=class extends lS{constructor(a,b,c){super("saiz",0,0);this.f=a;this.j=b;this.h=c}a(){let a=0;this.flags&1&&(a+=8);a+=5;0===this.f&&(a+=this.j.length);return a+super.a()}write(a){super.write(a);this.flags&1&&(_.M(a,0),_.M(a,0));AQ(a,this.f);_.M(a,this.h);if(0===this.f)for(let b=0;b<this.h;b++)AQ(a,this.j[b]);a.getPosition()}},KR=class extends lS{constructor(a,b){super("senc",a,b);this.h=0;this.j=8;this.f=[]}a(){let a=4;this.flags&
|
|
58
|
-
1&&(a+=1);for(let b=0;b<this.h;b++)if(a+=this.f[b].
|
|
58
|
+
1&&(a+=1);for(let b=0;b<this.h;b++)if(a+=this.f[b].Bg.byteLength,this.flags&2){a+=2;for(let c=0;c<this.f[b].ud;c++)a+=2,a+=4}return a+super.a()}write(a){super.write(a);_.M(a,this.h);this.flags&1&&AQ(a,this.j);for(let b=0;b<this.h;b++)if(_.Ro(a,this.f[b].Bg),this.flags&2){CQ(a,this.f[b].ud);for(let c=0;c<this.f[b].ud;c++)CQ(a,this.f[b].Ff[c].cg),_.M(a,this.f[b].Ff[c].dg)}a.getPosition()}};var PR=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))}},OQ=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,PQ=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,QQ=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,RQ=/^(\d*\.?\d*)f$/,SQ=/^(\d*\.?\d*)t$/,TQ=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/;var DR=class{constructor(a){this.a=a;this.f=VQ(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=VQ(this);for(let a=0;a<this.a.length;a++)this.a[a].write(this.f);return this.f.buffer}};var JR=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);var pS=class{constructor(){this.A=this.j=this.f=this.D=null;this.h=1;this.U=0;this.o="";this.C=this.a=null;this.g=new _.T("clpp.smooth.SmoothParser");this.L=!1;this.l=this.B=null;this.P=bS;this.I=0;this.G=this.J=Infinity;this.w=[];this.M=this.S.bind(this);this.H=new Map}configure(a){this.f=a}start(a,b){this.D=b;a=[...new Set([a,IQ(a)])];return YR(this,a).then(c=>fS(this,c.data).then(()=>{gS(this,this.B);return this.j}))}requestStop(){}stop(){this.D&&this.D.networkingEngine.Ie(this.M);this.B=this.A=
|
|
59
59
|
this.j=this.f=this.D=null;this.l&&(clearTimeout(this.l),this.l=null);this.L=!1;this.J=this.G=Infinity;return Promise.resolve()}update(){if(this.F())return YR(this,[this.o]).then(a=>fS(this,a.data).then(()=>this.j)).catch(a=>{if(this.D)this.D.onError(a)})}setCurrentVariant(){}dc(){this.g.debug(_.BA);this.D&&(this.l=null,this.update().then(()=>{gS(this,this.B)}).catch(a=>{this.D&&(this.D.onError(a),1===a.severity&&gS(this,100))}))}F(){return this.P===aS}K(){return 0<this.w.length}R(a){let b=null;if(this.w.length)for(let c=
|
|
60
|
-
0;c<this.w.length;c++)if(this.w[c].keySystem===a){b=this.w[c].initData[0];break}return b}S(a){if(2!==a.request.type||a.uri.startsWith("data:"))return Promise.resolve(a);const b=a.request.timescale||this.A.timescale,c={isLive:this.F.bind(this),
|
|
61
|
-
`segment reference time ${a.request.startTime}`);f=TR(a,b,g,c)}catch(g){d=!0,e.data=g,3E3===g.code&&(e.code=4039)}if(d||!f)return Promise.reject(e);a.data=f;return Promise.resolve(a)}loadVariant(a){return _.w(function*(){return a})}loadTextStream(a,b){const c=this;return _.w(function*(){let d;const e=c.j.periods.find(f=>f.id===b);e&&(d=e.textStreams.find(f=>f.id===a)||null);if(!d)throw new _.
|
|
62
|
-
"LIVE",kS={
|
|
60
|
+
0;c<this.w.length;c++)if(this.w[c].keySystem===a){b=this.w[c].initData[0];break}return b}S(a){if(2!==a.request.type||a.uri.startsWith("data:"))return Promise.resolve(a);const b=a.request.timescale||this.A.timescale,c={isLive:this.F.bind(this),ve:this.K.bind(this),bi:()=>1,ue:this.R.bind(this)};let d=!1;const e=new _.I(_.D,3,4035,null);let f=null;try{const g=this.H.get(a.request.uris[a.request.uriIndex])||a.request.startTime||0;g!==a.request.startTime&&this.g.debug(`Using base media decode time ${g} instead of `+
|
|
61
|
+
`segment reference time ${a.request.startTime}`);f=TR(a,b,g,c)}catch(g){d=!0,e.data=g,3E3===g.code&&(e.code=4039)}if(d||!f)return Promise.reject(e);a.data=f;return Promise.resolve(a)}loadVariant(a){return _.w(function*(){return a})}loadTextStream(a,b){const c=this;return _.w(function*(){let d;const e=c.j.periods.find(f=>f.id===b);e&&(d=e.textStreams.find(f=>f.id===a)||null);if(!d)throw new _.pl(`Could not load text stream with id: ${a}`);return d})}},jS={video:_.Ag,audio:_.Ic,text:_.Cc},bS=_.Fb,aS=
|
|
62
|
+
"LIVE",kS={qj:_.GA,rj:_.VA};_.x("clpp.smooth.SmoothComponent",class extends _.Ev{install(){_.Kt.ism=pS;_.Jt[_.Dc]=pS}uninstall(){_.QC("ism");_.RC(_.Dc)}id(){return _.Of}});};f.call(g, window);
|
package/cl.thumbnails.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Py="Thumbnail URL is mandatory",Qy="Wrong gridSize format",Ry="clpp.thumbnails",Ty=function(a,b){b.reduce((c,d)=>{let e=d,f=!1;typeof d===_.Ie&&(e=d.step,f=d.preloadWhileBuffering);return c.then(()=>Sy(a,0,e,!!f))},Promise.resolve())},Sy=function(a,b,c,d){if(a.w||b>=a.a.length)return Promise.resolve();const e=b+c;return Uy(a,d).then(()=>a.a[b].load()).then(()=>Sy(a,e,c,d))},Uy=function(a,b){return new Promise(c=>{if(b||2!==a.player.getState())c();else a.player.one(_.
|
|
2
|
-
Vy=function(a){const b=a.a.byteLength;a.f.forEach(c=>{c.offset+c.length<b&&c.ld.resolve()})},Yy=function(a,b){return Wy(a,b).then(c=>new Xy(c,b.time,b.duration))},Wy=function(a,b){return b.load().then(()=>{const c=_.G(a.a,b.offset,b.length);return"data:image/jpeg;base64,"+_.
|
|
3
|
-
az=function(a,b){const c=a.horizontalTiles||b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{Nd:c,
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Py="Thumbnail URL is mandatory",Qy="Wrong gridSize format",Ry="clpp.thumbnails",Ty=function(a,b){b.reduce((c,d)=>{let e=d,f=!1;typeof d===_.Ie&&(e=d.step,f=d.preloadWhileBuffering);return c.then(()=>Sy(a,0,e,!!f))},Promise.resolve())},Sy=function(a,b,c,d){if(a.w||b>=a.a.length)return Promise.resolve();const e=b+c;return Uy(a,d).then(()=>a.a[b].load()).then(()=>Sy(a,e,c,d))},Uy=function(a,b){return new Promise(c=>{if(b||2!==a.player.getState())c();else a.player.one(_.Pc,()=>{c()})})},
|
|
2
|
+
Vy=function(a){const b=a.a.byteLength;a.f.forEach(c=>{c.offset+c.length<b&&c.ld.resolve()})},Yy=function(a,b){return Wy(a,b).then(c=>new Xy(c,b.time,b.duration))},Wy=function(a,b){return b.load().then(()=>{const c=_.G(a.a,b.offset,b.length);return"data:image/jpeg;base64,"+_.Zl(c)})},Zy=function(a){a=a.split(/\.|:/).map(parseFloat);let b=0,c;const d={3:.001,2:1,1:60,0:3600};for(c=a.length-1;0<=c;c--)b+=a[c]*d[c];return b},$y=function(a,b){let c=null;for(const d of a)d.startTime<=b&&(c=d);return c},
|
|
3
|
+
az=function(a,b){const c=a.horizontalTiles||b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{Nd:c,Pf:d,Ag:e,durationPerTile:a.durationPerTile||b.durationPerTile||(a.endTime-a.startTime)/e}},bz=function(a){return a.some(b=>0<b.thumbStreams.length)},jz=function(a){return a?a===cz||a===dz?new ez:a===fz?new gz:a===hz?new iz:null:null},kz=function(a){if(!a)return null;a=new _.gp(a);return a.path.match(/.*\.vtt$/i)?fz:a.path.match(/.*\.bif$/i)?hz:a.path.match(/.*\.(png|jpg|jpeg)$/i)?
|
|
4
4
|
cz:null};var lz=class{constructor(){this.log=new _.T(Ry);this.player=null;this.a=[];this.w=!1}init(a,b){this.player=a;a.one(_.yf,()=>{this.w=!0});a.isLive()||this.l().then(()=>{b&&b.preload&&Ty(this,b.preload)})}};var Xy=class{constructor(a,b,c,d,e,f,g,h,k,l,m,n){d=void 0===d?0:d;e=void 0===e?0:e;f=void 0===f?0:f;g=void 0===g?0:g;h=void 0===h?1:h;k=void 0===k?1:k;l=void 0===l?0:l;m=void 0===m?0:m;n=void 0===n?new Image:n;this.time=b;this.src=a;this.duration=c;this.x=d;this.y=e;this.width=f;this.height=g;this.a=n;this.h=h;this.o=k;this.j=l;this.l=m;this.f=null}raw(){return this.a.cloneNode(!1)}element(a,b){let c=this.width,d=this.height;const e=this.width/this.height;void 0!==a&&void 0===b&&(b=0);null!==a&&
|
|
5
|
-
void 0!==a&&(c=a);null!==b&&void 0!==b&&(d=b);c||(c=Math.ceil(d*e));d||(d=Math.ceil(c/e));a=document.createElement(_.
|
|
6
|
-
c+_.vf;a.style.backgroundPositionY="-"+b*d+_.vf;return a}load(){this.f||(this.f=new Promise((a,b)=>{const c=()=>{this.width||(this.width=(this.a.naturalWidth||this.a.width)/this.h);this.height||(this.height=(this.a.naturalHeight||this.a.height)/this.o);this.x||(this.x=this.width*this.j);this.y||(this.y=this.height*this.l)};if(this.a.src&&this.a.complete)c(),a(this);else{var d=null,e=()=>{c();this.a.removeEventListener(_.qe,e);this.a.removeEventListener(_.
|
|
7
|
-
e);this.a.removeEventListener(_.
|
|
5
|
+
void 0!==a&&(c=a);null!==b&&void 0!==b&&(d=b);c||(c=Math.ceil(d*e));d||(d=Math.ceil(c/e));a=document.createElement(_.Gd);a.style.width=c+_.vf;a.style.height=d+_.vf;a.style.backgroundColor="#000";a.style.backgroundRepeat="no-repeat";a.style.backgroundImage=`url("${this.src}")`;a.style.backgroundSize=`${Math.ceil(c/this.width*(this.a.naturalWidth||this.a.width))}px ${Math.ceil(d/this.height*(this.a.naturalHeight||this.a.height))}px`;b=this.y/this.height;a.style.backgroundPositionX="-"+this.x/this.width*
|
|
6
|
+
c+_.vf;a.style.backgroundPositionY="-"+b*d+_.vf;return a}load(){this.f||(this.f=new Promise((a,b)=>{const c=()=>{this.width||(this.width=(this.a.naturalWidth||this.a.width)/this.h);this.height||(this.height=(this.a.naturalHeight||this.a.height)/this.o);this.x||(this.x=this.width*this.j);this.y||(this.y=this.height*this.l)};if(this.a.src&&this.a.complete)c(),a(this);else{var d=null,e=()=>{c();this.a.removeEventListener(_.qe,e);this.a.removeEventListener(_.Yd,d);a(this)};d=f=>{this.a.removeEventListener(_.qe,
|
|
7
|
+
e);this.a.removeEventListener(_.Yd,d);b(new _.I(1,9,2014,"Failed to load thumbnail.",f))};this.a.addEventListener(_.qe,e);this.a.addEventListener(_.Yd,d);this.a.src=this.src}}));return this.f}};_.x("clpp.thumbnails.Thumbnail",Xy);Xy.prototype.load=Xy.prototype.load;Xy.prototype.element=Xy.prototype.element;Xy.prototype.raw=Xy.prototype.raw;var ez=class extends lz{constructor(){super();this.f=null;this.o=this.h=1;this.j=0}init(a,b){if(!b||!b.url)throw new _.I(1,9,7100,Py);if("GRID"===b.mode&&!b.gridSize)throw new _.I(1,9,7100,"Grid size is mandatory for GRID mode");if(!b.duration)throw new _.I(1,9,7100,"Duration is mandatory");this.f=b;this.j=this.f.duration;if(this.f.gridSize)try{const c=this.f.gridSize.split(/x/).map(d=>parseInt(d,10)).filter(d=>0<d);if(2===c.length)this.h=c[0],this.o=c[1];else throw new _.I(1,9,7100,Qy);}catch(c){throw this.log.error("Error during parsing gridSize",
|
|
8
8
|
c),new _.I(1,9,7100,Qy);}super.init(a,b)}get(a){const b=this;return _.w(function*(){var c=b.player.getDuration();if(0>a||a>c)throw new _.I(1,9,2014,`Position is out of range: ${a}`);c=Math.floor(a/b.f.duration);const d=b.a[c];if(!d)throw new _.I(1,9,2014,"No thumbnail found for position "+a+" at index "+c);yield d.load();return d})}l(){if(0<this.a.length)return Promise.resolve();var a=this.player.getDuration();const b=this.h*this.o;a=Math.ceil(Math.ceil(a/this.j)/b);const c=this.f.templateKey||"$index$";
|
|
9
|
-
for(let d=0;d<a;d++){const e=this.f.url.replace(c,String(d+1)),f=new Image;for(let g=0;g<b;g++)this.a.push(new Xy(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 mz=class{constructor(a,b){this.time=a;this.duration=0;this.offset=b;this.length=0;this.ld=new _.
|
|
9
|
+
for(let d=0;d<a;d++){const e=this.f.url.replace(c,String(d+1)),f=new Image;for(let g=0;g<b;g++)this.a.push(new Xy(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 mz=class{constructor(a,b){this.time=a;this.duration=0;this.offset=b;this.length=0;this.ld=new _.Gl}load(){return this.ld}},iz=class{constructor(){this.g=new _.T(Ry);this.a=new ArrayBuffer(0);this.f=[];this.h=new _.Gl}init(a,b){if(!b||!b.url)throw new _.I(1,9,7100,Py);const c=b.url;b=_.vk(c);b.type=_.uk;a.getNetworkEngine().fetch(b).V.then(d=>{var e=d.data;d=_.G(this.a);e=_.G(e);var f=d.byteLength+e.byteLength,g=new ArrayBuffer(f),h=new DataView(g),k=0;for(let l=0,m=d.byteLength;l<m;l++)h.setUint8(k,
|
|
10
10
|
d[l]),k+=1;for(let l=0,m=e.byteLength;l<m;l++)h.setUint8(k,e[l]),k+=1;this.a=g;this.g.info(`Appended ${e.byteLength} bytes.`+`Total data now ${f} bytes.`);f=this.a;d=_.G(f);h=String.fromCharCode.apply(null,nz);k=Array.prototype.slice.call(d,0,8);d=64;e=0;g=!1;if(h===String.fromCharCode.apply(null,k))for(f=new DataView(f,16,20),f=f.getUint32(0,!0),0===f&&(f=1E3);!g;){e+=1;k=f;h=new DataView(this.a,d);g=h.getUint32(0,!0);k=g*k/1E3;h=h.getUint32(4,!0);h=new mz(k,h);if(k=this.f.length)k=this.f[k-1],k.length=
|
|
11
11
|
h.offset-k.offset,k.duration=h.time-k.time;this.f.push(h);d+=8;(g=4294967295===g)&&this.h.resolve();if(1E5<e)throw Error("There was a problem during reading BIF entries");}else throw Error("The file is not a valid BIF format");Vy(this)}).catch(d=>{this.g.error(`[BIF] Error while loading thumbnails '
|
|
12
|
-
+ 'URL: ${c}`,d);a.onError(new _.I(1,9,2013,"Error while loading and parsing BIF thumbnails.",d))})}get(a){const b=this;return _.w(function*(){if(0>a)throw new _.I(1,9,2014,`Position is out of range: ${a}`);yield b.h;var c=b.f.find(d=>a>=d.time&&a<d.time+d.duration);if(!c)throw new _.I(1,9,2014,`No thumbnail found for position: ${a}`);c=yield Yy(b,c);yield c.load();return c})}},nz=[137,66,73,70,13,10,26,10];var gz=class extends lz{constructor(){super();this.f=null}init(a,b){if(!b||!b.url)throw new _.I(1,9,7100,Py);const c=b.url,d=_.
|
|
12
|
+
+ 'URL: ${c}`,d);a.onError(new _.I(1,9,2013,"Error while loading and parsing BIF thumbnails.",d))})}get(a){const b=this;return _.w(function*(){if(0>a)throw new _.I(1,9,2014,`Position is out of range: ${a}`);yield b.h;var c=b.f.find(d=>a>=d.time&&a<d.time+d.duration);if(!c)throw new _.I(1,9,2014,`No thumbnail found for position: ${a}`);c=yield Yy(b,c);yield c.load();return c})}},nz=[137,66,73,70,13,10,26,10];var gz=class extends lz{constructor(){super();this.f=null}init(a,b){if(!b||!b.url)throw new _.I(1,9,7100,Py);const c=b.url,d=_.vk(c);d.type=_.uk;this.f=a.getNetworkEngine().fetch(d).V.then(e=>{e=e.data;if(!e)throw Error("No data in the response");e=_.ni(e).split(/\n/);for(let m=0;m<e.length;m++){var f=e[m],g=f.split(" --\x3e ");if(2===g.length){f=e[++m];var h=f.indexOf("\x3d");var k=h=0>h?[]:f.substr(h+1).split(/,/).map(parseFloat);h=k[0];const n=k[1],p=k[2];k=k[3];var l=f.indexOf("#");f=0>l?f:f.substr(0,
|
|
13
13
|
l);f.match(/^http|^\/\//)||(f=c.substr(0,c.lastIndexOf("/"))+"/"+f);l=Zy(g[0]);g=Zy(g[1])-l;this.a.push(new Xy(f,l,g,h,n,p,k,0,0))}}}).catch(e=>{this.log.error("[VTT] Error while loading thumbnails "+`URL: ${c}`,e);a.onError(new _.I(1,9,2013,"Error while loading VTT thumbnails.",e))});super.init(a,b)}get(a){const b=this;return _.w(function*(){if(0>a)throw new _.I(1,9,2014,`Position is out of range: ${a}`);yield b.f;const c=b.a.find(d=>a>=d.time&&a<d.time+d.duration);if(!c)throw new _.I(1,9,2014,`No thumbnail found for position: ${a}`);
|
|
14
14
|
yield c.load();return c})}l(){return this.f}};var oz=class extends lz{get(a){const b=this;return _.w(function*(){function c(){return new _.I(1,9,2014,`No thumbnail found for position: ${a}`)}if(0>a)throw b.log.error("Position must be greater than 0 but is "+a),new _.I(1,9,2014,`Position is out of range: ${a}`);var d=b.player.getPeriods();d=$y(d,a);if(!d)throw b.log.error("Could not find period for specified position",a),c();var e=d.thumbStreams.sort(b.f)[0];if(!e)throw b.log.error("Could not find thumb stream for specified position",a),c();d=
|
|
15
|
-
e.findSegmentPosition(a-d.startTime);if(null===d||void 0===d)throw b.log.error("Could not find segment index for specified position",a),c();var f=e.getSegmentReference(d);if(f){const h=az(f,e),k=Math.floor((a-f.startTime)/h.durationPerTile);var g;if(0<b.a.length)f=e.findSegmentPosition(0),null!==f&&(g=b.a[(d-f)*h.
|
|
16
|
-
h.Nd,h.
|
|
17
|
-
0;k<e.
|
|
15
|
+
e.findSegmentPosition(a-d.startTime);if(null===d||void 0===d)throw b.log.error("Could not find segment index for specified position",a),c();var f=e.getSegmentReference(d);if(f){const h=az(f,e),k=Math.floor((a-f.startTime)/h.durationPerTile);var g;if(0<b.a.length)f=e.findSegmentPosition(0),null!==f&&(g=b.a[(d-f)*h.Ag+k]);else if((e=f.Da())&&0<e.length){let l=g=0;f=f.startTime;1<h.Ag&&(g=k%h.Nd,l=Math.floor(k/h.Nd),f+=k*h.durationPerTile);g=new Xy(e[0],f,h.durationPerTile,void 0,void 0,void 0,void 0,
|
|
16
|
+
h.Nd,h.Pf,g,l)}if(g)return yield g.load(),g}b.log.error("segment reference for specified segment index does not exist",d);throw c();})}f(a,b){return void 0!==a.bandwidth&&void 0!==b.bandwidth?a.bandwidth-b.bandwidth:0}l(){if(0<this.a.length)return Promise.resolve();var a=this.player.getPeriods();for(const b of a)if(a=b.thumbStreams.sort(this.f)[0]){let c=a.findSegmentPosition(0),d;for(;null!==c&&!_.z(d=a.getSegmentReference(c++));){const e=az(d,a),f=d.Da()[0],g=new Image;let h=d.startTime;for(let k=
|
|
17
|
+
0;k<e.Pf;++k)for(let l=0;l<e.Nd;++l)this.a.push(new Xy(f,h,e.durationPerTile,void 0,void 0,void 0,void 0,e.Nd,e.Pf,l,k,g)),h+=e.durationPerTile}}return Promise.resolve()}};var pz=class{constructor(){this.g=new _.T(Ry);this.a=this.m=null}onPlayerCreated(a){this.m=a}onPlayerWillDestroy(){this.m=null}onPlayerWillRelease(){this.a=null}onContentWillLoad(a){const b=a.getConfiguration().thumbnails;if(b)if(!1===b.enabled)this.g.info("Thumbnails disabled.");else{var c=b.mode||null;c||(c=kz(b.url||null));(this.a=jz(c))?(this.g.info("Loading thumbs configuration",b),this.m.one(_.se,()=>{this.g.info("Initialize thumbnails provider");try{this.a.init(a,b)}catch(d){this.m.onError(d)}})):
|
|
18
18
|
this.g.warn("Unknown thumbnail mode",c)}else this.a=null}onContentLoaded(a){if(!this.a){var b=a.getConfiguration();b=b&&b.thumbnails;if(!b||void 0===b.enabled||b.enabled){var c=a.getPeriods();if(bz(c)){this.a=new oz;try{this.a.init(a,b)}catch(d){this.m.onError(d)}}}}}get(a){return this.a?this.a.get(a):Promise.reject(new _.I(1,9,2014,"Thumbnail format is not supported"))}id(){return"thumbnails"}};_.x("clpp.thumbnails.ThumbnailsPlugin",pz);pz.prototype.get=pz.prototype.get;pz.Id="thumbnails";
|
|
19
|
-
var cz="SINGLE",dz="GRID",fz="WEBVTT",hz="BIF";_.
|
|
19
|
+
var cz="SINGLE",dz="GRID",fz="WEBVTT",hz="BIF";_.Pn(new class{create(){return new pz}});};f.call(g, window);
|