@castlabs/prestoplay 6.24.0 → 6.25.1
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 +29 -0
- package/cjs/cl.adobe.js +3 -3
- package/cjs/cl.airplay.js +3 -3
- package/cjs/cl.broadpeak.js +7 -7
- package/cjs/cl.cast.js +116 -116
- package/cjs/cl.conviva.js +32 -32
- package/cjs/cl.core.js +596 -597
- package/cjs/cl.crypto.js +9 -9
- package/cjs/cl.dash.js +88 -87
- package/cjs/cl.externs.js +42 -55
- package/cjs/cl.freewheel.js +25 -25
- package/cjs/cl.hls.js +77 -73
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +30 -30
- package/cjs/cl.ima.js +24 -23
- package/cjs/cl.mse.js +346 -341
- package/cjs/cl.muxdata.js +15 -15
- package/cjs/cl.onboard.js +3 -3
- package/cjs/cl.persistent.js +15 -15
- package/cjs/cl.playlist.js +6 -6
- package/cjs/cl.sessions.js +16 -16
- package/cjs/cl.simid.js +15 -15
- package/cjs/cl.smooth.js +72 -72
- package/cjs/cl.thumbnails.js +26 -26
- package/cjs/cl.tizen.js +72 -72
- package/cjs/cl.ttml.js +29 -29
- package/cjs/cl.verimatrix.js +5 -5
- package/cjs/cl.vimond.js +12 -12
- package/cjs/cl.vr.js +19 -19
- package/cjs/cl.vtt.js +14 -14
- package/cjs/cl.yospace.js +4 -4
- package/cjs/cl.youbora.js +31 -31
- package/cl.adobe.js +3 -3
- package/cl.airplay.js +3 -3
- package/cl.broadpeak.js +5 -5
- package/cl.cast.js +84 -84
- package/cl.conviva.js +27 -27
- package/cl.core.js +473 -474
- package/cl.crypto.js +9 -9
- package/cl.dash.js +75 -74
- package/cl.externs.js +42 -55
- package/cl.freewheel.js +15 -15
- package/cl.hls.js +79 -75
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +26 -26
- package/cl.ima.js +15 -14
- package/cl.mse.js +306 -304
- package/cl.muxdata.js +13 -13
- package/cl.onboard.js +4 -4
- package/cl.persistent.js +10 -10
- package/cl.playlist.js +5 -5
- package/cl.sessions.js +10 -10
- package/cl.simid.js +13 -13
- package/cl.smooth.js +60 -59
- package/cl.thumbnails.js +19 -19
- package/cl.tizen.js +57 -57
- package/cl.ttml.js +22 -22
- package/cl.verimatrix.js +4 -4
- package/cl.vimond.js +8 -8
- package/cl.vr.js +14 -14
- package/cl.vtt.js +12 -12
- package/cl.yospace.js +3 -3
- package/cl.youbora.js +26 -26
- package/clpp.styles.css +4 -0
- package/package.json +1 -1
- package/typings.d.ts +19 -26
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
|
|
2
|
-
a.m.getSurface();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
|
-
c={videoWidth:c.width,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},
|
|
4
|
-
player_mux_plugin_version:_.ea};(a=a.m.getConfiguration().viewerId)&&(b.viewer_user_id=a);return b},
|
|
5
|
-
a.emit("adplaying")});a.a.on(a.m,_.
|
|
6
|
-
var d=new _.
|
|
7
|
-
a.g.debug("onRequestFailed()","Track event: requestfailed",b);a.emit("requestfailed",b)}}}})},
|
|
8
|
-
a),this.l=!1);
|
|
9
|
-
switch(a.detail.currentState){case _.
|
|
10
|
-
this.emit(_.
|
|
11
|
-
request_response_end:a,request_response_headers:e,request_media_duration:c,request_url:_.
|
|
12
|
-
this.a=!1;const h=new _.I(1,9,9301);
|
|
13
|
-
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var oB=function(a){switch(a.type){case 1:return lB;case 2:return mB;case 3:return nB}},qB=function(a){const b=Object.keys(a).find(c=>pB.includes(c.toLowerCase()));return void 0!==b?a[b]:void 0},sB=function(a){let b={debug:!0,data:rB(a)};a.f&&a.f.muxOptionsOverride&&_.ph(a.f.muxOptionsOverride)&&(b=_.lh(b,a.f.muxOptionsOverride));b=_.lh(b,{getPlayheadTime:()=>1E3*a.m.getPosition(),getStateData:()=>{{a.g.debug("getStateData()");var c=a.m.getLoadedSource(),d=a.m.getTrackManager();const f=
|
|
2
|
+
a.m.getSurface();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 _.Bm(c.url);e.video_source_url=_.Zj(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().oa(),
|
|
3
|
+
c={videoWidth:c.width,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},tB=function(a){_.Th(a.a);a.j.vd(a.F);a.j.We(a.C)},rB=function(a){const b={env_key:a.f.envKey,video_title:a.o&&a.o.name||"",player_name:_.qa,player_software_name:_.qa,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},uB=function(a){a.a.on(a.m,_.og,()=>{const b={player_playhead_time:1E3*a.m.getPosition()};a.emit(_.og,b)});a.a.on(a.m,_.gf,()=>a.emit(_.gf));a.a.on(a.m,_.Zc,a.G.bind(a));a.a.on(a.m,_.$f,a.I.bind(a));a.a.on(a.m,_.Cg,()=>a.emit(_.Sf));a.a.on(a.m,_.Bg,()=>a.emit(_.Rf));a.a.on(a.m,_.q,a.H.bind(a));a.a.on(a.m,_.jc,()=>a.emit("adbreakstart"));a.a.on(a.m,_.kc,()=>a.emit("adbreakend"));a.a.on(a.m,_.zc,()=>{a.emit("adplay");
|
|
5
|
+
a.emit("adplaying")});a.a.on(a.m,_.vc,()=>a.emit("adpause"));a.a.on(a.m,_.xc,()=>{a.emit("adplay");a.emit("adplaying")});a.a.on(a.m,_.Ac,()=>a.emit("adended"));a.a.on(a.m,_.oc,()=>a.emit("adfirstquartile"));a.a.on(a.m,_.uc,()=>a.emit("admidpoint"));a.a.on(a.m,_.Dc,()=>a.emit("adthirdquartile"));a.j.Ec(a.F);a.j.me(a.C);a.a.on(a.m,_.q,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 _.Bm(b.uris[b.uriIndex]);b={request_start:c,request_type:oB(b),request_hostname:d.a};a.g.debug("onRequestCanceled()","Track event: requestcanceled",b);a.emit("requestcanceled",b)}else{{d=c.requestStartTimestamp;const f=new _.Bm(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:oB(c),request_hostname:f.a,request_error:`${oB(c)}${"LoadError"}`,request_error_code:e,request_error_text:b.toString()};
|
|
7
|
+
a.g.debug("onRequestFailed()","Track event: requestfailed",b);a.emit("requestfailed",b)}}}})},vB=function(a,b){a.trigger(new _.D(_.q,{detail:b}))},wB=function(a){return!_.B(a)&&typeof a.init===_.ne&&typeof a.emit===_.ne},lB="manifest",mB="media",nB="encryption",pB=["x-request-id","cf-ray","x-amz-cf-id","x-akamai-request-id"];var xB=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 _.St;this.g=b;this.A=this.l=this.h=!1;this.w=null;this.j=a.getNetworkEngine();this.F=this.J.bind(this);this.C=this.K.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,sB(this))}catch(d){throw this.h=!1,tB(this),new _.I(1,9,9302,null,d);}this.emit("playerready")}this.l&&!this.A&&(a=rB(this),this.emit("videochange",
|
|
8
|
+
a),this.l=!1);uB(this)}release(){this.g.debug("release()");this.l?this.g.debug(_.ia):(tB(this),this.l=!0,this.o=this.f=null)}destroy(){this.g.debug(_.Qd);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(_.Te);var b=a.detail;a=this.m.getTrackManager();b&&b.bandwidth&&(b=b.bandwidth,(a=a.Ra())&&a.bandwidth&&(b+=a.bandwidth),this.emit("renditionchange",{video_source_bitrate:b}))}I(a){this.g.debug(_.Ye);
|
|
9
|
+
switch(a.detail.currentState){case _.ip:this.m.getConfiguration().autoplay&&this.emit(_.gf);break;case _.kp:this.emit(_.sf);break;case _.jp:this.emit(_.cf);break;case _.$o:this.emit(_.je)}}H(a){this.g.debug(_.Ve);if(this.h&&(a=a.detail||null))if(10003===a.code)this.emit("aderror");else if(a.severity===_.F){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(_.q,{player_error_code:a.code,player_error_message:b})}}J(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 _.Bm(b.uris[b.uriIndex]);a={request_start:g,request_type:oB(b),request_hostname:d.a,request_id:qB(e),request_bytes_loaded:f,request_response_start:h,
|
|
11
|
+
request_response_end:a,request_response_headers:e,request_media_duration:c,request_url:_.Zj(d)};this.g.debug("onRequestCompleted()","Track event: requestcompleted",a);this.emit("requestcompleted",a)}}}K(a){a.requestStartTimestamp=Date.now()}};var yB=class extends _.Zv{constructor(){super();this.f=this.m=null;this.a=!1;this.g=new _.S("clpp.muxdata")}onPlayerCreated(a){this.m=a;this.f=new xB(a,this.g)}onContentWillLoad(a,b){var c=a.getConfiguration();c=_.mh(c.muxdata);try{var d=[];typeof c===_.Se&&(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=!_.B(f.muxdata)&&typeof f.muxdata===_.Se){const g=f.muxdata;d=wB(g.muxLib)?g.muxLib:window.mux;if(!wB(d)){this.g.warn("Mux SDK is not loaded. Will do nothing.");
|
|
12
|
+
this.a=!1;const h=new _.I(1,9,9301);vB(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,vB(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&&vB(this.m,c),c;}}};_.z("clpp.muxdata.MuxDataPlugin",yB);yB.prototype.emit=yB.prototype.emit;
|
|
13
|
+
yB.Id="mux";_.Nr(new class{create(){return new yB}});};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
|
-
_.z("clpp.onboard.OnboardComponent",class extends _.
|
|
4
|
-
_.z("clpp.onboard.register",
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var kB=function(a,b){let c=b.baseUrl;_.qj(c,"/")||(c+="/");const d=g=>g&&(_.pj(g,"https://")||_.pj(g,"http://")||_.pj(g,"//"))?g:`${c}${g}`,e=d(b.widevineUrl||"widevine"),f=d(b.playreadyUrl||"playready");b=d(b.fairplayUrl||"fairplay");a=new _.Iu(a);a.cb(_.Jd,{licenseUrl:e,videoRobustness:[_.Db,void 0],audioRobustness:[_.Cb,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:_.Tm,licenseResponse:_.Um}});a.cb(_.Ed,{licenseUrl:b,
|
|
2
|
+
certificateUrl:b,modifiers:{licenseRequest:_.Wm,licenseResponse:_.Xm,extractContentId:_.Ym,certificateRequest:_.Zm}});a.cb(_.Hd,{licenseUrl:f,modifiers:{licenseRequest:_.Tm}});_.fm(a)};
|
|
3
|
+
_.z("clpp.onboard.OnboardComponent",class extends _.Kv{constructor(){super();this.g=new _.S("clpp.onboard");this.j=new Set}a(){for(const a of this.j)delete _.em[a];this.j.clear()}h(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,playreadyUrl:a.playreadyUrl,fairplayUrl:a.fairplayUrl},this.g.info(`Registering the DRMtoday Onboard environment, name='${b}'`),kB(b,a),this.j.add(b))}id(){return"onboard"}});
|
|
4
|
+
_.z("clpp.onboard.register",kB);};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
|
-
|
|
4
|
-
keySystem:h.keySystem,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 VA="A persistent DRM session already exists for: ",WA="No DRM configuration.",XA="clpp.persistent",YA="clpp.persistent.SimpleSessionStorage",ZA=function(a,b){const c=[];for(const d of a)c.push(b(d));return c},aB=function(a,b,c,d,e,f){a.K=$A;const g=new Map,h=_.Pn(b);g.set(h,{audioCapabilities:e,videoCapabilities:f,distinctiveIdentifier:_.$e,persistentState:_.Kf,sessionTypes:[_.ef],label:h,drmInfos:[{keySystem:b,licenseServerUri:c,distinctiveIdentifierRequired:!1,persistentStateRequired:!0,
|
|
2
|
+
audioRobustness:"",videoRobustness:"",serverCertificate:d,initData:null,keyIds:null}]});return _.ho(a,g)},cB=function(a,b){a.K=bB;a.L=[];a.G=!0;return _.io(a,b)},dB=function(a,b){return _.x(function*(){const c=yield _.zo(a,b);if(c){var d=[],e=a.h.get(c);e&&a.C&&(e.kc=new _.rn,d.push(e.kc));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)})},eB=function(a){a=a.h.keys();a=ZA(a,b=>b.sessionId);return Array.from(a)},
|
|
3
|
+
fB=function(a,b){const c=_.hm(a),d=_.Il({drm:a});d.drm=a;a=new _.rp({yb:b,onError:()=>{},Ne:()=>{},Me:()=>{},onEvent:()=>{},getConfiguration:()=>d,Oc:()=>null});a.f=c;return a},iB=function(a,b,c){return _.x(function*(){const d=gB;if(a){var e=a.offlineId;if(0!==e.length){var f=yield d.get(e);if(f)hB.debug(VA,e);else{var g=fB(a,c);try{yield cB(g,b);yield _.xo(g);yield _.Ao(g);const h=g.getDrmInfo(),k=b.map(l=>({contentType:_.Bk(l.video.mimeType,l.video.codecs),robustness:h.videoRobustness}));f={sessionIds:eB(g),
|
|
4
|
+
keySystem:h.keySystem,licenseServerUri:h.licenseServerUri,serverCertificate:h.serverCertificate,audioCapabilities:[],videoCapabilities:k,drmConfig:a};yield d.store(e,f)}catch(h){throw hB.error(`Error while persisting DRM session ${e}`),new _.I(1,6,6200,null,h);}finally{yield g.destroy()}}}}else hB.debug(WA)})},bB=1,$A=2,jB=class{constructor(){this.g=new _.S(YA)}store(a,b){return _.x(function*(){{var c=JSON.stringify(b.sessionIds);var d=b.serverCertificate?Array.from(b.serverCertificate):null;d=JSON.stringify(d);
|
|
5
5
|
const e=JSON.stringify(b.audioCapabilities),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 _.x(function*(){const c=window.localStorage.getItem(encodeURIComponent(a));if(c)try{{const e=JSON.parse(atob(c)),f=JSON.parse(e.sessionIds),
|
|
6
|
-
g=e.audioCapabilities||[],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 _.x(function*(){window.localStorage.removeItem(encodeURIComponent(a))})}clear(){return _.x(function*(){window.localStorage.clear()})}getName(){return
|
|
7
|
-
_.z("clpp.persistent.fetchLicense",function(a,b,...c){return _.x(function*(){var d=
|
|
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(_.F,4,4014));const m=_
|
|
9
|
-
_.z("clpp.persistent.removeLicense",function(a){return _.x(function*(){var b=
|
|
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
|
|
11
|
-
const c=
|
|
6
|
+
g=e.audioCapabilities||[],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 _.x(function*(){window.localStorage.removeItem(encodeURIComponent(a))})}clear(){return _.x(function*(){window.localStorage.clear()})}getName(){return YA}};_.z("clpp.persistent.useStorage",function(a){{var b=["store","get","delete","clear","getName"];const c=[];_.B(a)||(_.qh(a.store)||c.push("store"),_.qh(a.get)||c.push("get"),_.qh(a.delete)||c.push("delete"),_.qh(a.clear)||c.push("clear"),_.qh(a.getName)||c.push("getName"),b=c)}if(0<b.length)throw hB.warn("Invalid session storage implementation"),new _.I(1,6,6202,{missingMethods:b});gB=a});
|
|
7
|
+
_.z("clpp.persistent.fetchLicense",function(a,b,...c){return _.x(function*(){var d=gB,e=(l,m)=>new _.I(1,6,6200,l,m);const f=_.np(a).shift();if(!f)throw e("No source specified.");if(!b)throw e(WA);var g=b.offlineId;if(typeof g!==_.cg||!g.length)throw e("Missing offline id.");if(yield d.get(g))hB.debug(VA,g);else{var h=_.Il();d=new _.Er;g=[];for(var k of c){const l=new k;_.Ll(l.id())||(l.f(),_.Nl(l),g.push(l))}k=null;try{k=yield _.bt(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(_.F,4,4014));const m=_.$s(l.periods);yield iB(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.a(),_.Kl.delete(e.id());e=[];k&&e.push(k.stop());e.push(d.destroy());yield Promise.all(e)}}})});
|
|
9
|
+
_.z("clpp.persistent.removeLicense",function(a){return _.x(function*(){var b=gB;if(_.sh(a)&&0!==a.length){var c=null,d=null;try{const e=yield b.get(a);e?(e.drmConfig.delayLicenseRequestUntilPlayed=!0,d=new _.Er,c=fB(e.drmConfig,d),yield aB(c,e.keySystem,e.licenseServerUri,e.serverCertificate,e.audioCapabilities,e.videoCapabilities),yield _.xo(c),yield Promise.all(e.sessionIds.map(f=>_.x(function*(){yield dB(c,f);hB.debug("successfully removed session with id",f)}))),yield b.delete(a)):hB.debug("No persistent DRM session found")}catch(e){throw hB.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 hB.warn("Invalid offlineId")})});_.z("clpp.persistent.getSessionStorage",function(){return gB});var gB=new jB,hB=new _.S(XA);_.z("clpp.persistent.PersistentLicenseComponent",class extends _.Kv{constructor(){super();this.g=new _.S(XA)}id(){return _.df}l(a,b){const c=this;return _.x(function*(){const d=a.getConfiguration().drm;if(d){c.g.debug(`Persisting DRM session ID: ${d.offlineId}`);var e=a.getNetworkEngine();try{yield iB(d,b,e),a.trigger(new _.D(_.ce,{offlineId:d.offlineId}))}catch(f){a.onError(f)}}else c.g.debug("No DRM configuration found for loaded source.")})}j(a){const b=this;return _.x(function*(){b.g.debug(`Getting EME session IDs for ${a}`);
|
|
11
|
+
const c=gB;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
|
|
2
|
-
this.a.length&&
|
|
3
|
-
c.trigger(new _.D(_.
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var SA=function(a,b){return 0<=b&&b<a.a.length},TA=function(a){a.trigger(new _.D(_.vf))},UA=class extends _.Cu{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.Da.bind(this)}getPosition(){return this.f}wh(){return this.a}ed(){return 0<this.a.length&&SA(this,this.f)?this.a[this.f]:null}xh(){const a=this.f+1;return 0<
|
|
2
|
+
this.a.length&&SA(this,a)?this.a[a]:null}Ih(){return this.h}start(){this.h||(this.h=!0,this.m.on(_.je,this.j),this.Qd(this.f,!0))}stop(){this.h=!1;this.m.off(_.je,this.j)}Da(){this.next()}next(){const a=this;return _.x(function*(){yield a.Qd(Math.min(a.a.length-1,a.f+1))})}$h(){const a=this;return _.x(function*(){yield a.Qd(Math.max(0,a.f-1))})}Qd(a,b){b=void 0===b?!1:b;const c=this;return _.x(function*(){if(0<c.a.length&&SA(c,a)&&(b||c.f!==a)){c.f=a;var d=c.ed();d&&(yield c.l(d),yield c.m.load(d.configuration),
|
|
3
|
+
c.trigger(new _.D(_.tf,{item:d})))}})}append(a){this.a.push(a);TA(this)}Gh(a,b){if(0<=b&&b<=this.a.length){const c=this.ed();this.a.splice(b,0,a);c&&(this.f=this.a.indexOf(c));TA(this)}}remove(a){if(0<this.a.length&&SA(this,a)){if(this.f===a)throw Error("Can't remove the current item");this.a.splice(a,1);TA(this)}}clear(){this.stop();this.f=0;this.a=[];this.h=!1;TA(this)}};_.z("clpp.Playlist",UA);UA.prototype.clear=UA.prototype.clear;UA.prototype.remove=UA.prototype.remove;UA.prototype.insert=UA.prototype.Gh;
|
|
4
|
+
UA.prototype.append=UA.prototype.append;UA.prototype.goTo=UA.prototype.Qd;UA.prototype.previous=UA.prototype.$h;UA.prototype.next=UA.prototype.next;UA.prototype.onEnded=UA.prototype.Da;UA.prototype.stop=UA.prototype.stop;UA.prototype.start=UA.prototype.start;UA.prototype.isStarted=UA.prototype.Ih;UA.prototype.getUpcoming=UA.prototype.xh;UA.prototype.getCurrent=UA.prototype.ed;UA.prototype.getQueue=UA.prototype.wh;UA.prototype.getPosition=UA.prototype.getPosition;UA.prototype.off=UA.prototype.off;
|
|
5
|
+
UA.prototype.one=UA.prototype.one;UA.prototype.on=UA.prototype.on;};f.call(g, window);
|
package/cl.sessions.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
b<<3|0),d(a,c)},
|
|
3
|
-
0;e<c.length;e++){
|
|
4
|
-
128),d.a.push(g&63|128),f++)}else d.a.push(g>>12|224),d.a.push(g>>6&63|128),d.a.push(g&63|128)}})},
|
|
5
|
-
{};a.f=new Promise(c=>{b=c});try{const c=new
|
|
6
|
-
c),new
|
|
7
|
-
_.
|
|
8
|
-
a=_.
|
|
9
|
-
c=new
|
|
10
|
-
const c=new EA(
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Nz="apiUrl config is missing",Oz=function(a,b){a.j=a.j.filter(c=>c!==b)},Pz=function(a){let b=0>a;a=Math.abs(a);let c=a>>>0;a=Math.floor((a-c)/4294967296);a>>>=0;b&&(a=~a>>>0,c=(~c>>>0)+1,4294967295<c&&(c=0,a++,4294967295<a&&(a=0)));return[c,a]},Uz=function(a,b,c,d){if(!(null===c||void 0===c||typeof c===_.t&&0===c||typeof c===_.cg&&0===c.length||Array.isArray(c)&&0===c.length))if(Array.isArray(c)){Qz(a,b<<3|2);b=new Rz;for(let e=0;e<c.length;e++)d(b,c[e]);Sz(a,b.length());Tz(a,b.end())}else Qz(a,
|
|
2
|
+
b<<3|0),d(a,c)},Sz=function(a,b){if(0<=b)Qz(a,b);else{for(let c=0;9>c;c++)a.a.push(b&127|128),b>>=7;a.a.push(1)}},Vz=function(a,b,c){Uz(a,b,c,(d,e)=>{Sz(d,e)})},Qz=function(a,b){for(;127<b;)a.a.push(b&127|128),b>>>=7;a.a.push(b)},Xz=function(a,b,c){Uz(a,b,c,(d,e)=>{if(0<=e){{const [f,g]=Pz(e);Wz(d,f,g)}}else{{const [f,g]=Pz(e);Wz(d,f,g)}}})},Yz=function(a,b,c,d){if(!(null===c||void 0===c||typeof c===_.t&&0===c||typeof c===_.cg&&0===c.length||Array.isArray(c)&&0===c.length))if(Array.isArray(c))for(let e=
|
|
3
|
+
0;e<c.length;e++){Qz(a,b<<3|2);const f=new Rz;d(f,c[e]);Sz(a,f.length());Tz(a,f.end())}else Qz(a,b<<3|2),b=new Rz,d(b,c),Sz(a,b.length()),Tz(a,b.end())},Zz=function(a,b,c){Yz(a,b,c,(d,e)=>{for(let f=0;f<e.length;f++){let g=e.charCodeAt(f);if(128>g)d.a.push(g);else if(2048>g)d.a.push(g>>6|192),d.a.push(g&63|128);else if(65536>g)if(55296<=g&&56319>=g&&f+1<e.length){let h=e.charCodeAt(f+1);56320<=h&&57343>=h&&(g=1024*(g-55296)+h-56320+65536,d.a.push(g>>18|240),d.a.push(g>>12&63|128),d.a.push(g>>6&63|
|
|
4
|
+
128),d.a.push(g&63|128),f++)}else d.a.push(g>>12|224),d.a.push(g>>6&63|128),d.a.push(g&63|128)}})},Tz=function(a,b){a.a.push.apply(a.a,b)},$z=function(a,b,c){Yz(a,b,c,(d,e)=>{Tz(d,e.a())})},aA=function(a,b,c){Yz(a,b,c,(d,e)=>{Tz(d,e)})},Wz=function(a,b,c){for(;0<c||127<b;)a.a.push(b&127|128),b=(b>>>7|c<<25)>>>0,c>>>=7;a.a.push(b)},cA=function(a){const b=new bA;b.h=Math.floor(a/1E3);b.f=a%1E3*1E6;return b},gA=function(a){return _.x(function*(){if(!a.j&&!a.f){0===a.a.length&&dA(a,new eA);var b=()=>
|
|
5
|
+
{};a.f=new Promise(c=>{b=c});try{const c=new fA;c.f=a.o;c.events.push(...a.a);const d=[...a.a],e=yield fetch(a.l,{method:_.sb,headers:{"Content-Type":"application/proto"},body:new Uint8Array(c.a())});if(e.ok)a.a=a.a.filter(f=>!d.includes(f));else throw Error("An error occurred while sending telemetry events to the API, "+`status='${e.status}' statusText='${e.statusText}'`);}finally{b(),a.f=null}}})},jA=function(a,b,c,d,e,f,g){const h=new hA;h.headers=[new iA("CL-BROWSER-NAME",b),new iA("CL-BROWSER-VERSION",
|
|
6
|
+
c),new iA("CL-OS-FAMILY",d),new iA("CL-OS-VERSION",e),new iA("CL-SDK-NAME",f),new iA("CL-SDK-NAME",f),new iA("CL-SDK-VERSION",g)];dA(a,h)},dA=function(a,b){if(!a.j){var c=new kA(a.w);c.sessionId=a.A;{var d=Date.now();const e=new lA;e.h=Math.floor(d/1E3);e.f=d%1E3*1E6;d=e}c.time=d;c.h=b.getId();c.f=new Uint8Array(b.a());a.a.push(c)}},mA=function(a){return _.x(function*(){a.h&&(clearInterval(a.h),a.h=null);a.f&&(yield a.f);0<a.a.length&&(yield gA(a),a.a=[]);a.j=!0})},nA=function(a){_.x(function*(){a.g.info("Destroy the session and stop sending events.");
|
|
7
|
+
_.Th(a.f);a.a=!1;const b=a.m.getNetworkEngine();b.We(a.o);b.vd(a.j);Oz(b,a.j);a.h&&(yield mA(a.h),a.h=null)})},vA=function(a){switch(a){case _.hp:return oA;case _.ip:return pA;case _.dp:return qA;case _.kp:return rA;case _.jp:return sA;case _.$o:return tA;case _.ap:return uA;default:return null}},wA=function(a,b){a.g.debug("Sending event",b);dA(a.h,b)},EA=function(a,b){switch(a){case 1:return xA;case 2:return b===_.w?yA:b===_.p?zA:b===_.H?AA:b===_.re?BA:CA;case 3:return DA;default:return CA}};var Rz=class{constructor(){this.a=[]}length(){return this.a.length}end(){const a=this.a;this.a=[];return a}};var FA=class{constructor(a,b,c,d){this.downloadId=a;this.h=b;this.duration=c;this.j=d;this.f=[]}a(){const a=new Rz;$z(a,1,this.downloadId);Vz(a,2,this.h);$z(a,3,this.duration);Vz(a,4,this.j);$z(a,5,this.f);return a.end()}getId(){return 4}};var GA=class{constructor(a,b){this.f=a;this.url=b;this.downloadId=null;this.headers=[];this.size=this.duration=null}a(){const a=new Rz;Vz(a,1,this.f);$z(a,2,this.downloadId);Zz(a,3,this.url);$z(a,4,this.headers);Zz(a,5,null);$z(a,6,null);$z(a,7,this.duration);Xz(a,8,this.size);return a.end()}getId(){return 2}};var HA=class{constructor(a,b){this.h=a;this.f=b}a(){const a=new Rz;Vz(a,1,this.h);aA(a,2,this.f);return a.end()}};var IA=class{constructor(a){this.cause=a;this.f=this.message=this.severity=this.errorCode=null}a(){const a=new Rz;Vz(a,1,this.errorCode);Vz(a,2,this.severity);Zz(a,3,this.message);Zz(a,4,this.f);$z(a,5,this.cause);return a.end()}getId(){return 7}};var iA=class{constructor(a,b){this.key=a;this.value=b}a(){const a=new Rz;Zz(a,1,this.key);Zz(a,2,this.value);return a.end()}};var JA=class{constructor(){this.cause=this.severity=this.code=null}a(){const a=new Rz;Vz(a,1,this.code);Vz(a,2,this.severity);$z(a,3,this.cause);return a.end()}getId(){return 12}};var KA=class{constructor(){this.data=null}a(){const a=new Rz;aA(a,1,this.data);return a.end()}};var LA=class extends KA{constructor(){super();var a=new Uint8Array(16);crypto.getRandomValues(a);a[6]=a[6]&15|64;a[8]=a[8]&63|128;this.data=a}toString(){const a=[];for(let b=0;256>b;++b)a.push((b+256).toString(16).slice(1));return a[this.data[0]]+a[this.data[1]]+a[this.data[2]]+a[this.data[3]]+"-"+a[this.data[4]]+a[this.data[5]]+"-"+a[this.data[6]]+a[this.data[7]]+"-"+a[this.data[8]]+a[this.data[9]]+"-"+a[this.data[10]]+a[this.data[11]]+a[this.data[12]]+a[this.data[13]]+a[this.data[14]]+a[this.data[15]]}};var hA=class{constructor(){this.headers=[]}a(){const a=new Rz;$z(a,1,this.headers);return a.end()}getId(){return 1}};var eA=class{constructor(){}a(){return(new Rz).end()}getId(){return 6}};var kA=class{constructor(a){this.j=a;this.f=this.h=this.time=this.sessionId=null}a(){const a=new Rz;$z(a,1,this.j);$z(a,2,this.sessionId);$z(a,3,this.time);Xz(a,4,null);Zz(a,5,null);Vz(a,6,this.h);aA(a,7,this.f);return a.end()}};var fA=class{constructor(){this.f=null;this.events=[]}a(){const a=new Rz;aA(a,1,this.f);$z(a,2,this.events);return a.end()}};var lA=class{constructor(){this.f=this.h=null}a(){const a=new Rz;Xz(a,1,this.h);Vz(a,2,this.f);return a.end()}};var bA=class{constructor(){this.f=this.h=null}a(){const a=new Rz;Xz(a,1,this.h);Vz(a,2,this.f);return a.end()}};var MA=class{constructor(a,b,c,d,e,f,g,h,k){k=void 0===k?2500:k;this.o=a;this.l=h;this.w=new LA;this.A=new LA;this.a=[];this.h=setInterval(()=>gA(this),k);this.f=null;this.j=!1;jA(this,b,c,d,e,f,g)}};var NA=class{constructor(){this.reason=this.currentState=this.previousState=null}a(){const a=new Rz;Vz(a,1,this.previousState);Vz(a,2,this.currentState);Vz(a,3,this.reason);$z(a,4,null);$z(a,5,null);$z(a,6,null);return a.end()}getId(){return 5}};var RA=class extends _.Zv{constructor(){super();this.m=null;this.a=this.l=!1;this.f=new _.St;this.h=null;this.g=new _.S("clpp.sessions.SessionsPlugin");this.o=this.G.bind(this);this.j=this.F.bind(this)}onPlayerCreated(a){this.m=a}onContentWillLoad(a){var b=a.getConfiguration().sessions;(b=!(!b||typeof b!==_.Se))||this.g.debug("Sessions plugin is loaded but not configured. Will do nothing.");if(this.l=b)b=a.getConfiguration().sessions,b.apiUrl?(this.g.debug(_.ra),this.g.info("Create a session and start sending events."),
|
|
8
|
+
a=_.il(),this.h=new MA(new Uint8Array([]),a.browser,a.browserVersion.name,a.os,a.osVersion.name,"prestoplay-web",_.ea,b.apiUrl),this.f.on(this.m,_.$f,this.C.bind(this)),this.f.on(this.m,_.Sf,this.B.bind(this)),this.f.on(this.m,_.Rf,this.A.bind(this)),this.f.on(this.m,_.q,this.w.bind(this)),a=this.m.getNetworkEngine(),a.me(this.o),a.Ec(this.j),a.j.push(this.j)):(this.g.warn(Nz),a.onError(new _.I(1,9,15E3,Nz)))}onPlayerWillRelease(){nA(this)}id(){return"sessions"}C(a){if(!this.a){a=a.detail;var b=a.currentState,
|
|
9
|
+
c=new NA;c.previousState=vA(a.previousState);c.currentState=vA(b);wA(this,c)}}B(){if(!this.a){var a=new NA;a.previousState=vA(this.m.getState());a.currentState=OA;wA(this,a);this.a=!0}}A(){if(this.a){var a=new NA;a.previousState=OA;a.currentState=vA(this.m.getState());wA(this,a);this.a=!1}}w(a){a=a.detail;var b=new JA;b=new IA(new HA(b.getId(),new Uint8Array(b.a())));b.errorCode=a.code;b.message=a.message;b.f=a.stack;b.severity=a.severity===_.F?PA:QA;wA(this,b)}G(a){const b=new LA;a.downloadId=b;
|
|
10
|
+
const c=new GA(EA(a.type,a.contentType),a.uris[0]);c.downloadId=b;c.headers=Object.keys(a.headers).map(d=>new iA(d,a.headers[d]));wA(this,c)}F(a){var b=a.request.downloadId;b?(b=new FA(b,a.data.byteLength,cA(a.timeMs||0),a.status||-1),b.f=Object.keys(a.headers).map(c=>new iA(c,a.headers[c])),wA(this,b)):this.g.warn("Download ID is missing on download completed event.")}};_.Nr(new class{create(){return new RA}});var QA=1,PA=2;var oA=0,pA=2,uA=3,OA=5,qA=6,rA=8,sA=10,tA=11;var xA=0,yA=1,zA=2,AA=3,BA=4,DA=5,CA=9;};f.call(g, window);
|
package/cl.simid.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
c)})},
|
|
3
|
-
!1,volume:c.m.getVolume()||0,navigationSupport:"adHandles",closeButtonSupport:"adHandles",nonlinearDuration:c.f.duration},creativeData:{adParameters:c.f.adParameters||"",clickThruUri:"",clickThruUrl:""}}}{const f=
|
|
4
|
-
value:void 0}))},
|
|
5
|
-
e=
|
|
6
|
-
"";a.h=!1;a.m.trigger(new _.D(_.
|
|
7
|
-
_.
|
|
8
|
-
d);if(c.m&&c.m.getSurface()&&c.m.getSurface().getMedia()&&d.mediaDimensions){c.h?c.m.getSurface().getMedia().style.transition="":(c.m.getSurface().getMedia().style.transition="left .5s, top .5s,width .5s, height .5s",c.h=!0);const e=
|
|
9
|
-
d.left,c.a.a.style.top=d.top,c.a.a.style.width=d.width,c.a.a.style.height=d.height);
|
|
10
|
-
this.o);this.a.parentElement&&this.a.parentElement.removeChild(this.a)}},
|
|
11
|
-
b=this.m.getSurface()){this.g.info("Creating new session");this.a=new
|
|
12
|
-
c&&(c=this.a,
|
|
13
|
-
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}Vf(){return this.a}url(){return this.f?this.f.url:""}};_.
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var wz="No surface found. Can not attach frame!",xz="SIMID:Media:timeupdate",yz="Starting creative",zz=function(a,b,c){return{type:b,sessionId:a.h,messageId:a.l++,timestamp:Date.now(),args:c}},Cz=function(a,b){return new Promise((c,d)=>{new Az(a.j,c,d,b);Bz(a,b)})},Dz=function(a){const b=zz(a,"SIMID:Player:startCreative",void 0);Cz(a,b).then(()=>{var c=a.f;c.g.info(yz);c.m.trigger(new _.D(_.Uf));a.a.style.opacity="1"}).catch(c=>{a.unload();a.f.g.error("Error while starting creative",
|
|
2
|
+
c)})},Fz=function(a,b){_.x(function*(){a.h=b.sessionId;Ez(a,b);try{{var c=a.f;const f=c.getSurface(),g=c.getContainer();var d={environmentData:{videoDimensions:{x:0,y:0,height:g.clientHeight,width:g.clientWidth},creativeDimensions:{x:0,y:0,height:g.clientHeight,width:g.clientWidth},fullscreen:f.isFullscreen(),fullscreenAllowed:!0,variableDurationAllowed:!1,skippableState:"notSkippable",version:"1.1",skipoffset:"",siteUrl:window.location.toString(),appId:"",useragent:"",deviceId:"",muted:c.m.isMuted()||
|
|
3
|
+
!1,volume:c.m.getVolume()||0,navigationSupport:"adHandles",closeButtonSupport:"adHandles",nonlinearDuration:c.f.duration},creativeData:{adParameters:c.f.adParameters||"",clickThruUri:"",clickThruUrl:""}}}{const f=zz(a,"SIMID:Player:init",d);var e=Cz(a,f)}yield e;a.g.info("Player Init acknowledged");a.f.g.info("SIMID Player initialized")}catch(f){a.g.error("Error while initializing",f),a.f.g.error("Error while initializing SIMID player: ",f),a.unload()}})},Ez=function(a,b){Bz(a,zz(a,"resolve",{messageId:b.messageId,
|
|
4
|
+
value:void 0}))},Bz=function(a,b){a.h?(b.type!==xz&&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}'`)},Gz=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
|
+
e=zz(d,"SIMID:Player:resize",e);Bz(d,e)}})},Hz=function(a,b){a.g.info("SIMID Session created");a.a=b},Iz=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
|
+
"";a.h=!1;a.m.trigger(new _.D(_.Vf))},Jz=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}%`}},Kz=class{constructor(a){this.f=a;this.h="";this.l=0;this.j=new Map;this.a=document.createElement("iframe");this.a.style.opacity="0";this.a.style.border=_.Re;this.a.style.backgroundColor="transparent";this.a.style.transition="opacity .5s";this.a.style.transitionDelay=".5s";this.a.style.pointerEvents=
|
|
7
|
+
_.Re;this.a.style.overflow=_.pe;this.a.classList.add(_.pd);this.o=b=>{if(b.source===this.a.contentWindow&&(b=(b=b.data)?typeof b===_.cg?JSON.parse(b):b:null))if(b.type)switch(this.g.info(`Received message [${b.messageId}] '${b.type}':`,b.args),b.type){case "createSession":Fz(this,b);break;case "resolve":b=b.args;var c=this.j.get(b.messageId);c&&c.resolve(b);break;case "reject":b=b.args;(c=this.j.get(b.messageId))&&c.reject(b);break;case "SIMID:Creative:requestResize":c=this.f;var d=b.args;c.g.info("Creative requested resize",
|
|
8
|
+
d);if(c.m&&c.m.getSurface()&&c.m.getSurface().getMedia()&&d.mediaDimensions){c.h?c.m.getSurface().getMedia().style.transition="":(c.m.getSurface().getMedia().style.transition="left .5s, top .5s,width .5s, height .5s",c.h=!0);const e=Jz(c,d.mediaDimensions);c.m.getSurface().getMedia().style.left=e.left;c.m.getSurface().getMedia().style.top=e.top;c.m.getSurface().getMedia().style.width=e.width;c.m.getSurface().getMedia().style.height=e.height}d.creativeDimensions&&(d=Jz(c,d.creativeDimensions),c.a.a.style.left=
|
|
9
|
+
d.left,c.a.a.style.top=d.top,c.a.a.style.width=d.width,c.a.a.style.height=d.height);Ez(this,b)}else this.g.warn("WARNING: received message without 'type' property")};this.g=new _.S("clpp.simid.SimidPlayer");Hz(this.f,this)}load(a){window.addEventListener(_.Ke,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(){Iz(this.f);this.h=this.a.src="";this.l=0;this.a.style.opacity="0";window.removeEventListener(_.Ke,
|
|
10
|
+
this.o);this.a.parentElement&&this.a.parentElement.removeChild(this.a)}},Az=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);this.j(a)}};var Mz=class extends _.Zv{constructor(){super();this.g=new _.S("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 Lz(a)}onContentWillLoad(a){var b=a.getConfiguration();if(b.simid&&b.simid.creatives&&0!==b.simid.creatives.length)if(this.l=b.simid.creatives,this.g.info(`Setting up SIMID plugin for ${this.l.length} creatives`),
|
|
11
|
+
b=this.m.getSurface()){this.g.info("Creating new session");this.a=new Kz(this.h);var c=b.getContainer();this.j=Gz(this,c,b);this.j.observe(c);a.on(_.og,this.w)}else this.g.warn(wz)}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&&(Dz(this.a),this.o=!0,this.g.info(yz)),
|
|
12
|
+
c&&(c=this.a,Bz(c,zz(c,xz,{currentTime:a-b}))))):((a=this.m.getSurface())||this.g.warn(wz),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(_.og,this.w),this.f&&(this.a.unload(),this.f=this.h.f=null))}},Lz=class{constructor(a){this.m=a;this.a=null;this.g=new _.S("clpp.simid.Loader");
|
|
13
|
+
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}Vf(){return this.a}url(){return this.f?this.f.url:""}};_.Nr(new class{create(){return new Mz}});};f.call(g, window);
|
package/cl.smooth.js
CHANGED
|
@@ -1,59 +1,60 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";import './cl.mse.js';let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
b,a.h),a.a+=2}catch(c){_.
|
|
3
|
-
String(d.bitrate)).replace("{start time}",String(c.t)).replace("{start_time}",String(c.t));return _.
|
|
4
|
-
sampleSize:NaN,channelCount:NaN};switch(c.type){case _.w:a.eb=[_.
|
|
5
|
-
Number(a[2]);let f=Number(a[3]),g=Number(a[4]);g+=(Number(a[5])||0)/c.f;f+=g/c.frameRate;d=f+60*e+3600*d}}else
|
|
6
|
-
0;for(let c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.
|
|
7
|
-
|
|
8
|
-
(a=(new
|
|
9
|
-
|
|
10
|
-
0<l-k.reader.getPosition()&&k.flags&32&&(m.l=_.P(k.reader));d=m}}).ea("trun",k=>{{var l=k.reader.Sa();if(null===k.flags)throw new _.I(_.F,3,3019,
|
|
11
|
-
2048&&(0===k.version?m.h.push(_.P(k.reader)):m.h.push(_.
|
|
12
|
-
u.Cf=_.
|
|
13
|
-
g;d=g.get(_.
|
|
14
|
-
A;y++){b:{var k=h;var l=g[y],m=new RegExp("\\w+:"+l),n=0;if(k.hasAttribute(l)){k=k.getAttribute(l);break b}l=k.attributes;const E=l.length;for(;n<E;n++){var
|
|
15
|
-
m,f]);n&&b.append([n]);if(e){g=0;k=[];if(c.flags&2)for(k=[],m=0;m<c.h;m++)k.push(10+6*c.f[m].
|
|
16
|
-
periodId:null}},
|
|
17
|
-
c.type=1;c=yield a.D.networkingEngine.fetch(c).
|
|
18
|
-
if(!1===/^[2].[0-2]$/.test(""+e+"."+f))throw a.g.error("Smooth Streaming version must be 2.0, 2.1 or 2.2"),new _.I(_.F,4,4036,a.o);k?(
|
|
19
|
-
u}{const
|
|
20
|
-
Na,
|
|
21
|
-
32E3:5,24E3:6,22050:7,16E3:8,12E3:9,11025:10,8E3:11,7350:12},
|
|
22
|
-
maxWidth:yg,xd:
|
|
23
|
-
|
|
24
|
-
fg:f,timescale:g,duration:h,isLive:k,
|
|
25
|
-
textStreams:
|
|
26
|
-
a.C.A=
|
|
27
|
-
c);c&&null!=a.l&&(window.clearTimeout(a.l),a.l=null,a.B=null);a.O=b},
|
|
28
|
-
`track with bitrate ${g.bitrate}. Skipping update.`)}}},
|
|
29
|
-
d.length;f++){const g=d[f].tracks.map(h=>{{var k=d[f],l=
|
|
30
|
-
2),16)&248)>>3),E="mp4a.40."+G,a.g.debug("AUDIO CODECS: ",E)}G=k.type===_.H?
|
|
31
|
-
primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:h.Ff||null,spatialAudio:!1,closedCaptions:null}}return h});e=e.concat(g)}return e},
|
|
32
|
-
try{d=
|
|
33
|
-
a)return this.children[b];{const c=this.children[b].get(a);if(c)return c}}return null}a(){const a=Math.pow(2,32)-1;let b;b=4+this.type.length;"uuid"===this.type&&(b+=16);if(0<this.children.length)for(let c=0;c<this.children.length;c++)b+=this.children[c].a();this.size>a&&(b+=8);return b}write(a){var b=Math.pow(2,32)-1;this.start=a.getPosition();this.size=this.a();this.size>b?_.O(a,1):_.O(a,this.size);_.
|
|
34
|
-
!this.w)for(b=0;b<this.children.length;b++)this.children[b].write(a),this.children[b].a(),a.getPosition()}},
|
|
35
|
-
b,c);this.f=d;this.offset=e}a(){return this.f.byteLength+super.a()-this.offset}write(a){super.write(a);_.
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
d;this.height=e;this.volume=1;this.f=[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0]}a(){let a=0;a=1===this.version?a+32:a+20;a=a+24+this.f.length;return a+super.a()}write(a){super.write(a);1===this.version?(
|
|
39
|
-
this.width);
|
|
40
|
-
0,0);this.f=a}a(){return 33+super.a()}write(a){super.write(a);_.O(a,0);this.f===_.w?_.
|
|
41
|
-
super.a()}write(a){super.write(a);_.O(a,0);
|
|
42
|
-
super.a()}write(a){super.write(a);_.O(a,0);_.O(a,0);
|
|
43
|
-
a.getPosition()}},
|
|
44
|
-
for(var b=0;b<this.eb.length;b++)
|
|
45
|
-
_.
|
|
46
|
-
a.getPosition()}},
|
|
47
|
-
_.O(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},
|
|
48
|
-
return a+super.a()}write(a){super.write(a);_.O(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},
|
|
49
|
-
|
|
50
|
-
b);this.l=this.j=this.f=0;this.o=[];this.sampleSize=[];this.A=[];this.h=[]}a(){let a=4;this.flags&
|
|
51
|
-
this.flags&
|
|
52
|
-
|
|
53
|
-
return a+super.a()}write(a){super.write(a);
|
|
54
|
-
class extends
|
|
55
|
-
b,c){super("saiz",0,0);this.f=a;this.j=b;this.h=c}a(){let a=0;this.flags&1&&(a+=8);a+=5;0===this.f&&(a+=this.j.length);return a+super.a()}write(a){super.write(a);this.flags&1&&(_.O(a,0),_.O(a,0));
|
|
56
|
-
2,a+=4}return a+super.a()}write(a){super.write(a);_.O(a,this.h);this.flags&1&&
|
|
57
|
-
this.j=this.f=this.D=null;this.l&&(clearTimeout(this.l),this.l=null);this.L=!1;this.J=this.G=Infinity;return Promise.resolve()}update(){if(this.F())return
|
|
58
|
-
0;c<this.w.length;c++)if(this.w[c].keySystem===a){b=this.w[c].initData[0];break}return b}S(a){if(2!==a.request.type||a.uri.startsWith("data:"))return Promise.resolve(a);const b=a.request.timescale||this.A.timescale,c={isLive:this.F.bind(this),
|
|
59
|
-
`segment reference time ${a.request.startTime}`);f=
|
|
1
|
+
import {clpp} from "./cl.core.js";import './cl.mse.js';let g={};const _ = clpp._;var f=function(window){'use strict';var JR="Full MP4 box must have flags defined",KR="clpp.smooth.SmoothMP4Processor",LR="codecPrivateData",MR=function(a,b){const c=Math.floor(b/Math.pow(2,32));b-=c*Math.pow(2,32);_.O(a,c);_.O(a,b)},NR=function(a,b){try{a.f.setUint8(a.a,b),a.a+=1}catch(c){_.km()}},OR=function(a,b){NR(a,b>>16&255);NR(a,b>>8&255);NR(a,b&255)},PR=function(a,b){try{a.f.setUint16(a.a,b,a.h),a.a+=2}catch(c){_.km()}},QR=function(a,b){try{a.f.setInt32(a.a,b,a.h),a.a+=4}catch(c){_.km()}},RR=function(a,b){try{a.f.setInt16(a.a,
|
|
2
|
+
b,a.h),a.a+=2}catch(c){_.km()}},SR=function(a,b){if(void 0!==b){var c=new Uint8Array(b);const d=Math.min(a.length,b);let e=0;for(;e<d;++e)c[e]=a.charCodeAt(e);for(;e<b;e++)c[e]=0;return c}b=new Uint8Array(a.length);for(c=0;c<a.length;++c)b[c]=a.charCodeAt(c);return b},TR=function(a){const b=a.split("/");return b[b.length-1].toLowerCase().match("manifest(\\(.+\\))?")?a:`${a}/Manifest`},UR=function(a,b,c,d){c=b.Of[c];b=b.Di;a=a.replace("Manifest","");b=b.replace("{bitrate}",String(d.bitrate)).replace("{Bitrate}",
|
|
3
|
+
String(d.bitrate)).replace("{start time}",String(c.t)).replace("{start_time}",String(c.t));return _.gD([a],[b])[0]},VR=function(a,b){if(a.type!==b.type)return!1;let c=[];a.type===_.w?c=["maxWidth","maxHeight","bitrate",LR,"fourCC"]:a.type===_.p&&(c=["bitrate",LR,"channels","bitsPerSample","samplingRate","fourCC"]);return _.uh(a,b,c,["id","segmentIndex"])},WR=function(a,b,c){const d=c.Kd.split("00000001");a={id:1,type:c.type,duration:a/b,timescale:b,eb:null,fc:null,width:NaN,height:NaN,cc:null,xd:NaN,
|
|
4
|
+
sampleSize:NaN,channelCount:NaN};switch(c.type){case _.w:a.eb=[_.Zl(d[1])];a.fc=[_.Zl(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.p:a.cc=_.Zl(c.Kd),a.sampleSize=c.Tg||16,a.xd=c.xd,a.channelCount=c.Ff}return a},YR=function(a,b){return a.filter(c=>c.type===b)},ZR=function(a,b){a=a.exec(b);return null==a||""===a[0]?null:(Number(a[4])||0)/1E3+(Number(a[3])||0)+60*(Number(a[2])||0)+3600*(Number(a[1])||0)},fS=function(a,b,c){var d=null;if($R.test(a)){{a=$R.exec(a);d=Number(a[1]);const e=
|
|
5
|
+
Number(a[2]);let f=Number(a[3]),g=Number(a[4]);g+=(Number(a[5])||0)/c.f;f+=g/c.frameRate;d=f+60*e+3600*d}}else aS.test(a)?d=ZR(aS,a):bS.test(a)?d=ZR(bS,a):cS.test(a)?(a=cS.exec(a),d=Number(a[1])/c.frameRate):dS.test(a)?(a=dS.exec(a),d=Number(a[1])/c.a):eS.test(a)&&(d=ZR(eS,a));c=d;d=c+b;b=Math.floor(d/3600);c=Math.floor((d-3600*b)/60);a=Math.floor(d-3600*b-60*c);d-=a;10>b&&(b="0"+b);10>c&&(c="0"+c);10>a&&(a="0"+a);0===d?d="000":d=Math.round(1E3*d);return b+":"+c+":"+a+"."+d},gS=function(a){let b=
|
|
6
|
+
0;for(let c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.Fm(b)},nS=function(a,b,c){a:{var d=[_.Jd,_.Hd];for(e of d)if((d=c.Pd(e))&&d.keyId){var e=d.keyId;break a}_.C(KR,"Could not get default Key ID for DRM init data!");e=null}c=new hS("xxxx");a.type===_.w?c=new iS(a.width,a.height):c=new jS(a.channelCount,a.sampleSize,a.xd);a=new kS;a.f=1;a.h=8;a.l=e||"00000000000000000000000000000000";a=(new hS("schi")).append([a]);b=(new hS(_.Wf)).append([new lS(b),new mS(_.kd,65536),a]);c.append([b]);return c},
|
|
7
|
+
QS=function(a,b){var c=b.Sd(),d=new oS(a.timescale,a.duration,a.id),e=(new pS).append([new qS(a.id)]),f=new rS(a.id,a.duration,a.timescale,a.width,a.height),g=new sS(a.timescale,a.duration);const h=new tS(a.type);var k=null,l=new uS;l.entries=[new vS];var m=new wS;switch(a.type){case _.w:k=new xS(a.eb,a.fc);c?(a=nS(a,"avc1",b),a.append([k]),m.entries=[a]):(a=(new yS(a.width,a.height)).append([k]),m.entries=[a]);k=new zS;break;case _.p:k=new AS(a.cc),c?(a=nS(a,"mp4a",b),a.append([k]),m.entries=[a]):
|
|
8
|
+
(a=(new BS(a.channelCount,a.sampleSize,a.xd)).append([k]),m.entries=[a]),k=new CS}m=(new DS).append([m,new ES,new FS,new GS,new HS]);l=(new IS).append([l]);l=(new JS).append([k,l,m]);g=(new KS).append([g,h,l]);f=(new LS).append([f,g]);d=(new MS).append([d,f,e]);e=new NS("dash",0,["iso6","mp41","avc1"]);c&&(c=b.Pd(_.Hd),b=b.Pd(_.Jd),c&&d.append([new OS("pssh",c.initData,8)]),b&&d.append([new OS("pssh",b.initData,8)]),c||b||_.C(KR,"Could not get PSSH init data!"));b=new PS([e,d]);return _.K(b.write())},
|
|
9
|
+
$S=function(a,b){let c,d,e,f,g,h;(new _.Dm).N("moof",_.wm).ea("mfhd",k=>{{const l=new RS;l.f=_.P(k.reader);c=l}}).N("traf",_.wm).ea("tfhd",k=>{{const l=k.reader.Sa();if(null===k.flags)throw new _.I(_.F,3,3019,JR);const m=new SS(k.version||0,k.flags||0);m.f=_.P(k.reader);0<l-k.reader.getPosition()&&k.flags&1&&(m.h=_.rm(k.reader));0<l-k.reader.getPosition()&&k.flags&2&&(m.A=_.P(k.reader));0<l-k.reader.getPosition()&&k.flags&8&&(m.j=_.P(k.reader));0<l-k.reader.getPosition()&&k.flags&16&&(m.o=_.P(k.reader));
|
|
10
|
+
0<l-k.reader.getPosition()&&k.flags&32&&(m.l=_.P(k.reader));d=m}}).ea("trun",k=>{{var l=k.reader.Sa();if(null===k.flags)throw new _.I(_.F,3,3019,JR);const m=new TS(k.version||0,k.flags||0);m.f=_.P(k.reader);0<l-k.reader.getPosition()&&k.flags&1&&(m.j=_.qm(k.reader));0<l-k.reader.getPosition()&&k.flags&4&&(m.l=_.P(k.reader));if(0<l-k.reader.getPosition())for(l=0;l<m.f;l++)k.flags&256&&m.o.push(_.P(k.reader)),k.flags&512&&m.sampleSize.push(_.P(k.reader)),k.flags&1024&&m.A.push(_.P(k.reader)),k.flags&
|
|
11
|
+
2048&&(0===k.version?m.h.push(_.P(k.reader)):m.h.push(_.qm(k.reader)));e=m}}).ea("sdtp",k=>{{const l=_.tm(k.reader,k.reader.Sa());f=new US("sdtp",k.version||0,k.flags||0,l,0)}}).N("uuid",k=>{var l=_.tm(k.reader,16);if(_.am(l,VS)){l=_.P(k.reader);k.version=l>>>24;k.flags=l&16777215;l=new WS(k.version,k.flags);l.h=_.P(k.reader);k.flags&1&&(l.j=_.om(k.reader));for(let m=0;m<l.h;m++){const n={$f:_.tm(k.reader,8),Vc:0,df:[]};if(k.flags&2){n.Vc=_.pm(k.reader);for(let r=0;r<n.Vc;r++){const u={Cf:0,Df:0};
|
|
12
|
+
u.Cf=_.pm(k.reader);u.Df=_.P(k.reader);n.df.push(u)}}l.f.push(n)}g=l}}).N(_.Ie,k=>{{const l=new XS;0<k.reader.Sa()?l.f=_.tm(k.reader,k.reader.Sa()):(_.C(KR,"mdat box is empty!"),l.f=new Uint8Array(0));h=l}}).parse(a,!1);if(!h)return null;a=(new YS).append([d,e]);f&&a.append([f]);b.Sd()&&g&&a.append([g]);b=(new ZS).append([c,a]);return new PS([b,h])},eT=function(a,b,c,d){var e=d.Sd(),f=parseInt(c*b,10);b=a.data||new ArrayBuffer(0);var g=$S(b,d);if(null===g)return a.request.contentType===_.H?a.data:
|
|
13
|
+
g;d=g.get(_.Ie);if(a.request.contentType===_.H){e=d.f.buffer;if(c){e=_.lj(e);if((e=(new DOMParser).parseFromString(e,_.ig))&&"tt"===e.documentElement.tagName.toLowerCase())var h=e.documentElement;if(h&&(d=new aT(h.getAttribute("ttp:frameRate"),h.getAttribute("ttp:subFrameRate"),h.getAttribute("ttp:frameRateMultiplier"),h.getAttribute("ttp:tickRate")),h=h.getElementsByTagName("body")[0])){f=h.getElementsByTagName("p");for(let u=0,v=f.length;u<v;u++){h=f[u];a=c;b=d;g=["begin",_.ie];for(let y=0,A=g.length;y<
|
|
14
|
+
A;y++){b:{var k=h;var l=g[y],m=new RegExp("\\w+:"+l),n=0;if(k.hasAttribute(l)){k=k.getAttribute(l);break b}l=k.attributes;const E=l.length;for(;n<E;n++){var r=l[n].name;if(r=r.match(m)){k=k.getAttribute(r[0]);break b}}k=null}h.setAttribute(g[y],fS(k||"",a,b))}}}e=(new XMLSerializer).serializeToString(e);c=_.mj(e).buffer}else c=e;return c}h=new ZS;a=g.get("mfhd");b=new YS;k=g.get("tfhd");m=new bT(1,f);f=g.get("trun");n=g.get("sdtp");c=g.get("senc");k.f=1;k.flags&=16777214;k.flags|=131072;b.append([k,
|
|
15
|
+
m,f]);n&&b.append([n]);if(e){g=0;k=[];if(c.flags&2)for(k=[],m=0;m<c.h;m++)k.push(10+6*c.f[m].Vc);else g=8;b.append([c,new cT,new dT(g,k,c.h)])}h.append([a,b]);f.flags|=1;f.j=h.a()+8;d=new PS([h,d]);h=d.write();e&&(e=d.get("saio"),d=d.f,e.offset[0]=c.start+16,d.seek(e.start),e.write(d),h=d.buffer);return h},fT=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,
|
|
16
|
+
periodId:null}},gT=function(a){return{initData:_.UC(_.zn(a)),initDataType:_.kd,keyId:a,periodId:null}},hT=function(a,b,c){a=_.In(a);c&&a.version!==c&&(a=_.WC(a,c));return{initData:_.UC(a),initDataType:_.kd,keyId:b,periodId:null}},iT=function(a,b){return _.x(function*(){var c=_.Bj(b);c.timeout=a.f.attemptParameters.timeout;c.maxAttempts=Math.max(a.f.attemptParameters.maxAttempts,b.length);c.baseDelay=a.f.attemptParameters.baseDelay;c.backoffFactor=a.f.attemptParameters.backoffFactor;c.fuzzFactor=a.f.attemptParameters.fuzzFactor;
|
|
17
|
+
c.type=1;c=yield a.D.networkingEngine.fetch(c).V;a.o=c.uri;return c})},qT=function(a,b){const c=_.Dn;let d=null;try{const ib=_.lj(b);d=c.j(ib,_.Hb)}catch(ib){}if(!d)throw a.g.error("Unable to parse manifest"),new _.I(_.F,4,4033,a.o);const e=+jT(a,d,"MajorVersion"),f=+jT(a,d,"MinorVersion"),g=+d.getAttribute("TimeScale")||1E7;let h=+jT(a,d,"Duration");const k="TRUE"===d.getAttribute("IsLive"),l=+d.getAttribute("LookAheadCount"),m=+d.getAttribute("DVRWindowLength")||Infinity,n=c.a(d,"Protection")[0];
|
|
18
|
+
if(!1===/^[2].[0-2]$/.test(""+e+"."+f))throw a.g.error("Smooth Streaming version must be 2.0, 2.1 or 2.2"),new _.I(_.F,4,4036,a.o);k?(kT(a,lT),a.B=typeof a.f.liveRefreshPeriod===_.t?1E3*a.f.liveRefreshPeriod:Math.min(1E3*a.I,1E4),h=Infinity):kT(a,mT);a.a={startTime:0,delay:0,duration:h/g,ue:m/g,od:0};if(n){{var r=a.f.playreadyVersion;const ib=_.Dn,va=[],xb=ib.a(n,"ProtectionHeader")[0],Bc=_.Yl(ib.f(xb)||""),ic=_.In(Bc).a;va.push(fT(_.Jd,gT(ic),[ic]));va.push(fT(_.Hd,hT(Bc,ic,r),[ic]));var u=va}a.w=
|
|
19
|
+
u}{const ib=[],va=_.Dn.a(d,"StreamIndex");if(!va.length)throw a.g.error("No streams found!"),new _.I(_.F,4,4034,a.o);for(let xb=0;xb<va.length;xb++){{var v=a,y=va[xb];const Bc=jT(v,y,"Type"),ic=+y.getAttribute("Chunks"),Vh=y.getAttribute("Subtype")||"",xe=y.getAttribute("Language")||_.tg,ye=_.Qi(xe),Wh=y.getAttribute("Name")||"",uf=+y.getAttribute(_.eb),wg=+y.getAttribute(_.db),Os=jT(v,y,"Url"),Pm=+y.getAttribute("TimeScale")||null;{const gd=[],Ej=_.Dn.a(y,_.zb);for(let ze=0;ze<Ej.length;ze++){{let hd,
|
|
20
|
+
Na,Zd;var A=v,E=Ej[ze],G=Bc;const Fj=+E.getAttribute("Index"),xg=+jT(A,E,"Bitrate");let Cc=NaN,yg=NaN,Qm=NaN,Ps=NaN,uG=NaN,vG=NaN,wG=NaN;const xG=E.getAttribute("FourCC")||"";switch(G){case _.w:Cc=+jT(A,E,_.db);yg=+jT(A,E,_.eb);break;case _.p:Ps=+E.getAttribute("Channels")||2,Qm=+jT(A,E,"SamplingRate"),vG=+jT(A,E,"AudioTag"),uG=+jT(A,E,"BitsPerSample"),wG=+jT(A,E,"PacketSize")}let Qs=String(E.getAttribute("CodecPrivateData"));if(G===_.p&&!Qs){{var X=Ps;const yG={96E3:0,88200:1,64E3:2,48E3:3,44100:4,
|
|
21
|
+
32E3:5,24E3:6,22050:7,16E3:8,12E3:9,11025:10,8E3:11,7350:12},Rm=yG[Qm];if("AACH"===xG){Na=new Uint8Array(4);const zG=yG[2*Qm];Na[0]=40|Rm>>1;Na[1]=Rm<<7|X<<3|zG>>1;Na[2]=zG<<7|8;Na[3]=0;hd=new Uint16Array(2);hd[0]=(Na[0]<<8)+Na[1];hd[1]=(Na[2]<<8)+Na[3];Zd=hd[0].toString(16)+hd[1].toString(16)}else Na=new Uint8Array(2),Na[0]=16|Rm>>1,Na[1]=Rm<<7|X<<3,hd=new Uint16Array(1),hd[0]=(Na[0]<<8)+Na[1],Zd=hd[0].toString(16);Qs=Zd.toUpperCase()}}var dd={id:A.U++,type:G,index:Fj,bitrate:xg,Kd:Qs,maxHeight:Cc,
|
|
22
|
+
maxWidth:yg,xd:Qm,Ff:Ps,Ii:vG,Tg:uG,Vi:wG,nh:xG,segmentIndex:null}}gd.push(dd)}var ec=gd}{const gd=[],Ej=_.Dn.a(y,"c");for(let ze=0;ze<Ej.length;ze++){const hd=Ej[ze];let Na=parseInt(hd.getAttribute("t"),10),Zd=parseInt(hd.getAttribute("d"),10),Fj=parseInt(hd.getAttribute("r"),10),xg=0;if(isNaN(Na)&&isNaN(Zd))throw v.g.error("Either one or both FragmentDuration and FragmentTime field MUST be present in StreamFragmentElement"),new _.I(_.F,4,4037,v.o);0===ze&&isNaN(Na)&&(xg=Na=0);if(0<ze){const Cc=
|
|
23
|
+
gd[gd.length-1];xg=Cc.n+1;Cc.d||(Cc.d=Na-Cc.t);Na||(Na=Cc.t+Cc.d);Zd||(Zd=Na-Cc.t)}gd.push({n:xg,d:Zd,t:Na});if(Fj){Fj--;for(let Cc=0;Cc<Fj;Cc++){const yg=gd[gd.length-1];xg=yg.n+1;Na=yg.t+yg.d;Zd=yg.d;gd.push({n:xg,d:Zd,t:Na})}}}v.F()||gd.length===ic||v.g.warn("Number of fragments ("+ic+") differs from number of chunks ("+gd.length+").");var Nb=gd}var Yd={type:Bc,Mi:ic,ri:Vh,language:ye,Qc:xe,name:Wh,maxWidth:uf,maxHeight:wg,Di:Os,tracks:ec,Of:Nb,timescale:Pm}}ib.push(Yd)}var Ob=ib}const fc={Ui:e,
|
|
24
|
+
fg:f,timescale:g,duration:h,isLive:k,Ti:l,ue:m,Ae:!1,streams:Ob};if(a.j&&a.A)return nT(a,fc),Promise.resolve();a.H.clear();{const ib=fc.timescale,va=fc.duration,xb=YR(fc.streams,_.p),Bc=YR(fc.streams,_.w),ic=YR(fc.streams,_.H),Vh=[];let xe=oT(a,va,ib,xb),ye=oT(a,va,ib,Bc);const Wh=oT(a,va,ib,ic);xe.length||(xe=[null]);ye.length||(ye=[null]);for(let uf=0;uf<ye.length;uf++)for(let wg=0;wg<xe.length;wg++)Vh.push(pT(a,ye[uf],xe[wg]));var gc={id:"ID",configurationId:void 0,startTime:0,endTime:va,variants:Vh,
|
|
25
|
+
textStreams:Wh,thumbStreams:[]}}{var Fb=fc.streams;let ib=a.a.startTime,va=a.a.delay;const xb=a.J;let Bc=Math.min(a.a.duration||Infinity,xb);const ic=a.F(),Vh=a.a.ue,xe=a.a.od,ye=a.I,Wh=isFinite(a.G)?a.G:0;if(ic)Bc=Infinity,ib=Date.now()/1E3-xe,a.a.startTime=ib,va=3*ye;else{const wg=isFinite(xb)?xb:a.a.duration;for(const Os of Fb)for(const Pm of Os.tracks)Pm.segmentIndex.offset(-Wh),_.LD(Pm.segmentIndex,wg)}const uf=a.f.timeline||{};uf.type=void 0;a.C=new _.iK(uf,ib,va,!ic,!0);a.C.f=Bc;_.ZD(a.C,ye);
|
|
26
|
+
a.C.A=Vh;ic||a.C.offset(-Wh)}a.D.filterAllPeriods([gc]);a.j={presentationTimeline:a.C,periods:[gc],minBufferTime:0,cues:[]};Promise.resolve();a.L||(a.D.networkingEngine.Ec(a.M),a.L=!0);a.A=fc;return Promise.resolve()},rT=function(a,b){null!=a.B&&null!=b&&(a.l=window.setTimeout(a.Xb.bind(a),b))},jT=function(a,b,c){if(b=b.getAttribute(c))return b;a.g.error("required attribute not provided: "+c);throw new _.I(_.F,4,4038,a.o,c);},kT=function(a,b){const c=b===mT;a.j&&a.j.presentationTimeline&&_.UD(a.j.presentationTimeline,
|
|
27
|
+
c);c&&null!=a.l&&(window.clearTimeout(a.l),a.l=null,a.B=null);a.O=b},nT=function(a,b){for(let e=0;e<a.A.streams.length;e++){const f=b.streams[e];for(const g of a.A.streams[e].tracks){var c=f.tracks.find(h=>h.type===g.type&&h.bitrate===g.bitrate);if(c){VR(g,c)||a.g.warn("The current stream is updated with a stream that seems to have different base properties!");var d=sT(a,a.A.timescale,f,c);c=g.segmentIndex;_.kE(c,d);(d=a.a.ue)&&_.lE(c,_.iE(c)-d).forEach(h=>{h.ab().forEach(k=>{a.H.delete(k)})})}else a.g.warn(`Cannot find satisfying update for ${g.type} `+
|
|
28
|
+
`track with bitrate ${g.bitrate}. Skipping update.`)}}},sT=function(a,b,c,d){let e=0;const f=[],g=c.timescale||b;c.Of.forEach((h,k)=>{const l=h.d/g;0===k?(h=h.t/g,a.G=Math.min(a.G,h)):h=f[k-1].endTime;const m=h+l,n=UR(a.o,c,k,d);a.I=Math.max(a.I,l);f.push(new _.jE(k,h,m,()=>[n],0,null,0,null,!0,g));a.H.set(n,h);e+=l});if(c.type===_.w||c.type===_.p)b=f[f.length-1],a.J=Math.min(a.J,e),0===a.a.od?a.a.od=b.endTime:a.a.od=Math.min(a.a.od,b.endTime);return f},oT=function(a,b,c,d){let e=[];for(let f=0;f<
|
|
29
|
+
d.length;f++){const g=d[f].tracks.map(h=>{{var k=d[f],l=sT(a,c,k,h);const X=new _.jK(l);var m=null;k.type!==_.H&&(m=tT(a,b,c,k,h));h.segmentIndex=X;l=_.fK++;var n=Promise.resolve.bind(Promise),r=X.f.bind(X),u=X.get.bind(X),v=X.h.bind(X),y=X.getDuration.bind(X),A=uT[k.type];var E="";switch(k.type){case _.w:E=h.Kd;var G=/00000001[0-9]7/.exec(E);E="avc1."+(G&&G[0]?E.substr(E.indexOf(G[0])+10,6):"42c00c");a.g.debug("VIDEO CODECS: ",E);break;case _.p:E=h.Kd,G=2,"AACH"===h.nh?G=5:E&&(G=(parseInt(E.substr(0,
|
|
30
|
+
2),16)&248)>>3),E="mp4a.40."+G,a.g.debug("AUDIO CODECS: ",E)}G=k.type===_.H?vT[k.ri]:void 0;h={id:l,originalId:null,Yi:null,createSegmentIndex:n,findSegmentPosition:r,getSegmentReference:u,adjustSegmentDurations:v,getDuration:y,segmentIndex:X,segmentLookupStrategy:_.BC,initSegmentReference:m,mimeType:A,codecs:E,frameRate:void 0,bandwidth:h.bitrate,width:h.maxWidth||void 0,height:h.maxHeight||void 0,kind:G,encrypted:a.K(),keyId:null,language:k.language,originalLanguage:k.Qc,label:k.name,type:k.type,
|
|
31
|
+
primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:h.Ff||null,spatialAudio:!1,closedCaptions:null}}return h});e=e.concat(g)}return e},pT=function(a,b,c){const d=(c?c.bandwidth:0)+(b?b.bandwidth:0),e=c?c.language:_.tg;return c||b?{id:a.h++,language:e,primary:!1,audio:c,video:b,bandwidth:d,drmInfos:a.w,allowedByApplication:!0,allowedByKeySystem:!0}:null},tT=function(a,b,c,d,e){b=WR(b,d.timescale||c,e);c={isLive:a.F.bind(a),Sd:a.K.bind(a),th:()=>1,Pd:a.R.bind(a)};d=new Uint8Array(0);
|
|
32
|
+
try{d=QS(b,c)}catch(g){throw a.g.error("Failed to generate initialization segment."),new _.I(_.F,3,4035,g);}const f="data:text/plain;base64,"+_.Xl(d);return new _.eK(()=>[f],0,null,null,!0)},hS=class{constructor(a){this.type=a;this.size=this.start=0;this.parent=null;this.w=!1;this.entries=[];this.children=[]}append(a=[]){for(let b=0;b<a.length;b++)this.children.push(a[b]),a[b].parent=this;return this}get(a){if(this.type===a)return this;for(let b=0;b<this.children.length;b++){if(this.children[b].type===
|
|
33
|
+
a)return this.children[b];{const c=this.children[b].get(a);if(c)return c}}return null}a(){const a=Math.pow(2,32)-1;let b;b=4+this.type.length;"uuid"===this.type&&(b+=16);if(0<this.children.length)for(let c=0;c<this.children.length;c++)b+=this.children[c].a();this.size>a&&(b+=8);return b}write(a){var b=Math.pow(2,32)-1;this.start=a.getPosition();this.size=this.a();this.size>b?_.O(a,1):_.O(a,this.size);_.lm(a,SR(this.type));this.size>b&&MR(a,this.size);"uuid"===this.type&&_.lm(a,null);if(0<this.children.length&&
|
|
34
|
+
!this.w)for(b=0;b<this.children.length;b++)this.children[b].write(a),this.children[b].a(),a.getPosition()}},wT=class extends hS{constructor(a,b,c){super(a);this.version=b;this.flags=c}a(){return 4+super.a()}write(a){super.write(a);NR(a,this.version);OR(a,this.flags)}},OS=class extends hS{constructor(a,b,c){super(a);this.f=b;this.offset=c}a(){return this.f.byteLength+super.a()-this.offset}write(a){super.write(a);_.lm(a,this.f,this.offset);a.getPosition()}},US=class extends wT{constructor(a,b,c,d,e){super(a,
|
|
35
|
+
b,c);this.f=d;this.offset=e}a(){return this.f.byteLength+super.a()-this.offset}write(a){super.write(a);_.lm(a,this.f,this.offset);a.getPosition()}},NS=class extends hS{constructor(a,b,c){super("ftyp");this.h=a;this.fg=b;this.f=c}a(){let a=this.h.length;a=a+4+this.f.join("").length;return a+super.a()}write(a){super.write(a);_.lm(a,SR(this.h));_.O(a,this.fg);_.lm(a,SR(this.f.join("")));a.getPosition()}},MS=class extends hS{constructor(){super(_.Oe)}},LS=class extends hS{constructor(){super(_.qg)}},
|
|
36
|
+
oS=class extends wT{constructor(a,b,c){super("mvhd",1,0);this.timescale=a;this.duration=b;this.volume=256;this.h=c+1;this.f=[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0]}a(){let a=0;a=1===this.version?a+28:a+16;a=a+44+this.f.length;return a+=super.a()}write(a){super.write(a);1===this.version?(MR(a,0),MR(a,0),_.O(a,this.timescale),MR(a,this.duration*this.timescale)):(_.O(a,0),_.O(a,0),_.O(a,this.timescale),_.O(a,this.duration*this.timescale));_.O(a,65536);PR(a,this.volume);
|
|
37
|
+
PR(a,0);_.O(a,0);_.O(a,0);for(let b=0;b<this.f.length;b++)NR(a,this.f[b]);_.O(a,0);_.O(a,0);_.O(a,0);_.O(a,0);_.O(a,0);_.O(a,0);_.O(a,this.h);a.getPosition()}},pS=class extends hS{constructor(){super("mvex")}},qS=class extends wT{constructor(a){super("trex",0,0);this.f=a}a(){return 20+super.a()}write(a){super.write(a);_.O(a,this.f);_.O(a,1);_.O(a,0);_.O(a,0);_.O(a,0);a.getPosition()}},rS=class extends wT{constructor(a,b,c,d,e){super("tkhd",1,7);this.h=a;this.duration=b;this.timescale=c;this.width=
|
|
38
|
+
d;this.height=e;this.volume=1;this.f=[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0]}a(){let a=0;a=1===this.version?a+32:a+20;a=a+24+this.f.length;return a+super.a()}write(a){super.write(a);1===this.version?(MR(a,0),MR(a,0),_.O(a,this.h),_.O(a,0),MR(a,this.duration*this.timescale)):(_.O(a,0),_.O(a,0),_.O(a,this.h),_.O(a,0),_.O(a,this.duration*this.timescale));_.O(a,0);_.O(a,0);PR(a,0);PR(a,0);PR(a,this.volume);PR(a,0);for(let b=0;b<this.f.length;b++)NR(a,this.f[b]);PR(a,
|
|
39
|
+
this.width);PR(a,0);PR(a,this.height);PR(a,0);a.getPosition()}},sS=class extends wT{constructor(a,b){super("mdhd",1,0);this.timescale=a;this.duration=b;this.language=21956}a(){let a=0;a=1===this.version?a+28:a+16;return a+4+super.a()}write(a){super.write(a);1===this.version?(MR(a,0),MR(a,0),_.O(a,this.timescale),MR(a,this.duration*this.timescale)):(_.O(a,0),_.O(a,0),_.O(a,this.timescale),_.O(a,this.duration*this.timescale));PR(a,this.language);PR(a,0);a.getPosition()}},tS=class extends wT{constructor(a){super("hdlr",
|
|
40
|
+
0,0);this.f=a}a(){return 33+super.a()}write(a){super.write(a);_.O(a,0);this.f===_.w?_.lm(a,SR("vide")):_.lm(a,SR("soun"));_.O(a,0);_.O(a,0);_.O(a,0);this.f===_.w?_.lm(a,SR("VideoHandler\x00")):_.lm(a,SR("SoundHandler\x00"));a.getPosition()}},zS=class extends wT{constructor(){super("vmhd",0,1);this.f=new Uint8Array([0,0,0,0,0,0])}a(){return 2+this.f.byteLength+super.a()}write(a){super.write(a);PR(a,0);_.lm(a,this.f);a.getPosition()}},xT=class extends hS{constructor(a){super(a);this.w=!0}a(){return 8+
|
|
41
|
+
super.a()}write(a){super.write(a);_.O(a,0);PR(a,0);PR(a,1)}},yT=class extends xT{constructor(a){super(a);this.height=this.width=0;this.depth=24}a(){return 70+super.a()}write(a){super.write(a);PR(a,0);PR(a,0);_.O(a,0);_.O(a,0);_.O(a,0);PR(a,this.width);PR(a,this.height);_.O(a,4718592);_.O(a,4718592);_.O(a,0);PR(a,1);NR(a,10);_.lm(a,SR("AVC Coding",31));PR(a,this.depth);RR(a,-1)}},zT=class extends xT{constructor(a,b,c,d){super(a);this.channelCount=b;this.sampleSize=c;this.sampleRate=d}a(){return 20+
|
|
42
|
+
super.a()}write(a){super.write(a);_.O(a,0);_.O(a,0);PR(a,this.channelCount);PR(a,this.sampleSize);RR(a,0);PR(a,0);PR(a,this.sampleRate);PR(a,0)}},yS=class extends yT{constructor(a,b){super("avc1");this.width=a;this.height=b}write(a){super.write(a);for(let b=0;b<this.children.length;b++)this.children[b].write(a);a.getPosition()}},iS=class extends yS{constructor(a,b){super(a,b);this.type="encv"}},BS=class extends zT{constructor(a,b,c){super("mp4a",a,b,c)}write(a){super.write(a);for(let b=0;b<this.children.length;b++)this.children[b].write(a);
|
|
43
|
+
a.getPosition()}},jS=class extends BS{constructor(a,b,c){super(a,b,c);this.type="enca"}},xS=class extends hS{constructor(a,b){super("avcC");this.eb=a;this.fc=b;this.version=1;this.f=this.eb[0][1];this.h=this.eb[0][2];this.level=this.eb[0][3]}a(){let a=7;for(var b=0;b<this.eb.length;b++)a+=2,a+=this.eb[b].byteLength;for(b=0;b<this.eb.length;b++)a+=2,a+=this.fc[b].byteLength;return a+super.a()}write(a){super.write(a);NR(a,this.version);NR(a,this.f);NR(a,this.h);NR(a,this.level);NR(a,255);NR(a,224|this.eb.length);
|
|
44
|
+
for(var b=0;b<this.eb.length;b++)PR(a,this.eb[b].length),_.lm(a,this.eb[b]);NR(a,this.fc.length);for(b=0;b<this.fc.length;b++)PR(a,this.fc[b].length),_.lm(a,this.fc[b]);a.getPosition()}},AS=class extends wT{constructor(a){super("esds",0,0);this.cc=a}a(){return 22+(this.cc.byteLength+3)+super.a()}write(a){super.write(a);NR(a,3);NR(a,23+this.cc.byteLength);PR(a,1);NR(a,0);NR(a,4);NR(a,15+this.cc.byteLength);NR(a,64);NR(a,21);OR(a,0);_.O(a,0);_.O(a,0);NR(a,5);NR(a,this.cc.byteLength);_.lm(a,this.cc);
|
|
45
|
+
_.lm(a,new Uint8Array([6,1,2]));a.getPosition()}},vS=class extends wT{constructor(a=""){super("url ",0,1);this.location=a}a(){return this.location.length+super.a()}write(a){super.write(a);0<this.location.length&&_.lm(a,SR(this.location));a.getPosition()}},uS=class extends wT{constructor(){super("dref",0,0)}a(){let a=4;for(let b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+super.a()}write(a){super.write(a);_.O(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);
|
|
46
|
+
a.getPosition()}},DS=class extends hS{constructor(){super(_.bg)}},wS=class extends wT{constructor(){super(_.dg,0,0)}a(){let a=4;for(let b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+super.a()}write(a){super.write(a);_.O(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},ES=class extends wT{constructor(){super("stts",0,0)}a(){let a=4;for(let b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+super.a()}write(a){super.write(a);
|
|
47
|
+
_.O(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},FS=class extends wT{constructor(){super("stsc",0,0)}a(){let a=4;for(let b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+super.a()}write(a){super.write(a);_.O(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},HS=class extends wT{constructor(){super("stco",0,0)}a(){let a=4;for(let b=0;b<this.entries.length;b++)a+=this.entries[b].a();
|
|
48
|
+
return a+super.a()}write(a){super.write(a);_.O(a,this.entries.length);for(let b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()}},GS=class extends wT{constructor(){super("stsz",0,0)}a(){return 8+super.a()}write(a){super.write(a);_.O(a,0);_.O(a,0);a.getPosition()}},CS=class extends wT{constructor(){super("smhd",0,0)}a(){return 4+super.a()}write(a){super.write(a);RR(a,0);PR(a,0);a.getPosition()}},IS=class extends hS{constructor(){super("dinf")}},JS=class extends hS{constructor(){super(_.Ne)}},
|
|
49
|
+
KS=class extends hS{constructor(){super(_.Je)}},bT=class extends wT{constructor(a,b){super("tfdt",a,0);this.baseMediaDecodeTime=b}a(){let a=0;a=1===this.version?a+8:a+4;return a+super.a()}write(a){super.write(a);1===this.version?MR(a,this.baseMediaDecodeTime):_.O(a,this.baseMediaDecodeTime);a.getPosition()}},RS=class extends wT{constructor(){super("mfhd",0,0);this.f=0}a(){return 4+super.a()}write(a){super.write(a);_.O(a,this.f);a.getPosition()}},TS=class extends wT{constructor(a,b){super("trun",a,
|
|
50
|
+
b);this.l=this.j=this.f=0;this.o=[];this.sampleSize=[];this.A=[];this.h=[]}a(){let a=4;this.flags&AT&&(a+=4);this.flags&BT&&(a+=4);for(let b=0;b<this.f;b++)this.flags&CT&&(a+=4),this.flags&DT&&(a+=4),this.flags&ET&&(a+=4),this.flags&FT&&(a+=4);return a+super.a()}write(a){super.write(a);_.O(a,this.f);this.flags&AT&&(a.getPosition(),QR(a,this.j));this.flags&BT&&_.O(a,this.l);for(let b=0;b<this.f;b++)this.flags&CT&&_.O(a,this.o[b]),this.flags&DT&&_.O(a,this.sampleSize[b]),this.flags&ET&&_.O(a,this.A[b]),
|
|
51
|
+
this.flags&FT&&(0===this.version?_.O(a,this.h[b]):QR(a,this.h[b]));a.getPosition()}},AT=1,BT=4,CT=256,DT=512,ET=1024,FT=2048,SS=class extends wT{constructor(a,b){super("tfhd",a,b);this.f=255;this.l=this.o=this.j=this.A=this.h=0}a(){let a=4;this.flags>&&(a+=8);this.flags&HT&&(a+=4);this.flags&IT&&(a+=4);this.flags&JT&&(a+=4);this.flags&KT&&(a+=4);return a+super.a()}write(a){super.write(a);_.O(a,this.f);this.flags>&&MR(a,this.h);this.flags&HT&&_.O(a,this.A);this.flags&IT&&_.O(a,this.j);this.flags&
|
|
52
|
+
JT&&_.O(a,this.o);this.flags&KT&&_.O(a,this.l);a.getPosition()}},GT=1,HT=2,IT=8,JT=16,KT=32,YS=class extends hS{constructor(){super("traf")}},ZS=class extends hS{constructor(){super("moof")}},XS=class extends hS{constructor(){super(_.Ie);this.f=new Uint8Array(0)}a(){return this.f.byteLength+super.a()}write(a){super.write(a);0<this.f.byteLength&&_.lm(a,this.f)}},kS=class extends wT{constructor(){super("tenc",0,0);this.f=1;this.h=8;this.l="";this.j=[]}a(){let a;a=20;1===this.f&&0===this.h&&(a=a+1+this.j.length);
|
|
53
|
+
return a+super.a()}write(a){super.write(a);NR(a,0);0===this.version?NR(a,0):NR(a,0);NR(a,this.f);NR(a,this.h);_.lm(a,_.Zl(this.l));if(1===this.f&&0===this.h){NR(a,0);for(let b=0;b<this.j.length;b++)NR(a,this.j[b])}a.getPosition()}},mS=class extends wT{constructor(a,b){super("schm",0,0);this.f=a;this.h=b;this.Zb=""}a(){let a=8;this.flags&1&&(a+=SR(this.Zb).byteLength);return a+super.a()}write(a){super.write(a);_.lm(a,SR(this.f));_.O(a,this.h);this.flags&1&&_.lm(a,SR(this.Zb));a.getPosition()}},lS=
|
|
54
|
+
class extends hS{constructor(a){super("frma");this.f=a}a(){return SR(this.f).byteLength+super.a()}write(a){super.write(a);_.lm(a,SR(this.f));a.getPosition()}},cT=class extends wT{constructor(){super("saio",0,0);this.offset=[0]}a(){let a=0;this.flags&1&&(a+=8);a+=4;for(let b=0;1>b;b++)a=0===this.version?a+4:a+8;return a+super.a()}write(a){super.write(a);this.flags&1&&(_.O(a,0),_.O(a,0));_.O(a,1);for(let b=0;1>b;b++)0===this.version?_.O(a,this.offset[b]):MR(a,this.offset[b]);a.getPosition()}},dT=class extends wT{constructor(a,
|
|
55
|
+
b,c){super("saiz",0,0);this.f=a;this.j=b;this.h=c}a(){let a=0;this.flags&1&&(a+=8);a+=5;0===this.f&&(a+=this.j.length);return a+super.a()}write(a){super.write(a);this.flags&1&&(_.O(a,0),_.O(a,0));NR(a,this.f);_.O(a,this.h);if(0===this.f)for(let b=0;b<this.h;b++)NR(a,this.j[b]);a.getPosition()}},WS=class extends wT{constructor(a,b){super("senc",a,b);this.h=0;this.j=8;this.f=[]}a(){let a=4;this.flags&1&&(a+=1);for(let b=0;b<this.h;b++)if(a+=this.f[b].$f.byteLength,this.flags&2){a+=2;for(let c=0;c<this.f[b].Vc;c++)a+=
|
|
56
|
+
2,a+=4}return a+super.a()}write(a){super.write(a);_.O(a,this.h);this.flags&1&&NR(a,this.j);for(let b=0;b<this.h;b++)if(_.lm(a,this.f[b].$f),this.flags&2){PR(a,this.f[b].Vc);for(let c=0;c<this.f[b].Vc;c++)PR(a,this.f[b].df[c].Cf),_.O(a,this.f[b].df[c].Df)}a.getPosition()}};var aT=class{constructor(a,b,c,d){this.frameRate=Number(a)||30;this.f=Number(b)||1;this.a=Number(d);0===this.a&&(this.a=a?this.frameRate*this.f:1);c&&(a=/^(\d+) (\d+)$/g.exec(c))&&(this.frameRate*=parseInt(a[1],10)/parseInt(a[2],10))}},$R=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,aS=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,bS=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,cS=/^(\d*\.?\d*)f$/,dS=/^(\d*\.?\d*)t$/,eS=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/;var PS=class{constructor(a){this.a=a;this.f=gS(this)}get(a){for(let b=0;b<this.a.length;b++){const c=this.a[b].get(a);if(c)return c}return null}write(){this.f=gS(this);for(let a=0;a<this.a.length;a++)this.a[a].write(this.f);return this.f.buffer}};var VS=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);var LT=class{constructor(){this.A=this.j=this.f=this.D=null;this.h=1;this.U=0;this.o="";this.C=this.a=null;this.g=new _.S("clpp.smooth.SmoothParser");this.L=!1;this.l=this.B=null;this.O=mT;this.I=0;this.G=this.J=Infinity;this.w=[];this.M=this.S.bind(this);this.H=new Map}configure(a){this.f=a}start(a,b){this.D=b;a=[...new Set([a,TR(a)])];return iT(this,a).then(c=>qT(this,c.data).then(()=>{rT(this,this.B);return this.j}))}requestStop(){}stop(){this.D&&this.D.networkingEngine.vd(this.M);this.B=this.A=
|
|
57
|
+
this.j=this.f=this.D=null;this.l&&(clearTimeout(this.l),this.l=null);this.L=!1;this.J=this.G=Infinity;return Promise.resolve()}update(){if(this.F())return iT(this,[this.o]).then(a=>qT(this,a.data).then(()=>this.j)).catch(a=>{if(this.D)this.D.onError(a)})}setCurrentVariant(){}Xb(){this.g.debug(_.qC);this.D&&(this.l=null,this.update().then(()=>{rT(this,this.B)}).catch(a=>{this.D&&(this.D.onError(a),1===a.severity&&rT(this,100))}))}F(){return this.O===lT}K(){return 0<this.w.length}R(a){let b=null;if(this.w.length)for(let c=
|
|
58
|
+
0;c<this.w.length;c++)if(this.w[c].keySystem===a){b=this.w[c].initData[0];break}return b}S(a){if(2!==a.request.type||a.uri.startsWith("data:"))return Promise.resolve(a);const b=a.request.timescale||this.A.timescale,c={isLive:this.F.bind(this),Sd:this.K.bind(this),th:()=>1,Pd:this.R.bind(this)};let d=!1;const e=new _.I(_.F,3,4035,null);let f=null;try{const g=this.H.get(a.request.uris[a.request.uriIndex])||a.request.startTime||0;g!==a.request.startTime&&this.g.debug(`Using base media decode time ${g} instead of `+
|
|
59
|
+
`segment reference time ${a.request.startTime}`);f=eT(a,b,g,c)}catch(g){d=!0,e.data=g,3E3===g.code&&(e.code=4039)}if(d||!f)return Promise.reject(e);a.data=f;return Promise.resolve(a)}loadVariant(a){return _.x(function*(){return a})}loadTextStream(a,b){const c=this;return _.x(function*(){let d;const e=c.j.periods.find(f=>f.id===b);e&&(d=e.textStreams.find(f=>f.id===a)||null);if(!d)throw new _.zi(`Could not load text stream with id: ${a}`);return d})}},uT={video:_.Ig,audio:_.Uc,text:_.Oc},mT=_.Ub,lT=
|
|
60
|
+
"LIVE",vT={Ei:_.wC,Fi:_.NC};_.z("clpp.smooth.SmoothComponent",class extends _.Kv{f(){_.et.ism=LT;_.ct[_.Pc]=LT}a(){_.IE("ism");_.JE(_.Pc)}id(){return _.Xf}});};f.call(g, window);
|