@castlabs/prestoplay 6.25.2 → 6.27.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 +38 -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 +115 -114
- package/cjs/cl.conviva.js +32 -32
- package/cjs/cl.core.js +620 -620
- package/cjs/cl.crypto.js +9 -9
- package/cjs/cl.dash.js +89 -88
- package/cjs/cl.externs.js +89 -51
- package/cjs/cl.freewheel.js +25 -25
- package/cjs/cl.hls.js +79 -77
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +30 -30
- package/cjs/cl.ima.js +24 -24
- package/cjs/cl.mediatailor.js +3 -3
- package/cjs/cl.mse.js +351 -336
- 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 +17 -17
- package/cjs/cl.smooth.js +72 -72
- package/cjs/cl.thumbnails.js +26 -26
- package/cjs/cl.tizen.js +73 -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 +39 -37
- package/cjs/polyfill.min.js +15 -3
- package/cl.adobe.js +3 -3
- package/cl.airplay.js +3 -3
- package/cl.broadpeak.js +5 -5
- package/cl.cast.js +92 -90
- package/cl.conviva.js +27 -27
- package/cl.core.js +496 -500
- package/cl.crypto.js +9 -9
- package/cl.dash.js +82 -82
- package/cl.externs.js +89 -51
- package/cl.freewheel.js +19 -19
- package/cl.hls.js +80 -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 +305 -294
- package/cl.muxdata.js +13 -13
- package/cl.onboard.js +4 -4
- package/cl.persistent.js +11 -11
- 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 +15 -15
- package/cl.vtt.js +12 -12
- package/cl.yospace.js +3 -3
- package/cl.youbora.js +29 -28
- package/package.json +3 -3
- package/typings.d.ts +124 -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 YA=function(a){switch(a.type){case 1:return VA;case 2:return WA;case 3:return XA}},$A=function(a){const b=Object.keys(a).find(c=>ZA.includes(c.toLowerCase()));return void 0!==b?a[b]:void 0},bB=function(a){let b={debug:!0,data:aB(a)};a.f&&a.f.muxOptionsOverride&&_.dh(a.f.muxOptionsOverride)&&(b=_.$g(b,a.f.muxOptionsOverride));b=_.$g(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 _.Lm(c.url);e.video_source_url=_.Qi(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},cB=function(a){_.Hh(a.a);a.j.td(a.F);a.j.Se(a.C)},aB=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},dB=function(a){a.a.on(a.m,_.cg,()=>{const b={player_playhead_time:1E3*a.m.getPosition()};a.emit(_.cg,b)});a.a.on(a.m,_.Ue,()=>a.emit(_.Ue));a.a.on(a.m,_.Lc,a.G.bind(a));a.a.on(a.m,_.Nf,a.I.bind(a));a.a.on(a.m,_.ng,()=>a.emit(_.Ff));a.a.on(a.m,_.mg,()=>a.emit(_.Ef));a.a.on(a.m,_.Ud,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,_.kc,()=>
|
|
5
|
+
{a.emit("adplay");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,_.mc,()=>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.Ac(a.F);a.j.me(a.C);a.a.on(a.m,_.Ud,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 _.Lm(b.uris[b.uriIndex]);b={request_start:c,request_type:YA(b),request_hostname:d.a};a.g.debug("onRequestCanceled()","Track event: requestcanceled",b);a.emit("requestcanceled",b)}else{{d=c.requestStartTimestamp;const f=new _.Lm(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:YA(c),request_hostname:f.a,request_error:`${YA(c)}${"LoadError"}`,request_error_code:e,request_error_text:b.toString()};
|
|
7
|
+
a.g.debug("onRequestFailed()","Track event: requestfailed",b);a.emit("requestfailed",b)}}}})},eB=function(a,b){a.trigger(new _.C(_.Ud,{detail:b}))},fB=function(a){return!_.z(a)&&typeof a.init===_.$d&&typeof a.emit===_.$d},VA="manifest",WA="media",XA="encryption",ZA=["x-request-id","cf-ray","x-amz-cf-id","x-akamai-request-id"];var gB=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 _.Kt;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,bB(this))}catch(d){throw this.h=!1,cB(this),new _.I(1,9,9302,null,d);}this.emit("playerready")}this.l&&!this.A&&(a=aB(this),this.emit("videochange",
|
|
8
|
+
a),this.l=!1);dB(this)}release(){this.g.debug("release()");this.l?this.g.debug(_.ja):(cB(this),this.l=!0,this.o=this.f=null)}destroy(){this.g.debug(_.Bd);this.A?this.g.debug(_.ia):(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(_.Ge);var b=a.detail;a=this.m.getTrackManager();b&&b.bandwidth&&(b=b.bandwidth,(a=a.La())&&a.bandwidth&&(b+=a.bandwidth),this.emit("renditionchange",{video_source_bitrate:b}))}I(a){this.g.debug(_.Le);
|
|
9
|
+
switch(a.detail.currentState){case _.qp:this.m.getConfiguration().autoplay&&this.emit(_.Ue);break;case _.sp:this.emit(_.ef);break;case _.rp:this.emit(_.Qe);break;case _.hp:this.emit(_.Td)}}H(a){this.g.debug(_.Ie);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(_.Ud,{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 _.Lm(b.uris[b.uriIndex]);a={request_start:g,request_type:YA(b),request_hostname:d.a,request_id:$A(e),request_bytes_loaded:f,request_response_start:h,
|
|
11
|
+
request_response_end:a,request_response_headers:e,request_media_duration:c,request_url:_.Qi(d)};this.g.debug("onRequestCompleted()","Track event: requestcompleted",a);this.emit("requestcompleted",a)}}}J(a){a.requestStartTimestamp=Date.now()}};var hB=class extends _.Iv{constructor(){super();this.f=this.m=null;this.a=!1;this.g=new _.S("clpp.muxdata")}onPlayerCreated(a){this.m=a;this.f=new gB(a,this.g)}onContentWillLoad(a,b){var c=a.getConfiguration();c=_.ah(c.muxdata);try{var d=[];typeof c===_.Fe&&(c.envKey||d.push("envKey"));if(0<d.length)throw new _.I(1,9,9300,{missingKeys:d});{const f=a.getConfiguration();d=null;if(this.a=!_.z(f.muxdata)&&typeof f.muxdata===_.Fe){const g=f.muxdata;d=fB(g.muxLib)?g.muxLib:window.mux;if(!fB(d)){this.g.warn("Mux SDK is not loaded. Will do nothing.");
|
|
12
|
+
this.a=!1;const h=new _.I(1,9,9301);eB(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,eB(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&&eB(this.m,c),c;}}};_.x("clpp.muxdata.MuxDataPlugin",hB);hB.prototype.emit=hB.prototype.emit;
|
|
13
|
+
hB.Id="mux";_.fs(new class{create(){return new hB}});};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
|
-
_.
|
|
4
|
-
_.
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var UA=function(a,b){let c=b.baseUrl;_.Ji(c,"/")||(c+="/");const d=g=>g&&(_.Ii(g,_.de)||_.Ii(g,"http://")||_.Ii(g,"//"))?g:`${c}${g}`,e=d(b.widevineUrl||"widevine"),f=d(b.playreadyUrl||"playready");b=d(b.fairplayUrl||"fairplay");a=new _.su(a);a.Xa(_.ud,{licenseUrl:e,videoRobustness:[_.ob,void 0],audioRobustness:[_.nb,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:_.cn,licenseResponse:_.dn}});a.Xa(_.qd,{licenseUrl:b,
|
|
2
|
+
certificateUrl:b,modifiers:{licenseRequest:_.fn,licenseResponse:_.gn,extractContentId:_.hn,certificateRequest:_.jn}});a.Xa(_.sd,{licenseUrl:f,modifiers:{licenseRequest:_.cn}});_.pm(a)};
|
|
3
|
+
_.x("clpp.onboard.OnboardComponent",class extends _.uv{constructor(){super();this.g=new _.S("clpp.onboard");this.j=new Set}a(){for(const a of this.j)delete _.om[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}'`),UA(b,a),this.j.add(b))}id(){return"onboard"}});
|
|
4
|
+
_.x("clpp.onboard.register",UA);};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
|
|
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 _.
|
|
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 _.
|
|
7
|
-
_.
|
|
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(_.
|
|
9
|
-
_.
|
|
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=
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var EA="A persistent DRM session already exists for: ",FA="No DRM configuration.",GA="clpp.persistent",HA="clpp.persistent.SimpleSessionStorage",IA=function(a,b){const c=[];for(const d of a)c.push(b(d));return c},KA=function(a,b,c,d,e,f){a.K=JA;const g=new Map,h=_.Xn(b);g.set(h,{audioCapabilities:e,videoCapabilities:f,distinctiveIdentifier:_.Ne,persistentState:_.xf,sessionTypes:[_.Se],label:h,drmInfos:[{keySystem:b,licenseServerUri:c,distinctiveIdentifierRequired:!1,persistentStateRequired:!0,
|
|
2
|
+
audioRobustness:"",videoRobustness:"",serverCertificate:d,initData:null,keyIds:null}]});return _.po(a,g)},MA=function(a,b){a.K=LA;a.L=[];a.G=!0;return _.qo(a,b)},NA=function(a,b){return _.w(function*(){const c=yield _.Ho(a,b);if(c){var d=[],e=a.h.get(c);e&&a.C&&(e.ec=new _.xk,d.push(e.ec));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)})},OA=function(a){a=a.h.keys();a=IA(a,b=>b.sessionId);return Array.from(a)},
|
|
3
|
+
PA=function(a,b){const c=_.rm(a),d=_.Zl({drm:a});d.drm=a;a=new _.zp({sb:b,onError:()=>{},Je:()=>{},Ie:()=>{},onEvent:()=>{},getConfiguration:()=>d,Jc:()=>null});a.f=c;return a},SA=function(a,b,c){return _.w(function*(){const d=QA;if(a){var e=a.offlineId;if(0!==e.length){var f=yield d.get(e);if(f)RA.debug(EA,e);else{var g=PA(a,c);try{yield MA(g,b);yield _.Fo(g);yield _.Io(g);const h=g.getDrmInfo(),k=b.map(l=>({contentType:_.ul(l.video.mimeType,l.video.codecs),robustness:h.videoRobustness}));f={sessionIds:OA(g),
|
|
4
|
+
keySystem:h.keySystem,licenseServerUri:h.licenseServerUri,serverCertificate:h.serverCertificate,audioCapabilities:[],videoCapabilities:k,drmConfig:a};yield d.store(e,f)}catch(h){throw RA.error(`Error while persisting DRM session ${e}`),new _.I(1,6,6200,null,h);}finally{yield g.destroy()}}}}else RA.debug(FA)})},LA=1,JA=2,TA=class{constructor(){this.g=new _.S(HA)}store(a,b){return _.w(function*(){{var c=JSON.stringify(b.sessionIds);var d=b.serverCertificate?Array.from(b.serverCertificate):null;d=JSON.stringify(d);
|
|
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 _.w(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 _.w(function*(){window.localStorage.removeItem(encodeURIComponent(a))})}clear(){return _.w(function*(){window.localStorage.clear()})}getName(){return HA}};_.x("clpp.persistent.useStorage",function(a){{var b=["store","get","delete","clear","getName"];const c=[];_.z(a)||(_.eh(a.store)||c.push("store"),_.eh(a.get)||c.push("get"),_.eh(a.delete)||c.push("delete"),_.eh(a.clear)||c.push("clear"),_.eh(a.getName)||c.push("getName"),b=c)}if(0<b.length)throw RA.warn("Invalid session storage implementation"),new _.I(1,6,6202,{missingMethods:b});QA=a});
|
|
7
|
+
_.x("clpp.persistent.fetchLicense",function(a,b,...c){return _.w(function*(){var d=QA,e=(l,m)=>new _.I(1,6,6200,l,m);const f=_.vp(a).shift();if(!f)throw e("No source specified.");if(!b)throw e(FA);var g=b.offlineId;if(typeof g!==_.Qf||!g.length)throw e("Missing offline id.");if(yield d.get(g))RA.debug(EA,g);else{var h=_.Zl();d=new _.Xr;g=[];for(var k of c){const l=new k;_.bm(l.id())||(l.f(),_.dm(l),g.push(l))}k=null;try{k=yield _.qt(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=_.ot(l.periods);yield SA(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(),_.am.delete(e.id());e=[];k&&e.push(k.stop());e.push(d.destroy());yield Promise.all(e)}}})});
|
|
9
|
+
_.x("clpp.persistent.removeLicense",function(a){return _.w(function*(){var b=QA;if(_.gh(a)&&0!==a.length){var c=null,d=null;try{const e=yield b.get(a);e?(e.drmConfig.delayLicenseRequestUntilPlayed=!0,d=new _.Xr,c=PA(e.drmConfig,d),yield KA(c,e.keySystem,e.licenseServerUri,e.serverCertificate,e.audioCapabilities,e.videoCapabilities),yield _.Fo(c),yield Promise.all(e.sessionIds.map(f=>_.w(function*(){yield NA(c,f);RA.debug("successfully removed session with id",f)}))),yield b.delete(a)):RA.debug("No persistent DRM session found")}catch(e){throw RA.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 RA.warn("Invalid offlineId")})});_.x("clpp.persistent.getSessionStorage",function(){return QA});var QA=new TA,RA=new _.S(GA);_.x("clpp.persistent.PersistentLicenseComponent",class extends _.uv{constructor(){super();this.g=new _.S(GA)}id(){return _.Re}l(a,b){const c=this;return _.w(function*(){const d=a.getConfiguration().drm;if(d){c.g.debug(`Persisting DRM session ID: ${d.offlineId}`);var e=a.getNetworkEngine();try{yield SA(d,b,e),a.trigger(new _.C(_.Md,{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 _.w(function*(){b.g.debug(`Getting EME session IDs for ${a}`);
|
|
11
|
+
const c=QA;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 _.
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var BA=function(a,b){return 0<=b&&b<a.a.length},CA=function(a){a.trigger(new _.C(_.gf))},DA=class extends _.nu{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.za.bind(this)}getPosition(){return this.f}wh(){return this.a}bd(){return 0<this.a.length&&BA(this,this.f)?this.a[this.f]:null}xh(){const a=this.f+1;return 0<
|
|
2
|
+
this.a.length&&BA(this,a)?this.a[a]:null}Hh(){return this.h}start(){this.h||(this.h=!0,this.m.on(_.Td,this.j),this.Od(this.f,!0))}stop(){this.h=!1;this.m.off(_.Td,this.j)}za(){this.next()}next(){const a=this;return _.w(function*(){yield a.Od(Math.min(a.a.length-1,a.f+1))})}$h(){const a=this;return _.w(function*(){yield a.Od(Math.max(0,a.f-1))})}Od(a,b){b=void 0===b?!1:b;const c=this;return _.w(function*(){if(0<c.a.length&&BA(c,a)&&(b||c.f!==a)){c.f=a;var d=c.bd();d&&(yield c.l(d),yield c.m.load(d.configuration),
|
|
3
|
+
c.trigger(new _.C(_.ff,{item:d})))}})}append(a){this.a.push(a);CA(this)}Fh(a,b){if(0<=b&&b<=this.a.length){const c=this.bd();this.a.splice(b,0,a);c&&(this.f=this.a.indexOf(c));CA(this)}}remove(a){if(0<this.a.length&&BA(this,a)){if(this.f===a)throw Error("Can't remove the current item");this.a.splice(a,1);CA(this)}}clear(){this.stop();this.f=0;this.a=[];this.h=!1;CA(this)}};_.x("clpp.Playlist",DA);DA.prototype.clear=DA.prototype.clear;DA.prototype.remove=DA.prototype.remove;DA.prototype.insert=DA.prototype.Fh;
|
|
4
|
+
DA.prototype.append=DA.prototype.append;DA.prototype.goTo=DA.prototype.Od;DA.prototype.previous=DA.prototype.$h;DA.prototype.next=DA.prototype.next;DA.prototype.onEnded=DA.prototype.za;DA.prototype.stop=DA.prototype.stop;DA.prototype.start=DA.prototype.start;DA.prototype.isStarted=DA.prototype.Hh;DA.prototype.getUpcoming=DA.prototype.xh;DA.prototype.getCurrent=DA.prototype.bd;DA.prototype.getQueue=DA.prototype.wh;DA.prototype.getPosition=DA.prototype.getPosition;DA.prototype.off=DA.prototype.off;
|
|
5
|
+
DA.prototype.one=DA.prototype.one;DA.prototype.on=DA.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 wz="apiUrl config is missing",xz=function(a,b){a.l=a.l.filter(c=>c!==b)},yz=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]},Dz=function(a,b,c,d){if(!(null===c||void 0===c||typeof c===_.r&&0===c||typeof c===_.Qf&&0===c.length||Array.isArray(c)&&0===c.length))if(Array.isArray(c)){zz(a,b<<3|2);b=new Az;for(let e=0;e<c.length;e++)d(b,c[e]);Bz(a,b.length());Cz(a,b.end())}else zz(a,
|
|
2
|
+
b<<3|0),d(a,c)},Bz=function(a,b){if(0<=b)zz(a,b);else{for(let c=0;9>c;c++)a.a.push(b&127|128),b>>=7;a.a.push(1)}},Ez=function(a,b,c){Dz(a,b,c,(d,e)=>{Bz(d,e)})},zz=function(a,b){for(;127<b;)a.a.push(b&127|128),b>>>=7;a.a.push(b)},Gz=function(a,b,c){Dz(a,b,c,(d,e)=>{if(0<=e){{const [f,g]=yz(e);Fz(d,f,g)}}else{{const [f,g]=yz(e);Fz(d,f,g)}}})},Hz=function(a,b,c,d){if(!(null===c||void 0===c||typeof c===_.r&&0===c||typeof c===_.Qf&&0===c.length||Array.isArray(c)&&0===c.length))if(Array.isArray(c))for(let e=
|
|
3
|
+
0;e<c.length;e++){zz(a,b<<3|2);const f=new Az;d(f,c[e]);Bz(a,f.length());Cz(a,f.end())}else zz(a,b<<3|2),b=new Az,d(b,c),Bz(a,b.length()),Cz(a,b.end())},Iz=function(a,b,c){Hz(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)}})},Cz=function(a,b){a.a.push.apply(a.a,b)},Jz=function(a,b,c){Hz(a,b,c,(d,e)=>{Cz(d,e.a())})},Kz=function(a,b,c){Hz(a,b,c,(d,e)=>{Cz(d,e)})},Fz=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)},Mz=function(a){const b=new Lz;b.h=Math.floor(a/1E3);b.f=a%1E3*1E6;return b},Qz=function(a){return _.w(function*(){if(!a.j&&!a.f){0===a.a.length&&Nz(a,new Oz);var b=()=>
|
|
5
|
+
{};a.f=new Promise(c=>{b=c});try{const c=new Pz;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}}})},Tz=function(a,b,c,d,e,f,g){const h=new Rz;h.headers=[new Sz("CL-BROWSER-NAME",b),new Sz("CL-BROWSER-VERSION",
|
|
6
|
+
c),new Sz("CL-OS-FAMILY",d),new Sz("CL-OS-VERSION",e),new Sz("CL-SDK-NAME",f),new Sz("CL-SDK-NAME",f),new Sz("CL-SDK-VERSION",g)];Nz(a,h)},Nz=function(a,b){if(!a.j){var c=new Uz(a.w);c.sessionId=a.A;{var d=Date.now();const e=new Vz;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)}},Wz=function(a){return _.w(function*(){a.h&&(clearInterval(a.h),a.h=null);a.f&&(yield a.f);0<a.a.length&&(yield Qz(a),a.a=[]);a.j=!0})},Xz=function(a){_.w(function*(){a.g.info("Destroy the session and stop sending events.");
|
|
7
|
+
_.Hh(a.a);a.Y=!1;const b=a.m.getNetworkEngine();b.Se(a.l);b.td(a.h);xz(b,a.h);a.f&&(yield Wz(a.f),a.f=null)})},eA=function(a){switch(a){case _.pp:return Yz;case _.qp:return Zz;case _.lp:return $z;case _.sp:return aA;case _.rp:return bA;case _.hp:return cA;case _.ip:return dA;default:return null}},fA=function(a,b){a.g.debug("Sending event",b);Nz(a.f,b)},nA=function(a,b){switch(a){case 1:return gA;case 2:return b===_.t?hA:b===_.q?iA:b===_.H?jA:b===_.ee?kA:lA;case 3:return mA;default:return lA}};var Az=class{constructor(){this.a=[]}length(){return this.a.length}end(){const a=this.a;this.a=[];return a}};var oA=class{constructor(a,b,c,d){this.downloadId=a;this.h=b;this.duration=c;this.j=d;this.f=[]}a(){const a=new Az;Jz(a,1,this.downloadId);Ez(a,2,this.h);Jz(a,3,this.duration);Ez(a,4,this.j);Jz(a,5,this.f);return a.end()}getId(){return 4}};var pA=class{constructor(a,b){this.f=a;this.url=b;this.downloadId=null;this.headers=[];this.size=this.duration=null}a(){const a=new Az;Ez(a,1,this.f);Jz(a,2,this.downloadId);Iz(a,3,this.url);Jz(a,4,this.headers);Iz(a,5,null);Jz(a,6,null);Jz(a,7,this.duration);Gz(a,8,this.size);return a.end()}getId(){return 2}};var qA=class{constructor(a,b){this.h=a;this.f=b}a(){const a=new Az;Ez(a,1,this.h);Kz(a,2,this.f);return a.end()}};var rA=class{constructor(a){this.cause=a;this.f=this.message=this.severity=this.errorCode=null}a(){const a=new Az;Ez(a,1,this.errorCode);Ez(a,2,this.severity);Iz(a,3,this.message);Iz(a,4,this.f);Jz(a,5,this.cause);return a.end()}getId(){return 7}};var Sz=class{constructor(a,b){this.key=a;this.value=b}a(){const a=new Az;Iz(a,1,this.key);Iz(a,2,this.value);return a.end()}};var sA=class{constructor(){this.cause=this.severity=this.code=null}a(){const a=new Az;Ez(a,1,this.code);Ez(a,2,this.severity);Jz(a,3,this.cause);return a.end()}getId(){return 12}};var tA=class{constructor(){this.data=null}a(){const a=new Az;Kz(a,1,this.data);return a.end()}};var uA=class extends tA{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 Rz=class{constructor(){this.headers=[]}a(){const a=new Az;Jz(a,1,this.headers);return a.end()}getId(){return 1}};var Oz=class{constructor(){}a(){return(new Az).end()}getId(){return 6}};var Uz=class{constructor(a){this.j=a;this.f=this.h=this.time=this.sessionId=null}a(){const a=new Az;Jz(a,1,this.j);Jz(a,2,this.sessionId);Jz(a,3,this.time);Gz(a,4,null);Iz(a,5,null);Ez(a,6,this.h);Kz(a,7,this.f);return a.end()}};var Pz=class{constructor(){this.f=null;this.events=[]}a(){const a=new Az;Kz(a,1,this.f);Jz(a,2,this.events);return a.end()}};var Vz=class{constructor(){this.f=this.h=null}a(){const a=new Az;Gz(a,1,this.h);Ez(a,2,this.f);return a.end()}};var Lz=class{constructor(){this.f=this.h=null}a(){const a=new Az;Gz(a,1,this.h);Ez(a,2,this.f);return a.end()}};var vA=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 uA;this.A=new uA;this.a=[];this.h=setInterval(()=>Qz(this),k);this.f=null;this.j=!1;Tz(this,b,c,d,e,f,g)}};var wA=class{constructor(){this.reason=this.currentState=this.previousState=null}a(){const a=new Az;Ez(a,1,this.previousState);Ez(a,2,this.currentState);Ez(a,3,this.reason);Jz(a,4,null);Jz(a,5,null);Jz(a,6,null);return a.end()}getId(){return 5}};var AA=class extends _.Iv{constructor(){super();this.m=null;this.Y=this.j=!1;this.a=new _.Kt;this.f=null;this.g=new _.S("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!==_.Fe))||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=_.ok(),this.f=new vA(new Uint8Array([]),a.browser,a.browserVersion.name,a.os,a.osVersion.name,"prestoplay-web",_.ea,b.apiUrl),this.a.on(this.m,_.Nf,this.B.bind(this)),this.a.on(this.m,_.Ff,this.A.bind(this)),this.a.on(this.m,_.Ef,this.w.bind(this)),this.a.on(this.m,_.Ud,this.o.bind(this)),a=this.m.getNetworkEngine(),a.me(this.l),a.Ac(this.h),a.l.push(this.h)):(this.g.warn(wz),a.onError(new _.I(1,9,15E3,wz)))}onPlayerWillRelease(){Xz(this)}id(){return"sessions"}B(a){if(!this.Y){a=a.detail;var b=
|
|
9
|
+
a.currentState,c=new wA;c.previousState=eA(a.previousState);c.currentState=eA(b);fA(this,c)}}A(){if(!this.Y){var a=new wA;a.previousState=eA(this.m.getState());a.currentState=xA;fA(this,a);this.Y=!0}}w(){if(this.Y){var a=new wA;a.previousState=xA;a.currentState=eA(this.m.getState());fA(this,a);this.Y=!1}}o(a){a=a.detail;var b=new sA;b=new rA(new qA(b.getId(),new Uint8Array(b.a())));b.errorCode=a.code;b.message=a.message;b.f=a.stack;b.severity=a.severity===_.F?yA:zA;fA(this,b)}F(a){const b=new uA;
|
|
10
|
+
a.downloadId=b;const c=new pA(nA(a.type,a.contentType),a.uris[0]);c.downloadId=b;c.headers=Object.keys(a.headers).map(d=>new Sz(d,a.headers[d]));fA(this,c)}C(a){var b=a.request.downloadId;b?(b=new oA(b,a.data.byteLength,Mz(a.timeMs||0),a.status||-1),b.f=Object.keys(a.headers).map(c=>new Sz(c,a.headers[c])),fA(this,b)):this.g.warn("Download ID is missing on download completed event.")}};_.fs(new class{create(){return new AA}});var zA=1,yA=2;var Yz=0,Zz=2,dA=3,xA=5,$z=6,aA=8,bA=10,cA=11;var gA=0,hA=1,iA=2,jA=3,kA=4,mA=5,lA=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 _.
|
|
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 fz="No surface found. Can not attach frame!",gz="SIMID:Media:timeupdate",hz="Starting creative",iz=function(a,b,c){return{type:b,sessionId:a.h,messageId:a.l++,timestamp:Date.now(),args:c}},lz=function(a,b){return new Promise((c,d)=>{new jz(a.j,c,d,b);kz(a,b)})},mz=function(a){const b=iz(a,"SIMID:Player:startCreative",void 0);lz(a,b).then(()=>{var c=a.f;c.g.info(hz);c.m.trigger(new _.C(_.Hf));a.a.style.opacity="1"}).catch(c=>{a.unload();a.f.g.error("Error while starting creative",
|
|
2
|
+
c)})},oz=function(a,b){_.w(function*(){a.h=b.sessionId;nz(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=iz(a,"SIMID:Player:init",d);var e=lz(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()}})},nz=function(a,b){kz(a,iz(a,"resolve",{messageId:b.messageId,
|
|
4
|
+
value:void 0}))},kz=function(a,b){a.h?(b.type!==gz&&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}'`)},pz=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=iz(d,"SIMID:Player:resize",e);kz(d,e)}})},qz=function(a,b){a.g.info("SIMID Session created");a.a=b},rz=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 _.C(_.If))},sz=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}%`}},tz=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=_.Ee,this.a.style.backgroundColor="transparent",this.a.style.transition=
|
|
7
|
+
"opacity .5s",this.a.style.transitionDelay=".5s",this.a.style.pointerEvents=_.Ee,this.a.style.overflow=_.be);this.a.classList.add(_.Zc);this.o=c=>{if(c.source===this.a.contentWindow&&(c=(c=c.data)?typeof c===_.Qf?JSON.parse(c):c:null))if(c.type)switch(this.g.info(`Received message [${c.messageId}] '${c.type}':`,c.args),c.type){case "createSession":oz(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=sz(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=sz(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);nz(this,c)}else this.g.warn("WARNING: received message without 'type' property")};this.g=new _.S("clpp.simid.SimidPlayer");qz(this.f,this)}load(a){window.addEventListener(_.ue,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(){rz(this.f);
|
|
10
|
+
this.h=this.a.src="";this.l=0;this.a.style.opacity="0";window.removeEventListener(_.ue,this.o);this.a.parentElement&&this.a.parentElement.removeChild(this.a)}},jz=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 vz=class extends _.Iv{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 uz(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 tz(this.h,b.simid),b=c.getContainer(),this.j=pz(this,b,c),this.j.observe(b),a.on(_.cg,this.w)):this.g.warn(fz)}}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&&(mz(this.a),this.o=!0,this.g.info(hz)),
|
|
13
|
+
c&&(c=this.a,kz(c,iz(c,gz,{currentTime:a-b}))))):((a=this.m.getSurface())||this.g.warn(fz),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(_.cg,this.w),this.f&&(this.a.unload(),this.f=this.h.f=null))}},uz=class{constructor(a){this.m=a;this.a=null;this.g=new _.S("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}Tf(){return this.a}url(){return this.f?this.f.url:""}};_.fs(new class{create(){return new vz}});};f.call(g, window);
|