@castlabs/prestoplay 6.32.0-beta.2 → 6.32.0-beta.5

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 (55) hide show
  1. package/cjs/cl.airplay.js +3 -3
  2. package/cjs/cl.broadpeak.js +7 -7
  3. package/cjs/cl.cast.js +56 -56
  4. package/cjs/cl.cdn.js +5 -5
  5. package/cjs/cl.conviva.js +18 -18
  6. package/cjs/cl.core.js +191 -191
  7. package/cjs/cl.dash.js +51 -51
  8. package/cjs/cl.freewheel.js +9 -9
  9. package/cjs/cl.hls.js +54 -54
  10. package/cjs/cl.hlssmpte.js +1 -1
  11. package/cjs/cl.htmlcue.js +3 -3
  12. package/cjs/cl.ima.js +11 -11
  13. package/cjs/cl.mediatailor.js +2 -2
  14. package/cjs/cl.mse.js +125 -125
  15. package/cjs/cl.muxdata.js +8 -8
  16. package/cjs/cl.persistent.js +2 -2
  17. package/cjs/cl.playlist.js +5 -5
  18. package/cjs/cl.simid.js +3 -3
  19. package/cjs/cl.smooth.js +28 -28
  20. package/cjs/cl.thumbnails.js +3 -3
  21. package/cjs/cl.tizen.js +34 -34
  22. package/cjs/cl.ttml.js +3 -3
  23. package/cjs/cl.verimatrix.js +1 -1
  24. package/cjs/cl.vimond.js +8 -8
  25. package/cjs/cl.vr.js +7 -7
  26. package/cjs/cl.vtt.js +1 -1
  27. package/cjs/cl.yospace.js +2 -2
  28. package/cjs/cl.youbora.js +11 -11
  29. package/cl.airplay.js +1 -1
  30. package/cl.cast.js +29 -29
  31. package/cl.cdn.js +5 -5
  32. package/cl.conviva.js +3 -3
  33. package/cl.core.js +116 -116
  34. package/cl.dash.js +48 -48
  35. package/cl.freewheel.js +3 -3
  36. package/cl.hls.js +35 -35
  37. package/cl.htmlcue.js +1 -1
  38. package/cl.ima.js +1 -1
  39. package/cl.mediatailor.js +2 -2
  40. package/cl.mse.js +78 -78
  41. package/cl.muxdata.js +2 -2
  42. package/cl.persistent.js +1 -1
  43. package/cl.playlist.js +4 -4
  44. package/cl.simid.js +1 -1
  45. package/cl.smooth.js +22 -22
  46. package/cl.thumbnails.js +4 -4
  47. package/cl.tizen.js +15 -15
  48. package/cl.ttml.js +2 -2
  49. package/cl.verimatrix.js +1 -1
  50. package/cl.vimond.js +2 -2
  51. package/cl.vr.js +2 -2
  52. package/cl.vtt.js +2 -2
  53. package/cl.yospace.js +2 -2
  54. package/cl.youbora.js +8 -8
  55. package/package.json +1 -1
