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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/cjs/cl.airplay.js +3 -3
  2. package/cjs/cl.broadpeak.js +7 -7
  3. package/cjs/cl.cast.js +56 -56
  4. package/cjs/cl.cdn.js +5 -5
  5. package/cjs/cl.conviva.js +18 -18
  6. package/cjs/cl.core.js +191 -191
  7. package/cjs/cl.dash.js +51 -51
  8. package/cjs/cl.freewheel.js +9 -9
  9. package/cjs/cl.hls.js +54 -54
  10. package/cjs/cl.hlssmpte.js +1 -1
  11. package/cjs/cl.htmlcue.js +3 -3
  12. package/cjs/cl.ima.js +11 -11
  13. package/cjs/cl.mediatailor.js +2 -2
  14. package/cjs/cl.mse.js +125 -125
  15. package/cjs/cl.muxdata.js +8 -8
  16. package/cjs/cl.persistent.js +2 -2
  17. package/cjs/cl.playlist.js +5 -5
  18. package/cjs/cl.simid.js +3 -3
  19. package/cjs/cl.smooth.js +28 -28
  20. package/cjs/cl.thumbnails.js +3 -3
  21. package/cjs/cl.tizen.js +34 -34
  22. package/cjs/cl.ttml.js +3 -3
  23. package/cjs/cl.verimatrix.js +1 -1
  24. package/cjs/cl.vimond.js +8 -8
  25. package/cjs/cl.vr.js +7 -7
  26. package/cjs/cl.vtt.js +1 -1
  27. package/cjs/cl.yospace.js +2 -2
  28. package/cjs/cl.youbora.js +11 -11
  29. package/cl.airplay.js +1 -1
  30. package/cl.cast.js +29 -29
  31. package/cl.cdn.js +5 -5
  32. package/cl.conviva.js +3 -3
  33. package/cl.core.js +116 -116
  34. package/cl.dash.js +48 -48
  35. package/cl.freewheel.js +3 -3
  36. package/cl.hls.js +35 -35
  37. package/cl.htmlcue.js +1 -1
  38. package/cl.ima.js +1 -1
  39. package/cl.mediatailor.js +2 -2
  40. package/cl.mse.js +78 -78
  41. package/cl.muxdata.js +2 -2
  42. package/cl.persistent.js +1 -1
  43. package/cl.playlist.js +4 -4
  44. package/cl.simid.js +1 -1
  45. package/cl.smooth.js +22 -22
  46. package/cl.thumbnails.js +4 -4
  47. package/cl.tizen.js +15 -15
  48. package/cl.ttml.js +2 -2
  49. package/cl.verimatrix.js +1 -1
  50. package/cl.vimond.js +2 -2
  51. package/cl.vr.js +2 -2
  52. package/cl.vtt.js +2 -2
  53. package/cl.yospace.js +2 -2
  54. package/cl.youbora.js +8 -8
  55. package/package.json +1 -1
package/cjs/cl.muxdata.js CHANGED
@@ -1,16 +1,16 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var mB=function(a){switch(a.type){case 1:return jB;case 2:return kB;case 3:return lB}},oB=function(a){var b=Object.keys(a).find(function(c){return nB.includes(c.toLowerCase())});return void 0!==b?a[b]:void 0},pB=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 _.Bi;this.g=b;this.A=this.l=this.h=!1;this.w=null;this.j=a.getNetworkEngine();this.G=this.El.bind(this);this.D=this.Dl.bind(this)},rB=function(a){var b={debug:!0,
2
+ var f=function(window){var mB=function(a){switch(a.type){case 1:return jB;case 2:return kB;case 3:return lB}},oB=function(a){var b=Object.keys(a).find(function(c){return nB.includes(c.toLowerCase())});return void 0!==b?a[b]:void 0},pB=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 _.Bi;this.g=b;this.A=this.l=this.h=!1;this.w=null;this.j=a.getNetworkEngine();this.G=this.Fl.bind(this);this.D=this.El.bind(this)},rB=function(a){var b={debug:!0,
3
3
  data:qB(a)};a.f&&a.f.muxOptionsOverride&&_.N.Pd(a.f.muxOptionsOverride)&&(b=_.N.ta(b,a.f.muxOptionsOverride));b=_.N.ta(b,{getPlayheadTime:function(){return 1E3*a.m.getPosition()},getStateData:function(){a.g.debug("getStateData()");var c=a.m.ab(),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 _.zn(c.url);f.video_source_url=
4
4
  _.An(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().sa(),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.qa())&&d.language&&(f.player_language_code=d.language);
5
5
  return f}});a.g.debug("Mux SDK options",b);return b},qB=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},sB=function(a){a.a.on(a.m,_.Bg,function(){var b={player_playhead_time:1E3*a.m.getPosition()};a.emit(_.Bg,b)});a.a.on(a.m,_.pf,function(){return a.emit(_.pf)});
6
- a.a.on(a.m,_.bd,a.Al.bind(a));a.a.on(a.m,_.kg,a.Cl.bind(a));a.a.on(a.m,_.Og,function(){return a.emit(_.cg)});a.a.on(a.m,_.Ng,function(){return a.emit(_.bg)});a.a.on(a.m,_.qe,a.Bl.bind(a));a.a.on(a.m,_.ic,function(){return a.emit("adbreakstart")});a.a.on(a.m,_.jc,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,_.nc,function(){return a.emit("adfirstquartile")});a.a.on(a.m,_.vc,function(){return a.emit("admidpoint")});a.a.on(a.m,_.Dc,function(){return a.emit("adthirdquartile")});a.j.yd(a.G);a.j.vg(a.D);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 _.zn(b.uris[b.uriIndex]);b={request_start:c,request_type:mB(b),
6
+ a.a.on(a.m,_.bd,a.Bl.bind(a));a.a.on(a.m,_.kg,a.Dl.bind(a));a.a.on(a.m,_.Og,function(){return a.emit(_.cg)});a.a.on(a.m,_.Ng,function(){return a.emit(_.bg)});a.a.on(a.m,_.qe,a.Cl.bind(a));a.a.on(a.m,_.ic,function(){return a.emit("adbreakstart")});a.a.on(a.m,_.jc,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,_.nc,function(){return a.emit("adfirstquartile")});a.a.on(a.m,_.vc,function(){return a.emit("admidpoint")});a.a.on(a.m,_.Dc,function(){return a.emit("adthirdquartile")});a.j.yd(a.G);a.j.wg(a.D);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 _.zn(b.uris[b.uriIndex]);b={request_start:c,request_type:mB(b),
8
8
  request_hostname:d.a};a.g.debug("onRequestCanceled()","Track event: requestcanceled",b);a.emit("requestcanceled",b)}else{d=b.requestStartTimestamp;var e=new _.zn(b.uris[b.uriIndex]),f=c.data;b={request_start:d,request_type:mB(b),request_hostname:e.a,request_error:""+mB(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)}})},tB=function(a){_.Ei(a.a);a.j.Ve(a.G);a.j.lh(a.D)},uB=function(){this.f=this.m=null;this.a=!1;this.g=new _.M("clpp.muxdata")},vB=function(a){return!_.N.R(a)&&typeof a.init===_.ue&&typeof a.emit===_.ue},wB=function(a,b){a.trigger(new _.Q(_.qe,{detail:b}))},xB=function(){},jB="manifest",kB="media",lB="encryption",nB=["x-request-id","cf-ray","x-amz-cf-id","x-akamai-request-id"];_.r=pB.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,rB(this))}catch(d){throw this.h=!1,tB(this),new _.O(1,9,9302,null,d);}this.emit("playerready")}this.l&&!this.A&&(a=qB(this),this.emit("videochange",a),this.l=!1);sB(this)};_.r.release=function(){this.g.debug("release()");this.l?this.g.debug(_.ma):(tB(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.Al=function(a){this.g.debug(_.af);var b=a.detail;a=this.m.getTrackManager();b&&b.bandwidth&&(b=b.bandwidth,(a=a.Za())&&a.bandwidth&&(b+=a.bandwidth),this.emit("renditionchange",{video_source_bitrate:b}))};_.r.Cl=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.Bl=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.El=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,k=e+a.responseStartMs;a=e+a.timeMs;f=f&&g?g-f:void 0;g=new _.zn(b.uris[b.uriIndex]);a={request_start:e,request_type:mB(b),request_hostname:g.a,request_id:oB(c),request_bytes_loaded:d,request_response_start:k,request_response_end:a,request_response_headers:c,request_media_duration:f,
13
- request_url:_.An(g)};this.g.debug("onRequestCompleted()","Track event: requestcompleted",a);this.emit("requestcompleted",a)}};_.r.Dl=function(a){a.requestStartTimestamp=Date.now()};_.w(uB,_.gw);_.r=uB.prototype;_.r.onPlayerCreated=function(a){this.m=a;this.f=new pB(a,this.g)};
9
+ b)}})},tB=function(a){_.Ei(a.a);a.j.We(a.G);a.j.mh(a.D)},uB=function(){this.f=this.m=null;this.a=!1;this.g=new _.M("clpp.muxdata")},vB=function(a){return!_.N.R(a)&&typeof a.init===_.ue&&typeof a.emit===_.ue},wB=function(a,b){a.trigger(new _.Q(_.qe,{detail:b}))},xB=function(){},jB="manifest",kB="media",lB="encryption",nB=["x-request-id","cf-ray","x-amz-cf-id","x-akamai-request-id"];_.r=pB.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,rB(this))}catch(d){throw this.h=!1,tB(this),new _.O(1,9,9302,null,d);}this.emit("playerready")}this.l&&!this.A&&(a=qB(this),this.emit("videochange",a),this.l=!1);sB(this)};_.r.release=function(){this.g.debug("release()");this.l?this.g.debug(_.ma):(tB(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.Bl=function(a){this.g.debug(_.af);var b=a.detail;a=this.m.getTrackManager();b&&b.bandwidth&&(b=b.bandwidth,(a=a.Za())&&a.bandwidth&&(b+=a.bandwidth),this.emit("renditionchange",{video_source_bitrate:b}))};_.r.Dl=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.Cl=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.Fl=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,k=e+a.responseStartMs;a=e+a.timeMs;f=f&&g?g-f:void 0;g=new _.zn(b.uris[b.uriIndex]);a={request_start:e,request_type:mB(b),request_hostname:g.a,request_id:oB(c),request_bytes_loaded:d,request_response_start:k,request_response_end:a,request_response_headers:c,request_media_duration:f,
13
+ request_url:_.An(g)};this.g.debug("onRequestCompleted()","Track event: requestcompleted",a);this.emit("requestcompleted",a)}};_.r.El=function(a){a.requestStartTimestamp=Date.now()};_.w(uB,_.gw);_.r=uB.prototype;_.r.onPlayerCreated=function(a){this.m=a;this.f=new pB(a,this.g)};
14
14
  _.r.onContentWillLoad=function(a,b){var c=a.getConfiguration();c=_.N.xb(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=!_.N.R(e.muxdata)&&typeof e.muxdata===_.$e){var f=e.muxdata;d=vB(f.muxLib)?f.muxLib:window.mux;if(!vB(d)){this.g.warn("Mux SDK is not loaded. Will do nothing.");this.a=!1;var g=new _.O(1,9,9301);wB(a,g)}}else this.g.debug("Mux plugin is loaded but not configured. Will do nothing.");
15
15
  var k=d;null!==k&&this.f.initialize(c,b,k)}catch(l){this.a=!1,wB(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&&wB(this.m,c),c;}};_.K("clpp.muxdata.MuxDataPlugin",uB);uB.prototype.emit=uB.prototype.emit;uB.Id="mux";xB.prototype.create=function(){return new uB};_.fp(new xB);};
16
16
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
@@ -1,8 +1,8 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
2
  var f=function(window){var RA="A persistent DRM session already exists for: ",SA="No DRM configuration.",TA="clpp.persistent",UA="clpp.persistent.SimpleSessionStorage",VA=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},WA=function(a,b){var c,d,e;return _.I(function(f){if(1==f.a)return _.y(f,_.Fs(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.D&&(e.Oc=new _.rm,d.push(e.Oc));a.g.debug("Attempting to remove session",
3
3
  b);d.push(c.remove());return f["return"](Promise.all(d))})},YA=function(a,b){a.L=XA;a.M=[];a.H=!0;return _.hs(a,b)},$A=function(a,b,c,d,e,f){a.L=ZA;var g=new Map,k=_.Ks(b);g.set(k,{audioCapabilities:e,videoCapabilities:f,distinctiveIdentifier:_.hf,persistentState:_.Uf,sessionTypes:[_.nf],label:k,drmInfos:[{keySystem:b,licenseServerUri:c,distinctiveIdentifierRequired:!1,persistentStateRequired:!0,audioRobustness:"",videoRobustness:"",serverCertificate:d,initData:null,keyIds:null}]});return _.rs(a,
4
- g)},aB=function(){this.g=new _.M(UA)},bB=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}},cB=function(a,b){var c=_.ao(a),d=_.Rn([{drm:a}]);d.drm=a;var e=new _.ds({Mb:b,onError:function(){},Zg:function(){},
5
- Yg:function(){},onEvent:function(){},getConfiguration:function(){return d},Hd:function(){return null}});e.f=c;return e},fB=function(a,b,c){var d,e,f,g,k,l,m,n,p;return _.I(function(q){switch(q.a){case 1:d=dB;e=eB;if(!a)return e.debug(SA),q["return"]();f=a.offlineId;return 0===f.length?q["return"]():_.y(q,d.get(f),2);case 2:if(g=q.f)return e.debug(RA,f),q["return"]();k=cB(a,c);_.F(q,3,4);return _.y(q,YA(k,b),6);case 6:return _.y(q,_.ys(k),7);case 7:return _.y(q,_.zs(k),8);case 8:return l=k.getDrmInfo(),
4
+ g)},aB=function(){this.g=new _.M(UA)},bB=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}},cB=function(a,b){var c=_.ao(a),d=_.Rn([{drm:a}]);d.drm=a;var e=new _.ds({Mb:b,onError:function(){},$g:function(){},
5
+ Zg:function(){},onEvent:function(){},getConfiguration:function(){return d},Hd:function(){return null}});e.f=c;return e},fB=function(a,b,c){var d,e,f,g,k,l,m,n,p;return _.I(function(q){switch(q.a){case 1:d=dB;e=eB;if(!a)return e.debug(SA),q["return"]();f=a.offlineId;return 0===f.length?q["return"]():_.y(q,d.get(f),2);case 2:if(g=q.f)return e.debug(RA,f),q["return"]();k=cB(a,c);_.F(q,3,4);return _.y(q,YA(k,b),6);case 6:return _.y(q,_.ys(k),7);case 7:return _.y(q,_.zs(k),8);case 8:return l=k.getDrmInfo(),
6
6
  m=b.map(function(t){return{contentType:_.In(t.video.mimeType,t.video.codecs),robustness:l.videoRobustness}}),n=VA(k),g={sessionIds:n,keySystem:l.keySystem,licenseServerUri:l.licenseServerUri,serverCertificate:l.serverCertificate,audioCapabilities:[],videoCapabilities:m,drmConfig:a},_.y(q,d.store(f,g),4);case 4:return _.Jh(q),_.y(q,k.destroy(),10);case 10:_.Kh(q);break;case 3:throw p=_.H(q),e.error("Error while persisting DRM session "+f),new _.O(1,6,6200,null,p);}})},gB=function(){this.g=new _.M(TA)},
7
7
  XA=1,ZA=2;_.r=aB.prototype;
8
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),k=JSON.stringify(b.videoCapabilities);c=JSON.stringify({sessionIds:e,keySystem:b.keySystem,licenseServerUri:encodeURIComponent(b.licenseServerUri),serverCertificate:f,audioCapabilities:g,videoCapabilities:k,drmConfig:JSON.stringify(b.drmConfig)});window.localStorage.setItem(encodeURIComponent(a),btoa(c));
@@ -1,10 +1,10 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
2
  var f=function(window){var OA=function(a,b){b=void 0===b?function(){return Promise.resolve()}:b;_.Ii.call(this);this.m=a;this.l=b;this.f=0;this.a=[];this.h=!1;this.j=this.Ja.bind(this)},PA=function(a){a.trigger(new _.Q(_.Cf))},QA=function(a,b){return 0<=b&&b<a.a.length};_.w(OA,_.Ii);_.r=OA.prototype;_.r.on=function(a,b,c){return _.Ii.prototype.on.call(this,a,b,c)};_.r.one=function(a,b,c){return _.Ii.prototype.one.call(this,a,b,c)};_.r.off=function(a,b){return _.Ii.prototype.off.call(this,a,b)};_.r.getPosition=function(){return this.f};
3
- _.r.Ae=function(){return this.a};_.r.Wb=function(){return 0<this.a.length&&QA(this,this.f)?this.a[this.f]:null};_.r.Si=function(){var a=this.f+1;return 0<this.a.length&&QA(this,a)?this.a[a]:null};_.r.Sg=function(){return this.h};_.r.start=function(){this.h||(this.h=!0,this.m.on(_.pe,this.j),this.Md(this.f,!0))};_.r.stop=function(){this.h=!1;this.m.off(_.pe,this.j)};_.r.Ja=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 _.y(c,a.Md(b),0)})};_.r.Ue=function(){var a=this,b;return _.I(function(c){b=Math.max(0,a.f-1);return _.y(c,a.Md(b),0)})};
5
- _.r.Md=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&&QA(c,a))||!b&&c.f===a)return e["return"]();c.f=a;return(d=c.Wb())&&!1===d.skippable?e["return"]():d?_.y(e,c.l(d),3):e.C(0)}if(4!=e.a)return _.y(e,c.m.open(d.configuration),4);c.trigger(new _.Q(_.Bf,{item:d}));_.A(e)})};_.r.append=function(a){this.a.push(a);PA(this)};_.r.Xi=function(a,b){if(0<=b&&b<=this.a.length){var c=this.Wb();this.a.splice(b,0,a);c&&(this.f=this.a.indexOf(c));PA(this)}};
6
- _.r.remove=function(a){if(0<this.a.length&&QA(this,a)){if(this.f===a)throw Error("Can't remove the current item");this.a.splice(a,1);PA(this)}};_.r.clear=function(){this.stop();this.f=0;this.a=[];this.h=!1;PA(this)};_.K("clpp.Playlist",OA);OA.prototype.clear=OA.prototype.clear;OA.prototype.remove=OA.prototype.remove;OA.prototype.insert=OA.prototype.Xi;OA.prototype.append=OA.prototype.append;OA.prototype.goTo=OA.prototype.Md;OA.prototype.previous=OA.prototype.Ue;OA.prototype.next=OA.prototype.next;
7
- OA.prototype.onEnded=OA.prototype.Ja;OA.prototype.stop=OA.prototype.stop;OA.prototype.start=OA.prototype.start;OA.prototype.isStarted=OA.prototype.Sg;OA.prototype.getUpcoming=OA.prototype.Si;OA.prototype.getCurrent=OA.prototype.Wb;OA.prototype.getQueue=OA.prototype.Ae;OA.prototype.getPosition=OA.prototype.getPosition;OA.prototype.off=OA.prototype.off;OA.prototype.one=OA.prototype.one;OA.prototype.on=OA.prototype.on;};
3
+ _.r.Be=function(){return this.a};_.r.Wb=function(){return 0<this.a.length&&QA(this,this.f)?this.a[this.f]:null};_.r.Ti=function(){var a=this.f+1;return 0<this.a.length&&QA(this,a)?this.a[a]:null};_.r.Tg=function(){return this.h};_.r.start=function(){this.h||(this.h=!0,this.m.on(_.pe,this.j),this.Md(this.f,!0))};_.r.stop=function(){this.h=!1;this.m.off(_.pe,this.j)};_.r.Ja=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 _.y(c,a.Md(b),0)})};_.r.Ve=function(){var a=this,b;return _.I(function(c){b=Math.max(0,a.f-1);return _.y(c,a.Md(b),0)})};
5
+ _.r.Md=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&&QA(c,a))||!b&&c.f===a)return e["return"]();c.f=a;return(d=c.Wb())&&!1===d.skippable?e["return"]():d?_.y(e,c.l(d),3):e.C(0)}if(4!=e.a)return _.y(e,c.m.open(d.configuration),4);c.trigger(new _.Q(_.Bf,{item:d}));_.A(e)})};_.r.append=function(a){this.a.push(a);PA(this)};_.r.Yi=function(a,b){if(0<=b&&b<=this.a.length){var c=this.Wb();this.a.splice(b,0,a);c&&(this.f=this.a.indexOf(c));PA(this)}};
6
+ _.r.remove=function(a){if(0<this.a.length&&QA(this,a)){if(this.f===a)throw Error("Can't remove the current item");this.a.splice(a,1);PA(this)}};_.r.clear=function(){this.stop();this.f=0;this.a=[];this.h=!1;PA(this)};_.K("clpp.Playlist",OA);OA.prototype.clear=OA.prototype.clear;OA.prototype.remove=OA.prototype.remove;OA.prototype.insert=OA.prototype.Yi;OA.prototype.append=OA.prototype.append;OA.prototype.goTo=OA.prototype.Md;OA.prototype.previous=OA.prototype.Ve;OA.prototype.next=OA.prototype.next;
7
+ OA.prototype.onEnded=OA.prototype.Ja;OA.prototype.stop=OA.prototype.stop;OA.prototype.start=OA.prototype.start;OA.prototype.isStarted=OA.prototype.Tg;OA.prototype.getUpcoming=OA.prototype.Ti;OA.prototype.getCurrent=OA.prototype.Wb;OA.prototype.getQueue=OA.prototype.Be;OA.prototype.getPosition=OA.prototype.getPosition;OA.prototype.off=OA.prototype.off;OA.prototype.one=OA.prototype.one;OA.prototype.on=OA.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
@@ -6,15 +6,15 @@ g.left,f.a.a.style.top=g.top,f.a.a.style.width=g.width,f.a.a.style.height=g.heig
6
6
  d.a){a.h=b.sessionId;BA(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
7
  closeButtonSupport:"adHandles",nonlinearDuration:e.f.duration},creativeData:{adParameters:e.f.adParameters||"",clickThruUri:"",clickThruUrl:""}};e=EA(a,"SIMID:Player:init",e);e=FA(a,e);return _.y(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();_.A(d)})},EA=function(a,b,c){return{type:b,sessionId:a.h,messageId:a.l++,timestamp:Date.now(),
8
8
  args:c}},HA=function(a,b){a.h?(b.type!==xA&&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+"'")},BA=function(a,b){HA(a,EA(a,"resolve",{messageId:b.messageId,value:void 0}))},FA=function(a,b){return new Promise(function(c,d){new IA(a.j,c,d,b);HA(a,b)})},IA=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))},JA=function(){this.g=new _.M("clpp.simid.Plugin");this.h=this.a=this.m=null;this.l=[];this.j=null;this.w=this.Gl.bind(this);this.f=null;this.o=!1},KA=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=EA(d,"SIMID:Player:resize",
9
+ this.a=null;this.f.set(d.messageId,this);0<=f&&(this.a=setTimeout(function(){e.resolve()},f))},JA=function(){this.g=new _.M("clpp.simid.Plugin");this.h=this.a=this.m=null;this.l=[];this.j=null;this.w=this.Hl.bind(this);this.f=null;this.o=!1},KA=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=EA(d,"SIMID:Player:resize",
10
10
  e);HA(d,e)}})},LA=function(a){this.m=a;this.a=null;this.g=new _.M("clpp.simid.Loader");this.h=!1;this.f=null},AA=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+"%"}},CA=function(a,b){a.g.info("SIMID Session created");a.a=b},MA=function(a){a.g.info("Stopping creative");a.m.getSurface().getMedia().style.transition=".5s";setTimeout(function(){a.m.getSurface().getMedia().style.transition=""},
11
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(_.fg))},NA=function(){};
12
12
  DA.prototype.load=function(a){window.addEventListener(_.Re,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)};DA.prototype.unload=function(){MA(this.f);this.h=this.a.src="";this.l=0;this.a.style.opacity="0";window.removeEventListener(_.Re,this.o);this.a.parentElement&&this.a.parentElement.removeChild(this.a)};
