@castlabs/prestoplay 6.25.2 → 6.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +5 -5
  3. package/cjs/cl.adobe.js +3 -3
  4. package/cjs/cl.airplay.js +3 -3
  5. package/cjs/cl.broadpeak.js +7 -7
  6. package/cjs/cl.cast.js +112 -112
  7. package/cjs/cl.conviva.js +32 -32
  8. package/cjs/cl.core.js +601 -600
  9. package/cjs/cl.crypto.js +9 -9
  10. package/cjs/cl.dash.js +89 -88
  11. package/cjs/cl.externs.js +37 -31
  12. package/cjs/cl.freewheel.js +24 -24
  13. package/cjs/cl.hls.js +77 -77
  14. package/cjs/cl.hlssmpte.js +6 -6
  15. package/cjs/cl.htmlcue.js +30 -30
  16. package/cjs/cl.ima.js +23 -23
  17. package/cjs/cl.mediatailor.js +3 -3
  18. package/cjs/cl.mse.js +341 -334
  19. package/cjs/cl.muxdata.js +15 -15
  20. package/cjs/cl.onboard.js +3 -3
  21. package/cjs/cl.persistent.js +14 -14
  22. package/cjs/cl.playlist.js +6 -6
  23. package/cjs/cl.sessions.js +16 -16
  24. package/cjs/cl.simid.js +17 -17
  25. package/cjs/cl.smooth.js +72 -72
  26. package/cjs/cl.thumbnails.js +26 -26
  27. package/cjs/cl.tizen.js +71 -71
  28. package/cjs/cl.ttml.js +29 -29
  29. package/cjs/cl.verimatrix.js +5 -5
  30. package/cjs/cl.vimond.js +12 -12
  31. package/cjs/cl.vr.js +19 -19
  32. package/cjs/cl.vtt.js +14 -14
  33. package/cjs/cl.yospace.js +4 -4
  34. package/cjs/cl.youbora.js +38 -36
  35. package/cl.adobe.js +3 -3
  36. package/cl.airplay.js +3 -3
  37. package/cl.broadpeak.js +5 -5
  38. package/cl.cast.js +87 -87
  39. package/cl.conviva.js +27 -27
  40. package/cl.core.js +489 -488
  41. package/cl.crypto.js +9 -9
  42. package/cl.dash.js +82 -82
  43. package/cl.externs.js +37 -31
  44. package/cl.freewheel.js +19 -19
  45. package/cl.hls.js +79 -80
  46. package/cl.hlssmpte.js +5 -5
  47. package/cl.htmlcue.js +26 -26
  48. package/cl.ima.js +17 -17
  49. package/cl.mediatailor.js +3 -3
  50. package/cl.mse.js +299 -292
  51. package/cl.muxdata.js +13 -13
  52. package/cl.onboard.js +4 -4
  53. package/cl.persistent.js +10 -10
  54. package/cl.playlist.js +5 -5
  55. package/cl.sessions.js +10 -10
  56. package/cl.simid.js +14 -14
  57. package/cl.smooth.js +60 -60
  58. package/cl.thumbnails.js +19 -19
  59. package/cl.tizen.js +57 -57
  60. package/cl.ttml.js +22 -22
  61. package/cl.verimatrix.js +4 -4
  62. package/cl.vimond.js +8 -8
  63. package/cl.vr.js +14 -14
  64. package/cl.vtt.js +12 -12
  65. package/cl.yospace.js +3 -3
  66. package/cl.youbora.js +28 -27
  67. package/package.json +3 -3
  68. package/typings.d.ts +41 -3