package/cl.muxdata.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var cA=function(a){switch(a.type){case 1:return $z;case 2:return aA;case 3:return bA}},eA=function(a){const b=Object.keys(a).find(c=>dA.includes(c.toLowerCase()));return void 0!==b?a[b]:void 0},gA=function(a){let b={debug:!0,data:fA(a)};a.f&&a.f.muxOptionsOverride&&_.lh(a.f.muxOptionsOverride)&&(b=_.hh(b,a.f.muxOptionsOverride));b=_.hh(b,{getPlayheadTime:()=>1E3*a.m.getPosition(),getStateData:()=>{{a.g.debug("getStateData()");var c=a.m.Sa(),d=a.m.getTrackManager();const f=a.m.getSurface();
2
2
  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 _.lp(c.url);e.video_source_url=_.Qm(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(),c={videoWidth:c.width,
3
- 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},hA=function(a){_.ai(a.a);a.j.Xd(a.F);a.j.Cf(a.C)},fA=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",
3
+ 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},hA=function(a){_.ai(a.a);a.j.Yd(a.F);a.j.Df(a.C)},fA=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
4
  player_mux_plugin_version:_.ea};(a=a.m.getConfiguration().viewerId)&&(b.viewer_user_id=a);return b},iA=function(a){a.a.on(a.m,_.gg,()=>{const b={player_playhead_time:1E3*a.m.getPosition()};a.emit(_.gg,b)});a.a.on(a.m,_.Xe,()=>a.emit(_.Xe));a.a.on(a.m,_.Mc,a.G.bind(a));a.a.on(a.m,_.Rf,a.I.bind(a));a.a.on(a.m,_.ug,()=>a.emit(_.Jf));a.a.on(a.m,_.qg,()=>a.emit(_.If));a.a.on(a.m,_.Xd,a.H.bind(a));a.a.on(a.m,_.Ub,()=>a.emit("adbreakstart"));a.a.on(a.m,_.Vb,()=>a.emit("adbreakend"));a.a.on(a.m,_.mc,()=>
5
- {a.emit("adplay");a.emit("adplaying")});a.a.on(a.m,_.hc,()=>a.emit("adpause"));a.a.on(a.m,_.kc,()=>{a.emit("adplay");a.emit("adplaying")});a.a.on(a.m,_.nc,()=>a.emit("adended"));a.a.on(a.m,_.Zb,()=>a.emit("adfirstquartile"));a.a.on(a.m,_.ec,()=>a.emit("admidpoint"));a.a.on(a.m,_.oc,()=>a.emit("adthirdquartile"));a.j.Sc(a.F);a.j.Ue(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;
5
+ {a.emit("adplay");a.emit("adplaying")});a.a.on(a.m,_.hc,()=>a.emit("adpause"));a.a.on(a.m,_.kc,()=>{a.emit("adplay");a.emit("adplaying")});a.a.on(a.m,_.nc,()=>a.emit("adended"));a.a.on(a.m,_.Zb,()=>a.emit("adfirstquartile"));a.a.on(a.m,_.ec,()=>a.emit("admidpoint"));a.a.on(a.m,_.oc,()=>a.emit("adthirdquartile"));a.j.Sc(a.F);a.j.Ve(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
6
  var d=new _.lp(b.uris[b.uriIndex]);b={request_start:c,request_type:cA(b),request_hostname:d.a};a.g.debug("onRequestCanceled()","Track event: requestcanceled",b);a.emit("requestcanceled",b)}else{{d=c.requestStartTimestamp;const f=new _.lp(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:cA(c),request_hostname:f.a,request_error:`${cA(c)}${"LoadError"}`,request_error_code:e,request_error_text:b.toString()};
7
7
  a.g.debug("onRequestFailed()","Track event: requestfailed",b);a.emit("requestfailed",b)}}}})},jA=function(a,b){a.trigger(new _.H(_.Xd,{detail:b}))},kA=function(a){return!_.z(a)&&typeof a.init===_.ae&&typeof a.emit===_.ae},$z="manifest",aA="media",bA="encryption",dA=["x-request-id","cf-ray","x-amz-cf-id","x-akamai-request-id"];var lA=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 _.Vt;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,gA(this))}catch(d){throw this.h=!1,hA(this),new _.I(1,9,9302,null,d);}this.emit("playerready")}this.l&&!this.A&&(a=fA(this),this.emit("videochange",
8
8
  a),this.l=!1);iA(this)}release(){this.g.debug("release()");this.l?this.g.debug(_.ia):(hA(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(_.Je);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(_.Oe);
package/cl.persistent.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Kz="A persistent DRM session already exists for: ",Lz="No DRM configuration.",Mz="clpp.persistent",Nz="clpp.persistent.SimpleSessionStorage",Pz=function(a,b,c,d,e,f){a.K=Oz;const g=new Map,h=_.uq(b);g.set(h,{audioCapabilities:e,videoCapabilities:f,distinctiveIdentifier:_.Qe,persistentState:_.Af,sessionTypes:[_.Ve],label:h,drmInfos:[{keySystem:b,licenseServerUri:c,distinctiveIdentifierRequired:!1,persistentStateRequired:!0,audioRobustness:"",videoRobustness:"",serverCertificate:d,
2
2
  initData:null,keyIds:null}]});return _.Mq(a,g)},Rz=function(a,b){a.K=Qz;a.L=[];a.G=!0;return _.Nq(a,b)},Sz=function(a,b){return _.w(function*(){const c=yield _.dr(a,b);if(c){var d=[],e=a.h.get(c);e&&a.C&&(e.vc=new _.Kl,d.push(e.vc));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)})},Tz=function(a){const b=[];for(const c of a.h.keys())b.push(c.sessionId);return b},Uz=function(a,b){const c=_.pn(a),d=_.en([{drm:a}]);
3
- d.drm=a;a=new _.Ns({Cb:b,onError:()=>{},rf:()=>{},qf:()=>{},onEvent:()=>{},getConfiguration:()=>d,bd:()=>null});a.f=c;return a},Xz=function(a,b,c){return _.w(function*(){const d=Vz;if(a){var e=a.offlineId;if(0!==e.length){var f=yield d.get(e);if(f)Wz.debug(Kz,e);else{var g=Uz(a,c);try{yield Rz(g,b);yield _.br(g);yield _.er(g);const h=g.getDrmInfo(),k=b.map(l=>({contentType:_.Xm(l.video.mimeType,l.video.codecs),robustness:h.videoRobustness}));f={sessionIds:Tz(g),keySystem:h.keySystem,licenseServerUri:h.licenseServerUri,
3
+ d.drm=a;a=new _.Ns({Cb:b,onError:()=>{},tf:()=>{},rf:()=>{},onEvent:()=>{},getConfiguration:()=>d,bd:()=>null});a.f=c;return a},Xz=function(a,b,c){return _.w(function*(){const d=Vz;if(a){var e=a.offlineId;if(0!==e.length){var f=yield d.get(e);if(f)Wz.debug(Kz,e);else{var g=Uz(a,c);try{yield Rz(g,b);yield _.br(g);yield _.er(g);const h=g.getDrmInfo(),k=b.map(l=>({contentType:_.Xm(l.video.mimeType,l.video.codecs),robustness:h.videoRobustness}));f={sessionIds:Tz(g),keySystem:h.keySystem,licenseServerUri:h.licenseServerUri,
4
4
  serverCertificate:h.serverCertificate,audioCapabilities:[],videoCapabilities:k,drmConfig:a};yield d.store(e,f)}catch(h){throw Wz.error(`Error while persisting DRM session ${e}`),new _.I(1,6,6200,null,h);}finally{yield g.destroy()}}}}else Wz.debug(Lz)})},Qz=1,Oz=2,Yz=class{constructor(){this.g=new _.T(Nz)}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
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 Nz}};_.x("clpp.persistent.useStorage",function(a){{var b=["store","get","delete","clear","getName"];const c=[];_.z(a)||(_.mh(a.store)||c.push("store"),_.mh(a.get)||c.push("get"),_.mh(a.delete)||c.push("delete"),_.mh(a.clear)||c.push("clear"),_.mh(a.getName)||c.push("getName"),b=c)}if(0<b.length)throw Wz.warn("Invalid session storage implementation"),new _.I(1,6,6202,{missingMethods:b});Vz=a});
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 Hz=function(a,b){return 0<=b&&b<a.a.length},Iz=function(a){a.trigger(new _.H(_.kf))},Jz=class extends _.Yt{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}Hd(){return this.a}Mb(){return 0<this.a.length&&Hz(this,this.f)?this.a[this.f]:null}Dg(){const a=this.f+1;return 0<
2
- this.a.length&&Hz(this,a)?this.a[a]:null}hf(){return this.h}start(){this.h||(this.h=!0,this.m.on(_.Wd,this.j),this.ed(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.ed(Math.min(a.a.length-1,a.f+1))})}Wd(){const a=this;return _.w(function*(){yield a.ed(Math.max(0,a.f-1))})}ed(a,b){b=void 0===b?!1:b;const c=this;return _.w(function*(){if(0<c.a.length&&Hz(c,a)&&(b||c.f!==a)){c.f=a;var d=c.Mb();d&&!1===d.skippable||!d||(yield c.l(d),
3
- yield c.m.open(d.configuration),c.trigger(new _.H(_.jf,{item:d})))}})}append(a){this.a.push(a);Iz(this)}Hg(a,b){if(0<=b&&b<=this.a.length){const c=this.Mb();this.a.splice(b,0,a);c&&(this.f=this.a.indexOf(c));Iz(this)}}remove(a){if(0<this.a.length&&Hz(this,a)){if(this.f===a)throw Error("Can't remove the current item");this.a.splice(a,1);Iz(this)}}clear(){this.stop();this.f=0;this.a=[];this.h=!1;Iz(this)}};_.x("clpp.Playlist",Jz);Jz.prototype.clear=Jz.prototype.clear;Jz.prototype.remove=Jz.prototype.remove;
4
- Jz.prototype.insert=Jz.prototype.Hg;Jz.prototype.append=Jz.prototype.append;Jz.prototype.goTo=Jz.prototype.ed;Jz.prototype.previous=Jz.prototype.Wd;Jz.prototype.next=Jz.prototype.next;Jz.prototype.onEnded=Jz.prototype.Ea;Jz.prototype.stop=Jz.prototype.stop;Jz.prototype.start=Jz.prototype.start;Jz.prototype.isStarted=Jz.prototype.hf;Jz.prototype.getUpcoming=Jz.prototype.Dg;Jz.prototype.getCurrent=Jz.prototype.Mb;Jz.prototype.getQueue=Jz.prototype.Hd;Jz.prototype.getPosition=Jz.prototype.getPosition;
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Hz=function(a,b){return 0<=b&&b<a.a.length},Iz=function(a){a.trigger(new _.H(_.kf))},Jz=class extends _.Yt{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}Jd(){return this.a}Mb(){return 0<this.a.length&&Hz(this,this.f)?this.a[this.f]:null}Eg(){const a=this.f+1;return 0<
2
+ this.a.length&&Hz(this,a)?this.a[a]:null}jf(){return this.h}start(){this.h||(this.h=!0,this.m.on(_.Wd,this.j),this.ed(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.ed(Math.min(a.a.length-1,a.f+1))})}Xd(){const a=this;return _.w(function*(){yield a.ed(Math.max(0,a.f-1))})}ed(a,b){b=void 0===b?!1:b;const c=this;return _.w(function*(){if(0<c.a.length&&Hz(c,a)&&(b||c.f!==a)){c.f=a;var d=c.Mb();d&&!1===d.skippable||!d||(yield c.l(d),
3
+ yield c.m.open(d.configuration),c.trigger(new _.H(_.jf,{item:d})))}})}append(a){this.a.push(a);Iz(this)}Ig(a,b){if(0<=b&&b<=this.a.length){const c=this.Mb();this.a.splice(b,0,a);c&&(this.f=this.a.indexOf(c));Iz(this)}}remove(a){if(0<this.a.length&&Hz(this,a)){if(this.f===a)throw Error("Can't remove the current item");this.a.splice(a,1);Iz(this)}}clear(){this.stop();this.f=0;this.a=[];this.h=!1;Iz(this)}};_.x("clpp.Playlist",Jz);Jz.prototype.clear=Jz.prototype.clear;Jz.prototype.remove=Jz.prototype.remove;
4
+ Jz.prototype.insert=Jz.prototype.Ig;Jz.prototype.append=Jz.prototype.append;Jz.prototype.goTo=Jz.prototype.ed;Jz.prototype.previous=Jz.prototype.Xd;Jz.prototype.next=Jz.prototype.next;Jz.prototype.onEnded=Jz.prototype.Ea;Jz.prototype.stop=Jz.prototype.stop;Jz.prototype.start=Jz.prototype.start;Jz.prototype.isStarted=Jz.prototype.jf;Jz.prototype.getUpcoming=Jz.prototype.Eg;Jz.prototype.getCurrent=Jz.prototype.Mb;Jz.prototype.getQueue=Jz.prototype.Jd;Jz.prototype.getPosition=Jz.prototype.getPosition;
5
5
  Jz.prototype.off=Jz.prototype.off;Jz.prototype.one=Jz.prototype.one;Jz.prototype.on=Jz.prototype.on;};f.call(g, window);
package/cl.simid.js CHANGED
@@ -11,4 +11,4 @@ this.h=this.a.src="";this.l=0;this.a.style.opacity="0";window.removeEventListene
11
11
  this.j(a)}};var Gz=class extends _.Uv{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 Fz(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
12
  var c=this.m.getSurface();c?(this.g.info("Creating new session"),this.a=new Ez(this.h,b.simid),b=c.getContainer(),this.j=Az(this,b,c),this.j.observe(b),a.on(_.gg,this.w)):this.g.warn(qz)}}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&&(xz(this.a),this.o=!0,this.g.info(sz)),
13
13
  c&&(c=this.a,vz(c,tz(c,rz,{currentTime:a-b}))))):((a=this.m.getSurface())||this.g.warn(qz),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(_.gg,this.w),this.f&&(this.a.unload(),this.f=this.h.f=null))}},Fz=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}Bg(){return this.a}url(){return this.f?this.f.url:""}};_.Tn(new class{create(){return new Gz}});};f.call(g, window);
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:""}};_.Tn(new class{create(){return new Gz}});};f.call(g, window);
package/cl.smooth.js CHANGED
@@ -2,39 +2,39 @@ import {clpp} from "./cl.core.js";import './cl.mse.js';let g={};const _ = clpp._
2
2
  b,a.h),a.a+=2}catch(c){_.Vo()}},FQ=function(a,b){let c=[];const d=[];for(var e=0,f=0;e<a.a.length&&f<b.length;){var g=a.a[e];const h=b[f];g.startTime<h.startTime?(c.push(g),e++):(g.startTime>h.startTime?0===e?d.push(h):a.g.info("Refusing to rewrite original references on update!"):(.1<Math.abs(g.endTime-h.endTime)?c.push(new _.rI(g.position,h.startTime,h.endTime,h.Da,h.na,h.ja,h.Ka,h.keyInfo,h.Xc,h.timescale,h.horizontalTiles,h.verticalTiles,h.durationPerTile,null,null,h.cd,h.Ha)):c.push(g),e++),
3
3
  f++)}for(;e<a.a.length;)c.push(a.a[e++]);if(c.length)for(e=c[c.length-1].position+1;f<b.length;)g=b[f++],g=new _.rI(e++,g.startTime,g.endTime,g.Da,g.na,g.ja,g.Ka,g.keyInfo,g.Xc,g.timescale,g.horizontalTiles,g.verticalTiles,g.durationPerTile,null,null,g.cd,g.Ha),c.push(g);else c=b;b=c;if(d.length&&c.length){b=[];f=c[0].position;e=d.length;for(const h of d)b.push(new _.rI(f-e--,h.startTime,h.endTime,h.Da,h.na,h.ja,h.Ka,h.keyInfo,h.Xc,h.timescale,h.horizontalTiles,h.verticalTiles,h.durationPerTile,null,
4
4
  null,h.cd,h.Ha));for(const h of c)b.push(h)}a.a=b},GQ=function(a,b){for(let c=0;c<a.a.length;++c)if(a.a[c].endTime>b)return a.a.splice(0,c);b=a.a;a.a=[];return b},HQ=function(a,b){if(void 0!==b){var c=new Uint8Array(b);const d=Math.min(a.length,b);let e=0;for(;e<d;++e)c[e]=a.charCodeAt(e);for(;e<b;e++)c[e]=0;return c}b=new Uint8Array(a.length);for(c=0;c<a.length;++c)b[c]=a.charCodeAt(c);return b},IQ=function(a){const b=a.split("/");return b[b.length-1].toLowerCase().match("manifest(\\(.+\\))?")?a:
5
- `${a}/Manifest`},JQ=function(a,b,c,d){c=b.vg[c];b=b.tj;a=a.replace("Manifest","");b=b.replace("{bitrate}",String(d.bitrate)).replace("{Bitrate}",String(d.bitrate)).replace("{start time}",String(c.t)).replace("{start_time}",String(c.t));return _.qB([a],[b])[0]},KQ=function(a,b){if(a.type!==b.type)return!1;let c=[];a.type===_.t?c=["maxWidth","maxHeight","bitrate",yQ,"fourCC"]:a.type===_.q&&(c=["bitrate",yQ,"channels","bitsPerSample","samplingRate","fourCC"]);return _.qh(a,b,c,["id","segmentIndex"])},
6
- LQ=function(a,b,c){const d=c.pe.split("00000001");a={id:1,type:c.type,duration:a/b,timescale:b,kb:null,rc:null,width:NaN,height:NaN,lc:null,Yd:NaN,sampleSize:NaN,channelCount:NaN};switch(c.type){case _.t:a.kb=[_.fm(d[1])];a.rc=[_.fm(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.q:a.lc=_.fm(c.pe),a.sampleSize=c.Hh||16,a.Yd=c.Yd,a.channelCount=c.lg}return a},MQ=function(a,b){return a.filter(c=>c.type===b)},NQ=function(a,b){a=a.exec(b);return null==a||""===a[0]?null:(Number(a[4])||0)/1E3+
5
+ `${a}/Manifest`},JQ=function(a,b,c,d){c=b.wg[c];b=b.uj;a=a.replace("Manifest","");b=b.replace("{bitrate}",String(d.bitrate)).replace("{Bitrate}",String(d.bitrate)).replace("{start time}",String(c.t)).replace("{start_time}",String(c.t));return _.qB([a],[b])[0]},KQ=function(a,b){if(a.type!==b.type)return!1;let c=[];a.type===_.t?c=["maxWidth","maxHeight","bitrate",yQ,"fourCC"]:a.type===_.q&&(c=["bitrate",yQ,"channels","bitsPerSample","samplingRate","fourCC"]);return _.qh(a,b,c,["id","segmentIndex"])},
6
+ LQ=function(a,b,c){const d=c.qe.split("00000001");a={id:1,type:c.type,duration:a/b,timescale:b,kb:null,rc:null,width:NaN,height:NaN,lc:null,Zd:NaN,sampleSize:NaN,channelCount:NaN};switch(c.type){case _.t:a.kb=[_.fm(d[1])];a.rc=[_.fm(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.q:a.lc=_.fm(c.qe),a.sampleSize=c.Ih||16,a.Zd=c.Zd,a.channelCount=c.mg}return a},MQ=function(a,b){return a.filter(c=>c.type===b)},NQ=function(a,b){a=a.exec(b);return null==a||""===a[0]?null:(Number(a[4])||0)/1E3+
7
7
  (Number(a[3])||0)+60*(Number(a[2])||0)+3600*(Number(a[1])||0)},UQ=function(a,b,c){var d=null;if(OQ.test(a)){{a=OQ.exec(a);d=Number(a[1]);const e=Number(a[2]);let f=Number(a[3]),g=Number(a[4]);g+=(Number(a[5])||0)/c.f;f+=g/c.frameRate;d=f+60*e+3600*d}}else PQ.test(a)?d=NQ(PQ,a):QQ.test(a)?d=NQ(QQ,a):RQ.test(a)?(a=RQ.exec(a),d=Number(a[1])/c.frameRate):SQ.test(a)?(a=SQ.exec(a),d=Number(a[1])/c.a):TQ.test(a)&&(d=NQ(TQ,a));c=d;d=c+b;b=Math.floor(d/3600);c=Math.floor((d-3600*b)/60);a=Math.floor(d-3600*
8
- b-60*c);d-=a;10>b&&(b="0"+b);10>c&&(c="0"+c);10>a&&(a="0"+a);0===d?d="000":d=Math.round(1E3*d);return b+":"+c+":"+a+"."+d},VQ=function(a){let b=0;for(let c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.pp(b)},bR=function(a,b,c){a:{var d=[_.wd,_.ud];for(e of d)if((d=c.xe(e))&&d.keyId){var e=d.keyId;break a}_.B(xQ,"Could not get default Key ID for DRM init data!");e=null}c=new WQ("xxxx");a.type===_.t?c=new XQ(a.width,a.height):c=new YQ(a.channelCount,a.sampleSize,a.Yd);a=new ZQ;a.f=1;a.h=8;a.l=e||"00000000000000000000000000000000";
9
- a=(new WQ("schi")).append([a]);b=(new WQ(_.Nf)).append([new $Q(b),new aR(_.Wc,65536),a]);c.append([b]);return c},ER=function(a,b){var c=b.ye(),d=new cR(a.timescale,a.duration,a.id),e=(new dR).append([new eR(a.id)]),f=new fR(a.id,a.duration,a.timescale,a.width,a.height),g=new gR(a.timescale,a.duration);const h=new hR(a.type);var k=null,l=new iR;l.entries=[new jR];var m=new kR;switch(a.type){case _.t:k=new lR(a.kb,a.rc);c?(a=bR(a,"avc1",b),a.append([k]),m.entries=[a]):(a=(new mR(a.width,a.height)).append([k]),
10
- m.entries=[a]);k=new nR;break;case _.q:k=new oR(a.lc),c?(a=bR(a,"mp4a",b),a.append([k]),m.entries=[a]):(a=(new pR(a.channelCount,a.sampleSize,a.Yd)).append([k]),m.entries=[a]),k=new qR}m=(new rR).append([m,new sR,new tR,new uR,new vR]);l=(new wR).append([l]);l=(new xR).append([k,l,m]);g=(new yR).append([g,h,l]);f=(new zR).append([f,g]);d=(new AR).append([d,f,e]);e=new BR("dash",0,["iso6","mp41","avc1"]);c&&(c=b.xe(_.ud),b=b.xe(_.wd),c&&d.append([new CR("pssh",c.initData,8)]),b&&d.append([new CR("pssh",
8
+ b-60*c);d-=a;10>b&&(b="0"+b);10>c&&(c="0"+c);10>a&&(a="0"+a);0===d?d="000":d=Math.round(1E3*d);return b+":"+c+":"+a+"."+d},VQ=function(a){let b=0;for(let c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.pp(b)},bR=function(a,b,c){a:{var d=[_.wd,_.ud];for(e of d)if((d=c.ye(e))&&d.keyId){var e=d.keyId;break a}_.B(xQ,"Could not get default Key ID for DRM init data!");e=null}c=new WQ("xxxx");a.type===_.t?c=new XQ(a.width,a.height):c=new YQ(a.channelCount,a.sampleSize,a.Zd);a=new ZQ;a.f=1;a.h=8;a.l=e||"00000000000000000000000000000000";
9
+ a=(new WQ("schi")).append([a]);b=(new WQ(_.Nf)).append([new $Q(b),new aR(_.Wc,65536),a]);c.append([b]);return c},ER=function(a,b){var c=b.ze(),d=new cR(a.timescale,a.duration,a.id),e=(new dR).append([new eR(a.id)]),f=new fR(a.id,a.duration,a.timescale,a.width,a.height),g=new gR(a.timescale,a.duration);const h=new hR(a.type);var k=null,l=new iR;l.entries=[new jR];var m=new kR;switch(a.type){case _.t:k=new lR(a.kb,a.rc);c?(a=bR(a,"avc1",b),a.append([k]),m.entries=[a]):(a=(new mR(a.width,a.height)).append([k]),
10
+ m.entries=[a]);k=new nR;break;case _.q:k=new oR(a.lc),c?(a=bR(a,"mp4a",b),a.append([k]),m.entries=[a]):(a=(new pR(a.channelCount,a.sampleSize,a.Zd)).append([k]),m.entries=[a]),k=new qR}m=(new rR).append([m,new sR,new tR,new uR,new vR]);l=(new wR).append([l]);l=(new xR).append([k,l,m]);g=(new yR).append([g,h,l]);f=(new zR).append([f,g]);d=(new AR).append([d,f,e]);e=new BR("dash",0,["iso6","mp41","avc1"]);c&&(c=b.ye(_.ud),b=b.ye(_.wd),c&&d.append([new CR("pssh",c.initData,8)]),b&&d.append([new CR("pssh",
11
11
  b.initData,8)]),c||b||_.B(xQ,"Could not get PSSH init data!"));b=new DR([e,d]);return _.G(b.write())},OR=function(a,b){let c,d,e,f,g,h;(new _.np).N("moof",_.gp).fa("mfhd",k=>{{const l=new FR;l.f=_.N(k.reader);c=l}}).N("traf",_.gp).fa("tfhd",k=>{{const l=k.reader.Ta();if(null===k.flags)throw new _.I(_.D,3,3019,wQ);const m=new GR(k.version||0,k.flags||0);m.f=_.N(k.reader);0<l-k.reader.getPosition()&&k.flags&1&&(m.h=_.bp(k.reader));0<l-k.reader.getPosition()&&k.flags&2&&(m.A=_.N(k.reader));0<l-k.reader.getPosition()&&
12
12
  k.flags&8&&(m.j=_.N(k.reader));0<l-k.reader.getPosition()&&k.flags&16&&(m.o=_.N(k.reader));0<l-k.reader.getPosition()&&k.flags&32&&(m.l=_.N(k.reader));d=m}}).fa("trun",k=>{{var l=k.reader.Ta();if(null===k.flags)throw new _.I(_.D,3,3019,wQ);const m=new HR(k.version||0,k.flags||0);m.f=_.N(k.reader);0<l-k.reader.getPosition()&&k.flags&1&&(m.j=_.ap(k.reader));0<l-k.reader.getPosition()&&k.flags&4&&(m.l=_.N(k.reader));if(0<l-k.reader.getPosition())for(l=0;l<m.f;l++)k.flags&256&&m.o.push(_.N(k.reader)),
13
- k.flags&512&&m.sampleSize.push(_.N(k.reader)),k.flags&1024&&m.A.push(_.N(k.reader)),k.flags&2048&&(0===k.version?m.h.push(_.N(k.reader)):m.h.push(_.ap(k.reader)));e=m}}).fa("sdtp",k=>{{const l=_.dp(k.reader,k.reader.Ta());f=new IR("sdtp",k.version||0,k.flags||0,l,0)}}).N("uuid",k=>{var l=_.dp(k.reader,16);if(_.hm(l,JR)){l=_.N(k.reader);k.version=l>>>24;k.flags=l&16777215;l=new KR(k.version,k.flags);l.h=_.N(k.reader);k.flags&1&&(l.j=_.Zo(k.reader));for(let m=0;m<l.h;m++){const n={Gg:_.dp(k.reader,
14
- 8),vd:0,Lf:[]};if(k.flags&2){n.vd=_.$o(k.reader);for(let p=0;p<n.vd;p++){const u={hg:0,ig:0};u.hg=_.$o(k.reader);u.ig=_.N(k.reader);n.Lf.push(u)}}l.f.push(n)}g=l}}).N(_.ve,k=>{{const l=new LR;0<k.reader.Ta()?l.f=_.dp(k.reader,k.reader.Ta()):(_.B(xQ,"mdat box is empty!"),l.f=new Uint8Array(0));h=l}}).parse(a,!1);if(!h)return null;a=(new MR).append([d,e]);f&&a.append([f]);b.ye()&&g&&a.append([g]);b=(new NR).append([c,a]);return new DR([b,h])},TR=function(a,b,c,d){var e=d.ye(),f=parseInt(c*b,10);b=a.data||
13
+ k.flags&512&&m.sampleSize.push(_.N(k.reader)),k.flags&1024&&m.A.push(_.N(k.reader)),k.flags&2048&&(0===k.version?m.h.push(_.N(k.reader)):m.h.push(_.ap(k.reader)));e=m}}).fa("sdtp",k=>{{const l=_.dp(k.reader,k.reader.Ta());f=new IR("sdtp",k.version||0,k.flags||0,l,0)}}).N("uuid",k=>{var l=_.dp(k.reader,16);if(_.hm(l,JR)){l=_.N(k.reader);k.version=l>>>24;k.flags=l&16777215;l=new KR(k.version,k.flags);l.h=_.N(k.reader);k.flags&1&&(l.j=_.Zo(k.reader));for(let m=0;m<l.h;m++){const n={Hg:_.dp(k.reader,
14
+ 8),vd:0,Mf:[]};if(k.flags&2){n.vd=_.$o(k.reader);for(let p=0;p<n.vd;p++){const u={ig:0,jg:0};u.ig=_.$o(k.reader);u.jg=_.N(k.reader);n.Mf.push(u)}}l.f.push(n)}g=l}}).N(_.ve,k=>{{const l=new LR;0<k.reader.Ta()?l.f=_.dp(k.reader,k.reader.Ta()):(_.B(xQ,"mdat box is empty!"),l.f=new Uint8Array(0));h=l}}).parse(a,!1);if(!h)return null;a=(new MR).append([d,e]);f&&a.append([f]);b.ze()&&g&&a.append([g]);b=(new NR).append([c,a]);return new DR([b,h])},TR=function(a,b,c,d){var e=d.ze(),f=parseInt(c*b,10);b=a.data||
15
15
  new ArrayBuffer(0);var g=OR(b,d);if(null===g)return a.request.contentType===_.K?a.data:g;d=g.get(_.ve);if(a.request.contentType===_.K){e=d.f.buffer;if(c){e=_.ui(e);if((e=(new DOMParser).parseFromString(e,_.ag))&&"tt"===e.documentElement.tagName.toLowerCase())var h=e.documentElement;if(h&&(d=new PR(h.getAttribute("ttp:frameRate"),h.getAttribute("ttp:subFrameRate"),h.getAttribute("ttp:frameRateMultiplier"),h.getAttribute("ttp:tickRate")),h=h.getElementsByTagName("body")[0])){f=h.getElementsByTagName("p");
16
16
  for(let u=0,v=f.length;u<v;u++){h=f[u];a=c;b=d;g=["begin",_.Vd];for(let y=0,A=g.length;y<A;y++){b:{var k=h;var l=g[y],m=new RegExp("\\w+:"+l),n=0;if(k.hasAttribute(l)){k=k.getAttribute(l);break b}l=k.attributes;const E=l.length;for(;n<E;n++){var p=l[n].name;if(p=p.match(m)){k=k.getAttribute(p[0]);break b}}k=null}h.setAttribute(g[y],UQ(k||"",a,b))}}}e=(new XMLSerializer).serializeToString(e);c=_.vi(e).buffer}else c=e;return c}h=new NR;a=g.get("mfhd");b=new MR;k=g.get("tfhd");m=new QR(1,f);f=g.get("trun");
17
17
  n=g.get("sdtp");c=g.get("senc");k.f=1;k.flags&=16777214;k.flags|=131072;b.append([k,m,f]);n&&b.append([n]);if(e){g=0;k=[];if(c.flags&2)for(k=[],m=0;m<c.h;m++)k.push(10+6*c.f[m].vd);else g=8;b.append([c,new RR,new SR(g,k,c.h)])}h.append([a,b]);f.flags|=1;f.j=h.a()+8;d=new DR([h,d]);h=d.write();e&&(e=d.get("saio"),d=d.f,e.offset[0]=c.start+16,d.seek(e.start),e.write(d),h=d.buffer);return h},UR=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,
18
18
  audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,periodId:null}},VR=function(a){return{initData:_.dB(_.jq(a)),initDataType:_.Wc,keyId:a,periodId:null}},WR=function(a,b,c){a=_.rq(a);c&&a.version!==c&&(a=_.fB(a,c));return{initData:_.dB(a),initDataType:_.Wc,keyId:b,periodId:null}},YR=function(a,b){return _.w(function*(){var c=_.zk(b);c.timeout=a.f.attemptParameters.timeout;c.maxAttempts=Math.max(a.f.attemptParameters.maxAttempts,b.length);c.baseDelay=a.f.attemptParameters.baseDelay;
19
19
  c.backoffFactor=a.f.attemptParameters.backoffFactor;c.fuzzFactor=a.f.attemptParameters.fuzzFactor;c.type=1;c=yield a.D.networkingEngine.fetch(c).V;a.o=c.uri;return c})},fS=function(a,b){const c=_.O;let d=null;try{const kb=_.ui(b);d=c.j(kb,_.sb)}catch(kb){}if(!d)throw a.g.error("Unable to parse manifest"),new _.I(_.D,4,4033,a.o);const e=+ZR(a,d,"MajorVersion"),f=+ZR(a,d,"MinorVersion"),g=+d.getAttribute("TimeScale")||1E7;let h=+ZR(a,d,"Duration");const k="TRUE"===d.getAttribute("IsLive"),l=+d.getAttribute("LookAheadCount"),
20
- m=+d.getAttribute("DVRWindowLength")||Infinity,n=c.a(d,"Protection")[0];if(!1===/^[2].[0-2]$/.test(""+e+"."+f))throw a.g.error("Smooth Streaming version must be 2.0, 2.1 or 2.2"),new _.I(_.D,4,4036,a.o);k?($R(a,aS),a.B=typeof a.f.liveRefreshPeriod===_.r?1E3*a.f.liveRefreshPeriod:Math.min(1E3*a.I,1E4),h=Infinity):$R(a,bS);a.a={startTime:0,delay:0,duration:h/g,af:m/g,Qd:0};if(n){{var p=a.f.playreadyVersion;const kb=_.O,ya=[],yb=kb.a(n,"ProtectionHeader")[0],xc=_.em(kb.f(yb)||""),ic=_.rq(xc).a;ya.push(UR(_.wd,
20
+ m=+d.getAttribute("DVRWindowLength")||Infinity,n=c.a(d,"Protection")[0];if(!1===/^[2].[0-2]$/.test(""+e+"."+f))throw a.g.error("Smooth Streaming version must be 2.0, 2.1 or 2.2"),new _.I(_.D,4,4036,a.o);k?($R(a,aS),a.B=typeof a.f.liveRefreshPeriod===_.r?1E3*a.f.liveRefreshPeriod:Math.min(1E3*a.I,1E4),h=Infinity):$R(a,bS);a.a={startTime:0,delay:0,duration:h/g,bf:m/g,Rd:0};if(n){{var p=a.f.playreadyVersion;const kb=_.O,ya=[],yb=kb.a(n,"ProtectionHeader")[0],xc=_.em(kb.f(yb)||""),ic=_.rq(xc).a;ya.push(UR(_.wd,
21
21
  VR(ic),[ic]));ya.push(UR(_.ud,WR(xc,ic,p),[ic]));var u=ya}a.w=u}{const kb=[],ya=_.O.a(d,"StreamIndex");if(!ya.length)throw a.g.error("No streams found!"),new _.I(_.D,4,4034,a.o);for(let yb=0;yb<ya.length;yb++){{var v=a,y=ya[yb];const xc=ZR(v,y,"Type"),ic=+y.getAttribute("Chunks"),Mh=y.getAttribute("Subtype")||"",we=y.getAttribute("Language")||_.lg,xe=_.Kn(we),Nh=y.getAttribute("Name")||"",qf=+y.getAttribute(_.Ra),rg=+y.getAttribute(_.Qa),Js=ZR(v,y,"Url"),Hm=+y.getAttribute("TimeScale")||null;{const dd=
22
22
  [],sj=_.O.a(y,_.lb);for(let ye=0;ye<sj.length;ye++){{let ed,Oa,Od;var A=v,E=sj[ye],F=xc;const tj=+E.getAttribute("Index"),sg=+ZR(A,E,"Bitrate");let yc=NaN,tg=NaN,Im=NaN,Ks=NaN,bG=NaN,cG=NaN,dG=NaN;const eG=E.getAttribute("FourCC")||"";switch(F){case _.t:yc=+ZR(A,E,_.Qa);tg=+ZR(A,E,_.Ra);break;case _.q:Ks=+E.getAttribute("Channels")||2,Im=+ZR(A,E,"SamplingRate"),cG=+ZR(A,E,"AudioTag"),bG=+ZR(A,E,"BitsPerSample"),dG=+ZR(A,E,"PacketSize")}let Ls=String(E.getAttribute("CodecPrivateData"));if(F===_.q&&
23
23
  !Ls){{var C=Ks;const fG={96E3:0,88200:1,64E3:2,48E3:3,44100:4,32E3:5,24E3:6,22050:7,16E3:8,12E3:9,11025:10,8E3:11,7350:12},Jm=fG[Im];if("AACH"===eG){Oa=new Uint8Array(4);const gG=fG[2*Im];Oa[0]=40|Jm>>1;Oa[1]=Jm<<7|C<<3|gG>>1;Oa[2]=gG<<7|8;Oa[3]=0;ed=new Uint16Array(2);ed[0]=(Oa[0]<<8)+Oa[1];ed[1]=(Oa[2]<<8)+Oa[3];Od=ed[0].toString(16)+ed[1].toString(16)}else Oa=new Uint8Array(2),Oa[0]=16|Jm>>1,Oa[1]=Jm<<7|C<<3,ed=new Uint16Array(1),ed[0]=(Oa[0]<<8)+Oa[1],Od=ed[0].toString(16);Ls=Od.toUpperCase()}}var ja=
24
- {id:A.U++,type:F,index:tj,bitrate:sg,pe:Ls,maxHeight:yc,maxWidth:tg,Yd:Im,lg:Ks,yj:cG,Hh:bG,Lj:dG,Zh:eG,segmentIndex:null}}dd.push(ja)}var Ca=dd}{const dd=[],sj=_.O.a(y,"c");for(let ye=0;ye<sj.length;ye++){const ed=sj[ye];let Oa=parseInt(ed.getAttribute("t"),10),Od=parseInt(ed.getAttribute("d"),10),tj=parseInt(ed.getAttribute("r"),10),sg=0;if(isNaN(Oa)&&isNaN(Od))throw v.g.error("Either one or both FragmentDuration and FragmentTime field MUST be present in StreamFragmentElement"),new _.I(_.D,4,4037,
25
- v.o);0===ye&&isNaN(Oa)&&(sg=Oa=0);if(0<ye){const yc=dd[dd.length-1];sg=yc.n+1;yc.d||(yc.d=Oa-yc.t);Oa||(Oa=yc.t+yc.d);Od||(Od=Oa-yc.t)}dd.push({n:sg,d:Od,t:Oa});if(tj){tj--;for(let yc=0;yc<tj;yc++){const tg=dd[dd.length-1];sg=tg.n+1;Oa=tg.t+tg.d;Od=tg.d;dd.push({n:sg,d:Od,t:Oa})}}}v.F()||dd.length===ic||v.g.warn("Number of fragments ("+ic+") differs from number of chunks ("+dd.length+").");var Xa=dd}var Jb={type:xc,Cj:ic,gj:Mh,language:xe,kd:we,name:Nh,maxWidth:qf,maxHeight:rg,tj:Js,tracks:Ca,vg:Xa,
26
- timescale:Hm}}kb.push(Jb)}var vb=kb}const fc={Kj:e,Mg:f,timescale:g,duration:h,isLive:k,Jj:l,af:m,ff:!1,streams:vb};if(a.j&&a.A)return cS(a,fc),Promise.resolve();a.H.clear();{const kb=fc.timescale,ya=fc.duration,yb=MQ(fc.streams,_.q),xc=MQ(fc.streams,_.t),ic=MQ(fc.streams,_.K),Mh=[];let we=dS(a,ya,kb,yb),xe=dS(a,ya,kb,xc);const Nh=dS(a,ya,kb,ic);we.length||(we=[null]);xe.length||(xe=[null]);for(let qf=0;qf<xe.length;qf++)for(let rg=0;rg<we.length;rg++)Mh.push(eS(a,xe[qf],we[rg]));var gc={id:"ID",
27
- configurationId:void 0,startTime:0,endTime:ya,variants:Mh,textStreams:Nh,thumbStreams:[]}}{var Kb=fc.streams;let kb=a.a.startTime,ya=a.a.delay;const yb=a.J;let xc=Math.min(a.a.duration||Infinity,yb);const ic=a.F(),Mh=a.a.af,we=a.a.Qd,xe=a.I,Nh=isFinite(a.G)?a.G:0;if(ic)xc=Infinity,kb=Date.now()/1E3-we,a.a.startTime=kb,ya=3*xe;else{const rg=isFinite(yb)?yb:a.a.duration;for(const Js of Kb)for(const Hm of Js.tracks)Hm.segmentIndex.offset(-Nh),_.VB(Hm.segmentIndex,rg)}const qf=a.f.timeline||{};qf.type=
24
+ {id:A.U++,type:F,index:tj,bitrate:sg,qe:Ls,maxHeight:yc,maxWidth:tg,Zd:Im,mg:Ks,zj:cG,Ih:bG,Mj:dG,$h:eG,segmentIndex:null}}dd.push(ja)}var Ca=dd}{const dd=[],sj=_.O.a(y,"c");for(let ye=0;ye<sj.length;ye++){const ed=sj[ye];let Oa=parseInt(ed.getAttribute("t"),10),Od=parseInt(ed.getAttribute("d"),10),tj=parseInt(ed.getAttribute("r"),10),sg=0;if(isNaN(Oa)&&isNaN(Od))throw v.g.error("Either one or both FragmentDuration and FragmentTime field MUST be present in StreamFragmentElement"),new _.I(_.D,4,4037,
25
+ v.o);0===ye&&isNaN(Oa)&&(sg=Oa=0);if(0<ye){const yc=dd[dd.length-1];sg=yc.n+1;yc.d||(yc.d=Oa-yc.t);Oa||(Oa=yc.t+yc.d);Od||(Od=Oa-yc.t)}dd.push({n:sg,d:Od,t:Oa});if(tj){tj--;for(let yc=0;yc<tj;yc++){const tg=dd[dd.length-1];sg=tg.n+1;Oa=tg.t+tg.d;Od=tg.d;dd.push({n:sg,d:Od,t:Oa})}}}v.F()||dd.length===ic||v.g.warn("Number of fragments ("+ic+") differs from number of chunks ("+dd.length+").");var Xa=dd}var Jb={type:xc,Dj:ic,hj:Mh,language:xe,kd:we,name:Nh,maxWidth:qf,maxHeight:rg,uj:Js,tracks:Ca,wg:Xa,
26
+ timescale:Hm}}kb.push(Jb)}var vb=kb}const fc={Lj:e,Ng:f,timescale:g,duration:h,isLive:k,Kj:l,bf:m,gf:!1,streams:vb};if(a.j&&a.A)return cS(a,fc),Promise.resolve();a.H.clear();{const kb=fc.timescale,ya=fc.duration,yb=MQ(fc.streams,_.q),xc=MQ(fc.streams,_.t),ic=MQ(fc.streams,_.K),Mh=[];let we=dS(a,ya,kb,yb),xe=dS(a,ya,kb,xc);const Nh=dS(a,ya,kb,ic);we.length||(we=[null]);xe.length||(xe=[null]);for(let qf=0;qf<xe.length;qf++)for(let rg=0;rg<we.length;rg++)Mh.push(eS(a,xe[qf],we[rg]));var gc={id:"ID",
27
+ configurationId:void 0,startTime:0,endTime:ya,variants:Mh,textStreams:Nh,thumbStreams:[]}}{var Kb=fc.streams;let kb=a.a.startTime,ya=a.a.delay;const yb=a.J;let xc=Math.min(a.a.duration||Infinity,yb);const ic=a.F(),Mh=a.a.bf,we=a.a.Rd,xe=a.I,Nh=isFinite(a.G)?a.G:0;if(ic)xc=Infinity,kb=Date.now()/1E3-we,a.a.startTime=kb,ya=3*xe;else{const rg=isFinite(yb)?yb:a.a.duration;for(const Js of Kb)for(const Hm of Js.tracks)Hm.segmentIndex.offset(-Nh),_.VB(Hm.segmentIndex,rg)}const qf=a.f.timeline||{};qf.type=
28
28
  void 0;a.C=new _.uI(qf,kb,ya,!ic,!0);a.C.f=xc;_.mC(a.C,xe);a.C.A=Mh;ic||a.C.offset(-Nh)}a.D.filterAllPeriods([gc]);a.j={presentationTimeline:a.C,periods:[gc],minBufferTime:0,cues:[]};Promise.resolve();a.L||(a.D.networkingEngine.Sc(a.M),a.L=!0);a.A=fc;return Promise.resolve()},gS=function(a,b){null!=a.B&&null!=b&&(a.l=window.setTimeout(a.dc.bind(a),b))},ZR=function(a,b,c){if(b=b.getAttribute(c))return b;a.g.error("required attribute not provided: "+c);throw new _.I(_.D,4,4038,a.o,c);},$R=function(a,
29
- b){const c=b===bS;a.j&&a.j.presentationTimeline&&_.hC(a.j.presentationTimeline,c);c&&null!=a.l&&(window.clearTimeout(a.l),a.l=null,a.B=null);a.P=b},cS=function(a,b){for(let e=0;e<a.A.streams.length;e++){const f=b.streams[e];for(const g of a.A.streams[e].tracks){var c=f.tracks.find(h=>h.type===g.type&&h.bitrate===g.bitrate);if(c){KQ(g,c)||a.g.warn("The current stream is updated with a stream that seems to have different base properties!");var d=hS(a,a.A.timescale,f,c);c=g.segmentIndex;FQ(c,d);(d=a.a.af)&&
30
- GQ(c,(c.a.length?c.a[c.a.length-1].endTime:0)-d).forEach(h=>{h.Da().forEach(k=>{a.H.delete(k)})})}else a.g.warn(`Cannot find satisfying update for ${g.type} `+`track with bitrate ${g.bitrate}. Skipping update.`)}}},hS=function(a,b,c,d){let e=0;const f=[],g=c.timescale||b;c.vg.forEach((h,k)=>{const l=h.d/g;0===k?(h=h.t/g,a.G=Math.min(a.G,h)):h=f[k-1].endTime;const m=h+l,n=JQ(a.o,c,k,d);a.I=Math.max(a.I,l);f.push(new _.rI(k,h,m,()=>[n],0,null,0,null,!0,g));a.H.set(n,h);e+=l});if(c.type===_.t||c.type===
31
- _.q)b=f[f.length-1],a.J=Math.min(a.J,e),0===a.a.Qd?a.a.Qd=b.endTime:a.a.Qd=Math.min(a.a.Qd,b.endTime);return f},dS=function(a,b,c,d){let e=[];for(let f=0;f<d.length;f++){const g=d[f].tracks.map(h=>{{var k=d[f],l=hS(a,c,k,h);const C=new _.vI(l);var m=null;k.type!==_.K&&(m=iS(a,b,c,k,h));h.segmentIndex=C;l=_.pI++;var n=Promise.resolve.bind(Promise),p=C.f.bind(C),u=C.get.bind(C),v=C.h.bind(C),y=C.getDuration.bind(C),A=jS[k.type];var E="";switch(k.type){case _.t:E=h.pe;var F=/00000001[0-9]7/.exec(E);
32
- E="avc1."+(F&&F[0]?E.substr(E.indexOf(F[0])+10,6):"42c00c");a.g.debug("VIDEO CODECS: ",E);break;case _.q:E=h.pe,F=2,"AACH"===h.Zh?F=5:E&&(F=(parseInt(E.substr(0,2),16)&248)>>3),E="mp4a.40."+F,a.g.debug("AUDIO CODECS: ",E)}F=k.type===_.K?kS[k.gj]:void 0;h={id:l,originalId:null,Oj:null,createSegmentIndex:n,findSegmentPosition:p,getSegmentReference:u,adjustSegmentDurations:v,getDuration:y,segmentIndex:C,segmentLookupStrategy:_.LA,initSegmentReference:m,mimeType:A,codecs:E,frameRate:void 0,bandwidth:h.bitrate,
33
- width:h.maxWidth||void 0,height:h.maxHeight||void 0,kind:F,encrypted:a.K(),keyId:null,language:k.language,originalLanguage:k.kd,label:k.name,type:k.type,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:h.lg||null,spatialAudio:!1,closedCaptions:null}}return h});e=e.concat(g)}return e},eS=function(a,b,c){const d=(c?c.bandwidth:0)+(b?b.bandwidth:0),e=c?c.language:_.lg;return c||b?{id:a.h++,language:e,primary:!1,audio:c,video:b,bandwidth:d,drmInfos:a.w,allowedByApplication:!0,
34
- allowedByKeySystem:!0}:null},iS=function(a,b,c,d,e){b=LQ(b,d.timescale||c,e);c={isLive:a.F.bind(a),ye:a.K.bind(a),gi:()=>1,xe:a.R.bind(a)};d=new Uint8Array(0);try{d=ER(b,c)}catch(g){throw a.g.error("Failed to generate initialization segment."),new _.I(_.D,3,4035,g);}const f="data:text/plain;base64,"+_.dm(d);return new _.qI(()=>[f],0,null,null,!0)},WQ=class{constructor(a){this.type=a;this.size=this.start=0;this.parent=null;this.w=!1;this.entries=[];this.children=[]}append(a=[]){for(let b=0;b<a.length;b++)this.children.push(a[b]),
29
+ b){const c=b===bS;a.j&&a.j.presentationTimeline&&_.hC(a.j.presentationTimeline,c);c&&null!=a.l&&(window.clearTimeout(a.l),a.l=null,a.B=null);a.P=b},cS=function(a,b){for(let e=0;e<a.A.streams.length;e++){const f=b.streams[e];for(const g of a.A.streams[e].tracks){var c=f.tracks.find(h=>h.type===g.type&&h.bitrate===g.bitrate);if(c){KQ(g,c)||a.g.warn("The current stream is updated with a stream that seems to have different base properties!");var d=hS(a,a.A.timescale,f,c);c=g.segmentIndex;FQ(c,d);(d=a.a.bf)&&
30
+ GQ(c,(c.a.length?c.a[c.a.length-1].endTime:0)-d).forEach(h=>{h.Da().forEach(k=>{a.H.delete(k)})})}else a.g.warn(`Cannot find satisfying update for ${g.type} `+`track with bitrate ${g.bitrate}. Skipping update.`)}}},hS=function(a,b,c,d){let e=0;const f=[],g=c.timescale||b;c.wg.forEach((h,k)=>{const l=h.d/g;0===k?(h=h.t/g,a.G=Math.min(a.G,h)):h=f[k-1].endTime;const m=h+l,n=JQ(a.o,c,k,d);a.I=Math.max(a.I,l);f.push(new _.rI(k,h,m,()=>[n],0,null,0,null,!0,g));a.H.set(n,h);e+=l});if(c.type===_.t||c.type===
31
+ _.q)b=f[f.length-1],a.J=Math.min(a.J,e),0===a.a.Rd?a.a.Rd=b.endTime:a.a.Rd=Math.min(a.a.Rd,b.endTime);return f},dS=function(a,b,c,d){let e=[];for(let f=0;f<d.length;f++){const g=d[f].tracks.map(h=>{{var k=d[f],l=hS(a,c,k,h);const C=new _.vI(l);var m=null;k.type!==_.K&&(m=iS(a,b,c,k,h));h.segmentIndex=C;l=_.pI++;var n=Promise.resolve.bind(Promise),p=C.f.bind(C),u=C.get.bind(C),v=C.h.bind(C),y=C.getDuration.bind(C),A=jS[k.type];var E="";switch(k.type){case _.t:E=h.qe;var F=/00000001[0-9]7/.exec(E);
32
+ E="avc1."+(F&&F[0]?E.substr(E.indexOf(F[0])+10,6):"42c00c");a.g.debug("VIDEO CODECS: ",E);break;case _.q:E=h.qe,F=2,"AACH"===h.$h?F=5:E&&(F=(parseInt(E.substr(0,2),16)&248)>>3),E="mp4a.40."+F,a.g.debug("AUDIO CODECS: ",E)}F=k.type===_.K?kS[k.hj]:void 0;h={id:l,originalId:null,Pj:null,createSegmentIndex:n,findSegmentPosition:p,getSegmentReference:u,adjustSegmentDurations:v,getDuration:y,segmentIndex:C,segmentLookupStrategy:_.LA,initSegmentReference:m,mimeType:A,codecs:E,frameRate:void 0,bandwidth:h.bitrate,
33
+ width:h.maxWidth||void 0,height:h.maxHeight||void 0,kind:F,encrypted:a.K(),keyId:null,language:k.language,originalLanguage:k.kd,label:k.name,type:k.type,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:h.mg||null,spatialAudio:!1,closedCaptions:null}}return h});e=e.concat(g)}return e},eS=function(a,b,c){const d=(c?c.bandwidth:0)+(b?b.bandwidth:0),e=c?c.language:_.lg;return c||b?{id:a.h++,language:e,primary:!1,audio:c,video:b,bandwidth:d,drmInfos:a.w,allowedByApplication:!0,
34
+ allowedByKeySystem:!0}:null},iS=function(a,b,c,d,e){b=LQ(b,d.timescale||c,e);c={isLive:a.F.bind(a),ze:a.K.bind(a),hi:()=>1,ye:a.R.bind(a)};d=new Uint8Array(0);try{d=ER(b,c)}catch(g){throw a.g.error("Failed to generate initialization segment."),new _.I(_.D,3,4035,g);}const f="data:text/plain;base64,"+_.dm(d);return new _.qI(()=>[f],0,null,null,!0)},WQ=class{constructor(a){this.type=a;this.size=this.start=0;this.parent=null;this.w=!1;this.entries=[];this.children=[]}append(a=[]){for(let b=0;b<a.length;b++)this.children.push(a[b]),
35
35
  a[b].parent=this;return this}get(a){if(this.type===a)return this;for(let b=0;b<this.children.length;b++){if(this.children[b].type===a)return this.children[b];{const c=this.children[b].get(a);if(c)return c}}return null}a(){const a=Math.pow(2,32)-1;let b;b=4+this.type.length;"uuid"===this.type&&(b+=16);if(0<this.children.length)for(let c=0;c<this.children.length;c++)b+=this.children[c].a();this.size>a&&(b+=8);return b}write(a){var b=Math.pow(2,32)-1;this.start=a.getPosition();this.size=this.a();this.size>
36
36
  b?_.M(a,1):_.M(a,this.size);_.Wo(a,HQ(this.type));this.size>b&&zQ(a,this.size);"uuid"===this.type&&_.Wo(a,null);if(0<this.children.length&&!this.w)for(b=0;b<this.children.length;b++)this.children[b].write(a),this.children[b].a(),a.getPosition()}},lS=class extends WQ{constructor(a,b,c){super(a);this.version=b;this.flags=c}a(){return 4+super.a()}write(a){super.write(a);AQ(a,this.version);BQ(a,this.flags)}},CR=class extends WQ{constructor(a,b,c){super(a);this.f=b;this.offset=c}a(){return this.f.byteLength+
37
- super.a()-this.offset}write(a){super.write(a);_.Wo(a,this.f,this.offset);a.getPosition()}},IR=class extends lS{constructor(a,b,c,d,e){super(a,b,c);this.f=d;this.offset=e}a(){return this.f.byteLength+super.a()-this.offset}write(a){super.write(a);_.Wo(a,this.f,this.offset);a.getPosition()}},BR=class extends WQ{constructor(a,b,c){super("ftyp");this.h=a;this.Mg=b;this.f=c}a(){let a=this.h.length;a=a+4+this.f.join("").length;return a+super.a()}write(a){super.write(a);_.Wo(a,HQ(this.h));_.M(a,this.Mg);
37
+ super.a()-this.offset}write(a){super.write(a);_.Wo(a,this.f,this.offset);a.getPosition()}},IR=class extends lS{constructor(a,b,c,d,e){super(a,b,c);this.f=d;this.offset=e}a(){return this.f.byteLength+super.a()-this.offset}write(a){super.write(a);_.Wo(a,this.f,this.offset);a.getPosition()}},BR=class extends WQ{constructor(a,b,c){super("ftyp");this.h=a;this.Ng=b;this.f=c}a(){let a=this.h.length;a=a+4+this.f.join("").length;return a+super.a()}write(a){super.write(a);_.Wo(a,HQ(this.h));_.M(a,this.Ng);
38
38
  _.Wo(a,HQ(this.f.join("")));a.getPosition()}},AR=class extends WQ{constructor(){super(_.Ee)}},zR=class extends WQ{constructor(){super(_.ig)}},cR=class extends lS{constructor(a,b,c){super("mvhd",1,0);this.timescale=a;this.duration=b;this.volume=256;this.h=c+1;this.f=[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0]}a(){let a=0;a=1===this.version?a+28:a+16;a=a+44+this.f.length;return a+=super.a()}write(a){super.write(a);1===this.version?(zQ(a,0),zQ(a,0),_.M(a,this.timescale),
39
39
  zQ(a,this.duration*this.timescale)):(_.M(a,0),_.M(a,0),_.M(a,this.timescale),_.M(a,this.duration*this.timescale));_.M(a,65536);CQ(a,this.volume);CQ(a,0);_.M(a,0);_.M(a,0);for(let b=0;b<this.f.length;b++)AQ(a,this.f[b]);_.M(a,0);_.M(a,0);_.M(a,0);_.M(a,0);_.M(a,0);_.M(a,0);_.M(a,this.h);a.getPosition()}},dR=class extends WQ{constructor(){super("mvex")}},eR=class extends lS{constructor(a){super("trex",0,0);this.f=a}a(){return 20+super.a()}write(a){super.write(a);_.M(a,this.f);_.M(a,1);_.M(a,0);_.M(a,
40
40
  0);_.M(a,0);a.getPosition()}},fR=class extends lS{constructor(a,b,c,d,e){super("tkhd",1,7);this.h=a;this.duration=b;this.timescale=c;this.width=d;this.height=e;this.volume=1;this.f=[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0]}a(){let a=0;a=1===this.version?a+32:a+20;a=a+24+this.f.length;return a+super.a()}write(a){super.write(a);1===this.version?(zQ(a,0),zQ(a,0),_.M(a,this.h),_.M(a,0),zQ(a,this.duration*this.timescale)):(_.M(a,0),_.M(a,0),_.M(a,this.h),_.M(a,0),_.M(a,
@@ -55,8 +55,8 @@ _.M(a,this.f);this.flags&1&&zQ(a,this.h);this.flags&2&&_.M(a,this.A);this.flags&
55
55
  1;this.h=8;this.l="";this.j=[]}a(){let a;a=20;1===this.f&&0===this.h&&(a=a+1+this.j.length);return a+super.a()}write(a){super.write(a);AQ(a,0);0===this.version?AQ(a,0):AQ(a,0);AQ(a,this.f);AQ(a,this.h);_.Wo(a,_.fm(this.l));if(1===this.f&&0===this.h){AQ(a,0);for(let b=0;b<this.j.length;b++)AQ(a,this.j[b])}a.getPosition()}},aR=class extends lS{constructor(a,b){super("schm",0,0);this.f=a;this.h=b;this.fc=""}a(){let a=8;this.flags&1&&(a+=HQ(this.fc).byteLength);return a+super.a()}write(a){super.write(a);
56
56
  _.Wo(a,HQ(this.f));_.M(a,this.h);this.flags&1&&_.Wo(a,HQ(this.fc));a.getPosition()}},$Q=class extends WQ{constructor(a){super("frma");this.f=a}a(){return HQ(this.f).byteLength+super.a()}write(a){super.write(a);_.Wo(a,HQ(this.f));a.getPosition()}},RR=class extends lS{constructor(){super("saio",0,0);this.offset=[0]}a(){let a=0;this.flags&1&&(a+=8);a+=4;for(let b=0;1>b;b++)a=0===this.version?a+4:a+8;return a+super.a()}write(a){super.write(a);this.flags&1&&(_.M(a,0),_.M(a,0));_.M(a,1);for(let b=0;1>b;b++)0===
57
57
  this.version?_.M(a,this.offset[b]):zQ(a,this.offset[b]);a.getPosition()}},SR=class extends lS{constructor(a,b,c){super("saiz",0,0);this.f=a;this.j=b;this.h=c}a(){let a=0;this.flags&1&&(a+=8);a+=5;0===this.f&&(a+=this.j.length);return a+super.a()}write(a){super.write(a);this.flags&1&&(_.M(a,0),_.M(a,0));AQ(a,this.f);_.M(a,this.h);if(0===this.f)for(let b=0;b<this.h;b++)AQ(a,this.j[b]);a.getPosition()}},KR=class extends lS{constructor(a,b){super("senc",a,b);this.h=0;this.j=8;this.f=[]}a(){let a=4;this.flags&
58
- 1&&(a+=1);for(let b=0;b<this.h;b++)if(a+=this.f[b].Gg.byteLength,this.flags&2){a+=2;for(let c=0;c<this.f[b].vd;c++)a+=2,a+=4}return a+super.a()}write(a){super.write(a);_.M(a,this.h);this.flags&1&&AQ(a,this.j);for(let b=0;b<this.h;b++)if(_.Wo(a,this.f[b].Gg),this.flags&2){CQ(a,this.f[b].vd);for(let c=0;c<this.f[b].vd;c++)CQ(a,this.f[b].Lf[c].hg),_.M(a,this.f[b].Lf[c].ig)}a.getPosition()}};var PR=class{constructor(a,b,c,d){this.frameRate=Number(a)||30;this.f=Number(b)||1;this.a=Number(d);0===this.a&&(this.a=a?this.frameRate*this.f:1);c&&(a=/^(\d+) (\d+)$/g.exec(c))&&(this.frameRate*=parseInt(a[1],10)/parseInt(a[2],10))}},OQ=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,PQ=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,QQ=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,RQ=/^(\d*\.?\d*)f$/,SQ=/^(\d*\.?\d*)t$/,TQ=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/;var DR=class{constructor(a){this.a=a;this.f=VQ(this)}get(a){for(let b=0;b<this.a.length;b++){const c=this.a[b].get(a);if(c)return c}return null}write(){this.f=VQ(this);for(let a=0;a<this.a.length;a++)this.a[a].write(this.f);return this.f.buffer}};var JR=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);var pS=class{constructor(){this.A=this.j=this.f=this.D=null;this.h=1;this.U=0;this.o="";this.C=this.a=null;this.g=new _.T("clpp.smooth.SmoothParser");this.L=!1;this.l=this.B=null;this.P=bS;this.I=0;this.G=this.J=Infinity;this.w=[];this.M=this.S.bind(this);this.H=new Map}configure(a){this.f=a}start(a,b){this.D=b;a=[...new Set([a,IQ(a)])];return YR(this,a).then(c=>fS(this,c.data).then(()=>{gS(this,this.B);return this.j}))}requestStop(){}stop(){this.D&&this.D.networkingEngine.Xd(this.M);this.B=this.A=
58
+ 1&&(a+=1);for(let b=0;b<this.h;b++)if(a+=this.f[b].Hg.byteLength,this.flags&2){a+=2;for(let c=0;c<this.f[b].vd;c++)a+=2,a+=4}return a+super.a()}write(a){super.write(a);_.M(a,this.h);this.flags&1&&AQ(a,this.j);for(let b=0;b<this.h;b++)if(_.Wo(a,this.f[b].Hg),this.flags&2){CQ(a,this.f[b].vd);for(let c=0;c<this.f[b].vd;c++)CQ(a,this.f[b].Mf[c].ig),_.M(a,this.f[b].Mf[c].jg)}a.getPosition()}};var PR=class{constructor(a,b,c,d){this.frameRate=Number(a)||30;this.f=Number(b)||1;this.a=Number(d);0===this.a&&(this.a=a?this.frameRate*this.f:1);c&&(a=/^(\d+) (\d+)$/g.exec(c))&&(this.frameRate*=parseInt(a[1],10)/parseInt(a[2],10))}},OQ=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,PQ=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,QQ=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,RQ=/^(\d*\.?\d*)f$/,SQ=/^(\d*\.?\d*)t$/,TQ=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/;var DR=class{constructor(a){this.a=a;this.f=VQ(this)}get(a){for(let b=0;b<this.a.length;b++){const c=this.a[b].get(a);if(c)return c}return null}write(){this.f=VQ(this);for(let a=0;a<this.a.length;a++)this.a[a].write(this.f);return this.f.buffer}};var JR=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);var pS=class{constructor(){this.A=this.j=this.f=this.D=null;this.h=1;this.U=0;this.o="";this.C=this.a=null;this.g=new _.T("clpp.smooth.SmoothParser");this.L=!1;this.l=this.B=null;this.P=bS;this.I=0;this.G=this.J=Infinity;this.w=[];this.M=this.S.bind(this);this.H=new Map}configure(a){this.f=a}start(a,b){this.D=b;a=[...new Set([a,IQ(a)])];return YR(this,a).then(c=>fS(this,c.data).then(()=>{gS(this,this.B);return this.j}))}requestStop(){}stop(){this.D&&this.D.networkingEngine.Yd(this.M);this.B=this.A=
59
59
  this.j=this.f=this.D=null;this.l&&(clearTimeout(this.l),this.l=null);this.L=!1;this.J=this.G=Infinity;return Promise.resolve()}update(){if(this.F())return YR(this,[this.o]).then(a=>fS(this,a.data).then(()=>this.j)).catch(a=>{if(this.D)this.D.onError(a)})}setCurrentVariant(){}dc(){this.g.debug(_.BA);this.D&&(this.l=null,this.update().then(()=>{gS(this,this.B)}).catch(a=>{this.D&&(this.D.onError(a),1===a.severity&&gS(this,100))}))}F(){return this.P===aS}K(){return 0<this.w.length}R(a){let b=null;if(this.w.length)for(let c=
60
- 0;c<this.w.length;c++)if(this.w[c].keySystem===a){b=this.w[c].initData[0];break}return b}S(a){if(2!==a.request.type||a.uri.startsWith("data:"))return Promise.resolve(a);const b=a.request.timescale||this.A.timescale,c={isLive:this.F.bind(this),ye:this.K.bind(this),gi:()=>1,xe:this.R.bind(this)};let d=!1;const e=new _.I(_.D,3,4035,null);let f=null;try{const g=this.H.get(a.request.uris[a.request.uriIndex])||a.request.startTime||0;g!==a.request.startTime&&this.g.debug(`Using base media decode time ${g} instead of `+
60
+ 0;c<this.w.length;c++)if(this.w[c].keySystem===a){b=this.w[c].initData[0];break}return b}S(a){if(2!==a.request.type||a.uri.startsWith("data:"))return Promise.resolve(a);const b=a.request.timescale||this.A.timescale,c={isLive:this.F.bind(this),ze:this.K.bind(this),hi:()=>1,ye:this.R.bind(this)};let d=!1;const e=new _.I(_.D,3,4035,null);let f=null;try{const g=this.H.get(a.request.uris[a.request.uriIndex])||a.request.startTime||0;g!==a.request.startTime&&this.g.debug(`Using base media decode time ${g} instead of `+
61
61
  `segment reference time ${a.request.startTime}`);f=TR(a,b,g,c)}catch(g){d=!0,e.data=g,3E3===g.code&&(e.code=4039)}if(d||!f)return Promise.reject(e);a.data=f;return Promise.resolve(a)}loadVariant(a){return _.w(function*(){return a})}loadTextStream(a,b){const c=this;return _.w(function*(){let d;const e=c.j.periods.find(f=>f.id===b);e&&(d=e.textStreams.find(f=>f.id===a)||null);if(!d)throw new _.tl(`Could not load text stream with id: ${a}`);return d})}},jS={video:_.Ag,audio:_.Hc,text:_.Bc},bS=_.Fb,aS=
62
- "LIVE",kS={vj:_.GA,wj:_.VA};_.x("clpp.smooth.SmoothComponent",class extends _.Ev{install(){_.Pt.ism=pS;_.Ot[_.Cc]=pS}uninstall(){_.QC("ism");_.RC(_.Cc)}id(){return _.Of}});};f.call(g, window);
62
+ "LIVE",kS={wj:_.GA,xj:_.VA};_.x("clpp.smooth.SmoothComponent",class extends _.Ev{install(){_.Pt.ism=pS;_.Ot[_.Cc]=pS}uninstall(){_.QC("ism");_.RC(_.Cc)}id(){return _.Of}});};f.call(g, window);
package/cl.thumbnails.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Py="Thumbnail URL is mandatory",Qy="Wrong gridSize format",Ry="clpp.thumbnails",Ty=function(a,b){b.reduce((c,d)=>{let e=d,f=!1;typeof d===_.Ie&&(e=d.step,f=d.preloadWhileBuffering);return c.then(()=>Sy(a,0,e,!!f))},Promise.resolve())},Sy=function(a,b,c,d){if(a.w||b>=a.a.length)return Promise.resolve();const e=b+c;return Uy(a,d).then(()=>a.a[b].load()).then(()=>Sy(a,e,c,d))},Uy=function(a,b){return new Promise(c=>{if(b||2!==a.player.getState())c();else a.player.one(_.Oc,()=>{c()})})},
2
2
  Vy=function(a){const b=a.a.byteLength;a.f.forEach(c=>{c.offset+c.length<b&&c.ld.resolve()})},Yy=function(a,b){return Wy(a,b).then(c=>new Xy(c,b.time,b.duration))},Wy=function(a,b){return b.load().then(()=>{const c=_.G(a.a,b.offset,b.length);return"data:image/jpeg;base64,"+_.cm(c)})},Zy=function(a){a=a.split(/\.|:/).map(parseFloat);let b=0,c;const d={3:.001,2:1,1:60,0:3600};for(c=a.length-1;0<=c;c--)b+=a[c]*d[c];return b},$y=function(a,b){let c=null;for(const d of a)d.startTime<=b&&(c=d);return c},
3
- az=function(a,b){const c=a.horizontalTiles||b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{Nd:c,Vf:d,Fg:e,durationPerTile:a.durationPerTile||b.durationPerTile||(a.endTime-a.startTime)/e}},bz=function(a){return a.some(b=>0<b.thumbStreams.length)},jz=function(a){return a?a===cz||a===dz?new ez:a===fz?new gz:a===hz?new iz:null:null},kz=function(a){if(!a)return null;a=new _.lp(a);return a.path.match(/.*\.vtt$/i)?fz:a.path.match(/.*\.bif$/i)?hz:a.path.match(/.*\.(png|jpg|jpeg)$/i)?
3
+ az=function(a,b){const c=a.horizontalTiles||b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{Od:c,Wf:d,Gg:e,durationPerTile:a.durationPerTile||b.durationPerTile||(a.endTime-a.startTime)/e}},bz=function(a){return a.some(b=>0<b.thumbStreams.length)},jz=function(a){return a?a===cz||a===dz?new ez:a===fz?new gz:a===hz?new iz:null:null},kz=function(a){if(!a)return null;a=new _.lp(a);return a.path.match(/.*\.vtt$/i)?fz:a.path.match(/.*\.bif$/i)?hz:a.path.match(/.*\.(png|jpg|jpeg)$/i)?
4
4
  cz:null};var lz=class{constructor(){this.log=new _.T(Ry);this.player=null;this.a=[];this.w=!1}init(a,b){this.player=a;a.one(_.yf,()=>{this.w=!0});a.isLive()||this.l().then(()=>{b&&b.preload&&Ty(this,b.preload)})}};var Xy=class{constructor(a,b,c,d,e,f,g,h,k,l,m,n){d=void 0===d?0:d;e=void 0===e?0:e;f=void 0===f?0:f;g=void 0===g?0:g;h=void 0===h?1:h;k=void 0===k?1:k;l=void 0===l?0:l;m=void 0===m?0:m;n=void 0===n?new Image:n;this.time=b;this.src=a;this.duration=c;this.x=d;this.y=e;this.width=f;this.height=g;this.a=n;this.h=h;this.o=k;this.j=l;this.l=m;this.f=null}raw(){return this.a.cloneNode(!1)}element(a,b){let c=this.width,d=this.height;const e=this.width/this.height;void 0!==a&&void 0===b&&(b=0);null!==a&&
5
5
  void 0!==a&&(c=a);null!==b&&void 0!==b&&(d=b);c||(c=Math.ceil(d*e));d||(d=Math.ceil(c/e));a=document.createElement(_.Fd);a.style.width=c+_.vf;a.style.height=d+_.vf;a.style.backgroundColor="#000";a.style.backgroundRepeat="no-repeat";a.style.backgroundImage=`url("${this.src}")`;a.style.backgroundSize=`${Math.ceil(c/this.width*(this.a.naturalWidth||this.a.width))}px ${Math.ceil(d/this.height*(this.a.naturalHeight||this.a.height))}px`;b=this.y/this.height;a.style.backgroundPositionX="-"+this.x/this.width*
6
6
  c+_.vf;a.style.backgroundPositionY="-"+b*d+_.vf;return a}load(){this.f||(this.f=new Promise((a,b)=>{const c=()=>{this.width||(this.width=(this.a.naturalWidth||this.a.width)/this.h);this.height||(this.height=(this.a.naturalHeight||this.a.height)/this.o);this.x||(this.x=this.width*this.j);this.y||(this.y=this.height*this.l)};if(this.a.src&&this.a.complete)c(),a(this);else{var d=null,e=()=>{c();this.a.removeEventListener(_.qe,e);this.a.removeEventListener(_.Xd,d);a(this)};d=f=>{this.a.removeEventListener(_.qe,
@@ -12,8 +12,8 @@ h.offset-k.offset,k.duration=h.time-k.time;this.f.push(h);d+=8;(g=4294967295===g
12
12
  + 'URL: ${c}`,d);a.onError(new _.I(1,9,2013,"Error while loading and parsing BIF thumbnails.",d))})}get(a){const b=this;return _.w(function*(){if(0>a)throw new _.I(1,9,2014,`Position is out of range: ${a}`);yield b.h;var c=b.f.find(d=>a>=d.time&&a<d.time+d.duration);if(!c)throw new _.I(1,9,2014,`No thumbnail found for position: ${a}`);c=yield Yy(b,c);yield c.load();return c})}},nz=[137,66,73,70,13,10,26,10];var gz=class extends lz{constructor(){super();this.f=null}init(a,b){if(!b||!b.url)throw new _.I(1,9,7100,Py);const c=b.url,d=_.zk(c);d.type=_.yk;this.f=a.getNetworkEngine().fetch(d).V.then(e=>{e=e.data;if(!e)throw Error("No data in the response");e=_.ri(e).split(/\n/);for(let m=0;m<e.length;m++){var f=e[m],g=f.split(" --\x3e ");if(2===g.length){f=e[++m];var h=f.indexOf("\x3d");var k=h=0>h?[]:f.substr(h+1).split(/,/).map(parseFloat);h=k[0];const n=k[1],p=k[2];k=k[3];var l=f.indexOf("#");f=0>l?f:f.substr(0,
13
13
  l);f.match(/^http|^\/\//)||(f=c.substr(0,c.lastIndexOf("/"))+"/"+f);l=Zy(g[0]);g=Zy(g[1])-l;this.a.push(new Xy(f,l,g,h,n,p,k,0,0))}}}).catch(e=>{this.log.error("[VTT] Error while loading thumbnails "+`URL: ${c}`,e);a.onError(new _.I(1,9,2013,"Error while loading VTT thumbnails.",e))});super.init(a,b)}get(a){const b=this;return _.w(function*(){if(0>a)throw new _.I(1,9,2014,`Position is out of range: ${a}`);yield b.f;const c=b.a.find(d=>a>=d.time&&a<d.time+d.duration);if(!c)throw new _.I(1,9,2014,`No thumbnail found for position: ${a}`);
14
14
  yield c.load();return c})}l(){return this.f}};var oz=class extends lz{get(a){const b=this;return _.w(function*(){function c(){return new _.I(1,9,2014,`No thumbnail found for position: ${a}`)}if(0>a)throw b.log.error("Position must be greater than 0 but is "+a),new _.I(1,9,2014,`Position is out of range: ${a}`);var d=b.player.getPeriods();d=$y(d,a);if(!d)throw b.log.error("Could not find period for specified position",a),c();var e=d.thumbStreams.sort(b.f)[0];if(!e)throw b.log.error("Could not find thumb stream for specified position",a),c();d=
15
- e.findSegmentPosition(a-d.startTime);if(null===d||void 0===d)throw b.log.error("Could not find segment index for specified position",a),c();var f=e.getSegmentReference(d);if(f){const h=az(f,e),k=Math.floor((a-f.startTime)/h.durationPerTile);var g;if(0<b.a.length)f=e.findSegmentPosition(0),null!==f&&(g=b.a[(d-f)*h.Fg+k]);else if((e=f.Da())&&0<e.length){let l=g=0;f=f.startTime;1<h.Fg&&(g=k%h.Nd,l=Math.floor(k/h.Nd),f+=k*h.durationPerTile);g=new Xy(e[0],f,h.durationPerTile,void 0,void 0,void 0,void 0,
16
- h.Nd,h.Vf,g,l)}if(g)return yield g.load(),g}b.log.error("segment reference for specified segment index does not exist",d);throw c();})}f(a,b){return void 0!==a.bandwidth&&void 0!==b.bandwidth?a.bandwidth-b.bandwidth:0}l(){if(0<this.a.length)return Promise.resolve();var a=this.player.getPeriods();for(const b of a)if(a=b.thumbStreams.sort(this.f)[0]){let c=a.findSegmentPosition(0),d;for(;null!==c&&!_.z(d=a.getSegmentReference(c++));){const e=az(d,a),f=d.Da()[0],g=new Image;let h=d.startTime;for(let k=
17
- 0;k<e.Vf;++k)for(let l=0;l<e.Nd;++l)this.a.push(new Xy(f,h,e.durationPerTile,void 0,void 0,void 0,void 0,e.Nd,e.Vf,l,k,g)),h+=e.durationPerTile}}return Promise.resolve()}};var pz=class{constructor(){this.g=new _.T(Ry);this.a=this.m=null}onPlayerCreated(a){this.m=a}onPlayerWillDestroy(){this.m=null}onPlayerWillRelease(){this.a=null}onContentWillLoad(a){const b=a.getConfiguration().thumbnails;if(b)if(!1===b.enabled)this.g.info("Thumbnails disabled.");else{var c=b.mode||null;c||(c=kz(b.url||null));(this.a=jz(c))?(this.g.info("Loading thumbs configuration",b),this.m.one(_.se,()=>{this.g.info("Initialize thumbnails provider");try{this.a.init(a,b)}catch(d){this.m.onError(d)}})):
15
+ e.findSegmentPosition(a-d.startTime);if(null===d||void 0===d)throw b.log.error("Could not find segment index for specified position",a),c();var f=e.getSegmentReference(d);if(f){const h=az(f,e),k=Math.floor((a-f.startTime)/h.durationPerTile);var g;if(0<b.a.length)f=e.findSegmentPosition(0),null!==f&&(g=b.a[(d-f)*h.Gg+k]);else if((e=f.Da())&&0<e.length){let l=g=0;f=f.startTime;1<h.Gg&&(g=k%h.Od,l=Math.floor(k/h.Od),f+=k*h.durationPerTile);g=new Xy(e[0],f,h.durationPerTile,void 0,void 0,void 0,void 0,
16
+ h.Od,h.Wf,g,l)}if(g)return yield g.load(),g}b.log.error("segment reference for specified segment index does not exist",d);throw c();})}f(a,b){return void 0!==a.bandwidth&&void 0!==b.bandwidth?a.bandwidth-b.bandwidth:0}l(){if(0<this.a.length)return Promise.resolve();var a=this.player.getPeriods();for(const b of a)if(a=b.thumbStreams.sort(this.f)[0]){let c=a.findSegmentPosition(0),d;for(;null!==c&&!_.z(d=a.getSegmentReference(c++));){const e=az(d,a),f=d.Da()[0],g=new Image;let h=d.startTime;for(let k=
17
+ 0;k<e.Wf;++k)for(let l=0;l<e.Od;++l)this.a.push(new Xy(f,h,e.durationPerTile,void 0,void 0,void 0,void 0,e.Od,e.Wf,l,k,g)),h+=e.durationPerTile}}return Promise.resolve()}};var pz=class{constructor(){this.g=new _.T(Ry);this.a=this.m=null}onPlayerCreated(a){this.m=a}onPlayerWillDestroy(){this.m=null}onPlayerWillRelease(){this.a=null}onContentWillLoad(a){const b=a.getConfiguration().thumbnails;if(b)if(!1===b.enabled)this.g.info("Thumbnails disabled.");else{var c=b.mode||null;c||(c=kz(b.url||null));(this.a=jz(c))?(this.g.info("Loading thumbs configuration",b),this.m.one(_.se,()=>{this.g.info("Initialize thumbnails provider");try{this.a.init(a,b)}catch(d){this.m.onError(d)}})):
18
18
  this.g.warn("Unknown thumbnail mode",c)}else this.a=null}onContentLoaded(a){if(!this.a){var b=a.getConfiguration();b=b&&b.thumbnails;if(!b||void 0===b.enabled||b.enabled){var c=a.getPeriods();if(bz(c)){this.a=new oz;try{this.a.init(a,b)}catch(d){this.m.onError(d)}}}}}get(a){return this.a?this.a.get(a):Promise.reject(new _.I(1,9,2014,"Thumbnail format is not supported"))}id(){return"thumbnails"}};_.x("clpp.thumbnails.ThumbnailsPlugin",pz);pz.prototype.get=pz.prototype.get;pz.Id="thumbnails";
19
19
  var cz="SINGLE",dz="GRID",fz="WEBVTT",hz="BIF";_.Tn(new class{create(){return new pz}});};f.call(g, window);
package/cl.tizen.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import {clpp} from "./cl.core.js";import './cl.mse.js';let g={};const _ = clpp._;var f=function(window){'use strict';var RO="An unknown error occurred while trying to get volume",SO="Cannot get loading rendition due to platform limitations",TO="SecurityError",UO="The require privilege is: http://tizen.org/privilege/tv.audio",VO="onbufferingcomplete",WO="onbufferingprogress",XO="onbufferingstart",YO="oncurrentplaytime",ZO="ondrmevent",$O="onerror",aP="onstreamcompleted",bP="onsubtitlechange",cP="preparingend",dP="preparingstart",eP="|STARTBITRATE\x3d",fP=function(a,b,c){const d=e=>{c.call(a,e);a.removeEventListener(b,
2
- d)};a.addEventListener(b,d)},iP=function(a){return _.w(function*(){if(a.a!==_.wd&&a.a!==_.ud)throw new _.I(_.D,6,6001,`The key system ${a.a} is not supported by `+"the player or the platform");const b=a.f.get(a.a);if(!b.Sd)throw new _.I(_.D,6,6012,`No license server given for ${a.a}`);try{a.a===_.wd?yield gP(a):yield hP(a,b),a.o={keySystem:a.a,licenseServerUri:b.Sd,distinctiveIdentifierRequired:!1,persistentStateRequired:b.vf,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[],
3
- keyIds:[],periodId:null}}catch(c){throw a.g.error(`Error while configuring CDM for ${a.a}`,c),new _.I(_.D,6,6005,{message:JSON.stringify(c)});}})},kP=function(a,b){_.w(function*(){var c=a.f.get(a.a);a.g.debug("DRM Challenge data: ",b.challenge);const d=atob(b.challenge);var e=new Uint8Array(d.length);for(let h=0;h<d.length;++h)e[h]=d.charCodeAt(h);c=_.zk([b.serverurl&&""!==b.serverurl?b.serverurl:c.Sd],_.vk());c.type=3;c.body=e.buffer;c.method=_.eb;try{var f=yield a.D.Cb.fetch(c).V;if(a.j){var g=
2
+ d)};a.addEventListener(b,d)},iP=function(a){return _.w(function*(){if(a.a!==_.wd&&a.a!==_.ud)throw new _.I(_.D,6,6001,`The key system ${a.a} is not supported by `+"the player or the platform");const b=a.f.get(a.a);if(!b.Td)throw new _.I(_.D,6,6012,`No license server given for ${a.a}`);try{a.a===_.wd?yield gP(a):yield hP(a,b),a.o={keySystem:a.a,licenseServerUri:b.Td,distinctiveIdentifierRequired:!1,persistentStateRequired:b.wf,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[],
3
+ keyIds:[],periodId:null}}catch(c){throw a.g.error(`Error while configuring CDM for ${a.a}`,c),new _.I(_.D,6,6005,{message:JSON.stringify(c)});}})},kP=function(a,b){_.w(function*(){var c=a.f.get(a.a);a.g.debug("DRM Challenge data: ",b.challenge);const d=atob(b.challenge);var e=new Uint8Array(d.length);for(let h=0;h<d.length;++h)e[h]=d.charCodeAt(h);c=_.zk([b.serverurl&&""!==b.serverurl?b.serverurl:c.Td],_.vk());c.type=3;c.body=e.buffer;c.method=_.eb;try{var f=yield a.D.Cb.fetch(c).V;if(a.j){var g=
4
4
  _.G(f.data);const h=g.byteLength;e="";for(f=0;f<h;f++)e+=String.fromCharCode(g[f]);const k=`${b.session_id}PARAM_START_POSITION`+`${btoa(e)}PARAM_START_POSITION`;a.g.debug("Widevine license params",k);try{webapis.avplay.setDrm(jP,"widevine_license_data",k)}catch(l){a.g.error("License response rejected by CDM");const m=new _.I(_.D,6,6008,{browserError:JSON.stringify(l)});a.D.onError(m)}}}catch(h){a.g.error("License request failed.",JSON.stringify(h)),g=new _.I(_.D,6,6007,{message:"Error while fetching license!",
5
- url:h.data.url,status:h.data.status||NaN,response:h.data.response||"",headers:h.data.headers||{}},h),a.D.onError(g)}})},gP=function(a){return _.w(function*(){try{webapis.avplay.setDrm(jP,"Initialize",""),webapis.avplay.setDrm(jP,"widevine_app_session",a.l.id),webapis.avplay.setDrm(jP,"widevine_data_type",a.l.type)}catch(b){throw b;}})},hP=function(a,b){return _.w(function*(){var c={};c[lP]=!b.vf;c[mP]=b.Sd;""!==b.customData&&(c[nP]=b.customData);c=JSON.stringify(c);a.g.debug("PlayReady properties: ",
5
+ url:h.data.url,status:h.data.status||NaN,response:h.data.response||"",headers:h.data.headers||{}},h),a.D.onError(g)}})},gP=function(a){return _.w(function*(){try{webapis.avplay.setDrm(jP,"Initialize",""),webapis.avplay.setDrm(jP,"widevine_app_session",a.l.id),webapis.avplay.setDrm(jP,"widevine_data_type",a.l.type)}catch(b){throw b;}})},hP=function(a,b){return _.w(function*(){var c={};c[lP]=!b.wf;c[mP]=b.Td;""!==b.customData&&(c[nP]=b.customData);c=JSON.stringify(c);a.g.debug("PlayReady properties: ",
6
6
  c);try{webapis.avplay.setDrm(oP,"SetProperties",c)}catch(d){throw d;}})},qP=function(a,b){if(a.f!==b)if(a.f===_.As&&b!==_.Hs)a.g.debug(_.wA+`${pP(b)}`);else{var c=(new Date).getTime();a.j=a.f;a.f=b;2===a.f?(a.o=(new Date).getTime(),a.m.trigger(new _.H(_.Pc,{detail:{bufferedTimeMS:-1,reason:a.h}}))):2===a.j&&a.m.trigger(new _.H(_.Oc,{detail:{bufferedTimeMS:c-a.o,reason:a.h}}));b={currentState:a.f,previousState:a.j,timeSinceLastStateChangeMS:c-a.w};a.w=c;a.m.trigger(new _.H(_.Rf,{detail:b}));a.g.debug("State changed:",
7
7
  pP(a.j),"-\x3e",pP(a.f))}},pP=function(a){return Object.keys(_.Gs)[a]},tP=function(a){if(a.l){var b=a.a.getState(),c=a.f;switch(b){case rP:c=3;break;case sP:c=4;break;default:a.m.isEnded()?c=5:a.g.debug("Inconsistent AVPlay playback state:",b)}qP(a,c)}},uP=function(a){return _.w(function*(){const b=a.m.getConfiguration();let c;(c=yield _.Nt(a.B.url,a.m.getNetworkEngine(),b.manifest.attemptParameters,a.B.type||null))&&c.configure(b.manifest);return c})},vP=function(a){if(!a)return!1;a=a.periods;let b=
8
- !1;for(let c=0;c<a.length;c++)b=b||0<a[c].textStreams.length;return b},wP=function(a){const b=document.createElement(_.t),c=new _.xH,d=new _.CG,e=a.m.getTextDisplayer();return new _.yH(b,c,e,d,a.m.getConfiguration())},xP=function(a){const b={configuration:{},yb:()=>a.m.getPosition(),$:a.h,Cb:a.m.getNetworkEngine(),Wc:null,nf:a.G.bind(a),Og:a.F.bind(a),onError:a.H.bind(a),Pg:()=>{},onEvent:()=>{},Sg:a.I.bind(a),Fe:()=>{},Fd:()=>new _.BI,Xe:()=>!1,Cd:null};return new _.UH(a.a,b)},yP=function(a){const b=
8
+ !1;for(let c=0;c<a.length;c++)b=b||0<a[c].textStreams.length;return b},wP=function(a){const b=document.createElement(_.t),c=new _.xH,d=new _.CG,e=a.m.getTextDisplayer();return new _.yH(b,c,e,d,a.m.getConfiguration())},xP=function(a){const b={configuration:{},yb:()=>a.m.getPosition(),$:a.h,Cb:a.m.getNetworkEngine(),Wc:null,pf:a.G.bind(a),Pg:a.F.bind(a),onError:a.H.bind(a),Qg:()=>{},onEvent:()=>{},Tg:a.I.bind(a),Ge:()=>{},Gd:()=>new _.BI,Ye:()=>!1,Dd:null};return new _.UH(a.a,b)},yP=function(a){const b=
9
9
  a.m.getPosition();let c=null;for(const d of a.a.periods)d.startTime<=b&&(c=d);return c},zP=function(a){a.g.debug("getTextStreams()",a.a);if(a.a){var b=[],c=a.a.periods;a.g.debug("getting text streams");for(var d=0;d<c.length;d++)if(a.g.debug(c[d].startTime,a.m.getPosition()),c[d].startTime<=a.m.getPosition()){b=c[d].textStreams;break}a=b}else a=[];b=[];c=0;for(d=0;d<a.length;d++){const e=new _.Cr(String(c++),_.P);e.mimeType=a[d].mimeType;e.language=a[d].language;e.roles=a[d].roles;e.kind=a[d].kind||
10
10
  _.WA;const f=new _.Gr(String(a[d].id),e);f.bandwidth=a[d].bandwidth||null;e.renditions.push(f);b.push(e)}return b},AP=function(a){if(a.h&&!a.h.getTextDisplayer().isTextVisible())return null;if(a.f){const b=_.gF(a.f,_.K);let c=null;if(b){a=zP(a);for(let d=0;d<a.length;d++)if(a[d].renditions[0].id===String(b.id)){c=a[d].renditions[0];break}}return c}return null},BP=function(a,b){_.w(function*(){a.g.debug("Set active track",b);if(b&&(a.o=b.language,a.A=b.roles[0]||"",a.C=b.kind===_.Zd,a.a&&a.f)){a.setTextVisibility(!0);
11
11
  var c=yP(a);const d=b.renditions[0];(c=c.textStreams.find(e=>String(e.id)===d.id))?(a.w?(a.g.debug("Switching period defer text selection"),a.l=c):(yield _.xF(a.f,c),a.m.trigger(new _.H(_.bg))),a.o=c.language):a.g.error("No stream with id",d.id)}})},CP=function(a){const b=a.ta();b&&a.m.trigger(new _.H(_.Mc,{detail:{width:b.width,height:b.height,bandwidth:b.bandwidth,rendition:b}}))},DP=function(a,b){a.m.trigger(new _.H(_.Cg,{details:{width:b.width,height:b.height,bandwidth:b.bandwidth,track:b.track,
@@ -15,19 +15,19 @@ var e=b.filter(l=>l.type===HP),f=b.filter(l=>l.type===IP);const g=[];for(var h=0
15
15
  zP(a.j):LP(a,b);d[_.R]=[c];d[_.Q]=g;d[_.P]=e;return d},PP=function(a,b){if(b===_.P&&a.j)return AP(a.j);var c=NP(a.a)||[];if(0===c.length)return null;c=c.filter(e=>e.type===b.toUpperCase())[0];var d=null;b===_.R&&(d=EP(a,c.extra_info),d=FP(a,{width:d.Width,height:d.Height}));b===_.Q&&(c?(d=OP(a,c,_.Q),a.l=d):d=a.l);b===_.P&&(c?(d=OP(a,c,_.P),a.o=d):d=a.o);return d},SP=function(a,b){if(b){const c=b.track.type.toUpperCase();QP(a.a,c,Number(b.id)).then(()=>{c===IP&&(a.l=b,a.m.trigger(new _.H(_.Kc)));
16
16
  c===RP&&(a.o=b,a.m.trigger(new _.H(_.bg)))}).catch(()=>{a.g.error("Could not select "+c+" track.")})}else a.g.debug("Must provide valid rendition")},JP=function(a,b,c){const d=_.Kn(b.language||_.lg);c.language=_.zr(d);c.originalLanguage=d;c.channelsCount=b.channels?Number(b.channels):null;c.mimeType=_.Hc;a=new _.Gr(String(a),c);a.track=c;a.codec=b.fourCC||null;a.bandwidth=b.bit_rate||null;return a},KP=function(a,b,c){c.mimeType=_.Ag;a=new _.Gr(String(a),c);a.track=c;a.width=b.Width||null;a.height=
17
17
  b.Height||null;a.bandwidth=b.Bit_rate?Number(b.Bit_rate):null;a.codec=b.fourCC||null;return a},TP=function(a,b,c){b=_.Kn(b.track_lang||_.lg);c.mimeType="text/ttml";c.language=_.zr(b);c.originalLanguage=b;c.kind=_.WA;return new _.Gr(String(a),c)},LP=function(a,b){b=b.filter(d=>d.type===RP);const c=[];for(let d=0;d<b.length;d++){const e=EP(a,b[d].extra_info);if(!e){a.g.warn("Skipping text stream with no extra info");continue}const f=new _.Cr(String(a.h++),_.P);f.renditions.push(TP(b[d].index,e,f));
18
- c.push(f)}return c},OP=function(a,b,c){a=a.f[c]||[];b=String(b.index);c=null;for(let d=0;d<a.length;d++)for(let e=0;e<a[d].renditions.length;e++)if(a[d].renditions[e].id===b){c=a[d].renditions[e];break}return c},UP=function(a){return a.f&&a.a?a.a.mj:webapis.avplay.getTotalTrackInfo()},WP=function(a,b,c){a.g.debug("switchVideoTrack()");try{const d={estimatedBandwidth:parseInt(webapis.avplay.getStreamingProperty("CURRENT_BANDWITH"),10),currentBandwidth:b,nextBandwidth:c,currentPosition:a.getPosition()};
19
- a.a=VP(a);a.f=!0;webapis.avplay.stop();webapis.avplay.close();return a.load(a.m.getConfiguration(),d).then(()=>{const e=a.a.fg;a.f=!1;a.a=null;return e===sP?a.pause():a.play()})}catch(d){return Promise.reject(d)}},XP=function(a,b){var c=a.m.getTextDisplayer();c&&c.setTextVisibility(b);c=a.m.h;try{c||webapis.avplay.setSilentSubtitle(!b)}catch(d){a.g.debug("Could not set text track visibility",d)}},QP=function(a,b,c){b=b.toUpperCase();b===RP&&XP(a,!0);const d=a.j[b];d&&(d.Oe.stop(),a.j[b]=null,a.g.debug(`Cancelled pending track switch for ${b}`));
20
- return new Promise((e,f)=>{const g=(h,k,l)=>{l=void 0===l?!1:l;try{webapis.avplay.setSelectTrack(h,k),a.j[h]=null,e()}catch(m){a.g.debug(`Could not set ${h} track. Trying again...`+`AVPlay state: ${a.getState()}, `+`buffering: ${a.w}`,m),!1===l&&(a.j[h]={type:h,index:k,bg:0,Oe:new _.Pi(()=>g(h,c,!0))}),(k=a.j[h])&&3>k.bg?(a.w||++k.bg,k.Oe.la(a.w?.5:.25)):(a.g.debug("Could not set track after multiple attempts.Giving up..."),k&&k.Oe.stop(),a.j[h]=null,f())}};g(b,c)})},NP=function(a){return a.f&&a.a?
21
- a.a.Ph:webapis.avplay.getCurrentStreamInfo()},YP=function(a){return _.w(function*(){tizen.systeminfo.getPropertyValue("DISPLAY",b=>{a.A=b.resolutionWidth/1920;a.g.debug("Display resolution ratio: ",a.A)},b=>{a.g.debug("Could not load DISPLAY property");throw b;})})},ZP=function(a){try{webapis.avplay.setListener({onbufferingstart:a.J.bind(a),onbufferingprogress:a.I.bind(a),onbufferingcomplete:a.H.bind(a),onstreamcompleted:a.M.bind(a),oncurrentplaytime:b=>{a.trigger(new _.H(YO,{currentTime:b}))},onevent:a.L.bind(a),
22
- onsubtitlechange:a.P.bind(a),ondrmevent:a.K.bind(a),onerror:a.B.bind(a)})}catch(b){a.g.error(b)}},$P=function(a){const b=!!a.m.getTrackManager().Xa();try{webapis.avplay.setSilentSubtitle(!b)}catch(c){a.g.debug("Could not set AVPlay subtitle config",c)}},aQ=function(a,b){try{const c=b.estimatedBandwidth||0,d=b.currentBandwidth||0;a.g.debug({estimatedBandwidth:c,Dj:d});0!==c&&0!==d&&c>=1.15*d&&webapis.avplay.setStreamingProperty("ADAPTIVE_INFO",eP+d)}catch(c){a.g.debug(c)}},bQ=function(a,b){try{webapis.avplay.setStreamingProperty("ADAPTIVE_INFO",
23
- "|BITRATES\x3d"+b+eP+b)}catch(c){throw a.g.debug("Could not set fixed bandwidth",c),c;}},cQ=function(a){let b=null;try{b=tizen.tvaudiocontrol.isMute()}catch(c){switch(c.name){case TO:a.g.warn("The application doesn't have the privilege to get the mute state.",UO);break;default:a.g.warn(RO,c)}}return!!b},VP=function(a){return{position:a.getPosition(),state:a.m.getState(),fg:a.getState(),playbackRate:a.getPlaybackRate(),isLive:a.isLive(),duration:a.getDuration(),isMuted:cQ(a),volume:a.getVolume(),mj:UP(a),
24
- Ph:NP(a)}},dQ=function(){return new Promise((a,b)=>{if(window.webapis)a();else{const c=document.createElement("script");fP(c,_.qe,d=>a(d));fP(c,_.Xd,d=>b(d));c.src="$WEBAPIS/webapis/webapis.js";document.querySelector("head").appendChild(c)}})},eQ=function(a){return _.w(function*(){yield dQ();const b=new Promise(c=>{(new _.Pi(c)).la(5)});if(!(yield Promise.race([YP(a).then(()=>!0),b.then(()=>!1)])))return a.g.debug("Took to long for the SDK to be ready"),Promise.reject("SDK Timeout")})},fQ=function(a){return _.w(function*(){a.g.debug("avplay.prepare()");
18
+ c.push(f)}return c},OP=function(a,b,c){a=a.f[c]||[];b=String(b.index);c=null;for(let d=0;d<a.length;d++)for(let e=0;e<a[d].renditions.length;e++)if(a[d].renditions[e].id===b){c=a[d].renditions[e];break}return c},UP=function(a){return a.f&&a.a?a.a.nj:webapis.avplay.getTotalTrackInfo()},WP=function(a,b,c){a.g.debug("switchVideoTrack()");try{const d={estimatedBandwidth:parseInt(webapis.avplay.getStreamingProperty("CURRENT_BANDWITH"),10),currentBandwidth:b,nextBandwidth:c,currentPosition:a.getPosition()};
19
+ a.a=VP(a);a.f=!0;webapis.avplay.stop();webapis.avplay.close();return a.load(a.m.getConfiguration(),d).then(()=>{const e=a.a.gg;a.f=!1;a.a=null;return e===sP?a.pause():a.play()})}catch(d){return Promise.reject(d)}},XP=function(a,b){var c=a.m.getTextDisplayer();c&&c.setTextVisibility(b);c=a.m.h;try{c||webapis.avplay.setSilentSubtitle(!b)}catch(d){a.g.debug("Could not set text track visibility",d)}},QP=function(a,b,c){b=b.toUpperCase();b===RP&&XP(a,!0);const d=a.j[b];d&&(d.Pe.stop(),a.j[b]=null,a.g.debug(`Cancelled pending track switch for ${b}`));
20
+ return new Promise((e,f)=>{const g=(h,k,l)=>{l=void 0===l?!1:l;try{webapis.avplay.setSelectTrack(h,k),a.j[h]=null,e()}catch(m){a.g.debug(`Could not set ${h} track. Trying again...`+`AVPlay state: ${a.getState()}, `+`buffering: ${a.w}`,m),!1===l&&(a.j[h]={type:h,index:k,cg:0,Pe:new _.Pi(()=>g(h,c,!0))}),(k=a.j[h])&&3>k.cg?(a.w||++k.cg,k.Pe.la(a.w?.5:.25)):(a.g.debug("Could not set track after multiple attempts.Giving up..."),k&&k.Pe.stop(),a.j[h]=null,f())}};g(b,c)})},NP=function(a){return a.f&&a.a?
21
+ a.a.Qh:webapis.avplay.getCurrentStreamInfo()},YP=function(a){return _.w(function*(){tizen.systeminfo.getPropertyValue("DISPLAY",b=>{a.A=b.resolutionWidth/1920;a.g.debug("Display resolution ratio: ",a.A)},b=>{a.g.debug("Could not load DISPLAY property");throw b;})})},ZP=function(a){try{webapis.avplay.setListener({onbufferingstart:a.J.bind(a),onbufferingprogress:a.I.bind(a),onbufferingcomplete:a.H.bind(a),onstreamcompleted:a.M.bind(a),oncurrentplaytime:b=>{a.trigger(new _.H(YO,{currentTime:b}))},onevent:a.L.bind(a),
22
+ onsubtitlechange:a.P.bind(a),ondrmevent:a.K.bind(a),onerror:a.B.bind(a)})}catch(b){a.g.error(b)}},$P=function(a){const b=!!a.m.getTrackManager().Xa();try{webapis.avplay.setSilentSubtitle(!b)}catch(c){a.g.debug("Could not set AVPlay subtitle config",c)}},aQ=function(a,b){try{const c=b.estimatedBandwidth||0,d=b.currentBandwidth||0;a.g.debug({estimatedBandwidth:c,Ej:d});0!==c&&0!==d&&c>=1.15*d&&webapis.avplay.setStreamingProperty("ADAPTIVE_INFO",eP+d)}catch(c){a.g.debug(c)}},bQ=function(a,b){try{webapis.avplay.setStreamingProperty("ADAPTIVE_INFO",
23
+ "|BITRATES\x3d"+b+eP+b)}catch(c){throw a.g.debug("Could not set fixed bandwidth",c),c;}},cQ=function(a){let b=null;try{b=tizen.tvaudiocontrol.isMute()}catch(c){switch(c.name){case TO:a.g.warn("The application doesn't have the privilege to get the mute state.",UO);break;default:a.g.warn(RO,c)}}return!!b},VP=function(a){return{position:a.getPosition(),state:a.m.getState(),gg:a.getState(),playbackRate:a.getPlaybackRate(),isLive:a.isLive(),duration:a.getDuration(),isMuted:cQ(a),volume:a.getVolume(),nj:UP(a),
24
+ Qh:NP(a)}},dQ=function(){return new Promise((a,b)=>{if(window.webapis)a();else{const c=document.createElement("script");fP(c,_.qe,d=>a(d));fP(c,_.Xd,d=>b(d));c.src="$WEBAPIS/webapis/webapis.js";document.querySelector("head").appendChild(c)}})},eQ=function(a){return _.w(function*(){yield dQ();const b=new Promise(c=>{(new _.Pi(c)).la(5)});if(!(yield Promise.race([YP(a).then(()=>!0),b.then(()=>!1)])))return a.g.debug("Took to long for the SDK to be ready"),Promise.reject("SDK Timeout")})},fQ=function(a){return _.w(function*(){a.g.debug("avplay.prepare()");
25
25
  return new Promise((b,c)=>{try{webapis.avplay.prepareAsync(()=>{a.g.debug("AVPlay is ready!");$P(a);b()},d=>{a.g.debug("prepareAsync failed",d);c(d)})}catch(d){a.g.debug("Failed to prepare media player for playback"),c(d)}})})},gQ=function(a,b){try{tizen.tvaudiocontrol.setMute(b)}catch(c){switch(c.name){case TO:a.g.warn("The application does not have the privilege to set mute.",UO);break;default:a.g.warn(RO,c)}}},iQ=function(a,b,c){return _.w(function*(){a.l=_.jn(b);const d=a.G,e=c||{estimatedBandwidth:0,
26
26
  currentBandwidth:0,nextBandwidth:null,currentPosition:0};a.g.debug(`Loading manifest URL: ${a.l[d].url}`);let f=b.startTime||void 0;a.f&&(a.trigger(new _.H(XO)),f=c.currentPosition);try{let g=a.l[d].url;if(a.l[d].type===_.vc&&!g.includes(".mpd")){const h=new URL(g);h.searchParams.append("cl-ext",".mpd");g=h.toString()}webapis.avplay.open(g);e.nextBandwidth?(bQ(a,e.nextBandwidth),a.o=!1):(a.o||aQ(a,e),a.o=!0);ZP(a);if(b.drm&&b.drm.env){const h={onError:k=>a.m.onError(k),Cb:a.m.getNetworkEngine()};
27
27
  a.h=new hQ(b.drm,h);yield a.h.init()}else a.g.debug("No DRM configuration was provided. Assuming clear content");a.f||a.trigger(new _.H(dP));yield fQ(a);a.f||a.trigger(new _.H(cP));f&&typeof f===_.r&&0<f&&a.seek(f).catch(h=>{a.g.debug("Couldn't set start position",h)});a.f||(b.volume&&a.setVolume(b.volume),b.muted&&gQ(a,b.muted),b.autoplay&&a.m.play().catch(h=>{a.g.debug("Autoplay failed",h)}))}catch(g){throw a.g.debug("Error while attempting to load source."),g;}})},jQ=function(a){if("NONE"!==a.a.getState()){var b=
28
28
  a.j.getBoundingClientRect();{a=a.a;const c=Math.floor(b.left*a.A),d=Math.floor(b.top*a.A),e=Math.floor(b.width*a.A);b=Math.floor(b.height*a.A);a.g.debug("Setting display area to","x:",c,"y:",d,"width:",e,"height:",b);webapis.avplay.setDisplayRect(c,d,e,b);0===c&&0===d&&1920===e&&1080===b&&webapis.avplay.setDisplayMethod("PLAYER_DISPLAY_MODE_LETTER_BOX")}}else a.g.debug("Could not apply dimension. Player state "+a.a.getState())},hQ=class{constructor(a,b){this.h=a;this.o=null;this.a=_.He;this.l=null;
29
- this.j=!1;this.f=new Map;this.D=b;this.g=new _.T("clpp.tizen.DrmEngine")}init(){const a=this;return _.w(function*(){var b=_.mn[a.h.env]||null;if(!b)throw a.g.debug(_.ua,_.ib+a.h.env+_.aa),new _.I(_.D,6,6015,`DRM environment '${a.h.env}' is missing.`);a.l={id:String(Math.floor(1E4*Math.random())),type:"MPEG-DASH"};var c=Object.keys(a.h.customData||{}).length?btoa(JSON.stringify(a.h.customData)):"";b=_.on(b,a.h.customData);const d=b[_.ud];d&&a.f.set(_.ud,{Sd:d.licenseUrl||"",customData:c,vf:!1});(b=
30
- b[_.wd])&&a.f.set(_.wd,{Sd:b.licenseUrl||"",customData:c,vf:!1});if(0===a.f.size)throw new _.I(_.D,6,6E3);if((c=a.h.preferredDrmSystem)&&a.f.get(c))a.a=c;else if(a.f.get(_.ud))a.a=_.ud;else if(a.f.get(_.wd))a.a=_.wd;else throw new _.I(_.D,6,6001,"Configuration for the target system is missing.");yield iP(a);a.j=!0})}release(){const a=this;return _.w(function*(){a.j=!1;a.o=null;a.a=_.He;a.l=null;a.f=new Map})}getDrmInfo(){return this.o}},lP="DeleteLicenseAfterUse",mP="LicenseServer",nP="CustomData";var mQ=class{constructor(a){this.m=a;this.a=this.m.a;this.f=_.Hs;this.j=7;this.w=(new Date).getTime();this.l=!1;this.o=-1;this.h=2;this.g=new _.T("clpp.tizen.StateManager")}initialize(){this.a.on(XO,this.C,this);this.a.on(WO,this.B,this);this.a.on(VO,this.A,this);this.a.on(dP,this.H,this);this.a.on(cP,this.G,this);this.a.on(aP,this.F,this)}release(){qP(this,_.Hs);this.l=!1;this.o=-1;this.h=2}destroy(){this.release();this.a.off(XO,this.C);this.a.off(WO,this.B);this.a.off(VO,this.A);this.a.off(dP,this.H);
29
+ this.j=!1;this.f=new Map;this.D=b;this.g=new _.T("clpp.tizen.DrmEngine")}init(){const a=this;return _.w(function*(){var b=_.mn[a.h.env]||null;if(!b)throw a.g.debug(_.ua,_.ib+a.h.env+_.aa),new _.I(_.D,6,6015,`DRM environment '${a.h.env}' is missing.`);a.l={id:String(Math.floor(1E4*Math.random())),type:"MPEG-DASH"};var c=Object.keys(a.h.customData||{}).length?btoa(JSON.stringify(a.h.customData)):"";b=_.on(b,a.h.customData);const d=b[_.ud];d&&a.f.set(_.ud,{Td:d.licenseUrl||"",customData:c,wf:!1});(b=
30
+ b[_.wd])&&a.f.set(_.wd,{Td:b.licenseUrl||"",customData:c,wf:!1});if(0===a.f.size)throw new _.I(_.D,6,6E3);if((c=a.h.preferredDrmSystem)&&a.f.get(c))a.a=c;else if(a.f.get(_.ud))a.a=_.ud;else if(a.f.get(_.wd))a.a=_.wd;else throw new _.I(_.D,6,6001,"Configuration for the target system is missing.");yield iP(a);a.j=!0})}release(){const a=this;return _.w(function*(){a.j=!1;a.o=null;a.a=_.He;a.l=null;a.f=new Map})}getDrmInfo(){return this.o}},lP="DeleteLicenseAfterUse",mP="LicenseServer",nP="CustomData";var mQ=class{constructor(a){this.m=a;this.a=this.m.a;this.f=_.Hs;this.j=7;this.w=(new Date).getTime();this.l=!1;this.o=-1;this.h=2;this.g=new _.T("clpp.tizen.StateManager")}initialize(){this.a.on(XO,this.C,this);this.a.on(WO,this.B,this);this.a.on(VO,this.A,this);this.a.on(dP,this.H,this);this.a.on(cP,this.G,this);this.a.on(aP,this.F,this)}release(){qP(this,_.Hs);this.l=!1;this.o=-1;this.h=2}destroy(){this.release();this.a.off(XO,this.C);this.a.off(WO,this.B);this.a.off(VO,this.A);this.a.off(dP,this.H);
31
31
  this.a.off(cP,this.G);this.a.off(aP,this.F);this.m=this.a=null}C(){this.g.debug("Buffering start. Player state: ",this.a.getState());this.h=this.a.C?1:2;qP(this,2)}B(a){this.g.debug("Buffering progress: "+a.percent+" %. Player state: ",pP(this.f))}A(){this.g.debug("Buffering complete. Player state: ",this.a.getState());if(!this.l){this.l=!0;var a=this.m.getConfiguration().autoplay;const b=this.a.getState()===kQ;if(!a&&b){qP(this,4);return}}if(a=1!==this.f)a=this.a.getState(),a=a===rP||a===sP;a&&tP(this)}H(){this.g.debug("Preparing starts. AVPlay State: ",
32
32
  this.a.getState());this.a.getState()===lQ?qP(this,1):this.g.error("AVPlay prepares while state is not IDLE")}G(){this.g.debug("Preparing ends: AVPlay state:",this.a.getState())}F(){qP(this,5)}getState(){return this.f}};var nQ=class{constructor(){this.o=this.A=this.f=this.h=this.B=this.m=this.j=this.a=null;this.C=!1;this.w=!0;this.l=null;this.g=new _.T("clpp.tizen.TextStreamer")}initialize(a){this.m=a}load(a){const b=this;return _.w(function*(){if(b.m)if(b.B=a,b.j=yield uP(b),b.j){var c={configurationId:"",networkingEngine:b.m.getNetworkEngine(),onContentSteeringInfoFound:()=>null,filterNewPeriod:()=>{},filterAllPeriods:()=>{},onEvent:()=>{},onError:()=>{}};try{b.a=yield b.j.start(a.url,c)}catch(d){b.g.warn(d);try{b.a=
33
33
  yield b.j.start(a.url.replace(_.ge,_.fe),c)}catch(e){b.g.error(e),b.a=null}}if(b.a&&vP(b.a)){b.h=wP(b);try{yield b.h.open();b.f=xP(b);const d=b.m.getConfiguration();b.f.h=d.streaming;b.o=d.preferredTextLanguage;b.A=d.preferredTextRole;b.C=d.preferForcedSubtitles}catch(d){b.g.debug("Could not setup media source..."),b.h=null,b.f=null,b.j=null,b.a=null}}}else b.g.debug("Could not find manifest parser for source. Make sure parsers are registered.");else b.g.debug("Text streamer is not initialized. Will not load()")})}G(a){this.g.debug(_.PA,
@@ -41,9 +41,9 @@ qQ.prototype.addTextTrack=qQ.prototype.addTextTrack;qQ.prototype.setTextRenditio
41
41
  qQ.prototype.getLoadingAudioRendition=qQ.prototype.Nb;qQ.prototype.getLoadingVideoRendition=qQ.prototype.xb;qQ.prototype.getTextRendition=qQ.prototype.Xa;qQ.prototype.getAudioRendition=qQ.prototype.Qa;qQ.prototype.getVideoRendition=qQ.prototype.ta;qQ.prototype.getTextTracks=qQ.prototype.sa;qQ.prototype.getAudioTracks=qQ.prototype.getAudioTracks;qQ.prototype.getVideoTracks=qQ.prototype.getVideoTracks;var rQ=class extends _.Yt{constructor(a){super();this.m=a;this.h=null;this.g=new _.T("clpp.tizen.Middleware");this.F=1;this.C=!1;this.l=null;this.G=0;this.o=!0;this.f=!1;this.a=null;this.A=1;this.w=!1;this.j={}}J(){this.w=!0;this.f||this.trigger(new _.H(XO))}I(a){this.w=!0;this.trigger(new _.H(WO,{percent:a}))}H(){this.w=!1;this.trigger(new _.H(VO))}M(){this.trigger(new _.H(aP))}L(a,b){this.trigger(new _.H("onevent",{eventid:a,data:b}))}P(a,b,c,d,e){this.trigger(new _.H(bP,{duration:a,text:b,subtitleType:c,
42
42
  attriCount:d,attributes:e}))}K(a,b){this.trigger(new _.H(ZO,{drmType:a,drmData:b}));this.h&&(a=this.h,a.j&&(a.a===_.wd&&"Challenge"===b.name?kP(a,b):"DrmError"===b.name&&(a.g.debug("DrmError event",b),b=new _.I(_.D,6,6005,{message:JSON.stringify(b)}),a.D.onError(b))))}B(a){this.trigger(new _.H($O,{eventType:a}))}play(){const a=this.getState(),b=()=>new Promise((c,d)=>{let e=null;const f=()=>{c();clearTimeout(e)};this.one(YO,f,this);e=setTimeout(()=>{this.off(YO,f);d("Timeout")},3E4)});if(a===lQ)return(new Promise((c,
43
43
  d)=>{webapis.avplay.prepareAsync(()=>{$P(this);c(webapis.avplay.play())},e=>{this.trigger(new _.H($O));d(e)})})).then(()=>b());if(a===sP||a===kQ)try{return webapis.avplay.play(),b()}catch(c){return Promise.reject(c)}return a===rP?Promise.resolve():Promise.reject("Player is in invalid state")}pause(){try{webapis.avplay.pause()}catch(a){Promise.reject(a)}return this.getState()===sP?Promise.resolve():Promise.reject()}setPlaybackRate(a){const b=this.getState();if(b===kQ||b===rP||b===sP){try{webapis.avplay.setSpeed(a),
44
- this.F=a}catch(c){return this.g.debug("Error while trying to set playback rate",c),this.setPlaybackRate(this.F)}return!0}this.g.debug("Cannot set playback rate; AVPlay is in inconsistent state: "+b);return!1}getPlaybackRate(){return this.F}load(a,b){const c=this;return _.w(function*(){c.g.debug("configure()",b||"");try{yield eQ(c),yield iQ(c,a,b)}catch(d){throw new _.I(_.D,7,7003,null,d);}})}getState(){if(this.f&&this.a)return this.a.fg;try{return webapis.avplay.getState()}catch(a){this.B(JSON.stringify(a))}}seek(a){const b=
44
+ this.F=a}catch(c){return this.g.debug("Error while trying to set playback rate",c),this.setPlaybackRate(this.F)}return!0}this.g.debug("Cannot set playback rate; AVPlay is in inconsistent state: "+b);return!1}getPlaybackRate(){return this.F}load(a,b){const c=this;return _.w(function*(){c.g.debug("configure()",b||"");try{yield eQ(c),yield iQ(c,a,b)}catch(d){throw new _.I(_.D,7,7003,null,d);}})}getState(){if(this.f&&this.a)return this.a.gg;try{return webapis.avplay.getState()}catch(a){this.B(JSON.stringify(a))}}seek(a){const b=
45
45
  1E3*a;return new Promise((c,d)=>{this.C=!0;this.m.trigger(new _.H(_.ug));webapis.avplay.seekTo(b,()=>{this.C=!1;this.m.trigger(new _.H(_.qg));c()},()=>{this.C=!1;d()})})}getPosition(){if(this.f&&this.a)return this.a.position;try{return webapis.avplay.getCurrentTime()/1E3}catch(a){this.B(JSON.stringify(a))}}getDuration(){if(this.f&&this.a)return this.a.duration;try{return webapis.avplay.getDuration()/1E3}catch(a){this.B(JSON.stringify(a))}}release(){return new Promise((a,b)=>{try{this.h&&(this.h.release(),
46
- this.h=null);webapis.avplay.stop();webapis.avplay.close();for(const c in this.j){const d=this.j[c];d&&d.Oe.stop()}this.j={};this.F=1;this.C=!1;this.a=this.l=null;return a()}catch(c){return b(c)}})}getVolume(){let a=null;try{a=tizen.tvaudiocontrol.getVolume()}catch(b){switch(b.name){case TO:this.g.debug("The application does not have the privilege to get the volume.",UO);break;default:this.g.debug(RO,b)}}return a}setVolume(a){try{tizen.tvaudiocontrol.setVolume(Math.max(0,Math.min(100*a,100)))}catch(b){switch(b.name){case "InvalidValueError":this.g.warn("Invalid value passed for setVolume.",
46
+ this.h=null);webapis.avplay.stop();webapis.avplay.close();for(const c in this.j){const d=this.j[c];d&&d.Pe.stop()}this.j={};this.F=1;this.C=!1;this.a=this.l=null;return a()}catch(c){return b(c)}})}getVolume(){let a=null;try{a=tizen.tvaudiocontrol.getVolume()}catch(b){switch(b.name){case TO:this.g.debug("The application does not have the privilege to get the volume.",UO);break;default:this.g.debug(RO,b)}}return a}setVolume(a){try{tizen.tvaudiocontrol.setVolume(Math.max(0,Math.min(100*a,100)))}catch(b){switch(b.name){case "InvalidValueError":this.g.warn("Invalid value passed for setVolume.",
47
47
  "The passed value value should be in the range of 0 to 1.");break;case TO:this.g.warn("The application does not have the privilege to set the volume.",UO);break;default:this.g.warn("An unknown error occurred while trying to set volume",b)}}}isLive(){if(this.f&&this.a)return this.a.isLive;try{return"1"===webapis.avplay.getStreamingProperty("IS_LIVE")}catch(a){this.B(JSON.stringify(a))}}stop(){try{webapis.avplay.stop()}catch(a){this.g.debug(a)}}getDrmInfo(){this.h&&this.h.getDrmInfo();return null}setSourceIndex(a){this.G=
48
48
  a}getSourceIndex(){return this.G}getLoadedSource(){return this.l&&this.l[this.getSourceIndex()]}},lQ="IDLE",kQ="READY",rP="PLAYING",sP="PAUSED",HP=_.Eb,IP=_.pA,RP="TEXT",pQ="PLAYER_MSG_RESOLUTION_CHANGED",oQ="PLAYER_MSG_BITRATE_CHANGE",oP="PLAYREADY",jP="WIDEVINE_CDM";var vQ=class extends _.Yt{constructor(){super();this.a=new rQ(this);this.f=new mQ(this);this.configuration=this.B=_.cn();this.w=null;this.g=new _.T("clpp.tizen.Player");this.j=null;this.l=new qQ;this.C=new _.Hn;this.o=this.h=null;this.A=!1}I(){this.g.debug("On Stream completed. Current time: ",this.getPosition());this.trigger(new _.H(_.Wd));this.configuration.loop?this.seek(this.configuration.startTime||0).catch(()=>{this.g.debug("Could not loop playback")}):this.a.stop()}F(a){this.trigger(new _.H(_.gg,
49
49
  {currentTime:a.currentTime/1E3}))}J(a){const b=this.a.getPosition(),c=b+a.duration/1E3;let d=a.text||"";this.g.debug("Got subtitles: ",d,"start:",b,"end:",c,a);(d=_.Ei(d))&&this.o.append([new _.zu(b,c,d)],[])}G(a){this.g.debug("DRM event: "+a.drmType+", data: "+a.drmData)}K(){this.A||(this.g.debug("Initial buffering completed..."),this.A=!0)}H(a){this.g.debug(`Error: TYPE: ${a.eventType}`);qP(this.f,_.As);a=new _.I(_.D,7,7200,{tizenerror:a.eventType});this.a.release();this.trigger(new _.H(_.Xd,{detail:a}))}init(a,
package/cl.ttml.js CHANGED
@@ -12,9 +12,9 @@ d,1,100);c.widthUnits=gy(e,d);c.height=fy(e,a,2,100);c.heightUnits=gy(e,a);b=thi
12
12
  this.a){d=this.a.textOutline.split(" ");e="black";let g=".4em";const h=d[0]&&d[0].trim(),k=d[1]&&d[1].trim(),l=d[2]&&d[2].trim();3===d.length&&!zy.test(h)&&zy.test(k)&&zy.test(l)?(e=h,g=k):2===d.length&&!zy.test(h)&&zy.test(k)?(e=h,g=k):2===d.length&&zy.test(h)&&zy.test(k)&&(g=h);if(""!==g){g=Yx(g);d="text-shadow:"+`0 0 ${g} ${e},`+`0 0 ${g} ${e},`+`0 0 ${g} ${e};`;break a}}d=""}c+=d;"textShadow"in this.a?(d=ay(this.a.textShadow),d=Yx(d),d=`text-shadow:${d};`):d="";c=c+d+("fontFamily"in this.a?`font-family:${this.a.fontFamily.replace("monospaceSansSerif",
13
13
  "monospace").replace("monospaceSerif","monospace").replace("proportionalSansSerif","sans-serif").replace("proportionalSerif","sans-serif").replace("sansSerif","sans-serif").replace("default","sans-serif")};`:"");a:{if(Mx in this.a){d=this.a.textDecoration.split(" ");e=[];for(f of d)switch(f){case "underline":case "overline":e.push(f);break;case "lineThrough":e.push("line-through")}if(0<e.length){var f=`text-decoration:${e.join(" ")};`;break a}}f=""}"padding"in this.a?(d="border: solid transparent;border-width:"+
14
14
  Yx(this.a.padding),d+=";"):d="";f=c=c+f+d;"lineHeight"in this.a?(c="",d=this.a.lineHeight,d=Yx(d),d=$x(d,b),c+="line-height:",c+=d,c+=";"):c="";a.push(f+c+"}");a:{if("fontSize"in this.a&&(f=this.a.fontSize.split(" "),c=null,1===f.length&&(c=f[0]),2===f.length&&(c=f[1]),c)){c=c.trim();c=Yx(c);c=$x(c,b);b=`font-size:${c};`;break a}b=null}b&&(f=`::ttml .${this.h} .clpp-text-wrapper {`,f+=b,f+="}",a.push(f),f=`::ttml .clpp-text-wrapper__${this.h} {`,f+=b,f+="}",a.push(f));return a}},Ey=new Map([[Hx,"background-color"],
15
- ["color","color"],[Ix,Ix],["fontStyle","font-style"],["fontWeight","font-weight"],["opacity","opacity"],["zIndex","z-index"]]);var Gy=class{constructor(a){this.B=a;this.w=this.l=null;this.A=0;this.h=new Map;this.a=new Map;this.j=new Map;this.f=new Map;this.o=[]}},ly=0;var Jy=class{constructor(a){this.a=a.firstChild;this.f=new Set}Md(){return!!this.a}next(){if(!this.a)return null;let a=this.a;do this.f.add(a),a.nodeType!==Node.TEXT_NODE&&!Hy.has(Xx(a.nodeName))||Iy.has(Xx(a.nodeName))||!a.firstChild||this.f.has(a.firstChild)?a.nextSibling?a=a.nextSibling:a=a.parentNode:a=a.firstChild;while(a&&(this.f.has(a)||a.nodeType!==Node.TEXT_NODE&&!Hy.has(Xx(a.nodeName))));const b=this.a;this.a=a;return b}},Hy=new Set(["tt","head","layout",_.Be,_.he,Kx,"styling",_.Wf,"body",
15
+ ["color","color"],[Ix,Ix],["fontStyle","font-style"],["fontWeight","font-weight"],["opacity","opacity"],["zIndex","z-index"]]);var Gy=class{constructor(a){this.B=a;this.w=this.l=null;this.A=0;this.h=new Map;this.a=new Map;this.j=new Map;this.f=new Map;this.o=[]}},ly=0;var Jy=class{constructor(a){this.a=a.firstChild;this.f=new Set}Nd(){return!!this.a}next(){if(!this.a)return null;let a=this.a;do this.f.add(a),a.nodeType!==Node.TEXT_NODE&&!Hy.has(Xx(a.nodeName))||Iy.has(Xx(a.nodeName))||!a.firstChild||this.f.has(a.firstChild)?a.nextSibling?a=a.nextSibling:a=a.parentNode:a=a.firstChild;while(a&&(this.f.has(a)||a.nodeType!==Node.TEXT_NODE&&!Hy.has(Xx(a.nodeName))));const b=this.a;this.a=a;return b}},Hy=new Set(["tt","head","layout",_.Be,_.he,Kx,"styling",_.Wf,"body",
16
16
  _.Fd,"p","span","br"]),Iy=new Set([_.Wf,_.he]);var ty=class{constructor(a,b,c,d,e,f){this.h=a;this.a=b;this.j=c;this.l=d;this.f=e;this.attributes=f}getId(){return this.attributes.id}};var Ky=class{constructor(){this.a=new Map}};var Ly=class{constructor(a){this.a=a;this.f=new DOMParser}parseInit(){}parseMedia(a,b,c){c&&c.length||(c=[a.byteLength]);var d=_.ih(this.a.ttml||{}),e=_.G(a,0,c[0]);e=_.ri(e);if(""===e)return{cues:[],styles:[]};var f=null;try{f=this.f.parseFromString(e,_.ag)}catch(m){throw new _.I(_.D,2,2005,"Failed to parse TTML.");}d=new Gy(d);e=new Ky;f=new Jy(f);b=b.periodStart;typeof b===_.r&&(d.A=b);b=c[0];for(var g=1;g<c.length;++g){var h=c[g],k=_.G(a,b,h);k=_.cm(k);const m=`urn:mpeg:14496-30:subs:${g}`;d.h.set(m,
17
- new xy(m,k,{imageType:"PNG",encoding:"Base64"}));b+=h}for(;f.Md();)a=f.next(),a=uy(e,a),c=d,b=a,"tt"===ry(b)&&(c.l=new Dy(c.B,Object.assign({},b.attributes))),c=d,b=a,"tt"===ry(b)&&(c.w=new By(b.attributes.frameRate,b.attributes.subFrameRate,b.attributes.frameRateMultiplier,b.attributes.tickRate)),c=d,b=a,ry(b)!==_.he||b.attributes.begin||b.attributes.end||(g=`#${b.getId()}`,c.h.set(g,new xy(g,b.h.textContent,b.attributes))),c=d,g=a,ry(g)===_.he&&g.attributes.begin&&g.attributes.end?(b=`#${my()}`,
17
+ new xy(m,k,{imageType:"PNG",encoding:"Base64"}));b+=h}for(;f.Nd();)a=f.next(),a=uy(e,a),c=d,b=a,"tt"===ry(b)&&(c.l=new Dy(c.B,Object.assign({},b.attributes))),c=d,b=a,"tt"===ry(b)&&(c.w=new By(b.attributes.frameRate,b.attributes.subFrameRate,b.attributes.frameRateMultiplier,b.attributes.tickRate)),c=d,b=a,ry(b)!==_.he||b.attributes.begin||b.attributes.end||(g=`#${b.getId()}`,c.h.set(g,new xy(g,b.h.textContent,b.attributes))),c=d,g=a,ry(g)===_.he&&g.attributes.begin&&g.attributes.end?(b=`#${my()}`,
18
18
  g=new xy(b,g.h.textContent,g.attributes),c.h.set(b,g),c=g):c=null,c&&(a.j=c.getId()),c=d,b=a,ry(b)===_.Wf&&(g=b.getId()||my(),h=new Fy(g,b.f,Object.assign({},b.attributes)),c.a.set(g,h),b.a&&c.j.get(b.a).f.push(g)),c=d,g=a,ry(g)!==_.Wf&&oy(g)?(b=my(),g=new Fy(b,[],Object.assign({},g.attributes)),c.a.set(b,g),c=g):c=null,c&&a.f.push(c.getId()),c=d,g=a,ry(g)!==_.Fd||!g.attributes.extent&&!g.attributes.origin?c=null:(b=my(),g=new Cy(b,py(c,g.f),Object.assign({},g.attributes)),c.j.set(b,g),c=g),c&&(a.a=
19
19
  c.getId()),c=d,g=a,ry(g)!==Kx?c=null:(b=g.getId(),g=new Cy(b,py(c,g.f),Object.assign({},g.attributes)),c.j.set(b,g),c=g),c&&(a.a=c.getId()),c=d,g=a,b=g.l,-1===[_.da,"span","br"].indexOf(ry(g))||0===b.length?c=null:(h=b[b.length-1],c.f.has(h)?(b=my(),g=new Ay(b,g.h.nodeName===_.da?g.h.textContent:null,"br"===ry(g),g.a,g.j,py(c,g.f),g.attributes),c.f.set(b,g),(c=c.f.get(h))&&c.j.push(b),c=g):c=null),c&&a.l.push(c.getId()),c=d,g=a,"p"===ry(g)||g.j?(b=my(),g=new Ay(b,null,!1,g.a,g.j,py(c,g.f),g.attributes),
20
20
  c.f.set(b,g),c.o.push(g),c=g):c=null,c&&a.l.push(c.getId());e=qy(d);f=[];for(l of d.a.values())f.push(...l.build(d.l));var l=f;return{cues:e,styles:l}}};var My=class{constructor(a){this.f=a}a(a){var b=new Ly(this.f);({cues:a}=b.parseMedia(a,{periodStart:0,segmentStart:null,segmentEnd:0}));b="WEBVTT\n\n";for(const d of a){a=b;b=vy(d.startTime)+" --\x3e "+vy(d.endTime);{var c=d;const e=[];switch(c.textAlign){case _.ke:e.push("align:left");break;case _.Cf:e.push("align:right");break;case _.uu:e.push("align:middle");break;case _.Qf:e.push("align:start");break;case _.Vd:e.push("align:end")}switch(c.writingMode){case _.xg:e.push("vertical:lr");break;case _.yg:e.push("vertical:rl")}c=
package/cl.verimatrix.js CHANGED
@@ -1,4 +1,4 @@
1
1
  import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var tx="VerimatrixVCAS",ux="clpp.verimatrix.Vcas",vx="clpp.verimatrix.VcasComponent",xx=function(a,b){return a.C===wx?(a=Object.assign({},{deviceId:_.dm(_.xi(a.A))},a.a&&{authenticator:_.dm(_.xi(a.a))}),b+_.Rm(a)):b},Dx=class extends _.Op{constructor(a){super(tx);const b={};b[yx]=yx;b[zx]=zx;const {deviceId:c,authenticator:d,licenseRequestVuidLocation:e=wx,httpHeaderNames:f=b,widevineLicenseUrl:g,playReadyLicenseUrl:h,fairPlayLicenseUrl:k,fairPlayCertificateUrl:l,fairPlaySiteId:m,fairPlayAssetIdStrategy:n=
2
2
  Ax}=a;this.A=c;this.a=d;this.C=e;this.B=f;this.w=xx(this,g);this.o=xx(this,h);this.l=xx(this,k);this.j=l;this.G=m;this.F=n;this.g=new _.T(ux);_.Bi(this.w)?this.g.warn(_.Ib):this.Ga(_.wd,{licenseUrl:this.w,videoRobustness:[_.pb,void 0],audioRobustness:[_.ob,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:this.h.bind(this)}});_.Bi(this.o)?this.g.warn(_.fb):this.Ga(_.ud,{licenseUrl:this.o,videoRobustness:["3000"],audioRobustness:["2000"],
3
- modifiers:{licenseRequest:this.h.bind(this)}});_.Bi(this.l)?this.g.warn(_.Ea):_.Bi(this.j)?this.g.warn(_.Da):this.Ga(_.sd,{licenseUrl:this.l,certificateUrl:this.j,modifiers:{licenseRequest:this.J.bind(this),licenseResponse:this.K.bind(this),extractContentId:this.H.bind(this)}})}h(a,b){if(this.C===Bx){a=this.B[zx];const c={};c[this.B[yx]]=this.A;this.a&&(c[a]=this.a);Object.keys(c).forEach(d=>{b.headers[d]=c[d]})}}H(a,b){a=_.mp(b);switch(this.F){case Cx:a=_.Rm({r:a,Pj:this.G},!0)}return a}J(a,b){this.h(a,
3
+ modifiers:{licenseRequest:this.h.bind(this)}});_.Bi(this.l)?this.g.warn(_.Ea):_.Bi(this.j)?this.g.warn(_.Da):this.Ga(_.sd,{licenseUrl:this.l,certificateUrl:this.j,modifiers:{licenseRequest:this.J.bind(this),licenseResponse:this.K.bind(this),extractContentId:this.H.bind(this)}})}h(a,b){if(this.C===Bx){a=this.B[zx];const c={};c[this.B[yx]]=this.A;this.a&&(c[a]=this.a);Object.keys(c).forEach(d=>{b.headers[d]=c[d]})}}H(a,b){a=_.mp(b);switch(this.F){case Cx:a=_.Rm({r:a,Qj:this.G},!0)}return a}J(a,b){this.h(a,
4
4
  b);_.rp(b)}K(a,b){_.sp(b)}};_.x(ux,Dx);Dx.prototype.constructor=Dx.prototype.constructor;Dx.NAME=tx;var wx="query-string",Bx="http-header";Dx.LicenseRequestVuidLocation={QUERY_STRING:wx,HTTP_HEADER:Bx};var yx="DeviceId",zx="Authenticator";Dx.LicenseRequestHttpHeader={DEVICE_ID_HEADER:yx,AUTHENTICATOR_HEADER:zx};var Ax="keyid",Cx="contentid-siteid";Dx.FairPlayAssetIdStrategy={KEYID:Ax,CONTENTID_SITEID:Cx};_.x(vx,class extends _.Ev{constructor(){super();this.g=new _.T(vx)}uninstall(){delete _.mn.VerimatrixVCAS}beforeLoad(a){a=a.getConfiguration();if(a.drm&&a.drm.env===tx){({customData:a}=a.drm);if(!a)throw new _.I(_.D,7,7100,_.xd);a=new Dx(a);this.g.info("Registering the Verimatrix VCAS Ultra environment");_.nn(a)}}id(){return"verimatrix-vcas"}});};f.call(g, window);
package/cl.vimond.js CHANGED
@@ -3,6 +3,6 @@ new _.Vt;this.j=!0;this.ga=this.h=this.A=!1;this.B=null;this.f=new _.Pi(this.w.b
3
3
  this.h=!1}H(a){const b=this;return _.w(function*(){const c=a.detail,d=c.currentState;b.g.debug(`State changed, prev: ${c.previousState} curr: ${d}`);b.A||b.h||(d!==b.B||b.ga?b.j&&3!==d||(b.ga&&[4,2].includes(d)?b.g.debug("Seeking"):(b.ga&&3===d&&(b.g.debug("Seeked"),b.ga=!1),[3,4,_.As,5].includes(d)&&(b.B=d,yield b.w(),5===d&&b.f.stop()))):b.g.debug("Ignore transition"))})}w(){const a=this;return _.w(function*(){var b=Math.floor(Date.now()/1E3);0<a.l&&a.g.debug(`Last event was ${b-a.l} seconds ago`);
4
4
  a.l=b;a.f.stop();a.f.la(a.j?10:a.J);a.j=!1;try{var c=yield a.C.fireEvent();mx(a,c)}catch(d){b=d.code,c=d.data,[1002,1003].includes(b)?(a.g.debug("Unreachable service"),mx(a,c),nx(a,a.K,c)):1001===b?(a.g.debug("Generic service error"),mx(a,c),nx(a,a.L,c)):a.g.error(d.toString())}})}};var qx=class{constructor(a,b,c,d,e){this.l=a;this.o=c;this.h=b;this.a=d;this.j=e;this.g=new _.T("clpp.vimond.VimondService");this.f=0}fireEvent(){this.f++;const a=_.hh(this.o);a.client.buildName=_.ra;a.client.buildVersion=_.ea;var b=a.client;var c=(c=this.a.m.getDrmInfo())?c.keySystem:"";b.drm=c;a.client.pageUrl=document.location.href;a.client.streamUrl=this.a.m.Sa().url;a.client.userAgent=navigator.userAgent;a.client.videoFormat=this.a.m.Sa().type||"";b=a.client;c=this.a.m.Sa();c=((new _.lp(c.url)).scheme||
5
5
  "").replace(":","");b.videoProtocol=c;b=ox(this.a,this.f);a.client.playerEvent=b[0]||"";a.client.playerState=b[1]||"";a.progress.vod&&(a.progress.vod.position=this.a.getPosition());if(b=a.progress.live){c=this.a;var d=c.m.getPresentationStartTime()||0;c=Math.floor(d+c.m.getPosition());c=(new Date(1E3*c)).toISOString();b.position=c;d=this.a;c=d.m.getPosition();d=d.m.getSeekRange().end;c=30>Math.abs(d-c);b.onLiveEdge=c;typeof b.liveResumePossible!==_.Nc&&(b.liveResumePossible=!0)}a.progress.eventNumber=
6
- this.f;a.timestamp=(new Date).toISOString();this.g.debug("Fire an event");b=_.zk(this.l);b.method=_.eb;b.contentType="application/json";b.headers.Authorization=`Bearer ${this.h}`;b.body=_.xi(JSON.stringify(a));return this.j.fetch(b).V}Sf(a){this.h=a}};var rx=class{constructor(a){this.m=a;this.a=new _.Vt;this.g=new _.T("clpp.vimond.VimondAdapter");this.f=this.h=!1;this.m&&this.a&&(this.g.debug(kx),this.a.on(this.m,_.yf,this.o.bind(this)),this.a.on(this.m,_.Ub,this.j.bind(this)),this.a.on(this.m,_.Vb,this.l.bind(this)))}getPosition(){return Math.floor(this.m.getPosition())}o(){this.h=!0}j(){this.f=!0}l(){this.f=!1}};var sx=class extends _.Uv{constructor(){super();this.a=!1;this.g=new _.T(lx);this.j=this.h=this.f=null}onPlayerCreated(){}onContentWillLoad(a){var b=a.getConfiguration();(this.a=!_.z(b.vimond)&&typeof b.vimond===_.Ie)?a.namespace()===_.hd&&(this.a=!1,this.g.info("Vimond does not report when casting.")):this.g.debug("Vimond plugin is loaded but not configured. Will do nothing.");if(this.a){b=a.getConfiguration().vimond;for(var c of["authToken","playerEventRequest"])if(!b[c]){this.g.warn(`${c} key is missing`);
6
+ this.f;a.timestamp=(new Date).toISOString();this.g.debug("Fire an event");b=_.zk(this.l);b.method=_.eb;b.contentType="application/json";b.headers.Authorization=`Bearer ${this.h}`;b.body=_.xi(JSON.stringify(a));return this.j.fetch(b).V}Tf(a){this.h=a}};var rx=class{constructor(a){this.m=a;this.a=new _.Vt;this.g=new _.T("clpp.vimond.VimondAdapter");this.f=this.h=!1;this.m&&this.a&&(this.g.debug(kx),this.a.on(this.m,_.yf,this.o.bind(this)),this.a.on(this.m,_.Ub,this.j.bind(this)),this.a.on(this.m,_.Vb,this.l.bind(this)))}getPosition(){return Math.floor(this.m.getPosition())}o(){this.h=!0}j(){this.f=!0}l(){this.f=!1}};var sx=class extends _.Uv{constructor(){super();this.a=!1;this.g=new _.T(lx);this.j=this.h=this.f=null}onPlayerCreated(){}onContentWillLoad(a){var b=a.getConfiguration();(this.a=!_.z(b.vimond)&&typeof b.vimond===_.Ie)?a.namespace()===_.hd&&(this.a=!1,this.g.info("Vimond does not report when casting.")):this.g.debug("Vimond plugin is loaded but not configured. Will do nothing.");if(this.a){b=a.getConfiguration().vimond;for(var c of["authToken","playerEventRequest"])if(!b[c]){this.g.warn(`${c} key is missing`);
7
7
  a.onError(new _.I(1,9,9200));return}this.g.debug("Configuration is valid");c=b.failIfUnreachable;typeof c!==_.Nc&&(c=!0);var d=b.failOnError;typeof d!==_.Nc&&(d=!0);this.f=new rx(a);this.h=new qx(b.playerEventRequest.uri,b.authToken,b.playerEventRequest.body,this.f,a.getNetworkEngine());this.j=new px(b.playerEventRequest.eventInterval,c,d,a,this.h)}}onPlayerWillRelease(){if(this.a){if(this.f){var a=this.f;a.g.debug(_.Ab);_.ai(a.a)}this.j&&(a=this.j,a.g.debug(_.Ab),_.ai(a.a),a.f.stop());this.j=this.h=
8
- this.f=null}}onPlayerWillDestroy(){}id(){return"vimond"}Sf(a){this.a&&this.h&&this.h.Sf(a)}};_.x(lx,sx);sx.prototype.updateAuthToken=sx.prototype.Sf;sx.Id="vimond";_.Tn(new class{create(){return new sx}});};f.call(g, window);
8
+ this.f=null}}onPlayerWillDestroy(){}id(){return"vimond"}Tf(a){this.a&&this.h&&this.h.Tf(a)}};_.x(lx,sx);sx.prototype.updateAuthToken=sx.prototype.Tf;sx.Id="vimond";_.Tn(new class{create(){return new sx}});};f.call(g, window);
package/cl.vr.js CHANGED
@@ -11,5 +11,5 @@ this.w&&cancelAnimationFrame(this.w);this.h.x=0;this.l=this.j=this.h.y=0;this.f&
11
11
  var b=this.f;this.o||a.readyState!==a.HAVE_ENOUGH_DATA||(this.o=new hx(a,b));b.clearColor(0,0,0,1);b.clearDepth(1);b.clearStencil(0);b.enable(b.DEPTH_TEST);b.depthFunc(b.LEQUAL);b.frontFace(b.CCW);b.cullFace(b.BACK);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.blendFunc(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA);b.depthMask(!0);b.clearColor(0,0,0,1);b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT);if(this.o){var c=this.C;c.a.useProgram(c.f);{c=Zw(this.I,this.K,this.G).a;let d;d=c[1];c[1]=c[4];c[4]=d;d=c[2];c[2]=
12
12
  c[8];c[8]=d;d=c[6];c[6]=c[9];c[9]=d;d=c[3];c[3]=c[12];c[12]=d;d=c[7];c[7]=c[13];c[13]=d;d=c[11];c[11]=c[14];c[14]=d}b.uniformMatrix4fv(this.C.h,!1,this.I.a);c=this.o;c.a.activeTexture(c.a.TEXTURE0);c.a.bindTexture(c.a.TEXTURE_2D,c.f);b.texImage2D(b.TEXTURE_2D,0,b.RGB,b.RGB,b.UNSIGNED_BYTE,a);a=this.W;a.a.bindBuffer(a.a.ARRAY_BUFFER,a.f);a.a.vertexAttribPointer(0,3,a.a.FLOAT,!1,20,0);a.a.vertexAttribPointer(1,2,a.a.FLOAT,!1,20,12);a.a.enableVertexAttribArray(0);a.a.enableVertexAttribArray(1);a.a.drawArrays(a.a.TRIANGLES,
13
13
  0,a.h);a=this.o;a.a.bindTexture(a.a.TEXTURE_2D,null);this.C.a.useProgram(null)}}}}da(a){this.g.debug("Mouse Down. Enable VR mouse interaction");a.preventDefault();if(0===a.button||a.type===Sw)a.type===Sw?a.touches[0]&&(this.h.x=a.touches[0].clientX,this.h.y=a.touches[0].clientY):(this.h.x=a.clientX,this.h.y=a.clientY),this.g.debug("Mouse Start coordinates:",this.h,a),this.a.addEventListener("mousemove",this.A,!1),this.a.addEventListener(Rw,this.A,!1),this.a.addEventListener("mouseup",this.B,!1),this.a.addEventListener("touchend",
14
- this.B,!1)}ia(a){a.preventDefault();var b=a.clientX;let c=a.clientY;a.type===Rw&&a.touches[0]&&(b=a.touches[0].clientX,c=a.touches[0].clientY);a=this.h.x-b;const d=this.h.y-c;this.h.x=b;this.h.y=c;b=this.U;const {Ih:e,Jh:f}={Ih:a*b*(this.L?-1:1),Jh:d*b*(this.M?-1:1)};this.j+=e;this.l+=f;dx(this)}Aa(a){this.g.debug("Mouse Up. Removing mouse interaction listeners");a.preventDefault();cx(this)}Ci(a,b){this.l=b;this.j=a;dx(this)}ci(){return{x:this.j,y:this.l}}Zi(a){this.H=a;this.F()}};
15
- _.x("clpp.vr.VrPlugin",jx);jx.prototype.setCameraFieldOfView=jx.prototype.Zi;jx.prototype.getCameraCoordinates=jx.prototype.ci;jx.prototype.moveCamera=jx.prototype.Ci;jx.Id="vr";_.Tn(new class{create(){return new jx}});};f.call(g, window);
14
+ this.B,!1)}ia(a){a.preventDefault();var b=a.clientX;let c=a.clientY;a.type===Rw&&a.touches[0]&&(b=a.touches[0].clientX,c=a.touches[0].clientY);a=this.h.x-b;const d=this.h.y-c;this.h.x=b;this.h.y=c;b=this.U;const {Jh:e,Kh:f}={Jh:a*b*(this.L?-1:1),Kh:d*b*(this.M?-1:1)};this.j+=e;this.l+=f;dx(this)}Aa(a){this.g.debug("Mouse Up. Removing mouse interaction listeners");a.preventDefault();cx(this)}Di(a,b){this.l=b;this.j=a;dx(this)}di(){return{x:this.j,y:this.l}}$i(a){this.H=a;this.F()}};
15
+ _.x("clpp.vr.VrPlugin",jx);jx.prototype.setCameraFieldOfView=jx.prototype.$i;jx.prototype.getCameraCoordinates=jx.prototype.di;jx.prototype.moveCamera=jx.prototype.Di;jx.Id="vr";_.Tn(new class{create(){return new jx}});};f.call(g, window);
package/cl.vtt.js CHANGED
@@ -7,6 +7,6 @@ b," The region will be ignored."),null)},Lw=function(a,b,c){let d,e,f;(new _.np)
7
7
  8589934592;a=b.periodStart+e/9E4-a}}else this.a.streaming.relativeTextTimestamp&&null!==b.segmentStart&&(a=b.segmentStart);b=[];for(var f of c)if(/^region/.test(f.toLowerCase())){e=new _.ur(f.replace(/\n/g," "));d=new _.Eu;Ew(e);Fw(e);for(var g=Ew(e);g;){a:{var h;var k=d;var l=g;if(h=/^id:(.*)$/.exec(l))k.id=h[1];else if(h=/^width:(\d{1,2}|100)%$/.exec(l))k.width=Number(h[1]);else if(h=/^lines:(\d+)$/.exec(l))k.height=Number(h[1]),k.heightUnits=2;else if(h=/^regionanchor:(\d{1,2}|100)%,(\d{1,2}|100)%$/.exec(l))k.regionAnchorX=
8
8
  Number(h[1]),k.regionAnchorY=Number(h[2]);else if(h=/^viewportanchor:(\d{1,2}|100)%,(\d{1,2}|100)%$/.exec(l))k.viewportAnchorX=Number(h[1]),k.viewportAnchorY=Number(h[2]);else if(/^scroll:up$/.exec(l))k.scroll="up";else{k=!1;break a}k=!0}k||_.B("VTT parser encountered an invalid VTTRegion setting: ",g,yw);Fw(e);g=Ew(e)}e=d;b.push(e)}f=[];for(var m of c)if(/^style/.test(m.toLowerCase())){e=m.replace(/^style/i,"").replace(/\n/g," ");d=/[^{}]+{[^{}]*}/g;do(g=d.exec(e))&&f.push(g[0]);while(g)}m=[];for(const n of c)if(n.includes("--\x3e")){a:{l=
9
9
  n.split("\n");h=a;c=b;if(1===l.length&&!l[0]||/^NOTE($|[ \t])/.test(l[0])||"STYLE"===l[0]){c=null;break a}e=null;l[0].includes("--\x3e")||(e=l[0],l.splice(0,1));d=new _.ur(l[0]);g=Hw(d);const p=_.tr(d,/[ \t]+--\x3e[ \t]+/g);k=Hw(d);if(null==g||null==p||null==k)throw new _.I(_.D,2,2001);g+=h;k+=h;l=l.slice(1).join("\n").trim();g=new _.zu(g,k,l,_.Fg);e&&(g.id=e);Fw(d);for(k=Ew(d);k;)Jw(g,k,c)||_.B(zw,k,yw),Fw(d),k=Ew(d);null!=e&&(g.id=e);c=g}c&&m.push(c)}return{cues:m,styles:f}}};var Pw=class extends Ow{parseMedia(a,b){return super.parseMedia((new Mw).a(a),b)}};var Qw=class{constructor(){this.a=null;this.g=new _.T("clpp.vtt.mp4")}parseInit(a){let b=!1;(new _.np).N(_.Ee,_.gp).N(_.ig,_.gp).N(_.ze,_.gp).fa("mdhd",c=>{0===c.version?(c.reader.skip(4),c.reader.skip(4),this.a=_.N(c.reader),c.reader.skip(4)):(c.reader.skip(8),c.reader.skip(8),this.a=_.N(c.reader),c.reader.skip(8));c.reader.skip(4)}).N(_.De,_.gp).N(_.Tf,_.gp).fa(_.Vf,_.hp).N("wvtt",()=>{b=!0}).parse(a);if(!this.a)throw new _.I(_.D,2,2008);if(!b)throw new _.I(_.D,2,2008);}parseMedia(a,b){if(!this.a)throw this.g.error("No init segment for MP4+VTT!"),
10
- new _.I(_.D,2,2008);let c=0,d=[],e;const f=[];let g=!1,h=!1,k=!1,l=null;(new _.np).N("moof",_.gp).N("traf",_.gp).fa("tfdt",p=>{g=!0;c=0===p.version?_.N(p.reader):_.bp(p.reader)}).fa("tfhd",p=>{var u=p.flags;p=p.reader;p.skip(4);u&1&&p.skip(8);u&2&&p.skip(4);l=u&8?_.N(p):null}).fa("trun",p=>{h=!0;{var u=p.version,v=p.flags;p=p.reader;const y=_.N(p);v&1&&p.skip(4);v&4&&p.skip(4);const A=[];for(let E=0;E<y;E++){const F={duration:null,sampleSize:null,Of:null};v&256&&(F.duration=_.N(p));v&512&&(F.sampleSize=
11
- _.N(p));v&1024&&p.skip(4);v&2048&&(F.Of=0===u?_.N(p):_.ap(p));A.push(F)}d=A}}).N(_.ve,_.ip(p=>{k=!0;e=p})).parse(a);if(!k&&!g&&!h)throw new _.I(_.D,2,2008);a=c;var m=new DataView(e.buffer,e.byteOffset,e.byteLength);m=new _.kq(m,!1);for(const p of d){const u=p.duration||l,v=p.Of?c+p.Of:a;a=v+(u||0);let y=0;do{const A=_.N(m);y+=A;var n=_.N(m);n=_.fp(n);let E=null;"vttc"===n?8<A&&(E=_.dp(m,A-8)):("vtte"!==n&&this.g.error("Unknown box "+n+"! Skipping!"),m.skip(A-8));u?E&&f.push(Lw(E,b.periodStart+v/this.a,
10
+ new _.I(_.D,2,2008);let c=0,d=[],e;const f=[];let g=!1,h=!1,k=!1,l=null;(new _.np).N("moof",_.gp).N("traf",_.gp).fa("tfdt",p=>{g=!0;c=0===p.version?_.N(p.reader):_.bp(p.reader)}).fa("tfhd",p=>{var u=p.flags;p=p.reader;p.skip(4);u&1&&p.skip(8);u&2&&p.skip(4);l=u&8?_.N(p):null}).fa("trun",p=>{h=!0;{var u=p.version,v=p.flags;p=p.reader;const y=_.N(p);v&1&&p.skip(4);v&4&&p.skip(4);const A=[];for(let E=0;E<y;E++){const F={duration:null,sampleSize:null,Pf:null};v&256&&(F.duration=_.N(p));v&512&&(F.sampleSize=
11
+ _.N(p));v&1024&&p.skip(4);v&2048&&(F.Pf=0===u?_.N(p):_.ap(p));A.push(F)}d=A}}).N(_.ve,_.ip(p=>{k=!0;e=p})).parse(a);if(!k&&!g&&!h)throw new _.I(_.D,2,2008);a=c;var m=new DataView(e.buffer,e.byteOffset,e.byteLength);m=new _.kq(m,!1);for(const p of d){const u=p.duration||l,v=p.Pf?c+p.Pf:a;a=v+(u||0);let y=0;do{const A=_.N(m);y+=A;var n=_.N(m);n=_.fp(n);let E=null;"vttc"===n?8<A&&(E=_.dp(m,A-8)):("vtte"!==n&&this.g.error("Unknown box "+n+"! Skipping!"),m.skip(A-8));u?E&&f.push(Lw(E,b.periodStart+v/this.a,
12
12
  b.periodStart+a/this.a)):this.g.error("WVTT sample duration unknown, and no default found!")}while(p.sampleSize&&y<p.sampleSize)}return{cues:f.filter(_.Nm),styles:[]}}};_.x("clpp.vtt.VttComponent",class extends _.Ev{constructor(){super();this.a=new Nw}install(){_.Et(_.$f,Ow);_.Et(Cw,Ow);_.Et(Dw,Ow);_.Et(_.Ac,Qw);_.Et(Bw,Pw);_.Et(Aw,Pw);_.Sr.push(this.a)}uninstall(){_.Gt(_.$f);_.Gt(Cw);_.Gt(Dw);_.Gt(_.Ac);_.Gt(Bw);_.Gt(Aw);_.Ur(this.a)}id(){return"subtitles-vtt"}});};f.call(g, window);
package/cl.yospace.js CHANGED
@@ -1,3 +1,3 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var tw="clpp.yospace.YospacePlugin",ww=class extends _.Uv{constructor(){super();this.a=null;this.g=new _.T(tw)}Bg(){return this.a}onContentWillLoad(a,b){const c=this;return _.w(function*(){var d=a.getConfiguration().yospace;if(d.enabled){if(typeof window.YospaceAdManagement!==_.Ie)throw new _.I(_.D,9,7003,"Yospace SDK not found.");c.g.info("Yospace enabled.");a:{d=d.streamType||uw;var e=b.url;c.g.info("Creating Yospace session for stream type",d);switch(d){case uw:d=YospaceAdManagement.SessionVOD.create(e);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var tw="clpp.yospace.YospacePlugin",ww=class extends _.Uv{constructor(){super();this.a=null;this.g=new _.T(tw)}Cg(){return this.a}onContentWillLoad(a,b){const c=this;return _.w(function*(){var d=a.getConfiguration().yospace;if(d.enabled){if(typeof window.YospaceAdManagement!==_.Ie)throw new _.I(_.D,9,7003,"Yospace SDK not found.");c.g.info("Yospace enabled.");a:{d=d.streamType||uw;var e=b.url;c.g.info("Creating Yospace session for stream type",d);switch(d){case uw:d=YospaceAdManagement.SessionVOD.create(e);
2
2
  break a;case vw:d=YospaceAdManagement.SessionLive.create(e);break a;default:d=YospaceAdManagement.SessionDVRLive.create(e)}}d=yield d;e=d.getSessionState();if(e!==YospaceAdManagement.SessionState.INITIALISED)throw c.g.error("Failed to initialize Yospace session. State:",e,"URL",b.url),new _.I(_.D,9,7003,"Yospace session failed to initialize.");a.trigger(new _.H(_.Wg,{detail:d}));b.url=d.getPlaybackUrl();c.g.info("Yospace session initialized. New URL:",b.url);c.a=d}})}onPlayerWillRelease(a){if(this.a){this.g.info("Shutting down Yospace session.");
3
- const b=this.a;this.a.shutdown();this.a=null;a.trigger(new _.H(_.Vg,{detail:b}))}}id(){return"yospace"}};_.x(tw,ww);ww.prototype.getSession=ww.prototype.Bg;ww.Id="yospace";var xw=class{create(){return new ww}},uw=_.Fb,vw="LIVE";_.x("clpp.yospace.StreamType",{VOD:uw,LIVE:vw,DVR:"DVR"});_.Tn(new xw);};f.call(g, window);
3
+ const b=this.a;this.a.shutdown();this.a=null;a.trigger(new _.H(_.Vg,{detail:b}))}}id(){return"yospace"}};_.x(tw,ww);ww.prototype.getSession=ww.prototype.Cg;ww.Id="yospace";var xw=class{create(){return new ww}},uw=_.Fb,vw="LIVE";_.x("clpp.yospace.StreamType",{VOD:uw,LIVE:vw,DVR:"DVR"});_.Tn(new xw);};f.call(g, window);