13
13
  IA.prototype.resolve=function(a){null!==this.a&&(clearTimeout(this.a),this.a=null);this.f["delete"](this.h.messageId);this.l(a)};IA.prototype.reject=function(a){null!==this.a&&(clearTimeout(this.a),this.a=null);this.f["delete"](this.h.messageId);this.j(a)};_.w(JA,_.gw);_.r=JA.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 LA(a)};
14
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 DA(this.h,b.simid),b=c.getContainer(),this.j=KA(this,b,c),this.j.observe(b),a.on(_.Bg,this.w)):this.g.warn(wA)}};
15
- _.r.Gl=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&&(GA(this.a),this.o=!0,this.g.info(yA)),c&&(c=this.a,HA(c,EA(c,xA,{currentTime:a-b}))))):((a=this.m.getSurface())||this.g.warn(wA),a=a.getContainer(),this.f=b,this.o=!1,this.g.info("Loading session"),this.h.f=
15
+ _.r.Hl=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&&(GA(this.a),this.o=!0,this.g.info(yA)),c&&(c=this.a,HA(c,EA(c,xA,{currentTime:a-b}))))):((a=this.m.getSurface())||this.g.warn(wA),a=a.getContainer(),this.f=b,this.o=!1,this.g.info("Loading session"),this.h.f=
16
16
  b,this.a.load(a)):this.f&&(this.a.unload(),this.f=null,this.o=!1)};_.r.onPlayerWillRelease=function(a){_.gw.prototype.onPlayerWillRelease.call(this,a);this.m.getSurface()&&(this.j&&(this.j.disconnect(),this.j=null),a.off(_.Bg,this.w),this.f&&(this.a.unload(),this.f=this.h.f=null))};_.r=LA.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.Qi=function(){return this.a};_.r.url=function(){return this.f?this.f.url:""};NA.prototype.create=function(){return new JA};_.fp(new NA);};
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.Ri=function(){return this.a};_.r.url=function(){return this.f?this.f.url:""};NA.prototype.create=function(){return new JA};_.fp(new NA);};
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,48 +1,48 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
2
  var f=function(window){var ZQ="Full MP4 box must have flags defined",$Q="clpp.smooth.SmoothMP4Processor",aR="codecPrivateData",bR=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)},cR=function(a,b){try{a.f.setUint8(a.a,b),a.a+=1}catch(c){_.hq()}},dR=function(a,b){cR(a,b>>16&255);cR(a,b>>8&255);cR(a,b&255)},eR=function(a,b){try{a.f.setUint16(a.a,b,a.h),a.a+=2}catch(c){_.hq()}},fR=function(a,b){try{a.f.setInt32(a.a,b,a.h),a.a+=4}catch(c){_.hq()}},gR=function(a,b){try{a.f.setInt16(a.a,
3
3
  b,a.h),a.a+=2}catch(c){_.hq()}},hR=function(a,b){for(var c=0;c<a.a.length;++c)if(a.a[c].endTime>b)return a.a.splice(0,c);c=a.a;a.a=[];return c},iR=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},jR=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){jR.call(this,
4
- a);this.version=b;this.flags=c},kR=function(a,b,c){jR.call(this,a);this.f=b;this.offset=c},lR=function(a,b,c,d,e){Z.call(this,a,b,c);this.f=d;this.offset=e},mR=function(a,b,c){jR.call(this,"ftyp");this.h=a;this.ij=b;this.f=c},nR=function(){jR.call(this,_.We)},oR=function(){jR.call(this,_.Dg)},pR=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]},qR=function(){jR.call(this,
4
+ a);this.version=b;this.flags=c},kR=function(a,b,c){jR.call(this,a);this.f=b;this.offset=c},lR=function(a,b,c,d,e){Z.call(this,a,b,c);this.f=d;this.offset=e},mR=function(a,b,c){jR.call(this,"ftyp");this.h=a;this.jj=b;this.f=c},nR=function(){jR.call(this,_.We)},oR=function(){jR.call(this,_.Dg)},pR=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]},qR=function(){jR.call(this,
5
5
  "mvex")},rR=function(a){Z.call(this,"trex",0,0);this.f=a},sR=function(a,b,c,d,e){Z.call(this,"tkhd",1,7);this.h=a;this.duration=b;this.timescale=c;this.width=d;this.height=e;this.volume=1;this.f=[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0]},tR=function(a,b){Z.call(this,"mdhd",1,0);this.timescale=a;this.duration=b;this.language=21956},uR=function(a){Z.call(this,"hdlr",0,0);this.f=a},vR=function(){Z.call(this,"vmhd",0,1);this.f=new Uint8Array([0,0,0,0,0,0])},wR=function(a){jR.call(this,
6
6
  a);this.w=!0},xR=function(a){wR.call(this,a);this.height=this.width=0;this.depth=24},yR=function(a,b,c,d){wR.call(this,a);this.channelCount=b;this.sampleSize=c;this.sampleRate=d},zR=function(a,b){xR.call(this,"avc1");this.width=a;this.height=b},AR=function(a,b){zR.call(this,a,b);this.type="encv"},BR=function(a,b,c){yR.call(this,"mp4a",a,b,c)},CR=function(a,b,c){BR.call(this,a,b,c);this.type="enca"},DR=function(a,b){jR.call(this,"avcC");this.sb=a;this.Kc=b;this.version=1;this.f=this.sb[0][1];this.h=
7
7
  this.sb[0][2];this.level=this.sb[0][3]},ER=function(a){Z.call(this,"esds",0,0);this.Ac=a},FR=function(a){a=void 0===a?"":a;Z.call(this,"url ",0,1);this.location=a},GR=function(){Z.call(this,"dref",0,0)},HR=function(){jR.call(this,_.mg)},IR=function(){Z.call(this,_.og,0,0)},JR=function(){Z.call(this,"stts",0,0)},KR=function(){Z.call(this,"stsc",0,0)},LR=function(){Z.call(this,"stco",0,0)},MR=function(){Z.call(this,"stsz",0,0)},NR=function(){Z.call(this,"smhd",0,0)},OR=function(){jR.call(this,"dinf")},
