@castlabs/prestoplay 6.28.0 → 6.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +7 -7
  5. package/cjs/cl.cast.js +128 -116
  6. package/cjs/cl.conviva.js +32 -32
  7. package/cjs/cl.core.js +619 -614
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +92 -89
  10. package/cjs/cl.externs.js +154 -60
  11. package/cjs/cl.freewheel.js +25 -25
  12. package/cjs/cl.hls.js +77 -77
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +30 -30
  15. package/cjs/cl.ima.js +25 -23
  16. package/cjs/cl.mediatailor.js +3 -3
  17. package/cjs/cl.mse.js +350 -349
  18. package/cjs/cl.muxdata.js +14 -14
  19. package/cjs/cl.onboard.js +4 -4
  20. package/cjs/cl.persistent.js +15 -15
  21. package/cjs/cl.playlist.js +6 -6
  22. package/cjs/cl.simid.js +16 -16
  23. package/cjs/cl.smooth.js +57 -58
  24. package/cjs/cl.thumbnails.js +26 -26
  25. package/cjs/cl.tizen.js +60 -60
  26. package/cjs/cl.ttml.js +29 -29
  27. package/cjs/cl.verimatrix.js +5 -5
  28. package/cjs/cl.vimond.js +12 -12
  29. package/cjs/cl.vr.js +19 -19
  30. package/cjs/cl.vtt.js +14 -14
  31. package/cjs/cl.yospace.js +4 -4
  32. package/cjs/cl.youbora.js +38 -38
  33. package/cjs/polyfill.min.js +2 -2
  34. package/cl.adobe.js +3 -3
  35. package/cl.airplay.js +3 -3
  36. package/cl.broadpeak.js +6 -6
  37. package/cl.cast.js +101 -92
  38. package/cl.conviva.js +27 -27
  39. package/cl.core.js +500 -496
  40. package/cl.crypto.js +9 -9
  41. package/cl.dash.js +84 -83
  42. package/cl.externs.js +150 -60
  43. package/cl.freewheel.js +19 -19
  44. package/cl.hls.js +82 -80
  45. package/cl.hlssmpte.js +5 -5
  46. package/cl.htmlcue.js +26 -26
  47. package/cl.ima.js +19 -17
  48. package/cl.mediatailor.js +2 -2
  49. package/cl.mse.js +304 -305
  50. package/cl.muxdata.js +13 -13
  51. package/cl.onboard.js +4 -4
  52. package/cl.persistent.js +11 -11
  53. package/cl.playlist.js +5 -5
  54. package/cl.simid.js +14 -14
  55. package/cl.smooth.js +60 -60
  56. package/cl.thumbnails.js +19 -19
  57. package/cl.tizen.js +56 -56
  58. package/cl.ttml.js +22 -22
  59. package/cl.verimatrix.js +4 -4
  60. package/cl.vimond.js +8 -8
  61. package/cl.vr.js +14 -14
  62. package/cl.vtt.js +12 -12
  63. package/cl.yospace.js +3 -3
  64. package/cl.youbora.js +31 -31
  65. package/package.json +1 -1
  66. package/typings.d.ts +198 -88
package/cjs/cl.muxdata.js CHANGED
@@ -1,18 +1,18 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var cB=function(a){switch(a.type){case 1:return $A;case 2:return aB;case 3:return bB}},eB=function(a){var b=Object.keys(a).find(function(c){return dB.includes(c.toLowerCase())});return void 0!==b?a[b]:void 0},fB=function(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 _.ti;this.g=b;this.A=this.l=this.h=!1;this.w=null;this.j=a.getNetworkEngine();this.G=this.Yk.bind(this);this.F=this.Xk.bind(this)},hB=function(a){var b={debug:!0,
3
- data:gB(a)};a.f&&a.f.muxOptionsOverride&&_.M.sd(a.f.muxOptionsOverride)&&(b=_.M.ua(b,a.f.muxOptionsOverride));b=_.M.ua(b,{getPlayheadTime:function(){return 1E3*a.m.getPosition()},getStateData:function(){a.g.debug("getStateData()");var c=a.m.getLoadedSource(),d=a.m.getTrackManager(),e=a.m.getSurface(),f={player_is_paused:a.m.isPaused(),player_is_fullscreen:e.isFullscreen(),video_source_duration:1E3*a.m.getDuration(),player_autoplay_on:!!a.m.getConfiguration().autoplay};if(c){var g=new _.mn(c.url);
4
- f.video_source_url=_.nn(g);f.video_source_mime_type=c.type;c.name&&(f.video_title=c.name)}if(c=e.getContainer())f.player_width=c.offsetWidth,f.player_height=c.offsetHeight;(c=a.m.getSurface().getMedia())?c={videoWidth:c.videoWidth,videoHeight:c.videoHeight}:(c=a.m.getTrackManager().pa(),c={videoWidth:c.width,videoHeight:c.height});e=c;c=e.videoWidth;e=e.videoHeight;a.g.debug("Video dimensions: "+c+"x"+e);c&&e&&(f.video_source_height=c,f.video_source_width=e);(d=d.na())&&d.language&&(f.player_language_code=
5
- d.language);return f}});a.g.debug("Mux SDK options",b);return b},gB=function(a){var b={env_key:a.f.envKey,video_title:a.o&&a.o.name||"",player_name:_.xa,player_software_name:_.xa,player_software_version:_.ia,player_mux_plugin_name:"CastlabsPlayer built-in Mux Plugin",player_mux_plugin_version:_.ia};(a=a.m.getConfiguration().viewerId)&&(b.viewer_user_id=a);return b},iB=function(a){a.a.on(a.m,_.ug,function(){var b={player_playhead_time:1E3*a.m.getPosition()};a.emit(_.ug,b)});a.a.on(a.m,_.gf,function(){return a.emit(_.gf)});
6
- a.a.on(a.m,_.Wc,a.Uk.bind(a));a.a.on(a.m,_.dg,a.Wk.bind(a));a.a.on(a.m,_.Hg,function(){return a.emit(_.Wf)});a.a.on(a.m,_.Gg,function(){return a.emit(_.Vf)});a.a.on(a.m,_.je,a.Vk.bind(a));a.a.on(a.m,_.fc,function(){return a.emit("adbreakstart")});a.a.on(a.m,_.gc,function(){return a.emit("adbreakend")});a.a.on(a.m,_.wc,function(){a.emit("adplay");a.emit("adplaying")});a.a.on(a.m,_.sc,function(){return a.emit("adpause")});a.a.on(a.m,_.uc,function(){a.emit("adplay");a.emit("adplaying")});a.a.on(a.m,
7
- _.xc,function(){return a.emit("adended")});a.a.on(a.m,_.kc,function(){return a.emit("adfirstquartile")});a.a.on(a.m,_.rc,function(){return a.emit("admidpoint")});a.a.on(a.m,_.yc,function(){return a.emit("adthirdquartile")});a.j.Gd(a.G);a.j.hh(a.F);a.a.on(a.m,_.je,function(b){var c=b.detail;if(c&&1===c.category&&(b=(b=c.data)&&b.request,void 0!==b&&!0===(1===b.type||2===b.type||3===b.type)))if(7001===c.code){c=b.requestStartTimestamp;var d=new _.mn(b.uris[b.uriIndex]);b={request_start:c,request_type:cB(b),
8
- request_hostname:d.a};a.g.debug("onRequestCanceled()","Track event: requestcanceled",b);a.emit("requestcanceled",b)}else{d=b.requestStartTimestamp;var e=new _.mn(b.uris[b.uriIndex]),f=c.data;b={request_start:d,request_type:cB(b),request_hostname:e.a,request_error:""+cB(b)+"LoadError",request_error_code:void 0===f?-1:void 0!==f.response?f.response.status:void 0!==f.status?f.status:-1,request_error_text:c.toString()};a.g.debug("onRequestFailed()","Track event: requestfailed",b);a.emit("requestfailed",
9
- b)}})},jB=function(a){_.wi(a.a);a.j.Df(a.G);a.j.lj(a.F)},kB=function(){this.f=this.m=null;this.a=!1;this.g=new _.L("clpp.muxdata")},lB=function(a){return!_.M.R(a)&&typeof a.init===_.ne&&typeof a.emit===_.ne},mB=function(a,b){a.trigger(new _.Q(_.je,{detail:b}))},nB=function(){},$A="manifest",aB="media",bB="encryption",dB=["x-request-id","cf-ray","x-amz-cf-id","x-akamai-request-id"];_.r=fB.prototype;_.r.initialize=function(a,b,c){this.f=a;this.o=b;this.w=c;if(!this.h){try{this.h=!0,this.w.init(this.B,hB(this))}catch(d){throw this.h=!1,jB(this),new _.N(1,9,9302,null,d);}this.emit("playerready")}this.l&&!this.A&&(a=gB(this),this.emit("videochange",a),this.l=!1);iB(this)};_.r.release=function(){this.g.debug("release()");this.l?this.g.debug(_.ma):(jB(this),this.l=!0,this.o=this.f=null)};_.r.destroy=function(){this.g.debug(_.Nd);this.A?this.g.debug(_.la):(this.A=!0,this.emit("destroy"))};
10
- _.r.emit=function(a,b){if(null===this.w)throw new _.N(1,9,9301);this.w.emit(this.B,a,b)};_.r.Uk=function(a){this.g.debug(_.Te);var b=a.detail;a=this.m.getTrackManager();b&&b.bandwidth&&(b=b.bandwidth,(a=a.Sa())&&a.bandwidth&&(b+=a.bandwidth),this.emit("renditionchange",{video_source_bitrate:b}))};_.r.Wk=function(a){this.g.debug(_.Ye);switch(a.detail.currentState){case 1:this.m.getConfiguration().autoplay&&this.emit(_.gf);break;case 3:this.emit(_.sf);break;case 4:this.emit(_.cf);break;case 5:this.emit(_.ie)}};
11
- _.r.Vk=function(a){this.g.debug(_.Ve);if(this.h&&(a=a.detail||null))if(10003===a.code)this.emit("aderror");else if(a.severity===_.O){var b=a.message||"Player error";if(1===a.category||6100===a.code||6007===a.code)b="Download error",6100===a.code?b="Certificate request error":6007===a.code&&(b="License request error"),b=b+" castlabs-error-data:"+JSON.stringify(a.data);this.emit(_.je,{player_error_code:a.code,player_error_message:b})}};
12
- _.r.Yk=function(a){var b=a.request;if(b=void 0!==b&&!0===(1===b.type||2===b.type||3===b.type))b=a.status,b=void 0!==b&&200<=b&&299>=b;if(b){b=a.request;var c=a.headers,d=b.bytesLoaded,e=b.requestStartTimestamp,f=b.startTime,g=b.endTime,h=e+a.responseStartMs;a=e+a.timeMs;f=f&&g?g-f:void 0;g=new _.mn(b.uris[b.uriIndex]);a={request_start:e,request_type:cB(b),request_hostname:g.a,request_id:eB(c),request_bytes_loaded:d,request_response_start:h,request_response_end:a,request_response_headers:c,request_media_duration:f,
13
- request_url:_.nn(g)};this.g.debug("onRequestCompleted()","Track event: requestcompleted",a);this.emit("requestcompleted",a)}};_.r.Xk=function(a){a.requestStartTimestamp=Date.now()};_.w(kB,_.Tv);_.r=kB.prototype;_.r.onPlayerCreated=function(a){this.m=a;this.f=new fB(a,this.g)};
14
- _.r.onContentWillLoad=function(a,b){var c=a.getConfiguration();c=_.M.ib(c.muxdata);try{var d=[];typeof c===_.Se&&(c.envKey||d.push("envKey"));if(0<d.length)throw new _.N(1,9,9300,{missingKeys:d});var e=a.getConfiguration();d=null;if(this.a=!_.M.R(e.muxdata)&&typeof e.muxdata===_.Se){var f=e.muxdata;d=lB(f.muxLib)?f.muxLib:window.mux;if(!lB(d)){this.g.warn("Mux SDK is not loaded. Will do nothing.");this.a=!1;var g=new _.N(1,9,9301);mB(a,g)}}else this.g.debug("Mux plugin is loaded but not configured. Will do nothing.");
15
- var h=d;null!==h&&this.f.initialize(c,b,h)}catch(l){this.a=!1,mB(a,l)}};_.r.onContentLoaded=function(){};_.r.onPlayerWillDestroy=function(){this.a&&(this.f.destroy(),this.m=this.f=null)};_.r.onPlayerWillRelease=function(){this.a&&this.f.release()};_.r.id=function(){return"mux"};_.r.emit=function(a,b){try{this.f.emit(a,b)}catch(c){throw null!==this.m&&mB(this.m,c),c;}};_.K("clpp.muxdata.MuxDataPlugin",kB);kB.prototype.emit=kB.prototype.emit;kB.Id="mux";nB.prototype.create=function(){return new kB};_.To(new nB);};
2
+ var f=function(window){var fB=function(a){switch(a.type){case 1:return cB;case 2:return dB;case 3:return eB}},hB=function(a){var b=Object.keys(a).find(function(c){return gB.includes(c.toLowerCase())});return void 0!==b?a[b]:void 0},iB=function(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 _.wi;this.g=b;this.A=this.l=this.h=!1;this.w=null;this.j=a.getNetworkEngine();this.G=this.tl.bind(this);this.F=this.sl.bind(this)},kB=function(a){var b={debug:!0,
3
+ data:jB(a)};a.f&&a.f.muxOptionsOverride&&_.M.xd(a.f.muxOptionsOverride)&&(b=_.M.ra(b,a.f.muxOptionsOverride));b=_.M.ra(b,{getPlayheadTime:function(){return 1E3*a.m.getPosition()},getStateData:function(){a.g.debug("getStateData()");var c=a.m.getLoadedSource(),d=a.m.getTrackManager(),e=a.m.getSurface(),f={player_is_paused:a.m.isPaused(),player_is_fullscreen:e.isFullscreen(),video_source_duration:1E3*a.m.getDuration(),player_autoplay_on:!!a.m.getConfiguration().autoplay};if(c){var g=new _.wn(c.url);
4
+ f.video_source_url=_.xn(g);f.video_source_mime_type=c.type;c.name&&(f.video_title=c.name)}if(c=e.getContainer())f.player_width=c.offsetWidth,f.player_height=c.offsetHeight;(c=a.m.getSurface().getMedia())?c={videoWidth:c.videoWidth,videoHeight:c.videoHeight}:(c=a.m.getTrackManager().qa(),c={videoWidth:c.width,videoHeight:c.height});e=c;c=e.videoWidth;e=e.videoHeight;a.g.debug("Video dimensions: "+c+"x"+e);c&&e&&(f.video_source_height=c,f.video_source_width=e);(d=d.oa())&&d.language&&(f.player_language_code=
5
+ d.language);return f}});a.g.debug("Mux SDK options",b);return b},jB=function(a){var b={env_key:a.f.envKey,video_title:a.o&&a.o.name||"",player_name:_.ya,player_software_name:_.ya,player_software_version:_.ia,player_mux_plugin_name:"CastlabsPlayer built-in Mux Plugin",player_mux_plugin_version:_.ia};(a=a.m.getConfiguration().viewerId)&&(b.viewer_user_id=a);return b},lB=function(a){a.a.on(a.m,_.zg,function(){var b={player_playhead_time:1E3*a.m.getPosition()};a.emit(_.zg,b)});a.a.on(a.m,_.pf,function(){return a.emit(_.pf)});
6
+ a.a.on(a.m,_.ad,a.pl.bind(a));a.a.on(a.m,_.ig,a.rl.bind(a));a.a.on(a.m,_.Ng,function(){return a.emit(_.ag)});a.a.on(a.m,_.Mg,function(){return a.emit(_.$f)});a.a.on(a.m,_.qe,a.ql.bind(a));a.a.on(a.m,_.jc,function(){return a.emit("adbreakstart")});a.a.on(a.m,_.kc,function(){return a.emit("adbreakend")});a.a.on(a.m,_.Bc,function(){a.emit("adplay");a.emit("adplaying")});a.a.on(a.m,_.xc,function(){return a.emit("adpause")});a.a.on(a.m,_.zc,function(){a.emit("adplay");a.emit("adplaying")});a.a.on(a.m,
7
+ _.Cc,function(){return a.emit("adended")});a.a.on(a.m,_.oc,function(){return a.emit("adfirstquartile")});a.a.on(a.m,_.wc,function(){return a.emit("admidpoint")});a.a.on(a.m,_.Dc,function(){return a.emit("adthirdquartile")});a.j.Od(a.G);a.j.wh(a.F);a.a.on(a.m,_.qe,function(b){var c=b.detail;if(c&&1===c.category&&(b=(b=c.data)&&b.request,void 0!==b&&!0===(1===b.type||2===b.type||3===b.type)))if(7001===c.code){c=b.requestStartTimestamp;var d=new _.wn(b.uris[b.uriIndex]);b={request_start:c,request_type:fB(b),
8
+ request_hostname:d.a};a.g.debug("onRequestCanceled()","Track event: requestcanceled",b);a.emit("requestcanceled",b)}else{d=b.requestStartTimestamp;var e=new _.wn(b.uris[b.uriIndex]),f=c.data;b={request_start:d,request_type:fB(b),request_hostname:e.a,request_error:""+fB(b)+"LoadError",request_error_code:void 0===f?-1:void 0!==f.response?f.response.status:void 0!==f.status?f.status:-1,request_error_text:c.toString()};a.g.debug("onRequestFailed()","Track event: requestfailed",b);a.emit("requestfailed",
9
+ b)}})},mB=function(a){_.zi(a.a);a.j.Rf(a.G);a.j.Dj(a.F)},nB=function(){this.f=this.m=null;this.a=!1;this.g=new _.L("clpp.muxdata")},oB=function(a){return!_.M.R(a)&&typeof a.init===_.ue&&typeof a.emit===_.ue},pB=function(a,b){a.trigger(new _.Q(_.qe,{detail:b}))},qB=function(){},cB="manifest",dB="media",eB="encryption",gB=["x-request-id","cf-ray","x-amz-cf-id","x-akamai-request-id"];_.r=iB.prototype;_.r.initialize=function(a,b,c){this.f=a;this.o=b;this.w=c;if(!this.h){try{this.h=!0,this.w.init(this.B,kB(this))}catch(d){throw this.h=!1,mB(this),new _.O(1,9,9302,null,d);}this.emit("playerready")}this.l&&!this.A&&(a=jB(this),this.emit("videochange",a),this.l=!1);lB(this)};_.r.release=function(){this.g.debug("release()");this.l?this.g.debug(_.ma):(mB(this),this.l=!0,this.o=this.f=null)};_.r.destroy=function(){this.g.debug(_.Vd);this.A?this.g.debug(_.la):(this.A=!0,this.emit("destroy"))};
10
+ _.r.emit=function(a,b){if(null===this.w)throw new _.O(1,9,9301);this.w.emit(this.B,a,b)};_.r.pl=function(a){this.g.debug(_.af);var b=a.detail;a=this.m.getTrackManager();b&&b.bandwidth&&(b=b.bandwidth,(a=a.Va())&&a.bandwidth&&(b+=a.bandwidth),this.emit("renditionchange",{video_source_bitrate:b}))};_.r.rl=function(a){this.g.debug(_.ff);switch(a.detail.currentState){case 1:this.m.getConfiguration().autoplay&&this.emit(_.pf);break;case 3:this.emit(_.Af);break;case 4:this.emit(_.lf);break;case 5:this.emit(_.pe)}};
11
+ _.r.ql=function(a){this.g.debug(_.cf);if(this.h&&(a=a.detail||null))if(10003===a.code)this.emit("aderror");else if(a.severity===_.P){var b=a.message||"Player error";if(1===a.category||6100===a.code||6007===a.code)b="Download error",6100===a.code?b="Certificate request error":6007===a.code&&(b="License request error"),b=b+" castlabs-error-data:"+JSON.stringify(a.data);this.emit(_.qe,{player_error_code:a.code,player_error_message:b})}};
12
+ _.r.tl=function(a){var b=a.request;if(b=void 0!==b&&!0===(1===b.type||2===b.type||3===b.type))b=a.status,b=void 0!==b&&200<=b&&299>=b;if(b){b=a.request;var c=a.headers,d=b.bytesLoaded,e=b.requestStartTimestamp,f=b.startTime,g=b.endTime,h=e+a.responseStartMs;a=e+a.timeMs;f=f&&g?g-f:void 0;g=new _.wn(b.uris[b.uriIndex]);a={request_start:e,request_type:fB(b),request_hostname:g.a,request_id:hB(c),request_bytes_loaded:d,request_response_start:h,request_response_end:a,request_response_headers:c,request_media_duration:f,
13
+ request_url:_.xn(g)};this.g.debug("onRequestCompleted()","Track event: requestcompleted",a);this.emit("requestcompleted",a)}};_.r.sl=function(a){a.requestStartTimestamp=Date.now()};_.w(nB,_.Zv);_.r=nB.prototype;_.r.onPlayerCreated=function(a){this.m=a;this.f=new iB(a,this.g)};
14
+ _.r.onContentWillLoad=function(a,b){var c=a.getConfiguration();c=_.M.jb(c.muxdata);try{var d=[];typeof c===_.$e&&(c.envKey||d.push("envKey"));if(0<d.length)throw new _.O(1,9,9300,{missingKeys:d});var e=a.getConfiguration();d=null;if(this.a=!_.M.R(e.muxdata)&&typeof e.muxdata===_.$e){var f=e.muxdata;d=oB(f.muxLib)?f.muxLib:window.mux;if(!oB(d)){this.g.warn("Mux SDK is not loaded. Will do nothing.");this.a=!1;var g=new _.O(1,9,9301);pB(a,g)}}else this.g.debug("Mux plugin is loaded but not configured. Will do nothing.");
15
+ var h=d;null!==h&&this.f.initialize(c,b,h)}catch(l){this.a=!1,pB(a,l)}};_.r.onContentLoaded=function(){};_.r.onPlayerWillDestroy=function(){this.a&&(this.f.destroy(),this.m=this.f=null)};_.r.onPlayerWillRelease=function(){this.a&&this.f.release()};_.r.id=function(){return"mux"};_.r.emit=function(a,b){try{this.f.emit(a,b)}catch(c){throw null!==this.m&&pB(this.m,c),c;}};_.K("clpp.muxdata.MuxDataPlugin",nB);nB.prototype.emit=nB.prototype.emit;nB.Id="mux";qB.prototype.create=function(){return new nB};_.bp(new qB);};
16
16
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
17
17
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
18
18
  else{_=this.clpp._;(f.call(g,this));}