package/cjs/cl.tizen.js CHANGED
@@ -1,76 +1,76 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var IN="An unknown error occurred while trying to get volume",JN="Cannot get loading rendition due to platform limitations",KN="PARAM_START_POSITION",LN="SecurityError",MN="The require privilege is: http://tizen.org/privilege/tv.audio",NN="|STARTBITRATE\x3d",ON=function(a,b,c){function d(e){c.call(a,e);a.removeEventListener(b,d)}a.addEventListener(b,d)},PN=function(a,b){this.h=a;this.o=null;this.a=_.Qe;this.l=null;this.j=!1;this.f=new Map;this.F=b;this.g=new _.J("clpp.tizen.DrmEngine")},SN=function(a){var b,
3
- c,d;return _.H(function(e){if(1==e.a){b=a.a===_.Gd||a.a===_.Ed;if(!b)throw new _.N(_.O,6,6001,"The key system "+a.a+" is not supported by the player or the platform");c=a.f.get(a.a);if(!c.ue)throw new _.N(_.O,6,6012,"No license server given for "+a.a);_.C(e,2);return a.a===_.Gd?_.x(e,QN(a),5):_.x(e,RN(a,c),5)}if(2!=e.a)return a.o={keySystem:a.a,licenseServerUri:c.ue,distinctiveIdentifierRequired:!1,persistentStateRequired:c.Cg,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[],
4
- keyIds:[],periodId:null},_.uh(e,0);d=_.E(e);a.g.error("Error while configuring CDM for "+a.a,d);throw new _.N(_.O,6,6005,{message:JSON.stringify(d)});})},RN=function(a,b){var c,d,e,f;return _.H(function(g){c=TN;d=UN;e={};e[d.uj]=!b.Cg;e[d.yj]=b.ue;""!==b.customData&&(e[d.tj]=b.customData);f=JSON.stringify(e);a.g.debug("PlayReady properties: ",f);try{webapis.avplay.setDrm(c.PLAYREADY,"SetProperties",f)}catch(h){throw h;}_.y(g)})},QN=function(a){var b;return _.H(function(c){b=TN;try{webapis.avplay.setDrm(b.Pe,
5
- "Initialize",""),webapis.avplay.setDrm(b.Pe,"widevine_app_session",a.l.id),webapis.avplay.setDrm(b.Pe,"widevine_data_type",a.l.type)}catch(d){throw d;}_.y(c)})},VN=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,t,v,z,A,D,G;_.H(function(B){if(1==B.a){c=TN;d=a.f.get(a.a);a.g.debug("DRM Challenge data: ",b.challenge);e=atob(b.challenge);f=new Uint8Array(e.length);for(g=0;g<e.length;++g)f[g]=e.charCodeAt(g);h=b.serverurl&&""!==b.serverurl?b.serverurl:d.ue;l=_.ck([h],_.Yj());l.type=3;l.body=f.buffer;l.method=
6
- _.sb;_.C(B,2);return _.x(B,a.F.Db.fetch(l).S,4)}if(2!=B.a){m=B.f;if(a.j){n=_.Oj(m.data);p=n.byteLength;q="";for(t=0;t<p;t++)q+=String.fromCharCode(n[t]);v=btoa(q);z=b.session_id+KN+(v+KN);a.g.debug("Widevine license params",z);try{webapis.avplay.setDrm(c.Pe,"widevine_license_data",z)}catch(F){a.g.error("License response rejected by CDM"),A=new _.N(_.O,6,6008,{browserError:JSON.stringify(F)}),a.F.onError(A)}}return _.uh(B,0)}D=_.E(B);a.g.error("License request failed.",JSON.stringify(D));G=new _.N(_.O,
7
- 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(G);_.y(B)})},WN=function(a){this.m=a;this.a=this.m.a;this.f=_.tq;this.j=_.uq;this.w=(new Date).getTime();this.l=!1;this.o=-1;this.h=2;this.g=new _.J("clpp.tizen.StateManager")},YN=function(a,b){if(a.f!==b)if(a.f===_.Eq&&b!==_.tq)a.g.debug(_.UC+XN(b));else{var c=(new Date).getTime();a.j=a.f;a.f=b;a.f===_.yq?(a.o=(new Date).getTime(),a.m.trigger(new _.K(_.ad,
8
- {detail:{bufferedTimeMS:-1,reason:a.h}}))):a.j===_.yq&&a.m.trigger(new _.K(_.$c,{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 _.K(_.bg,{detail:d}));a.g.debug("State changed:",XN(a.j),"-\x3e",XN(a.f))}},XN=function(a){return Object.keys(_.Cq)[a]},aO=function(a){if(a.l){var b=a.a.getState(),c=a.f;switch(b){case ZN:c=_.Hq;break;case $N:c=_.Gq;break;default:a.m.isEnded()?c=_.Aq:a.g.debug("Inconsistent AVPlay playback state:",
9
- b)}YN(a,c)}},bO=function(){this.o=this.A=this.f=this.h=this.B=this.m=this.j=this.a=null;this.C=!1;this.w=!0;this.l=null;this.g=new _.J("clpp.tizen.TextStreamer")},cO=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},dO=function(a){var b,c;return _.H(function(d){if(1==d.a)return b=a.m.getConfiguration(),c=null,_.x(d,_.av(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)})},
10
- eO=function(a){var b=document.createElement(_.Jg),c=new _.AG,d=new _.cE,e=a.m.getTextDisplayer();return new _.CG(b,c,e,d,a.m.getConfiguration())},fO=function(a){var b={configuration:{},Pb:function(){return a.m.getPosition()},X:a.h,Db:a.m.getNetworkEngine(),od:null,ug:a.gl.bind(a),tg:a.fl.bind(a),onError:a.hl.bind(a),Ii:function(){},onEvent:function(){},Ni:a.il.bind(a),uf:function(){},fe:function(){return new _.pH},Wf:function(){return!1},$d:null};return new _.WH(a.a,b)},gO=function(a){var b=a.m.getPosition(),
11
- c=null;a=_.u(a.a.periods);for(var d=a.next();!d.done;d=a.next())d=d.value,d.startTime<=b&&(c=d);return c},hO=function(a){a.g.debug("getTextStreams()",a.a);if(a.a){var b=[],c=a.a.periods;a.g.debug("getting text streams");for(var d=0;d<c.length;d++)if(a.g.debug(c[d].startTime,a.m.getPosition()),c[d].startTime<=a.m.getPosition()){b=c[d].textStreams;break}a=b}else a=[];b=[];for(d=c=0;d<a.length;d++){var e=new _.Dk(String(c++),_.S);e.mimeType=a[d].mimeType;e.language=a[d].language;e.roles=a[d].roles;e.kind=
12
- a[d].kind||_.rD;var f=new _.Lk(String(a[d].id),e);f.bandwidth=a[d].bandwidth||null;e.renditions.push(f);b.push(e)}return b},iO=function(a){if(a.h&&!a.h.getTextDisplayer().isTextVisible())return null;if(a.f){var b=_.ZH(a.f,_.pj),c=null;if(b){a=hO(a);for(var d=0;d<a.length;d++)if(a[d].renditions[0].id===String(b.id)){c=a[d].renditions[0];break}}return c}return null},jO=function(a,b){a.g.debug("Set active track",b);if(b&&(a.o=b.language,a.A=b.roles[0]||"",a.C=b.kind===_.ke,a.a&&a.f)){a.setTextVisibility(!0);
13
- var c=gO(a),d=b.renditions[0];(c=c.textStreams.find(function(e){return String(e.id)===d.id}))?(a.w?(a.g.debug("Switching period defer text selection"),a.l=c):(_.kI(a.f,c,!0,0),a.m.trigger(new _.K(_.mg))),a.o=c.language):a.g.error("No stream with id",d.id)}},kO=function(){this.j=this.a=this.m=null;this.f={};this.g=new _.J("clpp.tizen.TrackManager");this.w=this.o=this.l=null;this.A=!1;this.h=1},lO=function(a,b){a.m.trigger(new _.K(_.Ng,{details:{width:b.width,height:b.height,bandwidth:b.bandwidth,track:b.track,
14
- abrSelection:a.a.o}}))},mO=function(a){var b=a.ma();b&&a.m.trigger(new _.K(_.Yc,{detail:{width:b.width,height:b.height,bandwidth:b.bandwidth,rendition:b}}))},nO=function(a){var b=a.m.getConfiguration(),c=_.Gi(b.preferredAudioLanguage||[]),d=a.f[_.T]||[];if(d.length){var e=null;c.some(function(g){e=_.OD(g,d.map(function(h){return h.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)}),
15
- 0<f.length&&(c=f[0]));a.g.debug("Setting audio track with preferred language:",e);a.Ia(c)}else a.g.debug("Preferred language(s) not available")}else a.g.debug("Could not set preferred audio language")},rO=function(a,b){if(b){var c=b.track.type.toUpperCase();oO(a.a,c,Number(b.id)).then(function(){c===pO&&(a.l=b,a.m.trigger(new _.K(_.Wc)));c===qO&&(a.o=b,a.m.trigger(new _.K(_.mg)))})["catch"](function(){a.g.error("Could not select "+c+" track.")})}else a.g.debug("Must provide valid rendition")},sO=
16
- function(a,b,c){var d=_.Cj(b.language||_.wg);c.language=_.Ek(d);c.originalLanguage=d;c.channelsCount=b.channels?Number(b.channels):null;c.mimeType=_.Tc;a=new _.Lk(String(a),c);a.track=c;a.codec=b.fourCC||null;a.bandwidth=b.bit_rate||null;return a},tO=function(a,b,c){c.mimeType=_.Lg;a=new _.Lk(String(a),c);a.track=c;a.width=b.Width||null;a.height=b.Height||null;a.bandwidth=b.Bit_rate?Number(b.Bit_rate):null;a.codec=b.fourCC||null;return a},uO=function(a,b,c){b=_.Cj(b.track_lang||_.wg);c.mimeType="text/ttml";
17
- c.language=_.Ek(b);c.originalLanguage=b;c.kind=_.rD;return new _.Lk(String(a),c)},vO=function(a,b){var c=null;try{c=JSON.parse(b)}catch(d){a.g.warn("Couldn't retrieve extra infos from stream."),c=null}return c},yO=function(a,b){function c(n,p){for(var q=0;q<n.length;q++)if(n[q].language===p)return n[q];return null}var d={};if(0>=b.length)return d;for(var e=b.filter(function(n){return n.type===wO}),f=b.filter(function(n){return n.type===pO}),g=[],h=0;h<f.length;h++){var l=vO(a,f[h].extra_info);if(l){var m=
18
- _.Cj(l.language||_.wg);m=_.Ek(m);m=c(g,m);m||(m=new _.Dk(String(a.h++),_.T),g.push(m));m.renditions.push(sO(f[h].index,l,m))}else a.g.warn("Skipping audio stream with no extra info")}f=new _.Dk(String(a.h++),_.Fk);for(h=0;h<e.length;h++)(l=vO(a,e[h].extra_info))?f.renditions.push(tO(e[h].index,l,f)):a.g.warn("Skipping video stream with no extra info");e=[];e=a.j?hO(a.j):xO(a,b);d[_.Fk]=[f];d[_.T]=g;d[_.S]=e;return d},xO=function(a,b){for(var c=b.filter(function(h){return h.type===qO}),d=[],e=0;e<
19
- c.length;e++){var f=vO(a,c[e].extra_info);if(f){var g=new _.Dk(String(a.h++),_.S);g.renditions.push(uO(c[e].index,f,g));d.push(g)}else a.g.warn("Skipping text stream with no extra info")}return d},zO=function(a,b){for(var c=a.f[_.Fk]||[],d=[],e=0;e<c.length;e++)for(var f=0;f<c[e].renditions.length;f++)_.L.pa(c[e].renditions[f],b,Object.keys(b))&&d.push(c[e].renditions[f]);return d[0]||null},AO=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===
20
- b){c=a[d].renditions[e];break}return c},CO=function(a,b){if(b===_.S&&a.j)return iO(a.j);var c=BO(a.a)||[];if(0===c.length)return null;c=c.filter(function(e){return e.type===b.toUpperCase()})[0];var d=null;b===_.Fk&&(d=vO(a,c.extra_info),d=zO(a,{width:d.Width,height:d.Height}));b===_.T&&(c?(d=AO(a,c,_.T),a.l=d):d=a.l);b===_.S&&(c?(d=AO(a,c,_.S),a.o=d):d=a.o);return d},DO=function(a){_.mm.call(this);this.m=a;this.h=null;this.g=new _.J("clpp.tizen.Middleware");this.C=1;this.B=!1;this.l=null;this.G=0;
21
- this.o=!0;this.f=!1;this.a=null;this.A=1;this.w=!1;this.j={}},EO=function(a){return _.H(function(b){tizen.systeminfo.getPropertyValue("DISPLAY",function(c){a.A=c.resolutionWidth/1920;a.g.debug("Display resolution ratio: ",a.A)},function(c){a.g.debug("Could not load DISPLAY property");throw c;});_.y(b)})},GO=function(a){try{webapis.avplay.setListener({onbufferingstart:a.Zk.bind(a),onbufferingprogress:a.Yk.bind(a),onbufferingcomplete:a.Xk.bind(a),onstreamcompleted:a.cl.bind(a),oncurrentplaytime:function(b){a.trigger(new _.K(FO,
22
- {currentTime:b}))},onevent:a.al.bind(a),onsubtitlechange:a.el.bind(a),ondrmevent:a.$k.bind(a),onerror:a.Wd.bind(a)})}catch(b){a.g.error(b)}},HO=function(a){var b=!!a.m.getTrackManager().Wa();try{webapis.avplay.setSilentSubtitle(!b)}catch(c){a.g.debug("Could not set AVPlay subtitle config",c)}},IO=function(a,b){try{var c=b.estimatedBandwidth||0,d=b.currentBandwidth||0;a.g.debug({estimatedBandwidth:c,jp:d});0!==c&&0!==d&&c>=1.15*d&&webapis.avplay.setStreamingProperty("ADAPTIVE_INFO",NN+d)}catch(e){a.g.debug(e)}},
23
- JO=function(a,b){try{webapis.avplay.setStreamingProperty("ADAPTIVE_INFO","|BITRATES\x3d"+b+NN+b)}catch(c){throw a.g.debug("Could not set fixed bandwidth",c),c;}},MO=function(a){return{position:a.getPosition(),state:a.m.getState(),ph:a.getState(),playbackRate:a.getPlaybackRate(),isLive:a.isLive(),duration:a.getDuration(),isMuted:KO(a),volume:a.getVolume(),Eo:LO(a),ul:BO(a)}},OO=function(a){var b,c;return _.H(function(d){if(1==d.a)return _.x(d,NO(),2);if(3!=d.a)return b=new Promise(function(e){(new _.Xh(e)).ga(5)}),
24
- _.x(d,Promise.race([EO(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"),d["return"](Promise.reject("SDK Timeout"));_.y(d)})},UO=function(a,b,c){var d,e,f,g,h,l,m,n;return _.H(function(p){switch(p.a){case 1:a.l=_.Lq(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 _.K(PO)),f=c.currentPosition);
25
- _.C(p,2);g=a.l[d].url;h=a.l[d].type;h!==_.Ic||g.includes(".mpd")||(l=new URL(g),l.searchParams.append("cl-ext",".mpd"),g=l.toString());webapis.avplay.open(g);e.nextBandwidth?(JO(a,e.nextBandwidth),a.o=!1):(a.o||IO(a,e),a.o=!0);GO(a);if(!b.drm||!b.drm.env){a.g.debug("No DRM configuration was provided. Assuming clear content");p.D(4);break}m={onError:function(q){return a.m.onError(q)},Db:a.m.getNetworkEngine()};a.h=new PN(b.drm,m);return _.x(p,a.h.init(),4);case 4:return a.f||a.trigger(new _.K(QO)),
26
- _.x(p,RO(a),6);case 6:a.f||a.trigger(new _.K(SO));f&&typeof f===_.k&&0<f&&a.seek(f)["catch"](function(q){a.g.debug("Couldn't set start position",q)});a.f||(b.volume&&a.setVolume(b.volume),b.muted&&TO(a,b.muted),b.autoplay&&a.m.play()["catch"](function(q){a.g.debug("Autoplay failed",q)}));_.uh(p,0);break;case 2:throw n=_.E(p),a.g.debug("Error while attempting to load source."),n;}})},RO=function(a){return _.H(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!");
27
- HO(a);c()},function(e){a.g.debug("prepareAsync failed",e);d(e)})}catch(e){a.g.debug("Failed to prepare media player for playback"),d(e)}}))})},VO=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=MO(a);a.f=!0;webapis.avplay.stop();webapis.avplay.close();return a.load(a.m.getConfiguration(),d).then(function(){var e=a.a.ph;a.f=!1;a.a=
28
- null;return e===$N?a.pause():a.play()})}catch(e){return Promise.reject(e)}},LO=function(a){return a.f&&a.a?a.a.Eo:webapis.avplay.getTotalTrackInfo()},BO=function(a){return a.f&&a.a?a.a.ul:webapis.avplay.getCurrentStreamInfo()},oO=function(a,b,c){b=b.toUpperCase();b===qO&&WO(a,!0);var d=a.j[b];d&&(d.Ff.stop(),a.j[b]=null,a.g.debug("Cancelled pending track switch for "+b));return new Promise(function(e,f){function g(h,l,m){m=void 0===m?!1:m;try{webapis.avplay.setSelectTrack(h,l),a.j[h]=null,e()}catch(n){a.g.debug("Could not set "+
29
- h+" track. Trying again...AVPlay state: "+(a.getState()+", buffering: ")+a.w,n),!1===m&&(a.j[h]={type:h,index:l,lh:0,Ff:new _.Xh(function(){return g(h,c,!0)})}),(l=a.j[h])&&3>l.lh?(!a.w&&++l.lh,l.Ff.ga(a.w?.5:.25)):(a.g.debug("Could not set track after multiple attempts.Giving up..."),l&&l.Ff.stop(),a.j[h]=null,f())}}g(b,c)})},WO=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",
30
- d)}},TO=function(a,b){try{tizen.tvaudiocontrol.setMute(b)}catch(c){switch(c.name){case LN:a.g.warn("The application does not have the privilege to set mute.",MN);break;default:a.g.warn(IN,c)}}},KO=function(a){var b=null;try{b=tizen.tvaudiocontrol.isMute()}catch(c){switch(c.name){case LN:a.g.warn("The application doesn't have the privilege to get the mute state.",MN);break;default:a.g.warn(IN,c)}}return!!b},NO=function(){return new Promise(function(a,b){if(window.webapis)a();else{var c=document.createElement("script");
31
- ON(c,_.Be,function(d){return a(d)});ON(c,_.ie,function(d){return b(d)});c.src="$WEBAPIS/webapis/webapis.js";document.querySelector("head").appendChild(c)}})},XO=function(){_.mm.call(this);this.a=new DO(this);this.f=new WN(this);this.configuration=this.B=_.tm();this.w=null;this.g=new _.J("clpp.tizen.Player");this.j=null;this.l=new kO;this.C=new _.vk;this.o=this.h=null;this.A=!1},YO=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*
32
- a.A),e=Math.floor(b.width*a.A);b=Math.floor(b.height*a.A);a.g.debug("Setting display area to","x:",c,"y:",d,"width:",e,"height:",b);webapis.avplay.setDisplayRect(c,d,e,b);0===c&&0===d&&1920===e&&1080===b&&webapis.avplay.setDisplayMethod("PLAYER_DISPLAY_MODE_LETTER_BOX")}else a.g.debug("Could not apply dimension. Player state "+a.a.getState())},ZO=function(){},$O=function(){};
33
- PN.prototype.init=function(){var a=this,b,c,d,e,f,g;return _.H(function(h){if(1==h.a){b=_.Vm[a.h.env]||null;if(!b)throw a.g.debug(_.Ea,_.xb+a.h.env+_.aa),new _.N(_.O,6,6015,_.Fa+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=_.Xm(b,a.h.customData);(e=d[_.Ed])&&a.f.set(_.Ed,{ue:e.licenseUrl||"",customData:c,Cg:!1});(f=d[_.Gd])&&a.f.set(_.Gd,{ue:f.licenseUrl||"",customData:c,
34
- Cg:!1});if(0===a.f.size)throw new _.N(_.O,6,6E3);if((g=a.h.preferredDrmSystem)&&a.f.get(g))a.a=g;else if(a.f.get(_.Ed))a.a=_.Ed;else if(a.f.get(_.Gd))a.a=_.Gd;else throw new _.N(_.O,6,6001,"Configuration for the target system is missing.");return _.x(h,SN(a),2)}a.j=!0;_.y(h)})};PN.prototype.release=function(){var a=this;return _.H(function(b){a.j=!1;a.o=null;a.a=_.Qe;a.l=null;a.f=new Map;_.y(b)})};PN.prototype.getDrmInfo=function(){return this.o};
35
- var UN={uj:"DeleteLicenseAfterUse",yj:"LicenseServer",Uo:"GetChallenge",Vo:"HttpHeader",Xo:"UserAgent",Ro:"Cookie",tj:"CustomData"};_.r=WN.prototype;_.r.initialize=function(){this.a.on(PO,this.Gh,this);this.a.on(aP,this.Fh,this);this.a.on(bP,this.Eh,this);this.a.on(QO,this.Pi,this);this.a.on(SO,this.Oi,this);this.a.on(cP,this.Hh,this)};_.r.release=function(){YN(this,_.tq);this.l=!1;this.o=-1;this.h=2};_.r.destroy=function(){this.release();this.a.off(PO,this.Gh);this.a.off(aP,this.Fh);this.a.off(bP,this.Eh);this.a.off(QO,this.Pi);this.a.off(SO,this.Oi);this.a.off(cP,this.Hh);this.m=this.a=null};
36
- _.r.Gh=function(){this.g.debug("Buffering start. Player state: ",this.a.getState());this.h=this.a.B?1:2;YN(this,_.yq)};_.r.Fh=function(a){this.g.debug("Buffering progress: "+a.percent+" %. Player state: ",XN(this.f))};_.r.Eh=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()===dP;if(!a&&b){YN(this,_.Gq);return}}if(a=this.f!==_.Fq)a=this.a.getState(),a=a===ZN||a===$N;a&&aO(this)};
37
- _.r.Pi=function(){this.g.debug("Preparing starts. AVPlay State: ",this.a.getState());this.a.getState()===eP?YN(this,_.Fq):this.g.error("AVPlay prepares while state is not IDLE")};_.r.Oi=function(){this.g.debug("Preparing ends: AVPlay state:",this.a.getState())};_.r.Hh=function(){YN(this,_.Aq)};_.r.getState=function(){return this.f};_.r=bO.prototype;_.r.initialize=function(a){this.m=a};
38
- _.r.load=function(a){var b=this,c,d,e,f,g,h,l;return _.H(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 _.x(m,dO(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(){},
39
- onEvent:function(){},onError:function(){}};_.C(m,3);e=b;return _.x(m,b.j.start(a.url,d),5);case 5:e.a=m.f;_.uh(m,4);break;case 3:return f=_.E(m),b.g.warn(f),_.C(m,6),g=b,_.x(m,b.j.start(a.url.replace("https://","http://"),d),8);case 8:g.a=m.f;_.uh(m,4);break;case 6:h=_.E(m),b.g.error(h),b.a=null;case 4:if(!b.a||!cO(b.a)){m.D(0);break}b.h=eO(b);_.C(m,10);return _.x(m,b.h.open(),12);case 12:b.f=fO(b);l=b.m.getConfiguration();b.f.h=l.streaming;b.o=l.preferredTextLanguage;b.A=l.preferredTextRole;b.C=
40
- l.preferForcedSubtitles;_.uh(m,0);break;case 10:_.E(m),b.g.debug("Could not setup media source..."),b.h=null,b.f=null,b.j=null,b.a=null,_.y(m)}})};_.r.gl=function(a){this.g.debug(_.lD,a);this.w=!0;var b=_.oH(a.textStreams,this.o||"",this.A||"",this.C)[0]||null;this.l&&(a.textStreams.includes(this.l)&&(b=this.l),this.l=null);return{video:null,audio:null,text:b,eb:null}};_.r.fl=function(){this.g.debug("canSwitch_");this.w=!1;this.l&&(_.kI(this.f,this.l,!0,0),this.l=null)};_.r.hl=function(){this.g.debug("onError_")};
41
- _.r.il=function(){this.j&&this.j.update&&this.j.update()};_.r.start=function(){var a=this;return _.H(function(b){if(!a.f)return b["return"]();try{a.f.start()}catch(c){a.g.error("Error while starting streaming engine",c)}_.y(b)})};_.r.setTextVisibility=function(a){this.g.debug("Set text visibility",a);this.h&&this.h.getTextDisplayer().setTextVisibility(a)};_.r.release=function(){var a=this;return _.H(function(b){a.m=null;a.a=null;a.B=null;a.A=null;a.o=null;a.w=!0;a.l=null;_.y(b)})};
42
- _.r.destroy=function(){var a=this;return _.H(function(b){switch(b.a){case 1:if(!a.j){b.D(2);break}return _.x(b,a.j.stop(),3);case 3:a.j=null;case 2:if(!a.f){b.D(4);break}return _.x(b,a.f.destroy(),5);case 5:a.f=null,a.w=!0;case 4:if(!a.h){b.D(0);break}return _.x(b,a.h.destroy(),7);case 7:a.h=null,_.y(b)}})};_.w(kO,_.gl);_.r=kO.prototype;_.r.Gi=function(a){var b=a.eventid;a=a.data;switch(b){case fP:0<Object.keys(this.f).length||(this.g.debug("Loading track manager!"),this.load());b=webapis.avplay.getCurrentStreamInfo();0<b.length&&(b=+vO(this,b[0].extra_info).Bit_rate,b=zO(this,{bandwidth:b}))&&(this.w=b,lO(this,b));break;case gP:mO(this);break;default:this.g.debug("Event type: "+b+" data: "+a)}};_.r.yg=function(a){a.detail.currentState===_.Hq&&this.m.off(_.bg,this.yg)};
43
- _.r.initialize=function(a){var b=this;this.m=a;this.a=this.m.a;this.m.on(_.bg,function(c){b.A||(c=c.detail,c.currentState===_.Hq&&(b.g.debug("Current state",c.currentState),b.A=!0,nO(b)))});this.a.on(hP,this.Gi,this)};_.r.release=function(){this.f={};this.j=this.w=this.o=this.l=null;this.A=!1;this.h=1};
44
- _.r.load=function(){if(this.a&&!(0<Object.keys(this.f).length)){this.j=this.m.h;this.m.off(_.bg,this.yg);this.m.on(_.bg,this.yg,this);try{var a=LO(this.a);this.f=yO(this,a);var b=this.f[_.T]||[];b.length&&(this.l=b[0].renditions[0]||null);mO(this)}catch(c){this.g.debug("Could not load track manager")}}};_.r.destroy=function(){this.a.off(hP,this.Gi);this.a=this.m=null};_.r.getVideoTracks=function(){return this.f[_.Fk]||[]};_.r.getAudioTracks=function(){return this.f[_.T]||[]};
45
- _.r.la=function(){return this.f[_.S]||[]};_.r.ma=function(){return CO(this,_.Fk)};_.r.Sa=function(){return CO(this,_.T)};_.r.Wa=function(){return CO(this,_.S)};_.r.Ab=function(){return this.w};_.r.Mb=function(){this.g.info(JN);return null};_.r.Nb=function(){this.g.info(JN);return null};_.r.La=function(){var a=this.ma();return a?a.track:null};_.r.qa=function(){var a=this.Sa();return a?a.track:null};_.r.Ba=function(){var a=this.Wa();return a?a.track:null};
46
- _.r.Ib=function(a){var b=this;null===a?(a=this.ma(),VO(this.a,a.bandwidth,null).then(function(){mO(b)})):0<a.renditions.length&&this.sb(a.renditions[0])};_.r.Ia=function(a){a?rO(this,a.renditions[0]):this.g.warn("Cannot disable audio tracks on this platform.","Consider muting audio instead...")};_.r.Xa=function(a){a?(a=a.renditions[0],this.j?jO(this.j,a.track):rO(this,a)):(this.g.debug("Disabling text tracks"),this.o=null,WO(this.a,!1),this.m.trigger(new _.K(_.mg)))};
47
- _.r.sb=function(a){var b=this,c=this.ma();this.a.o||a.width!==c.width||a.height!==c.height||a.bandwidth!==c.bandwidth?(this.w=a,lO(this,a),VO(this.a,c.bandwidth,a.bandwidth).then(function(){mO(b)})["catch"](function(d){var e=new _.N(_.O,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.Gb=function(a){rO(this,a)};_.r.Hb=function(a){this.j?jO(this.j,a.track):rO(this,a)};
48
- _.r.addTextTrack=function(){};_.r.va=function(){return this.a.o};kO.prototype.isAbrEnabled=kO.prototype.va;kO.prototype.addTextTrack=kO.prototype.addTextTrack;kO.prototype.setTextRendition=kO.prototype.Hb;kO.prototype.setAudioRendition=kO.prototype.Gb;kO.prototype.setVideoRendition=kO.prototype.sb;kO.prototype.setTextTrack=kO.prototype.Xa;kO.prototype.setAudioTrack=kO.prototype.Ia;kO.prototype.setVideoTrack=kO.prototype.Ib;kO.prototype.getTextTrack=kO.prototype.Ba;kO.prototype.getAudioTrack=kO.prototype.qa;
49
- kO.prototype.getVideoTrack=kO.prototype.La;kO.prototype.getLoadingTextRendition=kO.prototype.Nb;kO.prototype.getLoadingAudioRendition=kO.prototype.Mb;kO.prototype.getLoadingVideoRendition=kO.prototype.Ab;kO.prototype.getTextRendition=kO.prototype.Wa;kO.prototype.getAudioRendition=kO.prototype.Sa;kO.prototype.getVideoRendition=kO.prototype.ma;kO.prototype.getTextTracks=kO.prototype.la;kO.prototype.getAudioTracks=kO.prototype.getAudioTracks;kO.prototype.getVideoTracks=kO.prototype.getVideoTracks;_.w(DO,_.mm);_.r=DO.prototype;_.r.Zk=function(){this.w=!0;this.f||this.trigger(new _.K(PO))};_.r.Yk=function(a){this.w=!0;this.trigger(new _.K(aP,{percent:a}))};_.r.Xk=function(){this.w=!1;this.trigger(new _.K(bP))};_.r.cl=function(){this.trigger(new _.K(cP))};_.r.al=function(a,b){this.trigger(new _.K(hP,{eventid:a,data:b}))};_.r.el=function(a,b,c,d,e){this.trigger(new _.K(iP,{duration:a,text:b,subtitleType:c,attriCount:d,attributes:e}))};
50
- _.r.$k=function(a,b){this.trigger(new _.K(jP,{drmType:a,drmData:b}));if(this.h){var c=this.h;if(c.j)if(c.a===_.Gd&&"Challenge"===b.name)VN(c,b);else if("DrmError"===b.name){c.g.debug("DrmError event",b);var d=new _.N(_.O,6,6005,{message:JSON.stringify(b)});c.F.onError(d)}}};_.r.Wd=function(a){this.trigger(new _.K(kP,{eventType:a}))};
51
- _.r.play=function(){function a(){return new Promise(function(d,e){function f(){d();clearTimeout(g)}var g=null;b.one(FO,f,b);g=setTimeout(function(){b.off(FO,f);e("Timeout")},3E4)})}var b=this,c=this.getState();if(c===eP)return(new Promise(function(d,e){webapis.avplay.prepareAsync(function(){HO(b);d(webapis.avplay.play())},function(f){b.trigger(new _.K(kP));e(f)})})).then(function(){return a()});if(c===$N||c===dP)try{return webapis.avplay.play(),a()}catch(d){return Promise.reject(d)}return c===ZN?
52
- Promise.resolve():Promise.reject("Player is in invalid state")};_.r.pause=function(){try{webapis.avplay.pause()}catch(a){Promise.reject(a)}return this.getState()===$N?Promise.resolve():Promise.reject()};
53
- _.r.setPlaybackRate=function(a){var b=this.getState();if(b===dP||b===ZN||b===$N){try{webapis.avplay.setSpeed(a),this.C=a}catch(c){return this.g.debug("Error while trying to set playback rate",c),this.setPlaybackRate(this.C)}return!0}this.g.debug("Cannot set playback rate; AVPlay is in inconsistent state: "+b);return!1};_.r.getPlaybackRate=function(){return this.C};
54
- _.r.load=function(a,b){var c=this,d;return _.H(function(e){switch(e.a){case 1:return c.g.debug("configure()",b||""),_.C(e,2),_.x(e,OO(c),4);case 4:return _.x(e,UO(c,a,b),5);case 5:_.uh(e,0);break;case 2:throw d=_.E(e),new _.N(_.O,7,7003,null,d);}})};_.r.getState=function(){if(this.f&&this.a)return this.a.ph;try{return webapis.avplay.getState()}catch(a){this.Wd(JSON.stringify(a))}};
55
- _.r.seek=function(a){var b=this,c=1E3*a;return new Promise(function(d,e){b.B=!0;b.m.trigger(new _.K(_.Cg));webapis.avplay.seekTo(c,function(){b.B=!1;b.m.trigger(new _.K(_.Bg));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.Wd(JSON.stringify(a))}};_.r.getDuration=function(){if(this.f&&this.a)return this.a.duration;try{return webapis.avplay.getDuration()/1E3}catch(a){this.Wd(JSON.stringify(a))}};
56
- _.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.Ff.stop()}a.j={};a.C=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 LN:this.g.debug("The application does not have the privilege to get the volume.",MN);break;default:this.g.debug(IN,b)}}return a};
57
- _.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 LN:this.g.warn("The application does not have the privilege to set the volume.",MN);break;default:this.g.warn("An unknown error occurred while trying to set volume",b)}}};
58
- _.r.isLive=function(){if(this.f&&this.a)return this.a.isLive;try{return"1"===webapis.avplay.getStreamingProperty("IS_LIVE")}catch(a){this.Wd(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()]};
59
- var eP="IDLE",dP="READY",ZN="PLAYING",$N="PAUSED",wO=_.Vb,pO=_.ja,qO="TEXT",gP="PLAYER_MSG_RESOLUTION_CHANGED",fP="PLAYER_MSG_BITRATE_CHANGE",TN={PLAYREADY:"PLAYREADY",So:"EME_PLAYREADY",Yo:"VERIMATRIX",Pe:"WIDEVINE_CDM",To:"EME_WIDEVINE_CDM",$o:"WIDEVINE_CLASSIC"};_.w(XO,_.mm);_.r=XO.prototype;_.r.Ch=function(){var a=this;this.g.debug("On Stream completed. Current time: ",this.getPosition());this.trigger(new _.K(_.he));this.configuration.loop?this.seek(this.configuration.startTime||0)["catch"](function(){a.g.debug("Could not loop playback")}):this.a.stop()};_.r.zh=function(a){this.trigger(new _.K(_.rg,{currentTime:a.currentTime/1E3}))};
60
- _.r.Dh=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=_.Q.Pg(d))&&this.o.append([new _.Si(b,c,d)],[])};_.r.Ah=function(a){this.g.debug("DRM event: "+a.drmType+", data: "+a.drmData)};_.r.Hi=function(){this.A||(this.g.debug("Initial buffering completed..."),this.A=!0)};
61
- _.r.Bh=function(a){this.g.debug("Error: TYPE: "+a.eventType);YN(this.f,_.Eq);a=new _.N(_.O,7,7200,{tizenerror:a.eventType});this.a.release();this.trigger(new _.K(_.ie,{detail:a}))};
62
- _.r.init=function(a,b){this.configuration=this.B=b;this.w=a;this.a.on(cP,this.Ch,this);this.a.on(FO,this.zh,this);this.a.on(iP,this.Dh,this);this.a.on(jP,this.Ah,this);this.a.on(kP,this.Bh,this);this.a.on(bP,this.Hi,this);this.f.initialize();this.l.initialize(this);this.g.debug("Initializing player surface");this.w.hideMediaElement();var c=lP;lP+=1;this.j=_.er(_.Re,{id:"__clpp_tizen_player_"+c,type:"application/avplayer"});this.w.addElementToContainer(this.j,!0);var d=this.w.getMedia();if(d){c=this.j;
63
- var e=[_.Yg,_.pe,"position",_.ve,"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=_.u(e);for(e=g.next();!e.done;e=g.next())e=e.value,f[e]=d[e];_.gr(c,f);YO(this)}};_.r.getSurface=function(){return this.w};_.r.getConfiguration=function(){return this.configuration};_.r.getTimeline=function(){return null};_.r.setupPlaylist=function(){return Promise.reject(_.ob)};_.r.appendLoad=function(){return Promise.reject(_.ob)};
2
+ var f=function(window){var RN="An unknown error occurred while trying to get volume",SN="Cannot get loading rendition due to platform limitations",TN="PARAM_START_POSITION",UN="SecurityError",VN="The require privilege is: http://tizen.org/privilege/tv.audio",WN="|STARTBITRATE\x3d",XN=function(a,b,c){function d(e){c.call(a,e);a.removeEventListener(b,d)}a.addEventListener(b,d)},YN=function(a,b){this.h=a;this.o=null;this.a=_.Re;this.l=null;this.j=!1;this.f=new Map;this.C=b;this.g=new _.J("clpp.tizen.DrmEngine")},aO=function(a){var b,
3
+ c,d;return _.H(function(e){if(1==e.a){b=a.a===_.Gd||a.a===_.Ed;if(!b)throw new _.N(_.O,6,6001,"The key system "+a.a+" is not supported by the player or the platform");c=a.f.get(a.a);if(!c.ye)throw new _.N(_.O,6,6012,"No license server given for "+a.a);_.D(e,2);return a.a===_.Gd?_.x(e,ZN(a),5):_.x(e,$N(a,c),5)}if(2!=e.a)return a.o={keySystem:a.a,licenseServerUri:c.ye,distinctiveIdentifierRequired:!1,persistentStateRequired:c.Fg,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[],
4
+ keyIds:[],periodId:null},_.vh(e,0);d=_.F(e);a.g.error("Error while configuring CDM for "+a.a,d);throw new _.N(_.O,6,6005,{message:JSON.stringify(d)});})},$N=function(a,b){var c,d,e,f;return _.H(function(g){c=bO;d=cO;e={};e[d.xj]=!b.Fg;e[d.Bj]=b.ye;""!==b.customData&&(e[d.wj]=b.customData);f=JSON.stringify(e);a.g.debug("PlayReady properties: ",f);try{webapis.avplay.setDrm(c.PLAYREADY,"SetProperties",f)}catch(h){throw h;}_.z(g)})},ZN=function(a){var b;return _.H(function(c){b=bO;try{webapis.avplay.setDrm(b.We,
5
+ "Initialize",""),webapis.avplay.setDrm(b.We,"widevine_app_session",a.l.id),webapis.avplay.setDrm(b.We,"widevine_data_type",a.l.type)}catch(d){throw d;}_.z(c)})},dO=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,t,u,y,A,B,E;_.H(function(C){if(1==C.a){c=bO;d=a.f.get(a.a);a.g.debug("DRM Challenge data: ",b.challenge);e=atob(b.challenge);f=new Uint8Array(e.length);for(g=0;g<e.length;++g)f[g]=e.charCodeAt(g);h=b.serverurl&&""!==b.serverurl?b.serverurl:d.ye;l=_.ik([h],_.ek());l.type=3;l.body=f.buffer;l.method=
6
+ _.sb;_.D(C,2);return _.x(C,a.C.Db.fetch(l).T,4)}if(2!=C.a){m=C.f;if(a.j){n=_.Oj(m.data);p=n.byteLength;q="";for(t=0;t<p;t++)q+=String.fromCharCode(n[t]);u=btoa(q);y=b.session_id+TN+(u+TN);a.g.debug("Widevine license params",y);try{webapis.avplay.setDrm(c.We,"widevine_license_data",y)}catch(G){a.g.error("License response rejected by CDM"),A=new _.N(_.O,6,6008,{browserError:JSON.stringify(G)}),a.C.onError(A)}}return _.vh(C,0)}B=_.F(C);a.g.error("License request failed.",JSON.stringify(B));E=new _.N(_.O,
7
+ 6,6007,{message:"Error while fetching license!",url:B.data.url,status:B.data.status||NaN,response:B.data.response||"",headers:B.data.headers||{}},B);a.C.onError(E);_.z(C)})},eO=function(a){this.m=a;this.a=this.m.a;this.f=_.wq;this.j=_.xq;this.w=(new Date).getTime();this.l=!1;this.o=-1;this.h=2;this.g=new _.J("clpp.tizen.StateManager")},gO=function(a,b){if(a.f!==b)if(a.f===_.Hq&&b!==_.wq)a.g.debug(_.XC+fO(b));else{var c=(new Date).getTime();a.j=a.f;a.f=b;a.f===_.Bq?(a.o=(new Date).getTime(),a.m.trigger(new _.K(_.ad,
8
+ {detail:{bufferedTimeMS:-1,reason:a.h}}))):a.j===_.Bq&&a.m.trigger(new _.K(_.$c,{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 _.K(_.cg,{detail:d}));a.g.debug("State changed:",fO(a.j),"-\x3e",fO(a.f))}},fO=function(a){return Object.keys(_.Fq)[a]},jO=function(a){if(a.l){var b=a.a.getState(),c=a.f;switch(b){case hO:c=_.Kq;break;case iO:c=_.Jq;break;default:a.m.isEnded()?c=_.Dq:a.g.debug("Inconsistent AVPlay playback state:",
9
+ b)}gO(a,c)}},kO=function(){this.o=this.A=this.f=this.h=this.B=this.m=this.j=this.a=null;this.F=!1;this.w=!0;this.l=null;this.g=new _.J("clpp.tizen.TextStreamer")},lO=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},mO=function(a){var b,c;return _.H(function(d){if(1==d.a)return b=a.m.getConfiguration(),c=null,_.x(d,_.ev(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)})},
10
+ nO=function(a){var b=document.createElement(_.Jg),c=new _.GG,d=new _.gE,e=a.m.getTextDisplayer();return new _.IG(b,c,e,d,a.m.getConfiguration())},oO=function(a){var b={configuration:{},Pb:function(){return a.m.getPosition()},X:a.h,Db:a.m.getNetworkEngine(),pd:null,xg:a.jl.bind(a),wg:a.il.bind(a),onError:a.kl.bind(a),Li:function(){},onEvent:function(){},Qi:a.ll.bind(a),yf:function(){},ge:function(){return new _.vH},$f:function(){return!1},ae:null};return new _.bI(a.a,b)},pO=function(a){var b=a.m.getPosition(),
11
+ 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},qO=function(a){a.g.debug("getTextStreams()",a.a);if(a.a){var b=[],c=a.a.periods;a.g.debug("getting text streams");for(var d=0;d<c.length;d++)if(a.g.debug(c[d].startTime,a.m.getPosition()),c[d].startTime<=a.m.getPosition()){b=c[d].textStreams;break}a=b}else a=[];b=[];for(d=c=0;d<a.length;d++){var e=new _.Lk(String(c++),_.S);e.mimeType=a[d].mimeType;e.language=a[d].language;e.roles=a[d].roles;e.kind=
12
+ a[d].kind||_.uD;var f=new _.Tk(String(a[d].id),e);f.bandwidth=a[d].bandwidth||null;e.renditions.push(f);b.push(e)}return b},rO=function(a){if(a.h&&!a.h.getTextDisplayer().isTextVisible())return null;if(a.f){var b=_.eI(a.f,_.qj),c=null;if(b){a=qO(a);for(var d=0;d<a.length;d++)if(a[d].renditions[0].id===String(b.id)){c=a[d].renditions[0];break}}return c}return null},sO=function(a,b){a.g.debug("Set active track",b);if(b&&(a.o=b.language,a.A=b.roles[0]||"",a.F=b.kind===_.ke,a.a&&a.f)){a.setTextVisibility(!0);
13
+ var c=pO(a),d=b.renditions[0];(c=c.textStreams.find(function(e){return String(e.id)===d.id}))?(a.w?(a.g.debug("Switching period defer text selection"),a.l=c):(_.qI(a.f,c,!0,0),a.m.trigger(new _.K(_.ng))),a.o=c.language):a.g.error("No stream with id",d.id)}},tO=function(){this.j=this.a=this.m=null;this.f={};this.g=new _.J("clpp.tizen.TrackManager");this.w=this.o=this.l=null;this.A=!1;this.h=1},uO=function(a,b){a.m.trigger(new _.K(_.Og,{details:{width:b.width,height:b.height,bandwidth:b.bandwidth,track:b.track,
14
+ abrSelection:a.a.o}}))},vO=function(a){var b=a.pa();b&&a.m.trigger(new _.K(_.Yc,{detail:{width:b.width,height:b.height,bandwidth:b.bandwidth,rendition:b}}))},wO=function(a){var b=a.m.getConfiguration(),c=_.Hi(b.preferredAudioLanguage||[]),d=a.f[_.T]||[];if(d.length){var e=null;c.some(function(g){e=_.SD(g,d.map(function(h){return h.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)}),
15
+ 0<f.length&&(c=f[0]));a.g.debug("Setting audio track with preferred language:",e);a.Ia(c)}else a.g.debug("Preferred language(s) not available")}else a.g.debug("Could not set preferred audio language")},AO=function(a,b){if(b){var c=b.track.type.toUpperCase();xO(a.a,c,Number(b.id)).then(function(){c===yO&&(a.l=b,a.m.trigger(new _.K(_.Wc)));c===zO&&(a.o=b,a.m.trigger(new _.K(_.ng)))})["catch"](function(){a.g.error("Could not select "+c+" track.")})}else a.g.debug("Must provide valid rendition")},BO=
16
+ function(a,b,c){var d=_.Dj(b.language||_.xg);c.language=_.Mk(d);c.originalLanguage=d;c.channelsCount=b.channels?Number(b.channels):null;c.mimeType=_.Tc;a=new _.Tk(String(a),c);a.track=c;a.codec=b.fourCC||null;a.bandwidth=b.bit_rate||null;return a},CO=function(a,b,c){c.mimeType=_.Mg;a=new _.Tk(String(a),c);a.track=c;a.width=b.Width||null;a.height=b.Height||null;a.bandwidth=b.Bit_rate?Number(b.Bit_rate):null;a.codec=b.fourCC||null;return a},DO=function(a,b,c){b=_.Dj(b.track_lang||_.xg);c.mimeType="text/ttml";
17
+ c.language=_.Mk(b);c.originalLanguage=b;c.kind=_.uD;return new _.Tk(String(a),c)},EO=function(a,b){var c=null;try{c=JSON.parse(b)}catch(d){a.g.warn("Couldn't retrieve extra infos from stream."),c=null}return c},HO=function(a,b){function c(n,p){for(var q=0;q<n.length;q++)if(n[q].language===p)return n[q];return null}var d={};if(0>=b.length)return d;for(var e=b.filter(function(n){return n.type===FO}),f=b.filter(function(n){return n.type===yO}),g=[],h=0;h<f.length;h++){var l=EO(a,f[h].extra_info);if(l){var m=
18
+ _.Dj(l.language||_.xg);m=_.Mk(m);m=c(g,m);m||(m=new _.Lk(String(a.h++),_.T),g.push(m));m.renditions.push(BO(f[h].index,l,m))}else a.g.warn("Skipping audio stream with no extra info")}f=new _.Lk(String(a.h++),_.Nk);for(h=0;h<e.length;h++)(l=EO(a,e[h].extra_info))?f.renditions.push(CO(e[h].index,l,f)):a.g.warn("Skipping video stream with no extra info");e=[];e=a.j?qO(a.j):GO(a,b);d[_.Nk]=[f];d[_.T]=g;d[_.S]=e;return d},GO=function(a,b){for(var c=b.filter(function(h){return h.type===zO}),d=[],e=0;e<
19
+ c.length;e++){var f=EO(a,c[e].extra_info);if(f){var g=new _.Lk(String(a.h++),_.S);g.renditions.push(DO(c[e].index,f,g));d.push(g)}else a.g.warn("Skipping text stream with no extra info")}return d},IO=function(a,b){for(var c=a.f[_.Nk]||[],d=[],e=0;e<c.length;e++)for(var f=0;f<c[e].renditions.length;f++)_.L.ra(c[e].renditions[f],b,Object.keys(b))&&d.push(c[e].renditions[f]);return d[0]||null},JO=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===
20
+ b){c=a[d].renditions[e];break}return c},LO=function(a,b){if(b===_.S&&a.j)return rO(a.j);var c=KO(a.a)||[];if(0===c.length)return null;c=c.filter(function(e){return e.type===b.toUpperCase()})[0];var d=null;b===_.Nk&&(d=EO(a,c.extra_info),d=IO(a,{width:d.Width,height:d.Height}));b===_.T&&(c?(d=JO(a,c,_.T),a.l=d):d=a.l);b===_.S&&(c?(d=JO(a,c,_.S),a.o=d):d=a.o);return d},MO=function(a){_.pm.call(this);this.m=a;this.h=null;this.g=new _.J("clpp.tizen.Middleware");this.F=1;this.B=!1;this.l=null;this.G=0;
21
+ this.o=!0;this.f=!1;this.a=null;this.A=1;this.w=!1;this.j={}},NO=function(a){return _.H(function(b){tizen.systeminfo.getPropertyValue("DISPLAY",function(c){a.A=c.resolutionWidth/1920;a.g.debug("Display resolution ratio: ",a.A)},function(c){a.g.debug("Could not load DISPLAY property");throw c;});_.z(b)})},PO=function(a){try{webapis.avplay.setListener({onbufferingstart:a.cl.bind(a),onbufferingprogress:a.al.bind(a),onbufferingcomplete:a.$k.bind(a),onstreamcompleted:a.gl.bind(a),oncurrentplaytime:function(b){a.trigger(new _.K(OO,
22
+ {currentTime:b}))},onevent:a.fl.bind(a),onsubtitlechange:a.hl.bind(a),ondrmevent:a.el.bind(a),onerror:a.Xd.bind(a)})}catch(b){a.g.error(b)}},QO=function(a){var b=!!a.m.getTrackManager().Ya();try{webapis.avplay.setSilentSubtitle(!b)}catch(c){a.g.debug("Could not set AVPlay subtitle config",c)}},RO=function(a,b){try{var c=b.estimatedBandwidth||0,d=b.currentBandwidth||0;a.g.debug({estimatedBandwidth:c,mp:d});0!==c&&0!==d&&c>=1.15*d&&webapis.avplay.setStreamingProperty("ADAPTIVE_INFO",WN+d)}catch(e){a.g.debug(e)}},
23
+ SO=function(a,b){try{webapis.avplay.setStreamingProperty("ADAPTIVE_INFO","|BITRATES\x3d"+b+WN+b)}catch(c){throw a.g.debug("Could not set fixed bandwidth",c),c;}},VO=function(a){return{position:a.getPosition(),state:a.m.getState(),sh:a.getState(),playbackRate:a.getPlaybackRate(),isLive:a.isLive(),duration:a.getDuration(),isMuted:TO(a),volume:a.getVolume(),Ho:UO(a),xl:KO(a)}},XO=function(a){var b,c;return _.H(function(d){if(1==d.a)return _.x(d,WO(),2);if(3!=d.a)return b=new Promise(function(e){(new _.Yh(e)).ha(5)}),
24
+ _.x(d,Promise.race([NO(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"),d["return"](Promise.reject("SDK Timeout"));_.z(d)})},cP=function(a,b,c){var d,e,f,g,h,l,m,n;return _.H(function(p){switch(p.a){case 1:a.l=_.Oq(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 _.K(YO)),f=c.currentPosition);
25
+ _.D(p,2);g=a.l[d].url;h=a.l[d].type;h!==_.Ic||g.includes(".mpd")||(l=new URL(g),l.searchParams.append("cl-ext",".mpd"),g=l.toString());webapis.avplay.open(g);e.nextBandwidth?(SO(a,e.nextBandwidth),a.o=!1):(a.o||RO(a,e),a.o=!0);PO(a);if(!b.drm||!b.drm.env){a.g.debug("No DRM configuration was provided. Assuming clear content");p.D(4);break}m={onError:function(q){return a.m.onError(q)},Db:a.m.getNetworkEngine()};a.h=new YN(b.drm,m);return _.x(p,a.h.init(),4);case 4:return a.f||a.trigger(new _.K(ZO)),
26
+ _.x(p,$O(a),6);case 6:a.f||a.trigger(new _.K(aP));f&&typeof f===_.k&&0<f&&a.seek(f)["catch"](function(q){a.g.debug("Couldn't set start position",q)});a.f||(b.volume&&a.setVolume(b.volume),b.muted&&bP(a,b.muted),b.autoplay&&a.m.play()["catch"](function(q){a.g.debug("Autoplay failed",q)}));_.vh(p,0);break;case 2:throw n=_.F(p),a.g.debug("Error while attempting to load source."),n;}})},$O=function(a){return _.H(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!");
27
+ QO(a);c()},function(e){a.g.debug("prepareAsync failed",e);d(e)})}catch(e){a.g.debug("Failed to prepare media player for playback"),d(e)}}))})},dP=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=VO(a);a.f=!0;webapis.avplay.stop();webapis.avplay.close();return a.load(a.m.getConfiguration(),d).then(function(){var e=a.a.sh;a.f=!1;a.a=
28
+ null;return e===iO?a.pause():a.play()})}catch(e){return Promise.reject(e)}},UO=function(a){return a.f&&a.a?a.a.Ho:webapis.avplay.getTotalTrackInfo()},KO=function(a){return a.f&&a.a?a.a.xl:webapis.avplay.getCurrentStreamInfo()},xO=function(a,b,c){b=b.toUpperCase();b===zO&&eP(a,!0);var d=a.j[b];d&&(d.Jf.stop(),a.j[b]=null,a.g.debug("Cancelled pending track switch for "+b));return new Promise(function(e,f){function g(h,l,m){m=void 0===m?!1:m;try{webapis.avplay.setSelectTrack(h,l),a.j[h]=null,e()}catch(n){a.g.debug("Could not set "+
29
+ h+" track. Trying again...AVPlay state: "+(a.getState()+", buffering: ")+a.w,n),!1===m&&(a.j[h]={type:h,index:l,oh:0,Jf:new _.Yh(function(){return g(h,c,!0)})}),(l=a.j[h])&&3>l.oh?(!a.w&&++l.oh,l.Jf.ha(a.w?.5:.25)):(a.g.debug("Could not set track after multiple attempts.Giving up..."),l&&l.Jf.stop(),a.j[h]=null,f())}}g(b,c)})},eP=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",
30
+ d)}},bP=function(a,b){try{tizen.tvaudiocontrol.setMute(b)}catch(c){switch(c.name){case UN:a.g.warn("The application does not have the privilege to set mute.",VN);break;default:a.g.warn(RN,c)}}},TO=function(a){var b=null;try{b=tizen.tvaudiocontrol.isMute()}catch(c){switch(c.name){case UN:a.g.warn("The application doesn't have the privilege to get the mute state.",VN);break;default:a.g.warn(RN,c)}}return!!b},WO=function(){return new Promise(function(a,b){if(window.webapis)a();else{var c=document.createElement("script");
31
+ XN(c,_.Ce,function(d){return a(d)});XN(c,_.ie,function(d){return b(d)});c.src="$WEBAPIS/webapis/webapis.js";document.querySelector("head").appendChild(c)}})},fP=function(){_.pm.call(this);this.a=new MO(this);this.f=new eO(this);this.configuration=this.B=_.wm();this.w=null;this.g=new _.J("clpp.tizen.Player");this.j=null;this.l=new tO;this.F=new _.Bk;this.o=this.h=null;this.A=!1},gP=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*
32
+ a.A),e=Math.floor(b.width*a.A);b=Math.floor(b.height*a.A);a.g.debug("Setting display area to","x:",c,"y:",d,"width:",e,"height:",b);webapis.avplay.setDisplayRect(c,d,e,b);0===c&&0===d&&1920===e&&1080===b&&webapis.avplay.setDisplayMethod("PLAYER_DISPLAY_MODE_LETTER_BOX")}else a.g.debug("Could not apply dimension. Player state "+a.a.getState())},hP=function(){},iP=function(){};
33
+ YN.prototype.init=function(){var a=this,b,c,d,e,f,g;return _.H(function(h){if(1==h.a){b=_.Ym[a.h.env]||null;if(!b)throw a.g.debug(_.Ea,_.xb+a.h.env+_.aa),new _.N(_.O,6,6015,_.Fa+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=_.$m(b,a.h.customData);(e=d[_.Ed])&&a.f.set(_.Ed,{ye:e.licenseUrl||"",customData:c,Fg:!1});(f=d[_.Gd])&&a.f.set(_.Gd,{ye:f.licenseUrl||"",customData:c,
34
+ Fg:!1});if(0===a.f.size)throw new _.N(_.O,6,6E3);if((g=a.h.preferredDrmSystem)&&a.f.get(g))a.a=g;else if(a.f.get(_.Ed))a.a=_.Ed;else if(a.f.get(_.Gd))a.a=_.Gd;else throw new _.N(_.O,6,6001,"Configuration for the target system is missing.");return _.x(h,aO(a),2)}a.j=!0;_.z(h)})};YN.prototype.release=function(){var a=this;return _.H(function(b){a.j=!1;a.o=null;a.a=_.Re;a.l=null;a.f=new Map;_.z(b)})};YN.prototype.getDrmInfo=function(){return this.o};
35
+ var cO={xj:"DeleteLicenseAfterUse",Bj:"LicenseServer",Xo:"GetChallenge",Yo:"HttpHeader",$o:"UserAgent",Uo:"Cookie",wj:"CustomData"};_.r=eO.prototype;_.r.initialize=function(){this.a.on(YO,this.Jh,this);this.a.on(jP,this.Ih,this);this.a.on(kP,this.Hh,this);this.a.on(ZO,this.Si,this);this.a.on(aP,this.Ri,this);this.a.on(lP,this.Kh,this)};_.r.release=function(){gO(this,_.wq);this.l=!1;this.o=-1;this.h=2};_.r.destroy=function(){this.release();this.a.off(YO,this.Jh);this.a.off(jP,this.Ih);this.a.off(kP,this.Hh);this.a.off(ZO,this.Si);this.a.off(aP,this.Ri);this.a.off(lP,this.Kh);this.m=this.a=null};
36
+ _.r.Jh=function(){this.g.debug("Buffering start. Player state: ",this.a.getState());this.h=this.a.B?1:2;gO(this,_.Bq)};_.r.Ih=function(a){this.g.debug("Buffering progress: "+a.percent+" %. Player state: ",fO(this.f))};_.r.Hh=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()===mP;if(!a&&b){gO(this,_.Jq);return}}if(a=this.f!==_.Iq)a=this.a.getState(),a=a===hO||a===iO;a&&jO(this)};
37
+ _.r.Si=function(){this.g.debug("Preparing starts. AVPlay State: ",this.a.getState());this.a.getState()===nP?gO(this,_.Iq):this.g.error("AVPlay prepares while state is not IDLE")};_.r.Ri=function(){this.g.debug("Preparing ends: AVPlay state:",this.a.getState())};_.r.Kh=function(){gO(this,_.Dq)};_.r.getState=function(){return this.f};_.r=kO.prototype;_.r.initialize=function(a){this.m=a};
38
+ _.r.load=function(a){var b=this,c,d,e,f,g,h,l;return _.H(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 _.x(m,mO(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(){},
39
+ onEvent:function(){},onError:function(){}};_.D(m,3);e=b;return _.x(m,b.j.start(a.url,d),5);case 5:e.a=m.f;_.vh(m,4);break;case 3:return f=_.F(m),b.g.warn(f),_.D(m,6),g=b,_.x(m,b.j.start(a.url.replace(_.se,"http://"),d),8);case 8:g.a=m.f;_.vh(m,4);break;case 6:h=_.F(m),b.g.error(h),b.a=null;case 4:if(!b.a||!lO(b.a)){m.D(0);break}b.h=nO(b);_.D(m,10);return _.x(m,b.h.open(),12);case 12:b.f=oO(b);l=b.m.getConfiguration();b.f.h=l.streaming;b.o=l.preferredTextLanguage;b.A=l.preferredTextRole;b.F=l.preferForcedSubtitles;
40
+ _.vh(m,0);break;case 10:_.F(m),b.g.debug("Could not setup media source..."),b.h=null,b.f=null,b.j=null,b.a=null,_.z(m)}})};_.r.jl=function(a){this.g.debug(_.oD,a);this.w=!0;var b=_.uH(a.textStreams,this.o||"",this.A||"",this.F)[0]||null;this.l&&(a.textStreams.includes(this.l)&&(b=this.l),this.l=null);return{video:null,audio:null,text:b,eb:null}};_.r.il=function(){this.g.debug("canSwitch_");this.w=!1;this.l&&(_.qI(this.f,this.l,!0,0),this.l=null)};_.r.kl=function(){this.g.debug("onError_")};
41
+ _.r.ll=function(){this.j&&this.j.update&&this.j.update()};_.r.start=function(){var a=this;return _.H(function(b){if(!a.f)return b["return"]();try{a.f.start()}catch(c){a.g.error("Error while starting streaming engine",c)}_.z(b)})};_.r.setTextVisibility=function(a){this.g.debug("Set text visibility",a);this.h&&this.h.getTextDisplayer().setTextVisibility(a)};_.r.release=function(){var a=this;return _.H(function(b){a.m=null;a.a=null;a.B=null;a.A=null;a.o=null;a.w=!0;a.l=null;_.z(b)})};
42
+ _.r.destroy=function(){var a=this;return _.H(function(b){switch(b.a){case 1:if(!a.j){b.D(2);break}return _.x(b,a.j.stop(),3);case 3:a.j=null;case 2:if(!a.f){b.D(4);break}return _.x(b,a.f.destroy(),5);case 5:a.f=null,a.w=!0;case 4:if(!a.h){b.D(0);break}return _.x(b,a.h.destroy(),7);case 7:a.h=null,_.z(b)}})};_.w(tO,_.jl);_.r=tO.prototype;_.r.Ji=function(a){var b=a.eventid;a=a.data;switch(b){case oP:0<Object.keys(this.f).length||(this.g.debug("Loading track manager!"),this.load());b=webapis.avplay.getCurrentStreamInfo();0<b.length&&(b=+EO(this,b[0].extra_info).Bit_rate,b=IO(this,{bandwidth:b}))&&(this.w=b,uO(this,b));break;case pP:vO(this);break;default:this.g.debug("Event type: "+b+" data: "+a)}};_.r.Bg=function(a){a.detail.currentState===_.Kq&&this.m.off(_.cg,this.Bg)};
43
+ _.r.initialize=function(a){var b=this;this.m=a;this.a=this.m.a;this.m.on(_.cg,function(c){b.A||(c=c.detail,c.currentState===_.Kq&&(b.g.debug("Current state",c.currentState),b.A=!0,wO(b)))});this.a.on(qP,this.Ji,this)};_.r.release=function(){this.f={};this.j=this.w=this.o=this.l=null;this.A=!1;this.h=1};
44
+ _.r.load=function(){if(this.a&&!(0<Object.keys(this.f).length)){this.j=this.m.h;this.m.off(_.cg,this.Bg);this.m.on(_.cg,this.Bg,this);try{var a=UO(this.a);this.f=HO(this,a);var b=this.f[_.T]||[];b.length&&(this.l=b[0].renditions[0]||null);vO(this)}catch(c){this.g.debug("Could not load track manager")}}};_.r.destroy=function(){this.a.off(qP,this.Ji);this.a=this.m=null};_.r.getVideoTracks=function(){return this.f[_.Nk]||[]};_.r.getAudioTracks=function(){return this.f[_.T]||[]};
45
+ _.r.oa=function(){return this.f[_.S]||[]};_.r.pa=function(){return LO(this,_.Nk)};_.r.Ua=function(){return LO(this,_.T)};_.r.Ya=function(){return LO(this,_.S)};_.r.Ab=function(){return this.w};_.r.Mb=function(){this.g.info(SN);return null};_.r.Nb=function(){this.g.info(SN);return null};_.r.Ma=function(){var a=this.pa();return a?a.track:null};_.r.na=function(){var a=this.Ua();return a?a.track:null};_.r.va=function(){var a=this.Ya();return a?a.track:null};
46
+ _.r.Ib=function(a){var b=this;null===a?(a=this.pa(),dP(this.a,a.bandwidth,null).then(function(){vO(b)})):0<a.renditions.length&&this.sb(a.renditions[0])};_.r.Ia=function(a){a?AO(this,a.renditions[0]):this.g.warn("Cannot disable audio tracks on this platform.","Consider muting audio instead...")};_.r.Za=function(a){a?(a=a.renditions[0],this.j?sO(this.j,a.track):AO(this,a)):(this.g.debug("Disabling text tracks"),this.o=null,eP(this.a,!1),this.m.trigger(new _.K(_.ng)))};
47
+ _.r.sb=function(a){var b=this,c=this.pa();this.a.o||a.width!==c.width||a.height!==c.height||a.bandwidth!==c.bandwidth?(this.w=a,uO(this,a),dP(this.a,c.bandwidth,a.bandwidth).then(function(){vO(b)})["catch"](function(d){var e=new _.N(_.O,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.Gb=function(a){AO(this,a)};_.r.Hb=function(a){this.j?sO(this.j,a.track):AO(this,a)};
48
+ _.r.addTextTrack=function(){};_.r.xa=function(){return this.a.o};tO.prototype.isAbrEnabled=tO.prototype.xa;tO.prototype.addTextTrack=tO.prototype.addTextTrack;tO.prototype.setTextRendition=tO.prototype.Hb;tO.prototype.setAudioRendition=tO.prototype.Gb;tO.prototype.setVideoRendition=tO.prototype.sb;tO.prototype.setTextTrack=tO.prototype.Za;tO.prototype.setAudioTrack=tO.prototype.Ia;tO.prototype.setVideoTrack=tO.prototype.Ib;tO.prototype.getTextTrack=tO.prototype.va;tO.prototype.getAudioTrack=tO.prototype.na;
49
+ tO.prototype.getVideoTrack=tO.prototype.Ma;tO.prototype.getLoadingTextRendition=tO.prototype.Nb;tO.prototype.getLoadingAudioRendition=tO.prototype.Mb;tO.prototype.getLoadingVideoRendition=tO.prototype.Ab;tO.prototype.getTextRendition=tO.prototype.Ya;tO.prototype.getAudioRendition=tO.prototype.Ua;tO.prototype.getVideoRendition=tO.prototype.pa;tO.prototype.getTextTracks=tO.prototype.oa;tO.prototype.getAudioTracks=tO.prototype.getAudioTracks;tO.prototype.getVideoTracks=tO.prototype.getVideoTracks;_.w(MO,_.pm);_.r=MO.prototype;_.r.cl=function(){this.w=!0;this.f||this.trigger(new _.K(YO))};_.r.al=function(a){this.w=!0;this.trigger(new _.K(jP,{percent:a}))};_.r.$k=function(){this.w=!1;this.trigger(new _.K(kP))};_.r.gl=function(){this.trigger(new _.K(lP))};_.r.fl=function(a,b){this.trigger(new _.K(qP,{eventid:a,data:b}))};_.r.hl=function(a,b,c,d,e){this.trigger(new _.K(rP,{duration:a,text:b,subtitleType:c,attriCount:d,attributes:e}))};
50
+ _.r.el=function(a,b){this.trigger(new _.K(sP,{drmType:a,drmData:b}));if(this.h){var c=this.h;if(c.j)if(c.a===_.Gd&&"Challenge"===b.name)dO(c,b);else if("DrmError"===b.name){c.g.debug("DrmError event",b);var d=new _.N(_.O,6,6005,{message:JSON.stringify(b)});c.C.onError(d)}}};_.r.Xd=function(a){this.trigger(new _.K(tP,{eventType:a}))};
51
+ _.r.play=function(){function a(){return new Promise(function(d,e){function f(){d();clearTimeout(g)}var g=null;b.one(OO,f,b);g=setTimeout(function(){b.off(OO,f);e("Timeout")},3E4)})}var b=this,c=this.getState();if(c===nP)return(new Promise(function(d,e){webapis.avplay.prepareAsync(function(){QO(b);d(webapis.avplay.play())},function(f){b.trigger(new _.K(tP));e(f)})})).then(function(){return a()});if(c===iO||c===mP)try{return webapis.avplay.play(),a()}catch(d){return Promise.reject(d)}return c===hO?
52
+ Promise.resolve():Promise.reject("Player is in invalid state")};_.r.pause=function(){try{webapis.avplay.pause()}catch(a){Promise.reject(a)}return this.getState()===iO?Promise.resolve():Promise.reject()};
53
+ _.r.setPlaybackRate=function(a){var b=this.getState();if(b===mP||b===hO||b===iO){try{webapis.avplay.setSpeed(a),this.F=a}catch(c){return this.g.debug("Error while trying to set playback rate",c),this.setPlaybackRate(this.F)}return!0}this.g.debug("Cannot set playback rate; AVPlay is in inconsistent state: "+b);return!1};_.r.getPlaybackRate=function(){return this.F};
54
+ _.r.load=function(a,b){var c=this,d;return _.H(function(e){switch(e.a){case 1:return c.g.debug("configure()",b||""),_.D(e,2),_.x(e,XO(c),4);case 4:return _.x(e,cP(c,a,b),5);case 5:_.vh(e,0);break;case 2:throw d=_.F(e),new _.N(_.O,7,7003,null,d);}})};_.r.getState=function(){if(this.f&&this.a)return this.a.sh;try{return webapis.avplay.getState()}catch(a){this.Xd(JSON.stringify(a))}};
55
+ _.r.seek=function(a){var b=this,c=1E3*a;return new Promise(function(d,e){b.B=!0;b.m.trigger(new _.K(_.Dg));webapis.avplay.seekTo(c,function(){b.B=!1;b.m.trigger(new _.K(_.Cg));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.Xd(JSON.stringify(a))}};_.r.getDuration=function(){if(this.f&&this.a)return this.a.duration;try{return webapis.avplay.getDuration()/1E3}catch(a){this.Xd(JSON.stringify(a))}};
56
+ _.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.Jf.stop()}a.j={};a.F=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 UN:this.g.debug("The application does not have the privilege to get the volume.",VN);break;default:this.g.debug(RN,b)}}return a};
57
+ _.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 UN:this.g.warn("The application does not have the privilege to set the volume.",VN);break;default:this.g.warn("An unknown error occurred while trying to set volume",b)}}};
58
+ _.r.isLive=function(){if(this.f&&this.a)return this.a.isLive;try{return"1"===webapis.avplay.getStreamingProperty("IS_LIVE")}catch(a){this.Xd(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()]};
59
+ var nP="IDLE",mP="READY",hO="PLAYING",iO="PAUSED",FO=_.Vb,yO=_.ja,zO="TEXT",pP="PLAYER_MSG_RESOLUTION_CHANGED",oP="PLAYER_MSG_BITRATE_CHANGE",bO={PLAYREADY:"PLAYREADY",Vo:"EME_PLAYREADY",ap:"VERIMATRIX",We:"WIDEVINE_CDM",Wo:"EME_WIDEVINE_CDM",cp:"WIDEVINE_CLASSIC"};_.w(fP,_.pm);_.r=fP.prototype;_.r.Fh=function(){var a=this;this.g.debug("On Stream completed. Current time: ",this.getPosition());this.trigger(new _.K(_.he));this.configuration.loop?this.seek(this.configuration.startTime||0)["catch"](function(){a.g.debug("Could not loop playback")}):this.a.stop()};_.r.Ch=function(a){this.trigger(new _.K(_.sg,{currentTime:a.currentTime/1E3}))};
60
+ _.r.Gh=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=_.Q.Sg(d))&&this.o.append([new _.Ti(b,c,d)],[])};_.r.Dh=function(a){this.g.debug("DRM event: "+a.drmType+", data: "+a.drmData)};_.r.Ki=function(){this.A||(this.g.debug("Initial buffering completed..."),this.A=!0)};
61
+ _.r.Eh=function(a){this.g.debug("Error: TYPE: "+a.eventType);gO(this.f,_.Hq);a=new _.N(_.O,7,7200,{tizenerror:a.eventType});this.a.release();this.trigger(new _.K(_.ie,{detail:a}))};
62
+ _.r.init=function(a,b){this.configuration=this.B=b;this.w=a;this.a.on(lP,this.Fh,this);this.a.on(OO,this.Ch,this);this.a.on(rP,this.Gh,this);this.a.on(sP,this.Dh,this);this.a.on(tP,this.Eh,this);this.a.on(kP,this.Ki,this);this.f.initialize();this.l.initialize(this);this.g.debug("Initializing player surface");this.w.hideMediaElement();var c=uP;uP+=1;this.j=_.hr(_.Se,{id:"__clpp_tizen_player_"+c,type:"application/avplayer"});this.w.addElementToContainer(this.j,!0);var d=this.w.getMedia();if(d){c=this.j;
63
+ var e=[_.Zg,_.ne,"position",_.we,"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];_.jr(c,f);gP(this)}};_.r.getSurface=function(){return this.w};_.r.getConfiguration=function(){return this.configuration};_.r.getTimeline=function(){return null};_.r.setupPlaylist=function(){return Promise.reject(_.ob)};_.r.appendLoad=function(){return Promise.reject(_.ob)};
64
64
  _.r.seekWith=function(){return Promise.reject(_.ob)};_.r.setSeekInterceptor=function(){};_.r.setPlaybackSessionId=function(){};_.r.getBandwidthEstimate=function(){return null};
65
- _.r.destroy=function(){var a=this;return _.H(function(b){switch(b.a){case 1:return _.x(b,a.release(),2);case 2:a.a.off(cP,a.Ch);a.a.off(FO,a.zh);a.a.off(iP,a.Dh);a.a.off(jP,a.Ah);a.a.off(kP,a.Bh);a.a.off(bP,a.Hi);if(!a.h){b.D(3);break}return _.x(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,_.y(b)}})};_.r.namespace=function(){return mP};_.r.getPlaybackRate=function(){return this.a.getPlaybackRate()};
66
- _.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:this.f.getState()===_.Aq?this.getDuration():this.a.getPosition()||0};_.r.seek=function(a){return typeof a===_.k&&0<=a?(this.isLive()||(a=Math.min(a,this.getDuration())),this.a.seek(a)):Promise.reject()};
67
- _.r.getPresentationStartTime=function(){return null};_.r.getSeekRange=function(){return{start:0,end:0}};_.r.getVolume=function(){var a=this.a.getVolume();return typeof a===_.k?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(_.wa);return new _.lm};_.r.getTrackManager=function(){return this.l};_.r.unload=function(){var a=this;return this.a.release().then(function(){a.l.release()})};
68
- _.r.release=function(){var a=this;return _.H(function(b){switch(b.a){case 1:if(!a.h){b.D(2);break}return _.x(b,a.h.release(),2);case 2:if(!a.o){b.D(4);break}return _.x(b,a.o.destroy(),5);case 5:a.o=null;case 4:return _.x(b,a.a.release(),6);case 6:a.l.release(),a.f.release(),a.A=!1,_.y(b)}})};
69
- _.r.load=function(a){var b=this,c,d,e,f,g;return _.H(function(h){switch(h.a){case 1:b.configuration=_.vm(b.B,a);c=_.kq(b.configuration,[_.re,"native"]);b.o=c.create(b);d=_.Lq(b.configuration)[0];e=!!b.configuration.tizen&&b.configuration.tizen.sideStreamText;if(!e){h.D(2);break}b.h=new bO;b.h.initialize(b);_.C(h,3);return _.x(h,b.h.load(d),5);case 5:b.h.start();_.uh(h,2);break;case 3:f=_.E(h),b.g.error(f);case 2:return _.C(h,6),_.x(h,b.a.load(b.configuration),8);case 8:_.uh(h,7);break;case 6:throw g=
70
- _.E(h),b.onError(g),g;case 7:b.l.load(),_.y(h)}})};_.r.play=function(){var a=this;this.trigger(new _.K(_.ff));YO(this);return this.a.play().then(function(){aO(a.f)})};_.r.pause=function(){var a=this;return this.a.pause().then(function(){aO(a.f)})};_.r.getState=function(){return this.f.getState()};_.r.getPeriods=function(){return[]};_.r.onError=function(a){var b=new _.K(_.ie,{detail:a});a.severity===_.O&&(YN(this.f,_.Eq),this.a.release());this.trigger(b);b.defaultPrevented&&(b.a=!0)};
71
- _.r.getDrmInfo=function(){return this.a.getDrmInfo()};_.r.isEnded=function(){return this.f.getState()===_.Aq};_.r.isPaused=function(){return this.a.getState()===$N};_.r.isMuted=function(){return KO(this.a)};_.r.setMuted=function(a){TO(this.a,a)};_.r.getNetworkEngine=function(){return this.C};_.r.setNetworkEngine=function(a){this.C=a};_.r.setCmsdManager=function(){};_.r.isLive=function(){return this.a.isLive()};_.r.getStats=function(){return null};_.r.setSourceIndex=function(a){this.a.setSourceIndex(a)};
72
- _.r.getSourceIndex=function(){return this.a.getSourceIndex()};_.r.getLoadedSource=function(){return this.a.getLoadedSource()};_.r.canPlay=function(a,b){return(new ZO).canPlay(a,b)};_.r.getTimelineCues=function(){return[]};_.r.getCueTimeline=function(){return null};_.r.getTextDisplayer=function(){return this.o};_.r.resetAbr=function(){};var mP="clpp.tizen",lP=0;ZO.prototype.a=function(){return mP};
73
- ZO.prototype.canPlay=function(a){a=a.type;var b=!!window.webapis;if((a===_.Ic||a===_.Zl||a===_.Nc)&&b){if(_.qk(2))return 2;if(_.qk(3)||_.qk(4)||_.qk(5)||_.qk(6))return _.Jh("Use of clpp.tizen.TizenComponent is not recommended for Tizen version \x3e\x3d 3."),1}return 0};ZO.prototype.f=function(a){return a===_.ra};ZO.prototype.create=function(){return new XO};_.w($O,_.Bu);$O.prototype.f=function(){_.Th(new ZO)};$O.prototype.a=function(){var a=mP;a&&_.Rh[a]&&(delete _.Rh[a],_.Sh.info("Removed Player factory: '"+a+"'"))};$O.prototype.id=function(){return"tizen"};_.I("clpp.tizen.TizenComponent",$O);var PO="onbufferingstart",aP="onbufferingprogress",bP="onbufferingcomplete",cP="onstreamcompleted",FO="oncurrentplaytime",hP="onevent",iP="onsubtitlechange",jP="ondrmevent",kP="onerror",QO="preparingstart",SO="preparingend";};
65
+ _.r.destroy=function(){var a=this;return _.H(function(b){switch(b.a){case 1:return _.x(b,a.release(),2);case 2:a.a.off(lP,a.Fh);a.a.off(OO,a.Ch);a.a.off(rP,a.Gh);a.a.off(sP,a.Dh);a.a.off(tP,a.Eh);a.a.off(kP,a.Ki);if(!a.h){b.D(3);break}return _.x(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,_.z(b)}})};_.r.namespace=function(){return vP};_.r.getPlaybackRate=function(){return this.a.getPlaybackRate()};
66
+ _.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:this.f.getState()===_.Dq?this.getDuration():this.a.getPosition()||0};_.r.seek=function(a){return typeof a===_.k&&0<=a?(this.isLive()||(a=Math.min(a,this.getDuration())),this.a.seek(a)):Promise.reject()};
67
+ _.r.getPresentationStartTime=function(){return null};_.r.getSeekRange=function(){return{start:0,end:0}};_.r.getVolume=function(){var a=this.a.getVolume();return typeof a===_.k?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(_.wa);return new _.om};_.r.getTrackManager=function(){return this.l};_.r.unload=function(){var a=this;return this.a.release().then(function(){a.l.release()})};
68
+ _.r.release=function(){var a=this;return _.H(function(b){switch(b.a){case 1:if(!a.h){b.D(2);break}return _.x(b,a.h.release(),2);case 2:if(!a.o){b.D(4);break}return _.x(b,a.o.destroy(),5);case 5:a.o=null;case 4:return _.x(b,a.a.release(),6);case 6:a.l.release(),a.f.release(),a.A=!1,_.z(b)}})};
69
+ _.r.load=function(a){var b=this,c,d,e,f,g;return _.H(function(h){switch(h.a){case 1:b.configuration=_.ym(b.B,a);c=_.nq(b.configuration,[_.re,"native"]);b.o=c.create(b);d=_.Oq(b.configuration)[0];e=!!b.configuration.tizen&&b.configuration.tizen.sideStreamText;if(!e){h.D(2);break}b.h=new kO;b.h.initialize(b);_.D(h,3);return _.x(h,b.h.load(d),5);case 5:b.h.start();_.vh(h,2);break;case 3:f=_.F(h),b.g.error(f);case 2:return _.D(h,6),_.x(h,b.a.load(b.configuration),8);case 8:_.vh(h,7);break;case 6:throw g=
70
+ _.F(h),b.onError(g),g;case 7:b.l.load(),_.z(h)}})};_.r.play=function(){var a=this;this.trigger(new _.K(_.gf));gP(this);return this.a.play().then(function(){jO(a.f)})};_.r.pause=function(){var a=this;return this.a.pause().then(function(){jO(a.f)})};_.r.getState=function(){return this.f.getState()};_.r.getPeriods=function(){return[]};_.r.onError=function(a){var b=new _.K(_.ie,{detail:a});a.severity===_.O&&(gO(this.f,_.Hq),this.a.release());this.trigger(b);b.defaultPrevented&&(b.a=!0)};
71
+ _.r.getDrmInfo=function(){return this.a.getDrmInfo()};_.r.isEnded=function(){return this.f.getState()===_.Dq};_.r.isPaused=function(){return this.a.getState()===iO};_.r.isMuted=function(){return TO(this.a)};_.r.setMuted=function(a){bP(this.a,a)};_.r.getNetworkEngine=function(){return this.F};_.r.setNetworkEngine=function(a){this.F=a};_.r.setCmsdManager=function(){};_.r.isLive=function(){return this.a.isLive()};_.r.getStats=function(){return null};_.r.setSourceIndex=function(a){this.a.setSourceIndex(a)};
72
+ _.r.getSourceIndex=function(){return this.a.getSourceIndex()};_.r.getLoadedSource=function(){return this.a.getLoadedSource()};_.r.canPlay=function(a,b){return(new hP).canPlay(a,b)};_.r.getTimelineCues=function(){return[]};_.r.getCueTimeline=function(){return null};_.r.getTextDisplayer=function(){return this.o};_.r.resetAbr=function(){};var vP="clpp.tizen",uP=0;hP.prototype.a=function(){return vP};
73
+ hP.prototype.canPlay=function(a){a=a.type;var b=!!window.webapis;if((a===_.Ic||a===_.bm||a===_.Nc)&&b){if(_.wk(2))return 2;if(_.wk(3)||_.wk(4)||_.wk(5)||_.wk(6))return _.Kh("Use of clpp.tizen.TizenComponent is not recommended for Tizen version \x3e\x3d 3."),1}return 0};hP.prototype.f=function(a){return a===_.qa};hP.prototype.create=function(){return new fP};_.w(iP,_.Fu);iP.prototype.f=function(){_.Uh(new hP)};iP.prototype.a=function(){var a=vP;a&&_.Sh[a]&&(delete _.Sh[a],_.Th.info("Removed Player factory: '"+a+"'"))};iP.prototype.id=function(){return"tizen"};_.I("clpp.tizen.TizenComponent",iP);var YO="onbufferingstart",jP="onbufferingprogress",kP="onbufferingcomplete",lP="onstreamcompleted",OO="oncurrentplaytime",qP="onevent",rP="onsubtitlechange",sP="ondrmevent",tP="onerror",ZO="preparingstart",aP="preparingend";};
74
74
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
75
75
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
76
76
  else{_=this.clpp._;(f.call(g,this));}
package/cjs/cl.ttml.js CHANGED
@@ -1,33 +1,33 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var Gy='application/mp4; codecs\x3d"stpp.ttml"',Hy='application/mp4; codecs\x3d"stpp.ttml.im1i"',Iy='application/mp4; codecs\x3d"stpp.ttml.im1t"',Jy="backgroundColor",Ky="direction",Ly="displayAlign",My="region",Ny="sans-serif",Oy="textAlign",Py="textDecoration",Qy="writingMode",Ry=function(a,b,c){this.h=a;this.f=b;this.a=c},Sy=function(a,b,c){Ry.call(this,a,[],c);this.j=b||""},Ty=function(a,b,c){Ry.call(this,a,b,c)},Uy=function(a,b,c){a=a.f;for(var d=a.length-1;0<=d;d--){var e=b.get(a[d]);if(e.hasAttribute(c))return e.getAttribute(c)}return null},
3
- bz=function(a,b){var c=null;if(Vy.test(a)){c=Vy.exec(a);var d=Number(c[1]),e=Number(c[2]),f=Number(c[3]),g=Number(c[4]);g+=(Number(c[5])||0)/b.f;f+=g/b.frameRate;c=f+60*e+3600*d}else Wy.test(a)?c=Xy(Wy,a):Yy.test(a)?c=Xy(Yy,a):Zy.test(a)?(c=Zy.exec(a),c=Number(c[1])/b.frameRate):$y.test(a)?(c=$y.exec(a),c=Number(c[1])/b.a):az.test(a)&&(c=Xy(az,a));return c},Xy=function(a,b){var c=a.exec(b);return null==c||""===c[0]?null:(Number(c[4])||0)/1E3+(Number(c[3])||0)+60*(Number(c[2])||0)+3600*(Number(c[1])||
4
- 0)},cz=function(a){return a.split(":").pop()},dz=function(a){return a.replace(/(\d*\.?\d+)c/g,"$1em")},fz=function(a,b){for(;ez.test(a);){var c=ez.exec(a)[0];a=a.replace(c,parseInt(c,10)/b+"em")}return a},gz=function(a){return a?a.replace(/(\d*\.?\d+)%/g,function(b,c){return c/100+"em"}):""},hz=function(a,b,c,d,e,f,g){Ry.call(this,a,f,g);this.w=b;this.A=c;this.o=d;this.l=e;this.j=[]},iz=function(a,b,c){a=Uy(a,b,Oy);if(!a&&c&&(a=Uy(c,b,Oy),!a&&"rltb"===Uy(c,b,Qy)))return _.ge;switch(a){case _.id:return _.Ni;
5
- case _.Of:case _.ge:return _.ge;default:return _.ag}},jz=function(a,b,c){if(_.Q.nf(a.w))return document.createTextNode(_.Q.Pg(a.w||""));if(a.A)return _.er("br");for(var d=_.er("span"),e=_.u(a.f),f=e.next();!f.done;f=e.next())_.fr(d,f.value);a=_.u(a.j);for(e=a.next();!e.done;e=a.next())d.appendChild(jz(c.get(e.value),b,c));return d},kz=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))&&
6
- (this.frameRate*=Number(a[1])/Number(a[2]))},lz=function(a,b,c){Ry.call(this,a,b,c)},oz=function(a,b,c,d){var e=mz.exec(a);a=nz.exec(a);return typeof b===_.k&&0<b&&a?100*Number(a[c])/b:e?Number(e[c]):a?Number(a[c]):d},pz=function(a,b){return typeof b===_.k&&0<b?_.Ti:nz.test(a)?0:_.Ti},qz=function(a,b){Ry.call(this,"root-container",[],b);this.j=a},rz=function(a,b,c){return typeof a===_.k?a:typeof b===_.k?b:c},sz=function(a,b){var c=a.getAttribute("extent");return(c=nz.exec(c))?Number(c[b]):null},uz=
7
- function(a){a=a.getAttribute("cellResolution");return(a=tz.exec(a))?Number(a[2]):null},vz=function(a,b,c){Ry.call(this,a,b,c)},wz=function(a){this.B=a;this.w=this.l=null;this.A=0;this.h=new Map;this.a=new Map;this.j=new Map;this.f=new Map;this.o=[]},yz=function(a){return xz.some(function(b){return b in a.attributes})},zz=function(a,b){if(0===b.length)return[];for(var c=[],d=_.u(b),e=d.next();!e.done;e=d.next())e=e.value,a.a.has(e)&&c.push.apply(c,_.gh(zz(a,a.a.get(e).f)).concat([e]));return c},Bz=
8
- function(){return"inline-"+Az++},Cz=function(a){return a.o.map(function(b){return b.build(a.l,a.w,a.A,a.h,a.a,a.j,a.f)}).filter(function(b){return null!=b})},Dz=function(a){this.a=a.firstChild;this.f=new Set},Ez=function(a,b,c,d,e,f){this.h=a;this.a=b;this.j=c;this.l=d;this.f=e;this.attributes=f},Fz=function(a){return cz(a.h.nodeName)},Gz=function(){this.a=new Map},Iz=function(a,b){if(a.a.has(b))return a.a.get(b);var c=null,d=null,e=[],f=[],g={},h=b.parentNode;if(h&&a.a.has(h)){var l=a.a.get(h);e=
9
- _.gh(l.l).concat();-1===[_.da,"span","br"].indexOf(b.nodeName)&&(c=l.a,d=l.j,f=_.gh(l.f).concat(),g={},Hz.forEach(function(n){n in l.attributes&&(g[n]=l.attributes[n])}))}if(b.nodeType===b.ELEMENT_NODE){b.hasAttribute(My)&&(c=b.getAttribute(My));b.hasAttribute(_.gg)&&f.push.apply(f,_.gh(b.getAttribute(_.gg).split(" ")));d=Array.from(b.attributes).map(function(n){return n.name});d=_.u(d);for(h=d.next();!h.done;h=d.next()){h=h.value;var m=cz(h);g[m]=b.getAttribute(h)}d=g.backgroundImage}c=new Ez(b,
10
- c,d,e,f,g);a.a.set(b,c);return c},Jz=function(a){this.a=a;this.f=new DOMParser},Kz=function(a){this.f=a},Lz=function(a){return String(Math.floor(a/3600)).padStart(2,"0")+":"+String(Math.floor(a/60%60)).padStart(2,"0")+":"+String(Math.floor(a%60)).padStart(2,"0")+"."+String(Math.floor(1E3*a%1E3)).padStart(3,"0")},Mz=function(){},Nz=function(a){this.a=new Jz(a);this.g=new _.J("clpp.ttml.Mp4TtmlParser")},Oz=function(){this.j=new Mz};Ry.prototype.getId=function(){return this.h};
11
- Ry.prototype.hasAttribute=function(a){return a in this.a};Ry.prototype.getAttribute=function(a){return this.a[a]};_.w(Sy,Ry);_.w(Ty,Ry);var Vy=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Wy=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,Yy=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d+)$/,Zy=/^(\d*(?:\.\d*)?)f$/,$y=/^(\d*(?:\.\d*)?)t$/,az=/^(?:(\d*(?:\.\d*)?)h)?(?:(\d*(?:\.\d*)?)m)?(?:(\d*(?:\.\d*)?)s)?(?:(\d*(?:\.\d*)?)ms)?$/,mz=/^(\d{1,2}(?:\.\d+)?|100(?:\.0+)?)% (\d{1,2}(?:\.\d+)?|100(?:\.0+)?)%$/,nz=/^(\d+)px (\d+)px$/,tz=/^(\d+) (\d+)$/,ez=/(\d+)px/,Pz=/^(\d+px|\d+em|\d*\.?\d+c)$/,xz=[Jy,"color",Ky,Ly,"fontFamily","fontSize","fontStyle","fontWeight",
12
- "lineHeight","opacity","padding",Oy,Py,"textOutline",Qy,"zIndex"],Hz=["begin",_.ge];_.w(hz,Ty);
13
- hz.prototype.build=function(a,b,c,d,e,f,g){var h=bz(this.a.begin,b);b=bz(this.a.end,b);if(null===h||null===b)return null;h+=c;b+=c;c=_.er(_.Qd);for(var l=_.u(this.j),m=l.next();!m.done;m=l.next())c.appendChild(jz(g.get(m.value),e,g));g=new _.Si(h,b,c.innerHTML.trim(),_.ug);g.cssClassList=_.gh(this.f).concat();g.textAlign=iz(this,e,null);g.writingMode=_.Oi;g.line=-1;g.lineInterpretation=_.Pi;g.lineAlign=_.Qi;g.containerRows=rz(null,uz(a),15);if(this.o&&(f=f.get(this.o))){g.region=f.build(a,e);g.textAlign=
14
- iz(this,e,f);a:switch(Uy(f,e,Qy)){case "tb":case "tblr":a=_.Gg;break a;case "tbrl":a=_.Hg;break a;default:a=_.Oi}g.writingMode=a;a:switch(Uy(f,e,Ly)){case _.id:a=50;break a;case "after":a=-1;break a;default:a=0}g.line=a;a:switch(Uy(f,e,Ly)){case _.id:a=1;break a;default:a=_.Pi}g.lineInterpretation=a;a:switch(Uy(f,e,Ly)){case _.id:e=_.id;break a;default:e=_.Qi}g.lineAlign=e}this.l&&(a=d.get(this.l))&&(d=a.getAttribute("encoding"),e=a.getAttribute("imageType")||a.getAttribute("imagetype"),a=a.j.trim(),
15
- g.backgroundImage=("PNG"===e&&"Base64"===d&&0<a.length?"data:image/png;base64,"+a:null)||"");return g};_.w(lz,Ty);
16
- lz.prototype.build=function(a,b){var c=new _.Vi;c.id=this.getId();var d=rz(a.j.containerWidth,sz(a,1),720),e=rz(a.j.containerHeight,sz(a,2),480);a:switch(Uy(this,b,Ly)){case "after":var f="flex-start";break a;case _.id:f=_.id;break a;default:f="flex-end"}c.displayAlign=f;a:switch(Uy(this,b,Qy)){case "tb":case "tblr":f="row-reverse";break a;case "tbrl":f="row";break a;default:f=_.Ad}c.writingMode=f;f=this.getAttribute("extent")||Uy(this,b,"extent");c.width=oz(f,d,1,100);c.widthUnits=pz(f,d);c.height=
17
- oz(f,e,2,100);c.heightUnits=pz(f,e);f=this.getAttribute("origin")||Uy(this,b,"origin");c.viewportAnchorX=oz(f,d,1,0);c.viewportAnchorY=oz(f,e,2,0);c.viewportAnchorUnits=pz(f,d);c.cssClassList=_.gh(this.f).concat();return c};_.w(qz,Ry);_.w(vz,Ry);
18
- vz.prototype.build=function(a){var b=null;var c=uz(a);c&&(b=rz(a.j.containerHeight,sz(a,2),480)/c);b=rz(a.j.fontSizeRadix,b,16);a=[];c="::ttml ."+this.h+", ::ttml ."+this.h+" * {";for(var d=_.u(Qz.entries()),e=d.next();!e.done;e=d.next()){var f=_.u(e.value);e=f.next().value;f=f.next().value;e in this.a&&(c+=f+":"+dz(this.a[e])+";")}a:{if("unicodeBidi"in this.a){d=this.a.unicodeBidi;e="";switch(d){case "normal":case "embed":e=d;break;case "bidiOverride":e="bidi-override"}if(0<e.length){d="unicode-bidi:"+
19
- e+";";break a}}d=""}c+=d;a:{if("textOutline"in this.a){d=this.a.textOutline.split(" ");e="black";f=".4em";var g=d[0]&&d[0].trim(),h=d[1]&&d[1].trim(),l=d[2]&&d[2].trim();3===d.length&&!Pz.test(g)&&Pz.test(h)&&Pz.test(l)?(e=g,f=h):2===d.length&&!Pz.test(g)&&Pz.test(h)?(e=g,f=h):2===d.length&&Pz.test(g)&&Pz.test(h)&&(f=g);if(""!==f){f=dz(f);d="text-shadow:0 0 "+(f+" "+e+",0 0 ")+(f+" "+e+",0 0 ")+(f+" "+e+";");break a}}d=""}c+=d;"textShadow"in this.a?(d=gz(this.a.textShadow),d=dz(d),d="text-shadow:"+
20
- d+";"):d="";c=c+d+("fontFamily"in this.a?"font-family:"+this.a.fontFamily.replace("monospaceSansSerif","monospace").replace("monospaceSerif","monospace").replace("proportionalSansSerif",Ny).replace("proportionalSerif",Ny).replace("sansSerif",Ny).replace("default",Ny)+";":"");a:{if(Py in this.a){d=[];e=_.u(this.a.textDecoration.split(" "));for(f=e.next();!f.done;f=e.next())switch(f=f.value,f){case "underline":case "overline":d.push(f);break;case "lineThrough":d.push("line-through")}if(0<d.length){d=
21
- "text-decoration:"+d.join(" ")+";";break a}}d=""}e="padding"in this.a?"border: solid transparent;border-width:"+dz(this.a.padding)+";":"";c=c+d+e;"lineHeight"in this.a?(d="",e=this.a.lineHeight,e=dz(e),e=fz(e,b),d=d+"line-height:"+e+";"):d="";a.push(c+d+"}");a:{if("fontSize"in this.a&&(c=this.a.fontSize.split(" "),d=null,1===c.length&&(d=c[0]),2===c.length&&(d=c[1]),d)){d=d.trim();d=dz(d);d=fz(d,b);b="font-size:"+d+";";break a}b=null}b&&(c="::ttml ."+this.h+" .clpp-text-wrapper {",a.push(c+b+"}"),
22
- c="::ttml .clpp-text-wrapper__"+this.h+" {",a.push(c+b+"}"));return a};var Qz=new Map([[Jy,"background-color"],["color","color"],[Ky,Ky],["fontStyle","font-style"],["fontWeight","font-weight"],["opacity","opacity"],["zIndex","z-index"]]);var Az=0;Dz.prototype.me=function(){return!!this.a};Dz.prototype.next=function(){if(!this.a)return null;var a=this.a;do this.f.add(a),a.nodeType!==Node.TEXT_NODE&&!Rz.has(cz(a.nodeName))||Sz.has(cz(a.nodeName))||!a.firstChild||this.f.has(a.firstChild)?a.nextSibling?a=a.nextSibling:a=a.parentNode:a=a.firstChild;while(a&&(this.f.has(a)||a.nodeType!==Node.TEXT_NODE&&!Rz.has(cz(a.nodeName))));var b=this.a;this.a=a;return b};
23
- var Rz=new Set(["tt","head","layout",_.Je,_.se,My,"styling",_.gg,"body",_.Qd,"p","span","br"]),Sz=new Set([_.gg,_.se]);Ez.prototype.getId=function(){return this.attributes.id};Jz.prototype.parseInit=function(){};
24
- Jz.prototype.parseMedia=function(a,b,c){c&&c.length||(c=[a.byteLength]);var d=_.L.kb(this.a.ttml||{}),e=_.Oj(a,0,c[0]);e=_.Q.ea(e);if(""===e)return{cues:[],styles:[]};var f=null;try{f=this.f.parseFromString(e,_.lg)}catch(n){throw new _.N(_.O,2,2005,"Failed to parse TTML.");}d=new wz(d);e=new Gz;f=new Dz(f);b=b.periodStart;typeof b===_.k&&(d.A=b);b=c[0];for(var g=1;g<c.length;++g){var h=c[g],l=_.Oj(a,b,h);l=_.Lm(l);var m="urn:mpeg:14496-30:subs:"+g;d.h.set(m,new Sy(m,l,{imageType:"PNG",encoding:"Base64"}));
25
- b+=h}for(;f.me();)a=f.next(),a=Iz(e,a),"tt"===Fz(a)&&(d.l=new qz(d.B,Object.assign({},a.attributes))),"tt"===Fz(a)&&(d.w=new kz(a.attributes.frameRate,a.attributes.subFrameRate,a.attributes.frameRateMultiplier,a.attributes.tickRate)),Fz(a)!==_.se||a.attributes.begin||a.attributes.end||(c="#"+a.getId(),d.h.set(c,new Sy(c,a.h.textContent,a.attributes))),Fz(a)===_.se&&a.attributes.begin&&a.attributes.end?(c="#"+Bz(),b=new Sy(c,a.h.textContent,a.attributes),d.h.set(c,b),c=b):c=null,c&&(a.j=c.getId()),
26
- Fz(a)===_.gg&&(c=a.getId()||Bz(),b=new vz(c,a.f,Object.assign({},a.attributes)),d.a.set(c,b),a.a&&d.j.get(a.a).f.push(c)),Fz(a)!==_.gg&&yz(a)?(c=Bz(),b=new vz(c,[],Object.assign({},a.attributes)),d.a.set(c,b),c=b):c=null,c&&a.f.push(c.getId()),Fz(a)!==_.Qd||!a.attributes.extent&&!a.attributes.origin?c=null:(c=Bz(),b=new lz(c,zz(d,a.f),Object.assign({},a.attributes)),d.j.set(c,b),c=b),c&&(a.a=c.getId()),Fz(a)!==My?c=null:(c=a.getId(),b=new lz(c,zz(d,a.f),Object.assign({},a.attributes)),d.j.set(c,b),
27
- c=b),c&&(a.a=c.getId()),c=a.l,-1===[_.da,"span","br"].indexOf(Fz(a))||0===c.length?c=null:(g=c[c.length-1],d.f.has(g)?(c=Bz(),b=new hz(c,a.h.nodeName===_.da?a.h.textContent:null,"br"===Fz(a),a.a,a.j,zz(d,a.f),a.attributes),d.f.set(c,b),(g=d.f.get(g))&&g.j.push(c),c=b):c=null),c&&a.l.push(c.getId()),"p"===Fz(a)||a.j?(c=Bz(),b=new hz(c,null,!1,a.a,a.j,zz(d,a.f),a.attributes),d.f.set(c,b),d.o.push(b),c=b):c=null,c&&a.l.push(c.getId());e=Cz(d);f=[];a=_.u(d.a.values());for(c=a.next();!c.done;c=a.next())f.push.apply(f,
28
- _.gh(c.value.build(d.l)));return{cues:e,styles:f}};Kz.prototype.a=function(a){a=(new Jz(this.f)).parseMedia(a,{periodStart:0,segmentStart:null,segmentEnd:0}).cues;var b="WEBVTT\n\n";a=_.u(a);for(var c=a.next();!c.done;c=a.next()){c=c.value;var d=Lz(c.startTime)+" --\x3e "+Lz(c.endTime),e=[];switch(c.textAlign){case _.ve:e.push("align:left");break;case _.Of:e.push("align:right");break;case _.Ni:e.push("align:middle");break;case _.ag:e.push("align:start");break;case _.ge:e.push("align:end")}switch(c.writingMode){case _.Gg:e.push("vertical:lr");break;
29
- case _.Hg:e.push("vertical:rl")}b+=d+(e.length?" "+e.join(" "):"")+"\n";b+=c.payload+"\n\n"}return _.Q.hb(b)};Mz.prototype.probe=function(a,b){return a===_.Mc&&b===_.kg};Mz.prototype.create=function(a){return new Kz(a)};Nz.prototype.parseInit=function(a){var b=!1;(new _.pn).M(_.Ne,_.qn).M(_.tg,_.qn).M(_.He,_.qn).M(_.Le,_.qn).M(_.dg,_.qn).aa(_.fg,_.rn).M("stpp",function(c){b=!0;c.parser.stop()}).parse(a);if(!b)throw new _.N(_.O,2,2007);};
30
- Nz.prototype.parseMedia=function(a,b){var c=this,d=!1,e=[],f=[],g=[];(new _.pn).M("moof",_.qn).M("traf",_.qn).aa("subs",function(h){for(var l=_.kn(h.reader),m=0;m<l;++m){h.reader.skip(4);for(var n=_.jn(h.reader),p=0;p<n;++p){var q=1===h.version?_.kn(h.reader):_.jn(h.reader);g.push(q);h.reader.skip(6)}}}).M(_.Ge,_.sn(function(h){d=!0;h=c.a.parseMedia(h,b,g);e=e.concat(h.cues);f=f.concat(h.styles)})).parse(a);d||this.g.warn("Couldn't find the mdat box");return{cues:e,styles:f}};_.w(Oz,_.Bu);Oz.prototype.f=function(){_.Av(_.Mc,Jz);_.Av(_.Kc,Nz);_.Av(Gy,Nz);_.Av(Iy,Nz);_.Av(Hy,Nz);_.dl.push(this.j)};Oz.prototype.a=function(){_.Cv(_.Mc);_.Cv(_.Kc);_.Cv(Gy);_.Cv(Iy);_.Cv(Hy);_.fl(this.j)};Oz.prototype.id=function(){return"subtitles-ttml"};_.I("clpp.ttml.TtmlComponent",Oz);};
2
+ var f=function(window){var Jy='application/mp4; codecs\x3d"stpp.ttml"',Ky='application/mp4; codecs\x3d"stpp.ttml.im1i"',Ly='application/mp4; codecs\x3d"stpp.ttml.im1t"',My="backgroundColor",Ny="direction",Oy="displayAlign",Py="region",Qy="sans-serif",Ry="textAlign",Sy="textDecoration",Ty="writingMode",Uy=function(a,b,c){this.h=a;this.f=b;this.a=c},Vy=function(a,b,c){Uy.call(this,a,[],c);this.j=b||""},Wy=function(a,b,c){Uy.call(this,a,b,c)},Xy=function(a,b,c){a=a.f;for(var d=a.length-1;0<=d;d--){var e=b.get(a[d]);if(e.hasAttribute(c))return e.getAttribute(c)}return null},
3
+ ez=function(a,b){var c=null;if(Yy.test(a)){c=Yy.exec(a);var d=Number(c[1]),e=Number(c[2]),f=Number(c[3]),g=Number(c[4]);g+=(Number(c[5])||0)/b.f;f+=g/b.frameRate;c=f+60*e+3600*d}else Zy.test(a)?c=$y(Zy,a):az.test(a)?c=$y(az,a):bz.test(a)?(c=bz.exec(a),c=Number(c[1])/b.frameRate):cz.test(a)?(c=cz.exec(a),c=Number(c[1])/b.a):dz.test(a)&&(c=$y(dz,a));return c},$y=function(a,b){var c=a.exec(b);return null==c||""===c[0]?null:(Number(c[4])||0)/1E3+(Number(c[3])||0)+60*(Number(c[2])||0)+3600*(Number(c[1])||
4
+ 0)},fz=function(a){return a.split(":").pop()},gz=function(a){return a.replace(/(\d*\.?\d+)c/g,"$1em")},iz=function(a,b){for(;hz.test(a);){var c=hz.exec(a)[0];a=a.replace(c,parseInt(c,10)/b+"em")}return a},jz=function(a){return a?a.replace(/(\d*\.?\d+)%/g,function(b,c){return c/100+"em"}):""},kz=function(a,b,c,d,e,f,g){Uy.call(this,a,f,g);this.w=b;this.A=c;this.o=d;this.l=e;this.j=[]},lz=function(a,b,c){a=Xy(a,b,Ry);if(!a&&c&&(a=Xy(c,b,Ry),!a&&"rltb"===Xy(c,b,Ty)))return _.ge;switch(a){case _.id:return _.Oi;
5
+ case _.Pf:case _.ge:return _.ge;default:return _.bg}},mz=function(a,b,c){if(_.Q.tf(a.w))return document.createTextNode(_.Q.Sg(a.w||""));if(a.A)return _.hr("br");for(var d=_.hr("span"),e=_.v(a.f),f=e.next();!f.done;f=e.next())_.ir(d,f.value);a=_.v(a.j);for(e=a.next();!e.done;e=a.next())d.appendChild(mz(c.get(e.value),b,c));return d},nz=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))&&
6
+ (this.frameRate*=Number(a[1])/Number(a[2]))},oz=function(a,b,c){Uy.call(this,a,b,c)},rz=function(a,b,c,d){var e=pz.exec(a);a=qz.exec(a);return typeof b===_.k&&0<b&&a?100*Number(a[c])/b:e?Number(e[c]):a?Number(a[c]):d},sz=function(a,b){return typeof b===_.k&&0<b?_.Ui:qz.test(a)?0:_.Ui},tz=function(a,b){Uy.call(this,"root-container",[],b);this.j=a},uz=function(a,b,c){return typeof a===_.k?a:typeof b===_.k?b:c},vz=function(a,b){var c=a.getAttribute("extent");return(c=qz.exec(c))?Number(c[b]):null},xz=
7
+ function(a){a=a.getAttribute("cellResolution");return(a=wz.exec(a))?Number(a[2]):null},yz=function(a,b,c){Uy.call(this,a,b,c)},zz=function(a){this.B=a;this.w=this.l=null;this.A=0;this.h=new Map;this.a=new Map;this.j=new Map;this.f=new Map;this.o=[]},Bz=function(a){return Az.some(function(b){return b in a.attributes})},Cz=function(a,b){if(0===b.length)return[];for(var c=[],d=_.v(b),e=d.next();!e.done;e=d.next())e=e.value,a.a.has(e)&&c.push.apply(c,_.hh(Cz(a,a.a.get(e).f)).concat([e]));return c},Ez=
8
+ function(){return"inline-"+Dz++},Fz=function(a){return a.o.map(function(b){return b.build(a.l,a.w,a.A,a.h,a.a,a.j,a.f)}).filter(function(b){return null!=b})},Gz=function(a){this.a=a.firstChild;this.f=new Set},Hz=function(a,b,c,d,e,f){this.h=a;this.a=b;this.j=c;this.l=d;this.f=e;this.attributes=f},Iz=function(a){return fz(a.h.nodeName)},Jz=function(){this.a=new Map},Lz=function(a,b){if(a.a.has(b))return a.a.get(b);var c=null,d=null,e=[],f=[],g={},h=b.parentNode;if(h&&a.a.has(h)){var l=a.a.get(h);e=
9
+ _.hh(l.l).concat();-1===[_.da,"span","br"].indexOf(b.nodeName)&&(c=l.a,d=l.j,f=_.hh(l.f).concat(),g={},Kz.forEach(function(n){n in l.attributes&&(g[n]=l.attributes[n])}))}if(b.nodeType===b.ELEMENT_NODE){b.hasAttribute(Py)&&(c=b.getAttribute(Py));b.hasAttribute(_.hg)&&f.push.apply(f,_.hh(b.getAttribute(_.hg).split(" ")));d=Array.from(b.attributes).map(function(n){return n.name});d=_.v(d);for(h=d.next();!h.done;h=d.next()){h=h.value;var m=fz(h);g[m]=b.getAttribute(h)}d=g.backgroundImage}c=new Hz(b,
10
+ c,d,e,f,g);a.a.set(b,c);return c},Mz=function(a){this.a=a;this.f=new DOMParser},Nz=function(a){this.f=a},Oz=function(a){return String(Math.floor(a/3600)).padStart(2,"0")+":"+String(Math.floor(a/60%60)).padStart(2,"0")+":"+String(Math.floor(a%60)).padStart(2,"0")+"."+String(Math.floor(1E3*a%1E3)).padStart(3,"0")},Pz=function(){},Qz=function(a){this.a=new Mz(a);this.g=new _.J("clpp.ttml.Mp4TtmlParser")},Rz=function(){this.j=new Pz};Uy.prototype.getId=function(){return this.h};
11
+ Uy.prototype.hasAttribute=function(a){return a in this.a};Uy.prototype.getAttribute=function(a){return this.a[a]};_.w(Vy,Uy);_.w(Wy,Uy);var Yy=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Zy=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,az=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d+)$/,bz=/^(\d*(?:\.\d*)?)f$/,cz=/^(\d*(?:\.\d*)?)t$/,dz=/^(?:(\d*(?:\.\d*)?)h)?(?:(\d*(?:\.\d*)?)m)?(?:(\d*(?:\.\d*)?)s)?(?:(\d*(?:\.\d*)?)ms)?$/,pz=/^(\d{1,2}(?:\.\d+)?|100(?:\.0+)?)% (\d{1,2}(?:\.\d+)?|100(?:\.0+)?)%$/,qz=/^(\d+)px (\d+)px$/,wz=/^(\d+) (\d+)$/,hz=/(\d+)px/,Sz=/^(\d+px|\d+em|\d*\.?\d+c)$/,Az=[My,"color",Ny,Oy,"fontFamily","fontSize","fontStyle","fontWeight",
12
+ "lineHeight","opacity","padding",Ry,Sy,"textOutline",Ty,"zIndex"],Kz=["begin",_.ge];_.w(kz,Wy);
13
+ kz.prototype.build=function(a,b,c,d,e,f,g){var h=ez(this.a.begin,b);b=ez(this.a.end,b);if(null===h||null===b)return null;h+=c;b+=c;c=_.hr(_.Pd);for(var l=_.v(this.j),m=l.next();!m.done;m=l.next())c.appendChild(mz(g.get(m.value),e,g));g=new _.Ti(h,b,c.innerHTML.trim(),_.vg);g.cssClassList=_.hh(this.f).concat();g.textAlign=lz(this,e,null);g.writingMode=_.Pi;g.line=-1;g.lineInterpretation=_.Qi;g.lineAlign=_.Ri;g.containerRows=uz(null,xz(a),15);if(this.o&&(f=f.get(this.o))){g.region=f.build(a,e);g.textAlign=
14
+ lz(this,e,f);a:switch(Xy(f,e,Ty)){case "tb":case "tblr":a=_.Gg;break a;case "tbrl":a=_.Hg;break a;default:a=_.Pi}g.writingMode=a;a:switch(Xy(f,e,Oy)){case _.id:a=50;break a;case "after":a=-1;break a;default:a=0}g.line=a;a:switch(Xy(f,e,Oy)){case _.id:a=1;break a;default:a=_.Qi}g.lineInterpretation=a;a:switch(Xy(f,e,Oy)){case _.id:e=_.id;break a;default:e=_.Ri}g.lineAlign=e}this.l&&(a=d.get(this.l))&&(d=a.getAttribute("encoding"),e=a.getAttribute("imageType")||a.getAttribute("imagetype"),a=a.j.trim(),
15
+ g.backgroundImage=("PNG"===e&&"Base64"===d&&0<a.length?"data:image/png;base64,"+a:null)||"");return g};_.w(oz,Wy);
16
+ oz.prototype.build=function(a,b){var c=new _.Wi;c.id=this.getId();var d=uz(a.j.containerWidth,vz(a,1),720),e=uz(a.j.containerHeight,vz(a,2),480);a:switch(Xy(this,b,Oy)){case "after":var f="flex-start";break a;case _.id:f=_.id;break a;default:f="flex-end"}c.displayAlign=f;a:switch(Xy(this,b,Ty)){case "tb":case "tblr":f="row-reverse";break a;case "tbrl":f="row";break a;default:f=_.Ad}c.writingMode=f;f=this.getAttribute("extent")||Xy(this,b,"extent");c.width=rz(f,d,1,100);c.widthUnits=sz(f,d);c.height=
17
+ rz(f,e,2,100);c.heightUnits=sz(f,e);f=this.getAttribute("origin")||Xy(this,b,"origin");c.viewportAnchorX=rz(f,d,1,0);c.viewportAnchorY=rz(f,e,2,0);c.viewportAnchorUnits=sz(f,d);c.cssClassList=_.hh(this.f).concat();return c};_.w(tz,Uy);_.w(yz,Uy);
18
+ yz.prototype.build=function(a){var b=null;var c=xz(a);c&&(b=uz(a.j.containerHeight,vz(a,2),480)/c);b=uz(a.j.fontSizeRadix,b,16);a=[];c="::ttml ."+this.h+", ::ttml ."+this.h+" * {";for(var d=_.v(Tz.entries()),e=d.next();!e.done;e=d.next()){var f=_.v(e.value);e=f.next().value;f=f.next().value;e in this.a&&(c+=f+":"+gz(this.a[e])+";")}a:{if("unicodeBidi"in this.a){d=this.a.unicodeBidi;e="";switch(d){case "normal":case "embed":e=d;break;case "bidiOverride":e="bidi-override"}if(0<e.length){d="unicode-bidi:"+
19
+ e+";";break a}}d=""}c+=d;a:{if("textOutline"in this.a){d=this.a.textOutline.split(" ");e="black";f=".4em";var g=d[0]&&d[0].trim(),h=d[1]&&d[1].trim(),l=d[2]&&d[2].trim();3===d.length&&!Sz.test(g)&&Sz.test(h)&&Sz.test(l)?(e=g,f=h):2===d.length&&!Sz.test(g)&&Sz.test(h)?(e=g,f=h):2===d.length&&Sz.test(g)&&Sz.test(h)&&(f=g);if(""!==f){f=gz(f);d="text-shadow:0 0 "+(f+" "+e+",0 0 ")+(f+" "+e+",0 0 ")+(f+" "+e+";");break a}}d=""}c+=d;"textShadow"in this.a?(d=jz(this.a.textShadow),d=gz(d),d="text-shadow:"+
20
+ d+";"):d="";c=c+d+("fontFamily"in this.a?"font-family:"+this.a.fontFamily.replace("monospaceSansSerif","monospace").replace("monospaceSerif","monospace").replace("proportionalSansSerif",Qy).replace("proportionalSerif",Qy).replace("sansSerif",Qy).replace("default",Qy)+";":"");a:{if(Sy in this.a){d=[];e=_.v(this.a.textDecoration.split(" "));for(f=e.next();!f.done;f=e.next())switch(f=f.value,f){case "underline":case "overline":d.push(f);break;case "lineThrough":d.push("line-through")}if(0<d.length){d=
21
+ "text-decoration:"+d.join(" ")+";";break a}}d=""}e="padding"in this.a?"border: solid transparent;border-width:"+gz(this.a.padding)+";":"";c=c+d+e;"lineHeight"in this.a?(d="",e=this.a.lineHeight,e=gz(e),e=iz(e,b),d=d+"line-height:"+e+";"):d="";a.push(c+d+"}");a:{if("fontSize"in this.a&&(c=this.a.fontSize.split(" "),d=null,1===c.length&&(d=c[0]),2===c.length&&(d=c[1]),d)){d=d.trim();d=gz(d);d=iz(d,b);b="font-size:"+d+";";break a}b=null}b&&(c="::ttml ."+this.h+" .clpp-text-wrapper {",a.push(c+b+"}"),
22
+ c="::ttml .clpp-text-wrapper__"+this.h+" {",a.push(c+b+"}"));return a};var Tz=new Map([[My,"background-color"],["color","color"],[Ny,Ny],["fontStyle","font-style"],["fontWeight","font-weight"],["opacity","opacity"],["zIndex","z-index"]]);var Dz=0;Gz.prototype.oe=function(){return!!this.a};Gz.prototype.next=function(){if(!this.a)return null;var a=this.a;do this.f.add(a),a.nodeType!==Node.TEXT_NODE&&!Uz.has(fz(a.nodeName))||Vz.has(fz(a.nodeName))||!a.firstChild||this.f.has(a.firstChild)?a.nextSibling?a=a.nextSibling:a=a.parentNode:a=a.firstChild;while(a&&(this.f.has(a)||a.nodeType!==Node.TEXT_NODE&&!Uz.has(fz(a.nodeName))));var b=this.a;this.a=a;return b};
23
+ var Uz=new Set(["tt","head","layout",_.Ke,_.te,Py,"styling",_.hg,"body",_.Pd,"p","span","br"]),Vz=new Set([_.hg,_.te]);Hz.prototype.getId=function(){return this.attributes.id};Mz.prototype.parseInit=function(){};
24
+ Mz.prototype.parseMedia=function(a,b,c){c&&c.length||(c=[a.byteLength]);var d=_.L.kb(this.a.ttml||{}),e=_.Oj(a,0,c[0]);e=_.Q.ea(e);if(""===e)return{cues:[],styles:[]};var f=null;try{f=this.f.parseFromString(e,_.mg)}catch(n){throw new _.N(_.O,2,2005,"Failed to parse TTML.");}d=new zz(d);e=new Jz;f=new Gz(f);b=b.periodStart;typeof b===_.k&&(d.A=b);b=c[0];for(var g=1;g<c.length;++g){var h=c[g],l=_.Oj(a,b,h);l=_.Om(l);var m="urn:mpeg:14496-30:subs:"+g;d.h.set(m,new Vy(m,l,{imageType:"PNG",encoding:"Base64"}));
25
+ b+=h}for(;f.oe();)a=f.next(),a=Lz(e,a),"tt"===Iz(a)&&(d.l=new tz(d.B,Object.assign({},a.attributes))),"tt"===Iz(a)&&(d.w=new nz(a.attributes.frameRate,a.attributes.subFrameRate,a.attributes.frameRateMultiplier,a.attributes.tickRate)),Iz(a)!==_.te||a.attributes.begin||a.attributes.end||(c="#"+a.getId(),d.h.set(c,new Vy(c,a.h.textContent,a.attributes))),Iz(a)===_.te&&a.attributes.begin&&a.attributes.end?(c="#"+Ez(),b=new Vy(c,a.h.textContent,a.attributes),d.h.set(c,b),c=b):c=null,c&&(a.j=c.getId()),
26
+ Iz(a)===_.hg&&(c=a.getId()||Ez(),b=new yz(c,a.f,Object.assign({},a.attributes)),d.a.set(c,b),a.a&&d.j.get(a.a).f.push(c)),Iz(a)!==_.hg&&Bz(a)?(c=Ez(),b=new yz(c,[],Object.assign({},a.attributes)),d.a.set(c,b),c=b):c=null,c&&a.f.push(c.getId()),Iz(a)!==_.Pd||!a.attributes.extent&&!a.attributes.origin?c=null:(c=Ez(),b=new oz(c,Cz(d,a.f),Object.assign({},a.attributes)),d.j.set(c,b),c=b),c&&(a.a=c.getId()),Iz(a)!==Py?c=null:(c=a.getId(),b=new oz(c,Cz(d,a.f),Object.assign({},a.attributes)),d.j.set(c,b),
27
+ c=b),c&&(a.a=c.getId()),c=a.l,-1===[_.da,"span","br"].indexOf(Iz(a))||0===c.length?c=null:(g=c[c.length-1],d.f.has(g)?(c=Ez(),b=new kz(c,a.h.nodeName===_.da?a.h.textContent:null,"br"===Iz(a),a.a,a.j,Cz(d,a.f),a.attributes),d.f.set(c,b),(g=d.f.get(g))&&g.j.push(c),c=b):c=null),c&&a.l.push(c.getId()),"p"===Iz(a)||a.j?(c=Ez(),b=new kz(c,null,!1,a.a,a.j,Cz(d,a.f),a.attributes),d.f.set(c,b),d.o.push(b),c=b):c=null,c&&a.l.push(c.getId());e=Fz(d);f=[];a=_.v(d.a.values());for(c=a.next();!c.done;c=a.next())f.push.apply(f,
28
+ _.hh(c.value.build(d.l)));return{cues:e,styles:f}};Nz.prototype.a=function(a){a=(new Mz(this.f)).parseMedia(a,{periodStart:0,segmentStart:null,segmentEnd:0}).cues;var b="WEBVTT\n\n";a=_.v(a);for(var c=a.next();!c.done;c=a.next()){c=c.value;var d=Oz(c.startTime)+" --\x3e "+Oz(c.endTime),e=[];switch(c.textAlign){case _.we:e.push("align:left");break;case _.Pf:e.push("align:right");break;case _.Oi:e.push("align:middle");break;case _.bg:e.push("align:start");break;case _.ge:e.push("align:end")}switch(c.writingMode){case _.Gg:e.push("vertical:lr");break;
29
+ case _.Hg:e.push("vertical:rl")}b+=d+(e.length?" "+e.join(" "):"")+"\n";b+=c.payload+"\n\n"}return _.Q.hb(b)};Pz.prototype.probe=function(a,b){return a===_.Mc&&b===_.lg};Pz.prototype.create=function(a){return new Nz(a)};Qz.prototype.parseInit=function(a){var b=!1;(new _.sn).M(_.Ne,_.tn).M(_.ug,_.tn).M(_.Ie,_.tn).M(_.Me,_.tn).M(_.eg,_.tn).aa(_.gg,_.un).M("stpp",function(c){b=!0;c.parser.stop()}).parse(a);if(!b)throw new _.N(_.O,2,2007);};
30
+ Qz.prototype.parseMedia=function(a,b){var c=this,d=!1,e=[],f=[],g=[];(new _.sn).M("moof",_.tn).M("traf",_.tn).aa("subs",function(h){for(var l=_.nn(h.reader),m=0;m<l;++m){h.reader.skip(4);for(var n=_.mn(h.reader),p=0;p<n;++p){var q=1===h.version?_.nn(h.reader):_.mn(h.reader);g.push(q);h.reader.skip(6)}}}).M(_.He,_.vn(function(h){d=!0;h=c.a.parseMedia(h,b,g);e=e.concat(h.cues);f=f.concat(h.styles)})).parse(a);d||this.g.warn("Couldn't find the mdat box");return{cues:e,styles:f}};_.w(Rz,_.Fu);Rz.prototype.f=function(){_.Dv(_.Mc,Mz);_.Dv(_.Kc,Qz);_.Dv(Jy,Qz);_.Dv(Ly,Qz);_.Dv(Ky,Qz);_.gl.push(this.j)};Rz.prototype.a=function(){_.Fv(_.Mc);_.Fv(_.Kc);_.Fv(Jy);_.Fv(Ly);_.Fv(Ky);_.il(this.j)};Rz.prototype.id=function(){return"subtitles-ttml"};_.I("clpp.ttml.TtmlComponent",Rz);};
31
31
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
32
32
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
33
33
  else{_=this.clpp._;(f.call(g,this));}