8
8
  PR=function(){jR.call(this,_.Ve)},QR=function(){jR.call(this,_.Qe)},RR=function(a,b){Z.call(this,"tfdt",a,0);this.baseMediaDecodeTime=b},SR=function(){Z.call(this,"mfhd",0,0);this.f=0},TR=function(a,b){Z.call(this,"trun",a,b);this.l=this.j=this.f=0;this.o=[];this.sampleSize=[];this.A=[];this.h=[]},UR=function(a,b){Z.call(this,"tfhd",a,b);this.f=255;this.l=this.o=this.j=this.A=this.h=0},VR=function(){jR.call(this,"traf")},WR=function(){jR.call(this,"moof")},YR=function(){jR.call(this,_.Pe);this.f=
9
9
  new Uint8Array(0)},ZR=function(){Z.call(this,"tenc",0,0);this.f=1;this.h=8;this.l="";this.j=[]},$R=function(a,b){Z.call(this,"schm",0,0);this.f=a;this.h=b;this.tc=""},aS=function(a){jR.call(this,"frma");this.f=a},bS=function(){Z.call(this,"saio",0,0);this.offset=[0]},cS=function(a,b,c){Z.call(this,"saiz",0,0);this.f=a;this.j=b;this.h=c},dS=function(a,b){Z.call(this,"senc",a,b);this.h=0;this.j=8;this.f=[]},eS=function(a){var b=a.split("/");return b[b.length-1].toLowerCase().match("manifest(\\(.+\\))?")?
10
- a:a+"/Manifest"},fS=function(a,b,c,d){c=b.Ei[c];b=b.xp;a=a.replace("Manifest","");b=b.replace("{bitrate}",String(d.bitrate)).replace("{Bitrate}",String(d.bitrate)).replace("{start time}",String(c.t)).replace("{start_time}",String(c.t));return _.DC([a],[b])[0]},gS=function(a,b){if(a.type!==b.type)return!1;var c=[];a.type===_.Tg?c=["maxWidth","maxHeight","bitrate",aR,"fourCC"]:a.type===_.Sc&&(c=["bitrate",aR,"channels","bitsPerSample","samplingRate","fourCC"]);return _.N.ua(a,b,c,["id","segmentIndex"])},
11
- hS=function(a,b,c){var d=c.Bf.split("00000001");a={id:1,type:c.type,duration:a/b,timescale:b,sb:null,Kc:null,width:NaN,height:NaN,Ac:null,We:NaN,sampleSize:NaN,channelCount:NaN};switch(c.type){case _.Tg:a.sb=[_.Qm(d[1])];a.Kc=[_.Qm(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.Sc:a.Ac=_.Qm(c.Bf),a.sampleSize=c.Ak||16,a.We=c.We,a.channelCount=c.Zh}return a},iS=function(a,b){return a.filter(function(c){return c.type===b})},jS=function(a,b){var c=a.exec(b);return null==c||""===c[0]?null:
10
+ a:a+"/Manifest"},fS=function(a,b,c,d){c=b.Fi[c];b=b.yp;a=a.replace("Manifest","");b=b.replace("{bitrate}",String(d.bitrate)).replace("{Bitrate}",String(d.bitrate)).replace("{start time}",String(c.t)).replace("{start_time}",String(c.t));return _.DC([a],[b])[0]},gS=function(a,b){if(a.type!==b.type)return!1;var c=[];a.type===_.Tg?c=["maxWidth","maxHeight","bitrate",aR,"fourCC"]:a.type===_.Sc&&(c=["bitrate",aR,"channels","bitsPerSample","samplingRate","fourCC"]);return _.N.ua(a,b,c,["id","segmentIndex"])},
11
+ hS=function(a,b,c){var d=c.Cf.split("00000001");a={id:1,type:c.type,duration:a/b,timescale:b,sb:null,Kc:null,width:NaN,height:NaN,Ac:null,Xe:NaN,sampleSize:NaN,channelCount:NaN};switch(c.type){case _.Tg:a.sb=[_.Qm(d[1])];a.Kc=[_.Qm(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.Sc:a.Ac=_.Qm(c.Cf),a.sampleSize=c.Bk||16,a.Xe=c.Xe,a.channelCount=c.$h}return a},iS=function(a,b){return a.filter(function(c){return c.type===b})},jS=function(a,b){var c=a.exec(b);return null==c||""===c[0]?null:
12
12
  (Number(c[4])||0)/1E3+(Number(c[3])||0)+60*(Number(c[2])||0)+3600*(Number(c[1])||0)},qS=function(a,b,c){var d=null;if(kS.test(a)){a=kS.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 lS.test(a)?d=jS(lS,a):mS.test(a)?d=jS(mS,a):nS.test(a)?(a=nS.exec(a),d=Number(a[1])/c.frameRate):oS.test(a)?(a=oS.exec(a),d=Number(a[1])/c.a):pS.test(a)&&(d=jS(pS,a));d+=b;b=Math.floor(d/3600);c=Math.floor((d-3600*b)/60);a=Math.floor(d-
13
13
  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*d);return b+":"+c+":"+a+"."+d},rS=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))},tS=function(a){this.a=a;this.f=sS(this)},sS=function(a){for(var b=0,c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.gq(b)},uS=function(a,b,c){a:{var d=
14
- _.v([_.Md,_.Kd]);for(var e=d.next();!e.done;e=d.next())if((e=c.Kf(e.value))&&e.keyId){d=e.keyId;break a}_.Vh($Q,"Could not get default Key ID for DRM init data!");d=null}c=new jR("xxxx");a.type===_.Tg?c=new AR(a.width,a.height):c=new CR(a.channelCount,a.sampleSize,a.We);a=new ZR;a.f=1;a.h=8;a.l=d||"00000000000000000000000000000000";a=(new jR("schi")).append([a]);b=(new jR(_.gg)).append([new aS(b),new $R(_.md,65536),a]);c.append([b]);return c},vS=function(a,b){var c=b.Mf(),d=new pR(a.timescale,a.duration,
15
- a.id),e=(new qR).append([new rR(a.id)]),f=new sR(a.id,a.duration,a.timescale,a.width,a.height),g=new tR(a.timescale,a.duration),k=new uR(a.type),l=null,m=new GR;m.entries=[new FR];var n=new IR;switch(a.type){case _.Tg:var p=new DR(a.sb,a.Kc);c?(l=uS(a,"avc1",b),l.append([p]),n.entries=[l]):(l=(new zR(a.width,a.height)).append([p]),n.entries=[l]);l=new vR;break;case _.Sc:p=new ER(a.Ac),c?(l=uS(a,"mp4a",b),l.append([p]),n.entries=[l]):(l=(new BR(a.channelCount,a.sampleSize,a.We)).append([p]),n.entries=
16
- [l]),l=new NR}n=(new HR).append([n,new JR,new KR,new MR,new LR]);m=(new OR).append([m]);m=(new PR).append([l,m,n]);g=(new QR).append([g,k,m]);f=(new oR).append([f,g]);d=(new nR).append([d,f,e]);e=new mR("dash",0,["iso6","mp41","avc1"]);c&&(c=b.Kf(_.Kd),f=b.Kf(_.Md),c&&d.append([new kR("pssh",c.initData,8)]),f&&d.append([new kR("pssh",f.initData,8)]),c||f||_.Vh($Q,"Could not get PSSH init data!"));c=new tS([e,d]);return _.Vi(c.write())},xS=function(a,b){var c,d,e,f,g,k;(new _.tq).N("moof",_.uq).da("mfhd",
14
+ _.v([_.Md,_.Kd]);for(var e=d.next();!e.done;e=d.next())if((e=c.Lf(e.value))&&e.keyId){d=e.keyId;break a}_.Vh($Q,"Could not get default Key ID for DRM init data!");d=null}c=new jR("xxxx");a.type===_.Tg?c=new AR(a.width,a.height):c=new CR(a.channelCount,a.sampleSize,a.Xe);a=new ZR;a.f=1;a.h=8;a.l=d||"00000000000000000000000000000000";a=(new jR("schi")).append([a]);b=(new jR(_.gg)).append([new aS(b),new $R(_.md,65536),a]);c.append([b]);return c},vS=function(a,b){var c=b.Nf(),d=new pR(a.timescale,a.duration,
15
+ a.id),e=(new qR).append([new rR(a.id)]),f=new sR(a.id,a.duration,a.timescale,a.width,a.height),g=new tR(a.timescale,a.duration),k=new uR(a.type),l=null,m=new GR;m.entries=[new FR];var n=new IR;switch(a.type){case _.Tg:var p=new DR(a.sb,a.Kc);c?(l=uS(a,"avc1",b),l.append([p]),n.entries=[l]):(l=(new zR(a.width,a.height)).append([p]),n.entries=[l]);l=new vR;break;case _.Sc:p=new ER(a.Ac),c?(l=uS(a,"mp4a",b),l.append([p]),n.entries=[l]):(l=(new BR(a.channelCount,a.sampleSize,a.Xe)).append([p]),n.entries=
16
+ [l]),l=new NR}n=(new HR).append([n,new JR,new KR,new MR,new LR]);m=(new OR).append([m]);m=(new PR).append([l,m,n]);g=(new QR).append([g,k,m]);f=(new oR).append([f,g]);d=(new nR).append([d,f,e]);e=new mR("dash",0,["iso6","mp41","avc1"]);c&&(c=b.Lf(_.Kd),f=b.Lf(_.Md),c&&d.append([new kR("pssh",c.initData,8)]),f&&d.append([new kR("pssh",f.initData,8)]),c||f||_.Vh($Q,"Could not get PSSH init data!"));c=new tS([e,d]);return _.Vi(c.write())},xS=function(a,b){var c,d,e,f,g,k;(new _.tq).N("moof",_.uq).da("mfhd",
17
17
  function(m){var n=new SR;n.f=_.oq(m.reader);c=n}).N("traf",_.uq).da("tfhd",function(m){var n=m.reader.cb();if(null===m.flags)throw new _.O(_.P,3,3019,ZQ);var p=new UR(m.version||0,m.flags||0);p.f=_.oq(m.reader);0<n-m.reader.getPosition()&&m.flags&1&&(p.h=_.qq(m.reader));0<n-m.reader.getPosition()&&m.flags&2&&(p.A=_.oq(m.reader));0<n-m.reader.getPosition()&&m.flags&8&&(p.j=_.oq(m.reader));0<n-m.reader.getPosition()&&m.flags&16&&(p.o=_.oq(m.reader));0<n-m.reader.getPosition()&&m.flags&32&&(p.l=_.oq(m.reader));
18
18
  d=p}).da("trun",function(m){var n=m.reader.cb();if(null===m.flags)throw new _.O(_.P,3,3019,ZQ);var p=new TR(m.version||0,m.flags||0);p.f=_.oq(m.reader);0<n-m.reader.getPosition()&&m.flags&1&&(p.j=_.pq(m.reader));0<n-m.reader.getPosition()&&m.flags&4&&(p.l=_.oq(m.reader));if(0<n-m.reader.getPosition())for(n=0;n<p.f;n++)m.flags&256&&p.o.push(_.oq(m.reader)),m.flags&512&&p.sampleSize.push(_.oq(m.reader)),m.flags&1024&&p.A.push(_.oq(m.reader)),m.flags&2048&&(0===m.version?p.h.push(_.oq(m.reader)):p.h.push(_.pq(m.reader)));
19
- e=p}).da("sdtp",function(m){var n=_.sq(m.reader,m.reader.cb());f=new lR("sdtp",m.version||0,m.flags||0,n,0)}).N("uuid",function(m){var n=_.sq(m.reader,16);if(_.Sm(n,wS)){n=_.oq(m.reader);m.version=n>>>24;m.flags=n&16777215;n=new dS(m.version,m.flags);n.h=_.oq(m.reader);m.flags&1&&(n.j=_.mq(m.reader));for(var p=0;p<n.h;p++){var q={Wi:_.sq(m.reader,8),Xd:0,vh:[]};if(m.flags&2){q.Xd=_.nq(m.reader);for(var t=0;t<q.Xd;t++){var u={Vh:0,Wh:0};u.Vh=_.nq(m.reader);u.Wh=_.oq(m.reader);q.vh.push(u)}}n.f.push(q)}g=
20
- n}}).N(_.Pe,function(m){var n=new YR;0<m.reader.cb()?n.f=_.sq(m.reader,m.reader.cb()):(_.Vh($Q,"mdat box is empty!"),n.f=new Uint8Array(0));k=n}).parse(a,!1);if(!k)return null;var l=(new VR).append([d,e]);f&&l.append([f]);b.Mf()&&g&&l.append([g]);l=(new WR).append([c,l]);return new tS([l,k])},yS=function(a,b,c,d){var e=d.Mf(),f=parseInt(c*b,10);b=a.data||new ArrayBuffer(0);var g=xS(b,d);if(null===g)return a.request.contentType===_.Gn?a.data:g;d=g.get(_.Pe);if(a.request.contentType===_.Gn){e=d.f.buffer;
21
- if(c){e=_.R.we(e);if((e=(new DOMParser).parseFromString(e,_.vg))&&"tt"===e.documentElement.tagName.toLowerCase())var k=e.documentElement;if(k&&(d=new rS(k.getAttribute("ttp:frameRate"),k.getAttribute("ttp:subFrameRate"),k.getAttribute("ttp:frameRateMultiplier"),k.getAttribute("ttp:tickRate")),k=k.getElementsByTagName("body")[0]))for(k=k.getElementsByTagName("p"),a=0,b=k.length;a<b;a++){f=k[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=
19
+ e=p}).da("sdtp",function(m){var n=_.sq(m.reader,m.reader.cb());f=new lR("sdtp",m.version||0,m.flags||0,n,0)}).N("uuid",function(m){var n=_.sq(m.reader,16);if(_.Sm(n,wS)){n=_.oq(m.reader);m.version=n>>>24;m.flags=n&16777215;n=new dS(m.version,m.flags);n.h=_.oq(m.reader);m.flags&1&&(n.j=_.mq(m.reader));for(var p=0;p<n.h;p++){var q={Xi:_.sq(m.reader,8),Xd:0,wh:[]};if(m.flags&2){q.Xd=_.nq(m.reader);for(var t=0;t<q.Xd;t++){var u={Wh:0,Xh:0};u.Wh=_.nq(m.reader);u.Xh=_.oq(m.reader);q.wh.push(u)}}n.f.push(q)}g=
20
+ n}}).N(_.Pe,function(m){var n=new YR;0<m.reader.cb()?n.f=_.sq(m.reader,m.reader.cb()):(_.Vh($Q,"mdat box is empty!"),n.f=new Uint8Array(0));k=n}).parse(a,!1);if(!k)return null;var l=(new VR).append([d,e]);f&&l.append([f]);b.Nf()&&g&&l.append([g]);l=(new WR).append([c,l]);return new tS([l,k])},yS=function(a,b,c,d){var e=d.Nf(),f=parseInt(c*b,10);b=a.data||new ArrayBuffer(0);var g=xS(b,d);if(null===g)return a.request.contentType===_.Gn?a.data:g;d=g.get(_.Pe);if(a.request.contentType===_.Gn){e=d.f.buffer;
21
+ if(c){e=_.R.xe(e);if((e=(new DOMParser).parseFromString(e,_.vg))&&"tt"===e.documentElement.tagName.toLowerCase())var k=e.documentElement;if(k&&(d=new rS(k.getAttribute("ttp:frameRate"),k.getAttribute("ttp:subFrameRate"),k.getAttribute("ttp:frameRateMultiplier"),k.getAttribute("ttp:tickRate")),k=k.getElementsByTagName("body")[0]))for(k=k.getElementsByTagName("p"),a=0,b=k.length;a<b;a++){f=k[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=
22
22
  p.getAttribute(q);else{q=p.attributes;for(var z=q.length;u<z;u++){var B=q[u].name;if(B=B.match(t)){p=p.getAttribute(B[0]);break b}}p=null}}f.setAttribute(l[m],qS(p||"",g,d))}}e=(new XMLSerializer).serializeToString(e);c=_.R.ub(e).buffer}else c=e;return c}k=new WR;a=g.get("mfhd");b=new VR;l=g.get("tfhd");m=new RR(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+
23
23
  6*c.f[m].Xd);else g=8;b.append([c,new bS,new cS(g,l,c.h)])}k.append([a,b]);f.flags|=1;f.j=k.a()+8;d=new tS([k,d]);k=d.write();e&&(e=d.get("saio"),d=d.f,e.offset[0]=c.start+16,d.seek(e.start),e.write(d),k=d.buffer);return k},zS=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,periodId:null}},AS=function(a,b,c){a=_.Zr(a);c&&a.version!==c&&(a=_.tC(a,c));
24
- return{initData:_.rC(a),initDataType:_.md,keyId:b,periodId:null}},CS=function(){this.A=this.j=this.f=this.F=null;this.h=1;this.P=0;this.o="";this.D=this.a=null;this.g=new _.M("clpp.smooth.SmoothParser");this.K=!1;this.l=this.B=null;this.M=BS;this.I=0;this.G=this.J=Infinity;this.w=[];this.L=this.Qo.bind(this);this.H=new Map},DS=function(a,b){var c,d,e;return _.I(function(f){if(1==f.a)return c=_.dl(b),c.timeout=a.f.attemptParameters.timeout,c.maxAttempts=Math.max(a.f.attemptParameters.maxAttempts,b.length),
25
- c.baseDelay=a.f.attemptParameters.baseDelay,c.backoffFactor=a.f.attemptParameters.backoffFactor,c.fuzzFactor=a.f.attemptParameters.fuzzFactor,c.type=1,d=a.F.networkingEngine.fetch(c),_.y(f,d.U,2);e=f.f;a.o=e.uri;return f["return"](e)})},KS=function(a,b){var c=_.Ur,d=null;try{var e=_.R.we(b);d=c.Te(e,_.Jb)}catch(lY){}if(!d)throw a.g.error("Unable to parse manifest"),new _.O(_.P,4,4033,a.o);var f=+ES(a,d,"MajorVersion"),g=+ES(a,d,"MinorVersion"),k=+d.getAttribute("TimeScale")||1E7,l=+ES(a,d,"Duration"),
26
- m="TRUE"===d.getAttribute("IsLive"),n=+d.getAttribute("LookAheadCount"),p=+d.getAttribute("DVRWindowLength")||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 _.O(_.P,4,4036,a.o);m?(FS(a,GS),a.B=typeof a.f.liveRefreshPeriod===_.h?1E3*a.f.liveRefreshPeriod:Math.min(1E3*a.I,1E4),l=Infinity):FS(a,BS);a.a={startTime:0,delay:0,duration:l/k,Ig:p/k,Ne:0};if(q){var t=a.f.playreadyVersion,u=_.Ur,z=[],B=u.aa(q,
24
+ return{initData:_.rC(a),initDataType:_.md,keyId:b,periodId:null}},CS=function(){this.A=this.j=this.f=this.F=null;this.h=1;this.P=0;this.o="";this.D=this.a=null;this.g=new _.M("clpp.smooth.SmoothParser");this.K=!1;this.l=this.B=null;this.M=BS;this.I=0;this.G=this.J=Infinity;this.w=[];this.L=this.Ro.bind(this);this.H=new Map},DS=function(a,b){var c,d,e;return _.I(function(f){if(1==f.a)return c=_.dl(b),c.timeout=a.f.attemptParameters.timeout,c.maxAttempts=Math.max(a.f.attemptParameters.maxAttempts,b.length),
25
+ c.baseDelay=a.f.attemptParameters.baseDelay,c.backoffFactor=a.f.attemptParameters.backoffFactor,c.fuzzFactor=a.f.attemptParameters.fuzzFactor,c.type=1,d=a.F.networkingEngine.fetch(c),_.y(f,d.U,2);e=f.f;a.o=e.uri;return f["return"](e)})},KS=function(a,b){var c=_.Ur,d=null;try{var e=_.R.xe(b);d=c.Ue(e,_.Jb)}catch(lY){}if(!d)throw a.g.error("Unable to parse manifest"),new _.O(_.P,4,4033,a.o);var f=+ES(a,d,"MajorVersion"),g=+ES(a,d,"MinorVersion"),k=+d.getAttribute("TimeScale")||1E7,l=+ES(a,d,"Duration"),
26
+ m="TRUE"===d.getAttribute("IsLive"),n=+d.getAttribute("LookAheadCount"),p=+d.getAttribute("DVRWindowLength")||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 _.O(_.P,4,4036,a.o);m?(FS(a,GS),a.B=typeof a.f.liveRefreshPeriod===_.h?1E3*a.f.liveRefreshPeriod:Math.min(1E3*a.I,1E4),l=Infinity):FS(a,BS);a.a={startTime:0,delay:0,duration:l/k,Jg:p/k,Oe:0};if(q){var t=a.f.playreadyVersion,u=_.Ur,z=[],B=u.aa(q,
27
27
  "ProtectionHeader")[0],D=_.Pm(u.va(B)||""),C=_.Zr(D).a;z.push(zS(_.Md,{initData:_.rC(_.Rr(C)),initDataType:_.md,keyId:C,periodId:null},[C]));z.push(zS(_.Kd,AS(D,C,t),[C]));a.w=z}var E=[],x=_.Ur.aa(d,"StreamIndex");if(!x.length)throw a.g.error("No streams found!"),new _.O(_.P,4,4034,a.o);for(var J=0;J<x.length;J++){for(var L,U=a,V=x[J],ta=ES(U,V,"Type"),za=+V.getAttribute("Chunks"),va=V.getAttribute("Subtype")||"",qa=V.getAttribute("Language")||_.Gg,Fa=_.vo(qa),sc=V.getAttribute("Name")||"",ab=+V.getAttribute(_.eb),
28
28
  Uc=+V.getAttribute(_.db),Pd=ES(U,V,"Url"),Ff=+V.getAttribute("TimeScale")||null,uc=[],ei=_.Ur.aa(V,_.yb),Hf=0;Hf<ei.length;Hf++){var td=void 0,Nb=void 0,fc=void 0,Rd=U,wc=ei[Hf],Ig=ta,JW=+wc.getAttribute("Index"),KW=+ES(Rd,wc,"Bitrate"),HJ=NaN,IJ=NaN,Jo=NaN,Mv=NaN,JJ=NaN,KJ=NaN,LJ=NaN,MJ=wc.getAttribute("FourCC")||"";switch(Ig){case _.Tg:HJ=+ES(Rd,wc,_.db);IJ=+ES(Rd,wc,_.eb);break;case _.Sc:Mv=+wc.getAttribute("Channels")||2,Jo=+ES(Rd,wc,"SamplingRate"),KJ=+ES(Rd,wc,"AudioTag"),JJ=+ES(Rd,wc,"BitsPerSample"),
29
29
  LJ=+ES(Rd,wc,"PacketSize")}var Nv=String(wc.getAttribute("CodecPrivateData"));if(Ig===_.Sc&&!Nv){var NJ=Mv,OJ={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},Ko=OJ[Jo];if("AACH"===MJ){Nb=new Uint8Array(4);var PJ=OJ[2*Jo];Nb[0]=40|Ko>>1;Nb[1]=Ko<<7|NJ<<3|PJ>>1;Nb[2]=PJ<<7|8;Nb[3]=0;td=new Uint16Array(2);td[0]=(Nb[0]<<8)+Nb[1];td[1]=(Nb[2]<<8)+Nb[3];fc=td[0].toString(16)+td[1].toString(16)}else Nb=new Uint8Array(2),Nb[0]=16|Ko>>1,Nb[1]=Ko<<7|NJ<<3,
30
- td=new Uint16Array(1),td[0]=(Nb[0]<<8)+Nb[1],fc=td[0].toString(16);Nv=fc.toUpperCase()}var LW={id:Rd.P++,type:Ig,index:JW,bitrate:KW,Bf:Nv,maxHeight:HJ,maxWidth:IJ,We:Jo,Zh:Mv,Np:KJ,Ak:JJ,eq:LJ,rm:MJ,segmentIndex:null};uc.push(LW)}L=uc;for(var Te=[],QJ=_.Ur.aa(V,"c"),wk=0;wk<QJ.length;wk++){var Ov=QJ[wk],le=parseInt(Ov.getAttribute("t"),10),ii=parseInt(Ov.getAttribute("d"),10),Pv=parseInt(Ov.getAttribute("r"),10),xk=0;if(isNaN(le)&&isNaN(ii))throw U.g.error("Either one or both FragmentDuration and FragmentTime field MUST be present in StreamFragmentElement"),
31
- new _.O(_.P,4,4037,U.o);0===wk&&isNaN(le)&&(xk=le=0);if(0<wk){var Kg=Te[Te.length-1];xk=Kg.n+1;Kg.d||(Kg.d=le-Kg.t);le||(le=Kg.t+Kg.d);ii||(ii=le-Kg.t)}Te.push({n:xk,d:ii,t:le});if(Pv){Pv--;for(var RJ=0;RJ<Pv;RJ++){var Lo=Te[Te.length-1];xk=Lo.n+1;le=Lo.t+Lo.d;ii=Lo.d;Te.push({n:xk,d:ii,t:le})}}}U.me()||Te.length===za||U.g.warn("Number of fragments ("+za+") differs from number of chunks ("+Te.length+").");E.push({type:ta,Sp:za,fp:va,language:Fa,Qd:qa,name:sc,maxWidth:ab,maxHeight:Uc,xp:Pd,tracks:L,
32
- Ei:Te,timescale:Ff})}var Jf={bq:f,ij:g,timescale:k,duration:l,isLive:m,aq:n,Ig:p,Og:!1,streams:E};if(a.j&&a.A)return HS(a,Jf),Promise.resolve();a.H.clear();var Qv=Jf.timescale,Mo=Jf.duration,NW=iS(Jf.streams,_.Sc),OW=iS(Jf.streams,_.Tg),PW=iS(Jf.streams,_.Gn),SJ=[],No=IS(a,Mo,Qv,NW),Oo=IS(a,Mo,Qv,OW),QW=IS(a,Mo,Qv,PW);No.length||(No=[null]);Oo.length||(Oo=[null]);for(var Sv=0;Sv<Oo.length;Sv++)for(var Tv=0;Tv<No.length;Tv++)SJ.push(JS(a,Oo[Sv],No[Tv]));var TJ={id:"ID",configurationId:void 0,startTime:0,
33
- endTime:Mo,variants:SJ,textStreams:QW,thumbStreams:[]};var SW=Jf.streams,Uv=a.a.startTime,UJ=a.a.delay,Vv=a.J,VJ=Math.min(a.a.duration||Infinity,Vv),Wv=a.me(),TW=a.a.Ig,UW=a.a.Ne,WJ=a.I,XJ=isFinite(a.G)?a.G:0;if(Wv)VJ=Infinity,Uv=Date.now()/1E3-UW,a.a.startTime=Uv,UJ=3*WJ;else for(var VW=isFinite(Vv)?Vv:a.a.duration,YJ=_.v(SW),Xv=YJ.next();!Xv.done;Xv=YJ.next())for(var ZJ=_.v(Xv.value.tracks),Yv=ZJ.next();!Yv.done;Yv=ZJ.next()){var $J=Yv.value;$J.segmentIndex.offset(-XJ);_.hD($J.segmentIndex,VW)}var aK=
30
+ td=new Uint16Array(1),td[0]=(Nb[0]<<8)+Nb[1],fc=td[0].toString(16);Nv=fc.toUpperCase()}var LW={id:Rd.P++,type:Ig,index:JW,bitrate:KW,Cf:Nv,maxHeight:HJ,maxWidth:IJ,Xe:Jo,$h:Mv,Op:KJ,Bk:JJ,fq:LJ,sm:MJ,segmentIndex:null};uc.push(LW)}L=uc;for(var Te=[],QJ=_.Ur.aa(V,"c"),wk=0;wk<QJ.length;wk++){var Ov=QJ[wk],le=parseInt(Ov.getAttribute("t"),10),ii=parseInt(Ov.getAttribute("d"),10),Pv=parseInt(Ov.getAttribute("r"),10),xk=0;if(isNaN(le)&&isNaN(ii))throw U.g.error("Either one or both FragmentDuration and FragmentTime field MUST be present in StreamFragmentElement"),
31
+ new _.O(_.P,4,4037,U.o);0===wk&&isNaN(le)&&(xk=le=0);if(0<wk){var Kg=Te[Te.length-1];xk=Kg.n+1;Kg.d||(Kg.d=le-Kg.t);le||(le=Kg.t+Kg.d);ii||(ii=le-Kg.t)}Te.push({n:xk,d:ii,t:le});if(Pv){Pv--;for(var RJ=0;RJ<Pv;RJ++){var Lo=Te[Te.length-1];xk=Lo.n+1;le=Lo.t+Lo.d;ii=Lo.d;Te.push({n:xk,d:ii,t:le})}}}U.ne()||Te.length===za||U.g.warn("Number of fragments ("+za+") differs from number of chunks ("+Te.length+").");E.push({type:ta,Tp:za,gp:va,language:Fa,Qd:qa,name:sc,maxWidth:ab,maxHeight:Uc,yp:Pd,tracks:L,
32
+ Fi:Te,timescale:Ff})}var Jf={cq:f,jj:g,timescale:k,duration:l,isLive:m,bq:n,Jg:p,Pg:!1,streams:E};if(a.j&&a.A)return HS(a,Jf),Promise.resolve();a.H.clear();var Qv=Jf.timescale,Mo=Jf.duration,NW=iS(Jf.streams,_.Sc),OW=iS(Jf.streams,_.Tg),PW=iS(Jf.streams,_.Gn),SJ=[],No=IS(a,Mo,Qv,NW),Oo=IS(a,Mo,Qv,OW),QW=IS(a,Mo,Qv,PW);No.length||(No=[null]);Oo.length||(Oo=[null]);for(var Sv=0;Sv<Oo.length;Sv++)for(var Tv=0;Tv<No.length;Tv++)SJ.push(JS(a,Oo[Sv],No[Tv]));var TJ={id:"ID",configurationId:void 0,startTime:0,
33
+ endTime:Mo,variants:SJ,textStreams:QW,thumbStreams:[]};var SW=Jf.streams,Uv=a.a.startTime,UJ=a.a.delay,Vv=a.J,VJ=Math.min(a.a.duration||Infinity,Vv),Wv=a.ne(),TW=a.a.Jg,UW=a.a.Oe,WJ=a.I,XJ=isFinite(a.G)?a.G:0;if(Wv)VJ=Infinity,Uv=Date.now()/1E3-UW,a.a.startTime=Uv,UJ=3*WJ;else for(var VW=isFinite(Vv)?Vv:a.a.duration,YJ=_.v(SW),Xv=YJ.next();!Xv.done;Xv=YJ.next())for(var ZJ=_.v(Xv.value.tracks),Yv=ZJ.next();!Yv.done;Yv=ZJ.next()){var $J=Yv.value;$J.segmentIndex.offset(-XJ);_.hD($J.segmentIndex,VW)}var aK=
34
34
  a.f.timeline||{};aK.type=void 0;a.D=new _.uD(aK,Uv,UJ,!Wv,!0);a.D.f=VJ;_.CD(a.D,WJ);a.D.A=TW;Wv||a.D.offset(-XJ);a.F.filterAllPeriods([TJ]);a.j={presentationTimeline:a.D,periods:[TJ],minBufferTime:0,cues:[]};Promise.resolve();a.K||(a.F.networkingEngine.yd(a.L),a.K=!0);a.A=Jf;return Promise.resolve()},HS=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={zc:e.zc},g=f.next())if(e.zc=g.value,g=d.tracks.find(function(l){return function(m){return m.type===
35
- l.zc.type&&m.bitrate===l.zc.bitrate}}(e))){gS(e.zc,g)||a.g.warn("The current stream is updated with a stream that seems to have different base properties!");var k=LS(a,a.A.timescale,d,g);g=e.zc.segmentIndex;g.ta(k);(k=a.a.Ig)&&hR(g,(g.a.length?g.a[g.a.length-1].endTime:0)-k).forEach(function(l){l.Ia().forEach(function(m){a.H["delete"](m)})})}else a.g.warn("Cannot find satisfying update for "+e.zc.type+" track with bitrate "+(e.zc.bitrate+". Skipping update."))},IS=function(a,b,c,d){for(var e=[],f=
36
- {td:0};f.td<d.length;f={td:f.td},f.td++){var g=d[f.td].tracks.map(function(k){return function(l){var m=d[k.td],n=LS(a,c,m,l);n=new _.RD(n);var p=null;m.type!==_.Gn&&(p=MS(a,b,c,m,l));l.segmentIndex=n;var q=_.gK++,t=Promise.resolve.bind(Promise),u=n.Af.bind(n),z=n.get.bind(n),B=n.wg.bind(n),D=n.getDuration.bind(n),C=NS[m.type],E="";switch(m.type){case _.Tg:E=l.Bf;var x=/00000001[0-9]7/.exec(E);E="avc1."+(x&&x[0]?E.substr(E.indexOf(x[0])+10,6):"42c00c");a.g.debug("VIDEO CODECS: ",E);break;case _.Sc:E=
37
- l.Bf,x=2,"AACH"===l.rm?x=5:E&&(x=(parseInt(E.substr(0,2),16)&248)>>3),E="mp4a.40."+x,a.g.debug("AUDIO CODECS: ",E)}x=m.type===_.Gn?OS[m.fp]:void 0;return{id:q,originalId:null,hq:null,createSegmentIndex:t,findSegmentPosition:u,getSegmentReference:z,adjustSegmentDurations:B,getDuration:D,segmentIndex:n,segmentLookupStrategy:_.$B,initSegmentReference:p,mimeType:C,codecs:E,frameRate:void 0,bandwidth:l.bitrate,width:l.maxWidth||void 0,height:l.maxHeight||void 0,kind:x,encrypted:a.Rg(),keyId:null,language:m.language,
38
- originalLanguage:m.Qd,label:m.name,type:m.type,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:l.Zh||null,spatialAudio:!1,closedCaptions:null}}}(f));e=e.concat(g)}return e},LS=function(a,b,c,d){var e=0,f=[],g=c.timescale||b;c.Ei.forEach(function(k,l){var m=k.d/g;if(0===l){var n=k.t/g;a.G=Math.min(a.G,n)}else n=f[l-1].endTime;var p=n+m,q=fS(a.o,c,l,d);a.I=Math.max(a.I,m);f.push(new _.Wp(l,n,p,function(){return[q]},0,null,0,null,!0,g));a.H.set(q,n);e+=m});if(c.type===_.Tg||
39
- c.type===_.Sc)b=f[f.length-1],a.J=Math.min(a.J,e),0===a.a.Ne?a.a.Ne=b.endTime:a.a.Ne=Math.min(a.a.Ne,b.endTime);return f},MS=function(a,b,c,d,e){b=hS(b,d.timescale||c,e);c={isLive:a.me.bind(a),Mf:a.Rg.bind(a),Bm:function(){return 1},Kf:a.Ji.bind(a)};d=new Uint8Array(0);try{d=vS(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,"+_.Om(d);return new _.RC(function(){return[f]},0,null,null,!0)},JS=function(a,b,c){var d=(c?
35
+ l.zc.type&&m.bitrate===l.zc.bitrate}}(e))){gS(e.zc,g)||a.g.warn("The current stream is updated with a stream that seems to have different base properties!");var k=LS(a,a.A.timescale,d,g);g=e.zc.segmentIndex;g.ta(k);(k=a.a.Jg)&&hR(g,(g.a.length?g.a[g.a.length-1].endTime:0)-k).forEach(function(l){l.Ia().forEach(function(m){a.H["delete"](m)})})}else a.g.warn("Cannot find satisfying update for "+e.zc.type+" track with bitrate "+(e.zc.bitrate+". Skipping update."))},IS=function(a,b,c,d){for(var e=[],f=
36
+ {td:0};f.td<d.length;f={td:f.td},f.td++){var g=d[f.td].tracks.map(function(k){return function(l){var m=d[k.td],n=LS(a,c,m,l);n=new _.RD(n);var p=null;m.type!==_.Gn&&(p=MS(a,b,c,m,l));l.segmentIndex=n;var q=_.gK++,t=Promise.resolve.bind(Promise),u=n.Bf.bind(n),z=n.get.bind(n),B=n.xg.bind(n),D=n.getDuration.bind(n),C=NS[m.type],E="";switch(m.type){case _.Tg:E=l.Cf;var x=/00000001[0-9]7/.exec(E);E="avc1."+(x&&x[0]?E.substr(E.indexOf(x[0])+10,6):"42c00c");a.g.debug("VIDEO CODECS: ",E);break;case _.Sc:E=
37
+ l.Cf,x=2,"AACH"===l.sm?x=5:E&&(x=(parseInt(E.substr(0,2),16)&248)>>3),E="mp4a.40."+x,a.g.debug("AUDIO CODECS: ",E)}x=m.type===_.Gn?OS[m.gp]:void 0;return{id:q,originalId:null,iq:null,createSegmentIndex:t,findSegmentPosition:u,getSegmentReference:z,adjustSegmentDurations:B,getDuration:D,segmentIndex:n,segmentLookupStrategy:_.$B,initSegmentReference:p,mimeType:C,codecs:E,frameRate:void 0,bandwidth:l.bitrate,width:l.maxWidth||void 0,height:l.maxHeight||void 0,kind:x,encrypted:a.Sg(),keyId:null,language:m.language,
38
+ originalLanguage:m.Qd,label:m.name,type:m.type,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:l.$h||null,spatialAudio:!1,closedCaptions:null}}}(f));e=e.concat(g)}return e},LS=function(a,b,c,d){var e=0,f=[],g=c.timescale||b;c.Fi.forEach(function(k,l){var m=k.d/g;if(0===l){var n=k.t/g;a.G=Math.min(a.G,n)}else n=f[l-1].endTime;var p=n+m,q=fS(a.o,c,l,d);a.I=Math.max(a.I,m);f.push(new _.Wp(l,n,p,function(){return[q]},0,null,0,null,!0,g));a.H.set(q,n);e+=m});if(c.type===_.Tg||
39
+ c.type===_.Sc)b=f[f.length-1],a.J=Math.min(a.J,e),0===a.a.Oe?a.a.Oe=b.endTime:a.a.Oe=Math.min(a.a.Oe,b.endTime);return f},MS=function(a,b,c,d,e){b=hS(b,d.timescale||c,e);c={isLive:a.ne.bind(a),Nf:a.Sg.bind(a),Cm:function(){return 1},Lf:a.Ki.bind(a)};d=new Uint8Array(0);try{d=vS(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,"+_.Om(d);return new _.RC(function(){return[f]},0,null,null,!0)},JS=function(a,b,c){var d=(c?
40
40
  c.bandwidth:0)+(b?b.bandwidth:0),e=c?c.language:_.Gg;return c||b?{id:a.h++,language:e,primary:!1,audio:c,video:b,bandwidth:d,drmInfos:a.w,allowedByApplication:!0,allowedByKeySystem:!0}:null},ES=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);},PS=function(a,b){null!=a.B&&null!=b&&(a.l=window.setTimeout(a.rc.bind(a),b))},FS=function(a,b){var c=b===BS;a.j&&a.j.presentationTimeline&&_.xD(a.j.presentationTimeline,c);c&&null!=
41
41
  a.l&&(window.clearTimeout(a.l),a.l=null,a.B=null);a.M=b},QS=function(){};jR.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};jR.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
  jR.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