package/cjs/cl.onboard.js CHANGED
@@ -1,8 +1,8 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var YA=function(){this.g=new _.L("clpp.onboard");this.a=new Set},ZA=function(a,b){function c(n){return n&&(_.R.startsWith(n,_.se)||_.R.startsWith(n,"http://")||_.R.startsWith(n,"//"))?n:d+n}var d=b.baseUrl;_.R.endsWith(d,"/")||(d+="/");var e=c(b.widevineUrl||"widevine"),f=c(b.playreadyUrl||"playready"),g=c(b.fairplayUrl||"fairplay"),h=b.serverCertificate,l=_.Qp("V2"),m=new _.Rp(a);m.bb(_.Fd,{licenseUrl:e,videoRobustness:[_.Db,void 0],audioRobustness:[_.Cb,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,
3
- serverCertificate:_.Sp(h,l),modifiers:{licenseRequest:_.Iq,licenseResponse:_.Nq}});m.bb(_.Bd,{licenseUrl:g,certificateUrl:g,modifiers:{licenseRequest:_.Kq,licenseResponse:_.Lq,extractContentId:_.Gq,certificateRequest:_.Mq}});m.bb(_.Dd,{licenseUrl:f,modifiers:{licenseRequest:_.Iq}});_.Nn(m)};_.w(YA,_.Tu);YA.prototype.uninstall=function(){for(var a=_.v(this.a),b=a.next();!b.done;b=a.next())delete _.Mn[b.value];this.a.clear()};
4
- YA.prototype.beforeLoad=function(a){a=a.getConfiguration().drm;var b;if(b=!(!a||!a.env))b=a&&a.customData,b=!(!b||!b.baseUrl);b&&(b=a.env,a=a.customData,a={baseUrl:a.baseUrl,widevineUrl:a.widevineUrl,serverCertificate:a.serverCertificate,playreadyUrl:a.playreadyUrl,fairplayUrl:a.fairplayUrl},this.g.info("Registering the DRMtoday Onboard environment, name\x3d'"+b+"'"),ZA(b,a),this.a.add(b))};YA.prototype.id=function(){return"onboard"};_.K("clpp.onboard.OnboardComponent",YA);
5
- _.K("clpp.onboard.register",ZA);};
2
+ var f=function(window){var aB=function(){this.g=new _.L("clpp.onboard");this.a=new Set},bB=function(a,b){function c(n){return n&&(_.R.startsWith(n,_.ze)||_.R.startsWith(n,"http://")||_.R.startsWith(n,"//"))?n:d+n}var d=b.baseUrl;_.R.endsWith(d,"/")||(d+="/");var e=c(b.widevineUrl||"widevine"),f=c(b.playreadyUrl||"playready"),g=c(b.fairplayUrl||"fairplay"),h=b.serverCertificate,l=_.Zp("V2"),m=new _.$p(a);m.eb(_.Md,{licenseUrl:e,videoRobustness:[_.Db,void 0],audioRobustness:[_.Cb,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,
3
+ serverCertificate:_.aq(h,l),modifiers:{licenseRequest:_.Rq,licenseResponse:_.Wq}});m.eb(_.Id,{licenseUrl:g,certificateUrl:g,modifiers:{licenseRequest:_.Tq,licenseResponse:_.Uq,extractContentId:_.Pq,certificateRequest:_.Vq}});m.eb(_.Kd,{licenseUrl:f,modifiers:{licenseRequest:_.Rq}});_.Wn(m)};_.w(aB,_.bv);aB.prototype.uninstall=function(){for(var a=_.v(this.a),b=a.next();!b.done;b=a.next())delete _.Vn[b.value];this.a.clear()};
4
+ aB.prototype.beforeLoad=function(a){a=a.getConfiguration().drm;var b;if(b=!(!a||!a.env))b=a&&a.customData,b=!(!b||!b.baseUrl);b&&(b=a.env,a=a.customData,a={baseUrl:a.baseUrl,widevineUrl:a.widevineUrl,serverCertificate:a.serverCertificate,playreadyUrl:a.playreadyUrl,fairplayUrl:a.fairplayUrl},this.g.info("Registering the DRMtoday Onboard environment, name\x3d'"+b+"'"),bB(b,a),this.a.add(b))};aB.prototype.id=function(){return"onboard"};_.K("clpp.onboard.OnboardComponent",aB);
5
+ _.K("clpp.onboard.register",bB);};
6
6
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
7
7
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
8
8
  else{_=this.clpp._;(f.call(g,this));}
@@ -1,19 +1,19 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var GA="A persistent DRM session already exists for: ",HA="No DRM configuration.",IA="clpp.persistent",JA="clpp.persistent.SimpleSessionStorage",KA=function(a,b){for(var c=[],d=_.v(a),e=d.next();!e.done;e=d.next())c.push(b(e.value));return c},LA=function(a){a=a.h.keys();a=KA(a,function(b){return b.sessionId});return Array.from(a)},MA=function(a,b){var c,d,e;return _.I(function(f){if(1==f.a)return _.x(f,_.ns(a,b),2);c=f.f;if(!c)return a.g.debug("Ignoring attempt to remove missing session",b),f["return"]();
3
- d=[];(e=a.h.get(c))&&a.F&&(e.yc=new _.am,d.push(e.yc));a.g.debug("Attempting to remove session",b);d.push(c.remove());return f["return"](Promise.all(d))})},OA=function(a,b){a.L=NA;a.O=[];a.H=!0;return _.Qr(a,b)},QA=function(a,b,c,d,e,f){a.L=PA;var g=new Map,h=_.ss(b);g.set(h,{audioCapabilities:e,videoCapabilities:f,distinctiveIdentifier:_.$e,persistentState:_.Nf,sessionTypes:[_.ef],label:h,drmInfos:[{keySystem:b,licenseServerUri:c,distinctiveIdentifierRequired:!1,persistentStateRequired:!0,audioRobustness:"",
4
- videoRobustness:"",serverCertificate:d,initData:null,keyIds:null}]});return _.$r(a,g)},RA=function(){this.g=new _.L(JA)},SA=function(a){a=JSON.parse(a);var b=JSON.parse(a.sessionIds),c=a.audioCapabilities||[],d=a.videoCapabilities||[],e=a.serverCertificate||[],f=a.drmConfig||{};return{sessionIds:b,keySystem:a.keySystem,licenseServerUri:decodeURIComponent(a.licenseServerUri||""),serverCertificate:e?new Uint8Array(e):null,audioCapabilities:c,videoCapabilities:d,drmConfig:f}},TA=function(a,b){var c=
5
- _.Pn(a),d=_.Fn([{drm:a}]);d.drm=a;var e=new _.Mr({Cb:b,onError:function(){},xg:function(){},wg:function(){},onEvent:function(){},getConfiguration:function(){return d},od:function(){return null}});e.f=c;return e},WA=function(a,b,c){var d,e,f,g,h,l,m,n,p;return _.I(function(q){switch(q.a){case 1:d=UA;e=VA;if(!a)return e.debug(HA),q["return"]();f=a.offlineId;return 0===f.length?q["return"]():_.x(q,d.get(f),2);case 2:if(g=q.f)return e.debug(GA,f),q["return"]();h=TA(a,c);_.F(q,3,4);return _.x(q,OA(h,b),
6
- 6);case 6:return _.x(q,_.gs(h),7);case 7:return _.x(q,_.hs(h),8);case 8:return l=h.getDrmInfo(),m=b.map(function(t){return{contentType:_.wn(t.video.mimeType,t.video.codecs),robustness:l.videoRobustness}}),n=LA(h),g={sessionIds:n,keySystem:l.keySystem,licenseServerUri:l.licenseServerUri,serverCertificate:l.serverCertificate,audioCapabilities:[],videoCapabilities:m,drmConfig:a},_.x(q,d.store(f,g),4);case 4:return _.xh(q),_.x(q,h.destroy(),10);case 10:_.yh(q);break;case 3:throw p=_.H(q),e.error("Error while persisting DRM session "+
7
- f),new _.N(1,6,6200,null,p);}})},XA=function(){this.g=new _.L(IA)},NA=1,PA=2;_.r=RA.prototype;
8
- _.r.store=function(a,b){var c;return _.I(function(d){var e=JSON.stringify(b.sessionIds),f=b.serverCertificate?Array.from(b.serverCertificate):null;f=JSON.stringify(f);var g=JSON.stringify(b.audioCapabilities),h=JSON.stringify(b.videoCapabilities);c=JSON.stringify({sessionIds:e,keySystem:b.keySystem,licenseServerUri:encodeURIComponent(b.licenseServerUri),serverCertificate:f,audioCapabilities:g,videoCapabilities:h,drmConfig:JSON.stringify(b.drmConfig)});window.localStorage.setItem(encodeURIComponent(a),
9
- btoa(c));_.z(d)})};_.r.get=function(a){var b=this,c;return _.I(function(d){if(c=window.localStorage.getItem(encodeURIComponent(a)))try{return d["return"](SA(atob(c)))}catch(e){b.g.warn("Error while loading offline items for "+a+" from storage: ",e)}return d["return"](null)})};_.r["delete"]=function(a){return _.I(function(b){window.localStorage.removeItem(encodeURIComponent(a));_.z(b)})};_.r.clear=function(){return _.I(function(a){window.localStorage.clear();_.z(a)})};_.r.getName=function(){return JA};_.K("clpp.persistent.useStorage",function(a){var b=["store","get","delete","clear","getName"];var c=[];_.M.R(a)||(_.M.Rb(a.store)||c.push("store"),_.M.Rb(a.get)||c.push("get"),_.M.Rb(a["delete"])||c.push("delete"),_.M.Rb(a.clear)||c.push("clear"),_.M.Rb(a.getName)||c.push("getName"),b=c);if(0<b.length)throw VA.warn("Invalid session storage implementation"),new _.N(1,6,6202,{missingMethods:b});UA=a});
10
- _.K("clpp.persistent.fetchLicense",function(a,b,c){for(var d=[],e=2;e<arguments.length;++e)d[e-2]=arguments[e];var f,g,h,l,m,n,p,q,t,u,y,B,A,C,E,D,J,P,U;return _.I(function(V){switch(V.a){case 1:f=UA;g=VA;h=function(ra,Da){return new _.N(1,6,6200,ra,Da)};l=_.Jn(a).shift();if(!l)throw h("No source specified.");if(!b)throw h(HA);m=b.offlineId;if(typeof m!==_.gg||!m.length)throw h("Missing offline id.");return _.x(V,f.get(m),2);case 2:if(n=V.f)return g.debug(GA,m),V["return"]();p=_.Dn();q=new _.Om;t=
11
- [];u=_.v(d);for(y=u.next();!y.done;y=u.next())B=y.value,A=new B,_.di(A.id())||(A.install(),_.fi(A),t.push(A));C=null;_.F(V,3,4);return _.x(V,_.Pv(l.url,q,p.manifest.attemptParameters,l.type||null),6);case 6:return C=V.f,C.configure(p.manifest),_.x(V,C.start(l.url,{configurationId:"",networkingEngine:q,onContentSteeringInfoFound:function(){return null},filterAllPeriods:function(){},filterNewPeriod:function(){},onEvent:function(){},onError:function(){}}),7);case 7:E=V.f;if(!E.periods.length)throw h(null,
12
- new _.N(_.O,4,4014));D=_.mv(E.periods);return _.x(V,WA(b,D,q),4);case 4:for(_.xh(V);t.length;)J=t.shift(),J.uninstall(),_.ci["delete"](J.id());P=[];C&&P.push(C.stop());P.push(q.destroy());return _.x(V,Promise.all(P),9);case 9:_.yh(V);break;case 3:U=_.H(V);if(U instanceof _.N&&6200===U.code)throw U;throw h(null,U);}})});
13
- _.K("clpp.persistent.removeLicense",function(a){var b,c,d,e,f,g,h;return _.I(function(l){switch(l.a){case 1:b=UA;c=VA;if(!_.M.ia(a)||0===a.length)return c.warn("Invalid offlineId"),l["return"]();e=d=null;_.F(l,2,3);return _.x(l,b.get(a),5);case 5:f=l.f;if(!f)return c.debug("No persistent DRM session found"),l["return"]();f.drmConfig.delayLicenseRequestUntilPlayed=!0;e=new _.Om;d=TA(f.drmConfig,e);return _.x(l,QA(d,f.keySystem,f.licenseServerUri,f.serverCertificate,f.audioCapabilities,f.videoCapabilities),
14
- 6);case 6:return _.x(l,_.gs(d),7);case 7:return _.x(l,Promise.all(f.sessionIds.map(function(m){return _.I(function(n){if(1==n.a)return _.x(n,MA(d,m),2);c.debug("successfully removed session with id",m);_.z(n)})})),8);case 8:return _.x(l,b["delete"](a),3);case 3:return _.xh(l),g=[],d&&g.push(d.destroy()),e&&g.push(e.destroy()),_.x(l,Promise.all(g),10);case 10:_.yh(l);break;case 2:throw h=_.H(l),c.error("Failed to remove session"),new _.N(1,6,6201,null,h);}})});
15
- _.K("clpp.persistent.getSessionStorage",function(){return UA});var UA=new RA,VA=new _.L(IA);_.w(XA,_.Tu);XA.prototype.id=function(){return _.df};XA.prototype.f=function(a,b){var c=this,d,e,f;return _.I(function(g){if(1==g.a){d=a.getConfiguration().drm;if(!d)return c.g.debug("No DRM configuration found for loaded source."),g["return"]();c.g.debug("Persisting DRM session ID: "+d.offlineId);e=a.getNetworkEngine();_.F(g,2);return _.x(g,WA(d,b,e),4)}if(2!=g.a)return a.trigger(new _.Q(_.$d,{offlineId:d.offlineId})),_.G(g,0);f=_.H(g);a.onError(f);_.z(g)})};
16
- XA.prototype.a=function(a){var b=this,c,d;return _.I(function(e){if(1==e.a)return b.g.debug("Getting EME session IDs for "+a),c=UA,_.F(e,2),_.x(e,c.get(a),4);if(2!=e.a){if(d=e.f)return e["return"](d.sessionIds||[]);b.g.debug("No offline session found for "+a);return e["return"]([])}_.H(e);b.g.warn("Error while loading session info from storage");return e["return"]([])})};_.K("clpp.persistent.PersistentLicenseComponent",XA);};
2
+ var f=function(window){var KA="A persistent DRM session already exists for: ",LA="No DRM configuration.",MA="clpp.persistent",NA="clpp.persistent.SimpleSessionStorage",OA=function(a){var b=[];a=_.v(a.h.keys());for(var c=a.next();!c.done;c=a.next())b.push(c.value.sessionId);return b},PA=function(a,b){var c,d,e;return _.I(function(f){if(1==f.a)return _.x(f,_.ws(a,b),2);c=f.f;if(!c)return a.g.debug("Ignoring attempt to remove missing session",b),f["return"]();d=[];(e=a.h.get(c))&&a.F&&(e.Cc=new _.om,d.push(e.Cc));a.g.debug("Attempting to remove session",
3
+ b);d.push(c.remove());return f["return"](Promise.all(d))})},RA=function(a,b){a.L=QA;a.O=[];a.H=!0;return _.Zr(a,b)},TA=function(a,b,c,d,e,f){a.L=SA;var g=new Map,h=_.Bs(b);g.set(h,{audioCapabilities:e,videoCapabilities:f,distinctiveIdentifier:_.hf,persistentState:_.Sf,sessionTypes:[_.nf],label:h,drmInfos:[{keySystem:b,licenseServerUri:c,distinctiveIdentifierRequired:!1,persistentStateRequired:!0,audioRobustness:"",videoRobustness:"",serverCertificate:d,initData:null,keyIds:null}]});return _.is(a,
4
+ g)},UA=function(){this.g=new _.L(NA)},VA=function(a){a=JSON.parse(a);var b=JSON.parse(a.sessionIds),c=a.audioCapabilities||[],d=a.videoCapabilities||[],e=a.serverCertificate||[],f=a.drmConfig||{};return{sessionIds:b,keySystem:a.keySystem,licenseServerUri:decodeURIComponent(a.licenseServerUri||""),serverCertificate:e?new Uint8Array(e):null,audioCapabilities:c,videoCapabilities:d,drmConfig:f}},WA=function(a,b){var c=_.Yn(a),d=_.On([{drm:a}]);d.drm=a;var e=new _.Vr({Db:b,onError:function(){},Kg:function(){},
5
+ Jg:function(){},onEvent:function(){},getConfiguration:function(){return d},td:function(){return null}});e.f=c;return e},ZA=function(a,b,c){var d,e,f,g,h,l,m,n,p;return _.I(function(q){switch(q.a){case 1:d=XA;e=YA;if(!a)return e.debug(LA),q["return"]();f=a.offlineId;return 0===f.length?q["return"]():_.x(q,d.get(f),2);case 2:if(g=q.f)return e.debug(KA,f),q["return"]();h=WA(a,c);_.F(q,3,4);return _.x(q,RA(h,b),6);case 6:return _.x(q,_.ps(h),7);case 7:return _.x(q,_.qs(h),8);case 8:return l=h.getDrmInfo(),
6
+ m=b.map(function(t){return{contentType:_.Fn(t.video.mimeType,t.video.codecs),robustness:l.videoRobustness}}),n=OA(h),g={sessionIds:n,keySystem:l.keySystem,licenseServerUri:l.licenseServerUri,serverCertificate:l.serverCertificate,audioCapabilities:[],videoCapabilities:m,drmConfig:a},_.x(q,d.store(f,g),4);case 4:return _.Eh(q),_.x(q,h.destroy(),10);case 10:_.Fh(q);break;case 3:throw p=_.H(q),e.error("Error while persisting DRM session "+f),new _.O(1,6,6200,null,p);}})},$A=function(){this.g=new _.L(MA)},
7
+ QA=1,SA=2;_.r=UA.prototype;
8
+ _.r.store=function(a,b){var c;return _.I(function(d){var e=JSON.stringify(b.sessionIds),f=b.serverCertificate?Array.from(b.serverCertificate):null;f=JSON.stringify(f);var g=JSON.stringify(b.audioCapabilities),h=JSON.stringify(b.videoCapabilities);c=JSON.stringify({sessionIds:e,keySystem:b.keySystem,licenseServerUri:encodeURIComponent(b.licenseServerUri),serverCertificate:f,audioCapabilities:g,videoCapabilities:h,drmConfig:JSON.stringify(b.drmConfig)});window.localStorage.setItem(encodeURIComponent(a),btoa(c));
9
+ _.z(d)})};_.r.get=function(a){var b=this,c;return _.I(function(d){if(c=window.localStorage.getItem(encodeURIComponent(a)))try{return d["return"](VA(atob(c)))}catch(e){b.g.warn("Error while loading offline items for "+a+" from storage: ",e)}return d["return"](null)})};_.r["delete"]=function(a){return _.I(function(b){window.localStorage.removeItem(encodeURIComponent(a));_.z(b)})};_.r.clear=function(){return _.I(function(a){window.localStorage.clear();_.z(a)})};_.r.getName=function(){return NA};_.K("clpp.persistent.useStorage",function(a){var b=["store","get","delete","clear","getName"];var c=[];_.M.R(a)||(_.M.Tb(a.store)||c.push("store"),_.M.Tb(a.get)||c.push("get"),_.M.Tb(a["delete"])||c.push("delete"),_.M.Tb(a.clear)||c.push("clear"),_.M.Tb(a.getName)||c.push("getName"),b=c);if(0<b.length)throw YA.warn("Invalid session storage implementation"),new _.O(1,6,6202,{missingMethods:b});XA=a});
10
+ _.K("clpp.persistent.fetchLicense",function(a,b,c){for(var d=[],e=2;e<arguments.length;++e)d[e-2]=arguments[e];var f,g,h,l,m,n,p,q,t,u,y,D,C,B,E,A,J,N,V;return _.I(function(U){switch(U.a){case 1:f=XA;g=YA;h=function(qa,wa){return new _.O(1,6,6200,qa,wa)};l=_.Sn(a).shift();if(!l)throw h("No source specified.");if(!b)throw h(LA);m=b.offlineId;if(typeof m!==_.lg||!m.length)throw h("Missing offline id.");return _.x(U,f.get(m),2);case 2:if(n=U.f)return g.debug(KA,m),U["return"]();p=_.Mn();q=new _.Ym;t=
11
+ [];u=_.v(d);for(y=u.next();!y.done;y=u.next())D=y.value,C=new D,_.ii(C.id())||(C.install(),_.ki(C),t.push(C));B=null;_.F(U,3,4);return _.x(U,_.Vv(l.url,q,p.manifest.attemptParameters,l.type||null),6);case 6:return B=U.f,B.configure(p.manifest),_.x(U,B.start(l.url,{configurationId:"",networkingEngine:q,onContentSteeringInfoFound:function(){return null},filterAllPeriods:function(){},filterNewPeriod:function(){},onEvent:function(){},onError:function(){}}),7);case 7:E=U.f;if(!E.periods.length)throw h(null,
12
+ new _.O(_.P,4,4014));A=_.nv(E.periods);return _.x(U,ZA(b,A,q),4);case 4:for(_.Eh(U);t.length;)J=t.shift(),J.uninstall(),_.hi["delete"](J.id());N=[];B&&N.push(B.stop());N.push(q.destroy());return _.x(U,Promise.all(N),9);case 9:_.Fh(U);break;case 3:V=_.H(U);if(V instanceof _.O&&6200===V.code)throw V;throw h(null,V);}})});
13
+ _.K("clpp.persistent.removeLicense",function(a){var b,c,d,e,f,g,h;return _.I(function(l){switch(l.a){case 1:b=XA;c=YA;if(!_.M.ia(a)||0===a.length)return c.warn("Invalid offlineId"),l["return"]();e=d=null;_.F(l,2,3);return _.x(l,b.get(a),5);case 5:f=l.f;if(!f)return c.debug("No persistent DRM session found"),l["return"]();f.drmConfig.delayLicenseRequestUntilPlayed=!0;e=new _.Ym;d=WA(f.drmConfig,e);return _.x(l,TA(d,f.keySystem,f.licenseServerUri,f.serverCertificate,f.audioCapabilities,f.videoCapabilities),
14
+ 6);case 6:return _.x(l,_.ps(d),7);case 7:return _.x(l,Promise.all(f.sessionIds.map(function(m){return _.I(function(n){if(1==n.a)return _.x(n,PA(d,m),2);c.debug("successfully removed session with id",m);_.z(n)})})),8);case 8:return _.x(l,b["delete"](a),3);case 3:return _.Eh(l),g=[],d&&g.push(d.destroy()),e&&g.push(e.destroy()),_.x(l,Promise.all(g),10);case 10:_.Fh(l);break;case 2:throw h=_.H(l),c.error("Failed to remove session"),new _.O(1,6,6201,null,h);}})});
15
+ _.K("clpp.persistent.getSessionStorage",function(){return XA});var XA=new UA,YA=new _.L(MA);_.w($A,_.bv);$A.prototype.id=function(){return _.mf};$A.prototype.f=function(a,b){var c=this,d,e,f;return _.I(function(g){if(1==g.a){d=a.getConfiguration().drm;if(!d)return c.g.debug("No DRM configuration found for loaded source."),g["return"]();c.g.debug("Persisting DRM session ID: "+d.offlineId);e=a.getNetworkEngine();_.F(g,2);return _.x(g,ZA(d,b,e),4)}if(2!=g.a)return a.trigger(new _.Q(_.he,{offlineId:d.offlineId})),_.G(g,0);f=_.H(g);a.onError(f);_.z(g)})};
16
+ $A.prototype.a=function(a){var b=this,c,d;return _.I(function(e){if(1==e.a)return b.g.debug("Getting EME session IDs for "+a),c=XA,_.F(e,2),_.x(e,c.get(a),4);if(2!=e.a){if(d=e.f)return e["return"](d.sessionIds||[]);b.g.debug("No offline session found for "+a);return e["return"]([])}_.H(e);b.g.warn("Error while loading session info from storage");return e["return"]([])})};_.K("clpp.persistent.PersistentLicenseComponent",$A);};
17
17
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
18
18
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
19
19
  else{_=this.clpp._;(f.call(g,this));}