@@ -1,9 +1,9 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var uy="VerimatrixVCAS",vy="clpp.verimatrix.Vcas",wy="clpp.verimatrix.VcasComponent",Cy=function(a){_.an.call(this,uy);var b={};b[xy]=xy;b[yy]=yy;var c=a.authenticator,d=void 0===a.licenseRequestVuidLocation?zy:a.licenseRequestVuidLocation;b=void 0===a.httpHeaderNames?b:a.httpHeaderNames;var e=a.widevineLicenseUrl,f=a.playReadyLicenseUrl,g=a.fairPlayLicenseUrl,h=a.fairPlayCertificateUrl,l=a.fairPlaySiteId,m=void 0===a.fairPlayAssetIdStrategy?Ay:a.fairPlayAssetIdStrategy;this.A=a.deviceId;this.a=c;
3
- this.C=d;this.B=b;this.w=By(this,e);this.o=By(this,f);this.l=By(this,g);this.j=h;this.H=l;this.G=m;this.g=new _.J(vy);_.Q.empty(this.w)?this.g.warn(_.Zb):this.fb(_.Gd,{licenseUrl:this.w,videoRobustness:[_.Fb,void 0],audioRobustness:[_.Eb,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:this.h.bind(this)}});_.Q.empty(this.o)?this.g.warn(_.tb):this.fb(_.Ed,{licenseUrl:this.o,videoRobustness:["3000"],audioRobustness:["2000"],modifiers:{licenseRequest:this.h.bind(this)}});
4
- _.Q.empty(this.l)?this.g.warn(_.Ra):_.Q.empty(this.j)?this.g.warn(_.Qa):this.fb(_.Cd,{licenseUrl:this.l,certificateUrl:this.j,modifiers:{licenseRequest:this.K.bind(this),licenseResponse:this.L.bind(this),extractContentId:this.I.bind(this)}})},By=function(a,b){if(a.C===zy){var c=Object.assign({},{deviceId:_.Mm(_.Q.Fd(a.A))},a.a&&{authenticator:_.Mm(_.Q.Fd(a.a))});return b+_.Ok(c)}return b},Dy=function(){this.g=new _.J(wy)};_.w(Cy,_.an);
5
- Cy.prototype.h=function(a,b){if(this.C===Ey){var c=this.B[yy],d={};d[this.B[xy]]=this.A;this.a&&(d[c]=this.a);Object.keys(d).forEach(function(e){b.headers[e]=d[e]})}};Cy.prototype.I=function(a,b){var c=_.yn(b);switch(this.G){case Fy:c=_.Ok({r:c,yp:this.H},!0)}return c};Cy.prototype.K=function(a,b){this.h(a,b);_.Bn(b)};Cy.prototype.L=function(a,b){_.Cn(b)};_.I(vy,Cy);Cy.prototype.constructor=Cy.prototype.constructor;Cy.NAME=uy;var zy="query-string",Ey="http-header";
6
- Cy.LicenseRequestVuidLocation={QUERY_STRING:zy,HTTP_HEADER:Ey};var xy="DeviceId",yy="Authenticator";Cy.LicenseRequestHttpHeader={DEVICE_ID_HEADER:xy,AUTHENTICATOR_HEADER:yy};var Ay="keyid",Fy="contentid-siteid";Cy.FairPlayAssetIdStrategy={KEYID:Ay,CONTENTID_SITEID:Fy};_.w(Dy,_.Bu);Dy.prototype.a=function(){delete _.Vm.VerimatrixVCAS};Dy.prototype.h=function(a){a=a.getConfiguration();if(a.drm&&a.drm.env===uy){a=a.drm.customData;if(!a)throw new _.N(_.O,7,7100,_.Hd);a=new Cy(a);this.g.info("Registering the Verimatrix VCAS Ultra environment");_.Wm(a)}};Dy.prototype.id=function(){return"verimatrix-vcas"};_.I(wy,Dy);};
2
+ var f=function(window){var xy="VerimatrixVCAS",yy="clpp.verimatrix.Vcas",zy="clpp.verimatrix.VcasComponent",Fy=function(a){_.dn.call(this,xy);var b={};b[Ay]=Ay;b[By]=By;var c=a.authenticator,d=void 0===a.licenseRequestVuidLocation?Cy:a.licenseRequestVuidLocation;b=void 0===a.httpHeaderNames?b:a.httpHeaderNames;var e=a.widevineLicenseUrl,f=a.playReadyLicenseUrl,g=a.fairPlayLicenseUrl,h=a.fairPlayCertificateUrl,l=a.fairPlaySiteId,m=void 0===a.fairPlayAssetIdStrategy?Dy:a.fairPlayAssetIdStrategy;this.A=a.deviceId;this.a=c;
3
+ this.F=d;this.B=b;this.w=Ey(this,e);this.o=Ey(this,f);this.l=Ey(this,g);this.j=h;this.H=l;this.G=m;this.g=new _.J(yy);_.Q.empty(this.w)?this.g.warn(_.Zb):this.fb(_.Gd,{licenseUrl:this.w,videoRobustness:[_.Fb,void 0],audioRobustness:[_.Eb,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:this.h.bind(this)}});_.Q.empty(this.o)?this.g.warn(_.tb):this.fb(_.Ed,{licenseUrl:this.o,videoRobustness:["3000"],audioRobustness:["2000"],modifiers:{licenseRequest:this.h.bind(this)}});
4
+ _.Q.empty(this.l)?this.g.warn(_.Ra):_.Q.empty(this.j)?this.g.warn(_.Qa):this.fb(_.Cd,{licenseUrl:this.l,certificateUrl:this.j,modifiers:{licenseRequest:this.K.bind(this),licenseResponse:this.L.bind(this),extractContentId:this.I.bind(this)}})},Ey=function(a,b){if(a.F===Cy){var c=Object.assign({},{deviceId:_.Pm(_.Q.Hd(a.A))},a.a&&{authenticator:_.Pm(_.Q.Hd(a.a))});return b+_.Zj(c)}return b},Gy=function(){this.g=new _.J(zy)};_.w(Fy,_.dn);
5
+ Fy.prototype.h=function(a,b){if(this.F===Hy){var c=this.B[By],d={};d[this.B[Ay]]=this.A;this.a&&(d[c]=this.a);Object.keys(d).forEach(function(e){b.headers[e]=d[e]})}};Fy.prototype.I=function(a,b){var c=_.Bn(b);switch(this.G){case Iy:c=_.Zj({r:c,Bp:this.H},!0)}return c};Fy.prototype.K=function(a,b){this.h(a,b);_.En(b)};Fy.prototype.L=function(a,b){_.Fn(b)};_.I(yy,Fy);Fy.prototype.constructor=Fy.prototype.constructor;Fy.NAME=xy;var Cy="query-string",Hy="http-header";
6
+ Fy.LicenseRequestVuidLocation={QUERY_STRING:Cy,HTTP_HEADER:Hy};var Ay="DeviceId",By="Authenticator";Fy.LicenseRequestHttpHeader={DEVICE_ID_HEADER:Ay,AUTHENTICATOR_HEADER:By};var Dy="keyid",Iy="contentid-siteid";Fy.FairPlayAssetIdStrategy={KEYID:Dy,CONTENTID_SITEID:Iy};_.w(Gy,_.Fu);Gy.prototype.a=function(){delete _.Ym.VerimatrixVCAS};Gy.prototype.h=function(a){a=a.getConfiguration();if(a.drm&&a.drm.env===xy){a=a.drm.customData;if(!a)throw new _.N(_.O,7,7100,_.Hd);a=new Fy(a);this.g.info("Registering the Verimatrix VCAS Ultra environment");_.Zm(a)}};Gy.prototype.id=function(){return"verimatrix-vcas"};_.I(zy,Gy);};
7
7
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
8
8
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
9
9
  else{_=this.clpp._;(f.call(g,this));}