43
  jR.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);_.iq(a,iR(this.type));this.size>b&&bR(a,this.size);"uuid"===this.type&&_.iq(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,jR);Z.prototype.a=function(){return 4+jR.prototype.a.call(this)};
44
44
  Z.prototype.write=function(a){jR.prototype.write.call(this,a);cR(a,this.version);dR(a,this.flags)};_.w(kR,jR);kR.prototype.a=function(){return this.f.byteLength+jR.prototype.a.call(this)-this.offset};kR.prototype.write=function(a){jR.prototype.write.call(this,a);_.iq(a,this.f,this.offset);a.getPosition()};_.w(lR,Z);lR.prototype.a=function(){return this.f.byteLength+Z.prototype.a.call(this)-this.offset};lR.prototype.write=function(a){Z.prototype.write.call(this,a);_.iq(a,this.f,this.offset);a.getPosition()};
45
- _.w(mR,jR);mR.prototype.a=function(){var a=this.h.length;a=a+4+this.f.join("").length;return a+jR.prototype.a.call(this)};mR.prototype.write=function(a){jR.prototype.write.call(this,a);_.iq(a,iR(this.h));_.W(a,this.ij);_.iq(a,iR(this.f.join("")));a.getPosition()};_.w(nR,jR);_.w(oR,jR);_.w(pR,Z);pR.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)};
45
+ _.w(mR,jR);mR.prototype.a=function(){var a=this.h.length;a=a+4+this.f.join("").length;return a+jR.prototype.a.call(this)};mR.prototype.write=function(a){jR.prototype.write.call(this,a);_.iq(a,iR(this.h));_.W(a,this.jj);_.iq(a,iR(this.f.join("")));a.getPosition()};_.w(nR,jR);_.w(oR,jR);_.w(pR,Z);pR.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
  pR.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(bR(a,0),bR(a,0),_.W(a,this.timescale),bR(a,this.duration*this.timescale)):(_.W(a,0),_.W(a,0),_.W(a,this.timescale),_.W(a,this.duration*this.timescale));_.W(a,65536);eR(a,this.volume);eR(a,0);_.W(a,0);_.W(a,0);for(var b=0;b<this.f.length;b++)cR(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(qR,jR);_.w(rR,Z);rR.prototype.a=function(){return 20+Z.prototype.a.call(this)};
47
47
  rR.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(sR,Z);sR.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
  sR.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(bR(a,0),bR(a,0),_.W(a,this.h),_.W(a,0),bR(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);eR(a,0);eR(a,0);eR(a,this.volume);eR(a,0);for(var b=0;b<this.f.length;b++)cR(a,this.f[b]);eR(a,this.width);eR(a,0);eR(a,this.height);eR(a,0);a.getPosition()};_.w(tR,Z);tR.prototype.a=function(){var a=0;a=1===this.version?a+28:a+16;return a+4+Z.prototype.a.call(this)};
@@ -64,12 +64,12 @@ UR.prototype.a=function(){var a=4;this.flags&1&&(a+=8);this.flags&2&&(a+=4);this
64
64
  YR.prototype.write=function(a){jR.prototype.write.call(this,a);0<this.f.byteLength&&_.iq(a,this.f)};_.w(ZR,Z);ZR.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)};ZR.prototype.write=function(a){Z.prototype.write.call(this,a);cR(a,0);0===this.version?cR(a,0):cR(a,0);cR(a,this.f);cR(a,this.h);_.iq(a,_.Qm(this.l));if(1===this.f&&0===this.h){cR(a,0);for(var b=0;b<this.j.length;b++)cR(a,this.j[b])}a.getPosition()};_.w($R,Z);
65
65
  $R.prototype.a=function(){var a=8;this.flags&1&&(a+=iR(this.tc).byteLength);return a+Z.prototype.a.call(this)};$R.prototype.write=function(a){Z.prototype.write.call(this,a);_.iq(a,iR(this.f));_.W(a,this.h);this.flags&1&&_.iq(a,iR(this.tc));a.getPosition()};_.w(aS,jR);aS.prototype.a=function(){return iR(this.f).byteLength+jR.prototype.a.call(this)};aS.prototype.write=function(a){jR.prototype.write.call(this,a);_.iq(a,iR(this.f));a.getPosition()};_.w(bS,Z);
66
66
  bS.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)};bS.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]):bR(a,this.offset[b]);a.getPosition()};_.w(cS,Z);cS.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
- cS.prototype.write=function(a){Z.prototype.write.call(this,a);this.flags&1&&(_.W(a,0),_.W(a,0));cR(a,this.f);_.W(a,this.h);if(0===this.f)for(var b=0;b<this.h;b++)cR(a,this.j[b]);a.getPosition()};_.w(dS,Z);dS.prototype.a=function(){var a=4;this.flags&1&&(a+=1);for(var b=0;b<this.h;b++)if(a+=this.f[b].Wi.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)};
68
- dS.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.h);this.flags&1&&cR(a,this.j);for(var b=0;b<this.h;b++)if(_.iq(a,this.f[b].Wi),this.flags&2){eR(a,this.f[b].Xd);for(var c=0;c<this.f[b].Xd;c++)eR(a,this.f[b].vh[c].Vh),_.W(a,this.f[b].vh[c].Wh)}a.getPosition()};var kS=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,lS=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,mS=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,nS=/^(\d*\.?\d*)f$/,oS=/^(\d*\.?\d*)t$/,pS=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/;tS.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};tS.prototype.write=function(){this.f=sS(this);for(var a=0;a<this.a.length;a++)this.a[a].write(this.f);return this.f.buffer};var wS=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);_.r=CS.prototype;_.r.configure=function(a){this.f=a};_.r.start=function(a,b){var c=this;this.F=b;var d=_.uh(new Set([a,eS(a)])).concat();return DS(this,d).then(function(e){return KS(c,e.data).then(function(){PS(c,c.B);return c.j})})};_.r.requestStop=function(){};_.r.stop=function(){this.F&&this.F.networkingEngine.Ve(this.L);this.B=this.A=this.j=this.f=this.F=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.me())return DS(this,[this.o]).then(function(b){return KS(a,b.data).then(function(){return a.j})})["catch"](function(b){if(a.F)a.F.onError(b)})};_.r.setCurrentVariant=function(){};_.r.rc=function(){var a=this;this.g.debug(_.RB);this.F&&(this.l=null,this.update().then(function(){PS(a,a.B)})["catch"](function(b){a.F&&(a.F.onError(b),1===b.severity&&PS(a,100))}))};_.r.me=function(){return this.M===GS};_.r.Rg=function(){return 0<this.w.length};
70
- _.r.Ji=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.Qo=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.me.bind(this),Mf:this.Rg.bind(this),Bm:function(){return 1},Kf:this.Ji.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=yS(a,b,g,c)}catch(k){d=
72
- !0,e.data=k,3E3===k.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 _.zi(_.HB+a);return f["return"](d)})};var NS={video:_.Vg,audio:_.Xc,text:_.Pc},BS=_.Vb,GS="LIVE",OS={Ap:_.hd,Hp:_.qg};_.w(QS,_.jv);QS.prototype.install=function(){_.ew.ism=CS;_.dw[_.Qc]=CS};QS.prototype.uninstall=function(){_.pE("ism");_.qE(_.Qc)};QS.prototype.id=function(){return _.hg};_.K("clpp.smooth.SmoothComponent",QS);};
67
+ cS.prototype.write=function(a){Z.prototype.write.call(this,a);this.flags&1&&(_.W(a,0),_.W(a,0));cR(a,this.f);_.W(a,this.h);if(0===this.f)for(var b=0;b<this.h;b++)cR(a,this.j[b]);a.getPosition()};_.w(dS,Z);dS.prototype.a=function(){var a=4;this.flags&1&&(a+=1);for(var b=0;b<this.h;b++)if(a+=this.f[b].Xi.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)};
68
+ dS.prototype.write=function(a){Z.prototype.write.call(this,a);_.W(a,this.h);this.flags&1&&cR(a,this.j);for(var b=0;b<this.h;b++)if(_.iq(a,this.f[b].Xi),this.flags&2){eR(a,this.f[b].Xd);for(var c=0;c<this.f[b].Xd;c++)eR(a,this.f[b].wh[c].Wh),_.W(a,this.f[b].wh[c].Xh)}a.getPosition()};var kS=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,lS=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,mS=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,nS=/^(\d*\.?\d*)f$/,oS=/^(\d*\.?\d*)t$/,pS=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/;tS.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};tS.prototype.write=function(){this.f=sS(this);for(var a=0;a<this.a.length;a++)this.a[a].write(this.f);return this.f.buffer};var wS=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);_.r=CS.prototype;_.r.configure=function(a){this.f=a};_.r.start=function(a,b){var c=this;this.F=b;var d=_.uh(new Set([a,eS(a)])).concat();return DS(this,d).then(function(e){return KS(c,e.data).then(function(){PS(c,c.B);return c.j})})};_.r.requestStop=function(){};_.r.stop=function(){this.F&&this.F.networkingEngine.We(this.L);this.B=this.A=this.j=this.f=this.F=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.ne())return DS(this,[this.o]).then(function(b){return KS(a,b.data).then(function(){return a.j})})["catch"](function(b){if(a.F)a.F.onError(b)})};_.r.setCurrentVariant=function(){};_.r.rc=function(){var a=this;this.g.debug(_.RB);this.F&&(this.l=null,this.update().then(function(){PS(a,a.B)})["catch"](function(b){a.F&&(a.F.onError(b),1===b.severity&&PS(a,100))}))};_.r.ne=function(){return this.M===GS};_.r.Sg=function(){return 0<this.w.length};
70
+ _.r.Ki=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.Ro=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.ne.bind(this),Nf:this.Sg.bind(this),Cm:function(){return 1},Lf:this.Ki.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=yS(a,b,g,c)}catch(k){d=
72
+ !0,e.data=k,3E3===k.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 _.zi(_.HB+a);return f["return"](d)})};var NS={video:_.Vg,audio:_.Xc,text:_.Pc},BS=_.Vb,GS="LIVE",OS={Bp:_.hd,Ip:_.qg};_.w(QS,_.jv);QS.prototype.install=function(){_.ew.ism=CS;_.dw[_.Qc]=CS};QS.prototype.uninstall=function(){_.pE("ism");_.qE(_.Qc)};QS.prototype.id=function(){return _.hg};_.K("clpp.smooth.SmoothComponent",QS);};
73
73
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
74
74
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
75
75
  else{_=this.clpp._;(f.call(g,this));}