@@ -1,10 +1,10 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var DA=function(a,b){b=void 0===b?function(){return Promise.resolve()}:b;_.yi.call(this);this.m=a;this.l=b;this.f=0;this.a=[];this.h=!1;this.j=this.Da.bind(this)},EA=function(a){a.trigger(new _.Q(_.yf))},FA=function(a,b){return 0<=b&&b<a.a.length};_.w(DA,_.yi);_.r=DA.prototype;_.r.on=function(a,b,c){return _.yi.prototype.on.call(this,a,b,c)};_.r.one=function(a,b,c){return _.yi.prototype.one.call(this,a,b,c)};_.r.off=function(a,b){return _.yi.prototype.off.call(this,a,b)};_.r.getPosition=function(){return this.f};
3
- _.r.dm=function(){return this.a};_.r.ce=function(){return 0<this.a.length&&FA(this,this.f)?this.a[this.f]:null};_.r.fm=function(){var a=this.f+1;return 0<this.a.length&&FA(this,a)?this.a[a]:null};_.r.wm=function(){return this.h};_.r.start=function(){this.h||(this.h=!0,this.m.on(_.ie,this.j),this.ff(this.f,!0))};_.r.stop=function(){this.h=!1;this.m.off(_.ie,this.j)};_.r.Da=function(){this.next()};
4
- _.r.next=function(){var a=this,b;return _.I(function(c){b=Math.min(a.a.length-1,a.f+1);return _.x(c,a.ff(b),0)})};_.r.Yn=function(){var a=this,b;return _.I(function(c){b=Math.max(0,a.f-1);return _.x(c,a.ff(b),0)})};_.r.ff=function(a,b){b=void 0===b?!1:b;var c=this,d;return _.I(function(e){if(1==e.a){if(!(0<c.a.length&&FA(c,a))||!b&&c.f===a)return e["return"]();c.f=a;return(d=c.ce())?_.x(e,c.l(d),3):e.C(0)}if(4!=e.a)return _.x(e,c.m.load(d.configuration),4);c.trigger(new _.Q(_.uf,{item:d}));_.z(e)})};
5
- _.r.append=function(a){this.a.push(a);EA(this)};_.r.qm=function(a,b){if(0<=b&&b<=this.a.length){var c=this.ce();this.a.splice(b,0,a);c&&(this.f=this.a.indexOf(c));EA(this)}};_.r.remove=function(a){if(0<this.a.length&&FA(this,a)){if(this.f===a)throw Error("Can't remove the current item");this.a.splice(a,1);EA(this)}};_.r.clear=function(){this.stop();this.f=0;this.a=[];this.h=!1;EA(this)};_.K("clpp.Playlist",DA);DA.prototype.clear=DA.prototype.clear;DA.prototype.remove=DA.prototype.remove;
6
- DA.prototype.insert=DA.prototype.qm;DA.prototype.append=DA.prototype.append;DA.prototype.goTo=DA.prototype.ff;DA.prototype.previous=DA.prototype.Yn;DA.prototype.next=DA.prototype.next;DA.prototype.onEnded=DA.prototype.Da;DA.prototype.stop=DA.prototype.stop;DA.prototype.start=DA.prototype.start;DA.prototype.isStarted=DA.prototype.wm;DA.prototype.getUpcoming=DA.prototype.fm;DA.prototype.getCurrent=DA.prototype.ce;DA.prototype.getQueue=DA.prototype.dm;DA.prototype.getPosition=DA.prototype.getPosition;
7
- DA.prototype.off=DA.prototype.off;DA.prototype.one=DA.prototype.one;DA.prototype.on=DA.prototype.on;};
2
+ var f=function(window){var HA=function(a,b){b=void 0===b?function(){return Promise.resolve()}:b;_.Di.call(this);this.m=a;this.l=b;this.f=0;this.a=[];this.h=!1;this.j=this.Ga.bind(this)},IA=function(a){a.trigger(new _.Q(_.Df))},JA=function(a,b){return 0<=b&&b<a.a.length};_.w(HA,_.Di);_.r=HA.prototype;_.r.on=function(a,b,c){return _.Di.prototype.on.call(this,a,b,c)};_.r.one=function(a,b,c){return _.Di.prototype.one.call(this,a,b,c)};_.r.off=function(a,b){return _.Di.prototype.off.call(this,a,b)};_.r.getPosition=function(){return this.f};
3
+ _.r.le=function(){return this.a};_.r.Mb=function(){return 0<this.a.length&&JA(this,this.f)?this.a[this.f]:null};_.r.Fi=function(){var a=this.f+1;return 0<this.a.length&&JA(this,a)?this.a[a]:null};_.r.Pm=function(){return this.h};_.r.start=function(){this.h||(this.h=!0,this.m.on(_.pe,this.j),this.vd(this.f,!0))};_.r.stop=function(){this.h=!1;this.m.off(_.pe,this.j)};_.r.Ga=function(){this.next()};
4
+ _.r.next=function(){var a=this,b;return _.I(function(c){b=Math.min(a.a.length-1,a.f+1);return _.x(c,a.vd(b),0)})};_.r.Ge=function(){var a=this,b;return _.I(function(c){b=Math.max(0,a.f-1);return _.x(c,a.vd(b),0)})};
5
+ _.r.vd=function(a,b){b=void 0===b?!1:b;var c=this,d;return _.I(function(e){if(1==e.a){if(!(0<c.a.length&&JA(c,a))||!b&&c.f===a)return e["return"]();c.f=a;return(d=c.Mb())&&!1===d.skippable?e["return"]():d?_.x(e,c.l(d),3):e.C(0)}if(4!=e.a)return _.x(e,c.m.load(d.configuration),4);c.trigger(new _.Q(_.Cf,{item:d}));_.z(e)})};_.r.append=function(a){this.a.push(a);IA(this)};_.r.Ki=function(a,b){if(0<=b&&b<=this.a.length){var c=this.Mb();this.a.splice(b,0,a);c&&(this.f=this.a.indexOf(c));IA(this)}};
6
+ _.r.remove=function(a){if(0<this.a.length&&JA(this,a)){if(this.f===a)throw Error("Can't remove the current item");this.a.splice(a,1);IA(this)}};_.r.clear=function(){this.stop();this.f=0;this.a=[];this.h=!1;IA(this)};_.K("clpp.Playlist",HA);HA.prototype.clear=HA.prototype.clear;HA.prototype.remove=HA.prototype.remove;HA.prototype.insert=HA.prototype.Ki;HA.prototype.append=HA.prototype.append;HA.prototype.goTo=HA.prototype.vd;HA.prototype.previous=HA.prototype.Ge;HA.prototype.next=HA.prototype.next;
7
+ HA.prototype.onEnded=HA.prototype.Ga;HA.prototype.stop=HA.prototype.stop;HA.prototype.start=HA.prototype.start;HA.prototype.isStarted=HA.prototype.Pm;HA.prototype.getUpcoming=HA.prototype.Fi;HA.prototype.getCurrent=HA.prototype.Mb;HA.prototype.getQueue=HA.prototype.le;HA.prototype.getPosition=HA.prototype.getPosition;HA.prototype.off=HA.prototype.off;HA.prototype.one=HA.prototype.one;HA.prototype.on=HA.prototype.on;};
8
8
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
9
9
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
10
10
  else{_=this.clpp._;(f.call(g,this));}
