@castlabs/prestoplay 6.25.2 → 6.26.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 +15 -0
- package/README.md +5 -5
- 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 +112 -112
- package/cjs/cl.conviva.js +32 -32
- package/cjs/cl.core.js +601 -600
- package/cjs/cl.crypto.js +9 -9
- package/cjs/cl.dash.js +89 -88
- package/cjs/cl.externs.js +37 -31
- package/cjs/cl.freewheel.js +24 -24
- 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 +23 -23
- package/cjs/cl.mediatailor.js +3 -3
- package/cjs/cl.mse.js +341 -334
- package/cjs/cl.muxdata.js +15 -15
- package/cjs/cl.onboard.js +3 -3
- package/cjs/cl.persistent.js +14 -14
- package/cjs/cl.playlist.js +6 -6
- package/cjs/cl.sessions.js +16 -16
- package/cjs/cl.simid.js +17 -17
- package/cjs/cl.smooth.js +72 -72
- package/cjs/cl.thumbnails.js +26 -26
- 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 +19 -19
- package/cjs/cl.vtt.js +14 -14
- package/cjs/cl.yospace.js +4 -4
- package/cjs/cl.youbora.js +38 -36
- package/cl.adobe.js +3 -3
- package/cl.airplay.js +3 -3
- package/cl.broadpeak.js +5 -5
- package/cl.cast.js +87 -87
- package/cl.conviva.js +27 -27
- package/cl.core.js +489 -488
- package/cl.crypto.js +9 -9
- package/cl.dash.js +82 -82
- package/cl.externs.js +37 -31
- package/cl.freewheel.js +19 -19
- package/cl.hls.js +79 -80
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +26 -26
- package/cl.ima.js +17 -17
- package/cl.mediatailor.js +3 -3
- package/cl.mse.js +299 -292
- 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 +14 -14
- package/cl.smooth.js +60 -60
- package/cl.thumbnails.js +19 -19
- package/cl.tizen.js +57 -57
- package/cl.ttml.js +22 -22
- package/cl.verimatrix.js +4 -4
- package/cl.vimond.js +8 -8
- package/cl.vr.js +14 -14
- package/cl.vtt.js +12 -12
- package/cl.yospace.js +3 -3
- package/cl.youbora.js +28 -27
- package/package.json +3 -3
- package/typings.d.ts +41 -3
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.
|
|
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 hB=function(a){switch(a.type){case 1:return eB;case 2:return fB;case 3:return gB}},jB=function(a){const b=Object.keys(a).find(c=>iB.includes(c.toLowerCase()));return void 0!==b?a[b]:void 0},lB=function(a){let b={debug:!0,data:kB(a)};a.f&&a.f.muxOptionsOverride&&_.bh(a.f.muxOptionsOverride)&&(b=_.Yg(b,a.f.muxOptionsOverride));b=_.Yg(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 _.rm(c.url);e.video_source_url=_.fj(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().qa(),
|
|
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.oa())&&d.language&&(e.player_language_code=d.language)}return e}});a.g.debug("Mux SDK options",b);return b},mB=function(a){_.Fh(a.a);a.j.Cd(a.F);a.j.af(a.C)},kB=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},nB=function(a){a.a.on(a.m,_.ag,()=>{const b={player_playhead_time:1E3*a.m.getPosition()};a.emit(_.ag,b)});a.a.on(a.m,_.Te,()=>a.emit(_.Te));a.a.on(a.m,_.Lc,a.G.bind(a));a.a.on(a.m,_.Mf,a.I.bind(a));a.a.on(a.m,_.lg,()=>a.emit(_.Ef));a.a.on(a.m,_.kg,()=>a.emit(_.Df));a.a.on(a.m,_.r,a.H.bind(a));a.a.on(a.m,_.Sb,()=>a.emit("adbreakstart"));a.a.on(a.m,_.Tb,()=>a.emit("adbreakend"));a.a.on(a.m,_.hc,()=>{a.emit("adplay");
|
|
5
|
+
a.emit("adplaying")});a.a.on(a.m,_.dc,()=>a.emit("adpause"));a.a.on(a.m,_.fc,()=>{a.emit("adplay");a.emit("adplaying")});a.a.on(a.m,_.lc,()=>a.emit("adended"));a.a.on(a.m,_.Xb,()=>a.emit("adfirstquartile"));a.a.on(a.m,_.cc,()=>a.emit("admidpoint"));a.a.on(a.m,_.nc,()=>a.emit("adthirdquartile"));a.j.Gc(a.F);a.j.ue(a.C);a.a.on(a.m,_.r,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 _.rm(b.uris[b.uriIndex]);b={request_start:c,request_type:hB(b),request_hostname:d.a};a.g.debug("onRequestCanceled()","Track event: requestcanceled",b);a.emit("requestcanceled",b)}else{{d=c.requestStartTimestamp;const f=new _.rm(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:hB(c),request_hostname:f.a,request_error:`${hB(c)}${"LoadError"}`,request_error_code:e,request_error_text:b.toString()};
|
|
7
|
+
a.g.debug("onRequestFailed()","Track event: requestfailed",b);a.emit("requestfailed",b)}}}})},oB=function(a,b){a.trigger(new _.F(_.r,{detail:b}))},pB=function(a){return!_.B(a)&&typeof a.init===_.Wd&&typeof a.emit===_.Wd},eB="manifest",fB="media",gB="encryption",iB=["x-request-id","cf-ray","x-amz-cf-id","x-akamai-request-id"];var qB=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 _.Rt;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,lB(this))}catch(d){throw this.h=!1,mB(this),new _.I(1,9,9302,null,d);}this.emit("playerready")}this.l&&!this.A&&(a=kB(this),this.emit("videochange",
|
|
8
|
+
a),this.l=!1);nB(this)}release(){this.g.debug("release()");this.l?this.g.debug(_.ia):(mB(this),this.l=!0,this.o=this.f=null)}destroy(){this.g.debug(_.Ad);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(_.Fe);var b=a.detail;a=this.m.getTrackManager();b&&b.bandwidth&&(b=b.bandwidth,(a=a.Oa())&&a.bandwidth&&(b+=a.bandwidth),this.emit("renditionchange",{video_source_bitrate:b}))}I(a){this.g.debug(_.Ke);
|
|
9
|
+
switch(a.detail.currentState){case _.Xo:this.m.getConfiguration().autoplay&&this.emit(_.Te);break;case _.Zo:this.emit(_.df);break;case _.Yo:this.emit(_.Pe);break;case _.Oo:this.emit(_.Sd)}}H(a){this.g.debug(_.He);if(this.h&&(a=a.detail||null))if(10003===a.code)this.emit("aderror");else if(a.severity===_.G){var b=a.message||"Player error";if(1===a.category||6100===a.code||6007===a.code)b="Download error",6100===a.code?b="Certificate request error":6007===a.code&&(b="License request error"),b=`${b} castlabs-error-data:${JSON.stringify(a.data)}`;
|
|
10
|
+
this.emit(_.r,{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 _.rm(b.uris[b.uriIndex]);a={request_start:g,request_type:hB(b),request_hostname:d.a,request_id:jB(e),request_bytes_loaded:f,request_response_start:h,
|
|
11
|
+
request_response_end:a,request_response_headers:e,request_media_duration:c,request_url:_.fj(d)};this.g.debug("onRequestCompleted()","Track event: requestcompleted",a);this.emit("requestcompleted",a)}}}J(a){a.requestStartTimestamp=Date.now()}};var rB=class extends _.Sv{constructor(){super();this.f=this.m=null;this.a=!1;this.g=new _.T("clpp.muxdata")}onPlayerCreated(a){this.m=a;this.f=new qB(a,this.g)}onContentWillLoad(a,b){var c=a.getConfiguration();c=_.Zg(c.muxdata);try{var d=[];typeof c===_.Ee&&(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===_.Ee){const g=f.muxdata;d=pB(g.muxLib)?g.muxLib:window.mux;if(!pB(d)){this.g.warn("Mux SDK is not loaded. Will do nothing.");
|
|
12
|
+
this.a=!1;const h=new _.I(1,9,9301);oB(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,oB(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&&oB(this.m,c),c;}}};_.z("clpp.muxdata.MuxDataPlugin",rB);rB.prototype.emit=rB.prototype.emit;
|
|
13
|
+
rB.Id="mux";_.Mr(new class{create(){return new rB}});};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 dB=function(a,b){let c=b.baseUrl;_.$i(c,"/")||(c+="/");const d=g=>g&&(_.Zi(g,_.be)||_.Zi(g,"http://")||_.Zi(g,"//"))?g:`${c}${g}`,e=d(b.widevineUrl||"widevine"),f=d(b.playreadyUrl||"playready");b=d(b.fairplayUrl||"fairplay");a=new _.Bu(a);a.$a(_.td,{licenseUrl:e,videoRobustness:[_.ob,void 0],audioRobustness:[_.nb,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:_.Gm,licenseResponse:_.Hm}});a.$a(_.pd,{licenseUrl:b,
|
|
2
|
+
certificateUrl:b,modifiers:{licenseRequest:_.Jm,licenseResponse:_.Km,extractContentId:_.Lm,certificateRequest:_.Pm}});a.$a(_.rd,{licenseUrl:f,modifiers:{licenseRequest:_.Gm}});_.Wl(a)};
|
|
3
|
+
_.z("clpp.onboard.OnboardComponent",class extends _.Dv{constructor(){super();this.g=new _.T("clpp.onboard");this.j=new Set}a(){for(const a of this.j)delete _.Vl[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}'`),dB(b,a),this.j.add(b))}id(){return"onboard"}});
|
|
4
|
+
_.z("clpp.onboard.register",dB);};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 OA="A persistent DRM session already exists for: ",PA="No DRM configuration.",QA="clpp.persistent",RA="clpp.persistent.SimpleSessionStorage",SA=function(a,b){const c=[];for(const d of a)c.push(b(d));return c},UA=function(a,b,c,d,e,f){a.K=TA;const g=new Map,h=_.Dn(b);g.set(h,{audioCapabilities:e,videoCapabilities:f,distinctiveIdentifier:_.Me,persistentState:_.wf,sessionTypes:[_.Re],label:h,drmInfos:[{keySystem:b,licenseServerUri:c,distinctiveIdentifierRequired:!1,persistentStateRequired:!0,
|
|
2
|
+
audioRobustness:"",videoRobustness:"",serverCertificate:d,initData:null,keyIds:null}]});return _.Vn(a,g)},WA=function(a,b){a.K=VA;a.L=[];a.G=!0;return _.Wn(a,b)},XA=function(a,b){return _.x(function*(){const c=yield _.no(a,b);if(c){var d=[],e=a.h.get(c);e&&a.C&&(e.jc=new _.Ij,d.push(e.jc));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)})},YA=function(a){a=a.h.keys();a=SA(a,b=>b.sessionId);return Array.from(a)},
|
|
3
|
+
ZA=function(a,b){const c=_.Yl(a),d=_.yl({drm:a});d.drm=a;a=new _.fp({vb:b,onError:()=>{},Te:()=>{},Se:()=>{},onEvent:()=>{},getConfiguration:()=>d,Qc:()=>null});a.f=c;return a},bB=function(a,b,c){return _.x(function*(){const d=$A;if(a){var e=a.offlineId;if(0!==e.length){var f=yield d.get(e);if(f)aB.debug(OA,e);else{var g=ZA(a,c);try{yield WA(g,b);yield _.lo(g);yield _.oo(g);const h=g.getDrmInfo(),k=b.map(l=>({contentType:_.rk(l.video.mimeType,l.video.codecs),robustness:h.videoRobustness}));f={sessionIds:YA(g),
|
|
4
|
+
keySystem:h.keySystem,licenseServerUri:h.licenseServerUri,serverCertificate:h.serverCertificate,audioCapabilities:[],videoCapabilities:k,drmConfig:a};yield d.store(e,f)}catch(h){throw aB.error(`Error while persisting DRM session ${e}`),new _.I(1,6,6200,null,h);}finally{yield g.destroy()}}}}else aB.debug(PA)})},VA=1,TA=2,cB=class{constructor(){this.g=new _.T(RA)}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(_.G,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 RA}};_.z("clpp.persistent.useStorage",function(a){{var b=["store","get","delete","clear","getName"];const c=[];_.B(a)||(_.ch(a.store)||c.push("store"),_.ch(a.get)||c.push("get"),_.ch(a.delete)||c.push("delete"),_.ch(a.clear)||c.push("clear"),_.ch(a.getName)||c.push("getName"),b=c)}if(0<b.length)throw aB.warn("Invalid session storage implementation"),new _.I(1,6,6202,{missingMethods:b});$A=a});
|
|
7
|
+
_.z("clpp.persistent.fetchLicense",function(a,b,...c){return _.x(function*(){var d=$A,e=(l,m)=>new _.I(1,6,6200,l,m);const f=_.bp(a).shift();if(!f)throw e("No source specified.");if(!b)throw e(PA);var g=b.offlineId;if(typeof g!==_.Pf||!g.length)throw e("Missing offline id.");if(yield d.get(g))aB.debug(OA,g);else{var h=_.yl();d=new _.Dr;g=[];for(var k of c){const l=new k;_.Bl(l.id())||(l.f(),_.Dl(l),g.push(l))}k=null;try{k=yield _.at(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(_.G,4,4014));const m=_.Zs(l.periods);yield bB(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(),_.Al.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=$A;if(_.eh(a)&&0!==a.length){var c=null,d=null;try{const e=yield b.get(a);e?(e.drmConfig.delayLicenseRequestUntilPlayed=!0,d=new _.Dr,c=ZA(e.drmConfig,d),yield UA(c,e.keySystem,e.licenseServerUri,e.serverCertificate,e.audioCapabilities,e.videoCapabilities),yield _.lo(c),yield Promise.all(e.sessionIds.map(f=>_.x(function*(){yield XA(c,f);aB.debug("successfully removed session with id",f)}))),yield b.delete(a)):aB.debug("No persistent DRM session found")}catch(e){throw aB.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 aB.warn("Invalid offlineId")})});_.z("clpp.persistent.getSessionStorage",function(){return $A});var $A=new cB,aB=new _.T(QA);_.z("clpp.persistent.PersistentLicenseComponent",class extends _.Dv{constructor(){super();this.g=new _.T(QA)}id(){return _.Qe}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 bB(d,b,e),a.trigger(new _.F(_.Ld,{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=$A;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 _.F(_.
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var LA=function(a,b){return 0<=b&&b<a.a.length},MA=function(a){a.trigger(new _.F(_.ff))},NA=class extends _.vu{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.Aa.bind(this)}getPosition(){return this.f}Fh(){return this.a}jd(){return 0<this.a.length&&LA(this,this.f)?this.a[this.f]:null}Gh(){const a=this.f+1;return 0<
|
|
2
|
+
this.a.length&&LA(this,a)?this.a[a]:null}Sh(){return this.h}start(){this.h||(this.h=!0,this.m.on(_.Sd,this.j),this.Wd(this.f,!0))}stop(){this.h=!1;this.m.off(_.Sd,this.j)}Aa(){this.next()}next(){const a=this;return _.x(function*(){yield a.Wd(Math.min(a.a.length-1,a.f+1))})}ki(){const a=this;return _.x(function*(){yield a.Wd(Math.max(0,a.f-1))})}Wd(a,b){b=void 0===b?!1:b;const c=this;return _.x(function*(){if(0<c.a.length&&LA(c,a)&&(b||c.f!==a)){c.f=a;var d=c.jd();d&&(yield c.l(d),yield c.m.load(d.configuration),
|
|
3
|
+
c.trigger(new _.F(_.ef,{item:d})))}})}append(a){this.a.push(a);MA(this)}Qh(a,b){if(0<=b&&b<=this.a.length){const c=this.jd();this.a.splice(b,0,a);c&&(this.f=this.a.indexOf(c));MA(this)}}remove(a){if(0<this.a.length&&LA(this,a)){if(this.f===a)throw Error("Can't remove the current item");this.a.splice(a,1);MA(this)}}clear(){this.stop();this.f=0;this.a=[];this.h=!1;MA(this)}};_.z("clpp.Playlist",NA);NA.prototype.clear=NA.prototype.clear;NA.prototype.remove=NA.prototype.remove;NA.prototype.insert=NA.prototype.Qh;
|
|
4
|
+
NA.prototype.append=NA.prototype.append;NA.prototype.goTo=NA.prototype.Wd;NA.prototype.previous=NA.prototype.ki;NA.prototype.next=NA.prototype.next;NA.prototype.onEnded=NA.prototype.Aa;NA.prototype.stop=NA.prototype.stop;NA.prototype.start=NA.prototype.start;NA.prototype.isStarted=NA.prototype.Sh;NA.prototype.getUpcoming=NA.prototype.Gh;NA.prototype.getCurrent=NA.prototype.jd;NA.prototype.getQueue=NA.prototype.Fh;NA.prototype.getPosition=NA.prototype.getPosition;NA.prototype.off=NA.prototype.off;
|
|
5
|
+
NA.prototype.one=NA.prototype.one;NA.prototype.on=NA.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
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Gz="apiUrl config is missing",Hz=function(a,b){a.l=a.l.filter(c=>c!==b)},Iz=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]},Nz=function(a,b,c,d){if(!(null===c||void 0===c||typeof c===_.t&&0===c||typeof c===_.Pf&&0===c.length||Array.isArray(c)&&0===c.length))if(Array.isArray(c)){Jz(a,b<<3|2);b=new Kz;for(let e=0;e<c.length;e++)d(b,c[e]);Lz(a,b.length());Mz(a,b.end())}else Jz(a,
|
|
2
|
+
b<<3|0),d(a,c)},Lz=function(a,b){if(0<=b)Jz(a,b);else{for(let c=0;9>c;c++)a.a.push(b&127|128),b>>=7;a.a.push(1)}},Oz=function(a,b,c){Nz(a,b,c,(d,e)=>{Lz(d,e)})},Jz=function(a,b){for(;127<b;)a.a.push(b&127|128),b>>>=7;a.a.push(b)},Qz=function(a,b,c){Nz(a,b,c,(d,e)=>{if(0<=e){{const [f,g]=Iz(e);Pz(d,f,g)}}else{{const [f,g]=Iz(e);Pz(d,f,g)}}})},Rz=function(a,b,c,d){if(!(null===c||void 0===c||typeof c===_.t&&0===c||typeof c===_.Pf&&0===c.length||Array.isArray(c)&&0===c.length))if(Array.isArray(c))for(let e=
|
|
3
|
+
0;e<c.length;e++){Jz(a,b<<3|2);const f=new Kz;d(f,c[e]);Lz(a,f.length());Mz(a,f.end())}else Jz(a,b<<3|2),b=new Kz,d(b,c),Lz(a,b.length()),Mz(a,b.end())},Sz=function(a,b,c){Rz(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)}})},Mz=function(a,b){a.a.push.apply(a.a,b)},Tz=function(a,b,c){Rz(a,b,c,(d,e)=>{Mz(d,e.a())})},Uz=function(a,b,c){Rz(a,b,c,(d,e)=>{Mz(d,e)})},Pz=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)},Wz=function(a){const b=new Vz;b.h=Math.floor(a/1E3);b.f=a%1E3*1E6;return b},$z=function(a){return _.x(function*(){if(!a.j&&!a.f){0===a.a.length&&Xz(a,new Yz);var b=()=>
|
|
5
|
+
{};a.f=new Promise(c=>{b=c});try{const c=new Zz;c.f=a.o;c.events.push(...a.a);const d=[...a.a],e=yield fetch(a.l,{method:_.db,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}}})},cA=function(a,b,c,d,e,f,g){const h=new aA;h.headers=[new bA("CL-BROWSER-NAME",b),new bA("CL-BROWSER-VERSION",
|
|
6
|
+
c),new bA("CL-OS-FAMILY",d),new bA("CL-OS-VERSION",e),new bA("CL-SDK-NAME",f),new bA("CL-SDK-NAME",f),new bA("CL-SDK-VERSION",g)];Xz(a,h)},Xz=function(a,b){if(!a.j){var c=new dA(a.w);c.sessionId=a.A;{var d=Date.now();const e=new eA;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)}},fA=function(a){return _.x(function*(){a.h&&(clearInterval(a.h),a.h=null);a.f&&(yield a.f);0<a.a.length&&(yield $z(a),a.a=[]);a.j=!0})},gA=function(a){_.x(function*(){a.g.info("Destroy the session and stop sending events.");
|
|
7
|
+
_.Fh(a.a);a.Z=!1;const b=a.m.getNetworkEngine();b.af(a.l);b.Cd(a.h);Hz(b,a.h);a.f&&(yield fA(a.f),a.f=null)})},oA=function(a){switch(a){case _.Wo:return hA;case _.Xo:return iA;case _.So:return jA;case _.Zo:return kA;case _.Yo:return lA;case _.Oo:return mA;case _.Po:return nA;default:return null}},pA=function(a,b){a.g.debug("Sending event",b);Xz(a.f,b)},xA=function(a,b){switch(a){case 1:return qA;case 2:return b===_.w?rA:b===_.p?sA:b===_.H?tA:b===_.ce?uA:vA;case 3:return wA;default:return vA}};var Kz=class{constructor(){this.a=[]}length(){return this.a.length}end(){const a=this.a;this.a=[];return a}};var yA=class{constructor(a,b,c,d){this.downloadId=a;this.h=b;this.duration=c;this.j=d;this.f=[]}a(){const a=new Kz;Tz(a,1,this.downloadId);Oz(a,2,this.h);Tz(a,3,this.duration);Oz(a,4,this.j);Tz(a,5,this.f);return a.end()}getId(){return 4}};var zA=class{constructor(a,b){this.f=a;this.url=b;this.downloadId=null;this.headers=[];this.size=this.duration=null}a(){const a=new Kz;Oz(a,1,this.f);Tz(a,2,this.downloadId);Sz(a,3,this.url);Tz(a,4,this.headers);Sz(a,5,null);Tz(a,6,null);Tz(a,7,this.duration);Qz(a,8,this.size);return a.end()}getId(){return 2}};var AA=class{constructor(a,b){this.h=a;this.f=b}a(){const a=new Kz;Oz(a,1,this.h);Uz(a,2,this.f);return a.end()}};var BA=class{constructor(a){this.cause=a;this.f=this.message=this.severity=this.errorCode=null}a(){const a=new Kz;Oz(a,1,this.errorCode);Oz(a,2,this.severity);Sz(a,3,this.message);Sz(a,4,this.f);Tz(a,5,this.cause);return a.end()}getId(){return 7}};var bA=class{constructor(a,b){this.key=a;this.value=b}a(){const a=new Kz;Sz(a,1,this.key);Sz(a,2,this.value);return a.end()}};var CA=class{constructor(){this.cause=this.severity=this.code=null}a(){const a=new Kz;Oz(a,1,this.code);Oz(a,2,this.severity);Tz(a,3,this.cause);return a.end()}getId(){return 12}};var DA=class{constructor(){this.data=null}a(){const a=new Kz;Uz(a,1,this.data);return a.end()}};var EA=class extends DA{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 aA=class{constructor(){this.headers=[]}a(){const a=new Kz;Tz(a,1,this.headers);return a.end()}getId(){return 1}};var Yz=class{constructor(){}a(){return(new Kz).end()}getId(){return 6}};var dA=class{constructor(a){this.j=a;this.f=this.h=this.time=this.sessionId=null}a(){const a=new Kz;Tz(a,1,this.j);Tz(a,2,this.sessionId);Tz(a,3,this.time);Qz(a,4,null);Sz(a,5,null);Oz(a,6,this.h);Uz(a,7,this.f);return a.end()}};var Zz=class{constructor(){this.f=null;this.events=[]}a(){const a=new Kz;Uz(a,1,this.f);Tz(a,2,this.events);return a.end()}};var eA=class{constructor(){this.f=this.h=null}a(){const a=new Kz;Qz(a,1,this.h);Oz(a,2,this.f);return a.end()}};var Vz=class{constructor(){this.f=this.h=null}a(){const a=new Kz;Qz(a,1,this.h);Oz(a,2,this.f);return a.end()}};var FA=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 EA;this.A=new EA;this.a=[];this.h=setInterval(()=>$z(this),k);this.f=null;this.j=!1;cA(this,b,c,d,e,f,g)}};var GA=class{constructor(){this.reason=this.currentState=this.previousState=null}a(){const a=new Kz;Oz(a,1,this.previousState);Oz(a,2,this.currentState);Oz(a,3,this.reason);Tz(a,4,null);Tz(a,5,null);Tz(a,6,null);return a.end()}getId(){return 5}};var KA=class extends _.Sv{constructor(){super();this.m=null;this.Z=this.j=!1;this.a=new _.Rt;this.f=null;this.g=new _.T("clpp.sessions.SessionsPlugin");this.l=this.F.bind(this);this.h=this.C.bind(this)}onPlayerCreated(a){this.m=a}onContentWillLoad(a){var b=a.getConfiguration().sessions;(b=!(!b||typeof b!==_.Ee))||this.g.debug("Sessions plugin is loaded but not configured. Will do nothing.");if(this.j=b)b=a.getConfiguration().sessions,b.apiUrl?(this.g.debug(_.sa),this.g.info("Create a session and start sending events."),
|
|
8
|
+
a=_.Yk(),this.f=new FA(new Uint8Array([]),a.browser,a.browserVersion.name,a.os,a.osVersion.name,"prestoplay-web",_.ea,b.apiUrl),this.a.on(this.m,_.Mf,this.B.bind(this)),this.a.on(this.m,_.Ef,this.A.bind(this)),this.a.on(this.m,_.Df,this.w.bind(this)),this.a.on(this.m,_.r,this.o.bind(this)),a=this.m.getNetworkEngine(),a.ue(this.l),a.Gc(this.h),a.l.push(this.h)):(this.g.warn(Gz),a.onError(new _.I(1,9,15E3,Gz)))}onPlayerWillRelease(){gA(this)}id(){return"sessions"}B(a){if(!this.Z){a=a.detail;var b=a.currentState,
|
|
9
|
+
c=new GA;c.previousState=oA(a.previousState);c.currentState=oA(b);pA(this,c)}}A(){if(!this.Z){var a=new GA;a.previousState=oA(this.m.getState());a.currentState=HA;pA(this,a);this.Z=!0}}w(){if(this.Z){var a=new GA;a.previousState=HA;a.currentState=oA(this.m.getState());pA(this,a);this.Z=!1}}o(a){a=a.detail;var b=new CA;b=new BA(new AA(b.getId(),new Uint8Array(b.a())));b.errorCode=a.code;b.message=a.message;b.f=a.stack;b.severity=a.severity===_.G?IA:JA;pA(this,b)}F(a){const b=new EA;a.downloadId=b;
|
|
10
|
+
const c=new zA(xA(a.type,a.contentType),a.uris[0]);c.downloadId=b;c.headers=Object.keys(a.headers).map(d=>new bA(d,a.headers[d]));pA(this,c)}C(a){var b=a.request.downloadId;b?(b=new yA(b,a.data.byteLength,Wz(a.timeMs||0),a.status||-1),b.f=Object.keys(a.headers).map(c=>new bA(c,a.headers[c])),pA(this,b)):this.g.warn("Download ID is missing on download completed event.")}};_.Mr(new class{create(){return new KA}});var JA=1,IA=2;var hA=0,iA=2,nA=3,HA=5,jA=6,kA=8,lA=10,mA=11;var qA=0,rA=1,sA=2,tA=3,uA=4,wA=5,vA=9;};f.call(g, window);
|
package/cl.simid.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
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 _.F(_.
|
|
7
|
-
"opacity .5s",this.a.style.transitionDelay=".5s",this.a.style.pointerEvents=_.
|
|
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=
|
|
9
|
-
f.height}e.creativeDimensions&&(e=
|
|
10
|
-
this.h=this.a.src="";this.l=0;this.a.style.opacity="0";window.removeEventListener(_.
|
|
11
|
-
this.j(a)}};var
|
|
12
|
-
var c=this.m.getSurface();c?(this.g.info("Creating new session"),this.a=new
|
|
13
|
-
c&&(c=this.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}
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var pz="No surface found. Can not attach frame!",qz="SIMID:Media:timeupdate",rz="Starting creative",sz=function(a,b,c){return{type:b,sessionId:a.h,messageId:a.l++,timestamp:Date.now(),args:c}},vz=function(a,b){return new Promise((c,d)=>{new tz(a.j,c,d,b);uz(a,b)})},wz=function(a){const b=sz(a,"SIMID:Player:startCreative",void 0);vz(a,b).then(()=>{var c=a.f;c.g.info(rz);c.m.trigger(new _.F(_.Gf));a.a.style.opacity="1"}).catch(c=>{a.unload();a.f.g.error("Error while starting creative",
|
|
2
|
+
c)})},yz=function(a,b){_.x(function*(){a.h=b.sessionId;xz(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=sz(a,"SIMID:Player:init",d);var e=vz(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()}})},xz=function(a,b){uz(a,sz(a,"resolve",{messageId:b.messageId,
|
|
4
|
+
value:void 0}))},uz=function(a,b){a.h?(b.type!==qz&&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}'`)},zz=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=sz(d,"SIMID:Player:resize",e);uz(d,e)}})},Az=function(a,b){a.g.info("SIMID Session created");a.a=b},Bz=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 _.F(_.Hf))},Cz=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}%`}},Dz=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=_.De,this.a.style.backgroundColor="transparent",this.a.style.transition=
|
|
7
|
+
"opacity .5s",this.a.style.transitionDelay=".5s",this.a.style.pointerEvents=_.De,this.a.style.overflow=_.$d);this.a.classList.add(_.Zc);this.o=c=>{if(c.source===this.a.contentWindow&&(c=(c=c.data)?typeof c===_.Pf?JSON.parse(c):c:null))if(c.type)switch(this.g.info(`Received message [${c.messageId}] '${c.type}':`,c.args),c.type){case "createSession":yz(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
|
+
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=Cz(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
|
+
f.height}e.creativeDimensions&&(e=Cz(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);xz(this,c)}else this.g.warn("WARNING: received message without 'type' property")};this.g=new _.T("clpp.simid.SimidPlayer");Az(this.f,this)}load(a){window.addEventListener(_.se,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(){Bz(this.f);
|
|
10
|
+
this.h=this.a.src="";this.l=0;this.a.style.opacity="0";window.removeEventListener(_.se,this.o);this.a.parentElement&&this.a.parentElement.removeChild(this.a)}},tz=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
|
+
this.j(a)}};var Fz=class extends _.Sv{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 Ez(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
|
+
var c=this.m.getSurface();c?(this.g.info("Creating new session"),this.a=new Dz(this.h,b.simid),b=c.getContainer(),this.j=zz(this,b,c),this.j.observe(b),a.on(_.ag,this.w)):this.g.warn(pz)}}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&&(wz(this.a),this.o=!0,this.g.info(rz)),
|
|
13
|
+
c&&(c=this.a,uz(c,sz(c,qz,{currentTime:a-b}))))):((a=this.m.getSurface())||this.g.warn(pz),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(_.ag,this.w),this.f&&(this.a.unload(),this.f=this.h.f=null))}},Ez=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}cg(){return this.a}url(){return this.f?this.f.url:""}};_.Mr(new class{create(){return new Fz}});};f.call(g, window);
|