@@ -2,7 +2,7 @@
2
2
  var f=function(window){var Tz="No thumbnail found for position: ",Uz="Position is out of range: ",Vz="Thumbnail URL is mandatory",Wz="Wrong gridSize format",Xz="clpp.thumbnails",Yz=function(){this.log=new _.M(Xz);this.player=null;this.a=[];this.w=!1},$z=function(a,b){b.reduce(function(c,d){var e=d,f=!1;typeof d===_.$e&&(e=d.step,f=d.preloadWhileBuffering);return c.then(function(){return Zz(a,0,e,!!f)})},Promise.resolve())},Zz=function(a,b,c,d){if(a.w||b>=a.a.length)return Promise.resolve();var e=b+c;return aA(a,d).then(function(){return a.a[b].load()}).then(function(){return Zz(a,
3
3
  e,c,d)})},aA=function(a,b){return new Promise(function(c){if(b||2!==a.player.getState())c();else a.player.one(_.dd,function(){c()})})},bA=function(a,b,c,d,e,f,g,k,l,m,n,p){d=void 0===d?0:d;e=void 0===e?0:e;f=void 0===f?0:f;g=void 0===g?0:g;k=void 0===k?1:k;l=void 0===l?1:l;m=void 0===m?0:m;n=void 0===n?0:n;p=void 0===p?new Image:p;this.time=b;this.src=a;this.duration=c;this.x=d;this.y=e;this.width=f;this.height=g;this.a=p;this.h=k;this.o=l;this.j=m;this.l=n;this.f=null},cA=function(){Yz.call(this);
4
4
  this.f=null;this.o=this.h=1;this.j=0},dA=function(a,b){this.time=a;this.duration=0;this.offset=b;this.length=0;this.Rd=new _.rm},eA=function(){this.g=new _.M(Xz);this.f=new ArrayBuffer(0);this.a=[];this.h=new _.rm},fA=function(a){var b=a.f.byteLength;a.a.forEach(function(c){c.offset+c.length<b&&c.Rd.resolve()})},hA=function(a,b){return gA(a,b).then(function(c){return new bA(c,b.time,b.duration)})},gA=function(a,b){return b.load().then(function(){var c=_.Vi(a.f,b.offset,b.length);return"data:image/jpeg;base64,"+
5
- _.Nm(c)})},iA=function(){Yz.call(this);this.f=null},jA=function(a){a=a.split(/\.|:/).map(parseFloat);var b=0,c,d={3:.001,2:1,1:60,0:3600};for(c=a.length-1;0<=c;c--)b+=a[c]*d[c];return b},kA=function(){Yz.apply(this,arguments)},lA=function(a,b){var c=a.horizontalTiles||b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{Ge:c,Fh:d,Vi:e,durationPerTile:a.durationPerTile||b.durationPerTile||(a.endTime-a.startTime)/e}},mA=function(){this.g=new _.M(Xz);this.a=this.m=null},nA=function(a){return a.some(function(b){return 0<
5
+ _.Nm(c)})},iA=function(){Yz.call(this);this.f=null},jA=function(a){a=a.split(/\.|:/).map(parseFloat);var b=0,c,d={3:.001,2:1,1:60,0:3600};for(c=a.length-1;0<=c;c--)b+=a[c]*d[c];return b},kA=function(){Yz.apply(this,arguments)},lA=function(a,b){var c=a.horizontalTiles||b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{He:c,Gh:d,Wi:e,durationPerTile:a.durationPerTile||b.durationPerTile||(a.endTime-a.startTime)/e}},mA=function(){this.g=new _.M(Xz);this.a=this.m=null},nA=function(a){return a.some(function(b){return 0<
6
6
  b.thumbStreams.length})},sA=function(a){return a?a===oA||a===pA?new cA:a===qA?new iA:a===rA?new eA:null:null},tA=function(a){if(!a)return null;a=new _.zn(a);return a.path.match(/.*\.vtt$/i)?qA:a.path.match(/.*\.bif$/i)?rA:a.path.match(/.*\.(png|jpg|jpeg)$/i)?oA:null},uA=function(){};Yz.prototype.init=function(a,b){var c=this;this.player=a;a.one(_.Sf,function(){c.w=!0});a.isLive()||this.l().then(function(){b&&b.preload&&$z(c,b.preload)})};bA.prototype.raw=function(){return this.a.cloneNode(!1)};
7
7
  bA.prototype.element=function(a,b){var c=this.width,d=this.height,e=this.width/this.height;void 0!==a&&void 0===b&&(b=0);null!==a&&void 0!==a&&(c=a);null!==b&&void 0!==b&&(d=b);c||(c=Math.ceil(d*e));d||(d=Math.ceil(c/e));e=document.createElement(_.Xd);e.style.width=c+_.Pf;e.style.height=d+_.Pf;e.style.backgroundColor="#000";e.style.backgroundRepeat="no-repeat";e.style.backgroundImage='url("'+this.src+'")';e.style.backgroundSize=Math.ceil(c/this.width*(this.a.naturalWidth||this.a.width))+"px "+Math.ceil(d/
8
8
  this.height*(this.a.naturalHeight||this.a.height))+_.Pf;var f=this.y/this.height;e.style.backgroundPositionX="-"+this.x/this.width*c+_.Pf;e.style.backgroundPositionY="-"+f*d+_.Pf;return e};
@@ -19,9 +19,9 @@ iA.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.O(1,9,7100,
19
19
  d.substr(0,d.lastIndexOf("/"))+"/"+k);t=jA(l[0]);l=jA(l[1])-t;c.a.push(new bA(k,t,l,m,p,q,n,0,0))}}})["catch"](function(f){c.log.error("[VTT] Error while loading thumbnails URL: "+d,f);a.onError(new _.O(1,9,2013,"Error while loading VTT thumbnails.",f))});Yz.prototype.init.call(this,a,b)};
20
20
  iA.prototype.get=function(a){var b=this,c;return _.I(function(d){if(1==d.a){if(0>a)throw new _.O(1,9,2014,Uz+a);return _.y(d,b.f,2)}if(3!=d.a){c=b.a.find(function(e){return a>=e.time&&a<e.time+e.duration});if(!c)throw new _.O(1,9,2014,Tz+a);return _.y(d,c.load(),3)}return d["return"](c)})};iA.prototype.l=function(){return this.f};_.w(kA,Yz);