package/cjs/cl.simid.js CHANGED
@@ -1,20 +1,20 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var lA="No surface found. Can not attach frame!",mA="SIMID:Media:timeupdate",nA="Starting creative",sA=function(a,b){var c=this;this.f=a;this.w=b;this.h="";this.l=0;this.j=new Map;this.a=document.createElement("iframe");this.a.style.opacity="0";var d=this.w.style;d.className?this.a.classList.add(d.className):(this.a.style.border=_.Re,this.a.style.backgroundColor="transparent",this.a.style.transition="opacity .5s",this.a.style.transitionDelay=".5s",this.a.style.pointerEvents=_.Re,this.a.style.overflow=
3
- _.pe);this.a.classList.add(_.ld);this.o=function(e){if(e.source===c.a.contentWindow&&(e=(e=e.data)?typeof e===_.gg?JSON.parse(e):e:null))if(e.type)switch(c.g.info("Received message ["+e.messageId+"] '"+e.type+"':",e.args),e.type){case "createSession":oA(c,e);break;case "resolve":e=e.args;var f=c.j.get(e.messageId);f&&f.resolve(e);break;case "reject":e=e.args;(f=c.j.get(e.messageId))&&f.reject(e);break;case "SIMID:Creative:requestResize":f=c.f;var g=e.args;f.g.info("Creative requested resize",g);if(f.m&&
4
- f.m.getSurface()&&f.m.getSurface().getMedia()&&g.mediaDimensions){f.h?f.m.getSurface().getMedia().style.transition="":(f.m.getSurface().getMedia().style.transition="left .5s, top .5s,width .5s, height .5s",f.h=!0);var h=pA(f,g.mediaDimensions);f.m.getSurface().getMedia().style.left=h.left;f.m.getSurface().getMedia().style.top=h.top;f.m.getSurface().getMedia().style.width=h.width;f.m.getSurface().getMedia().style.height=h.height}g.creativeDimensions&&(g=pA(f,g.creativeDimensions),f.a.a.style.left=
5
- g.left,f.a.a.style.top=g.top,f.a.a.style.width=g.width,f.a.a.style.height=g.height);qA(c,e)}else c.g.warn("WARNING: received message without 'type' property")};this.g=new _.L("clpp.simid.SimidPlayer");rA(this.f,this)},vA=function(a){var b=tA(a,"SIMID:Player:startCreative",void 0);uA(a,b).then(function(){var c=a.f;c.g.info(nA);c.m.trigger(new _.Q(_.Yf));a.a.style.opacity="1"})["catch"](function(c){a.unload();a.f.g.error("Error while starting creative",c)})},oA=function(a,b){var c;_.I(function(d){if(1==
6
- d.a){a.h=b.sessionId;qA(a,b);_.F(d,2);var e=a.f;var f=e.getSurface(),g=e.getContainer();e={environmentData:{videoDimensions:{x:0,y:0,height:g.clientHeight,width:g.clientWidth},creativeDimensions:{x:0,y:0,height:g.clientHeight,width:g.clientWidth},fullscreen:f.isFullscreen(),fullscreenAllowed:!0,variableDurationAllowed:!1,skippableState:"notSkippable",version:"1.1",skipoffset:"",siteUrl:window.location.toString(),appId:"",useragent:"",deviceId:"",muted:e.m.isMuted()||!1,volume:e.m.getVolume()||0,navigationSupport:"adHandles",
7
- closeButtonSupport:"adHandles",nonlinearDuration:e.f.duration},creativeData:{adParameters:e.f.adParameters||"",clickThruUri:"",clickThruUrl:""}};e=tA(a,"SIMID:Player:init",e);e=uA(a,e);return _.x(d,e,4)}if(2!=d.a)return a.g.info("Player Init acknowledged"),a.f.g.info("SIMID Player initialized"),_.G(d,0);c=_.H(d);a.g.error("Error while initializing",c);a.f.g.error("Error while initializing SIMID player: ",c);a.unload();_.z(d)})},tA=function(a,b,c){return{type:b,sessionId:a.h,messageId:a.l++,timestamp:Date.now(),
8
- args:c}},wA=function(a,b){a.h?(b.type!==mA&&a.g.info("Posting message ["+b.messageId+"] '"+b.type+"':",b.args),a.a.contentWindow&&a.a.contentWindow.postMessage(JSON.stringify(b),"*")):a.g.warn("WARNING: no session available to send message '"+b.type+"'")},qA=function(a,b){wA(a,tA(a,"resolve",{messageId:b.messageId,value:void 0}))},uA=function(a,b){return new Promise(function(c,d){new xA(a.j,c,d,b);wA(a,b)})},xA=function(a,b,c,d){var e=this;var f=void 0===f?-1:f;this.f=a;this.l=b;this.j=c;this.h=d;
9
- this.a=null;this.f.set(d.messageId,this);0<=f&&(this.a=setTimeout(function(){e.resolve()},f))},yA=function(){this.g=new _.L("clpp.simid.Plugin");this.h=this.a=this.m=null;this.l=[];this.j=null;this.w=this.$k.bind(this);this.f=null;this.o=!1},zA=function(a,b,c){return new ResizeObserver(function(){if(a.a.h){var d=a.a,e={videoDimensions:{x:0,y:0,height:b.clientHeight,width:b.clientWidth},creativeDimensions:{x:0,y:0,height:b.clientHeight,width:b.clientWidth},fullscreen:c.isFullscreen()};e=tA(d,"SIMID:Player:resize",
10
- e);wA(d,e)}})},AA=function(a){this.m=a;this.a=null;this.g=new _.L("clpp.simid.Loader");this.h=!1;this.f=null},pA=function(a,b){var c=a.getContainer(),d=c.clientWidth;c=c.clientHeight;return{top:b.y/c*100+"%",left:b.x/d*100+"%",width:b.width/d*100+"%",height:b.height/c*100+"%"}},rA=function(a,b){a.g.info("SIMID Session created");a.a=b},BA=function(a){a.g.info("Stopping creative");a.m.getSurface().getMedia().style.transition=".5s";setTimeout(function(){a.m.getSurface().getMedia().style.transition=""},
11
- 500);a.m.getSurface().getMedia().style.left="";a.m.getSurface().getMedia().style.top="";a.m.getSurface().getMedia().style.width="";a.m.getSurface().getMedia().style.height="";a.a.a.style.left="";a.a.a.style.top="";a.a.a.style.width="";a.a.a.style.height="";a.h=!1;a.m.trigger(new _.Q(_.Zf))},CA=function(){};
12
- sA.prototype.load=function(a){window.addEventListener(_.Ke,this.o);this.h="";this.l=0;var b=this.f.url();this.g.info('Loading "'+b+'" as src of iFrame');this.a.src=b;this.g.info("Attaching iFrame");a.appendChild(this.a)};sA.prototype.unload=function(){BA(this.f);this.h=this.a.src="";this.l=0;this.a.style.opacity="0";window.removeEventListener(_.Ke,this.o);this.a.parentElement&&this.a.parentElement.removeChild(this.a)};
13
- xA.prototype.resolve=function(a){null!==this.a&&(clearTimeout(this.a),this.a=null);this.f["delete"](this.h.messageId);this.l(a)};xA.prototype.reject=function(a){null!==this.a&&(clearTimeout(this.a),this.a=null);this.f["delete"](this.h.messageId);this.j(a)};_.w(yA,_.Tv);_.r=yA.prototype;_.r.id=function(){return"simid"};_.r.onPlayerCreated=function(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 AA(a)};
14
- _.r.onContentWillLoad=function(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");var c=this.m.getSurface();c?(this.g.info("Creating new session"),this.a=new sA(this.h,b.simid),b=c.getContainer(),this.j=zA(this,b,c),this.j.observe(b),a.on(_.ug,this.w)):this.g.warn(lA)}};
15
- _.r.$k=function(){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],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&&(vA(this.a),this.o=!0,this.g.info(nA)),c&&(c=this.a,wA(c,tA(c,mA,{currentTime:a-b}))))):((a=this.m.getSurface())||this.g.warn(lA),a=a.getContainer(),this.f=b,this.o=!1,this.g.info("Loading session"),this.h.f=
16
- b,this.a.load(a)):this.f&&(this.a.unload(),this.f=null,this.o=!1)};_.r.onPlayerWillRelease=function(a){_.Tv.prototype.onPlayerWillRelease.call(this,a);this.m.getSurface()&&(this.j&&(this.j.disconnect(),this.j=null),a.off(_.ug,this.w),this.f&&(this.a.unload(),this.f=this.h.f=null))};_.r=AA.prototype;_.r.release=function(){this.g.info("Releasing loader")};
17
- _.r.getContainer=function(){var a=this.getSurface().getContainer();if(!a)throw this.g.error("No player container found. Can not create SIMID init data"),new _.N(1,10,10100,"No player container found");return a};_.r.getSurface=function(){var a=this.m.getSurface();if(!a)throw this.g.error("No player surface found. Can not create SIMID init data"),new _.N(1,10,10100,"No surface");return a};_.r.mi=function(){return this.a};_.r.url=function(){return this.f?this.f.url:""};CA.prototype.create=function(){return new yA};_.To(new CA);};
2
+ var f=function(window){var pA="No surface found. Can not attach frame!",qA="SIMID:Media:timeupdate",rA="Starting creative",wA=function(a,b){var c=this;this.f=a;this.w=b;this.h="";this.l=0;this.j=new Map;this.a=document.createElement("iframe");this.a.style.opacity="0";var d=this.w.style;d.className?this.a.classList.add(d.className):(this.a.style.border=_.Ze,this.a.style.backgroundColor="transparent",this.a.style.transition="opacity .5s",this.a.style.transitionDelay=".5s",this.a.style.pointerEvents=_.Ze,this.a.style.overflow=
3
+ _.we);this.a.classList.add(_.sd);this.o=function(e){if(e.source===c.a.contentWindow&&(e=(e=e.data)?typeof e===_.lg?JSON.parse(e):e:null))if(e.type)switch(c.g.info("Received message ["+e.messageId+"] '"+e.type+"':",e.args),e.type){case "createSession":sA(c,e);break;case "resolve":e=e.args;var f=c.j.get(e.messageId);f&&f.resolve(e);break;case "reject":e=e.args;(f=c.j.get(e.messageId))&&f.reject(e);break;case "SIMID:Creative:requestResize":f=c.f;var g=e.args;f.g.info("Creative requested resize",g);if(f.m&&
4
+ f.m.getSurface()&&f.m.getSurface().getMedia()&&g.mediaDimensions){f.h?f.m.getSurface().getMedia().style.transition="":(f.m.getSurface().getMedia().style.transition="left .5s, top .5s,width .5s, height .5s",f.h=!0);var h=tA(f,g.mediaDimensions);f.m.getSurface().getMedia().style.left=h.left;f.m.getSurface().getMedia().style.top=h.top;f.m.getSurface().getMedia().style.width=h.width;f.m.getSurface().getMedia().style.height=h.height}g.creativeDimensions&&(g=tA(f,g.creativeDimensions),f.a.a.style.left=
5
+ g.left,f.a.a.style.top=g.top,f.a.a.style.width=g.width,f.a.a.style.height=g.height);uA(c,e)}else c.g.warn("WARNING: received message without 'type' property")};this.g=new _.L("clpp.simid.SimidPlayer");vA(this.f,this)},zA=function(a){var b=xA(a,"SIMID:Player:startCreative",void 0);yA(a,b).then(function(){var c=a.f;c.g.info(rA);c.m.trigger(new _.Q(_.cg));a.a.style.opacity="1"})["catch"](function(c){a.unload();a.f.g.error("Error while starting creative",c)})},sA=function(a,b){var c;_.I(function(d){if(1==
6
+ d.a){a.h=b.sessionId;uA(a,b);_.F(d,2);var e=a.f;var f=e.getSurface(),g=e.getContainer();e={environmentData:{videoDimensions:{x:0,y:0,height:g.clientHeight,width:g.clientWidth},creativeDimensions:{x:0,y:0,height:g.clientHeight,width:g.clientWidth},fullscreen:f.isFullscreen(),fullscreenAllowed:!0,variableDurationAllowed:!1,skippableState:"notSkippable",version:"1.1",skipoffset:"",siteUrl:window.location.toString(),appId:"",useragent:"",deviceId:"",muted:e.m.isMuted()||!1,volume:e.m.getVolume()||0,navigationSupport:"adHandles",
7
+ closeButtonSupport:"adHandles",nonlinearDuration:e.f.duration},creativeData:{adParameters:e.f.adParameters||"",clickThruUri:"",clickThruUrl:""}};e=xA(a,"SIMID:Player:init",e);e=yA(a,e);return _.x(d,e,4)}if(2!=d.a)return a.g.info("Player Init acknowledged"),a.f.g.info("SIMID Player initialized"),_.G(d,0);c=_.H(d);a.g.error("Error while initializing",c);a.f.g.error("Error while initializing SIMID player: ",c);a.unload();_.z(d)})},xA=function(a,b,c){return{type:b,sessionId:a.h,messageId:a.l++,timestamp:Date.now(),
8
+ args:c}},AA=function(a,b){a.h?(b.type!==qA&&a.g.info("Posting message ["+b.messageId+"] '"+b.type+"':",b.args),a.a.contentWindow&&a.a.contentWindow.postMessage(JSON.stringify(b),"*")):a.g.warn("WARNING: no session available to send message '"+b.type+"'")},uA=function(a,b){AA(a,xA(a,"resolve",{messageId:b.messageId,value:void 0}))},yA=function(a,b){return new Promise(function(c,d){new BA(a.j,c,d,b);AA(a,b)})},BA=function(a,b,c,d){var e=this;var f=void 0===f?-1:f;this.f=a;this.l=b;this.j=c;this.h=d;
9
+ this.a=null;this.f.set(d.messageId,this);0<=f&&(this.a=setTimeout(function(){e.resolve()},f))},CA=function(){this.g=new _.L("clpp.simid.Plugin");this.h=this.a=this.m=null;this.l=[];this.j=null;this.w=this.vl.bind(this);this.f=null;this.o=!1},DA=function(a,b,c){return new ResizeObserver(function(){if(a.a.h){var d=a.a,e={videoDimensions:{x:0,y:0,height:b.clientHeight,width:b.clientWidth},creativeDimensions:{x:0,y:0,height:b.clientHeight,width:b.clientWidth},fullscreen:c.isFullscreen()};e=xA(d,"SIMID:Player:resize",
10
+ e);AA(d,e)}})},EA=function(a){this.m=a;this.a=null;this.g=new _.L("clpp.simid.Loader");this.h=!1;this.f=null},tA=function(a,b){var c=a.getContainer(),d=c.clientWidth;c=c.clientHeight;return{top:b.y/c*100+"%",left:b.x/d*100+"%",width:b.width/d*100+"%",height:b.height/c*100+"%"}},vA=function(a,b){a.g.info("SIMID Session created");a.a=b},FA=function(a){a.g.info("Stopping creative");a.m.getSurface().getMedia().style.transition=".5s";setTimeout(function(){a.m.getSurface().getMedia().style.transition=""},
11
+ 500);a.m.getSurface().getMedia().style.left="";a.m.getSurface().getMedia().style.top="";a.m.getSurface().getMedia().style.width="";a.m.getSurface().getMedia().style.height="";a.a.a.style.left="";a.a.a.style.top="";a.a.a.style.width="";a.a.a.style.height="";a.h=!1;a.m.trigger(new _.Q(_.dg))},GA=function(){};
12
+ wA.prototype.load=function(a){window.addEventListener(_.Se,this.o);this.h="";this.l=0;var b=this.f.url();this.g.info('Loading "'+b+'" as src of iFrame');this.a.src=b;this.g.info("Attaching iFrame");a.appendChild(this.a)};wA.prototype.unload=function(){FA(this.f);this.h=this.a.src="";this.l=0;this.a.style.opacity="0";window.removeEventListener(_.Se,this.o);this.a.parentElement&&this.a.parentElement.removeChild(this.a)};
13
+ BA.prototype.resolve=function(a){null!==this.a&&(clearTimeout(this.a),this.a=null);this.f["delete"](this.h.messageId);this.l(a)};BA.prototype.reject=function(a){null!==this.a&&(clearTimeout(this.a),this.a=null);this.f["delete"](this.h.messageId);this.j(a)};_.w(CA,_.Zv);_.r=CA.prototype;_.r.id=function(){return"simid"};_.r.onPlayerCreated=function(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 EA(a)};
14
+ _.r.onContentWillLoad=function(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");var c=this.m.getSurface();c?(this.g.info("Creating new session"),this.a=new wA(this.h,b.simid),b=c.getContainer(),this.j=DA(this,b,c),this.j.observe(b),a.on(_.zg,this.w)):this.g.warn(pA)}};
15
+ _.r.vl=function(){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],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&&(zA(this.a),this.o=!0,this.g.info(rA)),c&&(c=this.a,AA(c,xA(c,qA,{currentTime:a-b}))))):((a=this.m.getSurface())||this.g.warn(pA),a=a.getContainer(),this.f=b,this.o=!1,this.g.info("Loading session"),this.h.f=
16
+ b,this.a.load(a)):this.f&&(this.a.unload(),this.f=null,this.o=!1)};_.r.onPlayerWillRelease=function(a){_.Zv.prototype.onPlayerWillRelease.call(this,a);this.m.getSurface()&&(this.j&&(this.j.disconnect(),this.j=null),a.off(_.zg,this.w),this.f&&(this.a.unload(),this.f=this.h.f=null))};_.r=EA.prototype;_.r.release=function(){this.g.info("Releasing loader")};
17
+ _.r.getContainer=function(){var a=this.getSurface().getContainer();if(!a)throw this.g.error("No player container found. Can not create SIMID init data"),new _.O(1,10,10100,"No player container found");return a};_.r.getSurface=function(){var a=this.m.getSurface();if(!a)throw this.g.error("No player surface found. Can not create SIMID init data"),new _.O(1,10,10100,"No surface");return a};_.r.Di=function(){return this.a};_.r.url=function(){return this.f?this.f.url:""};GA.prototype.create=function(){return new CA};_.bp(new GA);};
18
18
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
19
19
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
20
20
  else{_=this.clpp._;(f.call(g,this));}
