@castlabs/prestoplay 6.26.0 → 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.
Files changed (68) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +7 -7
  5. package/cjs/cl.cast.js +114 -113
  6. package/cjs/cl.conviva.js +29 -29
  7. package/cjs/cl.core.js +620 -621
  8. package/cjs/cl.crypto.js +7 -7
  9. package/cjs/cl.dash.js +84 -84
  10. package/cjs/cl.externs.js +83 -51
  11. package/cjs/cl.freewheel.js +25 -25
  12. package/cjs/cl.hls.js +79 -77
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +23 -23
  15. package/cjs/cl.ima.js +24 -24
  16. package/cjs/cl.mediatailor.js +3 -3
  17. package/cjs/cl.mse.js +350 -342
  18. package/cjs/cl.muxdata.js +15 -15
  19. package/cjs/cl.onboard.js +3 -3
  20. package/cjs/cl.persistent.js +15 -15
  21. package/cjs/cl.playlist.js +6 -6
  22. package/cjs/cl.sessions.js +16 -16
  23. package/cjs/cl.simid.js +17 -17
  24. package/cjs/cl.smooth.js +67 -67
  25. package/cjs/cl.thumbnails.js +26 -26
  26. package/cjs/cl.tizen.js +69 -68
  27. package/cjs/cl.ttml.js +29 -29
  28. package/cjs/cl.verimatrix.js +5 -5
  29. package/cjs/cl.vimond.js +12 -12
  30. package/cjs/cl.vr.js +19 -19
  31. package/cjs/cl.vtt.js +14 -14
  32. package/cjs/cl.yospace.js +4 -4
  33. package/cjs/cl.youbora.js +37 -37
  34. package/cjs/polyfill.min.js +15 -3
  35. package/cl.adobe.js +3 -3
  36. package/cl.airplay.js +3 -3
  37. package/cl.broadpeak.js +5 -5
  38. package/cl.cast.js +92 -90
  39. package/cl.conviva.js +27 -27
  40. package/cl.core.js +498 -503
  41. package/cl.crypto.js +9 -9
  42. package/cl.dash.js +82 -82
  43. package/cl.externs.js +83 -51
  44. package/cl.freewheel.js +19 -19
  45. package/cl.hls.js +80 -79
  46. package/cl.hlssmpte.js +5 -5
  47. package/cl.htmlcue.js +26 -26
  48. package/cl.ima.js +17 -17
  49. package/cl.mediatailor.js +3 -3
  50. package/cl.mse.js +305 -301
  51. package/cl.muxdata.js +13 -13
  52. package/cl.onboard.js +4 -4
  53. package/cl.persistent.js +11 -11
  54. package/cl.playlist.js +5 -5
  55. package/cl.sessions.js +10 -10
  56. package/cl.simid.js +14 -14
  57. package/cl.smooth.js +60 -60
  58. package/cl.thumbnails.js +19 -19
  59. package/cl.tizen.js +57 -57
  60. package/cl.ttml.js +22 -22
  61. package/cl.verimatrix.js +4 -4
  62. package/cl.vimond.js +8 -8
  63. package/cl.vr.js +15 -15
  64. package/cl.vtt.js +12 -12
  65. package/cl.yospace.js +3 -3
  66. package/cl.youbora.js +29 -29
  67. package/package.json +1 -1
  68. package/typings.d.ts +83 -0
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 hB=function(a){switch(a.type){case 1:return eB;case 2:return fB;case 3:return gB}},jB=function(a){const b=Object.keys(a).find(c=>iB.includes(c.toLowerCase()));return void 0!==b?a[b]:void 0},lB=function(a){let b={debug:!0,data:kB(a)};a.f&&a.f.muxOptionsOverride&&_.bh(a.f.muxOptionsOverride)&&(b=_.Yg(b,a.f.muxOptionsOverride));b=_.Yg(b,{getPlayheadTime:()=>1E3*a.m.getPosition(),getStateData:()=>{{a.g.debug("getStateData()");var c=a.m.getLoadedSource(),d=a.m.getTrackManager();const f=
2
- a.m.getSurface();var e={player_is_paused:a.m.isPaused(),player_is_fullscreen:f.isFullscreen(),video_source_duration:1E3*a.m.getDuration(),player_autoplay_on:!!a.m.getConfiguration().autoplay};if(c){const k=new _.rm(c.url);e.video_source_url=_.fj(k);e.video_source_mime_type=c.type;c.name&&(e.video_title=c.name)}if(c=f.getContainer())e.player_width=c.offsetWidth,e.player_height=c.offsetHeight;(c=a.m.getSurface().getMedia())?c={videoWidth:c.videoWidth,videoHeight:c.videoHeight}:(c=a.m.getTrackManager().qa(),
3
- c={videoWidth:c.width,videoHeight:c.height});const {videoWidth:g,videoHeight:h}=c;a.g.debug(`Video dimensions: ${g}x${h}`);g&&h&&(e.video_source_height=g,e.video_source_width=h);(d=d.oa())&&d.language&&(e.player_language_code=d.language)}return e}});a.g.debug("Mux SDK options",b);return b},mB=function(a){_.Fh(a.a);a.j.Cd(a.F);a.j.af(a.C)},kB=function(a){const b={env_key:a.f.envKey,video_title:a.o&&a.o.name||"",player_name:_.ra,player_software_name:_.ra,player_software_version:_.ea,player_mux_plugin_name:"CastlabsPlayer built-in Mux Plugin",
4
- player_mux_plugin_version:_.ea};(a=a.m.getConfiguration().viewerId)&&(b.viewer_user_id=a);return b},nB=function(a){a.a.on(a.m,_.ag,()=>{const b={player_playhead_time:1E3*a.m.getPosition()};a.emit(_.ag,b)});a.a.on(a.m,_.Te,()=>a.emit(_.Te));a.a.on(a.m,_.Lc,a.G.bind(a));a.a.on(a.m,_.Mf,a.I.bind(a));a.a.on(a.m,_.lg,()=>a.emit(_.Ef));a.a.on(a.m,_.kg,()=>a.emit(_.Df));a.a.on(a.m,_.r,a.H.bind(a));a.a.on(a.m,_.Sb,()=>a.emit("adbreakstart"));a.a.on(a.m,_.Tb,()=>a.emit("adbreakend"));a.a.on(a.m,_.hc,()=>{a.emit("adplay");
5
- a.emit("adplaying")});a.a.on(a.m,_.dc,()=>a.emit("adpause"));a.a.on(a.m,_.fc,()=>{a.emit("adplay");a.emit("adplaying")});a.a.on(a.m,_.lc,()=>a.emit("adended"));a.a.on(a.m,_.Xb,()=>a.emit("adfirstquartile"));a.a.on(a.m,_.cc,()=>a.emit("admidpoint"));a.a.on(a.m,_.nc,()=>a.emit("adthirdquartile"));a.j.Gc(a.F);a.j.ue(a.C);a.a.on(a.m,_.r,b=>{if((b=b.detail)&&1===b.category){var c=b.data;c=c&&c.request;if(void 0!==c&&!0===(1===c.type||2===c.type||3===c.type))if(7001===b.code){b=c;c=b.requestStartTimestamp;
6
- var d=new _.rm(b.uris[b.uriIndex]);b={request_start:c,request_type:hB(b),request_hostname:d.a};a.g.debug("onRequestCanceled()","Track event: requestcanceled",b);a.emit("requestcanceled",b)}else{{d=c.requestStartTimestamp;const f=new _.rm(c.uris[c.uriIndex]);var e=b.data;e=void 0===e?-1:void 0!==e.response?e.response.status:void 0!==e.status?e.status:-1;b={request_start:d,request_type:hB(c),request_hostname:f.a,request_error:`${hB(c)}${"LoadError"}`,request_error_code:e,request_error_text:b.toString()};
7
- a.g.debug("onRequestFailed()","Track event: requestfailed",b);a.emit("requestfailed",b)}}}})},oB=function(a,b){a.trigger(new _.F(_.r,{detail:b}))},pB=function(a){return!_.B(a)&&typeof a.init===_.Wd&&typeof a.emit===_.Wd},eB="manifest",fB="media",gB="encryption",iB=["x-request-id","cf-ray","x-amz-cf-id","x-akamai-request-id"];var qB=class{constructor(a,b){this.m=a;this.o=this.f=null;this.B=("000000"+(Math.random()*Math.pow(36,6)<<0).toString(36)).slice(-6);this.a=new _.Rt;this.g=b;this.A=this.l=this.h=!1;this.w=null;this.j=a.getNetworkEngine();this.F=this.K.bind(this);this.C=this.J.bind(this)}initialize(a,b,c){this.f=a;this.o=b;this.w=c;if(!this.h){try{this.h=!0,this.w.init(this.B,lB(this))}catch(d){throw this.h=!1,mB(this),new _.I(1,9,9302,null,d);}this.emit("playerready")}this.l&&!this.A&&(a=kB(this),this.emit("videochange",
8
- a),this.l=!1);nB(this)}release(){this.g.debug("release()");this.l?this.g.debug(_.ia):(mB(this),this.l=!0,this.o=this.f=null)}destroy(){this.g.debug(_.Ad);this.A?this.g.debug(_.ha):(this.A=!0,this.emit("destroy"))}emit(a,b){if(null===this.w)throw new _.I(1,9,9301);this.w.emit(this.B,a,b)}G(a){this.g.debug(_.Fe);var b=a.detail;a=this.m.getTrackManager();b&&b.bandwidth&&(b=b.bandwidth,(a=a.Oa())&&a.bandwidth&&(b+=a.bandwidth),this.emit("renditionchange",{video_source_bitrate:b}))}I(a){this.g.debug(_.Ke);
9
- switch(a.detail.currentState){case _.Xo:this.m.getConfiguration().autoplay&&this.emit(_.Te);break;case _.Zo:this.emit(_.df);break;case _.Yo:this.emit(_.Pe);break;case _.Oo:this.emit(_.Sd)}}H(a){this.g.debug(_.He);if(this.h&&(a=a.detail||null))if(10003===a.code)this.emit("aderror");else if(a.severity===_.G){var b=a.message||"Player error";if(1===a.category||6100===a.code||6007===a.code)b="Download error",6100===a.code?b="Certificate request error":6007===a.code&&(b="License request error"),b=`${b} castlabs-error-data:${JSON.stringify(a.data)}`;
10
- this.emit(_.r,{player_error_code:a.code,player_error_message:b})}}K(a){var b=a.request;if(b=void 0!==b&&!0===(1===b.type||2===b.type||3===b.type))b=a.status,b=void 0!==b&&200<=b&&299>=b;if(b){{b=a.request;const e=a.headers,f=b.bytesLoaded,g=b.requestStartTimestamp;var c=b.startTime,d=b.endTime;const h=g+a.responseStartMs;a=g+a.timeMs;c=c&&d?d-c:void 0;d=new _.rm(b.uris[b.uriIndex]);a={request_start:g,request_type:hB(b),request_hostname:d.a,request_id:jB(e),request_bytes_loaded:f,request_response_start:h,
11
- request_response_end:a,request_response_headers:e,request_media_duration:c,request_url:_.fj(d)};this.g.debug("onRequestCompleted()","Track event: requestcompleted",a);this.emit("requestcompleted",a)}}}J(a){a.requestStartTimestamp=Date.now()}};var rB=class extends _.Sv{constructor(){super();this.f=this.m=null;this.a=!1;this.g=new _.T("clpp.muxdata")}onPlayerCreated(a){this.m=a;this.f=new qB(a,this.g)}onContentWillLoad(a,b){var c=a.getConfiguration();c=_.Zg(c.muxdata);try{var d=[];typeof c===_.Ee&&(c.envKey||d.push("envKey"));if(0<d.length)throw new _.I(1,9,9300,{missingKeys:d});{const f=a.getConfiguration();d=null;if(this.a=!_.B(f.muxdata)&&typeof f.muxdata===_.Ee){const g=f.muxdata;d=pB(g.muxLib)?g.muxLib:window.mux;if(!pB(d)){this.g.warn("Mux SDK is not loaded. Will do nothing.");
12
- this.a=!1;const h=new _.I(1,9,9301);oB(a,h)}}else this.g.debug("Mux plugin is loaded but not configured. Will do nothing.");var e=d}null!==e&&this.f.initialize(c,b,e)}catch(f){this.a=!1,oB(a,f)}}onContentLoaded(){}onPlayerWillDestroy(){this.a&&(this.f.destroy(),this.m=this.f=null)}onPlayerWillRelease(){this.a&&this.f.release()}id(){return"mux"}emit(a,b){try{this.f.emit(a,b)}catch(c){throw null!==this.m&&oB(this.m,c),c;}}};_.z("clpp.muxdata.MuxDataPlugin",rB);rB.prototype.emit=rB.prototype.emit;
13
- rB.Id="mux";_.Mr(new class{create(){return new rB}});};f.call(g, window);
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 dB=function(a,b){let c=b.baseUrl;_.$i(c,"/")||(c+="/");const d=g=>g&&(_.Zi(g,_.be)||_.Zi(g,"http://")||_.Zi(g,"//"))?g:`${c}${g}`,e=d(b.widevineUrl||"widevine"),f=d(b.playreadyUrl||"playready");b=d(b.fairplayUrl||"fairplay");a=new _.Bu(a);a.$a(_.td,{licenseUrl:e,videoRobustness:[_.ob,void 0],audioRobustness:[_.nb,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:_.Gm,licenseResponse:_.Hm}});a.$a(_.pd,{licenseUrl:b,
2
- certificateUrl:b,modifiers:{licenseRequest:_.Jm,licenseResponse:_.Km,extractContentId:_.Lm,certificateRequest:_.Pm}});a.$a(_.rd,{licenseUrl:f,modifiers:{licenseRequest:_.Gm}});_.Wl(a)};
3
- _.z("clpp.onboard.OnboardComponent",class extends _.Dv{constructor(){super();this.g=new _.T("clpp.onboard");this.j=new Set}a(){for(const a of this.j)delete _.Vl[a];this.j.clear()}h(a){a=a.getConfiguration().drm;var b;if(b=!(!a||!a.env))b=a&&a.customData,b=!(!b||!b.baseUrl);b&&(b=a.env,a=a.customData,a={baseUrl:a.baseUrl,widevineUrl:a.widevineUrl,playreadyUrl:a.playreadyUrl,fairplayUrl:a.fairplayUrl},this.g.info(`Registering the DRMtoday Onboard environment, name='${b}'`),dB(b,a),this.j.add(b))}id(){return"onboard"}});
4
- _.z("clpp.onboard.register",dB);};f.call(g, window);
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 OA="A persistent DRM session already exists for: ",PA="No DRM configuration.",QA="clpp.persistent",RA="clpp.persistent.SimpleSessionStorage",SA=function(a,b){const c=[];for(const d of a)c.push(b(d));return c},UA=function(a,b,c,d,e,f){a.K=TA;const g=new Map,h=_.Dn(b);g.set(h,{audioCapabilities:e,videoCapabilities:f,distinctiveIdentifier:_.Me,persistentState:_.wf,sessionTypes:[_.Re],label:h,drmInfos:[{keySystem:b,licenseServerUri:c,distinctiveIdentifierRequired:!1,persistentStateRequired:!0,
2
- audioRobustness:"",videoRobustness:"",serverCertificate:d,initData:null,keyIds:null}]});return _.Vn(a,g)},WA=function(a,b){a.K=VA;a.L=[];a.G=!0;return _.Wn(a,b)},XA=function(a,b){return _.x(function*(){const c=yield _.no(a,b);if(c){var d=[],e=a.h.get(c);e&&a.C&&(e.jc=new _.Ij,d.push(e.jc));a.g.debug("Attempting to remove session",b);d.push(c.remove());return Promise.all(d)}a.g.debug("Ignoring attempt to remove missing session",b)})},YA=function(a){a=a.h.keys();a=SA(a,b=>b.sessionId);return Array.from(a)},
3
- ZA=function(a,b){const c=_.Yl(a),d=_.yl({drm:a});d.drm=a;a=new _.fp({vb:b,onError:()=>{},Te:()=>{},Se:()=>{},onEvent:()=>{},getConfiguration:()=>d,Qc:()=>null});a.f=c;return a},bB=function(a,b,c){return _.x(function*(){const d=$A;if(a){var e=a.offlineId;if(0!==e.length){var f=yield d.get(e);if(f)aB.debug(OA,e);else{var g=ZA(a,c);try{yield WA(g,b);yield _.lo(g);yield _.oo(g);const h=g.getDrmInfo(),k=b.map(l=>({contentType:_.rk(l.video.mimeType,l.video.codecs),robustness:h.videoRobustness}));f={sessionIds:YA(g),
4
- keySystem:h.keySystem,licenseServerUri:h.licenseServerUri,serverCertificate:h.serverCertificate,audioCapabilities:[],videoCapabilities:k,drmConfig:a};yield d.store(e,f)}catch(h){throw aB.error(`Error while persisting DRM session ${e}`),new _.I(1,6,6200,null,h);}finally{yield g.destroy()}}}}else aB.debug(PA)})},VA=1,TA=2,cB=class{constructor(){this.g=new _.T(RA)}store(a,b){return _.x(function*(){{var c=JSON.stringify(b.sessionIds);var d=b.serverCertificate?Array.from(b.serverCertificate):null;d=JSON.stringify(d);
5
- const e=JSON.stringify(b.audioCapabilities),f=JSON.stringify(b.videoCapabilities);c=JSON.stringify({sessionIds:c,keySystem:b.keySystem,licenseServerUri:encodeURIComponent(b.licenseServerUri),serverCertificate:d,audioCapabilities:e,videoCapabilities:f,drmConfig:JSON.stringify(b.drmConfig)})}window.localStorage.setItem(encodeURIComponent(a),btoa(c))})}get(a){const b=this;return _.x(function*(){const c=window.localStorage.getItem(encodeURIComponent(a));if(c)try{{const e=JSON.parse(atob(c)),f=JSON.parse(e.sessionIds),
6
- g=e.audioCapabilities||[],h=e.videoCapabilities||[],k=e.serverCertificate||[],l=e.drmConfig||{};var d={sessionIds:f,keySystem:e.keySystem,licenseServerUri:decodeURIComponent(e.licenseServerUri||""),serverCertificate:k?new Uint8Array(k):null,audioCapabilities:g,videoCapabilities:h,drmConfig:l}}return d}catch(e){b.g.warn(`Error while loading offline items for ${a} from storage: `,e)}return null})}delete(a){return _.x(function*(){window.localStorage.removeItem(encodeURIComponent(a))})}clear(){return _.x(function*(){window.localStorage.clear()})}getName(){return RA}};_.z("clpp.persistent.useStorage",function(a){{var b=["store","get","delete","clear","getName"];const c=[];_.B(a)||(_.ch(a.store)||c.push("store"),_.ch(a.get)||c.push("get"),_.ch(a.delete)||c.push("delete"),_.ch(a.clear)||c.push("clear"),_.ch(a.getName)||c.push("getName"),b=c)}if(0<b.length)throw aB.warn("Invalid session storage implementation"),new _.I(1,6,6202,{missingMethods:b});$A=a});
7
- _.z("clpp.persistent.fetchLicense",function(a,b,...c){return _.x(function*(){var d=$A,e=(l,m)=>new _.I(1,6,6200,l,m);const f=_.bp(a).shift();if(!f)throw e("No source specified.");if(!b)throw e(PA);var g=b.offlineId;if(typeof g!==_.Pf||!g.length)throw e("Missing offline id.");if(yield d.get(g))aB.debug(OA,g);else{var h=_.yl();d=new _.Dr;g=[];for(var k of c){const l=new k;_.Bl(l.id())||(l.f(),_.Dl(l),g.push(l))}k=null;try{k=yield _.at(f.url,d,h.manifest.attemptParameters,f.type||null);k.configure(h.manifest);
8
- const l=yield k.start(f.url,{configurationId:"",networkingEngine:d,onContentSteeringInfoFound:()=>null,filterAllPeriods:()=>{},filterNewPeriod:()=>{},onEvent:()=>{},onError:()=>{}});if(!l.periods.length)throw e(null,new _.I(_.G,4,4014));const m=_.Zs(l.periods);yield bB(b,m,d)}catch(l){if(l instanceof _.I&&6200===l.code)throw l;throw e(null,l);}finally{for(;g.length;)e=g.shift(),e.a(),_.Al.delete(e.id());e=[];k&&e.push(k.stop());e.push(d.destroy());yield Promise.all(e)}}})});
9
- _.z("clpp.persistent.removeLicense",function(a){return _.x(function*(){var b=$A;if(_.eh(a)&&0!==a.length){var c=null,d=null;try{const e=yield b.get(a);e?(e.drmConfig.delayLicenseRequestUntilPlayed=!0,d=new _.Dr,c=ZA(e.drmConfig,d),yield UA(c,e.keySystem,e.licenseServerUri,e.serverCertificate,e.audioCapabilities,e.videoCapabilities),yield _.lo(c),yield Promise.all(e.sessionIds.map(f=>_.x(function*(){yield XA(c,f);aB.debug("successfully removed session with id",f)}))),yield b.delete(a)):aB.debug("No persistent DRM session found")}catch(e){throw aB.error("Failed to remove session"),
10
- new _.I(1,6,6201,null,e);}finally{b=[],c&&b.push(c.destroy()),d&&b.push(d.destroy()),yield Promise.all(b)}}else aB.warn("Invalid offlineId")})});_.z("clpp.persistent.getSessionStorage",function(){return $A});var $A=new cB,aB=new _.T(QA);_.z("clpp.persistent.PersistentLicenseComponent",class extends _.Dv{constructor(){super();this.g=new _.T(QA)}id(){return _.Qe}l(a,b){const c=this;return _.x(function*(){const d=a.getConfiguration().drm;if(d){c.g.debug(`Persisting DRM session ID: ${d.offlineId}`);var e=a.getNetworkEngine();try{yield bB(d,b,e),a.trigger(new _.F(_.Ld,{offlineId:d.offlineId}))}catch(f){a.onError(f)}}else c.g.debug("No DRM configuration found for loaded source.")})}j(a){const b=this;return _.x(function*(){b.g.debug(`Getting EME session IDs for ${a}`);
11
- const c=$A;try{const d=yield c.get(a);if(d)return d.sessionIds||[];b.g.debug(`No offline session found for ${a}`);return[]}catch(d){return b.g.warn("Error while loading session info from storage"),[]}})}});};f.call(g, window);
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 LA=function(a,b){return 0<=b&&b<a.a.length},MA=function(a){a.trigger(new _.F(_.ff))},NA=class extends _.vu{on(a,b,c){return super.on(a,b,c)}one(a,b,c){return super.one(a,b,c)}off(a,b){return super.off(a,b)}constructor(a,b){b=void 0===b?()=>Promise.resolve():b;super();this.m=a;this.l=b;this.f=0;this.a=[];this.h=!1;this.j=this.Aa.bind(this)}getPosition(){return this.f}Fh(){return this.a}jd(){return 0<this.a.length&&LA(this,this.f)?this.a[this.f]:null}Gh(){const a=this.f+1;return 0<
2
- this.a.length&&LA(this,a)?this.a[a]:null}Sh(){return this.h}start(){this.h||(this.h=!0,this.m.on(_.Sd,this.j),this.Wd(this.f,!0))}stop(){this.h=!1;this.m.off(_.Sd,this.j)}Aa(){this.next()}next(){const a=this;return _.x(function*(){yield a.Wd(Math.min(a.a.length-1,a.f+1))})}ki(){const a=this;return _.x(function*(){yield a.Wd(Math.max(0,a.f-1))})}Wd(a,b){b=void 0===b?!1:b;const c=this;return _.x(function*(){if(0<c.a.length&&LA(c,a)&&(b||c.f!==a)){c.f=a;var d=c.jd();d&&(yield c.l(d),yield c.m.load(d.configuration),
3
- c.trigger(new _.F(_.ef,{item:d})))}})}append(a){this.a.push(a);MA(this)}Qh(a,b){if(0<=b&&b<=this.a.length){const c=this.jd();this.a.splice(b,0,a);c&&(this.f=this.a.indexOf(c));MA(this)}}remove(a){if(0<this.a.length&&LA(this,a)){if(this.f===a)throw Error("Can't remove the current item");this.a.splice(a,1);MA(this)}}clear(){this.stop();this.f=0;this.a=[];this.h=!1;MA(this)}};_.z("clpp.Playlist",NA);NA.prototype.clear=NA.prototype.clear;NA.prototype.remove=NA.prototype.remove;NA.prototype.insert=NA.prototype.Qh;
4
- NA.prototype.append=NA.prototype.append;NA.prototype.goTo=NA.prototype.Wd;NA.prototype.previous=NA.prototype.ki;NA.prototype.next=NA.prototype.next;NA.prototype.onEnded=NA.prototype.Aa;NA.prototype.stop=NA.prototype.stop;NA.prototype.start=NA.prototype.start;NA.prototype.isStarted=NA.prototype.Sh;NA.prototype.getUpcoming=NA.prototype.Gh;NA.prototype.getCurrent=NA.prototype.jd;NA.prototype.getQueue=NA.prototype.Fh;NA.prototype.getPosition=NA.prototype.getPosition;NA.prototype.off=NA.prototype.off;
5
- NA.prototype.one=NA.prototype.one;NA.prototype.on=NA.prototype.on;};f.call(g, window);
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 Gz="apiUrl config is missing",Hz=function(a,b){a.l=a.l.filter(c=>c!==b)},Iz=function(a){let b=0>a;a=Math.abs(a);let c=a>>>0;a=Math.floor((a-c)/4294967296);a>>>=0;b&&(a=~a>>>0,c=(~c>>>0)+1,4294967295<c&&(c=0,a++,4294967295<a&&(a=0)));return[c,a]},Nz=function(a,b,c,d){if(!(null===c||void 0===c||typeof c===_.t&&0===c||typeof c===_.Pf&&0===c.length||Array.isArray(c)&&0===c.length))if(Array.isArray(c)){Jz(a,b<<3|2);b=new Kz;for(let e=0;e<c.length;e++)d(b,c[e]);Lz(a,b.length());Mz(a,b.end())}else Jz(a,
2
- b<<3|0),d(a,c)},Lz=function(a,b){if(0<=b)Jz(a,b);else{for(let c=0;9>c;c++)a.a.push(b&127|128),b>>=7;a.a.push(1)}},Oz=function(a,b,c){Nz(a,b,c,(d,e)=>{Lz(d,e)})},Jz=function(a,b){for(;127<b;)a.a.push(b&127|128),b>>>=7;a.a.push(b)},Qz=function(a,b,c){Nz(a,b,c,(d,e)=>{if(0<=e){{const [f,g]=Iz(e);Pz(d,f,g)}}else{{const [f,g]=Iz(e);Pz(d,f,g)}}})},Rz=function(a,b,c,d){if(!(null===c||void 0===c||typeof c===_.t&&0===c||typeof c===_.Pf&&0===c.length||Array.isArray(c)&&0===c.length))if(Array.isArray(c))for(let e=
3
- 0;e<c.length;e++){Jz(a,b<<3|2);const f=new Kz;d(f,c[e]);Lz(a,f.length());Mz(a,f.end())}else Jz(a,b<<3|2),b=new Kz,d(b,c),Lz(a,b.length()),Mz(a,b.end())},Sz=function(a,b,c){Rz(a,b,c,(d,e)=>{for(let f=0;f<e.length;f++){let g=e.charCodeAt(f);if(128>g)d.a.push(g);else if(2048>g)d.a.push(g>>6|192),d.a.push(g&63|128);else if(65536>g)if(55296<=g&&56319>=g&&f+1<e.length){let h=e.charCodeAt(f+1);56320<=h&&57343>=h&&(g=1024*(g-55296)+h-56320+65536,d.a.push(g>>18|240),d.a.push(g>>12&63|128),d.a.push(g>>6&63|
4
- 128),d.a.push(g&63|128),f++)}else d.a.push(g>>12|224),d.a.push(g>>6&63|128),d.a.push(g&63|128)}})},Mz=function(a,b){a.a.push.apply(a.a,b)},Tz=function(a,b,c){Rz(a,b,c,(d,e)=>{Mz(d,e.a())})},Uz=function(a,b,c){Rz(a,b,c,(d,e)=>{Mz(d,e)})},Pz=function(a,b,c){for(;0<c||127<b;)a.a.push(b&127|128),b=(b>>>7|c<<25)>>>0,c>>>=7;a.a.push(b)},Wz=function(a){const b=new Vz;b.h=Math.floor(a/1E3);b.f=a%1E3*1E6;return b},$z=function(a){return _.x(function*(){if(!a.j&&!a.f){0===a.a.length&&Xz(a,new Yz);var b=()=>
5
- {};a.f=new Promise(c=>{b=c});try{const c=new Zz;c.f=a.o;c.events.push(...a.a);const d=[...a.a],e=yield fetch(a.l,{method:_.db,headers:{"Content-Type":"application/proto"},body:new Uint8Array(c.a())});if(e.ok)a.a=a.a.filter(f=>!d.includes(f));else throw Error("An error occurred while sending telemetry events to the API, "+`status='${e.status}' statusText='${e.statusText}'`);}finally{b(),a.f=null}}})},cA=function(a,b,c,d,e,f,g){const h=new aA;h.headers=[new bA("CL-BROWSER-NAME",b),new bA("CL-BROWSER-VERSION",
6
- c),new bA("CL-OS-FAMILY",d),new bA("CL-OS-VERSION",e),new bA("CL-SDK-NAME",f),new bA("CL-SDK-NAME",f),new bA("CL-SDK-VERSION",g)];Xz(a,h)},Xz=function(a,b){if(!a.j){var c=new dA(a.w);c.sessionId=a.A;{var d=Date.now();const e=new eA;e.h=Math.floor(d/1E3);e.f=d%1E3*1E6;d=e}c.time=d;c.h=b.getId();c.f=new Uint8Array(b.a());a.a.push(c)}},fA=function(a){return _.x(function*(){a.h&&(clearInterval(a.h),a.h=null);a.f&&(yield a.f);0<a.a.length&&(yield $z(a),a.a=[]);a.j=!0})},gA=function(a){_.x(function*(){a.g.info("Destroy the session and stop sending events.");
7
- _.Fh(a.a);a.Z=!1;const b=a.m.getNetworkEngine();b.af(a.l);b.Cd(a.h);Hz(b,a.h);a.f&&(yield fA(a.f),a.f=null)})},oA=function(a){switch(a){case _.Wo:return hA;case _.Xo:return iA;case _.So:return jA;case _.Zo:return kA;case _.Yo:return lA;case _.Oo:return mA;case _.Po:return nA;default:return null}},pA=function(a,b){a.g.debug("Sending event",b);Xz(a.f,b)},xA=function(a,b){switch(a){case 1:return qA;case 2:return b===_.w?rA:b===_.p?sA:b===_.H?tA:b===_.ce?uA:vA;case 3:return wA;default:return vA}};var Kz=class{constructor(){this.a=[]}length(){return this.a.length}end(){const a=this.a;this.a=[];return a}};var yA=class{constructor(a,b,c,d){this.downloadId=a;this.h=b;this.duration=c;this.j=d;this.f=[]}a(){const a=new Kz;Tz(a,1,this.downloadId);Oz(a,2,this.h);Tz(a,3,this.duration);Oz(a,4,this.j);Tz(a,5,this.f);return a.end()}getId(){return 4}};var zA=class{constructor(a,b){this.f=a;this.url=b;this.downloadId=null;this.headers=[];this.size=this.duration=null}a(){const a=new Kz;Oz(a,1,this.f);Tz(a,2,this.downloadId);Sz(a,3,this.url);Tz(a,4,this.headers);Sz(a,5,null);Tz(a,6,null);Tz(a,7,this.duration);Qz(a,8,this.size);return a.end()}getId(){return 2}};var AA=class{constructor(a,b){this.h=a;this.f=b}a(){const a=new Kz;Oz(a,1,this.h);Uz(a,2,this.f);return a.end()}};var BA=class{constructor(a){this.cause=a;this.f=this.message=this.severity=this.errorCode=null}a(){const a=new Kz;Oz(a,1,this.errorCode);Oz(a,2,this.severity);Sz(a,3,this.message);Sz(a,4,this.f);Tz(a,5,this.cause);return a.end()}getId(){return 7}};var bA=class{constructor(a,b){this.key=a;this.value=b}a(){const a=new Kz;Sz(a,1,this.key);Sz(a,2,this.value);return a.end()}};var CA=class{constructor(){this.cause=this.severity=this.code=null}a(){const a=new Kz;Oz(a,1,this.code);Oz(a,2,this.severity);Tz(a,3,this.cause);return a.end()}getId(){return 12}};var DA=class{constructor(){this.data=null}a(){const a=new Kz;Uz(a,1,this.data);return a.end()}};var EA=class extends DA{constructor(){super();var a=new Uint8Array(16);crypto.getRandomValues(a);a[6]=a[6]&15|64;a[8]=a[8]&63|128;this.data=a}toString(){const a=[];for(let b=0;256>b;++b)a.push((b+256).toString(16).slice(1));return a[this.data[0]]+a[this.data[1]]+a[this.data[2]]+a[this.data[3]]+"-"+a[this.data[4]]+a[this.data[5]]+"-"+a[this.data[6]]+a[this.data[7]]+"-"+a[this.data[8]]+a[this.data[9]]+"-"+a[this.data[10]]+a[this.data[11]]+a[this.data[12]]+a[this.data[13]]+a[this.data[14]]+a[this.data[15]]}};var aA=class{constructor(){this.headers=[]}a(){const a=new Kz;Tz(a,1,this.headers);return a.end()}getId(){return 1}};var Yz=class{constructor(){}a(){return(new Kz).end()}getId(){return 6}};var dA=class{constructor(a){this.j=a;this.f=this.h=this.time=this.sessionId=null}a(){const a=new Kz;Tz(a,1,this.j);Tz(a,2,this.sessionId);Tz(a,3,this.time);Qz(a,4,null);Sz(a,5,null);Oz(a,6,this.h);Uz(a,7,this.f);return a.end()}};var Zz=class{constructor(){this.f=null;this.events=[]}a(){const a=new Kz;Uz(a,1,this.f);Tz(a,2,this.events);return a.end()}};var eA=class{constructor(){this.f=this.h=null}a(){const a=new Kz;Qz(a,1,this.h);Oz(a,2,this.f);return a.end()}};var Vz=class{constructor(){this.f=this.h=null}a(){const a=new Kz;Qz(a,1,this.h);Oz(a,2,this.f);return a.end()}};var FA=class{constructor(a,b,c,d,e,f,g,h,k){k=void 0===k?2500:k;this.o=a;this.l=h;this.w=new EA;this.A=new EA;this.a=[];this.h=setInterval(()=>$z(this),k);this.f=null;this.j=!1;cA(this,b,c,d,e,f,g)}};var GA=class{constructor(){this.reason=this.currentState=this.previousState=null}a(){const a=new Kz;Oz(a,1,this.previousState);Oz(a,2,this.currentState);Oz(a,3,this.reason);Tz(a,4,null);Tz(a,5,null);Tz(a,6,null);return a.end()}getId(){return 5}};var KA=class extends _.Sv{constructor(){super();this.m=null;this.Z=this.j=!1;this.a=new _.Rt;this.f=null;this.g=new _.T("clpp.sessions.SessionsPlugin");this.l=this.F.bind(this);this.h=this.C.bind(this)}onPlayerCreated(a){this.m=a}onContentWillLoad(a){var b=a.getConfiguration().sessions;(b=!(!b||typeof b!==_.Ee))||this.g.debug("Sessions plugin is loaded but not configured. Will do nothing.");if(this.j=b)b=a.getConfiguration().sessions,b.apiUrl?(this.g.debug(_.sa),this.g.info("Create a session and start sending events."),
8
- a=_.Yk(),this.f=new FA(new Uint8Array([]),a.browser,a.browserVersion.name,a.os,a.osVersion.name,"prestoplay-web",_.ea,b.apiUrl),this.a.on(this.m,_.Mf,this.B.bind(this)),this.a.on(this.m,_.Ef,this.A.bind(this)),this.a.on(this.m,_.Df,this.w.bind(this)),this.a.on(this.m,_.r,this.o.bind(this)),a=this.m.getNetworkEngine(),a.ue(this.l),a.Gc(this.h),a.l.push(this.h)):(this.g.warn(Gz),a.onError(new _.I(1,9,15E3,Gz)))}onPlayerWillRelease(){gA(this)}id(){return"sessions"}B(a){if(!this.Z){a=a.detail;var b=a.currentState,
9
- c=new GA;c.previousState=oA(a.previousState);c.currentState=oA(b);pA(this,c)}}A(){if(!this.Z){var a=new GA;a.previousState=oA(this.m.getState());a.currentState=HA;pA(this,a);this.Z=!0}}w(){if(this.Z){var a=new GA;a.previousState=HA;a.currentState=oA(this.m.getState());pA(this,a);this.Z=!1}}o(a){a=a.detail;var b=new CA;b=new BA(new AA(b.getId(),new Uint8Array(b.a())));b.errorCode=a.code;b.message=a.message;b.f=a.stack;b.severity=a.severity===_.G?IA:JA;pA(this,b)}F(a){const b=new EA;a.downloadId=b;
10
- const c=new zA(xA(a.type,a.contentType),a.uris[0]);c.downloadId=b;c.headers=Object.keys(a.headers).map(d=>new bA(d,a.headers[d]));pA(this,c)}C(a){var b=a.request.downloadId;b?(b=new yA(b,a.data.byteLength,Wz(a.timeMs||0),a.status||-1),b.f=Object.keys(a.headers).map(c=>new bA(c,a.headers[c])),pA(this,b)):this.g.warn("Download ID is missing on download completed event.")}};_.Mr(new class{create(){return new KA}});var JA=1,IA=2;var hA=0,iA=2,nA=3,HA=5,jA=6,kA=8,lA=10,mA=11;var qA=0,rA=1,sA=2,tA=3,uA=4,wA=5,vA=9;};f.call(g, window);
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 pz="No surface found. Can not attach frame!",qz="SIMID:Media:timeupdate",rz="Starting creative",sz=function(a,b,c){return{type:b,sessionId:a.h,messageId:a.l++,timestamp:Date.now(),args:c}},vz=function(a,b){return new Promise((c,d)=>{new tz(a.j,c,d,b);uz(a,b)})},wz=function(a){const b=sz(a,"SIMID:Player:startCreative",void 0);vz(a,b).then(()=>{var c=a.f;c.g.info(rz);c.m.trigger(new _.F(_.Gf));a.a.style.opacity="1"}).catch(c=>{a.unload();a.f.g.error("Error while starting creative",
2
- c)})},yz=function(a,b){_.x(function*(){a.h=b.sessionId;xz(a,b);try{{var c=a.f;const f=c.getSurface(),g=c.getContainer();var d={environmentData:{videoDimensions:{x:0,y:0,height:g.clientHeight,width:g.clientWidth},creativeDimensions:{x:0,y:0,height:g.clientHeight,width:g.clientWidth},fullscreen:f.isFullscreen(),fullscreenAllowed:!0,variableDurationAllowed:!1,skippableState:"notSkippable",version:"1.1",skipoffset:"",siteUrl:window.location.toString(),appId:"",useragent:"",deviceId:"",muted:c.m.isMuted()||
3
- !1,volume:c.m.getVolume()||0,navigationSupport:"adHandles",closeButtonSupport:"adHandles",nonlinearDuration:c.f.duration},creativeData:{adParameters:c.f.adParameters||"",clickThruUri:"",clickThruUrl:""}}}{const f=sz(a,"SIMID:Player:init",d);var e=vz(a,f)}yield e;a.g.info("Player Init acknowledged");a.f.g.info("SIMID Player initialized")}catch(f){a.g.error("Error while initializing",f),a.f.g.error("Error while initializing SIMID player: ",f),a.unload()}})},xz=function(a,b){uz(a,sz(a,"resolve",{messageId:b.messageId,
4
- value:void 0}))},uz=function(a,b){a.h?(b.type!==qz&&a.g.info(`Posting message [${b.messageId}] '${b.type}':`,b.args),a.a.contentWindow&&a.a.contentWindow.postMessage(JSON.stringify(b),"*")):a.g.warn(`WARNING: no session available to send message '${b.type}'`)},zz=function(a,b,c){return new ResizeObserver(()=>{if(a.a.h){var d=a.a,e={videoDimensions:{x:0,y:0,height:b.clientHeight,width:b.clientWidth},creativeDimensions:{x:0,y:0,height:b.clientHeight,width:b.clientWidth},fullscreen:c.isFullscreen()};
5
- e=sz(d,"SIMID:Player:resize",e);uz(d,e)}})},Az=function(a,b){a.g.info("SIMID Session created");a.a=b},Bz=function(a){a.g.info("Stopping creative");a.m.getSurface().getMedia().style.transition=".5s";setTimeout(()=>{a.m.getSurface().getMedia().style.transition=""},500);a.m.getSurface().getMedia().style.left="";a.m.getSurface().getMedia().style.top="";a.m.getSurface().getMedia().style.width="";a.m.getSurface().getMedia().style.height="";a.a.a.style.left="";a.a.a.style.top="";a.a.a.style.width="";a.a.a.style.height=
6
- "";a.h=!1;a.m.trigger(new _.F(_.Hf))},Cz=function(a,b){var c=a.getContainer();a=c.clientWidth;c=c.clientHeight;return{top:`${b.y/c*100}%`,left:`${b.x/a*100}%`,width:`${b.width/a*100}%`,height:`${b.height/c*100}%`}},Dz=class{constructor(a,b){this.f=a;this.w=b;this.h="";this.l=0;this.j=new Map;this.a=document.createElement("iframe");this.a.style.opacity="0";a=this.w.style;a.className?this.a.classList.add(a.className):(this.a.style.border=_.De,this.a.style.backgroundColor="transparent",this.a.style.transition=
7
- "opacity .5s",this.a.style.transitionDelay=".5s",this.a.style.pointerEvents=_.De,this.a.style.overflow=_.$d);this.a.classList.add(_.Zc);this.o=c=>{if(c.source===this.a.contentWindow&&(c=(c=c.data)?typeof c===_.Pf?JSON.parse(c):c:null))if(c.type)switch(this.g.info(`Received message [${c.messageId}] '${c.type}':`,c.args),c.type){case "createSession":yz(this,c);break;case "resolve":c=c.args;var d=this.j.get(c.messageId);d&&d.resolve(c);break;case "reject":c=c.args;(d=this.j.get(c.messageId))&&d.reject(c);
8
- break;case "SIMID:Creative:requestResize":d=this.f;var e=c.args;d.g.info("Creative requested resize",e);if(d.m&&d.m.getSurface()&&d.m.getSurface().getMedia()&&e.mediaDimensions){d.h?d.m.getSurface().getMedia().style.transition="":(d.m.getSurface().getMedia().style.transition="left .5s, top .5s,width .5s, height .5s",d.h=!0);const f=Cz(d,e.mediaDimensions);d.m.getSurface().getMedia().style.left=f.left;d.m.getSurface().getMedia().style.top=f.top;d.m.getSurface().getMedia().style.width=f.width;d.m.getSurface().getMedia().style.height=
9
- f.height}e.creativeDimensions&&(e=Cz(d,e.creativeDimensions),d.a.a.style.left=e.left,d.a.a.style.top=e.top,d.a.a.style.width=e.width,d.a.a.style.height=e.height);xz(this,c)}else this.g.warn("WARNING: received message without 'type' property")};this.g=new _.T("clpp.simid.SimidPlayer");Az(this.f,this)}load(a){window.addEventListener(_.se,this.o);this.h="";this.l=0;const b=this.f.url();this.g.info(`Loading "${b}" as src of iFrame`);this.a.src=b;this.g.info("Attaching iFrame");a.appendChild(this.a)}unload(){Bz(this.f);
10
- this.h=this.a.src="";this.l=0;this.a.style.opacity="0";window.removeEventListener(_.se,this.o);this.a.parentElement&&this.a.parentElement.removeChild(this.a)}},tz=class{constructor(a,b,c,d,e){e=void 0===e?-1:e;this.f=a;this.l=b;this.j=c;this.h=d;this.a=null;this.f.set(d.messageId,this);0<=e&&(this.a=setTimeout(()=>{this.resolve()},e))}resolve(a){null!==this.a&&(clearTimeout(this.a),this.a=null);this.f.delete(this.h.messageId);this.l(a)}reject(a){null!==this.a&&(clearTimeout(this.a),this.a=null);this.f.delete(this.h.messageId);
11
- this.j(a)}};var Fz=class extends _.Sv{constructor(){super();this.g=new _.T("clpp.simid.Plugin");this.h=this.a=this.m=null;this.l=[];this.j=null;this.w=this.A.bind(this);this.f=null;this.o=!1}id(){return"simid"}onPlayerCreated(a){this.g.info("New player created");this.a&&(this.a.unload(),this.a=null);this.m=a;this.h&&this.h.release();this.h=new Ez(a)}onContentWillLoad(a){var b=a.getConfiguration();if(b.simid&&b.simid.creatives&&0!==b.simid.creatives.length){this.l=b.simid.creatives;this.g.info(`Setting up SIMID plugin for ${this.l.length} creatives`);
12
- var c=this.m.getSurface();c?(this.g.info("Creating new session"),this.a=new Dz(this.h,b.simid),b=c.getContainer(),this.j=zz(this,b,c),this.j.observe(b),a.on(_.ag,this.w)):this.g.warn(pz)}}A(){var a=this.m.getPosition();a:if(this.f&&a<this.f.startTime+this.f.duration)var b=this.f;else{for(b=0;b<this.l.length;b++){var c=this.l[b];const d=c.startTime+c.duration;if(a>=c.startTime-(c.preload||5)&&a<d){b=c;break a}}b=null}b?b===this.f?(b=b.startTime,this.a&&(c=a>=b,!this.o&&c&&(wz(this.a),this.o=!0,this.g.info(rz)),
13
- c&&(c=this.a,uz(c,sz(c,qz,{currentTime:a-b}))))):((a=this.m.getSurface())||this.g.warn(pz),a=a.getContainer(),this.f=b,this.o=!1,this.g.info("Loading session"),this.h.f=b,this.a.load(a)):this.f&&(this.a.unload(),this.f=null,this.o=!1)}onPlayerWillRelease(a){super.onPlayerWillRelease(a);this.m.getSurface()&&(this.j&&(this.j.disconnect(),this.j=null),a.off(_.ag,this.w),this.f&&(this.a.unload(),this.f=this.h.f=null))}},Ez=class{constructor(a){this.m=a;this.a=null;this.g=new _.T("clpp.simid.Loader");
14
- this.h=!1;this.f=null}release(){this.g.info("Releasing loader")}getContainer(){const a=this.getSurface().getContainer();if(!a)throw this.g.error("No player container found. Can not create SIMID init data"),new _.I(1,10,10100,"No player container found");return a}getSurface(){const a=this.m.getSurface();if(!a)throw this.g.error("No player surface found. Can not create SIMID init data"),new _.I(1,10,10100,"No surface");return a}cg(){return this.a}url(){return this.f?this.f.url:""}};_.Mr(new class{create(){return new Fz}});};f.call(g, window);
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);