21
21
  kA.prototype.get=function(a){function b(){return new _.O(1,9,2014,Tz+a)}var c=this,d,e,f,g,k,l,m,n,p,q,t,u,z;return _.I(function(B){if(1==B.a){if(0>a)throw c.log.error("Position must be greater than 0 but is "+a),new _.O(1,9,2014,Uz+a);d=c.player.getPeriods();for(var D=null,C=_.v(d),E=C.next();!E.done;E=C.next())E=E.value,E.startTime<=a&&(D=E);e=D;if(!e)throw c.log.error("Could not find period for specified position",a),b();f=e.thumbStreams.sort(c.f)[0];if(!f)throw c.log.error("Could not find thumb stream for specified position",a),
22
- b();g=f.findSegmentPosition(a-e.startTime);if(null===g||void 0===g)throw c.log.error("Could not find segment index for specified position",a),b();k=f.getSegmentReference(g);if(!k)return B.C(2);l=lA(k,f);m=Math.floor((a-k.startTime)/l.durationPerTile);0<c.a.length?(p=f.findSegmentPosition(0),null!==p&&(n=c.a[(g-p)*l.Vi+m])):(q=k.Ia())&&0<q.length&&(u=t=0,z=k.startTime,1<l.Vi&&(t=m%l.Ge,u=Math.floor(m/l.Ge),z+=m*l.durationPerTile),n=new bA(q[0],z,l.durationPerTile,void 0,void 0,void 0,void 0,l.Ge,l.Fh,
22
+ b();g=f.findSegmentPosition(a-e.startTime);if(null===g||void 0===g)throw c.log.error("Could not find segment index for specified position",a),b();k=f.getSegmentReference(g);if(!k)return B.C(2);l=lA(k,f);m=Math.floor((a-k.startTime)/l.durationPerTile);0<c.a.length?(p=f.findSegmentPosition(0),null!==p&&(n=c.a[(g-p)*l.Wi+m])):(q=k.Ia())&&0<q.length&&(u=t=0,z=k.startTime,1<l.Wi&&(t=m%l.He,u=Math.floor(m/l.He),z+=m*l.durationPerTile),n=new bA(q[0],z,l.durationPerTile,void 0,void 0,void 0,void 0,l.He,l.Gh,
23
23
  t,u));return n?_.y(B,n.load(),4):B.C(2)}if(2!=B.a)return B["return"](n);c.log.error("segment reference for specified segment index does not exist",g);throw b();})};kA.prototype.f=function(a,b){return void 0!==a.bandwidth&&void 0!==b.bandwidth?a.bandwidth-b.bandwidth:0};
24
- kA.prototype.l=function(){if(0<this.a.length)return Promise.resolve();var a=this.player.getPeriods();a=_.v(a);for(var b=a.next();!b.done;b=a.next())if(b=b.value.thumbStreams.sort(this.f)[0])for(var c=b.findSegmentPosition(0),d=void 0;null!==c&&!_.N.R(d=b.getSegmentReference(c++));)for(var e=lA(d,b),f=d.Ia()[0],g=new Image,k=d.startTime,l=0;l<e.Fh;++l)for(var m=0;m<e.Ge;++m)this.a.push(new bA(f,k,e.durationPerTile,void 0,void 0,void 0,void 0,e.Ge,e.Fh,m,l,g)),k+=e.durationPerTile;return Promise.resolve()};_.r=mA.prototype;_.r.onPlayerCreated=function(a){this.m=a};_.r.onPlayerWillDestroy=function(){this.m=null};_.r.onPlayerWillRelease=function(){this.a=null};
24
+ kA.prototype.l=function(){if(0<this.a.length)return Promise.resolve();var a=this.player.getPeriods();a=_.v(a);for(var b=a.next();!b.done;b=a.next())if(b=b.value.thumbStreams.sort(this.f)[0])for(var c=b.findSegmentPosition(0),d=void 0;null!==c&&!_.N.R(d=b.getSegmentReference(c++));)for(var e=lA(d,b),f=d.Ia()[0],g=new Image,k=d.startTime,l=0;l<e.Gh;++l)for(var m=0;m<e.He;++m)this.a.push(new bA(f,k,e.durationPerTile,void 0,void 0,void 0,void 0,e.He,e.Gh,m,l,g)),k+=e.durationPerTile;return Promise.resolve()};_.r=mA.prototype;_.r.onPlayerCreated=function(a){this.m=a};_.r.onPlayerWillDestroy=function(){this.m=null};_.r.onPlayerWillRelease=function(){this.a=null};
25
25
  _.r.onContentWillLoad=function(a){var b=this,c=a.getConfiguration().thumbnails;if(c)if(!1===c.enabled)this.g.info("Thumbnails disabled.");else{var d=c.mode||null;d||(d=tA(c.url||null));(this.a=sA(d))?(this.g.info("Loading thumbs configuration",c),this.m.one(_.Me,function(){b.g.info("Initialize thumbnails provider");try{b.a.init(a,c)}catch(e){b.m.onError(e)}})):this.g.warn("Unknown thumbnail mode",d)}else this.a=null};
26
26
  _.r.onContentLoaded=function(a,b){for(var c=1;c<arguments.length;++c);if(!this.a&&(c=(c=a.getConfiguration())&&c.thumbnails,!c||void 0===c.enabled||c.enabled)){var d=a.getPeriods();if(nA(d)){this.a=new kA;try{this.a.init(a,c)}catch(e){this.m.onError(e)}}}};_.r.get=function(a){return this.a?this.a.get(a):Promise.reject(new _.O(1,9,2014,"Thumbnail format is not supported"))};_.r.id=function(){return"thumbnails"};_.K("clpp.thumbnails.ThumbnailsPlugin",mA);mA.prototype.get=mA.prototype.get;mA.Id="thumbnails";
27
27
  uA.prototype.create=function(){return new mA};var oA="SINGLE",pA="GRID",qA="WEBVTT",rA="BIF";_.fp(new uA);};
package/cjs/cl.tizen.js CHANGED
@@ -1,16 +1,16 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
2
  var f=function(window){var uP="An unknown error occurred while trying to get volume",vP="Cannot get loading rendition due to platform limitations",wP="PARAM_START_POSITION",xP="SecurityError",yP="The require privilege is: http://tizen.org/privilege/tv.audio",zP="onbufferingcomplete",AP="onbufferingprogress",BP="onbufferingstart",CP="oncurrentplaytime",DP="ondrmevent",EP="onerror",FP="onstreamcompleted",GP="onsubtitlechange",HP="preparingend",IP="preparingstart",JP="|STARTBITRATE\x3d",KP=function(a,b,c){function d(e){c.call(a,
3
- e);a.removeEventListener(b,d)}a.addEventListener(b,d)},LP=function(a,b){this.h=a;this.o=null;this.a=_.Ze;this.l=null;this.j=!1;this.f=new Map;this.F=b;this.g=new _.M("clpp.tizen.DrmEngine")},OP=function(a){var b,c,d;return _.I(function(e){if(1==e.a){b=a.a===_.Md||a.a===_.Kd;if(!b)throw new _.O(_.P,6,6001,"The key system "+a.a+" is not supported by the player or the platform");c=a.f.get(a.a);if(!c.Pe)throw new _.O(_.P,6,6012,"No license server given for "+a.a);_.F(e,2);return a.a===_.Md?_.y(e,MP(a),
4
- 5):_.y(e,NP(a,c),5)}if(2!=e.a)return a.o={keySystem:a.a,licenseServerUri:c.Pe,distinctiveIdentifierRequired:!1,persistentStateRequired:c.gh,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[],keyIds:[],periodId:null},_.G(e,0);d=_.H(e);a.g.error("Error while configuring CDM for "+a.a,d);throw new _.O(_.P,6,6005,{message:JSON.stringify(d)});})},NP=function(a,b){var c,d,e,f;return _.I(function(g){c=PP;d=QP;e={};e[d.gk]=!b.gh;e[d.ik]=b.Pe;""!==b.customData&&(e[d.ek]=b.customData);
5
- f=JSON.stringify(e);a.g.debug("PlayReady properties: ",f);try{webapis.avplay.setDrm(c.PLAYREADY,"SetProperties",f)}catch(k){throw k;}_.A(g)})},MP=function(a){var b;return _.I(function(c){b=PP;try{webapis.avplay.setDrm(b.qf,"Initialize",""),webapis.avplay.setDrm(b.qf,"widevine_app_session",a.l.id),webapis.avplay.setDrm(b.qf,"widevine_data_type",a.l.type)}catch(d){throw d;}_.A(c)})},RP=function(a,b){var c,d,e,f,g,k,l,m,n,p,q,t,u,z,B,D,C;_.I(function(E){if(1==E.a){c=PP;d=a.f.get(a.a);a.g.debug("DRM Challenge data: ",
6
- b.challenge);e=atob(b.challenge);f=new Uint8Array(e.length);for(g=0;g<e.length;++g)f[g]=e.charCodeAt(g);k=b.serverurl&&""!==b.serverurl?b.serverurl:d.Pe;l=_.dl([k],_.Zk());l.type=3;l.body=f.buffer;l.method=_.rb;_.F(E,2);return _.y(E,a.F.Mb.fetch(l).U,4)}if(2!=E.a){m=E.f;if(a.j){n=_.Vi(m.data);p=n.byteLength;q="";for(t=0;t<p;t++)q+=String.fromCharCode(n[t]);u=btoa(q);z=b.session_id+wP+(u+wP);a.g.debug("Widevine license params",z);try{webapis.avplay.setDrm(c.qf,"widevine_license_data",z)}catch(x){a.g.error("License response rejected by CDM"),
3
+ e);a.removeEventListener(b,d)}a.addEventListener(b,d)},LP=function(a,b){this.h=a;this.o=null;this.a=_.Ze;this.l=null;this.j=!1;this.f=new Map;this.F=b;this.g=new _.M("clpp.tizen.DrmEngine")},OP=function(a){var b,c,d;return _.I(function(e){if(1==e.a){b=a.a===_.Md||a.a===_.Kd;if(!b)throw new _.O(_.P,6,6001,"The key system "+a.a+" is not supported by the player or the platform");c=a.f.get(a.a);if(!c.Qe)throw new _.O(_.P,6,6012,"No license server given for "+a.a);_.F(e,2);return a.a===_.Md?_.y(e,MP(a),
4
+ 5):_.y(e,NP(a,c),5)}if(2!=e.a)return a.o={keySystem:a.a,licenseServerUri:c.Qe,distinctiveIdentifierRequired:!1,persistentStateRequired:c.hh,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[],keyIds:[],periodId:null},_.G(e,0);d=_.H(e);a.g.error("Error while configuring CDM for "+a.a,d);throw new _.O(_.P,6,6005,{message:JSON.stringify(d)});})},NP=function(a,b){var c,d,e,f;return _.I(function(g){c=PP;d=QP;e={};e[d.hk]=!b.hh;e[d.jk]=b.Qe;""!==b.customData&&(e[d.fk]=b.customData);
5
+ f=JSON.stringify(e);a.g.debug("PlayReady properties: ",f);try{webapis.avplay.setDrm(c.PLAYREADY,"SetProperties",f)}catch(k){throw k;}_.A(g)})},MP=function(a){var b;return _.I(function(c){b=PP;try{webapis.avplay.setDrm(b.rf,"Initialize",""),webapis.avplay.setDrm(b.rf,"widevine_app_session",a.l.id),webapis.avplay.setDrm(b.rf,"widevine_data_type",a.l.type)}catch(d){throw d;}_.A(c)})},RP=function(a,b){var c,d,e,f,g,k,l,m,n,p,q,t,u,z,B,D,C;_.I(function(E){if(1==E.a){c=PP;d=a.f.get(a.a);a.g.debug("DRM Challenge data: ",
6
+ b.challenge);e=atob(b.challenge);f=new Uint8Array(e.length);for(g=0;g<e.length;++g)f[g]=e.charCodeAt(g);k=b.serverurl&&""!==b.serverurl?b.serverurl:d.Qe;l=_.dl([k],_.Zk());l.type=3;l.body=f.buffer;l.method=_.rb;_.F(E,2);return _.y(E,a.F.Mb.fetch(l).U,4)}if(2!=E.a){m=E.f;if(a.j){n=_.Vi(m.data);p=n.byteLength;q="";for(t=0;t<p;t++)q+=String.fromCharCode(n[t]);u=btoa(q);z=b.session_id+wP+(u+wP);a.g.debug("Widevine license params",z);try{webapis.avplay.setDrm(c.rf,"widevine_license_data",z)}catch(x){a.g.error("License response rejected by CDM"),
7
7
  B=new _.O(_.P,6,6008,{browserError:JSON.stringify(x)}),a.F.onError(B)}}return _.G(E,0)}D=_.H(E);a.g.error("License request failed.",JSON.stringify(D));C=new _.O(_.P,6,6007,{message:"Error while fetching license!",url:D.data.url,status:D.data.status||NaN,response:D.data.response||"",headers:D.data.headers||{}},D);a.F.onError(C);_.A(E)})},SP=function(a){this.m=a;this.a=this.m.a;this.f=_.mu;this.j=7;this.w=(new Date).getTime();this.l=!1;this.o=-1;this.h=2;this.g=new _.M("clpp.tizen.StateManager")},UP=
8
8
  function(a,b){if(a.f!==b)if(a.f===_.Fo&&b!==_.mu)a.g.debug(_.MB+TP(b));else{var c=(new Date).getTime();a.j=a.f;a.f=b;2===a.f?(a.o=(new Date).getTime(),a.m.trigger(new _.Q(_.ed,{detail:{bufferedTimeMS:-1,reason:a.h}}))):2===a.j&&a.m.trigger(new _.Q(_.dd,{detail:{bufferedTimeMS:c-a.o,reason:a.h}}));var d={currentState:a.f,previousState:a.j,timeSinceLastStateChangeMS:c-a.w};a.w=c;a.m.trigger(new _.Q(_.kg,{detail:d}));a.g.debug("State changed:",TP(a.j),"-\x3e",TP(a.f))}},TP=function(a){return Object.keys(_.tu)[a]},
9
9
  XP=function(a){if(a.l){var b=a.a.getState(),c=a.f;switch(b){case VP:c=3;break;case WP:c=4;break;default:a.m.isEnded()?c=5:a.g.debug("Inconsistent AVPlay playback state:",b)}UP(a,c)}},YP=function(){this.o=this.A=this.f=this.h=this.B=this.m=this.j=this.a=null;this.D=!1;this.w=!0;this.l=null;this.g=new _.M("clpp.tizen.TextStreamer")},ZP=function(a){if(!a)return!1;a=a.periods;for(var b=!1,c=0;c<a.length;c++)b=b||0<a[c].textStreams.length;return b},$P=function(a){var b,c;return _.I(function(d){if(1==d.a)return b=
10
- a.m.getConfiguration(),c=null,_.y(d,_.cw(a.B.url,a.m.getNetworkEngine(),b.manifest.attemptParameters,a.B.type||null),2);(c=d.f)&&c.configure(b.manifest);return d["return"](c)})},aQ=function(a){var b=document.createElement(_.Tg),c=new _.nF,d=new _.ZC,e=a.m.getTextDisplayer();return new _.pF(b,c,e,d,a.m.getConfiguration())},bQ=function(a){var b={configuration:{},Ib:function(){return a.m.getPosition()},Y:a.h,Mb:a.m.getNetworkEngine(),Dd:null,Wg:a.Pl.bind(a),nj:a.Ol.bind(a),onError:a.Ql.bind(a),oj:function(){},
11
- onEvent:function(){},sj:a.Rl.bind(a),Yf:function(){},ye:function(){return new _.cG},Ag:function(){return!1},re:null};return new _.JG(a.a,b)},cQ=function(a){var b=a.m.getPosition(),c=null;a=_.v(a.a.periods);for(var d=a.next();!d.done;d=a.next())d=d.value,d.startTime<=b&&(c=d);return c},dQ=function(a){a.g.debug("getTextStreams()",a.a);if(a.a){var b=[],c=a.a.periods;a.g.debug("getting text streams");for(var d=0;d<c.length;d++)if(a.g.debug(c[d].startTime,a.m.getPosition()),c[d].startTime<=a.m.getPosition()){b=
10
+ a.m.getConfiguration(),c=null,_.y(d,_.cw(a.B.url,a.m.getNetworkEngine(),b.manifest.attemptParameters,a.B.type||null),2);(c=d.f)&&c.configure(b.manifest);return d["return"](c)})},aQ=function(a){var b=document.createElement(_.Tg),c=new _.nF,d=new _.ZC,e=a.m.getTextDisplayer();return new _.pF(b,c,e,d,a.m.getConfiguration())},bQ=function(a){var b={configuration:{},Ib:function(){return a.m.getPosition()},Y:a.h,Mb:a.m.getNetworkEngine(),Dd:null,Xg:a.Ql.bind(a),oj:a.Pl.bind(a),onError:a.Rl.bind(a),pj:function(){},
11
+ onEvent:function(){},tj:a.Sl.bind(a),Zf:function(){},ze:function(){return new _.cG},Bg:function(){return!1},se:null};return new _.JG(a.a,b)},cQ=function(a){var b=a.m.getPosition(),c=null;a=_.v(a.a.periods);for(var d=a.next();!d.done;d=a.next())d=d.value,d.startTime<=b&&(c=d);return c},dQ=function(a){a.g.debug("getTextStreams()",a.a);if(a.a){var b=[],c=a.a.periods;a.g.debug("getting text streams");for(var d=0;d<c.length;d++)if(a.g.debug(c[d].startTime,a.m.getPosition()),c[d].startTime<=a.m.getPosition()){b=
12
12
  c[d].textStreams;break}a=b}else a=[];b=[];for(d=c=0;d<a.length;d++){var e=new _.ht(String(c++),_.jt);e.mimeType=a[d].mimeType;e.language=a[d].language;e.roles=a[d].roles;e.kind=a[d].kind||_.jC;var f=new _.pt(String(a[d].id),e);f.bandwidth=a[d].bandwidth||null;e.renditions.push(f);b.push(e)}return b},eQ=function(a){if(a.h&&!a.h.getTextDisplayer().isTextVisible())return null;if(a.f){var b=_.MG(a.f,_.Gn),c=null;if(b){a=dQ(a);for(var d=0;d<a.length;d++)if(a[d].renditions[0].id===String(b.id)){c=a[d].renditions[0];
13
- break}}return c}return null},fQ=function(a,b){var c,d,e,f;_.I(function(g){if(1==g.a){c=_.cJ;a.g.debug("Set active track",b);if(!b)return g.C(0);a.o=b.language;a.A=b.roles[0]||"";a.D=b.kind===c.Jh;if(!a.a||!a.f)return g.C(0);a.setTextVisibility(!0);d=cQ(a);e=b.renditions[0];f=d.textStreams.find(function(k){return String(k.id)===e.id});return f?a.w?(a.g.debug("Switching period defer text selection"),a.l=f,g.C(4)):_.y(g,_.fH(a.f,f),5):(a.g.error("No stream with id",e.id),g["return"]())}4!=g.a&&a.m.trigger(new _.Q(_.wg));
13
+ break}}return c}return null},fQ=function(a,b){var c,d,e,f;_.I(function(g){if(1==g.a){c=_.cJ;a.g.debug("Set active track",b);if(!b)return g.C(0);a.o=b.language;a.A=b.roles[0]||"";a.D=b.kind===c.Kh;if(!a.a||!a.f)return g.C(0);a.setTextVisibility(!0);d=cQ(a);e=b.renditions[0];f=d.textStreams.find(function(k){return String(k.id)===e.id});return f?a.w?(a.g.debug("Switching period defer text selection"),a.l=f,g.C(4)):_.y(g,_.fH(a.f,f),5):(a.g.error("No stream with id",e.id),g["return"]())}4!=g.a&&a.m.trigger(new _.Q(_.wg));
14
14
  a.o=f.language;_.A(g)})},gQ=function(){this.j=this.a=this.m=null;this.f={};this.g=new _.M("clpp.tizen.TrackManager");this.w=this.o=this.l=null;this.A=!1;this.h=1},hQ=function(a,b){a.m.trigger(new _.Q(_.Xg,{details:{width:b.width,height:b.height,bandwidth:b.bandwidth,track:b.track,abrSelection:a.a.o}}))},iQ=function(a){var b=a.sa();b&&a.m.trigger(new _.Q(_.bd,{detail:{width:b.width,height:b.height,bandwidth:b.bandwidth,rendition:b}}))},jQ=function(a){var b=a.m.getConfiguration(),c=_.Ni(b.preferredAudioLanguage||
15
15
  []),d=a.f[_.X]||[];if(d.length){var e=null;c.some(function(g){e=_.QC(g,d.map(function(k){return k.language}));return!!e});if(e){var f=d.filter(function(g){return g.language===e});c=f[0];1<f.length&&b.preferredAudioRole&&(f=f.filter(function(g){return 0<=g.roles.indexOf(b.preferredAudioRole)}),0<f.length&&(c=f[0]));a.g.debug("Setting audio track with preferred language:",e);a.La(c)}else a.g.debug("Preferred language(s) not available")}else a.g.debug("Could not set preferred audio language")},nQ=function(a,
16
16
  b){if(b){var c=b.track.type.toUpperCase();kQ(a.a,c,Number(b.id)).then(function(){c===lQ&&(a.l=b,a.m.trigger(new _.Q(_.$c)));c===mQ&&(a.o=b,a.m.trigger(new _.Q(_.wg)))})["catch"](function(){a.g.error("Could not select "+c+" track.")})}else a.g.debug("Must provide valid rendition")},oQ=function(a,b,c){var d=_.vo(b.language||_.Gg);c.language=_.it(d);c.originalLanguage=d;c.channelsCount=b.channels?Number(b.channels):null;c.mimeType=_.Xc;a=new _.pt(String(a),c);a.track=c;a.codec=b.fourCC||null;a.bandwidth=
@@ -19,51 +19,51 @@ uQ=function(a,b){function c(n,p){for(var q=0;q<n.length;q++)if(n[q].language===p
19
19
  _.kt);for(k=0;k<e.length;k++)(l=rQ(a,e[k].extra_info))?f.renditions.push(pQ(e[k].index,l,f)):a.g.warn("Skipping video stream with no extra info");e=[];e=a.j?dQ(a.j):tQ(a,b);d[_.kt]=[f];d[_.X]=g;d[_.jt]=e;return d},tQ=function(a,b){for(var c=b.filter(function(k){return k.type===mQ}),d=[],e=0;e<c.length;e++){var f=rQ(a,c[e].extra_info);if(f){var g=new _.ht(String(a.h++),_.jt);g.renditions.push(qQ(c[e].index,f,g));d.push(g)}else a.g.warn("Skipping text stream with no extra info")}return d},vQ=function(a,
20
20
  b){for(var c=a.f[_.kt]||[],d=[],e=0;e<c.length;e++)for(var f=0;f<c[e].renditions.length;f++)_.N.ua(c[e].renditions[f],b,Object.keys(b))&&d.push(c[e].renditions[f]);return d[0]||null},wQ=function(a,b,c){a=a.f[c]||[];b=String(b.index);c=null;for(var d=0;d<a.length;d++)for(var e=0;e<a[d].renditions.length;e++)if(a[d].renditions[e].id===b){c=a[d].renditions[e];break}return c},yQ=function(a,b){if(b===_.jt&&a.j)return eQ(a.j);var c=xQ(a.a)||[];if(0===c.length)return null;c=c.filter(function(e){return e.type===
21
21
  b.toUpperCase()})[0];var d=null;b===_.kt&&(d=rQ(a,c.extra_info),d=vQ(a,{width:d.Width,height:d.Height}));b===_.X&&(c?(d=wQ(a,c,_.X),a.l=d):d=a.l);b===_.jt&&(c?(d=wQ(a,c,_.jt),a.o=d):d=a.o);return d},zQ=function(a){_.Ii.call(this);this.m=a;this.h=null;this.g=new _.M("clpp.tizen.Middleware");this.D=1;this.B=!1;this.l=null;this.G=0;this.o=!0;this.f=!1;this.a=null;this.A=1;this.w=!1;this.j={}},AQ=function(a){return _.I(function(b){tizen.systeminfo.getPropertyValue("DISPLAY",function(c){a.A=c.resolutionWidth/
22
- 1920;a.g.debug("Display resolution ratio: ",a.A)},function(c){a.g.debug("Could not load DISPLAY property");throw c;});_.A(b)})},BQ=function(a){try{webapis.avplay.setListener({onbufferingstart:a.Jl.bind(a),onbufferingprogress:a.Il.bind(a),onbufferingcomplete:a.Hl.bind(a),onstreamcompleted:a.Ml.bind(a),oncurrentplaytime:function(b){a.trigger(new _.Q(CP,{currentTime:b}))},onevent:a.Ll.bind(a),onsubtitlechange:a.Nl.bind(a),ondrmevent:a.Kl.bind(a),onerror:a.ne.bind(a)})}catch(b){a.g.error(b)}},CQ=function(a){var b=
23
- !!a.m.getTrackManager().hb();try{webapis.avplay.setSilentSubtitle(!b)}catch(c){a.g.debug("Could not set AVPlay subtitle config",c)}},DQ=function(a,b){try{var c=b.estimatedBandwidth||0,d=b.currentBandwidth||0;a.g.debug({estimatedBandwidth:c,Tp:d});0!==c&&0!==d&&c>=1.15*d&&webapis.avplay.setStreamingProperty("ADAPTIVE_INFO",JP+d)}catch(e){a.g.debug(e)}},EQ=function(a,b){try{webapis.avplay.setStreamingProperty("ADAPTIVE_INFO","|BITRATES\x3d"+b+JP+b)}catch(c){throw a.g.debug("Could not set fixed bandwidth",
24
- c),c;}},HQ=function(a){return{position:a.getPosition(),state:a.m.getState(),Th:a.getState(),playbackRate:a.getPlaybackRate(),isLive:a.isLive(),duration:a.getDuration(),isMuted:FQ(a),volume:a.getVolume(),np:GQ(a),bm:xQ(a)}},JQ=function(a){var b,c;return _.I(function(d){if(1==d.a)return _.y(d,IQ(),2);if(3!=d.a)return b=new Promise(function(e){(new _.lj(e)).ia(5)}),_.y(d,Promise.race([AQ(a).then(function(){return!0}),b.then(function(){return!1})]),3);c=d.f;if(!c)return a.g.debug("Took to long for the SDK to be ready"),
22
+ 1920;a.g.debug("Display resolution ratio: ",a.A)},function(c){a.g.debug("Could not load DISPLAY property");throw c;});_.A(b)})},BQ=function(a){try{webapis.avplay.setListener({onbufferingstart:a.Kl.bind(a),onbufferingprogress:a.Jl.bind(a),onbufferingcomplete:a.Il.bind(a),onstreamcompleted:a.Nl.bind(a),oncurrentplaytime:function(b){a.trigger(new _.Q(CP,{currentTime:b}))},onevent:a.Ml.bind(a),onsubtitlechange:a.Ol.bind(a),ondrmevent:a.Ll.bind(a),onerror:a.oe.bind(a)})}catch(b){a.g.error(b)}},CQ=function(a){var b=
23
+ !!a.m.getTrackManager().hb();try{webapis.avplay.setSilentSubtitle(!b)}catch(c){a.g.debug("Could not set AVPlay subtitle config",c)}},DQ=function(a,b){try{var c=b.estimatedBandwidth||0,d=b.currentBandwidth||0;a.g.debug({estimatedBandwidth:c,Up:d});0!==c&&0!==d&&c>=1.15*d&&webapis.avplay.setStreamingProperty("ADAPTIVE_INFO",JP+d)}catch(e){a.g.debug(e)}},EQ=function(a,b){try{webapis.avplay.setStreamingProperty("ADAPTIVE_INFO","|BITRATES\x3d"+b+JP+b)}catch(c){throw a.g.debug("Could not set fixed bandwidth",
24
+ c),c;}},HQ=function(a){return{position:a.getPosition(),state:a.m.getState(),Uh:a.getState(),playbackRate:a.getPlaybackRate(),isLive:a.isLive(),duration:a.getDuration(),isMuted:FQ(a),volume:a.getVolume(),op:GQ(a),cm:xQ(a)}},JQ=function(a){var b,c;return _.I(function(d){if(1==d.a)return _.y(d,IQ(),2);if(3!=d.a)return b=new Promise(function(e){(new _.lj(e)).ia(5)}),_.y(d,Promise.race([AQ(a).then(function(){return!0}),b.then(function(){return!1})]),3);c=d.f;if(!c)return a.g.debug("Took to long for the SDK to be ready"),
25
25
  d["return"](Promise.reject("SDK Timeout"));_.A(d)})},MQ=function(a,b,c){var d,e,f,g,k,l,m,n;return _.I(function(p){switch(p.a){case 1:a.l=_.Vn(b);d=a.G;e=c||{estimatedBandwidth:0,currentBandwidth:0,nextBandwidth:null,currentPosition:0};a.g.debug("Loading manifest URL: "+a.l[d].url);f=b.startTime||void 0;a.f&&(a.trigger(new _.Q(BP)),f=c.currentPosition);_.F(p,2);g=a.l[d].url;k=a.l[d].type;k!==_.Lc||g.includes(".mpd")||(l=new URL(g),l.searchParams.append("cl-ext",".mpd"),g=l.toString());webapis.avplay.open(g);
26
26
  e.nextBandwidth?(EQ(a,e.nextBandwidth),a.o=!1):(a.o||DQ(a,e),a.o=!0);BQ(a);if(!b.drm||!b.drm.env){a.g.debug("No DRM configuration was provided. Assuming clear content");p.C(4);break}m={onError:function(q){return a.m.onError(q)},Mb:a.m.getNetworkEngine()};a.h=new LP(b.drm,m);return _.y(p,a.h.init(),4);case 4:return a.f||a.trigger(new _.Q(IP)),_.y(p,KQ(a),6);case 6:a.f||a.trigger(new _.Q(HP));f&&typeof f===_.h&&0<f&&a.seek(f)["catch"](function(q){a.g.debug("Couldn't set start position",q)});a.f||(b.volume&&
27
27
  a.setVolume(b.volume),b.muted&&LQ(a,b.muted),b.autoplay&&a.m.play()["catch"](function(q){a.g.debug("Autoplay failed",q)}));_.G(p,0);break;case 2:throw n=_.H(p),a.g.debug("Error while attempting to load source."),n;}})},KQ=function(a){return _.I(function(b){a.g.debug("avplay.prepare()");return b["return"](new Promise(function(c,d){try{webapis.avplay.prepareAsync(function(){a.g.debug("AVPlay is ready!");CQ(a);c()},function(e){a.g.debug("prepareAsync failed",e);d(e)})}catch(e){a.g.debug("Failed to prepare media player for playback"),
28
- d(e)}}))})},NQ=function(a,b,c){a.g.debug("switchVideoTrack()");try{var d={estimatedBandwidth:parseInt(webapis.avplay.getStreamingProperty("CURRENT_BANDWITH"),10),currentBandwidth:b,nextBandwidth:c,currentPosition:a.getPosition()};a.a=HQ(a);a.f=!0;webapis.avplay.stop();webapis.avplay.close();return a.load(a.m.getConfiguration(),d).then(function(){var e=a.a.Th;a.f=!1;a.a=null;return e===WP?a.pause():a.play()})}catch(e){return Promise.reject(e)}},GQ=function(a){return a.f&&a.a?a.a.np:webapis.avplay.getTotalTrackInfo()},
29
- xQ=function(a){return a.f&&a.a?a.a.bm:webapis.avplay.getCurrentStreamInfo()},kQ=function(a,b,c){b=b.toUpperCase();b===mQ&&OQ(a,!0);var d=a.j[b];d&&(d.jg.stop(),a.j[b]=null,a.g.debug("Cancelled pending track switch for "+b));return new Promise(function(e,f){function g(k,l,m){m=void 0===m?!1:m;try{webapis.avplay.setSelectTrack(k,l),a.j[k]=null,e()}catch(n){a.g.debug("Could not set "+k+" track. Trying again...AVPlay state: "+(a.getState()+", buffering: ")+a.w,n),!1===m&&(a.j[k]={type:k,index:l,Ph:0,
30
- jg:new _.lj(function(){return g(k,c,!0)})}),(l=a.j[k])&&3>l.Ph?(a.w||++l.Ph,l.jg.ia(a.w?.5:.25)):(a.g.debug("Could not set track after multiple attempts.Giving up..."),l&&l.jg.stop(),a.j[k]=null,f())}}g(b,c)})},OQ=function(a,b){var c=a.m.getTextDisplayer();c&&c.setTextVisibility(b);c=a.m.h;try{c||webapis.avplay.setSilentSubtitle(!b)}catch(d){a.g.debug("Could not set text track visibility",d)}},LQ=function(a,b){try{tizen.tvaudiocontrol.setMute(b)}catch(c){switch(c.name){case xP:a.g.warn("The application does not have the privilege to set mute.",
28
+ d(e)}}))})},NQ=function(a,b,c){a.g.debug("switchVideoTrack()");try{var d={estimatedBandwidth:parseInt(webapis.avplay.getStreamingProperty("CURRENT_BANDWITH"),10),currentBandwidth:b,nextBandwidth:c,currentPosition:a.getPosition()};a.a=HQ(a);a.f=!0;webapis.avplay.stop();webapis.avplay.close();return a.load(a.m.getConfiguration(),d).then(function(){var e=a.a.Uh;a.f=!1;a.a=null;return e===WP?a.pause():a.play()})}catch(e){return Promise.reject(e)}},GQ=function(a){return a.f&&a.a?a.a.op:webapis.avplay.getTotalTrackInfo()},
29
+ xQ=function(a){return a.f&&a.a?a.a.cm:webapis.avplay.getCurrentStreamInfo()},kQ=function(a,b,c){b=b.toUpperCase();b===mQ&&OQ(a,!0);var d=a.j[b];d&&(d.kg.stop(),a.j[b]=null,a.g.debug("Cancelled pending track switch for "+b));return new Promise(function(e,f){function g(k,l,m){m=void 0===m?!1:m;try{webapis.avplay.setSelectTrack(k,l),a.j[k]=null,e()}catch(n){a.g.debug("Could not set "+k+" track. Trying again...AVPlay state: "+(a.getState()+", buffering: ")+a.w,n),!1===m&&(a.j[k]={type:k,index:l,Qh:0,
30
+ kg:new _.lj(function(){return g(k,c,!0)})}),(l=a.j[k])&&3>l.Qh?(a.w||++l.Qh,l.kg.ia(a.w?.5:.25)):(a.g.debug("Could not set track after multiple attempts.Giving up..."),l&&l.kg.stop(),a.j[k]=null,f())}}g(b,c)})},OQ=function(a,b){var c=a.m.getTextDisplayer();c&&c.setTextVisibility(b);c=a.m.h;try{c||webapis.avplay.setSilentSubtitle(!b)}catch(d){a.g.debug("Could not set text track visibility",d)}},LQ=function(a,b){try{tizen.tvaudiocontrol.setMute(b)}catch(c){switch(c.name){case xP:a.g.warn("The application does not have the privilege to set mute.",
31
31
  yP);break;default:a.g.warn(uP,c)}}},FQ=function(a){var b=null;try{b=tizen.tvaudiocontrol.isMute()}catch(c){switch(c.name){case xP:a.g.warn("The application doesn't have the privilege to get the mute state.",yP);break;default:a.g.warn(uP,c)}}return!!b},IQ=function(){return new Promise(function(a,b){if(window.webapis)a();else{var c=document.createElement("script");KP(c,_.Ke,function(d){return a(d)});KP(c,_.qe,function(d){return b(d)});c.src="$WEBAPIS/webapis/webapis.js";document.querySelector("head").appendChild(c)}})},
32
32
  PQ=function(){_.Ii.call(this);this.a=new zQ(this);this.f=new SP(this);this.configuration=this.B=_.Pn();this.w=null;this.g=new _.M("clpp.tizen.Player");this.j=null;this.l=new gQ;this.D=new _.an;this.o=this.h=null;this.A=!1},QQ=function(a){if("NONE"!==a.a.getState()){var b=a.j.getBoundingClientRect();a=a.a;var c=Math.floor(b.left*a.A),d=Math.floor(b.top*a.A),e=Math.floor(b.width*a.A);b=Math.floor(b.height*a.A);a.g.debug("Setting display area to","x:",c,"y:",d,"width:",e,"height:",b);webapis.avplay.setDisplayRect(c,
33
33
  d,e,b);0===c&&0===d&&1920===e&&1080===b&&webapis.avplay.setDisplayMethod("PLAYER_DISPLAY_MODE_LETTER_BOX")}else a.g.debug("Could not apply dimension. Player state "+a.a.getState())},RQ=function(){},SQ=function(){};
34
- LP.prototype.init=function(){var a=this,b,c,d,e,f,g;return _.I(function(k){if(1==k.a){b=_.Yn[a.h.env]||null;if(!b)throw a.g.debug(_.Ca,_.wb+a.h.env+_.aa),new _.O(_.P,6,6015,_.Da+a.h.env+"' is missing.");a.l={id:String(Math.floor(1E4*Math.random())),type:"MPEG-DASH"};c=Object.keys(a.h.customData||{}).length?btoa(JSON.stringify(a.h.customData)):"";d=_.$n(b,a.h.customData);(e=d[_.Kd])&&a.f.set(_.Kd,{Pe:e.licenseUrl||"",customData:c,gh:!1});(f=d[_.Md])&&a.f.set(_.Md,{Pe:f.licenseUrl||"",customData:c,
35
- gh:!1});if(0===a.f.size)throw new _.O(_.P,6,6E3);if((g=a.h.preferredDrmSystem)&&a.f.get(g))a.a=g;else if(a.f.get(_.Kd))a.a=_.Kd;else if(a.f.get(_.Md))a.a=_.Md;else throw new _.O(_.P,6,6001,"Configuration for the target system is missing.");return _.y(k,OP(a),2)}a.j=!0;_.A(k)})};LP.prototype.release=function(){var a=this;return _.I(function(b){a.j=!1;a.o=null;a.a=_.Ze;a.l=null;a.f=new Map;_.A(b)})};LP.prototype.getDrmInfo=function(){return this.o};
36
- var QP={gk:"DeleteLicenseAfterUse",ik:"LicenseServer",Fp:"GetChallenge",Gp:"HttpHeader",Ip:"UserAgent",Cp:"Cookie",ek:"CustomData"};_.r=SP.prototype;_.r.initialize=function(){this.a.on(BP,this.ki,this);this.a.on(AP,this.ji,this);this.a.on(zP,this.ii,this);this.a.on(IP,this.uj,this);this.a.on(HP,this.tj,this);this.a.on(FP,this.li,this)};_.r.release=function(){UP(this,_.mu);this.l=!1;this.o=-1;this.h=2};_.r.destroy=function(){this.release();this.a.off(BP,this.ki);this.a.off(AP,this.ji);this.a.off(zP,this.ii);this.a.off(IP,this.uj);this.a.off(HP,this.tj);this.a.off(FP,this.li);this.m=this.a=null};
37
- _.r.ki=function(){this.g.debug("Buffering start. Player state: ",this.a.getState());this.h=this.a.B?1:2;UP(this,2)};_.r.ji=function(a){this.g.debug("Buffering progress: "+a.percent+" %. Player state: ",TP(this.f))};_.r.ii=function(){this.g.debug("Buffering complete. Player state: ",this.a.getState());if(!this.l){this.l=!0;var a=this.m.getConfiguration().autoplay,b=this.a.getState()===TQ;if(!a&&b){UP(this,4);return}}if(a=1!==this.f)a=this.a.getState(),a=a===VP||a===WP;a&&XP(this)};
38
- _.r.uj=function(){this.g.debug("Preparing starts. AVPlay State: ",this.a.getState());this.a.getState()===UQ?UP(this,1):this.g.error("AVPlay prepares while state is not IDLE")};_.r.tj=function(){this.g.debug("Preparing ends: AVPlay state:",this.a.getState())};_.r.li=function(){UP(this,5)};_.r.getState=function(){return this.f};_.r=YP.prototype;_.r.initialize=function(a){this.m=a};
34
+ LP.prototype.init=function(){var a=this,b,c,d,e,f,g;return _.I(function(k){if(1==k.a){b=_.Yn[a.h.env]||null;if(!b)throw a.g.debug(_.Ca,_.wb+a.h.env+_.aa),new _.O(_.P,6,6015,_.Da+a.h.env+"' is missing.");a.l={id:String(Math.floor(1E4*Math.random())),type:"MPEG-DASH"};c=Object.keys(a.h.customData||{}).length?btoa(JSON.stringify(a.h.customData)):"";d=_.$n(b,a.h.customData);(e=d[_.Kd])&&a.f.set(_.Kd,{Qe:e.licenseUrl||"",customData:c,hh:!1});(f=d[_.Md])&&a.f.set(_.Md,{Qe:f.licenseUrl||"",customData:c,
35
+ hh:!1});if(0===a.f.size)throw new _.O(_.P,6,6E3);if((g=a.h.preferredDrmSystem)&&a.f.get(g))a.a=g;else if(a.f.get(_.Kd))a.a=_.Kd;else if(a.f.get(_.Md))a.a=_.Md;else throw new _.O(_.P,6,6001,"Configuration for the target system is missing.");return _.y(k,OP(a),2)}a.j=!0;_.A(k)})};LP.prototype.release=function(){var a=this;return _.I(function(b){a.j=!1;a.o=null;a.a=_.Ze;a.l=null;a.f=new Map;_.A(b)})};LP.prototype.getDrmInfo=function(){return this.o};
36
+ var QP={hk:"DeleteLicenseAfterUse",jk:"LicenseServer",Gp:"GetChallenge",Hp:"HttpHeader",Jp:"UserAgent",Dp:"Cookie",fk:"CustomData"};_.r=SP.prototype;_.r.initialize=function(){this.a.on(BP,this.li,this);this.a.on(AP,this.ki,this);this.a.on(zP,this.ji,this);this.a.on(IP,this.vj,this);this.a.on(HP,this.uj,this);this.a.on(FP,this.mi,this)};_.r.release=function(){UP(this,_.mu);this.l=!1;this.o=-1;this.h=2};_.r.destroy=function(){this.release();this.a.off(BP,this.li);this.a.off(AP,this.ki);this.a.off(zP,this.ji);this.a.off(IP,this.vj);this.a.off(HP,this.uj);this.a.off(FP,this.mi);this.m=this.a=null};
37
+ _.r.li=function(){this.g.debug("Buffering start. Player state: ",this.a.getState());this.h=this.a.B?1:2;UP(this,2)};_.r.ki=function(a){this.g.debug("Buffering progress: "+a.percent+" %. Player state: ",TP(this.f))};_.r.ji=function(){this.g.debug("Buffering complete. Player state: ",this.a.getState());if(!this.l){this.l=!0;var a=this.m.getConfiguration().autoplay,b=this.a.getState()===TQ;if(!a&&b){UP(this,4);return}}if(a=1!==this.f)a=this.a.getState(),a=a===VP||a===WP;a&&XP(this)};
38
+ _.r.vj=function(){this.g.debug("Preparing starts. AVPlay State: ",this.a.getState());this.a.getState()===UQ?UP(this,1):this.g.error("AVPlay prepares while state is not IDLE")};_.r.uj=function(){this.g.debug("Preparing ends: AVPlay state:",this.a.getState())};_.r.mi=function(){UP(this,5)};_.r.getState=function(){return this.f};_.r=YP.prototype;_.r.initialize=function(a){this.m=a};
39
39
  _.r.load=function(a){var b=this,c,d,e,f,g,k,l;return _.I(function(m){switch(m.a){case 1:if(!b.m)return b.g.debug("Text streamer is not initialized. Will not load()"),m["return"]();b.B=a;c=b;return _.y(m,$P(b),2);case 2:c.j=m.f;if(!b.j)return b.g.debug("Could not find manifest parser for source. Make sure parsers are registered."),m["return"]();d={configurationId:"",networkingEngine:b.m.getNetworkEngine(),onContentSteeringInfoFound:function(){return null},filterNewPeriod:function(){},filterAllPeriods:function(){},
40
40
  onEvent:function(){},onError:function(){}};_.F(m,3);e=b;return _.y(m,b.j.start(a.url,d),5);case 5:e.a=m.f;_.G(m,4);break;case 3:return f=_.H(m),b.g.warn(f),_.F(m,6),g=b,_.y(m,b.j.start(a.url.replace(_.Ae,_.ze),d),8);case 8:g.a=m.f;_.G(m,4);break;case 6:k=_.H(m),b.g.error(k),b.a=null;case 4:if(!b.a||!ZP(b.a)){m.C(0);break}b.h=aQ(b);_.F(m,10);return _.y(m,b.h.open(),12);case 12:b.f=bQ(b);l=b.m.getConfiguration();b.f.h=l.streaming;b.o=l.preferredTextLanguage;b.A=l.preferredTextRole;b.D=l.preferForcedSubtitles;
41
- _.G(m,0);break;case 10:_.H(m),b.g.debug("Could not setup media source..."),b.h=null,b.f=null,b.j=null,b.a=null,_.A(m)}})};_.r.Pl=function(a){this.g.debug(_.dC,a.id);this.w=!0;var b=_.bG(a.textStreams,this.o||"",this.A||"",this.D)[0]||null;this.l&&(a.textStreams.includes(this.l)&&(b=this.l),this.l=null);return{video:null,audio:null,text:b,qb:null}};_.r.Ol=function(){var a=this;return _.I(function(b){if(1==b.a)return a.g.debug("canSwitch_"),a.w=!1,a.l?_.y(b,_.fH(a.f,a.l),3):b.C(0);a.l=null;_.A(b)})};
42
- _.r.Ql=function(){this.g.debug("onError_")};_.r.Rl=function(){this.j&&this.j.update&&this.j.update()};_.r.start=function(){var a=this;return _.I(function(b){if(!a.f)return b["return"]();try{a.f.start()}catch(c){a.g.error("Error while starting streaming engine",c)}_.A(b)})};_.r.setTextVisibility=function(a){this.g.debug("Set text visibility",a);this.h&&this.h.getTextDisplayer().setTextVisibility(a)};
43
- _.r.release=function(){var a=this;return _.I(function(b){a.m=null;a.a=null;a.B=null;a.A=null;a.o=null;a.w=!0;a.l=null;_.A(b)})};_.r.destroy=function(){var a=this;return _.I(function(b){switch(b.a){case 1:if(!a.j){b.C(2);break}return _.y(b,a.j.stop(),3);case 3:a.j=null;case 2:if(!a.f){b.C(4);break}return _.y(b,a.f.destroy(),5);case 5:a.f=null,a.w=!0;case 4:if(!a.h){b.C(0);break}return _.y(b,a.h.destroy(),7);case 7:a.h=null,_.A(b)}})};_.w(gQ,_.Ft);_.r=gQ.prototype;_.r.lj=function(a){var b=a.eventid;a=a.data;switch(b){case VQ:0<Object.keys(this.f).length||(this.g.debug("Loading track manager!"),this.load());b=webapis.avplay.getCurrentStreamInfo();0<b.length&&(b=+rQ(this,b[0].extra_info).Bit_rate,b=vQ(this,{bandwidth:b}))&&(this.w=b,hQ(this,b));break;case WQ:iQ(this);break;default:this.g.debug("Event type: "+b+" data: "+a)}};_.r.$g=function(a){3===a.detail.currentState&&this.m.off(_.kg,this.$g)};
44
- _.r.initialize=function(a){var b=this;this.m=a;this.a=this.m.a;this.m.on(_.kg,function(c){b.A||(c=c.detail,3===c.currentState&&(b.g.debug("Current state",c.currentState),b.A=!0,jQ(b)))});this.a.on("onevent",this.lj,this)};_.r.release=function(){this.f={};this.j=this.w=this.o=this.l=null;this.A=!1;this.h=1};
45
- _.r.load=function(){if(this.a&&!(0<Object.keys(this.f).length)){this.j=this.m.h;this.m.off(_.kg,this.$g);this.m.on(_.kg,this.$g,this);try{var a=GQ(this.a);this.f=uQ(this,a);var b=this.f[_.X]||[];b.length&&(this.l=b[0].renditions[0]||null);iQ(this)}catch(c){this.g.debug("Could not load track manager")}}};_.r.destroy=function(){this.a.off("onevent",this.lj);this.a=this.m=null};_.r.getVideoTracks=function(){return this.f[_.kt]||[]};_.r.getAudioTracks=function(){return this.f[_.X]||[]};
41
+ _.G(m,0);break;case 10:_.H(m),b.g.debug("Could not setup media source..."),b.h=null,b.f=null,b.j=null,b.a=null,_.A(m)}})};_.r.Ql=function(a){this.g.debug(_.dC,a.id);this.w=!0;var b=_.bG(a.textStreams,this.o||"",this.A||"",this.D)[0]||null;this.l&&(a.textStreams.includes(this.l)&&(b=this.l),this.l=null);return{video:null,audio:null,text:b,qb:null}};_.r.Pl=function(){var a=this;return _.I(function(b){if(1==b.a)return a.g.debug("canSwitch_"),a.w=!1,a.l?_.y(b,_.fH(a.f,a.l),3):b.C(0);a.l=null;_.A(b)})};
42
+ _.r.Rl=function(){this.g.debug("onError_")};_.r.Sl=function(){this.j&&this.j.update&&this.j.update()};_.r.start=function(){var a=this;return _.I(function(b){if(!a.f)return b["return"]();try{a.f.start()}catch(c){a.g.error("Error while starting streaming engine",c)}_.A(b)})};_.r.setTextVisibility=function(a){this.g.debug("Set text visibility",a);this.h&&this.h.getTextDisplayer().setTextVisibility(a)};
43
+ _.r.release=function(){var a=this;return _.I(function(b){a.m=null;a.a=null;a.B=null;a.A=null;a.o=null;a.w=!0;a.l=null;_.A(b)})};_.r.destroy=function(){var a=this;return _.I(function(b){switch(b.a){case 1:if(!a.j){b.C(2);break}return _.y(b,a.j.stop(),3);case 3:a.j=null;case 2:if(!a.f){b.C(4);break}return _.y(b,a.f.destroy(),5);case 5:a.f=null,a.w=!0;case 4:if(!a.h){b.C(0);break}return _.y(b,a.h.destroy(),7);case 7:a.h=null,_.A(b)}})};_.w(gQ,_.Ft);_.r=gQ.prototype;_.r.mj=function(a){var b=a.eventid;a=a.data;switch(b){case VQ:0<Object.keys(this.f).length||(this.g.debug("Loading track manager!"),this.load());b=webapis.avplay.getCurrentStreamInfo();0<b.length&&(b=+rQ(this,b[0].extra_info).Bit_rate,b=vQ(this,{bandwidth:b}))&&(this.w=b,hQ(this,b));break;case WQ:iQ(this);break;default:this.g.debug("Event type: "+b+" data: "+a)}};_.r.ah=function(a){3===a.detail.currentState&&this.m.off(_.kg,this.ah)};
44
+ _.r.initialize=function(a){var b=this;this.m=a;this.a=this.m.a;this.m.on(_.kg,function(c){b.A||(c=c.detail,3===c.currentState&&(b.g.debug("Current state",c.currentState),b.A=!0,jQ(b)))});this.a.on("onevent",this.mj,this)};_.r.release=function(){this.f={};this.j=this.w=this.o=this.l=null;this.A=!1;this.h=1};
45
+ _.r.load=function(){if(this.a&&!(0<Object.keys(this.f).length)){this.j=this.m.h;this.m.off(_.kg,this.ah);this.m.on(_.kg,this.ah,this);try{var a=GQ(this.a);this.f=uQ(this,a);var b=this.f[_.X]||[];b.length&&(this.l=b[0].renditions[0]||null);iQ(this)}catch(c){this.g.debug("Could not load track manager")}}};_.r.destroy=function(){this.a.off("onevent",this.mj);this.a=this.m=null};_.r.getVideoTracks=function(){return this.f[_.kt]||[]};_.r.getAudioTracks=function(){return this.f[_.X]||[]};
46
46
  _.r.ra=function(){return this.f[_.jt]||[]};_.r.sa=function(){return yQ(this,_.kt)};_.r.Za=function(){return yQ(this,_.X)};_.r.hb=function(){return yQ(this,_.jt)};_.r.Hb=function(){return this.w};_.r.Xb=function(){this.g.info(vP);return null};_.r.Yb=function(){this.g.info(vP);return null};_.r.Ra=function(){var a=this.sa();return a?a.track:null};_.r.qa=function(){var a=this.Za();return a?a.track:null};_.r.wa=function(){var a=this.hb();return a?a.track:null};