package/cjs/cl.smooth.js CHANGED
@@ -1,76 +1,75 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var MQ="Full MP4 box must have flags defined",NQ="clpp.smooth.SmoothMP4Processor",OQ="codecPrivateData",PQ=function(a,b){var c=Math.floor(b/Math.pow(2,32)),d=b-c*Math.pow(2,32);_.W(a,c);_.W(a,d)},QQ=function(a,b){try{a.f.setUint8(a.a,b),a.a+=1}catch(c){_.Up()}},RQ=function(a,b){QQ(a,b>>16&255);QQ(a,b>>8&255);QQ(a,b&255)},SQ=function(a,b){try{a.f.setUint16(a.a,b,a.h),a.a+=2}catch(c){_.Up()}},TQ=function(a,b){try{a.f.setInt32(a.a,b,a.h),a.a+=4}catch(c){_.Up()}},UQ=function(a,b){try{a.f.setInt16(a.a,
3
- b,a.h),a.a+=2}catch(c){_.Up()}},VQ=function(a,b){if(void 0!==b){for(var c=new Uint8Array(b),d=Math.min(a.length,b),e=0;e<d;++e)c[e]=a.charCodeAt(e);for(;e<b;e++)c[e]=0;return c}c=new Uint8Array(a.length);for(d=0;d<a.length;++d)c[d]=a.charCodeAt(d);return c},WQ=function(a){this.type=a;this.size=this.start=0;this.parent=null;this.w=!1;this.entries=[];this.children=[]},Z=function(a,b,c){WQ.call(this,a);this.version=b;this.flags=c},XQ=function(a,b,c){WQ.call(this,a);this.f=b;this.offset=c},YQ=function(a,
4
- b,c,d,e){Z.call(this,a,b,c);this.f=d;this.offset=e},ZQ=function(a,b,c){WQ.call(this,"ftyp");this.h=a;this.Hi=b;this.f=c},$Q=function(){WQ.call(this,_.Oe)},aR=function(){WQ.call(this,_.xg)},bR=function(a,b,c){Z.call(this,"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]},cR=function(){WQ.call(this,"mvex")},dR=function(a){Z.call(this,"trex",0,0);this.f=a},eR=function(a,b,c,d,e){Z.call(this,"tkhd",
2
+ var f=function(window){var MQ="Full MP4 box must have flags defined",NQ="clpp.smooth.SmoothMP4Processor",OQ="codecPrivateData",PQ=function(a,b){var c=Math.floor(b/Math.pow(2,32)),d=b-c*Math.pow(2,32);_.W(a,c);_.W(a,d)},QQ=function(a,b){try{a.f.setUint8(a.a,b),a.a+=1}catch(c){_.cq()}},RQ=function(a,b){QQ(a,b>>16&255);QQ(a,b>>8&255);QQ(a,b&255)},SQ=function(a,b){try{a.f.setUint16(a.a,b,a.h),a.a+=2}catch(c){_.cq()}},TQ=function(a,b){try{a.f.setInt32(a.a,b,a.h),a.a+=4}catch(c){_.cq()}},UQ=function(a,b){try{a.f.setInt16(a.a,
3
+ b,a.h),a.a+=2}catch(c){_.cq()}},VQ=function(a,b){if(void 0!==b){for(var c=new Uint8Array(b),d=Math.min(a.length,b),e=0;e<d;++e)c[e]=a.charCodeAt(e);for(;e<b;e++)c[e]=0;return c}c=new Uint8Array(a.length);for(d=0;d<a.length;++d)c[d]=a.charCodeAt(d);return c},WQ=function(a){this.type=a;this.size=this.start=0;this.parent=null;this.w=!1;this.entries=[];this.children=[]},Z=function(a,b,c){WQ.call(this,a);this.version=b;this.flags=c},XQ=function(a,b,c){WQ.call(this,a);this.f=b;this.offset=c},YQ=function(a,
4
+ b,c,d,e){Z.call(this,a,b,c);this.f=d;this.offset=e},ZQ=function(a,b,c){WQ.call(this,"ftyp");this.h=a;this.Xi=b;this.f=c},$Q=function(){WQ.call(this,_.We)},aR=function(){WQ.call(this,_.Bg)},bR=function(a,b,c){Z.call(this,"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]},cR=function(){WQ.call(this,"mvex")},dR=function(a){Z.call(this,"trex",0,0);this.f=a},eR=function(a,b,c,d,e){Z.call(this,"tkhd",
5
5
  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]},fR=function(a,b){Z.call(this,"mdhd",1,0);this.timescale=a;this.duration=b;this.language=21956},gR=function(a){Z.call(this,"hdlr",0,0);this.f=a},hR=function(){Z.call(this,"vmhd",0,1);this.f=new Uint8Array([0,0,0,0,0,0])},iR=function(a){WQ.call(this,a);this.w=!0},jR=function(a){iR.call(this,a);this.height=this.width=0;this.depth=24},
6
- kR=function(a,b,c,d){iR.call(this,a);this.channelCount=b;this.sampleSize=c;this.sampleRate=d},lR=function(a,b){jR.call(this,"avc1");this.width=a;this.height=b},mR=function(a,b){lR.call(this,a,b);this.type="encv"},nR=function(a,b,c){kR.call(this,"mp4a",a,b,c)},oR=function(a,b,c){nR.call(this,a,b,c);this.type="enca"},pR=function(a,b){WQ.call(this,"avcC");this.cb=a;this.tc=b;this.version=1;this.f=this.cb[0][1];this.h=this.cb[0][2];this.level=this.cb[0][3]},qR=function(a){Z.call(this,"esds",0,0);this.mc=
7
- a},rR=function(a){a=void 0===a?"":a;Z.call(this,"url ",0,1);this.location=a},sR=function(){Z.call(this,"dref",0,0)},tR=function(){WQ.call(this,_.fg)},uR=function(){Z.call(this,_.hg,0,0)},vR=function(){Z.call(this,"stts",0,0)},wR=function(){Z.call(this,"stsc",0,0)},xR=function(){Z.call(this,"stco",0,0)},yR=function(){Z.call(this,"stsz",0,0)},zR=function(){Z.call(this,"smhd",0,0)},AR=function(){WQ.call(this,"dinf")},BR=function(){WQ.call(this,_.Ne)},CR=function(){WQ.call(this,_.Je)},DR=function(a,b){Z.call(this,
8
- "tfdt",a,0);this.baseMediaDecodeTime=b},ER=function(){Z.call(this,"mfhd",0,0);this.f=0},FR=function(a,b){Z.call(this,"trun",a,b);this.l=this.j=this.f=0;this.o=[];this.sampleSize=[];this.A=[];this.h=[]},GR=function(a,b){Z.call(this,"tfhd",a,b);this.f=255;this.l=this.o=this.j=this.A=this.h=0},HR=function(){WQ.call(this,"traf")},IR=function(){WQ.call(this,"moof")},JR=function(){WQ.call(this,_.Ie);this.f=new Uint8Array(0)},KR=function(){Z.call(this,"tenc",0,0);this.f=1;this.h=8;this.l="";this.j=[]},LR=
9
- function(a,b){Z.call(this,"schm",0,0);this.f=a;this.h=b;this.fc=""},MR=function(a){WQ.call(this,"frma");this.f=a},NR=function(){Z.call(this,"saio",0,0);this.offset=[0]},OR=function(a,b,c){Z.call(this,"saiz",0,0);this.f=a;this.j=b;this.h=c},PR=function(a,b){Z.call(this,"senc",a,b);this.h=0;this.j=8;this.f=[]},QR=function(a){var b=a.split("/");return b[b.length-1].toLowerCase().match("manifest(\\(.+\\))?")?a:a+"/Manifest"},RR=function(a,b,c,d){c=b.$h[c];b=b.Po;a=a.replace("Manifest","");b=b.replace("{bitrate}",
10
- String(d.bitrate)).replace("{Bitrate}",String(d.bitrate)).replace("{start time}",String(c.t)).replace("{start_time}",String(c.t));return _.tC([a],[b])[0]},SR=function(a,b){if(a.type!==b.type)return!1;var c=[];a.type===_.Mg?c=["maxWidth","maxHeight","bitrate",OQ,"fourCC"]:a.type===_.Nc&&(c=["bitrate",OQ,"channels","bitsPerSample","samplingRate","fourCC"]);return _.M.ra(a,b,c,["id","segmentIndex"])},TR=function(a,b,c){var d=c.Ye.split("00000001");a={id:1,type:c.type,duration:a/b,timescale:b,cb:null,
11
- tc:null,width:NaN,height:NaN,mc:null,xe:NaN,sampleSize:NaN,channelCount:NaN};switch(c.type){case _.Mg:a.cb=[_.Dm(d[1])];a.tc=[_.Dm(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.Nc:a.mc=_.Dm(c.Ye),a.sampleSize=c.Xj||16,a.xe=c.xe,a.channelCount=c.xh}return a},UR=function(a,b){return a.filter(function(c){return c.type===b})},VR=function(a,b){var c=a.exec(b);return null==c||""===c[0]?null:(Number(c[4])||0)/1E3+(Number(c[3])||0)+60*(Number(c[2])||0)+3600*(Number(c[1])||0)},cS=function(a,
6
+ kR=function(a,b,c,d){iR.call(this,a);this.channelCount=b;this.sampleSize=c;this.sampleRate=d},lR=function(a,b){jR.call(this,"avc1");this.width=a;this.height=b},mR=function(a,b){lR.call(this,a,b);this.type="encv"},nR=function(a,b,c){kR.call(this,"mp4a",a,b,c)},oR=function(a,b,c){nR.call(this,a,b,c);this.type="enca"},pR=function(a,b){WQ.call(this,"avcC");this.fb=a;this.xc=b;this.version=1;this.f=this.fb[0][1];this.h=this.fb[0][2];this.level=this.fb[0][3]},qR=function(a){Z.call(this,"esds",0,0);this.qc=
7
+ a},rR=function(a){a=void 0===a?"":a;Z.call(this,"url ",0,1);this.location=a},sR=function(){Z.call(this,"dref",0,0)},tR=function(){WQ.call(this,_.kg)},uR=function(){Z.call(this,_.mg,0,0)},vR=function(){Z.call(this,"stts",0,0)},wR=function(){Z.call(this,"stsc",0,0)},xR=function(){Z.call(this,"stco",0,0)},yR=function(){Z.call(this,"stsz",0,0)},zR=function(){Z.call(this,"smhd",0,0)},AR=function(){WQ.call(this,"dinf")},BR=function(){WQ.call(this,_.Ve)},CR=function(){WQ.call(this,_.Re)},DR=function(a,b){Z.call(this,
8
+ "tfdt",a,0);this.baseMediaDecodeTime=b},ER=function(){Z.call(this,"mfhd",0,0);this.f=0},FR=function(a,b){Z.call(this,"trun",a,b);this.l=this.j=this.f=0;this.o=[];this.sampleSize=[];this.A=[];this.h=[]},GR=function(a,b){Z.call(this,"tfhd",a,b);this.f=255;this.l=this.o=this.j=this.A=this.h=0},HR=function(){WQ.call(this,"traf")},IR=function(){WQ.call(this,"moof")},JR=function(){WQ.call(this,_.Qe);this.f=new Uint8Array(0)},KR=function(){Z.call(this,"tenc",0,0);this.f=1;this.h=8;this.l="";this.j=[]},LR=
9
+ function(a,b){Z.call(this,"schm",0,0);this.f=a;this.h=b;this.jc=""},MR=function(a){WQ.call(this,"frma");this.f=a},NR=function(){Z.call(this,"saio",0,0);this.offset=[0]},OR=function(a,b,c){Z.call(this,"saiz",0,0);this.f=a;this.j=b;this.h=c},PR=function(a,b){Z.call(this,"senc",a,b);this.h=0;this.j=8;this.f=[]},QR=function(a){var b=a.split("/");return b[b.length-1].toLowerCase().match("manifest(\\(.+\\))?")?a:a+"/Manifest"},RR=function(a,b,c,d){c=b.ni[c];b=b.jp;a=a.replace("Manifest","");b=b.replace("{bitrate}",
10
+ String(d.bitrate)).replace("{Bitrate}",String(d.bitrate)).replace("{start time}",String(c.t)).replace("{start_time}",String(c.t));return _.wC([a],[b])[0]},SR=function(a,b){if(a.type!==b.type)return!1;var c=[];a.type===_.Sg?c=["maxWidth","maxHeight","bitrate",OQ,"fourCC"]:a.type===_.Sc&&(c=["bitrate",OQ,"channels","bitsPerSample","samplingRate","fourCC"]);return _.M.ta(a,b,c,["id","segmentIndex"])},TR=function(a,b,c){var d=c.kf.split("00000001");a={id:1,type:c.type,duration:a/b,timescale:b,fb:null,
11
+ xc:null,width:NaN,height:NaN,qc:null,He:NaN,sampleSize:NaN,channelCount:NaN};switch(c.type){case _.Sg:a.fb=[_.Nm(d[1])];a.xc=[_.Nm(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.Sc:a.qc=_.Nm(c.kf),a.sampleSize=c.pk||16,a.He=c.He,a.channelCount=c.Lh}return a},UR=function(a,b){return a.filter(function(c){return c.type===b})},VR=function(a,b){var c=a.exec(b);return null==c||""===c[0]?null:(Number(c[4])||0)/1E3+(Number(c[3])||0)+60*(Number(c[2])||0)+3600*(Number(c[1])||0)},cS=function(a,
12
12
  b,c){var d=null;if(WR.test(a)){a=WR.exec(a);d=Number(a[1]);var e=Number(a[2]),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 YR.test(a)?d=VR(YR,a):ZR.test(a)?d=VR(ZR,a):$R.test(a)?(a=$R.exec(a),d=Number(a[1])/c.frameRate):aS.test(a)?(a=aS.exec(a),d=Number(a[1])/c.a):bS.test(a)&&(d=VR(bS,a));d+=b;b=Math.floor(d/3600);c=Math.floor((d-3600*b)/60);a=Math.floor(d-3600*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*
13
- d);return b+":"+c+":"+a+"."+d},dS=function(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))},fS=function(a){this.a=a;this.f=eS(this)},eS=function(a){for(var b=0,c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.Tp(b)},gS=function(a,b,c){a:{var d=_.v([_.Fd,_.Dd]);for(var e=d.next();!e.done;e=d.next())if((e=c.df(e.value))&&e.keyId){d=e.keyId;break a}_.Lh(NQ,
14
- "Could not get default Key ID for DRM init data!");d=null}c=new WQ("xxxx");a.type===_.Mg?c=new mR(a.width,a.height):c=new oR(a.channelCount,a.sampleSize,a.xe);a=new KR;a.f=1;a.h=8;a.l=d||"00000000000000000000000000000000";a=(new WQ("schi")).append([a]);b=(new WQ(_.$f)).append([new MR(b),new LR(_.fd,65536),a]);c.append([b]);return c},hS=function(a,b){var c=b.gf(),d=new bR(a.timescale,a.duration,a.id),e=(new cR).append([new dR(a.id)]),f=new eR(a.id,a.duration,a.timescale,a.width,a.height),g=new fR(a.timescale,
15
- a.duration),h=new gR(a.type),l=null,m=new sR;m.entries=[new rR];var n=new uR;switch(a.type){case _.Mg:var p=new pR(a.cb,a.tc);c?(l=gS(a,"avc1",b),l.append([p]),n.entries=[l]):(l=(new lR(a.width,a.height)).append([p]),n.entries=[l]);l=new hR;break;case _.Nc:p=new qR(a.mc),c?(l=gS(a,"mp4a",b),l.append([p]),n.entries=[l]):(l=(new nR(a.channelCount,a.sampleSize,a.xe)).append([p]),n.entries=[l]),l=new zR}n=(new tR).append([n,new vR,new wR,new yR,new xR]);m=(new AR).append([m]);m=(new BR).append([l,m,n]);
16
- g=(new CR).append([g,h,m]);f=(new aR).append([f,g]);d=(new $Q).append([d,f,e]);e=new ZQ("dash",0,["iso6","mp41","avc1"]);c&&(c=b.df(_.Dd),f=b.df(_.Fd),c&&d.append([new XQ("pssh",c.initData,8)]),f&&d.append([new XQ("pssh",f.initData,8)]),c||f||_.Lh(NQ,"Could not get PSSH init data!"));c=new fS([e,d]);return _.Mi(c.write())},jS=function(a,b){var c,d,e,f,g,h;(new _.fq).M("moof",_.gq).ba("mfhd",function(m){var n=new ER;n.f=_.aq(m.reader);c=n}).M("traf",_.gq).ba("tfhd",function(m){var n=m.reader.Ua();
17
- if(null===m.flags)throw new _.N(_.O,3,3019,MQ);var p=new GR(m.version||0,m.flags||0);p.f=_.aq(m.reader);0<n-m.reader.getPosition()&&m.flags&1&&(p.h=_.cq(m.reader));0<n-m.reader.getPosition()&&m.flags&2&&(p.A=_.aq(m.reader));0<n-m.reader.getPosition()&&m.flags&8&&(p.j=_.aq(m.reader));0<n-m.reader.getPosition()&&m.flags&16&&(p.o=_.aq(m.reader));0<n-m.reader.getPosition()&&m.flags&32&&(p.l=_.aq(m.reader));d=p}).ba("trun",function(m){var n=m.reader.Ua();if(null===m.flags)throw new _.N(_.O,3,3019,MQ);
18
- var p=new FR(m.version||0,m.flags||0);p.f=_.aq(m.reader);0<n-m.reader.getPosition()&&m.flags&1&&(p.j=_.bq(m.reader));0<n-m.reader.getPosition()&&m.flags&4&&(p.l=_.aq(m.reader));if(0<n-m.reader.getPosition())for(n=0;n<p.f;n++)m.flags&256&&p.o.push(_.aq(m.reader)),m.flags&512&&p.sampleSize.push(_.aq(m.reader)),m.flags&1024&&p.A.push(_.aq(m.reader)),m.flags&2048&&(0===m.version?p.h.push(_.aq(m.reader)):p.h.push(_.bq(m.reader)));e=p}).ba("sdtp",function(m){var n=_.eq(m.reader,m.reader.Ua());f=new YQ("sdtp",
19
- m.version||0,m.flags||0,n,0)}).M("uuid",function(m){var n=_.eq(m.reader,16);if(_.Fm(n,iS)){n=_.aq(m.reader);m.version=n>>>24;m.flags=n&16777215;n=new PR(m.version,m.flags);n.h=_.aq(m.reader);m.flags&1&&(n.j=_.Zp(m.reader));for(var p=0;p<n.h;p++){var q={si:_.eq(m.reader,8),xd:0,Rg:[]};if(m.flags&2){q.xd=_.$p(m.reader);for(var t=0;t<q.xd;t++){var u={th:0,uh:0};u.th=_.$p(m.reader);u.uh=_.aq(m.reader);q.Rg.push(u)}}n.f.push(q)}g=n}}).M(_.Ie,function(m){var n=new JR;0<m.reader.Ua()?n.f=_.eq(m.reader,m.reader.Ua()):
20
- (_.Lh(NQ,"mdat box is empty!"),n.f=new Uint8Array(0));h=n}).parse(a,!1);if(!h)return null;var l=(new HR).append([d,e]);f&&l.append([f]);b.gf()&&g&&l.append([g]);l=(new IR).append([c,l]);return new fS([l,h])},kS=function(a,b,c,d){var e=d.gf(),f=parseInt(c*b,10);b=a.data||new ArrayBuffer(0);var g=jS(b,d);if(null===g)return a.request.contentType===_.tn?a.data:g;d=g.get(_.Ie);if(a.request.contentType===_.tn){e=d.f.buffer;if(c){e=_.R.$d(e);if((e=(new DOMParser).parseFromString(e,_.og))&&"tt"===e.documentElement.tagName.toLowerCase())var h=
21
- e.documentElement;if(h&&(d=new dS(h.getAttribute("ttp:frameRate"),h.getAttribute("ttp:subFrameRate"),h.getAttribute("ttp:frameRateMultiplier"),h.getAttribute("ttp:tickRate")),h=h.getElementsByTagName("body")[0]))for(h=h.getElementsByTagName("p"),a=0,b=h.length;a<b;a++){f=h[a];g=c;for(var l=["begin",_.he],m=0,n=l.length;m<n;m++){b:{var p=f;var q=l[m],t=new RegExp("\\w+:"+q),u=0;if(p.hasAttribute(q))p=p.getAttribute(q);else{q=p.attributes;for(var y=q.length;u<y;u++){var B=q[u].name;if(B=B.match(t)){p=
22
- p.getAttribute(B[0]);break b}}p=null}}f.setAttribute(l[m],cS(p||"",g,d))}}e=(new XMLSerializer).serializeToString(e);c=_.R.eb(e).buffer}else c=e;return c}h=new IR;a=g.get("mfhd");b=new HR;l=g.get("tfhd");m=new DR(1,f);f=g.get("trun");n=g.get("sdtp");c=g.get("senc");l.f=1;l.flags&=16777214;l.flags|=131072;b.append([l,m,f]);n&&b.append([n]);if(e){g=0;l=[];if(c.flags&2)for(l=[],m=0;m<c.h;m++)l.push(10+6*c.f[m].xd);else g=8;b.append([c,new NR,new OR(g,l,c.h)])}h.append([a,b]);f.flags|=1;f.j=h.a()+8;d=
23
- new fS([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},lS=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,periodId:null}},mS=function(a,b,c){a=_.Hr(a);c&&a.version!==c&&(a=_.jC(a,c));return{initData:_.hC(a),initDataType:_.fd,keyId:b,periodId:null}},oS=function(){this.A=this.j=this.f=
24
- this.D=null;this.h=1;this.P=0;this.o="";this.F=this.a=null;this.g=new _.L("clpp.smooth.SmoothParser");this.K=!1;this.l=this.B=null;this.O=nS;this.I=0;this.G=this.J=Infinity;this.w=[];this.L=this.jo.bind(this);this.H=new Map},pS=function(a,b){var c,d,e;return _.I(function(f){if(1==f.a)return c=_.Mk(b),c.timeout=a.f.attemptParameters.timeout,c.maxAttempts=Math.max(a.f.attemptParameters.maxAttempts,b.length),c.baseDelay=a.f.attemptParameters.baseDelay,c.backoffFactor=a.f.attemptParameters.backoffFactor,
25
- c.fuzzFactor=a.f.attemptParameters.fuzzFactor,c.type=1,d=a.D.networkingEngine.fetch(c),_.x(f,d.T,2);e=f.f;a.o=e.uri;return f["return"](e)})},wS=function(a,b){var c=_.Cr,d=null;try{var e=_.R.$d(b);d=c.we(e,_.Jb)}catch(MX){}if(!d)throw a.g.error("Unable to parse manifest"),new _.N(_.O,4,4033,a.o);var f=+qS(a,d,"MajorVersion"),g=+qS(a,d,"MinorVersion"),h=+d.getAttribute("TimeScale")||1E7,l=+qS(a,d,"Duration"),m="TRUE"===d.getAttribute("IsLive"),n=+d.getAttribute("LookAheadCount"),p=+d.getAttribute("DVRWindowLength")||
26
- Infinity,q=c.aa(d,"Protection")[0];if(!1===/^[2].[0-2]$/.test(""+f+"."+g))throw a.g.error("Smooth Streaming version must be 2.0, 2.1 or 2.2"),new _.N(_.O,4,4036,a.o);m?(rS(a,sS),a.B=typeof a.f.liveRefreshPeriod===_.k?1E3*a.f.liveRefreshPeriod:Math.min(1E3*a.I,1E4),l=Infinity):rS(a,nS);a.a={startTime:0,delay:0,duration:l/h,gg:p/h,re:0};if(q){var t=a.f.playreadyVersion,u=_.Cr,y=[],B=u.aa(q,"ProtectionHeader")[0],A=_.Cm(u.sa(B)||""),C=_.Hr(A).a;y.push(lS(_.Fd,{initData:_.hC(_.zr(C)),initDataType:_.fd,
27
- keyId:C,periodId:null},[C]));y.push(lS(_.Dd,mS(A,C,t),[C]));a.w=y}var E=[],D=_.Cr.aa(d,"StreamIndex");if(!D.length)throw a.g.error("No streams found!"),new _.N(_.O,4,4034,a.o);for(var J=0;J<D.length;J++){for(var P,U=a,V=D[J],ra=qS(U,V,"Type"),Da=+V.getAttribute("Chunks"),wa=V.getAttribute("Subtype")||"",Ea=V.getAttribute("Language")||_.Bg,Ma=_.jo(Ea),vb=V.getAttribute("Name")||"",ee=+V.getAttribute(_.db),tf=+V.getAttribute(_.cb),wg=qS(U,V,"Url"),ru=+V.getAttribute("TimeScale")||null,hd=[],un=_.Cr.aa(V,
28
- _.yb),ev=0;ev<un.length;ev++){var vf=void 0,oc=void 0,fv=void 0,wf=U,Hd=un[ev],gv=ra,nW=+Hd.getAttribute("Index"),oW=+qS(wf,Hd,"Bitrate"),RI=NaN,SI=NaN,so=NaN,hv=NaN,TI=NaN,UI=NaN,VI=NaN,WI=Hd.getAttribute("FourCC")||"";switch(gv){case _.Mg:RI=+qS(wf,Hd,_.cb);SI=+qS(wf,Hd,_.db);break;case _.Nc:hv=+Hd.getAttribute("Channels")||2,so=+qS(wf,Hd,"SamplingRate"),UI=+qS(wf,Hd,"AudioTag"),TI=+qS(wf,Hd,"BitsPerSample"),VI=+qS(wf,Hd,"PacketSize")}var iv=String(Hd.getAttribute("CodecPrivateData"));if(gv===_.Nc&&
29
- !iv){var XI=hv,YI={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},to=YI[so];if("AACH"===WI){oc=new Uint8Array(4);var ZI=YI[2*so];oc[0]=40|to>>1;oc[1]=to<<7|XI<<3|ZI>>1;oc[2]=ZI<<7|8;oc[3]=0;vf=new Uint16Array(2);vf[0]=(oc[0]<<8)+oc[1];vf[1]=(oc[2]<<8)+oc[3];fv=vf[0].toString(16)+vf[1].toString(16)}else oc=new Uint8Array(2),oc[0]=16|to>>1,oc[1]=to<<7|XI<<3,vf=new Uint16Array(1),vf[0]=(oc[0]<<8)+oc[1],fv=vf[0].toString(16);iv=fv.toUpperCase()}var pW=
30
- {id:wf.P++,type:gv,index:nW,bitrate:oW,Ye:iv,maxHeight:RI,maxWidth:SI,xe:so,xh:hv,gp:UI,Xj:TI,xp:VI,Nl:WI,segmentIndex:null};hd.push(pW)}P=hd;for(var Fe=[],$I=_.Cr.aa(V,"c"),jk=0;jk<$I.length;jk++){var jv=$I[jk],fe=parseInt(jv.getAttribute("t"),10),$h=parseInt(jv.getAttribute("d"),10),kv=parseInt(jv.getAttribute("r"),10),kk=0;if(isNaN(fe)&&isNaN($h))throw U.g.error("Either one or both FragmentDuration and FragmentTime field MUST be present in StreamFragmentElement"),new _.N(_.O,4,4037,U.o);0===jk&&
31
- isNaN(fe)&&(kk=fe=0);if(0<jk){var zg=Fe[Fe.length-1];kk=zg.n+1;zg.d||(zg.d=fe-zg.t);fe||(fe=zg.t+zg.d);$h||($h=fe-zg.t)}Fe.push({n:kk,d:$h,t:fe});if(kv){kv--;for(var aJ=0;aJ<kv;aJ++){var uo=Fe[Fe.length-1];kk=uo.n+1;fe=uo.t+uo.d;$h=uo.d;Fe.push({n:kk,d:$h,t:fe})}}}U.Qd()||Fe.length===Da||U.g.warn("Number of fragments ("+Da+") differs from number of chunks ("+Fe.length+").");E.push({type:ra,lp:Da,Ao:wa,language:Ma,td:Ea,name:vb,maxWidth:ee,maxHeight:tf,Po:wg,tracks:P,$h:Fe,timescale:ru})}var xf={vp:f,
32
- Hi:g,timescale:h,duration:l,isLive:m,up:n,gg:p,ng:!1,streams:E};if(a.j&&a.A)return tS(a,xf),Promise.resolve();a.H.clear();var lv=xf.timescale,vo=xf.duration,rW=UR(xf.streams,_.Nc),sW=UR(xf.streams,_.Mg),tW=UR(xf.streams,_.tn),bJ=[],wo=uS(a,vo,lv,rW),xo=uS(a,vo,lv,sW),uW=uS(a,vo,lv,tW);wo.length||(wo=[null]);xo.length||(xo=[null]);for(var nv=0;nv<xo.length;nv++)for(var ov=0;ov<wo.length;ov++)bJ.push(vS(a,xo[nv],wo[ov]));var cJ={id:"ID",configurationId:void 0,startTime:0,endTime:vo,variants:bJ,textStreams:uW,
33
- thumbStreams:[]};var wW=xf.streams,pv=a.a.startTime,dJ=a.a.delay,qv=a.J,eJ=Math.min(a.a.duration||Infinity,qv),rv=a.Qd(),xW=a.a.gg,yW=a.a.re,fJ=a.I,gJ=isFinite(a.G)?a.G:0;if(rv)eJ=Infinity,pv=Date.now()/1E3-yW,a.a.startTime=pv,dJ=3*fJ;else for(var zW=isFinite(qv)?qv:a.a.duration,hJ=_.v(wW),sv=hJ.next();!sv.done;sv=hJ.next())for(var iJ=_.v(sv.value.tracks),uv=iJ.next();!uv.done;uv=iJ.next()){var jJ=uv.value;jJ.segmentIndex.offset(-gJ);_.YC(jJ.segmentIndex,zW)}var kJ=a.f.timeline||{};kJ.type=void 0;
34
- a.F=new _.kD(kJ,pv,dJ,!rv,!0);a.F.f=eJ;_.sD(a.F,fJ);a.F.A=xW;rv||a.F.offset(-gJ);a.D.filterAllPeriods([cJ]);a.j={presentationTimeline:a.F,periods:[cJ],minBufferTime:0,cues:[]};Promise.resolve();a.K||(a.D.networkingEngine.Gd(a.L),a.K=!0);a.A=xf;return Promise.resolve()},tS=function(a,b){for(var c=0;c<a.A.streams.length;c++)for(var d=b.streams[c],e={},f=_.v(a.A.streams[c].tracks),g=f.next();!g.done;e={kc:e.kc},g=f.next())if(e.kc=g.value,g=d.tracks.find(function(l){return function(m){return m.type===
35
- l.kc.type&&m.bitrate===l.kc.bitrate}}(e))){SR(e.kc,g)||a.g.warn("The current stream is updated with a stream that seems to have different base properties!");var h=xS(a,a.A.timescale,d,g);g=e.kc.segmentIndex;g.ua(h);(h=a.a.gg)&&_.JD(g,_.ID(g)-h).forEach(function(l){l.Ka().forEach(function(m){a.H["delete"](m)})})}else a.g.warn("Cannot find satisfying update for "+e.kc.type+" track with bitrate "+(e.kc.bitrate+". Skipping update."))},uS=function(a,b,c,d){for(var e=[],f={Yc:0};f.Yc<d.length;f={Yc:f.Yc},
36
- f.Yc++){var g=d[f.Yc].tracks.map(function(h){return function(l){var m=d[h.Yc],n=xS(a,c,m,l);n=new _.HD(n);var p=null;m.type!==_.tn&&(p=yS(a,b,c,m,l));l.segmentIndex=n;var q=_.$J++,t=Promise.resolve.bind(Promise),u=n.hd.bind(n),y=n.get.bind(n),B=n.Hd.bind(n),A=n.getDuration.bind(n),C=zS[m.type],E="";switch(m.type){case _.Mg:E=l.Ye;var D=/00000001[0-9]7/.exec(E);E="avc1."+(D&&D[0]?E.substr(E.indexOf(D[0])+10,6):"42c00c");a.g.debug("VIDEO CODECS: ",E);break;case _.Nc:E=l.Ye,D=2,"AACH"===l.Nl?D=5:E&&
37
- (D=(parseInt(E.substr(0,2),16)&248)>>3),E="mp4a.40."+D,a.g.debug("AUDIO CODECS: ",E)}D=m.type===_.tn?AS[m.Ao]:void 0;return{id:q,originalId:null,Ap:null,createSegmentIndex:t,findSegmentPosition:u,getSegmentReference:y,adjustSegmentDurations:B,getDuration:A,segmentIndex:n,segmentLookupStrategy:_.QB,initSegmentReference:p,mimeType:C,codecs:E,frameRate:void 0,bandwidth:l.bitrate,width:l.maxWidth||void 0,height:l.maxHeight||void 0,kind:D,encrypted:a.qg(),keyId:null,language:m.language,originalLanguage:m.td,
38
- label:m.name,type:m.type,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:l.xh||null,spatialAudio:!1,closedCaptions:null}}}(f));e=e.concat(g)}return e},xS=function(a,b,c,d){var e=0,f=[],g=c.timescale||b;c.$h.forEach(function(h,l){var m=h.d/g;if(0===l){var n=h.t/g;a.G=Math.min(a.G,n)}else n=f[l-1].endTime;var p=n+m,q=RR(a.o,c,l,d);a.I=Math.max(a.I,m);f.push(new _.Jp(l,n,p,function(){return[q]},0,null,0,null,!0,g));a.H.set(q,n);e+=m});if(c.type===_.Mg||c.type===_.Nc)b=f[f.length-
39
- 1],a.J=Math.min(a.J,e),0===a.a.re?a.a.re=b.endTime:a.a.re=Math.min(a.a.re,b.endTime);return f},yS=function(a,b,c,d,e){b=TR(b,d.timescale||c,e);c={isLive:a.Qd.bind(a),gf:a.qg.bind(a),Wl:function(){return 1},df:a.ei.bind(a)};d=new Uint8Array(0);try{d=hS(b,c)}catch(g){throw a.g.error("Failed to generate initialization segment."),new _.N(_.O,3,4035,g);}var f="data:text/plain;base64,"+_.Bm(d);return new _.HC(function(){return[f]},0,null,null,!0)},vS=function(a,b,c){var d=(c?c.bandwidth:0)+(b?b.bandwidth:
40
- 0),e=c?c.language:_.Bg;return c||b?{id:a.h++,language:e,primary:!1,audio:c,video:b,bandwidth:d,drmInfos:a.w,allowedByApplication:!0,allowedByKeySystem:!0}:null},qS=function(a,b,c){if(b=b.getAttribute(c))return b;a.g.error("required attribute not provided: "+c);throw new _.N(_.O,4,4038,a.o,c);},BS=function(a,b){null!=a.B&&null!=b&&(a.l=window.setTimeout(a.dc.bind(a),b))},rS=function(a,b){var c=b===nS;a.j&&a.j.presentationTimeline&&_.nD(a.j.presentationTimeline,c);c&&null!=a.l&&(window.clearTimeout(a.l),
13
+ d);return b+":"+c+":"+a+"."+d},dS=function(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))},fS=function(a){this.a=a;this.f=eS(this)},eS=function(a){for(var b=0,c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.bq(b)},gS=function(a,b,c){a:{var d=_.v([_.Md,_.Kd]);for(var e=d.next();!e.done;e=d.next())if((e=c.tf(e.value))&&e.keyId){d=e.keyId;break a}_.Qh(NQ,
14
+ "Could not get default Key ID for DRM init data!");d=null}c=new WQ("xxxx");a.type===_.Sg?c=new mR(a.width,a.height):c=new oR(a.channelCount,a.sampleSize,a.He);a=new KR;a.f=1;a.h=8;a.l=d||"00000000000000000000000000000000";a=(new WQ("schi")).append([a]);b=(new WQ(_.eg)).append([new MR(b),new LR(_.ld,65536),a]);c.append([b]);return c},hS=function(a,b){var c=b.vf(),d=new bR(a.timescale,a.duration,a.id),e=(new cR).append([new dR(a.id)]),f=new eR(a.id,a.duration,a.timescale,a.width,a.height),g=new fR(a.timescale,
15
+ a.duration),h=new gR(a.type),l=null,m=new sR;m.entries=[new rR];var n=new uR;switch(a.type){case _.Sg:var p=new pR(a.fb,a.xc);c?(l=gS(a,"avc1",b),l.append([p]),n.entries=[l]):(l=(new lR(a.width,a.height)).append([p]),n.entries=[l]);l=new hR;break;case _.Sc:p=new qR(a.qc),c?(l=gS(a,"mp4a",b),l.append([p]),n.entries=[l]):(l=(new nR(a.channelCount,a.sampleSize,a.He)).append([p]),n.entries=[l]),l=new zR}n=(new tR).append([n,new vR,new wR,new yR,new xR]);m=(new AR).append([m]);m=(new BR).append([l,m,n]);
16
+ g=(new CR).append([g,h,m]);f=(new aR).append([f,g]);d=(new $Q).append([d,f,e]);e=new ZQ("dash",0,["iso6","mp41","avc1"]);c&&(c=b.tf(_.Kd),f=b.tf(_.Md),c&&d.append([new XQ("pssh",c.initData,8)]),f&&d.append([new XQ("pssh",f.initData,8)]),c||f||_.Qh(NQ,"Could not get PSSH init data!"));c=new fS([e,d]);return _.Qi(c.write())},jS=function(a,b){var c,d,e,f,g,h;(new _.oq).M("moof",_.pq).ba("mfhd",function(m){var n=new ER;n.f=_.jq(m.reader);c=n}).M("traf",_.pq).ba("tfhd",function(m){var n=m.reader.Xa();
17
+ if(null===m.flags)throw new _.O(_.P,3,3019,MQ);var p=new GR(m.version||0,m.flags||0);p.f=_.jq(m.reader);0<n-m.reader.getPosition()&&m.flags&1&&(p.h=_.lq(m.reader));0<n-m.reader.getPosition()&&m.flags&2&&(p.A=_.jq(m.reader));0<n-m.reader.getPosition()&&m.flags&8&&(p.j=_.jq(m.reader));0<n-m.reader.getPosition()&&m.flags&16&&(p.o=_.jq(m.reader));0<n-m.reader.getPosition()&&m.flags&32&&(p.l=_.jq(m.reader));d=p}).ba("trun",function(m){var n=m.reader.Xa();if(null===m.flags)throw new _.O(_.P,3,3019,MQ);
18
+ var p=new FR(m.version||0,m.flags||0);p.f=_.jq(m.reader);0<n-m.reader.getPosition()&&m.flags&1&&(p.j=_.kq(m.reader));0<n-m.reader.getPosition()&&m.flags&4&&(p.l=_.jq(m.reader));if(0<n-m.reader.getPosition())for(n=0;n<p.f;n++)m.flags&256&&p.o.push(_.jq(m.reader)),m.flags&512&&p.sampleSize.push(_.jq(m.reader)),m.flags&1024&&p.A.push(_.jq(m.reader)),m.flags&2048&&(0===m.version?p.h.push(_.jq(m.reader)):p.h.push(_.kq(m.reader)));e=p}).ba("sdtp",function(m){var n=_.nq(m.reader,m.reader.Xa());f=new YQ("sdtp",
19
+ m.version||0,m.flags||0,n,0)}).M("uuid",function(m){var n=_.nq(m.reader,16);if(_.Pm(n,iS)){n=_.jq(m.reader);m.version=n>>>24;m.flags=n&16777215;n=new PR(m.version,m.flags);n.h=_.jq(m.reader);m.flags&1&&(n.j=_.hq(m.reader));for(var p=0;p<n.h;p++){var q={Ji:_.nq(m.reader,8),Fd:0,gh:[]};if(m.flags&2){q.Fd=_.iq(m.reader);for(var t=0;t<q.Fd;t++){var u={Hh:0,Ih:0};u.Hh=_.iq(m.reader);u.Ih=_.jq(m.reader);q.gh.push(u)}}n.f.push(q)}g=n}}).M(_.Qe,function(m){var n=new JR;0<m.reader.Xa()?n.f=_.nq(m.reader,m.reader.Xa()):
20
+ (_.Qh(NQ,"mdat box is empty!"),n.f=new Uint8Array(0));h=n}).parse(a,!1);if(!h)return null;var l=(new HR).append([d,e]);f&&l.append([f]);b.vf()&&g&&l.append([g]);l=(new IR).append([c,l]);return new fS([l,h])},kS=function(a,b,c,d){var e=d.vf(),f=parseInt(c*b,10);b=a.data||new ArrayBuffer(0);var g=jS(b,d);if(null===g)return a.request.contentType===_.Dn?a.data:g;d=g.get(_.Qe);if(a.request.contentType===_.Dn){e=d.f.buffer;if(c){e=_.R.ge(e);if((e=(new DOMParser).parseFromString(e,_.tg))&&"tt"===e.documentElement.tagName.toLowerCase())var h=
21
+ e.documentElement;if(h&&(d=new dS(h.getAttribute("ttp:frameRate"),h.getAttribute("ttp:subFrameRate"),h.getAttribute("ttp:frameRateMultiplier"),h.getAttribute("ttp:tickRate")),h=h.getElementsByTagName("body")[0]))for(h=h.getElementsByTagName("p"),a=0,b=h.length;a<b;a++){f=h[a];g=c;for(var l=["begin",_.oe],m=0,n=l.length;m<n;m++){b:{var p=f;var q=l[m],t=new RegExp("\\w+:"+q),u=0;if(p.hasAttribute(q))p=p.getAttribute(q);else{q=p.attributes;for(var y=q.length;u<y;u++){var D=q[u].name;if(D=D.match(t)){p=
22
+ p.getAttribute(D[0]);break b}}p=null}}f.setAttribute(l[m],cS(p||"",g,d))}}e=(new XMLSerializer).serializeToString(e);c=_.R.gb(e).buffer}else c=e;return c}h=new IR;a=g.get("mfhd");b=new HR;l=g.get("tfhd");m=new DR(1,f);f=g.get("trun");n=g.get("sdtp");c=g.get("senc");l.f=1;l.flags&=16777214;l.flags|=131072;b.append([l,m,f]);n&&b.append([n]);if(e){g=0;l=[];if(c.flags&2)for(l=[],m=0;m<c.h;m++)l.push(10+6*c.f[m].Fd);else g=8;b.append([c,new NR,new OR(g,l,c.h)])}h.append([a,b]);f.flags|=1;f.j=h.a()+8;d=
23
+ new fS([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},lS=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,periodId:null}},mS=function(a,b,c){a=_.Qr(a);c&&a.version!==c&&(a=_.mC(a,c));return{initData:_.kC(a),initDataType:_.ld,keyId:b,periodId:null}},oS=function(){this.A=this.j=this.f=
24
+ this.D=null;this.h=1;this.P=0;this.o="";this.F=this.a=null;this.g=new _.L("clpp.smooth.SmoothParser");this.K=!1;this.l=this.B=null;this.O=nS;this.I=0;this.G=this.J=Infinity;this.w=[];this.L=this.Co.bind(this);this.H=new Map},pS=function(a,b){var c,d,e;return _.I(function(f){if(1==f.a)return c=_.$k(b),c.timeout=a.f.attemptParameters.timeout,c.maxAttempts=Math.max(a.f.attemptParameters.maxAttempts,b.length),c.baseDelay=a.f.attemptParameters.baseDelay,c.backoffFactor=a.f.attemptParameters.backoffFactor,
25
+ c.fuzzFactor=a.f.attemptParameters.fuzzFactor,c.type=1,d=a.D.networkingEngine.fetch(c),_.x(f,d.U,2);e=f.f;a.o=e.uri;return f["return"](e)})},wS=function(a,b){var c=_.Lr,d=null;try{var e=_.R.ge(b);d=c.Fe(e,_.Jb)}catch(NX){}if(!d)throw a.g.error("Unable to parse manifest"),new _.O(_.P,4,4033,a.o);var f=+qS(a,d,"MajorVersion"),g=+qS(a,d,"MinorVersion"),h=+d.getAttribute("TimeScale")||1E7,l=+qS(a,d,"Duration"),m="TRUE"===d.getAttribute("IsLive"),n=+d.getAttribute("LookAheadCount"),p=+d.getAttribute("DVRWindowLength")||
26
+ Infinity,q=c.$(d,"Protection")[0];if(!1===/^[2].[0-2]$/.test(""+f+"."+g))throw a.g.error("Smooth Streaming version must be 2.0, 2.1 or 2.2"),new _.O(_.P,4,4036,a.o);m?(rS(a,sS),a.B=typeof a.f.liveRefreshPeriod===_.k?1E3*a.f.liveRefreshPeriod:Math.min(1E3*a.I,1E4),l=Infinity):rS(a,nS);a.a={startTime:0,delay:0,duration:l/h,rg:p/h,ze:0};if(q){var t=a.f.playreadyVersion,u=_.Lr,y=[],D=u.$(q,"ProtectionHeader")[0],C=_.Mm(u.ua(D)||""),B=_.Qr(C).a;y.push(lS(_.Md,{initData:_.kC(_.Ir(B)),initDataType:_.ld,
27
+ keyId:B,periodId:null},[B]));y.push(lS(_.Kd,mS(C,B,t),[B]));a.w=y}var E=[],A=_.Lr.$(d,"StreamIndex");if(!A.length)throw a.g.error("No streams found!"),new _.O(_.P,4,4034,a.o);for(var J=0;J<A.length;J++){for(var N,V=a,U=A[J],qa=qS(V,U,"Type"),wa=+U.getAttribute("Chunks"),oa=U.getAttribute("Subtype")||"",Ca=U.getAttribute("Language")||_.Hg,Ja=_.so(Ca),Ia=U.getAttribute("Name")||"",dc=+U.getAttribute(_.eb),md=+U.getAttribute(_.db),nd=qS(V,U,"Url"),dk=+U.getAttribute("TimeScale")||null,qc=[],Ke=_.Lr.$(U,
28
+ _.yb),Cg=0;Cg<Ke.length;Cg++){var Nd=void 0,Wb=void 0,ec=void 0,Od=V,sc=Ke[Cg],Dg=qa,pW=+sc.getAttribute("Index"),qW=+qS(Od,sc,"Bitrate"),kJ=NaN,lJ=NaN,Eo=NaN,uv=NaN,mJ=NaN,nJ=NaN,oJ=NaN,pJ=sc.getAttribute("FourCC")||"";switch(Dg){case _.Sg:kJ=+qS(Od,sc,_.db);lJ=+qS(Od,sc,_.eb);break;case _.Sc:uv=+sc.getAttribute("Channels")||2,Eo=+qS(Od,sc,"SamplingRate"),nJ=+qS(Od,sc,"AudioTag"),mJ=+qS(Od,sc,"BitsPerSample"),oJ=+qS(Od,sc,"PacketSize")}var vv=String(sc.getAttribute("CodecPrivateData"));if(Dg===_.Sc&&
29
+ !vv){var qJ=uv,rJ={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},Fo=rJ[Eo];if("AACH"===pJ){Wb=new Uint8Array(4);var sJ=rJ[2*Eo];Wb[0]=40|Fo>>1;Wb[1]=Fo<<7|qJ<<3|sJ>>1;Wb[2]=sJ<<7|8;Wb[3]=0;Nd=new Uint16Array(2);Nd[0]=(Wb[0]<<8)+Wb[1];Nd[1]=(Wb[2]<<8)+Wb[3];ec=Nd[0].toString(16)+Nd[1].toString(16)}else Wb=new Uint8Array(2),Wb[0]=16|Fo>>1,Wb[1]=Fo<<7|qJ<<3,Nd=new Uint16Array(1),Nd[0]=(Wb[0]<<8)+Wb[1],ec=Nd[0].toString(16);vv=ec.toUpperCase()}var rW=
30
+ {id:Od.P++,type:Dg,index:pW,bitrate:qW,kf:vv,maxHeight:kJ,maxWidth:lJ,He:Eo,Lh:uv,Ap:nJ,pk:mJ,Rp:oJ,gm:pJ,segmentIndex:null};qc.push(rW)}N=qc;for(var Ne=[],tJ=_.Lr.$(U,"c"),sk=0;sk<tJ.length;sk++){var wv=tJ[sk],ke=parseInt(wv.getAttribute("t"),10),ai=parseInt(wv.getAttribute("d"),10),xv=parseInt(wv.getAttribute("r"),10),tk=0;if(isNaN(ke)&&isNaN(ai))throw V.g.error("Either one or both FragmentDuration and FragmentTime field MUST be present in StreamFragmentElement"),new _.O(_.P,4,4037,V.o);0===sk&&
31
+ isNaN(ke)&&(tk=ke=0);if(0<sk){var Fg=Ne[Ne.length-1];tk=Fg.n+1;Fg.d||(Fg.d=ke-Fg.t);ke||(ke=Fg.t+Fg.d);ai||(ai=ke-Fg.t)}Ne.push({n:tk,d:ai,t:ke});if(xv){xv--;for(var uJ=0;uJ<xv;uJ++){var Go=Ne[Ne.length-1];tk=Go.n+1;ke=Go.t+Go.d;ai=Go.d;Ne.push({n:tk,d:ai,t:ke})}}}V.Xd()||Ne.length===wa||V.g.warn("Number of fragments ("+wa+") differs from number of chunks ("+Ne.length+").");E.push({type:qa,Fp:wa,So:oa,language:Ja,yd:Ca,name:Ia,maxWidth:dc,maxHeight:md,jp:nd,tracks:N,ni:Ne,timescale:dk})}var Bf={Pp:f,
32
+ Xi:g,timescale:h,duration:l,isLive:m,Op:n,rg:p,Ag:!1,streams:E};if(a.j&&a.A)return tS(a,Bf),Promise.resolve();a.H.clear();var yv=Bf.timescale,Ho=Bf.duration,tW=UR(Bf.streams,_.Sc),uW=UR(Bf.streams,_.Sg),vW=UR(Bf.streams,_.Dn),vJ=[],Io=uS(a,Ho,yv,tW),Jo=uS(a,Ho,yv,uW),wW=uS(a,Ho,yv,vW);Io.length||(Io=[null]);Jo.length||(Jo=[null]);for(var Av=0;Av<Jo.length;Av++)for(var Bv=0;Bv<Io.length;Bv++)vJ.push(vS(a,Jo[Av],Io[Bv]));var wJ={id:"ID",configurationId:void 0,startTime:0,endTime:Ho,variants:vJ,textStreams:wW,
33
+ thumbStreams:[]};var yW=Bf.streams,Cv=a.a.startTime,xJ=a.a.delay,Dv=a.J,yJ=Math.min(a.a.duration||Infinity,Dv),Ev=a.Xd(),zW=a.a.rg,AW=a.a.ze,zJ=a.I,AJ=isFinite(a.G)?a.G:0;if(Ev)yJ=Infinity,Cv=Date.now()/1E3-AW,a.a.startTime=Cv,xJ=3*zJ;else for(var BW=isFinite(Dv)?Dv:a.a.duration,BJ=_.v(yW),Fv=BJ.next();!Fv.done;Fv=BJ.next())for(var CJ=_.v(Fv.value.tracks),Gv=CJ.next();!Gv.done;Gv=CJ.next()){var DJ=Gv.value;DJ.segmentIndex.offset(-AJ);_.aD(DJ.segmentIndex,BW)}var EJ=a.f.timeline||{};EJ.type=void 0;
34
+ a.F=new _.nD(EJ,Cv,xJ,!Ev,!0);a.F.f=yJ;_.vD(a.F,zJ);a.F.A=zW;Ev||a.F.offset(-AJ);a.D.filterAllPeriods([wJ]);a.j={presentationTimeline:a.F,periods:[wJ],minBufferTime:0,cues:[]};Promise.resolve();a.K||(a.D.networkingEngine.Od(a.L),a.K=!0);a.A=Bf;return Promise.resolve()},tS=function(a,b){for(var c=0;c<a.A.streams.length;c++)for(var d=b.streams[c],e={},f=_.v(a.A.streams[c].tracks),g=f.next();!g.done;e={oc:e.oc},g=f.next())if(e.oc=g.value,g=d.tracks.find(function(l){return function(m){return m.type===
35
+ l.oc.type&&m.bitrate===l.oc.bitrate}}(e))){SR(e.oc,g)||a.g.warn("The current stream is updated with a stream that seems to have different base properties!");var h=xS(a,a.A.timescale,d,g);g=e.oc.segmentIndex;g.ra(h);(h=a.a.rg)&&_.MD(g,_.LD(g)-h).forEach(function(l){l.La().forEach(function(m){a.H["delete"](m)})})}else a.g.warn("Cannot find satisfying update for "+e.oc.type+" track with bitrate "+(e.oc.bitrate+". Skipping update."))},uS=function(a,b,c,d){for(var e=[],f={cd:0};f.cd<d.length;f={cd:f.cd},
36
+ f.cd++){var g=d[f.cd].tracks.map(function(h){return function(l){var m=d[h.cd],n=xS(a,c,m,l);n=new _.KD(n);var p=null;m.type!==_.Dn&&(p=yS(a,b,c,m,l));l.segmentIndex=n;var q=_.aK++,t=Promise.resolve.bind(Promise),u=n.Wd.bind(n),y=n.get.bind(n),D=n.df.bind(n),C=n.getDuration.bind(n),B=zS[m.type],E="";switch(m.type){case _.Sg:E=l.kf;var A=/00000001[0-9]7/.exec(E);E="avc1."+(A&&A[0]?E.substr(E.indexOf(A[0])+10,6):"42c00c");a.g.debug("VIDEO CODECS: ",E);break;case _.Sc:E=l.kf,A=2,"AACH"===l.gm?A=5:E&&
37
+ (A=(parseInt(E.substr(0,2),16)&248)>>3),E="mp4a.40."+A,a.g.debug("AUDIO CODECS: ",E)}A=m.type===_.Dn?AS[m.So]:void 0;return{id:q,originalId:null,Up:null,createSegmentIndex:t,findSegmentPosition:u,getSegmentReference:y,adjustSegmentDurations:D,getDuration:C,segmentIndex:n,segmentLookupStrategy:_.TB,initSegmentReference:p,mimeType:B,codecs:E,frameRate:void 0,bandwidth:l.bitrate,width:l.maxWidth||void 0,height:l.maxHeight||void 0,kind:A,encrypted:a.Dg(),keyId:null,language:m.language,originalLanguage:m.yd,
38
+ label:m.name,type:m.type,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:l.Lh||null,spatialAudio:!1,closedCaptions:null}}}(f));e=e.concat(g)}return e},xS=function(a,b,c,d){var e=0,f=[],g=c.timescale||b;c.ni.forEach(function(h,l){var m=h.d/g;if(0===l){var n=h.t/g;a.G=Math.min(a.G,n)}else n=f[l-1].endTime;var p=n+m,q=RR(a.o,c,l,d);a.I=Math.max(a.I,m);f.push(new _.Sp(l,n,p,function(){return[q]},0,null,0,null,!0,g));a.H.set(q,n);e+=m});if(c.type===_.Sg||c.type===_.Sc)b=f[f.length-
39
+ 1],a.J=Math.min(a.J,e),0===a.a.ze?a.a.ze=b.endTime:a.a.ze=Math.min(a.a.ze,b.endTime);return f},yS=function(a,b,c,d,e){b=TR(b,d.timescale||c,e);c={isLive:a.Xd.bind(a),vf:a.Dg.bind(a),qm:function(){return 1},tf:a.vi.bind(a)};d=new Uint8Array(0);try{d=hS(b,c)}catch(g){throw a.g.error("Failed to generate initialization segment."),new _.O(_.P,3,4035,g);}var f="data:text/plain;base64,"+_.Lm(d);return new _.KC(function(){return[f]},0,null,null,!0)},vS=function(a,b,c){var d=(c?c.bandwidth:0)+(b?b.bandwidth:
40
+ 0),e=c?c.language:_.Hg;return c||b?{id:a.h++,language:e,primary:!1,audio:c,video:b,bandwidth:d,drmInfos:a.w,allowedByApplication:!0,allowedByKeySystem:!0}:null},qS=function(a,b,c){if(b=b.getAttribute(c))return b;a.g.error("required attribute not provided: "+c);throw new _.O(_.P,4,4038,a.o,c);},BS=function(a,b){null!=a.B&&null!=b&&(a.l=window.setTimeout(a.hc.bind(a),b))},rS=function(a,b){var c=b===nS;a.j&&a.j.presentationTimeline&&_.qD(a.j.presentationTimeline,c);c&&null!=a.l&&(window.clearTimeout(a.l),
41
41
  a.l=null,a.B=null);a.O=b},CS=function(){};WQ.prototype.append=function(a){a=void 0===a?[]:a;for(var b=0;b<a.length;b++)this.children.push(a[b]),a[b].parent=this;return this};WQ.prototype.get=function(a){if(this.type===a)return this;for(var b=0;b<this.children.length;b++){if(this.children[b].type===a)return this.children[b];var c=this.children[b].get(a);if(c)return c}return null};
42
42
  WQ.prototype.a=function(){var a=Math.pow(2,32)-1;var b=4+this.type.length;"uuid"===this.type&&(b+=16);if(0<this.children.length)for(var c=0;c<this.children.length;c++)b+=this.children[c].a();this.size>a&&(b+=8);return b};
43
- WQ.prototype.write=function(a){var b=Math.pow(2,32)-1;this.start=a.getPosition();this.size=this.a();this.size>b?_.W(a,1):_.W(a,this.size);_.Vp(a,VQ(this.type));this.size>b&&PQ(a,this.size);"uuid"===this.type&&_.Vp(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()};_.w(Z,WQ);Z.prototype.a=function(){return 4+WQ.prototype.a.call(this)};
44
- Z.prototype.write=function(a){WQ.prototype.write.call(this,a);QQ(a,this.version);RQ(a,this.flags)};_.w(XQ,WQ);XQ.prototype.a=function(){return this.f.byteLength+WQ.prototype.a.call(this)-this.offset};XQ.prototype.write=function(a){WQ.prototype.write.call(this,a);_.Vp(a,this.f,this.offset);a.getPosition()};_.w(YQ,Z);YQ.prototype.a=function(){return this.f.byteLength+Z.prototype.a.call(this)-this.offset};YQ.prototype.write=function(a){Z.prototype.write.call(this,a);_.Vp(a,this.f,this.offset);a.getPosition()};
45
- _.w(ZQ,WQ);ZQ.prototype.a=function(){var a=this.h.length;a=a+4+this.f.join("").length;return a+WQ.prototype.a.call(this)};ZQ.prototype.write=function(a){WQ.prototype.write.call(this,a);_.Vp(a,VQ(this.h));_.W(a,this.Hi);_.Vp(a,VQ(this.f.join("")));a.getPosition()};_.w($Q,WQ);_.w(aR,WQ);_.w(bR,Z);bR.prototype.a=function(){var a=0;a=1===this.version?a+28:a+16;a=a+44+this.f.length;return a+=Z.prototype.a.call(this)};
43
+ WQ.prototype.write=function(a){var b=Math.pow(2,32)-1;this.start=a.getPosition();this.size=this.a();this.size>b?_.W(a,1):_.W(a,this.size);_.dq(a,VQ(this.type));this.size>b&&PQ(a,this.size);"uuid"===this.type&&_.dq(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()};_.w(Z,WQ);Z.prototype.a=function(){return 4+WQ.prototype.a.call(this)};
44
+ Z.prototype.write=function(a){WQ.prototype.write.call(this,a);QQ(a,this.version);RQ(a,this.flags)};_.w(XQ,WQ);XQ.prototype.a=function(){return this.f.byteLength+WQ.prototype.a.call(this)-this.offset};XQ.prototype.write=function(a){WQ.prototype.write.call(this,a);_.dq(a,this.f,this.offset);a.getPosition()};_.w(YQ,Z);YQ.prototype.a=function(){return this.f.byteLength+Z.prototype.a.call(this)-this.offset};YQ.prototype.write=function(a){Z.prototype.write.call(this,a);_.dq(a,this.f,this.offset);a.getPosition()};
45
+ _.w(ZQ,WQ);ZQ.prototype.a=function(){var a=this.h.length;a=a+4+this.f.join("").length;return a+WQ.prototype.a.call(this)};ZQ.prototype.write=function(a){WQ.prototype.write.call(this,a);_.dq(a,VQ(this.h));_.W(a,this.Xi);_.dq(a,VQ(this.f.join("")));a.getPosition()};_.w($Q,WQ);_.w(aR,WQ);_.w(bR,Z);bR.prototype.a=function(){var a=0;a=1===this.version?a+28:a+16;a=a+44+this.f.length;return a+=Z.prototype.a.call(this)};
46
46
  bR.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(PQ(a,0),PQ(a,0),_.W(a,this.timescale),PQ(a,this.duration*this.timescale)):(_.W(a,0),_.W(a,0),_.W(a,this.timescale),_.W(a,this.duration*this.timescale));_.W(a,65536);SQ(a,this.volume);SQ(a,0);_.W(a,0);_.W(a,0);for(var b=0;b<this.f.length;b++)QQ(a,this.f[b]);_.W(a,0);_.W(a,0);_.W(a,0);_.W(a,0);_.W(a,0);_.W(a,0);_.W(a,this.h);a.getPosition()};_.w(cR,WQ);_.w(dR,Z);dR.prototype.a=function(){return 20+Z.prototype.a.call(this)};
47
47
  dR.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.f);_.W(a,1);_.W(a,0);_.W(a,0);_.W(a,0);a.getPosition()};_.w(eR,Z);eR.prototype.a=function(){var a=0;a=1===this.version?a+32:a+20;a=a+24+this.f.length;return a+Z.prototype.a.call(this)};
48
48
  eR.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(PQ(a,0),PQ(a,0),_.W(a,this.h),_.W(a,0),PQ(a,this.duration*this.timescale)):(_.W(a,0),_.W(a,0),_.W(a,this.h),_.W(a,0),_.W(a,this.duration*this.timescale));_.W(a,0);_.W(a,0);SQ(a,0);SQ(a,0);SQ(a,this.volume);SQ(a,0);for(var b=0;b<this.f.length;b++)QQ(a,this.f[b]);SQ(a,this.width);SQ(a,0);SQ(a,this.height);SQ(a,0);a.getPosition()};_.w(fR,Z);fR.prototype.a=function(){var a=0;a=1===this.version?a+28:a+16;return a+4+Z.prototype.a.call(this)};
49
49
  fR.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(PQ(a,0),PQ(a,0),_.W(a,this.timescale),PQ(a,this.duration*this.timescale)):(_.W(a,0),_.W(a,0),_.W(a,this.timescale),_.W(a,this.duration*this.timescale));SQ(a,this.language);SQ(a,0);a.getPosition()};_.w(gR,Z);gR.prototype.a=function(){return 33+Z.prototype.a.call(this)};
50
- gR.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,0);this.f===_.Mg?_.Vp(a,VQ("vide")):_.Vp(a,VQ("soun"));_.W(a,0);_.W(a,0);_.W(a,0);this.f===_.Mg?_.Vp(a,VQ("VideoHandler\x00")):_.Vp(a,VQ("SoundHandler\x00"));a.getPosition()};_.w(hR,Z);hR.prototype.a=function(){return 2+this.f.byteLength+Z.prototype.a.call(this)};hR.prototype.write=function(a){Z.prototype.write.call(this,a);SQ(a,0);_.Vp(a,this.f);a.getPosition()};_.w(iR,WQ);iR.prototype.a=function(){return 8+WQ.prototype.a.call(this)};
51
- iR.prototype.write=function(a){WQ.prototype.write.call(this,a);_.W(a,0);SQ(a,0);SQ(a,1)};_.w(jR,iR);jR.prototype.a=function(){return 70+iR.prototype.a.call(this)};jR.prototype.write=function(a){iR.prototype.write.call(this,a);SQ(a,0);SQ(a,0);_.W(a,0);_.W(a,0);_.W(a,0);SQ(a,this.width);SQ(a,this.height);_.W(a,4718592);_.W(a,4718592);_.W(a,0);SQ(a,1);QQ(a,10);_.Vp(a,VQ("AVC Coding",31));SQ(a,this.depth);UQ(a,-1)};_.w(kR,iR);kR.prototype.a=function(){return 20+iR.prototype.a.call(this)};
50
+ gR.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,0);this.f===_.Sg?_.dq(a,VQ("vide")):_.dq(a,VQ("soun"));_.W(a,0);_.W(a,0);_.W(a,0);this.f===_.Sg?_.dq(a,VQ("VideoHandler\x00")):_.dq(a,VQ("SoundHandler\x00"));a.getPosition()};_.w(hR,Z);hR.prototype.a=function(){return 2+this.f.byteLength+Z.prototype.a.call(this)};hR.prototype.write=function(a){Z.prototype.write.call(this,a);SQ(a,0);_.dq(a,this.f);a.getPosition()};_.w(iR,WQ);iR.prototype.a=function(){return 8+WQ.prototype.a.call(this)};
51
+ iR.prototype.write=function(a){WQ.prototype.write.call(this,a);_.W(a,0);SQ(a,0);SQ(a,1)};_.w(jR,iR);jR.prototype.a=function(){return 70+iR.prototype.a.call(this)};jR.prototype.write=function(a){iR.prototype.write.call(this,a);SQ(a,0);SQ(a,0);_.W(a,0);_.W(a,0);_.W(a,0);SQ(a,this.width);SQ(a,this.height);_.W(a,4718592);_.W(a,4718592);_.W(a,0);SQ(a,1);QQ(a,10);_.dq(a,VQ("AVC Coding",31));SQ(a,this.depth);UQ(a,-1)};_.w(kR,iR);kR.prototype.a=function(){return 20+iR.prototype.a.call(this)};
52
52
  kR.prototype.write=function(a){iR.prototype.write.call(this,a);_.W(a,0);_.W(a,0);SQ(a,this.channelCount);SQ(a,this.sampleSize);UQ(a,0);SQ(a,0);SQ(a,this.sampleRate);SQ(a,0)};_.w(lR,jR);lR.prototype.write=function(a){jR.prototype.write.call(this,a);for(var b=0;b<this.children.length;b++)this.children[b].write(a);a.getPosition()};_.w(mR,lR);_.w(nR,kR);nR.prototype.write=function(a){kR.prototype.write.call(this,a);for(var b=0;b<this.children.length;b++)this.children[b].write(a);a.getPosition()};