package/cjs/cl.vimond.js CHANGED
@@ -1,16 +1,16 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var ky="Registering listeners",ly="clpp.vimond.VimondPlugin",my=function(a,b,c,d,e){this.G=a;this.H=b;this.I=c;this.m=d;this.C=e;this.a=new _.gi;this.l=!0;this.f=this.j=this.A=!1;this.B=null;this.h=new _.Xh(this.Rh.bind(this));this.g=new _.J("clpp.vimond.VimondDispatcher");this.o=this.w=0;this.m&&this.a&&(this.g.debug(ky),this.a.on(this.m,_.bg,this.ll.bind(this)),this.a.on(this.m,_.rg,this.ml.bind(this)),this.a.on(this.m,_.hc,this.jl.bind(this)),this.a.on(this.m,_.ic,this.kl.bind(this)))},ny=function(a,
3
- b){a.m.trigger(new _.K(_.Og,{detail:b}))},oy=function(a,b,c){b&&(a.A=!0,a.h.stop());a.m.onError(new _.N(b?_.O:1,9,9201,c))},py=function(a,b,c,d,e){this.l=a;this.o=c;this.h=b;this.a=d;this.j=e;this.g=new _.J("clpp.vimond.VimondService");this.f=0},qy=function(a){this.m=a;this.a=new _.gi;this.g=new _.J("clpp.vimond.VimondAdapter");this.f=this.h=!1;this.m&&this.a&&(this.g.debug(ky),this.a.on(this.m,_.Kf,this.o.bind(this)),this.a.on(this.m,_.hc,this.j.bind(this)),this.a.on(this.m,_.ic,this.l.bind(this)))},
4
- ry=function(a,b){var c=a.m.getState();if(1===b)return["str-start",_.rf];if(a.h)return[_.ge,_.bf];if(c===_.Aq)return[_.ge,null];if(c===_.Eq)return[_.ie,_.bf];var d=_.bf;if(c===_.yq||c===_.Hq||a.f)d=_.rf;return["period",d]},sy=function(){this.a=!1;this.g=new _.J(ly);this.j=this.h=this.f=null},ty=function(){};_.r=my.prototype;_.r.ml=function(){this.f||(this.f=1<Math.abs(this.w-this.m.getPosition()));this.w=this.m.getPosition()};_.r.jl=function(){this.g.debug("Ad break started");this.j=!0};
5
- _.r.kl=function(){this.g.debug("Ad break stopped");this.j=!1};
6
- _.r.ll=function(a){var b=this,c,d,e,f,g;return _.H(function(h){if(1==h.a){c=a.detail;d=_.Cq;e=c.currentState;f=c.previousState;b.g.debug("State changed, prev: "+f+" curr: "+e);if(b.A||b.j)return h["return"]();if(e===b.B&&!b.f)return b.g.debug("Ignore transition"),h["return"]();if(b.l&&e!==d.PLAYING)return h["return"]();if(b.f&&[d.PAUSED,d.BUFFERING].includes(e))return b.g.debug("Seeking"),h["return"]();b.f&&e===d.PLAYING&&(b.g.debug("Seeked"),b.f=!1);g=[d.PLAYING,d.PAUSED,d.ERROR,d.ENDED];if(!g.includes(e))return h.D(0);
7
- b.B=e;return _.x(h,b.Rh(),3)}e===d.ENDED&&b.h.stop();_.y(h)})};
8
- _.r.Rh=function(){var a=this,b,c,d,e,f,g;return _.H(function(h){if(1==h.a){var l=Math.floor(Date.now()/1E3);0<a.o&&a.g.debug("Last event was "+(l-a.o)+" seconds ago");a.o=l;a.h.stop();a.h.ga(a.l?10:a.G);a.l=!1;_.C(h,2);return _.x(h,a.C.fireEvent(),4)}if(2!=h.a)return b=h.f,ny(a,b),_.uh(h,0);d=c=_.E(h);e=d.code;f=d.data;g=[1002,1003];g.includes(e)?(a.g.debug("Unreachable service"),ny(a,f),oy(a,a.H,f)):1001===e?(a.g.debug("Generic service error"),ny(a,f),oy(a,a.I,f)):a.g.error(c.toString());_.y(h)})};py.prototype.fireEvent=function(){this.f++;var a=_.L.ta(this.o);a.client.buildName=_.xa;a.client.buildVersion=_.ia;var b=a.client,c=this.a.m.getDrmInfo();b.drm=c?c.keySystem:"";a.client.pageUrl=document.location.href;a.client.streamUrl=this.a.m.getLoadedSource().url;a.client.userAgent=navigator.userAgent;a.client.videoFormat=this.a.m.getLoadedSource().type||"";b=a.client;c=this.a.m.getLoadedSource();c=((new _.Mk(c.url)).scheme||"").replace(":","");b.videoProtocol=c;b=ry(this.a,this.f);a.client.playerEvent=
9
- b[0]||"";a.client.playerState=b[1]||"";a.progress.vod&&(a.progress.vod.position=this.a.getPosition());if(b=a.progress.live){c=this.a;var d=c.m.getPresentationStartTime()||0;c=Math.floor(d+c.m.getPosition());c=(new Date(1E3*c)).toISOString();b.position=c;d=this.a;c=d.m.getPosition();d=d.m.getSeekRange().end;b.onLiveEdge=30>Math.abs(d-c);typeof b.liveResumePossible!==_.Zc&&(b.liveResumePossible=!0)}a.progress.eventNumber=this.f;a.timestamp=(new Date).toISOString();this.g.debug("Fire an event");b=_.ck(this.l);
10
- b.method=_.sb;b.contentType="application/json";b.headers.Authorization="Bearer "+this.h;b.body=_.Q.Fd(JSON.stringify(a));return this.j.fetch(b).S};py.prototype.Xg=function(a){this.h=a};qy.prototype.getPosition=function(){return Math.floor(this.m.getPosition())};qy.prototype.o=function(){this.h=!0};qy.prototype.j=function(){this.f=!0};qy.prototype.l=function(){this.f=!1};_.w(sy,_.bw);_.r=sy.prototype;_.r.onPlayerCreated=function(){};
11
- _.r.onContentWillLoad=function(a){var b=a.getConfiguration();(this.a=!_.L.R(b.vimond)&&typeof b.vimond===_.Re)?a.namespace()===_.sd&&(this.a=!1,this.g.info("Vimond does not report when casting.")):this.g.debug("Vimond plugin is loaded but not configured. Will do nothing.");if(this.a){b=a.getConfiguration().vimond;for(var c=_.u(["authToken","playerEventRequest"]),d=c.next();!d.done;d=c.next())if(d=d.value,!b[d]){this.g.warn(d+" key is missing");a.onError(new _.N(1,9,9200));return}this.g.debug(_.ya);
12
- c=b.failIfUnreachable;typeof c!==_.Zc&&(c=!0);d=b.failOnError;typeof d!==_.Zc&&(d=!0);this.f=new qy(a);this.h=new py(b.playerEventRequest.uri,b.authToken,b.playerEventRequest.body,this.f,a.getNetworkEngine());this.j=new my(b.playerEventRequest.eventInterval,c,d,a,this.h)}};_.r.onPlayerWillRelease=function(){if(this.a){if(this.f){var a=this.f;a.g.debug(_.Rb);_.ki(a.a)}this.j&&(a=this.j,a.g.debug(_.Rb),_.ki(a.a),a.h.stop());this.j=this.h=this.f=null}};_.r.onPlayerWillDestroy=function(){};_.r.id=function(){return"vimond"};
13
- _.r.Xg=function(a){this.a&&this.h&&this.h.Xg(a)};_.I(ly,sy);sy.prototype.updateAuthToken=sy.prototype.Xg;sy.Id="vimond";ty.prototype.create=function(){return new sy};_.Yt(new ty);};
2
+ var f=function(window){var ny="Registering listeners",oy="clpp.vimond.VimondPlugin",py=function(a,b,c,d,e){this.G=a;this.H=b;this.I=c;this.m=d;this.F=e;this.a=new _.hi;this.l=!0;this.f=this.j=this.A=!1;this.B=null;this.h=new _.Yh(this.Uh.bind(this));this.g=new _.J("clpp.vimond.VimondDispatcher");this.o=this.w=0;this.m&&this.a&&(this.g.debug(ny),this.a.on(this.m,_.cg,this.ol.bind(this)),this.a.on(this.m,_.sg,this.pl.bind(this)),this.a.on(this.m,_.hc,this.ml.bind(this)),this.a.on(this.m,_.ic,this.nl.bind(this)))},qy=function(a,
3
+ b){a.m.trigger(new _.K(_.Pg,{detail:b}))},ry=function(a,b,c){b&&(a.A=!0,a.h.stop());a.m.onError(new _.N(b?_.O:1,9,9201,c))},sy=function(a,b,c,d,e){this.l=a;this.o=c;this.h=b;this.a=d;this.j=e;this.g=new _.J("clpp.vimond.VimondService");this.f=0},ty=function(a){this.m=a;this.a=new _.hi;this.g=new _.J("clpp.vimond.VimondAdapter");this.f=this.h=!1;this.m&&this.a&&(this.g.debug(ny),this.a.on(this.m,_.Lf,this.o.bind(this)),this.a.on(this.m,_.hc,this.j.bind(this)),this.a.on(this.m,_.ic,this.l.bind(this)))},
4
+ uy=function(a,b){var c=a.m.getState();if(1===b)return["str-start",_.sf];if(a.h)return[_.ge,_.cf];if(c===_.Dq)return[_.ge,null];if(c===_.Hq)return[_.ie,_.cf];var d=_.cf;if(c===_.Bq||c===_.Kq||a.f)d=_.sf;return["period",d]},vy=function(){this.a=!1;this.g=new _.J(oy);this.j=this.h=this.f=null},wy=function(){};_.r=py.prototype;_.r.pl=function(){this.f||(this.f=1<Math.abs(this.w-this.m.getPosition()));this.w=this.m.getPosition()};_.r.ml=function(){this.g.debug("Ad break started");this.j=!0};
5
+ _.r.nl=function(){this.g.debug("Ad break stopped");this.j=!1};
6
+ _.r.ol=function(a){var b=this,c,d,e,f,g;return _.H(function(h){if(1==h.a){c=a.detail;d=_.Fq;e=c.currentState;f=c.previousState;b.g.debug("State changed, prev: "+f+" curr: "+e);if(b.A||b.j)return h["return"]();if(e===b.B&&!b.f)return b.g.debug("Ignore transition"),h["return"]();if(b.l&&e!==d.PLAYING)return h["return"]();if(b.f&&[d.PAUSED,d.BUFFERING].includes(e))return b.g.debug("Seeking"),h["return"]();b.f&&e===d.PLAYING&&(b.g.debug("Seeked"),b.f=!1);g=[d.PLAYING,d.PAUSED,d.ERROR,d.ENDED];if(!g.includes(e))return h.D(0);
7
+ b.B=e;return _.x(h,b.Uh(),3)}e===d.ENDED&&b.h.stop();_.z(h)})};
8
+ _.r.Uh=function(){var a=this,b,c,d,e,f,g;return _.H(function(h){if(1==h.a){var l=Math.floor(Date.now()/1E3);0<a.o&&a.g.debug("Last event was "+(l-a.o)+" seconds ago");a.o=l;a.h.stop();a.h.ha(a.l?10:a.G);a.l=!1;_.D(h,2);return _.x(h,a.F.fireEvent(),4)}if(2!=h.a)return b=h.f,qy(a,b),_.vh(h,0);d=c=_.F(h);e=d.code;f=d.data;g=[1002,1003];g.includes(e)?(a.g.debug("Unreachable service"),qy(a,f),ry(a,a.H,f)):1001===e?(a.g.debug("Generic service error"),qy(a,f),ry(a,a.I,f)):a.g.error(c.toString());_.z(h)})};sy.prototype.fireEvent=function(){this.f++;var a=_.L.ua(this.o);a.client.buildName=_.xa;a.client.buildVersion=_.ia;var b=a.client,c=this.a.m.getDrmInfo();b.drm=c?c.keySystem:"";a.client.pageUrl=document.location.href;a.client.streamUrl=this.a.m.getLoadedSource().url;a.client.userAgent=navigator.userAgent;a.client.videoFormat=this.a.m.getLoadedSource().type||"";b=a.client;c=this.a.m.getLoadedSource();c=((new _.Xj(c.url)).scheme||"").replace(":","");b.videoProtocol=c;b=uy(this.a,this.f);a.client.playerEvent=
9
+ b[0]||"";a.client.playerState=b[1]||"";a.progress.vod&&(a.progress.vod.position=this.a.getPosition());if(b=a.progress.live){c=this.a;var d=c.m.getPresentationStartTime()||0;c=Math.floor(d+c.m.getPosition());c=(new Date(1E3*c)).toISOString();b.position=c;d=this.a;c=d.m.getPosition();d=d.m.getSeekRange().end;b.onLiveEdge=30>Math.abs(d-c);typeof b.liveResumePossible!==_.Zc&&(b.liveResumePossible=!0)}a.progress.eventNumber=this.f;a.timestamp=(new Date).toISOString();this.g.debug("Fire an event");b=_.ik(this.l);
10
+ b.method=_.sb;b.contentType="application/json";b.headers.Authorization="Bearer "+this.h;b.body=_.Q.Hd(JSON.stringify(a));return this.j.fetch(b).T};sy.prototype.$g=function(a){this.h=a};ty.prototype.getPosition=function(){return Math.floor(this.m.getPosition())};ty.prototype.o=function(){this.h=!0};ty.prototype.j=function(){this.f=!0};ty.prototype.l=function(){this.f=!1};_.w(vy,_.ew);_.r=vy.prototype;_.r.onPlayerCreated=function(){};
11
+ _.r.onContentWillLoad=function(a){var b=a.getConfiguration();(this.a=!_.L.R(b.vimond)&&typeof b.vimond===_.Se)?a.namespace()===_.sd&&(this.a=!1,this.g.info("Vimond does not report when casting.")):this.g.debug("Vimond plugin is loaded but not configured. Will do nothing.");if(this.a){b=a.getConfiguration().vimond;for(var c=_.v(["authToken","playerEventRequest"]),d=c.next();!d.done;d=c.next())if(d=d.value,!b[d]){this.g.warn(d+" key is missing");a.onError(new _.N(1,9,9200));return}this.g.debug(_.ya);
12
+ c=b.failIfUnreachable;typeof c!==_.Zc&&(c=!0);d=b.failOnError;typeof d!==_.Zc&&(d=!0);this.f=new ty(a);this.h=new sy(b.playerEventRequest.uri,b.authToken,b.playerEventRequest.body,this.f,a.getNetworkEngine());this.j=new py(b.playerEventRequest.eventInterval,c,d,a,this.h)}};_.r.onPlayerWillRelease=function(){if(this.a){if(this.f){var a=this.f;a.g.debug(_.Rb);_.li(a.a)}this.j&&(a=this.j,a.g.debug(_.Rb),_.li(a.a),a.h.stop());this.j=this.h=this.f=null}};_.r.onPlayerWillDestroy=function(){};_.r.id=function(){return"vimond"};
13
+ _.r.$g=function(a){this.a&&this.h&&this.h.$g(a)};_.I(oy,vy);vy.prototype.updateAuthToken=vy.prototype.$g;vy.Id="vimond";wy.prototype.create=function(){return new vy};_.bu(new wy);};
14
14
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
15
15
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
16
16
  else{_=this.clpp._;(f.call(g,this));}