47
47
  _.r.Qb=function(a){var b=this;null===a?(a=this.sa(),NQ(this.a,a.bandwidth,null).then(function(){iQ(b)})):0<a.renditions.length&&this.Db(a.renditions[0])};_.r.La=function(a){a?nQ(this,a.renditions[0]):this.g.warn("Cannot disable audio tracks on this platform.","Consider muting audio instead...")};_.r.kb=function(a){a?(a=a.renditions[0],this.j?fQ(this.j,a.track):nQ(this,a)):(this.g.debug("Disabling text tracks"),this.o=null,OQ(this.a,!1),this.m.trigger(new _.Q(_.wg)))};
48
48
  _.r.Db=function(a){var b=this,c=this.sa();this.a.o||a.width!==c.width||a.height!==c.height||a.bandwidth!==c.bandwidth?(this.w=a,hQ(this,a),NQ(this.a,c.bandwidth,a.bandwidth).then(function(){iQ(b)})["catch"](function(d){var e=new _.O(_.P,7,7200,{tizenerror:d});b.g.debug("Error while switching video track",d);b.m.onError(e)})):this.g.debug("Trying to switch to already active rendition. Doing nothing...")};_.r.Ob=function(a){nQ(this,a)};_.r.Pb=function(a){this.j?fQ(this.j,a.track):nQ(this,a)};