53
- _.w(oR,nR);_.w(pR,WQ);pR.prototype.a=function(){for(var a=7,b=0;b<this.cb.length;b++)a+=2,a+=this.cb[b].byteLength;for(b=0;b<this.cb.length;b++)a+=2,a+=this.tc[b].byteLength;return a+WQ.prototype.a.call(this)};
54
- pR.prototype.write=function(a){WQ.prototype.write.call(this,a);QQ(a,this.version);QQ(a,this.f);QQ(a,this.h);QQ(a,this.level);QQ(a,255);QQ(a,224|this.cb.length);for(var b=0;b<this.cb.length;b++)SQ(a,this.cb[b].length),_.Vp(a,this.cb[b]);QQ(a,this.tc.length);for(b=0;b<this.tc.length;b++)SQ(a,this.tc[b].length),_.Vp(a,this.tc[b]);a.getPosition()};_.w(qR,Z);qR.prototype.a=function(){return 22+(this.mc.byteLength+3)+Z.prototype.a.call(this)};
55
- qR.prototype.write=function(a){Z.prototype.write.call(this,a);QQ(a,3);QQ(a,23+this.mc.byteLength);SQ(a,1);QQ(a,0);QQ(a,4);QQ(a,15+this.mc.byteLength);QQ(a,64);QQ(a,21);RQ(a,0);_.W(a,0);_.W(a,0);QQ(a,5);QQ(a,this.mc.byteLength);_.Vp(a,this.mc);_.Vp(a,new Uint8Array([6,1,2]));a.getPosition()};_.w(rR,Z);rR.prototype.a=function(){return this.location.length+Z.prototype.a.call(this)};rR.prototype.write=function(a){Z.prototype.write.call(this,a);0<this.location.length&&_.Vp(a,VQ(this.location));a.getPosition()};
53
+ _.w(oR,nR);_.w(pR,WQ);pR.prototype.a=function(){for(var a=7,b=0;b<this.fb.length;b++)a+=2,a+=this.fb[b].byteLength;for(b=0;b<this.fb.length;b++)a+=2,a+=this.xc[b].byteLength;return a+WQ.prototype.a.call(this)};
54
+ pR.prototype.write=function(a){WQ.prototype.write.call(this,a);QQ(a,this.version);QQ(a,this.f);QQ(a,this.h);QQ(a,this.level);QQ(a,255);QQ(a,224|this.fb.length);for(var b=0;b<this.fb.length;b++)SQ(a,this.fb[b].length),_.dq(a,this.fb[b]);QQ(a,this.xc.length);for(b=0;b<this.xc.length;b++)SQ(a,this.xc[b].length),_.dq(a,this.xc[b]);a.getPosition()};_.w(qR,Z);qR.prototype.a=function(){return 22+(this.qc.byteLength+3)+Z.prototype.a.call(this)};
55
+ qR.prototype.write=function(a){Z.prototype.write.call(this,a);QQ(a,3);QQ(a,23+this.qc.byteLength);SQ(a,1);QQ(a,0);QQ(a,4);QQ(a,15+this.qc.byteLength);QQ(a,64);QQ(a,21);RQ(a,0);_.W(a,0);_.W(a,0);QQ(a,5);QQ(a,this.qc.byteLength);_.dq(a,this.qc);_.dq(a,new Uint8Array([6,1,2]));a.getPosition()};_.w(rR,Z);rR.prototype.a=function(){return this.location.length+Z.prototype.a.call(this)};rR.prototype.write=function(a){Z.prototype.write.call(this,a);0<this.location.length&&_.dq(a,VQ(this.location));a.getPosition()};
56
56
  _.w(sR,Z);sR.prototype.a=function(){for(var a=4,b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+Z.prototype.a.call(this)};sR.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.w(tR,WQ);_.w(uR,Z);uR.prototype.a=function(){for(var a=4,b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+Z.prototype.a.call(this)};
57
57
  uR.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.w(vR,Z);vR.prototype.a=function(){for(var a=4,b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+Z.prototype.a.call(this)};vR.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.w(wR,Z);
58
58
  wR.prototype.a=function(){for(var a=4,b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+Z.prototype.a.call(this)};wR.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.w(xR,Z);xR.prototype.a=function(){for(var a=4,b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+Z.prototype.a.call(this)};
59
59
  xR.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.w(yR,Z);yR.prototype.a=function(){return 8+Z.prototype.a.call(this)};yR.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,0);_.W(a,0);a.getPosition()};_.w(zR,Z);zR.prototype.a=function(){return 4+Z.prototype.a.call(this)};zR.prototype.write=function(a){Z.prototype.write.call(this,a);UQ(a,0);SQ(a,0);a.getPosition()};
60
60
  _.w(AR,WQ);_.w(BR,WQ);_.w(CR,WQ);_.w(DR,Z);DR.prototype.a=function(){var a=0;a=1===this.version?a+8:a+4;return a+Z.prototype.a.call(this)};DR.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?PQ(a,this.baseMediaDecodeTime):_.W(a,this.baseMediaDecodeTime);a.getPosition()};_.w(ER,Z);ER.prototype.a=function(){return 4+Z.prototype.a.call(this)};ER.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.f);a.getPosition()};_.w(FR,Z);
