@castlabs/prestoplay 6.30.0 → 6.31.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.
Files changed (65) hide show
  1. package/CHANGELOG.md +247 -179
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +19 -7
  5. package/cjs/cl.cast.js +120 -120
  6. package/cjs/cl.conviva.js +31 -31
  7. package/cjs/cl.core.js +567 -566
  8. package/cjs/cl.crypto.js +10 -10
  9. package/cjs/cl.dash.js +95 -92
  10. package/cjs/cl.externs.js +224 -40
  11. package/cjs/cl.freewheel.js +26 -25
  12. package/cjs/cl.hls.js +79 -78
  13. package/cjs/cl.hlssmpte.js +4 -4
  14. package/cjs/cl.htmlcue.js +19 -19
  15. package/cjs/cl.ima.js +26 -25
  16. package/cjs/cl.mediatailor.js +3 -3
  17. package/cjs/cl.mse.js +352 -350
  18. package/cjs/cl.muxdata.js +13 -13
  19. package/cjs/cl.onboard.js +2 -2
  20. package/cjs/cl.persistent.js +13 -13
  21. package/cjs/cl.playlist.js +6 -6
  22. package/cjs/cl.simid.js +10 -10
  23. package/cjs/cl.smooth.js +71 -71
  24. package/cjs/cl.thumbnails.js +16 -16
  25. package/cjs/cl.tizen.js +72 -72
  26. package/cjs/cl.ttml.js +15 -15
  27. package/cjs/cl.verimatrix.js +5 -5
  28. package/cjs/cl.vimond.js +11 -11
  29. package/cjs/cl.vr.js +12 -12
  30. package/cjs/cl.vtt.js +12 -12
  31. package/cjs/cl.yospace.js +4 -4
  32. package/cjs/cl.youbora.js +35 -35
  33. package/cl.adobe.js +3 -3
  34. package/cl.airplay.js +3 -3
  35. package/cl.broadpeak.js +14 -6
  36. package/cl.cast.js +99 -98
  37. package/cl.conviva.js +26 -26
  38. package/cl.core.js +413 -412
  39. package/cl.crypto.js +8 -8
  40. package/cl.dash.js +87 -84
  41. package/cl.externs.js +225 -37
  42. package/cl.freewheel.js +20 -19
  43. package/cl.hls.js +76 -76
  44. package/cl.hlssmpte.js +5 -5
  45. package/cl.htmlcue.js +26 -26
  46. package/cl.ima.js +20 -19
  47. package/cl.mediatailor.js +2 -2
  48. package/cl.mse.js +299 -300
  49. package/cl.muxdata.js +12 -12
  50. package/cl.onboard.js +4 -4
  51. package/cl.persistent.js +10 -10
  52. package/cl.playlist.js +5 -5
  53. package/cl.simid.js +14 -14
  54. package/cl.smooth.js +62 -60
  55. package/cl.thumbnails.js +17 -17
  56. package/cl.tizen.js +55 -55
  57. package/cl.ttml.js +22 -22
  58. package/cl.verimatrix.js +4 -4
  59. package/cl.vimond.js +8 -8
  60. package/cl.vr.js +15 -15
  61. package/cl.vtt.js +12 -12
  62. package/cl.yospace.js +3 -3
  63. package/cl.youbora.js +31 -31
  64. package/package.json +8 -7
  65. package/typings.d.ts +85 -61
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 Zz=function(a){switch(a.type){case 1:return Wz;case 2:return Xz;case 3:return Yz}},aA=function(a){const b=Object.keys(a).find(c=>$z.includes(c.toLowerCase()));return void 0!==b?a[b]:void 0},cA=function(a){let b={debug:!0,data:bA(a)};a.f&&a.f.muxOptionsOverride&&_.gh(a.f.muxOptionsOverride)&&(b=_.ch(b,a.f.muxOptionsOverride));b=_.ch(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 _.gp(c.url);e.video_source_url=_.Nm(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().ra(),
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.pa())&&d.language&&(e.player_language_code=d.language)}return e}});a.g.debug("Mux SDK options",b);return b},dA=function(a){_.Xh(a.a);a.j.we(a.F);a.j.Rg(a.C)},bA=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},eA=function(a){a.a.on(a.m,_.fg,()=>{const b={player_playhead_time:1E3*a.m.getPosition()};a.emit(_.fg,b)});a.a.on(a.m,_.We,()=>a.emit(_.We));a.a.on(a.m,_.Mc,a.G.bind(a));a.a.on(a.m,_.Qf,a.I.bind(a));a.a.on(a.m,_.tg,()=>a.emit(_.If));a.a.on(a.m,_.sg,()=>a.emit(_.Hf));a.a.on(a.m,_.Xd,a.H.bind(a));a.a.on(a.m,_.Tb,()=>a.emit("adbreakstart"));a.a.on(a.m,_.Ub,()=>a.emit("adbreakend"));a.a.on(a.m,_.lc,()=>
5
- {a.emit("adplay");a.emit("adplaying")});a.a.on(a.m,_.hc,()=>a.emit("adpause"));a.a.on(a.m,_.jc,()=>{a.emit("adplay");a.emit("adplaying")});a.a.on(a.m,_.mc,()=>a.emit("adended"));a.a.on(a.m,_.Yb,()=>a.emit("adfirstquartile"));a.a.on(a.m,_.gc,()=>a.emit("admidpoint"));a.a.on(a.m,_.nc,()=>a.emit("adthirdquartile"));a.j.bd(a.F);a.j.Lf(a.C);a.a.on(a.m,_.Xd,b=>{if((b=b.detail)&&1===b.category){var c=b.data;c=c&&c.request;if(void 0!==c&&!0===(1===c.type||2===c.type||3===c.type))if(7001===b.code){b=c;c=b.requestStartTimestamp;
6
- var d=new _.gp(b.uris[b.uriIndex]);b={request_start:c,request_type:Zz(b),request_hostname:d.a};a.g.debug("onRequestCanceled()","Track event: requestcanceled",b);a.emit("requestcanceled",b)}else{{d=c.requestStartTimestamp;const f=new _.gp(c.uris[c.uriIndex]);var e=b.data;e=void 0===e?-1:void 0!==e.response?e.response.status:void 0!==e.status?e.status:-1;b={request_start:d,request_type:Zz(c),request_hostname:f.a,request_error:`${Zz(c)}${"LoadError"}`,request_error_code:e,request_error_text:b.toString()};
7
- a.g.debug("onRequestFailed()","Track event: requestfailed",b);a.emit("requestfailed",b)}}}})},fA=function(a,b){a.trigger(new _.H(_.Xd,{detail:b}))},gA=function(a){return!_.z(a)&&typeof a.init===_.ae&&typeof a.emit===_.ae},Wz="manifest",Xz="media",Yz="encryption",$z=["x-request-id","cf-ray","x-amz-cf-id","x-akamai-request-id"];var hA=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,cA(this))}catch(d){throw this.h=!1,dA(this),new _.I(1,9,9302,null,d);}this.emit("playerready")}this.l&&!this.A&&(a=bA(this),this.emit("videochange",
8
- a),this.l=!1);eA(this)}release(){this.g.debug("release()");this.l?this.g.debug(_.ja):(dA(this),this.l=!0,this.o=this.f=null)}destroy(){this.g.debug(_.Dd);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(_.Ie);var b=a.detail;a=this.m.getTrackManager();b&&b.bandwidth&&(b=b.bandwidth,(a=a.Na())&&a.bandwidth&&(b+=a.bandwidth),this.emit("renditionchange",{video_source_bitrate:b}))}I(a){this.g.debug(_.Ne);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var $z=function(a){switch(a.type){case 1:return Xz;case 2:return Yz;case 3:return Zz}},bA=function(a){const b=Object.keys(a).find(c=>aA.includes(c.toLowerCase()));return void 0!==b?a[b]:void 0},dA=function(a){let b={debug:!0,data:cA(a)};a.f&&a.f.muxOptionsOverride&&_.gh(a.f.muxOptionsOverride)&&(b=_.ch(b,a.f.muxOptionsOverride));b=_.ch(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 _.gp(c.url);e.video_source_url=_.Mm(k);e.video_source_mime_type=c.type;c.name&&(e.video_title=c.name)}if(c=f.getContainer())e.player_width=c.offsetWidth,e.player_height=c.offsetHeight;(c=a.m.getSurface().getMedia())?c={videoWidth:c.videoWidth,videoHeight:c.videoHeight}:(c=a.m.getTrackManager().ta(),
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},eA=function(a){_.Xh(a.a);a.j.ze(a.F);a.j.Rg(a.C)},cA=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},fA=function(a){a.a.on(a.m,_.fg,()=>{const b={player_playhead_time:1E3*a.m.getPosition()};a.emit(_.fg,b)});a.a.on(a.m,_.We,()=>a.emit(_.We));a.a.on(a.m,_.Mc,a.G.bind(a));a.a.on(a.m,_.Qf,a.I.bind(a));a.a.on(a.m,_.tg,()=>a.emit(_.If));a.a.on(a.m,_.sg,()=>a.emit(_.Hf));a.a.on(a.m,_.Xd,a.H.bind(a));a.a.on(a.m,_.Tb,()=>a.emit("adbreakstart"));a.a.on(a.m,_.Ub,()=>a.emit("adbreakend"));a.a.on(a.m,_.lc,()=>
5
+ {a.emit("adplay");a.emit("adplaying")});a.a.on(a.m,_.gc,()=>a.emit("adpause"));a.a.on(a.m,_.jc,()=>{a.emit("adplay");a.emit("adplaying")});a.a.on(a.m,_.mc,()=>a.emit("adended"));a.a.on(a.m,_.Yb,()=>a.emit("adfirstquartile"));a.a.on(a.m,_.dc,()=>a.emit("admidpoint"));a.a.on(a.m,_.nc,()=>a.emit("adthirdquartile"));a.j.md(a.F);a.j.Nf(a.C);a.a.on(a.m,_.Xd,b=>{if((b=b.detail)&&1===b.category){var c=b.data;c=c&&c.request;if(void 0!==c&&!0===(1===c.type||2===c.type||3===c.type))if(7001===b.code){b=c;c=b.requestStartTimestamp;
6
+ var d=new _.gp(b.uris[b.uriIndex]);b={request_start:c,request_type:$z(b),request_hostname:d.a};a.g.debug("onRequestCanceled()","Track event: requestcanceled",b);a.emit("requestcanceled",b)}else{{d=c.requestStartTimestamp;const f=new _.gp(c.uris[c.uriIndex]);var e=b.data;e=void 0===e?-1:void 0!==e.response?e.response.status:void 0!==e.status?e.status:-1;b={request_start:d,request_type:$z(c),request_hostname:f.a,request_error:`${$z(c)}${"LoadError"}`,request_error_code:e,request_error_text:b.toString()};
7
+ a.g.debug("onRequestFailed()","Track event: requestfailed",b);a.emit("requestfailed",b)}}}})},gA=function(a,b){a.trigger(new _.H(_.Xd,{detail:b}))},hA=function(a){return!_.z(a)&&typeof a.init===_.ae&&typeof a.emit===_.ae},Xz="manifest",Yz="media",Zz="encryption",aA=["x-request-id","cf-ray","x-amz-cf-id","x-akamai-request-id"];var iA=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 _.Lt;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,dA(this))}catch(d){throw this.h=!1,eA(this),new _.I(1,9,9302,null,d);}this.emit("playerready")}this.l&&!this.A&&(a=cA(this),this.emit("videochange",
8
+ a),this.l=!1);fA(this)}release(){this.g.debug("release()");this.l?this.g.debug(_.ia):(eA(this),this.l=!0,this.o=this.f=null)}destroy(){this.g.debug(_.Dd);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(_.Ie);var b=a.detail;a=this.m.getTrackManager();b&&b.bandwidth&&(b=b.bandwidth,(a=a.Qa())&&a.bandwidth&&(b+=a.bandwidth),this.emit("renditionchange",{video_source_bitrate:b}))}I(a){this.g.debug(_.Ne);
9
9
  switch(a.detail.currentState){case 1:this.m.getConfiguration().autoplay&&this.emit(_.We);break;case 3:this.emit(_.gf);break;case 4:this.emit(_.Se);break;case 5:this.emit(_.Wd)}}H(a){this.g.debug(_.Ke);if(this.h&&(a=a.detail||null))if(10003===a.code)this.emit("aderror");else if(a.severity===_.D){var b=a.message||"Player error";if(1===a.category||6100===a.code||6007===a.code)b="Download error",6100===a.code?b="Certificate request error":6007===a.code&&(b="License request error"),b=`${b} castlabs-error-data:${JSON.stringify(a.data)}`;
10
- this.emit(_.Xd,{player_error_code:a.code,player_error_message:b})}}K(a){var b=a.request;if(b=void 0!==b&&!0===(1===b.type||2===b.type||3===b.type))b=a.status,b=void 0!==b&&200<=b&&299>=b;if(b){{b=a.request;const e=a.headers,f=b.bytesLoaded,g=b.requestStartTimestamp;var c=b.startTime,d=b.endTime;const h=g+a.responseStartMs;a=g+a.timeMs;c=c&&d?d-c:void 0;d=new _.gp(b.uris[b.uriIndex]);a={request_start:g,request_type:Zz(b),request_hostname:d.a,request_id:aA(e),request_bytes_loaded:f,request_response_start:h,
11
- request_response_end:a,request_response_headers:e,request_media_duration:c,request_url:_.Nm(d)};this.g.debug("onRequestCompleted()","Track event: requestcompleted",a);this.emit("requestcompleted",a)}}}J(a){a.requestStartTimestamp=Date.now()}};var iA=class extends _.Ov{constructor(){super();this.f=this.m=null;this.a=!1;this.g=new _.T("clpp.muxdata")}onPlayerCreated(a){this.m=a;this.f=new hA(a,this.g)}onContentWillLoad(a,b){var c=a.getConfiguration();c=_.dh(c.muxdata);try{var d=[];typeof c===_.He&&(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===_.He){const g=f.muxdata;d=gA(g.muxLib)?g.muxLib:window.mux;if(!gA(d)){this.g.warn("Mux SDK is not loaded. Will do nothing.");
12
- this.a=!1;const h=new _.I(1,9,9301);fA(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,fA(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&&fA(this.m,c),c;}}};_.x("clpp.muxdata.MuxDataPlugin",iA);iA.prototype.emit=iA.prototype.emit;
13
- iA.Id="mux";_.Qn(new class{create(){return new iA}});};f.call(g, window);
10
+ this.emit(_.Xd,{player_error_code:a.code,player_error_message:b})}}K(a){var b=a.request;if(b=void 0!==b&&!0===(1===b.type||2===b.type||3===b.type))b=a.status,b=void 0!==b&&200<=b&&299>=b;if(b){{b=a.request;const e=a.headers,f=b.bytesLoaded,g=b.requestStartTimestamp;var c=b.startTime,d=b.endTime;const h=g+a.responseStartMs;a=g+a.timeMs;c=c&&d?d-c:void 0;d=new _.gp(b.uris[b.uriIndex]);a={request_start:g,request_type:$z(b),request_hostname:d.a,request_id:bA(e),request_bytes_loaded:f,request_response_start:h,
11
+ request_response_end:a,request_response_headers:e,request_media_duration:c,request_url:_.Mm(d)};this.g.debug("onRequestCompleted()","Track event: requestcompleted",a);this.emit("requestcompleted",a)}}}J(a){a.requestStartTimestamp=Date.now()}};var jA=class extends _.Pv{constructor(){super();this.f=this.m=null;this.a=!1;this.g=new _.T("clpp.muxdata")}onPlayerCreated(a){this.m=a;this.f=new iA(a,this.g)}onContentWillLoad(a,b){var c=a.getConfiguration();c=_.dh(c.muxdata);try{var d=[];typeof c===_.He&&(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===_.He){const g=f.muxdata;d=hA(g.muxLib)?g.muxLib:window.mux;if(!hA(d)){this.g.warn("Mux SDK is not loaded. Will do nothing.");
12
+ this.a=!1;const h=new _.I(1,9,9301);gA(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,gA(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&&gA(this.m,c),c;}}};_.x("clpp.muxdata.MuxDataPlugin",jA);jA.prototype.emit=jA.prototype.emit;
13
+ jA.Id="mux";_.Pn(new class{create(){return new jA}});};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 Vz=function(a,b){let c=b.baseUrl;_.vi(c,"/")||(c+="/");var d=h=>h&&(_.ui(h,_.fe)||_.ui(h,"http://")||_.ui(h,"//"))?h:`${c}${h}`;const e=d(b.widevineUrl||"widevine"),f=d(b.playreadyUrl||"playready");d=d(b.fairplayUrl||"fairplay");b=b.serverCertificate;const g=_.Oo("V2");a=new _.yu(a);a.Ya(_.wd,{licenseUrl:e,videoRobustness:[_.pb,void 0],audioRobustness:[_.ob,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:_.Po(b,g),modifiers:{licenseRequest:_.vp,
2
- licenseResponse:_.wp}});a.Ya(_.sd,{licenseUrl:d,certificateUrl:d,modifiers:{licenseRequest:_.yp,licenseResponse:_.zp,extractContentId:_.Ap,certificateRequest:_.Bp}});a.Ya(_.ud,{licenseUrl:f,modifiers:{licenseRequest:_.vp}});_.kn(a)};
3
- _.x("clpp.onboard.OnboardComponent",class extends _.yv{constructor(){super();this.g=new _.T("clpp.onboard");this.a=new Set}uninstall(){for(const a of this.a)delete _.jn[a];this.a.clear()}beforeLoad(a){a=a.getConfiguration().drm;var b;if(b=!(!a||!a.env))b=a&&a.customData,b=!(!b||!b.baseUrl);b&&(b=a.env,a=a.customData,a={baseUrl:a.baseUrl,widevineUrl:a.widevineUrl,serverCertificate:a.serverCertificate,playreadyUrl:a.playreadyUrl,fairplayUrl:a.fairplayUrl},this.g.info(`Registering the DRMtoday Onboard environment, name='${b}'`),
4
- Vz(b,a),this.a.add(b))}id(){return"onboard"}});_.x("clpp.onboard.register",Vz);};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Wz=function(a,b){let c=b.baseUrl;_.vi(c,"/")||(c+="/");var d=h=>h&&(_.ui(h,_.fe)||_.ui(h,"http://")||_.ui(h,"//"))?h:`${c}${h}`;const e=d(b.widevineUrl||"widevine"),f=d(b.playreadyUrl||"playready");d=d(b.fairplayUrl||"fairplay");b=b.serverCertificate;const g=_.Oo("V2");a=new _.zu(a);a.ib(_.wd,{licenseUrl:e,videoRobustness:[_.pb,void 0],audioRobustness:[_.ob,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:_.Po(b,g),modifiers:{licenseRequest:_.vp,
2
+ licenseResponse:_.wp}});a.ib(_.sd,{licenseUrl:d,certificateUrl:d,modifiers:{licenseRequest:_.yp,licenseResponse:_.zp,extractContentId:_.Ap,certificateRequest:_.Bp}});a.ib(_.ud,{licenseUrl:f,modifiers:{licenseRequest:_.vp}});_.jn(a)};
3
+ _.x("clpp.onboard.OnboardComponent",class extends _.zv{constructor(){super();this.g=new _.T("clpp.onboard");this.a=new Set}uninstall(){for(const a of this.a)delete _.hn[a];this.a.clear()}beforeLoad(a){a=a.getConfiguration().drm;var b;if(b=!(!a||!a.env))b=a&&a.customData,b=!(!b||!b.baseUrl);b&&(b=a.env,a=a.customData,a={baseUrl:a.baseUrl,widevineUrl:a.widevineUrl,serverCertificate:a.serverCertificate,playreadyUrl:a.playreadyUrl,fairplayUrl:a.fairplayUrl},this.g.info(`Registering the DRMtoday Onboard environment, name='${b}'`),
4
+ Wz(b,a),this.a.add(b))}id(){return"onboard"}});_.x("clpp.onboard.register",Wz);};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 Gz="A persistent DRM session already exists for: ",Hz="No DRM configuration.",Iz="clpp.persistent",Jz="clpp.persistent.SimpleSessionStorage",Lz=function(a,b,c,d,e,f){a.K=Kz;const g=new Map,h=_.kq(b);g.set(h,{audioCapabilities:e,videoCapabilities:f,distinctiveIdentifier:_.Pe,persistentState:_.zf,sessionTypes:[_.Ue],label:h,drmInfos:[{keySystem:b,licenseServerUri:c,distinctiveIdentifierRequired:!1,persistentStateRequired:!0,audioRobustness:"",videoRobustness:"",serverCertificate:d,
2
- initData:null,keyIds:null}]});return _.Cq(a,g)},Nz=function(a,b){a.K=Mz;a.L=[];a.G=!0;return _.Dq(a,b)},Oz=function(a,b){return _.w(function*(){const c=yield _.Uq(a,b);if(c){var d=[],e=a.h.get(c);e&&a.C&&(e.mc=new _.Hl,d.push(e.mc));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)})},Pz=function(a){const b=[];for(const c of a.h.keys())b.push(c.sessionId);return b},Qz=function(a,b){const c=_.mn(a),d=_.bn([{drm:a}]);
3
- d.drm=a;a=new _.Cs({vb:b,onError:()=>{},af:()=>{},$e:()=>{},onEvent:()=>{},getConfiguration:()=>d,Qc:()=>null});a.f=c;return a},Tz=function(a,b,c){return _.w(function*(){const d=Rz;if(a){var e=a.offlineId;if(0!==e.length){var f=yield d.get(e);if(f)Sz.debug(Gz,e);else{var g=Qz(a,c);try{yield Nz(g,b);yield _.Sq(g);yield _.Vq(g);const h=g.getDrmInfo(),k=b.map(l=>({contentType:_.Um(l.video.mimeType,l.video.codecs),robustness:h.videoRobustness}));f={sessionIds:Pz(g),keySystem:h.keySystem,licenseServerUri:h.licenseServerUri,
4
- serverCertificate:h.serverCertificate,audioCapabilities:[],videoCapabilities:k,drmConfig:a};yield d.store(e,f)}catch(h){throw Sz.error(`Error while persisting DRM session ${e}`),new _.I(1,6,6200,null,h);}finally{yield g.destroy()}}}}else Sz.debug(Hz)})},Mz=1,Kz=2,Uz=class{constructor(){this.g=new _.T(Jz)}store(a,b){return _.w(function*(){{var c=JSON.stringify(b.sessionIds);var d=b.serverCertificate?Array.from(b.serverCertificate):null;d=JSON.stringify(d);const e=JSON.stringify(b.audioCapabilities),
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Hz="A persistent DRM session already exists for: ",Iz="No DRM configuration.",Jz="clpp.persistent",Kz="clpp.persistent.SimpleSessionStorage",Mz=function(a,b,c,d,e,f){a.K=Lz;const g=new Map,h=_.kq(b);g.set(h,{audioCapabilities:e,videoCapabilities:f,distinctiveIdentifier:_.Pe,persistentState:_.zf,sessionTypes:[_.Ue],label:h,drmInfos:[{keySystem:b,licenseServerUri:c,distinctiveIdentifierRequired:!1,persistentStateRequired:!0,audioRobustness:"",videoRobustness:"",serverCertificate:d,
2
+ initData:null,keyIds:null}]});return _.Cq(a,g)},Oz=function(a,b){a.K=Nz;a.L=[];a.G=!0;return _.Dq(a,b)},Pz=function(a,b){return _.w(function*(){const c=yield _.Uq(a,b);if(c){var d=[],e=a.h.get(c);e&&a.C&&(e.nc=new _.Gl,d.push(e.nc));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)})},Qz=function(a){const b=[];for(const c of a.h.keys())b.push(c.sessionId);return b},Rz=function(a,b){const c=_.ln(a),d=_.an([{drm:a}]);
3
+ d.drm=a;a=new _.Ds({Ab:b,onError:()=>{},df:()=>{},cf:()=>{},onEvent:()=>{},getConfiguration:()=>d,Tc:()=>null});a.f=c;return a},Uz=function(a,b,c){return _.w(function*(){const d=Sz;if(a){var e=a.offlineId;if(0!==e.length){var f=yield d.get(e);if(f)Tz.debug(Hz,e);else{var g=Rz(a,c);try{yield Oz(g,b);yield _.Sq(g);yield _.Vq(g);const h=g.getDrmInfo(),k=b.map(l=>({contentType:_.Tm(l.video.mimeType,l.video.codecs),robustness:h.videoRobustness}));f={sessionIds:Qz(g),keySystem:h.keySystem,licenseServerUri:h.licenseServerUri,
4
+ serverCertificate:h.serverCertificate,audioCapabilities:[],videoCapabilities:k,drmConfig:a};yield d.store(e,f)}catch(h){throw Tz.error(`Error while persisting DRM session ${e}`),new _.I(1,6,6200,null,h);}finally{yield g.destroy()}}}}else Tz.debug(Iz)})},Nz=1,Lz=2,Vz=class{constructor(){this.g=new _.T(Kz)}store(a,b){return _.w(function*(){{var c=JSON.stringify(b.sessionIds);var d=b.serverCertificate?Array.from(b.serverCertificate):null;d=JSON.stringify(d);const e=JSON.stringify(b.audioCapabilities),
5
5
  f=JSON.stringify(b.videoCapabilities);c=JSON.stringify({sessionIds:c,keySystem:b.keySystem,licenseServerUri:encodeURIComponent(b.licenseServerUri),serverCertificate:d,audioCapabilities:e,videoCapabilities:f,drmConfig:JSON.stringify(b.drmConfig)})}window.localStorage.setItem(encodeURIComponent(a),btoa(c))})}get(a){const b=this;return _.w(function*(){const c=window.localStorage.getItem(encodeURIComponent(a));if(c)try{{const e=JSON.parse(atob(c)),f=JSON.parse(e.sessionIds),g=e.audioCapabilities||[],
6
- h=e.videoCapabilities||[],k=e.serverCertificate||[],l=e.drmConfig||{};var d={sessionIds:f,keySystem:e.keySystem,licenseServerUri:decodeURIComponent(e.licenseServerUri||""),serverCertificate:k?new Uint8Array(k):null,audioCapabilities:g,videoCapabilities:h,drmConfig:l}}return d}catch(e){b.g.warn(`Error while loading offline items for ${a} from storage: `,e)}return null})}delete(a){return _.w(function*(){window.localStorage.removeItem(encodeURIComponent(a))})}clear(){return _.w(function*(){window.localStorage.clear()})}getName(){return Jz}};_.x("clpp.persistent.useStorage",function(a){{var b=["store","get","delete","clear","getName"];const c=[];_.z(a)||(_.hh(a.store)||c.push("store"),_.hh(a.get)||c.push("get"),_.hh(a.delete)||c.push("delete"),_.hh(a.clear)||c.push("clear"),_.hh(a.getName)||c.push("getName"),b=c)}if(0<b.length)throw Sz.warn("Invalid session storage implementation"),new _.I(1,6,6202,{missingMethods:b});Rz=a});
7
- _.x("clpp.persistent.fetchLicense",function(a,b,...c){return _.w(function*(){var d=Rz,e=(l,m)=>new _.I(1,6,6200,l,m);const f=_.fn(a).shift();if(!f)throw e("No source specified.");if(!b)throw e(Hz);var g=b.offlineId;if(typeof g!==_.Tf||!g.length)throw e("Missing offline id.");if(yield d.get(g))Sz.debug(Gz,g);else{var h=_.$m();d=new _.En;g=[];for(var k of c){const l=new k;_.Kh(l.id())||(l.install(),_.Mh(l),g.push(l))}k=null;try{k=yield _.Ct(f.url,d,h.manifest.attemptParameters,f.type||null);k.configure(h.manifest);
8
- const l=yield k.start(f.url,{configurationId:"",networkingEngine:d,onContentSteeringInfoFound:()=>null,filterAllPeriods:()=>{},filterNewPeriod:()=>{},onEvent:()=>{},onError:()=>{}});if(!l.periods.length)throw e(null,new _.I(_.D,4,4014));const m=_.rt(l.periods);yield Tz(b,m,d)}catch(l){if(l instanceof _.I&&6200===l.code)throw l;throw e(null,l);}finally{for(;g.length;)e=g.shift(),e.uninstall(),_.Jh.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=Rz;if(_.jh(a)&&0!==a.length){var c=null,d=null;try{const e=yield b.get(a);e?(e.drmConfig.delayLicenseRequestUntilPlayed=!0,d=new _.En,c=Qz(e.drmConfig,d),yield Lz(c,e.keySystem,e.licenseServerUri,e.serverCertificate,e.audioCapabilities,e.videoCapabilities),yield _.Sq(c),yield Promise.all(e.sessionIds.map(f=>_.w(function*(){yield Oz(c,f);Sz.debug("successfully removed session with id",f)}))),yield b.delete(a)):Sz.debug("No persistent DRM session found")}catch(e){throw Sz.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 Sz.warn("Invalid offlineId")})});_.x("clpp.persistent.getSessionStorage",function(){return Rz});var Rz=new Uz,Sz=new _.T(Iz);_.x("clpp.persistent.PersistentLicenseComponent",class extends _.yv{constructor(){super();this.g=new _.T(Iz)}id(){return _.Te}f(a,b){const c=this;return _.w(function*(){const d=a.getConfiguration().drm;if(d){c.g.debug(`Persisting DRM session ID: ${d.offlineId}`);var e=a.getNetworkEngine();try{yield Tz(d,b,e),a.trigger(new _.H(_.Pd,{offlineId:d.offlineId}))}catch(f){a.onError(f)}}else c.g.debug("No DRM configuration found for loaded source.")})}a(a){const b=this;return _.w(function*(){b.g.debug(`Getting EME session IDs for ${a}`);
11
- const c=Rz;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);
6
+ h=e.videoCapabilities||[],k=e.serverCertificate||[],l=e.drmConfig||{};var d={sessionIds:f,keySystem:e.keySystem,licenseServerUri:decodeURIComponent(e.licenseServerUri||""),serverCertificate:k?new Uint8Array(k):null,audioCapabilities:g,videoCapabilities:h,drmConfig:l}}return d}catch(e){b.g.warn(`Error while loading offline items for ${a} from storage: `,e)}return null})}delete(a){return _.w(function*(){window.localStorage.removeItem(encodeURIComponent(a))})}clear(){return _.w(function*(){window.localStorage.clear()})}getName(){return Kz}};_.x("clpp.persistent.useStorage",function(a){{var b=["store","get","delete","clear","getName"];const c=[];_.z(a)||(_.hh(a.store)||c.push("store"),_.hh(a.get)||c.push("get"),_.hh(a.delete)||c.push("delete"),_.hh(a.clear)||c.push("clear"),_.hh(a.getName)||c.push("getName"),b=c)}if(0<b.length)throw Tz.warn("Invalid session storage implementation"),new _.I(1,6,6202,{missingMethods:b});Sz=a});
7
+ _.x("clpp.persistent.fetchLicense",function(a,b,...c){return _.w(function*(){var d=Sz,e=(l,m)=>new _.I(1,6,6200,l,m);const f=_.en(a).shift();if(!f)throw e("No source specified.");if(!b)throw e(Iz);var g=b.offlineId;if(typeof g!==_.Tf||!g.length)throw e("Missing offline id.");if(yield d.get(g))Tz.debug(Hz,g);else{var h=_.Zm();d=new _.Dn;g=[];for(var k of c){const l=new k;_.Kh(l.id())||(l.install(),_.Mh(l),g.push(l))}k=null;try{k=yield _.Dt(f.url,d,h.manifest.attemptParameters,f.type||null);k.configure(h.manifest);
8
+ const l=yield k.start(f.url,{configurationId:"",networkingEngine:d,onContentSteeringInfoFound:()=>null,filterAllPeriods:()=>{},filterNewPeriod:()=>{},onEvent:()=>{},onError:()=>{}});if(!l.periods.length)throw e(null,new _.I(_.D,4,4014));const m=_.st(l.periods);yield Uz(b,m,d)}catch(l){if(l instanceof _.I&&6200===l.code)throw l;throw e(null,l);}finally{for(;g.length;)e=g.shift(),e.uninstall(),_.Jh.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=Sz;if(_.jh(a)&&0!==a.length){var c=null,d=null;try{const e=yield b.get(a);e?(e.drmConfig.delayLicenseRequestUntilPlayed=!0,d=new _.Dn,c=Rz(e.drmConfig,d),yield Mz(c,e.keySystem,e.licenseServerUri,e.serverCertificate,e.audioCapabilities,e.videoCapabilities),yield _.Sq(c),yield Promise.all(e.sessionIds.map(f=>_.w(function*(){yield Pz(c,f);Tz.debug("successfully removed session with id",f)}))),yield b.delete(a)):Tz.debug("No persistent DRM session found")}catch(e){throw Tz.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 Tz.warn("Invalid offlineId")})});_.x("clpp.persistent.getSessionStorage",function(){return Sz});var Sz=new Vz,Tz=new _.T(Jz);_.x("clpp.persistent.PersistentLicenseComponent",class extends _.zv{constructor(){super();this.g=new _.T(Jz)}id(){return _.Te}f(a,b){const c=this;return _.w(function*(){const d=a.getConfiguration().drm;if(d){c.g.debug(`Persisting DRM session ID: ${d.offlineId}`);var e=a.getNetworkEngine();try{yield Uz(d,b,e),a.trigger(new _.H(_.Pd,{offlineId:d.offlineId}))}catch(f){a.onError(f)}}else c.g.debug("No DRM configuration found for loaded source.")})}a(a){const b=this;return _.w(function*(){b.g.debug(`Getting EME session IDs for ${a}`);
11
+ const c=Sz;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 Dz=function(a,b){return 0<=b&&b<a.a.length},Ez=function(a){a.trigger(new _.H(_.kf))},Fz=class extends _.Nt{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.Ba.bind(this)}getPosition(){return this.f}nd(){return this.a}Eb(){return 0<this.a.length&&Dz(this,this.f)?this.a[this.f]:null}qg(){const a=this.f+1;return 0<
2
- this.a.length&&Dz(this,a)?this.a[a]:null}hi(){return this.h}start(){this.h||(this.h=!0,this.m.on(_.Wd,this.j),this.Sc(this.f,!0))}stop(){this.h=!1;this.m.off(_.Wd,this.j)}Ba(){this.next()}next(){const a=this;return _.w(function*(){yield a.Sc(Math.min(a.a.length-1,a.f+1))})}Fd(){const a=this;return _.w(function*(){yield a.Sc(Math.max(0,a.f-1))})}Sc(a,b){b=void 0===b?!1:b;const c=this;return _.w(function*(){if(0<c.a.length&&Dz(c,a)&&(b||c.f!==a)){c.f=a;var d=c.Eb();d&&!1===d.skippable||!d||(yield c.l(d),
3
- yield c.m.load(d.configuration),c.trigger(new _.H(_.hf,{item:d})))}})}append(a){this.a.push(a);Ez(this)}ug(a,b){if(0<=b&&b<=this.a.length){const c=this.Eb();this.a.splice(b,0,a);c&&(this.f=this.a.indexOf(c));Ez(this)}}remove(a){if(0<this.a.length&&Dz(this,a)){if(this.f===a)throw Error("Can't remove the current item");this.a.splice(a,1);Ez(this)}}clear(){this.stop();this.f=0;this.a=[];this.h=!1;Ez(this)}};_.x("clpp.Playlist",Fz);Fz.prototype.clear=Fz.prototype.clear;Fz.prototype.remove=Fz.prototype.remove;
4
- Fz.prototype.insert=Fz.prototype.ug;Fz.prototype.append=Fz.prototype.append;Fz.prototype.goTo=Fz.prototype.Sc;Fz.prototype.previous=Fz.prototype.Fd;Fz.prototype.next=Fz.prototype.next;Fz.prototype.onEnded=Fz.prototype.Ba;Fz.prototype.stop=Fz.prototype.stop;Fz.prototype.start=Fz.prototype.start;Fz.prototype.isStarted=Fz.prototype.hi;Fz.prototype.getUpcoming=Fz.prototype.qg;Fz.prototype.getCurrent=Fz.prototype.Eb;Fz.prototype.getQueue=Fz.prototype.nd;Fz.prototype.getPosition=Fz.prototype.getPosition;
5
- Fz.prototype.off=Fz.prototype.off;Fz.prototype.one=Fz.prototype.one;Fz.prototype.on=Fz.prototype.on;};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Ez=function(a,b){return 0<=b&&b<a.a.length},Fz=function(a){a.trigger(new _.H(_.jf))},Gz=class extends _.Ot{on(a,b,c){return super.on(a,b,c)}one(a,b,c){return super.one(a,b,c)}off(a,b){return super.off(a,b)}constructor(a,b){b=void 0===b?()=>Promise.resolve():b;super();this.m=a;this.l=b;this.f=0;this.a=[];this.h=!1;this.j=this.Ea.bind(this)}getPosition(){return this.f}xd(){return this.a}Jb(){return 0<this.a.length&&Ez(this,this.f)?this.a[this.f]:null}sg(){const a=this.f+1;return 0<
2
+ this.a.length&&Ez(this,a)?this.a[a]:null}We(){return this.h}start(){this.h||(this.h=!0,this.m.on(_.Wd,this.j),this.Wc(this.f,!0))}stop(){this.h=!1;this.m.off(_.Wd,this.j)}Ea(){this.next()}next(){const a=this;return _.w(function*(){yield a.Wc(Math.min(a.a.length-1,a.f+1))})}Od(){const a=this;return _.w(function*(){yield a.Wc(Math.max(0,a.f-1))})}Wc(a,b){b=void 0===b?!1:b;const c=this;return _.w(function*(){if(0<c.a.length&&Ez(c,a)&&(b||c.f!==a)){c.f=a;var d=c.Jb();d&&!1===d.skippable||!d||(yield c.l(d),
3
+ yield c.m.load(d.configuration),c.trigger(new _.H(_.hf,{item:d})))}})}append(a){this.a.push(a);Fz(this)}wg(a,b){if(0<=b&&b<=this.a.length){const c=this.Jb();this.a.splice(b,0,a);c&&(this.f=this.a.indexOf(c));Fz(this)}}remove(a){if(0<this.a.length&&Ez(this,a)){if(this.f===a)throw Error("Can't remove the current item");this.a.splice(a,1);Fz(this)}}clear(){this.stop();this.f=0;this.a=[];this.h=!1;Fz(this)}};_.x("clpp.Playlist",Gz);Gz.prototype.clear=Gz.prototype.clear;Gz.prototype.remove=Gz.prototype.remove;
4
+ Gz.prototype.insert=Gz.prototype.wg;Gz.prototype.append=Gz.prototype.append;Gz.prototype.goTo=Gz.prototype.Wc;Gz.prototype.previous=Gz.prototype.Od;Gz.prototype.next=Gz.prototype.next;Gz.prototype.onEnded=Gz.prototype.Ea;Gz.prototype.stop=Gz.prototype.stop;Gz.prototype.start=Gz.prototype.start;Gz.prototype.isStarted=Gz.prototype.We;Gz.prototype.getUpcoming=Gz.prototype.sg;Gz.prototype.getCurrent=Gz.prototype.Jb;Gz.prototype.getQueue=Gz.prototype.xd;Gz.prototype.getPosition=Gz.prototype.getPosition;
5
+ Gz.prototype.off=Gz.prototype.off;Gz.prototype.one=Gz.prototype.one;Gz.prototype.on=Gz.prototype.on;};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 mz="No surface found. Can not attach frame!",nz="SIMID:Media:timeupdate",oz="Starting creative",pz=function(a,b,c){return{type:b,sessionId:a.h,messageId:a.l++,timestamp:Date.now(),args:c}},sz=function(a,b){return new Promise((c,d)=>{new qz(a.j,c,d,b);rz(a,b)})},tz=function(a){const b=pz(a,"SIMID:Player:startCreative",void 0);sz(a,b).then(()=>{var c=a.f;c.g.info(oz);c.m.trigger(new _.H(_.Kf));a.a.style.opacity="1"}).catch(c=>{a.unload();a.f.g.error("Error while starting creative",
2
- c)})},vz=function(a,b){_.w(function*(){a.h=b.sessionId;uz(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=pz(a,"SIMID:Player:init",d);var e=sz(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()}})},uz=function(a,b){rz(a,pz(a,"resolve",{messageId:b.messageId,
4
- value:void 0}))},rz=function(a,b){a.h?(b.type!==nz&&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}'`)},wz=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=pz(d,"SIMID:Player:resize",e);rz(d,e)}})},xz=function(a,b){a.g.info("SIMID Session created");a.a=b},yz=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 _.H(_.Lf))},zz=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}%`}},Az=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=_.Ge,this.a.style.backgroundColor="transparent",this.a.style.transition=
7
- "opacity .5s",this.a.style.transitionDelay=".5s",this.a.style.pointerEvents=_.Ge,this.a.style.overflow=_.ce);this.a.classList.add(_.cd);this.o=c=>{if(c.source===this.a.contentWindow&&(c=(c=c.data)?typeof c===_.Tf?JSON.parse(c):c:null))if(c.type)switch(this.g.info(`Received message [${c.messageId}] '${c.type}':`,c.args),c.type){case "createSession":vz(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=zz(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=zz(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);uz(this,c)}else this.g.warn("WARNING: received message without 'type' property")};this.g=new _.T("clpp.simid.SimidPlayer");xz(this.f,this)}load(a){window.addEventListener(_.ze,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(){yz(this.f);
10
- this.h=this.a.src="";this.l=0;this.a.style.opacity="0";window.removeEventListener(_.ze,this.o);this.a.parentElement&&this.a.parentElement.removeChild(this.a)}},qz=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 Cz=class extends _.Ov{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 Bz(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 Az(this.h,b.simid),b=c.getContainer(),this.j=wz(this,b,c),this.j.observe(b),a.on(_.fg,this.w)):this.g.warn(mz)}}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&&(tz(this.a),this.o=!0,this.g.info(oz)),
13
- c&&(c=this.a,rz(c,pz(c,nz,{currentTime:a-b}))))):((a=this.m.getSurface())||this.g.warn(mz),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(_.fg,this.w),this.f&&(this.a.unload(),this.f=this.h.f=null))}},Bz=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}og(){return this.a}url(){return this.f?this.f.url:""}};_.Qn(new class{create(){return new Cz}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var nz="No surface found. Can not attach frame!",oz="SIMID:Media:timeupdate",pz="Starting creative",qz=function(a,b,c){return{type:b,sessionId:a.h,messageId:a.l++,timestamp:Date.now(),args:c}},tz=function(a,b){return new Promise((c,d)=>{new rz(a.j,c,d,b);sz(a,b)})},uz=function(a){const b=qz(a,"SIMID:Player:startCreative",void 0);tz(a,b).then(()=>{var c=a.f;c.g.info(pz);c.m.trigger(new _.H(_.Kf));a.a.style.opacity="1"}).catch(c=>{a.unload();a.f.g.error("Error while starting creative",
2
+ c)})},wz=function(a,b){_.w(function*(){a.h=b.sessionId;vz(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=qz(a,"SIMID:Player:init",d);var e=tz(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()}})},vz=function(a,b){sz(a,qz(a,"resolve",{messageId:b.messageId,
4
+ value:void 0}))},sz=function(a,b){a.h?(b.type!==oz&&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}'`)},xz=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=qz(d,"SIMID:Player:resize",e);sz(d,e)}})},yz=function(a,b){a.g.info("SIMID Session created");a.a=b},zz=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 _.H(_.Lf))},Az=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}%`}},Bz=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=_.Ge,this.a.style.backgroundColor="transparent",this.a.style.transition=
7
+ "opacity .5s",this.a.style.transitionDelay=".5s",this.a.style.pointerEvents=_.Ge,this.a.style.overflow=_.ce);this.a.classList.add(_.ad);this.o=c=>{if(c.source===this.a.contentWindow&&(c=(c=c.data)?typeof c===_.Tf?JSON.parse(c):c:null))if(c.type)switch(this.g.info(`Received message [${c.messageId}] '${c.type}':`,c.args),c.type){case "createSession":wz(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=Az(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=Az(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);vz(this,c)}else this.g.warn("WARNING: received message without 'type' property")};this.g=new _.T("clpp.simid.SimidPlayer");yz(this.f,this)}load(a){window.addEventListener(_.ze,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(){zz(this.f);
10
+ this.h=this.a.src="";this.l=0;this.a.style.opacity="0";window.removeEventListener(_.ze,this.o);this.a.parentElement&&this.a.parentElement.removeChild(this.a)}},rz=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 Dz=class extends _.Pv{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 Cz(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 Bz(this.h,b.simid),b=c.getContainer(),this.j=xz(this,b,c),this.j.observe(b),a.on(_.fg,this.w)):this.g.warn(nz)}}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&&(uz(this.a),this.o=!0,this.g.info(pz)),
13
+ c&&(c=this.a,sz(c,qz(c,oz,{currentTime:a-b}))))):((a=this.m.getSurface())||this.g.warn(nz),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(_.fg,this.w),this.f&&(this.a.unload(),this.f=this.h.f=null))}},Cz=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}qg(){return this.a}url(){return this.f?this.f.url:""}};_.Pn(new class{create(){return new Dz}});};f.call(g, window);