49
49
  _.r.addTextTrack=function(){};_.r.xa=function(){return this.a.o};gQ.prototype.isAbrEnabled=gQ.prototype.xa;gQ.prototype.addTextTrack=gQ.prototype.addTextTrack;gQ.prototype.setTextRendition=gQ.prototype.Pb;gQ.prototype.setAudioRendition=gQ.prototype.Ob;gQ.prototype.setVideoRendition=gQ.prototype.Db;gQ.prototype.setTextTrack=gQ.prototype.kb;gQ.prototype.setAudioTrack=gQ.prototype.La;gQ.prototype.setVideoTrack=gQ.prototype.Qb;gQ.prototype.getTextTrack=gQ.prototype.wa;gQ.prototype.getAudioTrack=gQ.prototype.qa;
50
- gQ.prototype.getVideoTrack=gQ.prototype.Ra;gQ.prototype.getLoadingTextRendition=gQ.prototype.Yb;gQ.prototype.getLoadingAudioRendition=gQ.prototype.Xb;gQ.prototype.getLoadingVideoRendition=gQ.prototype.Hb;gQ.prototype.getTextRendition=gQ.prototype.hb;gQ.prototype.getAudioRendition=gQ.prototype.Za;gQ.prototype.getVideoRendition=gQ.prototype.sa;gQ.prototype.getTextTracks=gQ.prototype.ra;gQ.prototype.getAudioTracks=gQ.prototype.getAudioTracks;gQ.prototype.getVideoTracks=gQ.prototype.getVideoTracks;_.w(zQ,_.Ii);_.r=zQ.prototype;_.r.Jl=function(){this.w=!0;this.f||this.trigger(new _.Q(BP))};_.r.Il=function(a){this.w=!0;this.trigger(new _.Q(AP,{percent:a}))};_.r.Hl=function(){this.w=!1;this.trigger(new _.Q(zP))};_.r.Ml=function(){this.trigger(new _.Q(FP))};_.r.Ll=function(a,b){this.trigger(new _.Q("onevent",{eventid:a,data:b}))};_.r.Nl=function(a,b,c,d,e){this.trigger(new _.Q(GP,{duration:a,text:b,subtitleType:c,attriCount:d,attributes:e}))};
51
- _.r.Kl=function(a,b){this.trigger(new _.Q(DP,{drmType:a,drmData:b}));if(this.h){var c=this.h;if(c.j)if(c.a===_.Md&&"Challenge"===b.name)RP(c,b);else if("DrmError"===b.name){c.g.debug("DrmError event",b);var d=new _.O(_.P,6,6005,{message:JSON.stringify(b)});c.F.onError(d)}}};_.r.ne=function(a){this.trigger(new _.Q(EP,{eventType:a}))};
50
+ gQ.prototype.getVideoTrack=gQ.prototype.Ra;gQ.prototype.getLoadingTextRendition=gQ.prototype.Yb;gQ.prototype.getLoadingAudioRendition=gQ.prototype.Xb;gQ.prototype.getLoadingVideoRendition=gQ.prototype.Hb;gQ.prototype.getTextRendition=gQ.prototype.hb;gQ.prototype.getAudioRendition=gQ.prototype.Za;gQ.prototype.getVideoRendition=gQ.prototype.sa;gQ.prototype.getTextTracks=gQ.prototype.ra;gQ.prototype.getAudioTracks=gQ.prototype.getAudioTracks;gQ.prototype.getVideoTracks=gQ.prototype.getVideoTracks;_.w(zQ,_.Ii);_.r=zQ.prototype;_.r.Kl=function(){this.w=!0;this.f||this.trigger(new _.Q(BP))};_.r.Jl=function(a){this.w=!0;this.trigger(new _.Q(AP,{percent:a}))};_.r.Il=function(){this.w=!1;this.trigger(new _.Q(zP))};_.r.Nl=function(){this.trigger(new _.Q(FP))};_.r.Ml=function(a,b){this.trigger(new _.Q("onevent",{eventid:a,data:b}))};_.r.Ol=function(a,b,c,d,e){this.trigger(new _.Q(GP,{duration:a,text:b,subtitleType:c,attriCount:d,attributes:e}))};
51
+ _.r.Ll=function(a,b){this.trigger(new _.Q(DP,{drmType:a,drmData:b}));if(this.h){var c=this.h;if(c.j)if(c.a===_.Md&&"Challenge"===b.name)RP(c,b);else if("DrmError"===b.name){c.g.debug("DrmError event",b);var d=new _.O(_.P,6,6005,{message:JSON.stringify(b)});c.F.onError(d)}}};_.r.oe=function(a){this.trigger(new _.Q(EP,{eventType:a}))};
52
52
  _.r.play=function(){function a(){return new Promise(function(d,e){function f(){d();clearTimeout(g)}var g=null;b.one(CP,f,b);g=setTimeout(function(){b.off(CP,f);e("Timeout")},3E4)})}var b=this,c=this.getState();if(c===UQ)return(new Promise(function(d,e){webapis.avplay.prepareAsync(function(){CQ(b);d(webapis.avplay.play())},function(f){b.trigger(new _.Q(EP));e(f)})})).then(function(){return a()});if(c===WP||c===TQ)try{return webapis.avplay.play(),a()}catch(d){return Promise.reject(d)}return c===VP?
53
53
  Promise.resolve():Promise.reject("Player is in invalid state")};_.r.pause=function(){try{webapis.avplay.pause()}catch(a){Promise.reject(a)}return this.getState()===WP?Promise.resolve():Promise.reject()};
54
54
  _.r.setPlaybackRate=function(a){var b=this.getState();if(b===TQ||b===VP||b===WP){try{webapis.avplay.setSpeed(a),this.D=a}catch(c){return this.g.debug("Error while trying to set playback rate",c),this.setPlaybackRate(this.D)}return!0}this.g.debug("Cannot set playback rate; AVPlay is in inconsistent state: "+b);return!1};_.r.getPlaybackRate=function(){return this.D};
55
- _.r.load=function(a,b){var c=this,d;return _.I(function(e){switch(e.a){case 1:return c.g.debug("configure()",b||""),_.F(e,2),_.y(e,JQ(c),4);case 4:return _.y(e,MQ(c,a,b),5);case 5:_.G(e,0);break;case 2:throw d=_.H(e),new _.O(_.P,7,7003,null,d);}})};_.r.getState=function(){if(this.f&&this.a)return this.a.Th;try{return webapis.avplay.getState()}catch(a){this.ne(JSON.stringify(a))}};
56
- _.r.seek=function(a){var b=this,c=1E3*a;return new Promise(function(d,e){b.B=!0;b.m.trigger(new _.Q(_.Og));webapis.avplay.seekTo(c,function(){b.B=!1;b.m.trigger(new _.Q(_.Ng));d()},function(){b.B=!1;e()})})};_.r.getPosition=function(){if(this.f&&this.a)return this.a.position;try{return webapis.avplay.getCurrentTime()/1E3}catch(a){this.ne(JSON.stringify(a))}};_.r.getDuration=function(){if(this.f&&this.a)return this.a.duration;try{return webapis.avplay.getDuration()/1E3}catch(a){this.ne(JSON.stringify(a))}};
57
- _.r.release=function(){var a=this;return new Promise(function(b,c){try{a.h&&(a.h.release(),a.h=null);webapis.avplay.stop();webapis.avplay.close();for(var d in a.j){var e=a.j[d];e&&e.jg.stop()}a.j={};a.D=1;a.B=!1;a.l=null;a.a=null;return b()}catch(f){return c(f)}})};_.r.getVolume=function(){var a=null;try{a=tizen.tvaudiocontrol.getVolume()}catch(b){switch(b.name){case xP:this.g.debug("The application does not have the privilege to get the volume.",yP);break;default:this.g.debug(uP,b)}}return a};
55
+ _.r.load=function(a,b){var c=this,d;return _.I(function(e){switch(e.a){case 1:return c.g.debug("configure()",b||""),_.F(e,2),_.y(e,JQ(c),4);case 4:return _.y(e,MQ(c,a,b),5);case 5:_.G(e,0);break;case 2:throw d=_.H(e),new _.O(_.P,7,7003,null,d);}})};_.r.getState=function(){if(this.f&&this.a)return this.a.Uh;try{return webapis.avplay.getState()}catch(a){this.oe(JSON.stringify(a))}};
56
+ _.r.seek=function(a){var b=this,c=1E3*a;return new Promise(function(d,e){b.B=!0;b.m.trigger(new _.Q(_.Og));webapis.avplay.seekTo(c,function(){b.B=!1;b.m.trigger(new _.Q(_.Ng));d()},function(){b.B=!1;e()})})};_.r.getPosition=function(){if(this.f&&this.a)return this.a.position;try{return webapis.avplay.getCurrentTime()/1E3}catch(a){this.oe(JSON.stringify(a))}};_.r.getDuration=function(){if(this.f&&this.a)return this.a.duration;try{return webapis.avplay.getDuration()/1E3}catch(a){this.oe(JSON.stringify(a))}};
57
+ _.r.release=function(){var a=this;return new Promise(function(b,c){try{a.h&&(a.h.release(),a.h=null);webapis.avplay.stop();webapis.avplay.close();for(var d in a.j){var e=a.j[d];e&&e.kg.stop()}a.j={};a.D=1;a.B=!1;a.l=null;a.a=null;return b()}catch(f){return c(f)}})};_.r.getVolume=function(){var a=null;try{a=tizen.tvaudiocontrol.getVolume()}catch(b){switch(b.name){case xP:this.g.debug("The application does not have the privilege to get the volume.",yP);break;default:this.g.debug(uP,b)}}return a};
58
58
  _.r.setVolume=function(a){try{tizen.tvaudiocontrol.setVolume(Math.max(0,Math.min(100*a,100)))}catch(b){switch(b.name){case "InvalidValueError":this.g.warn("Invalid value passed for setVolume.","The passed value value should be in the range of 0 to 1.");break;case xP:this.g.warn("The application does not have the privilege to set the volume.",yP);break;default:this.g.warn("An unknown error occurred while trying to set volume",b)}}};
59
- _.r.isLive=function(){if(this.f&&this.a)return this.a.isLive;try{return"1"===webapis.avplay.getStreamingProperty("IS_LIVE")}catch(a){this.ne(JSON.stringify(a))}};_.r.stop=function(){try{webapis.avplay.stop()}catch(a){this.g.debug(a)}};_.r.getDrmInfo=function(){this.h&&this.h.getDrmInfo();return null};_.r.setSourceIndex=function(a){this.G=a};_.r.getSourceIndex=function(){return this.G};_.r.getLoadedSource=function(){return this.l&&this.l[this.getSourceIndex()]};
60
- var UQ="IDLE",TQ="READY",VP="PLAYING",WP="PAUSED",sQ=_.Ub,lQ=_.ja,mQ="TEXT",WQ="PLAYER_MSG_RESOLUTION_CHANGED",VQ="PLAYER_MSG_BITRATE_CHANGE",PP={PLAYREADY:"PLAYREADY",Dp:"EME_PLAYREADY",Jp:"VERIMATRIX",qf:"WIDEVINE_CDM",Ep:"EME_WIDEVINE_CDM",Lp:"WIDEVINE_CLASSIC"};_.w(PQ,_.Ii);_.r=PQ.prototype;_.r.gi=function(){var a=this;this.g.debug("On Stream completed. Current time: ",this.getPosition());this.trigger(new _.Q(_.pe));this.configuration.loop?this.seek(this.configuration.startTime||0)["catch"](function(){a.g.debug("Could not loop playback")}):this.a.stop()};_.r.di=function(a){this.trigger(new _.Q(_.Bg,{currentTime:a.currentTime/1E3}))};
61
- _.r.hi=function(a){var b=this.a.getPosition(),c=b+a.duration/1E3,d=a.text||"";this.g.debug("Got subtitles: ",d,"start:",b,"end:",c,a);(d=_.R.uh(d))&&this.o.append([new _.Jp(b,c,d)],[])};_.r.ei=function(a){this.g.debug("DRM event: "+a.drmType+", data: "+a.drmData)};_.r.mj=function(){this.A||(this.g.debug("Initial buffering completed..."),this.A=!0)};
62
- _.r.fi=function(a){this.g.debug("Error: TYPE: "+a.eventType);UP(this.f,_.Fo);a=new _.O(_.P,7,7200,{tizenerror:a.eventType});this.a.release();this.trigger(new _.Q(_.qe,{detail:a}))};
63
- _.r.init=function(a,b){this.configuration=this.B=b;this.w=a;this.a.on(FP,this.gi,this);this.a.on(CP,this.di,this);this.a.on(GP,this.hi,this);this.a.on(DP,this.ei,this);this.a.on(EP,this.fi,this);this.a.on(zP,this.mj,this);this.f.initialize();this.l.initialize(this);this.g.debug("Initializing player surface");this.w.hideMediaElement();var c=XQ;XQ+=1;this.j=_.cj(_.$e,{id:"__clpp_tizen_player_"+c,type:"application/avplayer"});this.w.addElementToContainer(this.j,!0);var d=this.w.getMedia();if(d){c=this.j;
59
+ _.r.isLive=function(){if(this.f&&this.a)return this.a.isLive;try{return"1"===webapis.avplay.getStreamingProperty("IS_LIVE")}catch(a){this.oe(JSON.stringify(a))}};_.r.stop=function(){try{webapis.avplay.stop()}catch(a){this.g.debug(a)}};_.r.getDrmInfo=function(){this.h&&this.h.getDrmInfo();return null};_.r.setSourceIndex=function(a){this.G=a};_.r.getSourceIndex=function(){return this.G};_.r.getLoadedSource=function(){return this.l&&this.l[this.getSourceIndex()]};
60
+ var UQ="IDLE",TQ="READY",VP="PLAYING",WP="PAUSED",sQ=_.Ub,lQ=_.ja,mQ="TEXT",WQ="PLAYER_MSG_RESOLUTION_CHANGED",VQ="PLAYER_MSG_BITRATE_CHANGE",PP={PLAYREADY:"PLAYREADY",Ep:"EME_PLAYREADY",Kp:"VERIMATRIX",rf:"WIDEVINE_CDM",Fp:"EME_WIDEVINE_CDM",Mp:"WIDEVINE_CLASSIC"};_.w(PQ,_.Ii);_.r=PQ.prototype;_.r.hi=function(){var a=this;this.g.debug("On Stream completed. Current time: ",this.getPosition());this.trigger(new _.Q(_.pe));this.configuration.loop?this.seek(this.configuration.startTime||0)["catch"](function(){a.g.debug("Could not loop playback")}):this.a.stop()};_.r.ei=function(a){this.trigger(new _.Q(_.Bg,{currentTime:a.currentTime/1E3}))};
61
+ _.r.ii=function(a){var b=this.a.getPosition(),c=b+a.duration/1E3,d=a.text||"";this.g.debug("Got subtitles: ",d,"start:",b,"end:",c,a);(d=_.R.vh(d))&&this.o.append([new _.Jp(b,c,d)],[])};_.r.fi=function(a){this.g.debug("DRM event: "+a.drmType+", data: "+a.drmData)};_.r.nj=function(){this.A||(this.g.debug("Initial buffering completed..."),this.A=!0)};
62
+ _.r.gi=function(a){this.g.debug("Error: TYPE: "+a.eventType);UP(this.f,_.Fo);a=new _.O(_.P,7,7200,{tizenerror:a.eventType});this.a.release();this.trigger(new _.Q(_.qe,{detail:a}))};
63
+ _.r.init=function(a,b){this.configuration=this.B=b;this.w=a;this.a.on(FP,this.hi,this);this.a.on(CP,this.ei,this);this.a.on(GP,this.ii,this);this.a.on(DP,this.fi,this);this.a.on(EP,this.gi,this);this.a.on(zP,this.nj,this);this.f.initialize();this.l.initialize(this);this.g.debug("Initializing player surface");this.w.hideMediaElement();var c=XQ;XQ+=1;this.j=_.cj(_.$e,{id:"__clpp_tizen_player_"+c,type:"application/avplayer"});this.w.addElementToContainer(this.j,!0);var d=this.w.getMedia();if(d){c=this.j;
64
64
  var e=[_.hh,_.ve,"position",_.Ee,"top"],f={};d=null!==d.parentElement?window.getComputedStyle(d,null):d.style;if(!e||0===e.length){e||(e=[]);for(var g in d)e.push(g)}g=_.v(e);for(e=g.next();!e.done;e=g.next())e=e.value,f[e]=d[e];_.ej(c,f);QQ(this)}};_.r.getSurface=function(){return this.w};_.r.getConfiguration=function(){return this.configuration};_.r.getTimeline=function(){return null};_.r.setupPlaylist=function(){return Promise.reject(_.nb)};_.r.appendLoad=function(){return Promise.reject(_.nb)};
65
65
  _.r.seekWith=function(){return Promise.reject(_.nb)};_.r.setSeekInterceptor=function(){};_.r.setPlaybackSessionId=function(){};_.r.getBandwidthEstimate=function(){return null};
66
- _.r.destroy=function(){var a=this;return _.I(function(b){switch(b.a){case 1:return _.y(b,a.release(),2);case 2:a.a.off(FP,a.gi);a.a.off(CP,a.di);a.a.off(GP,a.hi);a.a.off(DP,a.ei);a.a.off(EP,a.fi);a.a.off(zP,a.mj);if(!a.h){b.C(3);break}return _.y(b,a.h.destroy(),4);case 4:a.h=null;case 3:a.j&&(a.j.parentElement.removeChild(a.j),a.j=null),a.l.destroy(),a.f.destroy(),a.l=null,a.f=null,_.A(b)}})};_.r.namespace=function(){return YQ};_.r.getPlaybackRate=function(){return this.a.getPlaybackRate()};
66
+ _.r.destroy=function(){var a=this;return _.I(function(b){switch(b.a){case 1:return _.y(b,a.release(),2);case 2:a.a.off(FP,a.hi);a.a.off(CP,a.ei);a.a.off(GP,a.ii);a.a.off(DP,a.fi);a.a.off(EP,a.gi);a.a.off(zP,a.nj);if(!a.h){b.C(3);break}return _.y(b,a.h.destroy(),4);case 4:a.h=null;case 3:a.j&&(a.j.parentElement.removeChild(a.j),a.j=null),a.l.destroy(),a.f.destroy(),a.l=null,a.f=null,_.A(b)}})};_.r.namespace=function(){return YQ};_.r.getPlaybackRate=function(){return this.a.getPlaybackRate()};
67
67
  _.r.setDrmCustomDataModifier=function(){};_.r.setCdnErrorCallback=function(){};_.r.detach=function(){};_.r.setPlaybackRate=function(a){this.a.setPlaybackRate(a)};_.r.getPosition=function(){return this.getMediaPosition()};_.r.getMediaPosition=function(){return 0<(this.configuration.startTime||0)&&!this.A?0:5===this.f.getState()?this.getDuration():this.a.getPosition()||0};_.r.seek=function(a){return typeof a===_.h&&0<=a?(this.isLive()||(a=Math.min(a,this.getDuration())),this.a.seek(a)):Promise.reject()};
68
68
  _.r.getPresentationStartTime=function(){return null};_.r.getSeekRange=function(){return{start:0,end:0}};_.r.getVolume=function(){var a=this.a.getVolume();return typeof a===_.h?a/100:null};_.r.setVolume=function(a){this.a.setVolume(a)};_.r.getDuration=function(){return this.getMediaDuration()};_.r.getMediaDuration=function(){return this.a.getDuration()};_.r.getBufferInfo=function(){this.g.warn(_.xa);return new _.mi};_.r.getTrackManager=function(){return this.l};_.r.unload=function(){var a=this;return this.a.release().then(function(){a.l.release()})};
69
69
  _.r.release=function(){var a=this;return _.I(function(b){switch(b.a){case 1:if(!a.h){b.C(2);break}return _.y(b,a.h.release(),2);case 2:if(!a.o){b.C(4);break}return _.y(b,a.o.destroy(),5);case 5:a.o=null;case 4:return _.y(b,a.a.release(),6);case 6:a.l.release(),a.f.release(),a.A=!1,_.A(b)}})};