61
- FR.prototype.a=function(){var a=4;this.flags&DS&&(a+=4);this.flags&ES&&(a+=4);for(var b=0;b<this.f;b++)this.flags&FS&&(a+=4),this.flags&GS&&(a+=4),this.flags&HS&&(a+=4),this.flags&IS&&(a+=4);return a+Z.prototype.a.call(this)};
62
- FR.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.f);this.flags&DS&&(a.getPosition(),TQ(a,this.j));this.flags&ES&&_.W(a,this.l);for(var b=0;b<this.f;b++)this.flags&FS&&_.W(a,this.o[b]),this.flags&GS&&_.W(a,this.sampleSize[b]),this.flags&HS&&_.W(a,this.A[b]),this.flags&IS&&(0===this.version?_.W(a,this.h[b]):TQ(a,this.h[b]));a.getPosition()};var DS=1,ES=4,FS=256,GS=512,HS=1024,IS=2048;_.w(GR,Z);
63
- GR.prototype.a=function(){var a=4;this.flags&JS&&(a+=8);this.flags&KS&&(a+=4);this.flags&LS&&(a+=4);this.flags&MS&&(a+=4);this.flags&NS&&(a+=4);return a+Z.prototype.a.call(this)};GR.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.f);this.flags&JS&&PQ(a,this.h);this.flags&KS&&_.W(a,this.A);this.flags&LS&&_.W(a,this.j);this.flags&MS&&_.W(a,this.o);this.flags&NS&&_.W(a,this.l);a.getPosition()};var JS=1,KS=2,LS=8,MS=16,NS=32;_.w(HR,WQ);_.w(IR,WQ);_.w(JR,WQ);
64
- JR.prototype.a=function(){return this.f.byteLength+WQ.prototype.a.call(this)};JR.prototype.write=function(a){WQ.prototype.write.call(this,a);0<this.f.byteLength&&_.Vp(a,this.f)};_.w(KR,Z);KR.prototype.a=function(){var a=20;1===this.f&&0===this.h&&(a=a+1+this.j.length);return a+Z.prototype.a.call(this)};
65
- KR.prototype.write=function(a){Z.prototype.write.call(this,a);QQ(a,0);0===this.version?QQ(a,0):QQ(a,0);QQ(a,this.f);QQ(a,this.h);_.Vp(a,_.Dm(this.l));if(1===this.f&&0===this.h){QQ(a,0);for(var b=0;b<this.j.length;b++)QQ(a,this.j[b])}a.getPosition()};_.w(LR,Z);LR.prototype.a=function(){var a=8;this.flags&1&&(a+=VQ(this.fc).byteLength);return a+Z.prototype.a.call(this)};LR.prototype.write=function(a){Z.prototype.write.call(this,a);_.Vp(a,VQ(this.f));_.W(a,this.h);this.flags&1&&_.Vp(a,VQ(this.fc));a.getPosition()};
66
- _.w(MR,WQ);MR.prototype.a=function(){return VQ(this.f).byteLength+WQ.prototype.a.call(this)};MR.prototype.write=function(a){WQ.prototype.write.call(this,a);_.Vp(a,VQ(this.f));a.getPosition()};_.w(NR,Z);NR.prototype.a=function(){var a=0;this.flags&1&&(a+=8);a+=4;for(var b=0;1>b;b++)a=0===this.version?a+4:a+8;return a+Z.prototype.a.call(this)};
67
- NR.prototype.write=function(a){Z.prototype.write.call(this,a);this.flags&1&&(_.W(a,0),_.W(a,0));_.W(a,1);for(var b=0;1>b;b++)0===this.version?_.W(a,this.offset[b]):PQ(a,this.offset[b]);a.getPosition()};_.w(OR,Z);OR.prototype.a=function(){var a=0;this.flags&1&&(a+=8);a+=5;0===this.f&&(a+=this.j.length);return a+Z.prototype.a.call(this)};
68
- OR.prototype.write=function(a){Z.prototype.write.call(this,a);this.flags&1&&(_.W(a,0),_.W(a,0));QQ(a,this.f);_.W(a,this.h);if(0===this.f)for(var b=0;b<this.h;b++)QQ(a,this.j[b]);a.getPosition()};_.w(PR,Z);PR.prototype.a=function(){var a=4;this.flags&1&&(a+=1);for(var b=0;b<this.h;b++)if(a+=this.f[b].si.byteLength,this.flags&2){a+=2;for(var c=0;c<this.f[b].xd;c++)a+=2,a+=4}return a+Z.prototype.a.call(this)};
69
- PR.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.h);this.flags&1&&QQ(a,this.j);for(var b=0;b<this.h;b++)if(_.Vp(a,this.f[b].si),this.flags&2){SQ(a,this.f[b].xd);for(var c=0;c<this.f[b].xd;c++)SQ(a,this.f[b].Rg[c].th),_.W(a,this.f[b].Rg[c].uh)}a.getPosition()};var WR=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,YR=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,ZR=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,$R=/^(\d*\.?\d*)f$/,aS=/^(\d*\.?\d*)t$/,bS=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/;fS.prototype.get=function(a){for(var b=0;b<this.a.length;b++){var c=this.a[b].get(a);if(c)return c}return null};fS.prototype.write=function(){this.f=eS(this);for(var a=0;a<this.a.length;a++)this.a[a].write(this.f);return this.f.buffer};var iS=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);_.r=oS.prototype;_.r.configure=function(a){this.f=a};_.r.start=function(a,b){var c=this;this.D=b;var d=_.jh(new Set([a,QR(a)])).concat();return pS(this,d).then(function(e){return wS(c,e.data).then(function(){BS(c,c.B);return c.j})})};_.r.requestStop=function(){};_.r.stop=function(){this.D&&this.D.networkingEngine.Df(this.L);this.B=this.A=this.j=this.f=this.D=null;this.l&&(clearTimeout(this.l),this.l=null);this.K=!1;this.J=this.G=Infinity;return Promise.resolve()};
70
- _.r.update=function(){var a=this;if(this.Qd())return pS(this,[this.o]).then(function(b){return wS(a,b.data).then(function(){return a.j})})["catch"](function(b){if(a.D)a.D.onError(b)})};_.r.setCurrentVariant=function(){};_.r.dc=function(){var a=this;this.g.debug(_.HB);this.D&&(this.l=null,this.update().then(function(){BS(a,a.B)})["catch"](function(b){a.D&&(a.D.onError(b),1===b.severity&&BS(a,100))}))};_.r.Qd=function(){return this.O===sS};_.r.qg=function(){return 0<this.w.length};
71
- _.r.ei=function(a){var b=null;if(this.w.length)for(var c=0;c<this.w.length;c++)if(this.w[c].keySystem===a){b=this.w[c].initData[0];break}return b};
72
- _.r.jo=function(a){if(2!==a.request.type||a.uri.startsWith("data:"))return Promise.resolve(a);var b=a.request.timescale||this.A.timescale,c={isLive:this.Qd.bind(this),gf:this.qg.bind(this),Wl:function(){return 1},df:this.ei.bind(this)},d=!1,e=new _.N(_.O,3,4035,null),f=null;try{var 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 segment reference time "+a.request.startTime);f=kS(a,b,g,c)}catch(h){d=
73
- !0,e.data=h,3E3===h.code&&(e.code=4039)}if(d||!f)return Promise.reject(e);a.data=f;return Promise.resolve(a)};_.r.loadVariant=function(a){return _.I(function(b){return b["return"](a)})};_.r.loadTextStream=function(a,b){var c=this,d,e;return _.I(function(f){(e=c.j.periods.find(function(g){return g.id===b}))&&(d=e.textStreams.find(function(g){return g.id===a})||null);if(!d)throw new _.pi(_.xB+a);return f["return"](d)})};var zS={video:_.Og,audio:_.Rc,text:_.Kc},nS=_.Ub,sS="LIVE",AS={So:_.bd,Zo:_.jg};_.w(CS,_.Tu);CS.prototype.install=function(){_.Rv.ism=oS;_.Qv[_.Lc]=oS};CS.prototype.uninstall=function(){_.jE("ism");_.kE(_.Lc)};CS.prototype.id=function(){return _.ag};_.K("clpp.smooth.SmoothComponent",CS);};
61
+ FR.prototype.a=function(){var a=4;this.flags&1&&(a+=4);this.flags&4&&(a+=4);for(var b=0;b<this.f;b++)this.flags&256&&(a+=4),this.flags&512&&(a+=4),this.flags&1024&&(a+=4),this.flags&2048&&(a+=4);return a+Z.prototype.a.call(this)};
62
+ FR.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.f);this.flags&1&&(a.getPosition(),TQ(a,this.j));this.flags&4&&_.W(a,this.l);for(var b=0;b<this.f;b++)this.flags&256&&_.W(a,this.o[b]),this.flags&512&&_.W(a,this.sampleSize[b]),this.flags&1024&&_.W(a,this.A[b]),this.flags&2048&&(0===this.version?_.W(a,this.h[b]):TQ(a,this.h[b]));a.getPosition()};_.w(GR,Z);
63
+ GR.prototype.a=function(){var a=4;this.flags&1&&(a+=8);this.flags&2&&(a+=4);this.flags&8&&(a+=4);this.flags&16&&(a+=4);this.flags&32&&(a+=4);return a+Z.prototype.a.call(this)};GR.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.f);this.flags&1&&PQ(a,this.h);this.flags&2&&_.W(a,this.A);this.flags&8&&_.W(a,this.j);this.flags&16&&_.W(a,this.o);this.flags&32&&_.W(a,this.l);a.getPosition()};_.w(HR,WQ);_.w(IR,WQ);_.w(JR,WQ);JR.prototype.a=function(){return this.f.byteLength+WQ.prototype.a.call(this)};
64
+ JR.prototype.write=function(a){WQ.prototype.write.call(this,a);0<this.f.byteLength&&_.dq(a,this.f)};_.w(KR,Z);KR.prototype.a=function(){var a=20;1===this.f&&0===this.h&&(a=a+1+this.j.length);return a+Z.prototype.a.call(this)};KR.prototype.write=function(a){Z.prototype.write.call(this,a);QQ(a,0);0===this.version?QQ(a,0):QQ(a,0);QQ(a,this.f);QQ(a,this.h);_.dq(a,_.Nm(this.l));if(1===this.f&&0===this.h){QQ(a,0);for(var b=0;b<this.j.length;b++)QQ(a,this.j[b])}a.getPosition()};_.w(LR,Z);
65
+ LR.prototype.a=function(){var a=8;this.flags&1&&(a+=VQ(this.jc).byteLength);return a+Z.prototype.a.call(this)};LR.prototype.write=function(a){Z.prototype.write.call(this,a);_.dq(a,VQ(this.f));_.W(a,this.h);this.flags&1&&_.dq(a,VQ(this.jc));a.getPosition()};_.w(MR,WQ);MR.prototype.a=function(){return VQ(this.f).byteLength+WQ.prototype.a.call(this)};MR.prototype.write=function(a){WQ.prototype.write.call(this,a);_.dq(a,VQ(this.f));a.getPosition()};_.w(NR,Z);
66
+ NR.prototype.a=function(){var a=0;this.flags&1&&(a+=8);a+=4;for(var b=0;1>b;b++)a=0===this.version?a+4:a+8;return a+Z.prototype.a.call(this)};NR.prototype.write=function(a){Z.prototype.write.call(this,a);this.flags&1&&(_.W(a,0),_.W(a,0));_.W(a,1);for(var b=0;1>b;b++)0===this.version?_.W(a,this.offset[b]):PQ(a,this.offset[b]);a.getPosition()};_.w(OR,Z);OR.prototype.a=function(){var a=0;this.flags&1&&(a+=8);a+=5;0===this.f&&(a+=this.j.length);return a+Z.prototype.a.call(this)};
67
+ OR.prototype.write=function(a){Z.prototype.write.call(this,a);this.flags&1&&(_.W(a,0),_.W(a,0));QQ(a,this.f);_.W(a,this.h);if(0===this.f)for(var b=0;b<this.h;b++)QQ(a,this.j[b]);a.getPosition()};_.w(PR,Z);PR.prototype.a=function(){var a=4;this.flags&1&&(a+=1);for(var b=0;b<this.h;b++)if(a+=this.f[b].Ji.byteLength,this.flags&2){a+=2;for(var c=0;c<this.f[b].Fd;c++)a+=2,a+=4}return a+Z.prototype.a.call(this)};
68
+ PR.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.h);this.flags&1&&QQ(a,this.j);for(var b=0;b<this.h;b++)if(_.dq(a,this.f[b].Ji),this.flags&2){SQ(a,this.f[b].Fd);for(var c=0;c<this.f[b].Fd;c++)SQ(a,this.f[b].gh[c].Hh),_.W(a,this.f[b].gh[c].Ih)}a.getPosition()};var WR=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,YR=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,ZR=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,$R=/^(\d*\.?\d*)f$/,aS=/^(\d*\.?\d*)t$/,bS=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/;fS.prototype.get=function(a){for(var b=0;b<this.a.length;b++){var c=this.a[b].get(a);if(c)return c}return null};fS.prototype.write=function(){this.f=eS(this);for(var a=0;a<this.a.length;a++)this.a[a].write(this.f);return this.f.buffer};var iS=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);_.r=oS.prototype;_.r.configure=function(a){this.f=a};_.r.start=function(a,b){var c=this;this.D=b;var d=_.ph(new Set([a,QR(a)])).concat();return pS(this,d).then(function(e){return wS(c,e.data).then(function(){BS(c,c.B);return c.j})})};_.r.requestStop=function(){};_.r.stop=function(){this.D&&this.D.networkingEngine.Rf(this.L);this.B=this.A=this.j=this.f=this.D=null;this.l&&(clearTimeout(this.l),this.l=null);this.K=!1;this.J=this.G=Infinity;return Promise.resolve()};
69
+ _.r.update=function(){var a=this;if(this.Xd())return pS(this,[this.o]).then(function(b){return wS(a,b.data).then(function(){return a.j})})["catch"](function(b){if(a.D)a.D.onError(b)})};_.r.setCurrentVariant=function(){};_.r.hc=function(){var a=this;this.g.debug(_.KB);this.D&&(this.l=null,this.update().then(function(){BS(a,a.B)})["catch"](function(b){a.D&&(a.D.onError(b),1===b.severity&&BS(a,100))}))};_.r.Xd=function(){return this.O===sS};_.r.Dg=function(){return 0<this.w.length};
70
+ _.r.vi=function(a){var b=null;if(this.w.length)for(var c=0;c<this.w.length;c++)if(this.w[c].keySystem===a){b=this.w[c].initData[0];break}return b};
71
+ _.r.Co=function(a){if(2!==a.request.type||a.uri.startsWith("data:"))return Promise.resolve(a);var b=a.request.timescale||this.A.timescale,c={isLive:this.Xd.bind(this),vf:this.Dg.bind(this),qm:function(){return 1},tf:this.vi.bind(this)},d=!1,e=new _.O(_.P,3,4035,null),f=null;try{var 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 segment reference time "+a.request.startTime);f=kS(a,b,g,c)}catch(h){d=
72
+ !0,e.data=h,3E3===h.code&&(e.code=4039)}if(d||!f)return Promise.reject(e);a.data=f;return Promise.resolve(a)};_.r.loadVariant=function(a){return _.I(function(b){return b["return"](a)})};_.r.loadTextStream=function(a,b){var c=this,d,e;return _.I(function(f){(e=c.j.periods.find(function(g){return g.id===b}))&&(d=e.textStreams.find(function(g){return g.id===a})||null);if(!d)throw new _.ui(_.AB+a);return f["return"](d)})};var zS={video:_.Ug,audio:_.Wc,text:_.Pc},nS=_.Ub,sS="LIVE",AS={mp:_.gd,tp:_.og};_.w(CS,_.bv);CS.prototype.install=function(){_.Xv.ism=oS;_.Wv[_.Qc]=oS};CS.prototype.uninstall=function(){_.kE("ism");_.lE(_.Qc)};CS.prototype.id=function(){return _.fg};_.K("clpp.smooth.SmoothComponent",CS);};
74
73
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
75
74
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
76
75
  else{_=this.clpp._;(f.call(g,this));}