@castlabs/prestoplay 6.13.0 → 6.14.1

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 (62) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +7 -6
  5. package/cjs/cl.cast.js +111 -111
  6. package/cjs/cl.conviva.js +33 -33
  7. package/cjs/cl.core.js +528 -518
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +72 -72
  10. package/cjs/cl.externs.js +60 -58
  11. package/cjs/cl.freewheel.js +24 -24
  12. package/cjs/cl.hls.js +69 -67
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +29 -30
  15. package/cjs/cl.ima.js +23 -23
  16. package/cjs/cl.mse.js +265 -274
  17. package/cjs/cl.muxdata.js +15 -14
  18. package/cjs/cl.onboard.js +3 -3
  19. package/cjs/cl.persistent.js +13 -13
  20. package/cjs/cl.playlist.js +6 -6
  21. package/cjs/cl.simid.js +15 -15
  22. package/cjs/cl.smooth.js +71 -71
  23. package/cjs/cl.thumbnails.js +26 -26
  24. package/cjs/cl.tizen.js +70 -70
  25. package/cjs/cl.ttml.js +28 -28
  26. package/cjs/cl.verimatrix.js +5 -5
  27. package/cjs/cl.vimond.js +13 -13
  28. package/cjs/cl.vr.js +19 -19
  29. package/cjs/cl.vtt.js +14 -14
  30. package/cjs/cl.youbora.js +20 -20
  31. package/cl.adobe.js +3 -3
  32. package/cl.airplay.js +3 -3
  33. package/cl.broadpeak.js +5 -5
  34. package/cl.cast.js +88 -88
  35. package/cl.conviva.js +27 -27
  36. package/cl.core.js +441 -431
  37. package/cl.crypto.js +8 -8
  38. package/cl.dash.js +68 -68
  39. package/cl.externs.js +60 -58
  40. package/cl.freewheel.js +19 -19
  41. package/cl.hls.js +71 -69
  42. package/cl.hlssmpte.js +5 -5
  43. package/cl.htmlcue.js +26 -26
  44. package/cl.ima.js +17 -17
  45. package/cl.mse.js +236 -239
  46. package/cl.muxdata.js +13 -12
  47. package/cl.onboard.js +4 -4
  48. package/cl.persistent.js +11 -11
  49. package/cl.playlist.js +5 -5
  50. package/cl.simid.js +13 -13
  51. package/cl.smooth.js +59 -59
  52. package/cl.thumbnails.js +19 -19
  53. package/cl.tizen.js +57 -57
  54. package/cl.ttml.js +22 -22
  55. package/cl.verimatrix.js +4 -4
  56. package/cl.vimond.js +8 -8
  57. package/cl.vr.js +14 -14
  58. package/cl.vtt.js +12 -12
  59. package/cl.youbora.js +15 -15
  60. package/clpp.styles.css +2 -0
  61. package/package.json +4 -4
  62. package/typings.d.ts +93 -50
package/cjs/cl.tizen.js CHANGED
@@ -1,75 +1,75 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var MJ="An unknown error occurred while trying to get volume",NJ="Cannot get loading rendition due to platform limitations",OJ="PARAM_START_POSITION",PJ="SecurityError",QJ="The require privilege is: http://tizen.org/privilege/tv.audio",RJ="|STARTBITRATE\x3d",SJ=function(a,b,c){function d(e){c.call(a,e);a.removeEventListener(b,d)}a.addEventListener(b,d)},TJ=function(a,b){this.h=a;this.o=null;this.a=_.Se;this.l=null;this.j=!1;this.f=new Map;this.C=b;this.g=new _.K("clpp.tizen.DrmEngine")},WJ=function(a){var b,
3
- c,d;return _.E(function(e){if(1==e.a){b=a.a===_.Rd||a.a===_.Pd;if(!b)throw new _.P(_.Q,6,6001,"The key system "+a.a+" is not supported by the player or the platform");c=a.f.get(a.a);if(!c.Hd)throw new _.P(_.Q,6,6012,"No license server given for "+a.a);_.A(e,2);return a.a===_.Rd?_.x(e,UJ(a),5):_.x(e,VJ(a,c),5)}if(2!=e.a)return a.o={keySystem:a.a,licenseServerUri:c.Hd,distinctiveIdentifierRequired:!1,persistentStateRequired:c.Ff,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[],
4
- keyIds:[],periodId:null},_.ah(e,0);d=_.C(e);a.g.error("Error while configuring CDM for "+a.a,d);throw new _.P(_.Q,6,6005,{message:JSON.stringify(d)});})},VJ=function(a,b){var c,d,e,f;return _.E(function(g){c=XJ;d=YJ;e={};e[d.Wh]=!b.Ff;e[d.Xh]=b.Hd;""!==b.customData&&(e[d.Vh]=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)})},UJ=function(a){var b;return _.E(function(c){b=XJ;try{webapis.avplay.setDrm(b.Vd,
5
- "Initialize",""),webapis.avplay.setDrm(b.Vd,"widevine_app_session",a.l.id),webapis.avplay.setDrm(b.Vd,"widevine_data_type",a.l.type)}catch(d){throw d;}_.y(c)})},ZJ=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,t,v,z,D,G,F;_.E(function(B){if(1==B.a){c=XJ;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.Hd;l=_.rj([h],_.oj());l.type=3;l.body=f.buffer;l.method=
6
- "POST";_.A(B,2);return _.x(B,a.C.Gb.fetch(l).O,4)}if(2!=B.a){m=B.f;if(a.j){n=_.Ui(m.data);p=n.byteLength;q="";for(t=0;t<p;t++)q+=String.fromCharCode(n[t]);v=btoa(q);z=b.session_id+OJ+(v+OJ);a.g.debug("Widevine license params",z);try{webapis.avplay.setDrm(c.Vd,"widevine_license_data",z)}catch(I){a.g.error("License response rejected by CDM"),D=new _.P(_.Q,6,6008,{browserError:JSON.stringify(I)}),a.C.onError(D)}}return _.ah(B,0)}G=_.C(B);a.g.error("License request failed.",JSON.stringify(G));F=new _.P(_.Q,
7
- 6,6007,{message:_.ab,url:G.data.url,status:G.data.status||NaN,response:G.data.response||"",headers:G.data.headers||{}},G);a.C.onError(F);_.y(B)})},$J=function(a){this.m=a;this.a=this.m.a;this.f=_.Go;this.j=_.Ho;this.w=(new Date).getTime();this.l=!1;this.o=-1;this.h=2;this.g=new _.K("clpp.tizen.StateManager")},bK=function(a,b){if(a.f!==b)if(a.f===_.Ro&&b!==_.Go)a.g.debug(_.Uy+aK(b));else{var c=(new Date).getTime();a.j=a.f;a.f=b;a.f===_.Lo?(a.o=(new Date).getTime(),a.m.trigger(new _.L(_.jd,{detail:{bufferedTimeMS:-1,
8
- reason:a.h}}))):a.j===_.Lo&&a.m.trigger(new _.L(_.id,{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 _.L(_.Tf,{detail:d}));a.g.debug("State changed:",aK(a.j),"-\x3e",aK(a.f))}},aK=function(a){return Object.keys(_.Po)[a]},eK=function(a){if(a.l){var b=a.a.getState(),c=a.f;switch(b){case cK:c=_.Uo;break;case dK:c=_.To;break;default:a.m.isEnded()?c=_.No:a.g.debug("Inconsistent AVPlay playback state:",b)}bK(a,
9
- c)}},fK=function(){this.o=this.A=this.f=this.h=this.B=this.m=this.j=this.a=null;this.w=!0;this.l=null;this.g=new _.K("clpp.tizen.TextStreamer")},gK=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},hK=function(a){var b,c;return _.E(function(d){if(1==d.a)return b=a.m.getConfiguration(),c=null,_.x(d,_.Bs(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
- iK=function(a){var b=document.createElement(_.sg),c=new _.LA,d=new _.Tz(function(){return null}),e=a.m.getTextDisplayer();return new _.NA(b,c,e,d,a.m.getConfiguration())},jK=function(a){var b={Cb:function(){return a.m.getPosition()},X:a.h,Gb:a.m.getNetworkEngine(),wf:a.sj.bind(a),vf:a.rj.bind(a),onError:a.U.bind(a),mh:function(){},onEvent:function(){},qh:a.tj.bind(a),we:function(){},df:function(){return new _.SB},Re:function(){return!1},ud:null};return new _.QC(a.a,b)},kK=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},lK=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 _.Oj(String(c++),_.S);e.mimeType=a[d].mimeType;e.language=a[d].language;e.roles=a[d].roles;e.kind=
12
- a[d].kind||_.oz;var f=new _.Wj(String(a[d].id),e);f.bandwidth=a[d].bandwidth||null;e.renditions.push(f);b.push(e)}return b},mK=function(a){if(a.h&&!a.h.getTextDisplayer().isTextVisible())return null;if(a.f){var b=_.TC(a.f,_.bg),c=null;if(b){a=lK(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},nK=function(a,b){a.g.debug("Set active track",b);if(b&&(a.o=b.language,a.A=b.roles[0]||"",a.a&&a.f)){a.setTextVisibility(!0);var c=kK(a),
13
- 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):(_.dD(a.f,c,!0,0),a.m.trigger(new _.L(_.nl))),a.o=c.language):a.g.error(_.Ty,d.id)}},oK=function(){this.h=this.a=this.m=null;this.f={};this.g=new _.K("clpp.tizen.TrackManager");this.w=this.l=this.j=null;this.A=!1;this.o=1},pK=function(a,b){a.m.trigger(new _.L(_.wg,{details:{width:b.width,height:b.height,bandwidth:b.bandwidth,track:b.track,abrSelection:a.a.o}}))},
14
- qK=function(a){var b=a.ia();b&&a.m.trigger(new _.L(_.gd,{detail:{width:b.width,height:b.height,bandwidth:b.bandwidth,rendition:b}}))},rK=function(a){var b=a.m.getConfiguration(),c=_.Th(b.preferredAudioLanguage||[]),d=a.f[_.T]||[];if(d.length){var e=null;c.some(function(g){e=_.Hz(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.za(c)}else a.g.debug("Preferred language(s) not available")}else a.g.debug("Could not set preferred audio language")},vK=function(a,b){if(b){var c=b.track.type.toUpperCase();sK(a.a,c,Number(b.id)).then(function(){c===tK&&(a.j=b,a.m.trigger(new _.L(_.ml)));c===uK&&(a.l=b,a.m.trigger(new _.L(_.nl)))})["catch"](function(){a.g.error("Could not select "+c+" track.")})}else a.g.debug("Must provide valid rendition")},wK=
16
- function(a,b,c){var d=_.Ni(b.language||_.hg);c.language=_.Pj(d);c.originalLanguage=d;c.channelsCount=b.channels?Number(b.channels):null;c.mimeType=_.dd;a=new _.Wj(String(a),c);a.track=c;a.codec=b.fourCC||null;a.bandwidth=b.bit_rate||null;return a},xK=function(a,b,c){c.mimeType=_.ug;a=new _.Wj(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},yK=function(a,b,c){b=_.Ni(b.track_lang||_.hg);c.mimeType="text/ttml";
17
- c.language=_.Pj(b);c.originalLanguage=b;c.kind=_.oz;return new _.Wj(String(a),c)},zK=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},CK=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===AK}),f=b.filter(function(n){return n.type===tK}),g=[],h=0;h<f.length;h++){var l=zK(a,f[h].extra_info);if(l){var m=
18
- _.Ni(l.language||_.hg);m=_.Pj(m);m=c(g,m);m||(m=new _.Oj(String(a.o++),_.T),g.push(m));m.renditions.push(wK(f[h].index,l,m))}else a.g.warn("Skipping audio stream with no extra info")}f=new _.Oj(String(a.o++),_.Qj);for(h=0;h<e.length;h++)(l=zK(a,e[h].extra_info))?f.renditions.push(xK(e[h].index,l,f)):a.g.warn("Skipping video stream with no extra info");e=[];e=a.h?lK(a.h):BK(a,b);d[_.Qj]=[f];d[_.T]=g;d[_.S]=e;return d},BK=function(a,b){for(var c=b.filter(function(h){return h.type===uK}),d=[],e=0;e<
19
- c.length;e++){var f=zK(a,c[e].extra_info);if(f){var g=new _.Oj(String(a.o++),_.S);g.renditions.push(yK(c[e].index,f,g));d.push(g)}else a.g.warn("Skipping text stream with no extra info")}return d},DK=function(a,b){for(var c=a.f[_.Qj]||[],d=[],e=0;e<c.length;e++)for(var f=0;f<c[e].renditions.length;f++)_.N.ra(c[e].renditions[f],b,Object.keys(b))&&d.push(c[e].renditions[f]);return d[0]||null},EK=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},GK=function(a,b){if(b===_.S&&a.h)return mK(a.h);var c=FK(a.a)||[];if(0===c.length)return null;c=c.filter(function(e){return e.type===b.toUpperCase()})[0];var d=null;b===_.Qj&&(d=zK(a,c.extra_info),d=DK(a,{width:d.Width,height:d.Height}));b===_.T&&(c?(d=EK(a,c,_.T),a.j=d):d=a.j);b===_.S&&(c?(d=EK(a,c,_.S),a.l=d):d=a.l);return d},HK=function(a){_.tl.call(this);this.m=a;this.h=null;this.g=new _.K("clpp.tizen.Middleware");this.D=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={}},IK=function(a){return _.E(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)})},KK=function(a){try{webapis.avplay.setListener({onbufferingstart:a.mj.bind(a),onbufferingprogress:a.lj.bind(a),onbufferingcomplete:a.kj.bind(a),onstreamcompleted:a.pj.bind(a),oncurrentplaytime:function(b){a.trigger(new _.L(JK,
22
- {currentTime:b}))},onevent:a.oj.bind(a),onsubtitlechange:a.qj.bind(a),ondrmevent:a.nj.bind(a),onerror:a.U.bind(a)})}catch(b){a.g.error(b)}},LK=function(a){var b=!!a.m.getTrackManager().Qa();try{webapis.avplay.setSilentSubtitle(!b)}catch(c){a.g.debug("Could not set AVPlay subtitle config",c)}},MK=function(a,b){try{var c=b.estimatedBandwidth||0,d=b.currentBandwidth||0;a.g.debug({estimatedBandwidth:c,Ym:d});0!==c&&0!==d&&c>=1.15*d&&webapis.avplay.setStreamingProperty("ADAPTIVE_INFO",RJ+d)}catch(e){a.g.debug(e)}},
23
- NK=function(a,b){try{webapis.avplay.setStreamingProperty("ADAPTIVE_INFO","|BITRATES\x3d"+b+RJ+b)}catch(c){throw a.g.debug("Could not set fixed bandwidth",c),c;}},QK=function(a){return{position:a.getPosition(),state:a.m.getState(),dg:a.getState(),playbackRate:a.getPlaybackRate(),isLive:a.isLive(),duration:a.getDuration(),isMuted:OK(a),volume:a.getVolume(),tm:PK(a),Hj:FK(a)}},SK=function(a){var b,c;return _.E(function(d){if(1==d.a)return _.x(d,RK(),2);if(3!=d.a)return b=new Promise(function(e){(new _.uk(e)).aa(5)}),
24
- _.x(d,Promise.race([IK(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)})},YK=function(a,b,c){var d,e,f,g,h,l,m,n;return _.E(function(p){switch(p.a){case 1:a.l=_.Yo(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 _.L(TK)),f=c.currentPosition);
25
- _.A(p,2);g=a.l[d].url;h=a.l[d].type;h!==_.Tc||g.includes(".mpd")||(l=new URL(g),l.searchParams.append("cl-ext",".mpd"),g=l.toString());webapis.avplay.open(g);e.nextBandwidth?(NK(a,e.nextBandwidth),a.o=!1):(a.o||MK(a,e),a.o=!0);KK(a);if(!b.drm||!b.drm.env){a.g.debug("No DRM configuration was provided. Assuming clear content");p.F(4);break}m={onError:function(q){return a.m.onError(q)},Gb:a.m.getNetworkEngine()};a.h=new TJ(b.drm,m);return _.x(p,a.h.init(),4);case 4:return a.f||a.trigger(new _.L(UK)),
26
- _.x(p,VK(a),6);case 6:a.f||a.trigger(new _.L(WK));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&&XK(a,b.muted),b.autoplay&&a.m.play()["catch"](function(q){a.g.debug("Autoplay failed",q)}));_.ah(p,0);break;case 2:throw n=_.C(p),a.g.debug("Error while attempting to load source."),n;}})},VK=function(a){return _.E(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
- LK(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)}}))})},ZK=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=QK(a);a.f=!0;webapis.avplay.stop();webapis.avplay.close();return a.load(a.m.getConfiguration(),d).then(function(){var e=a.a.dg;a.f=!1;a.a=
28
- null;return e===dK?a.pause():a.play()})}catch(e){return Promise.reject(e)}},PK=function(a){return a.f&&a.a?a.a.tm:webapis.avplay.getTotalTrackInfo()},FK=function(a){return a.f&&a.a?a.a.Hj:webapis.avplay.getCurrentStreamInfo()},sK=function(a,b,c){b=b.toUpperCase();b===uK&&$K(a,!0);var d=a.j[b];d&&(d.Ae.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,ag:0,Ae:new _.uk(function(){return g(h,c,!0)})}),(l=a.j[h])&&3>l.ag?(!a.w&&++l.ag,l.Ae.aa(a.w?.5:.25)):(a.g.debug("Could not set track after multiple attempts.Giving up..."),l&&l.Ae.stop(),a.j[h]=null,f())}}g(b,c)})},$K=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)}},XK=function(a,b){try{tizen.tvaudiocontrol.setMute(b)}catch(c){switch(c.name){case PJ:a.g.warn("The application does not have the privilege to set mute.",QJ);break;default:a.g.warn(MJ,c)}}},OK=function(a){var b=null;try{b=tizen.tvaudiocontrol.isMute()}catch(c){switch(c.name){case PJ:a.g.warn("The application doesn't have the privilege to get the mute state.",QJ);break;default:a.g.warn(MJ,c)}}return!!b},RK=function(){return new Promise(function(a,b){if(window.webapis)a();else{var c=document.createElement("script");
31
- SJ(c,"load",function(d){return a(d)});SJ(c,_.ne,function(d){return b(d)});c.src="$WEBAPIS/webapis/webapis.js";document.querySelector("head").appendChild(c)}})},aL=function(){_.tl.call(this);this.a=new HK(this);this.f=new $J(this);this.configuration=this.B=_.zl();this.w=null;this.g=new _.K("clpp.tizen.Player");this.j=null;this.l=new oK;this.D=new _.Ij;this.o=this.h=null;this.A=!1},bL=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())},cL=function(){},dL=function(){};
33
- TJ.prototype.init=function(){var a=this,b,c,d,e,f,g;return _.E(function(h){if(1==h.a){b=_.Ul[a.h.env]||null;if(!b)throw a.g.debug(_.Aa,_.Mb+a.h.env+_.ca),new _.P(_.Q,6,6015,_.Ba+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=_.Wl(b,a.h.customData);(e=d[_.Pd])&&a.f.set(_.Pd,{Hd:e.licenseUrl||"",customData:c,Ff:!1});(f=d[_.Rd])&&a.f.set(_.Rd,{Hd:f.licenseUrl||"",customData:c,
34
- Ff:!1});if(0===a.f.size)throw new _.P(_.Q,6,6E3);if((g=a.h.preferredDrmSystem)&&a.f.get(g))a.a=g;else if(a.f.get(_.Pd))a.a=_.Pd;else if(a.f.get(_.Rd))a.a=_.Rd;else throw new _.P(_.Q,6,6001,"Configuration for the target system is missing.");return _.x(h,WJ(a),2)}a.j=!0;_.y(h)})};TJ.prototype.release=function(){var a=this;return _.E(function(b){a.j=!1;a.o=null;a.a=_.Se;a.l=null;a.f=new Map;_.y(b)})};TJ.prototype.getDrmInfo=function(){return this.o};
35
- var YJ={Wh:"DeleteLicenseAfterUse",Xh:"LicenseServer",Im:"GetChallenge",Jm:"HttpHeader",Nm:"UserAgent",Dm:"Cookie",Vh:"CustomData"};_.r=$J.prototype;_.r.initialize=function(){this.a.on(TK,this.rg,this);this.a.on(eL,this.qg,this);this.a.on(fL,this.pg,this);this.a.on(UK,this.th,this);this.a.on(WK,this.sh,this);this.a.on(gL,this.sg,this)};_.r.release=function(){bK(this,_.Go);this.l=!1;this.o=-1;this.h=2};_.r.destroy=function(){this.release();this.a.off(TK,this.rg);this.a.off(eL,this.qg);this.a.off(fL,this.pg);this.a.off(UK,this.th);this.a.off(WK,this.sh);this.a.off(gL,this.sg);this.m=this.a=null};
36
- _.r.rg=function(){this.g.debug("Buffering start. Player state: ",this.a.getState());this.h=this.a.B?1:2;bK(this,_.Lo)};_.r.qg=function(a){this.g.debug("Buffering progress: "+a.percent+" %. Player state: ",aK(this.f))};_.r.pg=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()===hL;if(!a&&b){bK(this,_.To);return}}if(a=this.f!==_.So)a=this.a.getState(),a=a===cK||a===dK;a&&eK(this)};
37
- _.r.th=function(){this.g.debug("Preparing starts. AVPlay State: ",this.a.getState());this.a.getState()===iL?bK(this,_.So):this.g.error("AVPlay prepares while state is not IDLE")};_.r.sh=function(){this.g.debug("Preparing ends: AVPlay state:",this.a.getState())};_.r.sg=function(){bK(this,_.No)};_.r.getState=function(){return this.f};_.r=fK.prototype;_.r.initialize=function(a){this.m=a};
38
- _.r.load=function(a){var b=this,c,d,e,f,g,h,l;return _.E(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,hK(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={networkingEngine:b.m.getNetworkEngine(),filterNewPeriod:function(){},filterAllPeriods:function(){},onTimelineCueAdded:function(){},onEvent:function(){},
39
- onError:function(){}};_.A(m,3);e=b;return _.x(m,b.j.start(a.url,d),5);case 5:e.a=m.f;_.ah(m,4);break;case 3:return f=_.C(m),b.g.warn(f),_.A(m,6),g=b,_.x(m,b.j.start(a.url.replace("https://","http://"),d),8);case 8:g.a=m.f;_.ah(m,4);break;case 6:h=_.C(m),b.g.error(h),b.a=null;case 4:if(!b.a||!gK(b.a)){m.F(0);break}b.h=iK(b);_.A(m,10);return _.x(m,b.h.I,12);case 12:b.f=jK(b);l=b.m.getConfiguration();b.f.h=l.streaming;b.o=l.preferredTextLanguage;b.A=l.preferredTextRole;_.ah(m,0);break;case 10:_.C(m),
40
- b.g.debug("Could not setup media source..."),b.h=null,b.f=null,b.j=null,b.a=null,_.y(m)}})};_.r.sj=function(a){this.g.debug(_.iz,a);this.w=!0;var b=_.vB(a.textStreams,this.o||"",this.A||"")[0]||null;this.l&&(a.textStreams.includes(this.l)&&(b=this.l),this.l=null);return{variant:null,text:b}};_.r.rj=function(){this.g.debug("canSwitch_");this.w=!1;this.l&&(_.dD(this.f,this.l,!0,0),this.l=null)};_.r.U=function(){this.g.debug("onError_")};_.r.tj=function(){this.j&&this.j.update&&this.j.update()};
41
- _.r.start=function(){var a=this;return _.E(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 _.E(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 _.E(function(b){switch(b.a){case 1:if(!a.j){b.F(2);break}return _.x(b,a.j.stop(),3);case 3:a.j=null;case 2:if(!a.f){b.F(4);break}return _.x(b,a.f.destroy(),5);case 5:a.f=null,a.w=!0;case 4:if(!a.h){b.F(0);break}return _.x(b,a.h.destroy(),7);case 7:a.h=null,_.y(b)}})};_.w(oK,_.U);_.r=oK.prototype;_.r.ih=function(a){var b=a.eventid;a=a.data;switch(b){case jL:0<Object.keys(this.f).length||(this.g.debug("Loading track manager!"),this.load());b=webapis.avplay.getCurrentStreamInfo();0<b.length&&(b=+zK(this,b[0].extra_info).Bit_rate,b=DK(this,{bandwidth:b}))&&(this.w=b,pK(this,b));break;case kL:qK(this);break;default:this.g.debug("Event type: "+b+" data: "+a)}};_.r.zf=function(a){a.detail.currentState===_.Uo&&this.m.off(_.Tf,this.zf)};
43
- _.r.initialize=function(a){var b=this;this.m=a;this.a=this.m.a;this.m.on(_.Tf,function(c){b.A||(c=c.detail,c.currentState===_.Uo&&(b.g.debug("Current state",c.currentState),b.A=!0,rK(b)))});this.a.on(lL,this.ih,this)};_.r.release=function(){this.f={};this.h=this.w=this.l=this.j=null;this.A=!1;this.o=1};
44
- _.r.load=function(){if(this.a&&!(0<Object.keys(this.f).length)){this.h=this.m.h;this.m.off(_.Tf,this.zf);this.m.on(_.Tf,this.zf,this);try{var a=PK(this.a);this.f=CK(this,a);var b=this.f[_.T]||[];b.length&&(this.j=b[0].renditions[0]||null);qK(this)}catch(c){this.g.debug("Could not load track manager")}}};_.r.destroy=function(){this.a.off(lL,this.ih);this.a=this.m=null};_.r.getVideoTracks=function(){return this.f[_.Qj]||[]};_.r.getAudioTracks=function(){return this.f[_.T]||[]};
45
- _.r.ja=function(){return this.f[_.S]||[]};_.r.ia=function(){return GK(this,_.Qj)};_.r.Oa=function(){return GK(this,_.T)};_.r.Qa=function(){return GK(this,_.S)};_.r.ab=function(){return this.w};_.r.kb=function(){this.g.info(NJ);return null};_.r.lb=function(){this.g.info(NJ);return null};_.r.Sa=function(){var a=this.ia();return a?a.track:null};_.r.sa=function(){var a=this.Oa();return a?a.track:null};_.r.ta=function(){var a=this.Qa();return a?a.track:null};
46
- _.r.gb=function(a){var b=this;null===a?(a=this.ia(),ZK(this.a,a.bandwidth,null).then(function(){qK(b)})):0<a.renditions.length&&this.fb(a.renditions[0])};_.r.za=function(a){a?vK(this,a.renditions[0]):this.g.warn("Cannot disable audio tracks on this platform.","Consider muting audio instead...")};_.r.Ja=function(a){a?(a=a.renditions[0],this.h?nK(this.h,a.track):vK(this,a)):(this.g.debug("Disabling text tracks"),this.l=null,$K(this.a,!1),this.m.trigger(new _.L(_.nl)))};
47
- _.r.fb=function(a){var b=this,c=this.ia();this.a.o||a.width!==c.width||a.height!==c.height||a.bandwidth!==c.bandwidth?(this.w=a,pK(this,a),ZK(this.a,c.bandwidth,a.bandwidth).then(function(){qK(b)})["catch"](function(d){var e=new _.P(_.Q,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.rb=function(a){vK(this,a)};_.r.sb=function(a){this.h?nK(this.h,a.track):vK(this,a)};
48
- _.r.addTextTrack=function(){};_.r.la=function(){return this.a.o};oK.prototype.isAbrEnabled=oK.prototype.la;oK.prototype.addTextTrack=oK.prototype.addTextTrack;oK.prototype.setTextRendition=oK.prototype.sb;oK.prototype.setAudioRendition=oK.prototype.rb;oK.prototype.setVideoRendition=oK.prototype.fb;oK.prototype.setTextTrack=oK.prototype.Ja;oK.prototype.setAudioTrack=oK.prototype.za;oK.prototype.setVideoTrack=oK.prototype.gb;oK.prototype.getTextTrack=oK.prototype.ta;oK.prototype.getAudioTrack=oK.prototype.sa;
49
- oK.prototype.getVideoTrack=oK.prototype.Sa;oK.prototype.getLoadingTextRendition=oK.prototype.lb;oK.prototype.getLoadingAudioRendition=oK.prototype.kb;oK.prototype.getLoadingVideoRendition=oK.prototype.ab;oK.prototype.getTextRendition=oK.prototype.Qa;oK.prototype.getAudioRendition=oK.prototype.Oa;oK.prototype.getVideoRendition=oK.prototype.ia;oK.prototype.getTextTracks=oK.prototype.ja;oK.prototype.getAudioTracks=oK.prototype.getAudioTracks;oK.prototype.getVideoTracks=oK.prototype.getVideoTracks;_.w(HK,_.tl);_.r=HK.prototype;_.r.mj=function(){this.w=!0;this.f||this.trigger(new _.L(TK))};_.r.lj=function(a){this.w=!0;this.trigger(new _.L(eL,{percent:a}))};_.r.kj=function(){this.w=!1;this.trigger(new _.L(fL))};_.r.pj=function(){this.trigger(new _.L(gL))};_.r.oj=function(a,b){this.trigger(new _.L(lL,{eventid:a,data:b}))};_.r.qj=function(a,b,c,d,e){this.trigger(new _.L(mL,{duration:a,text:b,subtitleType:c,attriCount:d,attributes:e}))};
50
- _.r.nj=function(a,b){this.trigger(new _.L(nL,{drmType:a,drmData:b}));if(this.h){var c=this.h;if(c.j)if(c.a===_.Rd&&"Challenge"===b.name)ZJ(c,b);else if("DrmError"===b.name){c.g.debug("DrmError event",b);var d=new _.P(_.Q,6,6005,{message:JSON.stringify(b)});c.C.onError(d)}}};_.r.U=function(a){this.trigger(new _.L(oL,{eventType:a}))};
51
- _.r.play=function(){function a(){return new Promise(function(d,e){function f(){d();clearTimeout(g)}var g=null;b.one(JK,f,b);g=setTimeout(function(){b.off(JK,f);e("Timeout")},3E4)})}var b=this,c=this.getState();if(c===iL)return(new Promise(function(d,e){webapis.avplay.prepareAsync(function(){LK(b);d(webapis.avplay.play())},function(f){b.trigger(new _.L(oL));e(f)})})).then(function(){return a()});if(c===dK||c===hL)try{return webapis.avplay.play(),a()}catch(d){return Promise.reject(d)}return c===cK?
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()===dK?Promise.resolve():Promise.reject()};
53
- _.r.setPlaybackRate=function(a){var b=this.getState();if(b===hL||b===cK||b===dK){try{webapis.avplay.setSpeed(a),this.D=a}catch(c){return this.g.debug("Error while trying to set playback rate",c),this.setPlaybackRate(this.D)}return!0}this.g.debug("Cannot set playback rate; AVPlay is in inconsistent state: "+b);return!1};_.r.getPlaybackRate=function(){return this.D};
54
- _.r.load=function(a,b){var c=this,d;return _.E(function(e){switch(e.a){case 1:return c.g.debug("configure()",b||""),_.A(e,2),_.x(e,SK(c),4);case 4:return _.x(e,YK(c,a,b),5);case 5:_.ah(e,0);break;case 2:throw d=_.C(e),new _.P(_.Q,7,7003,null,d);}})};_.r.getState=function(){if(this.f&&this.a)return this.a.dg;try{return webapis.avplay.getState()}catch(a){this.U(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 _.L(_.ng));webapis.avplay.seekTo(c,function(){b.B=!1;b.m.trigger(new _.L(_.mg));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.U(JSON.stringify(a))}};_.r.getDuration=function(){if(this.f&&this.a)return this.a.duration;try{return webapis.avplay.getDuration()/1E3}catch(a){this.U(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.Ae.stop()}a.j={};a.D=1;a.B=!1;a.l=null;a.a=null;return b()}catch(f){return c(f)}})};_.r.getVolume=function(){var a=null;try{a=tizen.tvaudiocontrol.getVolume()}catch(b){switch(b.name){case PJ:this.g.debug("The application does not have the privilege to get the volume.",QJ);break;default:this.g.debug(MJ,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 PJ:this.g.warn("The application does not have the privilege to set the volume.",QJ);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.U(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 iL="IDLE",hL="READY",cK="PLAYING",dK="PAUSED",AK=_.lc,tK="AUDIO",uK="TEXT",kL="PLAYER_MSG_RESOLUTION_CHANGED",jL="PLAYER_MSG_BITRATE_CHANGE",XJ={PLAYREADY:"PLAYREADY",Fm:"EME_PLAYREADY",Om:"VERIMATRIX",Vd:"WIDEVINE_CDM",Gm:"EME_WIDEVINE_CDM",Qm:"WIDEVINE_CLASSIC"};_.w(aL,_.tl);_.r=aL.prototype;_.r.ng=function(){var a=this;this.g.debug("On Stream completed. Current time: ",this.getPosition());this.trigger(new _.L(_.me));this.configuration.loop?this.seek(this.configuration.startTime||0)["catch"](function(){a.g.debug("Could not loop playback")}):this.a.stop()};_.r.lg=function(a){this.trigger(new _.L(_.eg,{currentTime:a.currentTime/1E3}))};
60
- _.r.og=function(a){var b=this.a.getPosition(),c=b+a.duration/1E3,d=a.text||"";this.g.debug("Got subtitles: ",d,"start:",b,"end:",c,a);(d=_.R.Of(d))&&this.o.append([new _.di(b,c,d)],[])};_.r.mg=function(a){this.g.debug("DRM event: "+a.drmType+", data: "+a.drmData)};_.r.kh=function(){this.A||(this.g.debug("Initial buffering completed..."),this.A=!0)};
61
- _.r.U=function(a){this.g.debug("Error: TYPE: "+a.eventType);bK(this.f,_.Ro);a=new _.P(_.Q,7,7200,{tizenerror:a.eventType});this.a.release();this.trigger(new _.L(_.ne,{detail:a}))};
62
- _.r.init=function(a,b){this.configuration=this.B=b;this.w=a;this.a.on(gL,this.ng,this);this.a.on(JK,this.lg,this);this.a.on(mL,this.og,this);this.a.on(nL,this.mg,this);this.a.on(oL,this.U,this);this.a.on(fL,this.kh,this);this.f.initialize();this.l.initialize(this);this.g.debug("Initializing player surface");this.w.hideMediaElement();var c=pL;pL+=1;this.j=_.pp(_.Te,{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=[_.Hg,_.qe,"position",_.xe,"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];_.rp(c,f);bL(this)}};_.r.getSurface=function(){return this.w};_.r.getConfiguration=function(){return this.configuration};
64
- _.r.destroy=function(){var a=this;return _.E(function(b){switch(b.a){case 1:return _.x(b,a.release(),2);case 2:a.a.off(gL,a.ng);a.a.off(JK,a.lg);a.a.off(mL,a.og);a.a.off(nL,a.mg);a.a.off(oL,a.U);a.a.off(fL,a.kh);if(!a.h){b.F(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 qL};_.r.getPlaybackRate=function(){return this.a.getPlaybackRate()};
65
- _.r.setDrmCustomDataModifier=function(){};_.r.setCdnErrorCallback=function(){};_.r.detach=function(){};_.r.setPlaybackRate=function(a){this.a.setPlaybackRate(a)};_.r.getPosition=function(){return 0<(this.configuration.startTime||0)&&!this.A?0:this.f.getState()===_.No?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()};_.r.getPresentationStartTime=function(){return null};
66
- _.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.a.getDuration()};_.r.getBufferInfo=function(){this.g.warn(_.va);return new _.sl};_.r.getTrackManager=function(){return this.l};_.r.unload=function(){var a=this;return this.a.release().then(function(){a.l.release()})};
2
+ var f=function(window){var iK="An unknown error occurred while trying to get volume",jK="Cannot get loading rendition due to platform limitations",kK="PARAM_START_POSITION",lK="SecurityError",mK="The require privilege is: http://tizen.org/privilege/tv.audio",nK="|STARTBITRATE\x3d",oK=function(a,b,c){function d(e){c.call(a,e);a.removeEventListener(b,d)}a.addEventListener(b,d)},pK=function(a,b){this.h=a;this.o=null;this.a=_.Ue;this.l=null;this.j=!1;this.f=new Map;this.C=b;this.g=new _.K("clpp.tizen.DrmEngine")},sK=function(a){var b,
3
+ c,d;return _.E(function(e){if(1==e.a){b=a.a===_.Sd||a.a===_.Qd;if(!b)throw new _.P(_.Q,6,6001,"The key system "+a.a+" is not supported by the player or the platform");c=a.f.get(a.a);if(!c.Kd)throw new _.P(_.Q,6,6012,"No license server given for "+a.a);_.A(e,2);return a.a===_.Sd?_.x(e,qK(a),5):_.x(e,rK(a,c),5)}if(2!=e.a)return a.o={keySystem:a.a,licenseServerUri:c.Kd,distinctiveIdentifierRequired:!1,persistentStateRequired:c.Gf,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[],
4
+ keyIds:[],periodId:null},_.bh(e,0);d=_.C(e);a.g.error("Error while configuring CDM for "+a.a,d);throw new _.P(_.Q,6,6005,{message:JSON.stringify(d)});})},rK=function(a,b){var c,d,e,f;return _.E(function(g){c=tK;d=uK;e={};e[d.Zh]=!b.Gf;e[d.$h]=b.Kd;""!==b.customData&&(e[d.Yh]=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)})},qK=function(a){var b;return _.E(function(c){b=tK;try{webapis.avplay.setDrm(b.Wd,
5
+ "Initialize",""),webapis.avplay.setDrm(b.Wd,"widevine_app_session",a.l.id),webapis.avplay.setDrm(b.Wd,"widevine_data_type",a.l.type)}catch(d){throw d;}_.y(c)})},vK=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,t,v,z,D,G,F;_.E(function(B){if(1==B.a){c=tK;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.Kd;l=_.uj([h],_.rj());l.type=3;l.body=f.buffer;l.method=
6
+ "POST";_.A(B,2);return _.x(B,a.C.sb.fetch(l).O,4)}if(2!=B.a){m=B.f;if(a.j){n=_.Xi(m.data);p=n.byteLength;q="";for(t=0;t<p;t++)q+=String.fromCharCode(n[t]);v=btoa(q);z=b.session_id+kK+(v+kK);a.g.debug("Widevine license params",z);try{webapis.avplay.setDrm(c.Wd,"widevine_license_data",z)}catch(H){a.g.error("License response rejected by CDM"),D=new _.P(_.Q,6,6008,{browserError:JSON.stringify(H)}),a.C.onError(D)}}return _.bh(B,0)}G=_.C(B);a.g.error("License request failed.",JSON.stringify(G));F=new _.P(_.Q,
7
+ 6,6007,{message:_.$a,url:G.data.url,status:G.data.status||NaN,response:G.data.response||"",headers:G.data.headers||{}},G);a.C.onError(F);_.y(B)})},wK=function(a){this.m=a;this.a=this.m.a;this.f=_.Vo;this.j=_.Wo;this.w=(new Date).getTime();this.l=!1;this.o=-1;this.h=2;this.g=new _.K("clpp.tizen.StateManager")},yK=function(a,b){if(a.f!==b)if(a.f===_.fp&&b!==_.Vo)a.g.debug(_.rz+xK(b));else{var c=(new Date).getTime();a.j=a.f;a.f=b;a.f===_.$o?(a.o=(new Date).getTime(),a.m.trigger(new _.L(_.kd,{detail:{bufferedTimeMS:-1,
8
+ reason:a.h}}))):a.j===_.$o&&a.m.trigger(new _.L(_.jd,{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 _.L(_.Vf,{detail:d}));a.g.debug("State changed:",xK(a.j),"-\x3e",xK(a.f))}},xK=function(a){return Object.keys(_.dp)[a]},BK=function(a){if(a.l){var b=a.a.getState(),c=a.f;switch(b){case zK:c=_.ip;break;case AK:c=_.hp;break;default:a.m.isEnded()?c=_.bp:a.g.debug("Inconsistent AVPlay playback state:",b)}yK(a,
9
+ c)}},CK=function(){this.o=this.A=this.f=this.h=this.B=this.m=this.j=this.a=null;this.D=!1;this.w=!0;this.l=null;this.g=new _.K("clpp.tizen.TextStreamer")},DK=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},EK=function(a){var b,c;return _.E(function(d){if(1==d.a)return b=a.m.getConfiguration(),c=null,_.x(d,_.at(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
+ FK=function(a){var b=document.createElement(_.tg),c=new _.gB,d=new _.kA(function(){return null}),e=a.m.getTextDisplayer();return new _.iB(b,c,e,d,a.m.getConfiguration())},GK=function(a){var b={Db:function(){return a.m.getPosition()},X:a.h,sb:a.m.getNetworkEngine(),wf:a.vj.bind(a),vf:a.uj.bind(a),onError:a.T.bind(a),oh:function(){},onEvent:function(){},sh:a.wj.bind(a),we:function(){},df:function(){return new _.mC},Re:function(){return!1},wd:null};return new _.kD(a.a,b)},HK=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},IK=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 _.Rj(String(c++),_.T);e.mimeType=a[d].mimeType;e.language=a[d].language;e.roles=a[d].roles;e.kind=
12
+ a[d].kind||_.Mz;var f=new _.ak(String(a[d].id),e);f.bandwidth=a[d].bandwidth||null;e.renditions.push(f);b.push(e)}return b},JK=function(a){if(a.h&&!a.h.getTextDisplayer().isTextVisible())return null;if(a.f){var b=_.nD(a.f,_.Di),c=null;if(b){a=IK(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},KK=function(a,b){a.g.debug("Set active track",b);if(b&&(a.o=b.language,a.A=b.roles[0]||"",a.D=b.kind===_.qe,a.a&&a.f)){a.setTextVisibility(!0);
13
+ var c=HK(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):(_.yD(a.f,c,!0,0),a.m.trigger(new _.L(_.zl))),a.o=c.language):a.g.error(_.qz,d.id)}},LK=function(){this.h=this.a=this.m=null;this.f={};this.g=new _.K("clpp.tizen.TrackManager");this.w=this.l=this.j=null;this.A=!1;this.o=1},MK=function(a,b){a.m.trigger(new _.L(_.xg,{details:{width:b.width,height:b.height,bandwidth:b.bandwidth,track:b.track,abrSelection:a.a.o}}))},
14
+ NK=function(a){var b=a.ka();b&&a.m.trigger(new _.L(_.hd,{detail:{width:b.width,height:b.height,bandwidth:b.bandwidth,rendition:b}}))},OK=function(a){var b=a.m.getConfiguration(),c=_.Th(b.preferredAudioLanguage||[]),d=a.f[_.Tj]||[];if(d.length){var e=null;c.some(function(g){e=_.dA(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.za(c)}else a.g.debug("Preferred language(s) not available")}else a.g.debug("Could not set preferred audio language")},SK=function(a,b){if(b){var c=b.track.type.toUpperCase();PK(a.a,c,Number(b.id)).then(function(){c===QK&&(a.j=b,a.m.trigger(new _.L(_.yl)));c===RK&&(a.l=b,a.m.trigger(new _.L(_.zl)))})["catch"](function(){a.g.error("Could not select "+c+" track.")})}else a.g.debug("Must provide valid rendition")},TK=
16
+ function(a,b,c){var d=_.Qi(b.language||_.ig);c.language=_.Sj(d);c.originalLanguage=d;c.channelsCount=b.channels?Number(b.channels):null;c.mimeType=_.dd;a=new _.ak(String(a),c);a.track=c;a.codec=b.fourCC||null;a.bandwidth=b.bit_rate||null;return a},UK=function(a,b,c){c.mimeType=_.vg;a=new _.ak(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},VK=function(a,b,c){b=_.Qi(b.track_lang||_.ig);c.mimeType="text/ttml";
17
+ c.language=_.Sj(b);c.originalLanguage=b;c.kind=_.Mz;return new _.ak(String(a),c)},WK=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},ZK=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===XK}),f=b.filter(function(n){return n.type===QK}),g=[],h=0;h<f.length;h++){var l=WK(a,f[h].extra_info);if(l){var m=
18
+ _.Qi(l.language||_.ig);m=_.Sj(m);m=c(g,m);m||(m=new _.Rj(String(a.o++),_.Tj),g.push(m));m.renditions.push(TK(f[h].index,l,m))}else a.g.warn("Skipping audio stream with no extra info")}f=new _.Rj(String(a.o++),_.Uj);for(h=0;h<e.length;h++)(l=WK(a,e[h].extra_info))?f.renditions.push(UK(e[h].index,l,f)):a.g.warn("Skipping video stream with no extra info");e=[];e=a.h?IK(a.h):YK(a,b);d[_.Uj]=[f];d[_.Tj]=g;d[_.T]=e;return d},YK=function(a,b){for(var c=b.filter(function(h){return h.type===RK}),d=[],e=0;e<
19
+ c.length;e++){var f=WK(a,c[e].extra_info);if(f){var g=new _.Rj(String(a.o++),_.T);g.renditions.push(VK(c[e].index,f,g));d.push(g)}else a.g.warn("Skipping text stream with no extra info")}return d},$K=function(a,b){for(var c=a.f[_.Uj]||[],d=[],e=0;e<c.length;e++)for(var f=0;f<c[e].renditions.length;f++)_.O.ta(c[e].renditions[f],b,Object.keys(b))&&d.push(c[e].renditions[f]);return d[0]||null},aL=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},cL=function(a,b){if(b===_.T&&a.h)return JK(a.h);var c=bL(a.a)||[];if(0===c.length)return null;c=c.filter(function(e){return e.type===b.toUpperCase()})[0];var d=null;b===_.Uj&&(d=WK(a,c.extra_info),d=$K(a,{width:d.Width,height:d.Height}));b===_.Tj&&(c?(d=aL(a,c,_.Tj),a.j=d):d=a.j);b===_.T&&(c?(d=aL(a,c,_.T),a.l=d):d=a.l);return d},dL=function(a){_.Fl.call(this);this.m=a;this.h=null;this.g=new _.K("clpp.tizen.Middleware");this.D=1;this.B=!1;this.l=null;this.G=
21
+ 0;this.o=!0;this.f=!1;this.a=null;this.A=1;this.w=!1;this.j={}},eL=function(a){return _.E(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)})},gL=function(a){try{webapis.avplay.setListener({onbufferingstart:a.pj.bind(a),onbufferingprogress:a.oj.bind(a),onbufferingcomplete:a.nj.bind(a),onstreamcompleted:a.sj.bind(a),oncurrentplaytime:function(b){a.trigger(new _.L(fL,
22
+ {currentTime:b}))},onevent:a.rj.bind(a),onsubtitlechange:a.tj.bind(a),ondrmevent:a.qj.bind(a),onerror:a.T.bind(a)})}catch(b){a.g.error(b)}},hL=function(a){var b=!!a.m.getTrackManager().Ha();try{webapis.avplay.setSilentSubtitle(!b)}catch(c){a.g.debug("Could not set AVPlay subtitle config",c)}},iL=function(a,b){try{var c=b.estimatedBandwidth||0,d=b.currentBandwidth||0;a.g.debug({estimatedBandwidth:c,$m:d});0!==c&&0!==d&&c>=1.15*d&&webapis.avplay.setStreamingProperty("ADAPTIVE_INFO",nK+d)}catch(e){a.g.debug(e)}},
23
+ jL=function(a,b){try{webapis.avplay.setStreamingProperty("ADAPTIVE_INFO","|BITRATES\x3d"+b+nK+b)}catch(c){throw a.g.debug("Could not set fixed bandwidth",c),c;}},mL=function(a){return{position:a.getPosition(),state:a.m.getState(),eg:a.getState(),playbackRate:a.getPlaybackRate(),isLive:a.isLive(),duration:a.getDuration(),isMuted:kL(a),volume:a.getVolume(),wm:lL(a),Kj:bL(a)}},oL=function(a){var b,c;return _.E(function(d){if(1==d.a)return _.x(d,nL(),2);if(3!=d.a)return b=new Promise(function(e){(new _.Gk(e)).aa(5)}),
24
+ _.x(d,Promise.race([eL(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)})},uL=function(a,b,c){var d,e,f,g,h,l,m,n;return _.E(function(p){switch(p.a){case 1:a.l=_.mp(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 _.L(pL)),f=c.currentPosition);
25
+ _.A(p,2);g=a.l[d].url;h=a.l[d].type;h!==_.Tc||g.includes(".mpd")||(l=new URL(g),l.searchParams.append("cl-ext",".mpd"),g=l.toString());webapis.avplay.open(g);e.nextBandwidth?(jL(a,e.nextBandwidth),a.o=!1):(a.o||iL(a,e),a.o=!0);gL(a);if(!b.drm||!b.drm.env){a.g.debug("No DRM configuration was provided. Assuming clear content");p.F(4);break}m={onError:function(q){return a.m.onError(q)},sb:a.m.getNetworkEngine()};a.h=new pK(b.drm,m);return _.x(p,a.h.init(),4);case 4:return a.f||a.trigger(new _.L(qL)),
26
+ _.x(p,rL(a),6);case 6:a.f||a.trigger(new _.L(sL));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&&tL(a,b.muted),b.autoplay&&a.m.play()["catch"](function(q){a.g.debug("Autoplay failed",q)}));_.bh(p,0);break;case 2:throw n=_.C(p),a.g.debug("Error while attempting to load source."),n;}})},rL=function(a){return _.E(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
+ hL(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)}}))})},vL=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=mL(a);a.f=!0;webapis.avplay.stop();webapis.avplay.close();return a.load(a.m.getConfiguration(),d).then(function(){var e=a.a.eg;a.f=!1;a.a=
28
+ null;return e===AK?a.pause():a.play()})}catch(e){return Promise.reject(e)}},lL=function(a){return a.f&&a.a?a.a.wm:webapis.avplay.getTotalTrackInfo()},bL=function(a){return a.f&&a.a?a.a.Kj:webapis.avplay.getCurrentStreamInfo()},PK=function(a,b,c){b=b.toUpperCase();b===RK&&wL(a,!0);var d=a.j[b];d&&(d.Ae.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,bg:0,Ae:new _.Gk(function(){return g(h,c,!0)})}),(l=a.j[h])&&3>l.bg?(!a.w&&++l.bg,l.Ae.aa(a.w?.5:.25)):(a.g.debug("Could not set track after multiple attempts.Giving up..."),l&&l.Ae.stop(),a.j[h]=null,f())}}g(b,c)})},wL=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)}},tL=function(a,b){try{tizen.tvaudiocontrol.setMute(b)}catch(c){switch(c.name){case lK:a.g.warn("The application does not have the privilege to set mute.",mK);break;default:a.g.warn(iK,c)}}},kL=function(a){var b=null;try{b=tizen.tvaudiocontrol.isMute()}catch(c){switch(c.name){case lK:a.g.warn("The application doesn't have the privilege to get the mute state.",mK);break;default:a.g.warn(iK,c)}}return!!b},nL=function(){return new Promise(function(a,b){if(window.webapis)a();else{var c=document.createElement("script");
31
+ oK(c,"load",function(d){return a(d)});oK(c,_.pe,function(d){return b(d)});c.src="$WEBAPIS/webapis/webapis.js";document.querySelector("head").appendChild(c)}})},xL=function(){_.Fl.call(this);this.a=new dL(this);this.f=new wK(this);this.configuration=this.B=_.Ll();this.w=null;this.g=new _.K("clpp.tizen.Player");this.j=null;this.l=new LK;this.D=new _.Nj;this.o=this.h=null;this.A=!1},yL=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())},zL=function(){},AL=function(){};
33
+ pK.prototype.init=function(){var a=this,b,c,d,e,f,g;return _.E(function(h){if(1==h.a){b=_.fm[a.h.env]||null;if(!b)throw a.g.debug(_.ya,_.Mb+a.h.env+_.ca),new _.P(_.Q,6,6015,_.za+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=_.hm(b,a.h.customData);(e=d[_.Qd])&&a.f.set(_.Qd,{Kd:e.licenseUrl||"",customData:c,Gf:!1});(f=d[_.Sd])&&a.f.set(_.Sd,{Kd:f.licenseUrl||"",customData:c,
34
+ Gf:!1});if(0===a.f.size)throw new _.P(_.Q,6,6E3);if((g=a.h.preferredDrmSystem)&&a.f.get(g))a.a=g;else if(a.f.get(_.Qd))a.a=_.Qd;else if(a.f.get(_.Sd))a.a=_.Sd;else throw new _.P(_.Q,6,6001,"Configuration for the target system is missing.");return _.x(h,sK(a),2)}a.j=!0;_.y(h)})};pK.prototype.release=function(){var a=this;return _.E(function(b){a.j=!1;a.o=null;a.a=_.Ue;a.l=null;a.f=new Map;_.y(b)})};pK.prototype.getDrmInfo=function(){return this.o};
35
+ var uK={Zh:"DeleteLicenseAfterUse",$h:"LicenseServer",Km:"GetChallenge",Lm:"HttpHeader",Pm:"UserAgent",Gm:"Cookie",Yh:"CustomData"};_.r=wK.prototype;_.r.initialize=function(){this.a.on(pL,this.sg,this);this.a.on(BL,this.rg,this);this.a.on(CL,this.qg,this);this.a.on(qL,this.vh,this);this.a.on(sL,this.uh,this);this.a.on(DL,this.tg,this)};_.r.release=function(){yK(this,_.Vo);this.l=!1;this.o=-1;this.h=2};_.r.destroy=function(){this.release();this.a.off(pL,this.sg);this.a.off(BL,this.rg);this.a.off(CL,this.qg);this.a.off(qL,this.vh);this.a.off(sL,this.uh);this.a.off(DL,this.tg);this.m=this.a=null};
36
+ _.r.sg=function(){this.g.debug("Buffering start. Player state: ",this.a.getState());this.h=this.a.B?1:2;yK(this,_.$o)};_.r.rg=function(a){this.g.debug("Buffering progress: "+a.percent+" %. Player state: ",xK(this.f))};_.r.qg=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()===EL;if(!a&&b){yK(this,_.hp);return}}if(a=this.f!==_.gp)a=this.a.getState(),a=a===zK||a===AK;a&&BK(this)};
37
+ _.r.vh=function(){this.g.debug("Preparing starts. AVPlay State: ",this.a.getState());this.a.getState()===FL?yK(this,_.gp):this.g.error("AVPlay prepares while state is not IDLE")};_.r.uh=function(){this.g.debug("Preparing ends: AVPlay state:",this.a.getState())};_.r.tg=function(){yK(this,_.bp)};_.r.getState=function(){return this.f};_.r=CK.prototype;_.r.initialize=function(a){this.m=a};
38
+ _.r.load=function(a){var b=this,c,d,e,f,g,h,l;return _.E(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,EK(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={networkingEngine:b.m.getNetworkEngine(),filterNewPeriod:function(){},filterAllPeriods:function(){},onTimelineCueAdded:function(){},onEvent:function(){},
39
+ onError:function(){}};_.A(m,3);e=b;return _.x(m,b.j.start(a.url,d),5);case 5:e.a=m.f;_.bh(m,4);break;case 3:return f=_.C(m),b.g.warn(f),_.A(m,6),g=b,_.x(m,b.j.start(a.url.replace("https://","http://"),d),8);case 8:g.a=m.f;_.bh(m,4);break;case 6:h=_.C(m),b.g.error(h),b.a=null;case 4:if(!b.a||!DK(b.a)){m.F(0);break}b.h=FK(b);_.A(m,10);return _.x(m,b.h.I,12);case 12:b.f=GK(b);l=b.m.getConfiguration();b.f.h=l.streaming;b.o=l.preferredTextLanguage;b.A=l.preferredTextRole;b.D=l.preferForcedSubtitles;_.bh(m,
40
+ 0);break;case 10:_.C(m),b.g.debug("Could not setup media source..."),b.h=null,b.f=null,b.j=null,b.a=null,_.y(m)}})};_.r.vj=function(a){this.g.debug(_.Gz,a);this.w=!0;var b=_.RB(a.textStreams,this.o||"",this.A||"",this.D)[0]||null;this.l&&(a.textStreams.includes(this.l)&&(b=this.l),this.l=null);return{variant:null,text:b}};_.r.uj=function(){this.g.debug("canSwitch_");this.w=!1;this.l&&(_.yD(this.f,this.l,!0,0),this.l=null)};_.r.T=function(){this.g.debug("onError_")};
41
+ _.r.wj=function(){this.j&&this.j.update&&this.j.update()};_.r.start=function(){var a=this;return _.E(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 _.E(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 _.E(function(b){switch(b.a){case 1:if(!a.j){b.F(2);break}return _.x(b,a.j.stop(),3);case 3:a.j=null;case 2:if(!a.f){b.F(4);break}return _.x(b,a.f.destroy(),5);case 5:a.f=null,a.w=!0;case 4:if(!a.h){b.F(0);break}return _.x(b,a.h.destroy(),7);case 7:a.h=null,_.y(b)}})};_.w(LK,_.U);_.r=LK.prototype;_.r.kh=function(a){var b=a.eventid;a=a.data;switch(b){case GL:0<Object.keys(this.f).length||(this.g.debug("Loading track manager!"),this.load());b=webapis.avplay.getCurrentStreamInfo();0<b.length&&(b=+WK(this,b[0].extra_info).Bit_rate,b=$K(this,{bandwidth:b}))&&(this.w=b,MK(this,b));break;case HL:NK(this);break;default:this.g.debug("Event type: "+b+" data: "+a)}};_.r.Af=function(a){a.detail.currentState===_.ip&&this.m.off(_.Vf,this.Af)};
43
+ _.r.initialize=function(a){var b=this;this.m=a;this.a=this.m.a;this.m.on(_.Vf,function(c){b.A||(c=c.detail,c.currentState===_.ip&&(b.g.debug("Current state",c.currentState),b.A=!0,OK(b)))});this.a.on(IL,this.kh,this)};_.r.release=function(){this.f={};this.h=this.w=this.l=this.j=null;this.A=!1;this.o=1};
44
+ _.r.load=function(){if(this.a&&!(0<Object.keys(this.f).length)){this.h=this.m.h;this.m.off(_.Vf,this.Af);this.m.on(_.Vf,this.Af,this);try{var a=lL(this.a);this.f=ZK(this,a);var b=this.f[_.Tj]||[];b.length&&(this.j=b[0].renditions[0]||null);NK(this)}catch(c){this.g.debug("Could not load track manager")}}};_.r.destroy=function(){this.a.off(IL,this.kh);this.a=this.m=null};_.r.getVideoTracks=function(){return this.f[_.Uj]||[]};_.r.getAudioTracks=function(){return this.f[_.Tj]||[]};
45
+ _.r.ea=function(){return this.f[_.T]||[]};_.r.ka=function(){return cL(this,_.Uj)};_.r.Pa=function(){return cL(this,_.Tj)};_.r.Ha=function(){return cL(this,_.T)};_.r.cb=function(){return this.w};_.r.mb=function(){this.g.info(jK);return null};_.r.nb=function(){this.g.info(jK);return null};_.r.Ia=function(){var a=this.ka();return a?a.track:null};_.r.ja=function(){var a=this.Pa();return a?a.track:null};_.r.ua=function(){var a=this.Ha();return a?a.track:null};
46
+ _.r.jb=function(a){var b=this;null===a?(a=this.ka(),vL(this.a,a.bandwidth,null).then(function(){NK(b)})):0<a.renditions.length&&this.Za(a.renditions[0])};_.r.za=function(a){a?SK(this,a.renditions[0]):this.g.warn("Cannot disable audio tracks on this platform.","Consider muting audio instead...")};_.r.La=function(a){a?(a=a.renditions[0],this.h?KK(this.h,a.track):SK(this,a)):(this.g.debug("Disabling text tracks"),this.l=null,wL(this.a,!1),this.m.trigger(new _.L(_.zl)))};
47
+ _.r.Za=function(a){var b=this,c=this.ka();this.a.o||a.width!==c.width||a.height!==c.height||a.bandwidth!==c.bandwidth?(this.w=a,MK(this,a),vL(this.a,c.bandwidth,a.bandwidth).then(function(){NK(b)})["catch"](function(d){var e=new _.P(_.Q,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.hb=function(a){SK(this,a)};_.r.ib=function(a){this.h?KK(this.h,a.track):SK(this,a)};
48
+ _.r.addTextTrack=function(){};_.r.ma=function(){return this.a.o};LK.prototype.isAbrEnabled=LK.prototype.ma;LK.prototype.addTextTrack=LK.prototype.addTextTrack;LK.prototype.setTextRendition=LK.prototype.ib;LK.prototype.setAudioRendition=LK.prototype.hb;LK.prototype.setVideoRendition=LK.prototype.Za;LK.prototype.setTextTrack=LK.prototype.La;LK.prototype.setAudioTrack=LK.prototype.za;LK.prototype.setVideoTrack=LK.prototype.jb;LK.prototype.getTextTrack=LK.prototype.ua;LK.prototype.getAudioTrack=LK.prototype.ja;
49
+ LK.prototype.getVideoTrack=LK.prototype.Ia;LK.prototype.getLoadingTextRendition=LK.prototype.nb;LK.prototype.getLoadingAudioRendition=LK.prototype.mb;LK.prototype.getLoadingVideoRendition=LK.prototype.cb;LK.prototype.getTextRendition=LK.prototype.Ha;LK.prototype.getAudioRendition=LK.prototype.Pa;LK.prototype.getVideoRendition=LK.prototype.ka;LK.prototype.getTextTracks=LK.prototype.ea;LK.prototype.getAudioTracks=LK.prototype.getAudioTracks;LK.prototype.getVideoTracks=LK.prototype.getVideoTracks;_.w(dL,_.Fl);_.r=dL.prototype;_.r.pj=function(){this.w=!0;this.f||this.trigger(new _.L(pL))};_.r.oj=function(a){this.w=!0;this.trigger(new _.L(BL,{percent:a}))};_.r.nj=function(){this.w=!1;this.trigger(new _.L(CL))};_.r.sj=function(){this.trigger(new _.L(DL))};_.r.rj=function(a,b){this.trigger(new _.L(IL,{eventid:a,data:b}))};_.r.tj=function(a,b,c,d,e){this.trigger(new _.L(JL,{duration:a,text:b,subtitleType:c,attriCount:d,attributes:e}))};
50
+ _.r.qj=function(a,b){this.trigger(new _.L(KL,{drmType:a,drmData:b}));if(this.h){var c=this.h;if(c.j)if(c.a===_.Sd&&"Challenge"===b.name)vK(c,b);else if("DrmError"===b.name){c.g.debug("DrmError event",b);var d=new _.P(_.Q,6,6005,{message:JSON.stringify(b)});c.C.onError(d)}}};_.r.T=function(a){this.trigger(new _.L(LL,{eventType:a}))};
51
+ _.r.play=function(){function a(){return new Promise(function(d,e){function f(){d();clearTimeout(g)}var g=null;b.one(fL,f,b);g=setTimeout(function(){b.off(fL,f);e("Timeout")},3E4)})}var b=this,c=this.getState();if(c===FL)return(new Promise(function(d,e){webapis.avplay.prepareAsync(function(){hL(b);d(webapis.avplay.play())},function(f){b.trigger(new _.L(LL));e(f)})})).then(function(){return a()});if(c===AK||c===EL)try{return webapis.avplay.play(),a()}catch(d){return Promise.reject(d)}return c===zK?
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()===AK?Promise.resolve():Promise.reject()};
53
+ _.r.setPlaybackRate=function(a){var b=this.getState();if(b===EL||b===zK||b===AK){try{webapis.avplay.setSpeed(a),this.D=a}catch(c){return this.g.debug("Error while trying to set playback rate",c),this.setPlaybackRate(this.D)}return!0}this.g.debug("Cannot set playback rate; AVPlay is in inconsistent state: "+b);return!1};_.r.getPlaybackRate=function(){return this.D};
54
+ _.r.load=function(a,b){var c=this,d;return _.E(function(e){switch(e.a){case 1:return c.g.debug("configure()",b||""),_.A(e,2),_.x(e,oL(c),4);case 4:return _.x(e,uL(c,a,b),5);case 5:_.bh(e,0);break;case 2:throw d=_.C(e),new _.P(_.Q,7,7003,null,d);}})};_.r.getState=function(){if(this.f&&this.a)return this.a.eg;try{return webapis.avplay.getState()}catch(a){this.T(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 _.L(_.pg));webapis.avplay.seekTo(c,function(){b.B=!1;b.m.trigger(new _.L(_.og));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.T(JSON.stringify(a))}};_.r.getDuration=function(){if(this.f&&this.a)return this.a.duration;try{return webapis.avplay.getDuration()/1E3}catch(a){this.T(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.Ae.stop()}a.j={};a.D=1;a.B=!1;a.l=null;a.a=null;return b()}catch(f){return c(f)}})};_.r.getVolume=function(){var a=null;try{a=tizen.tvaudiocontrol.getVolume()}catch(b){switch(b.name){case lK:this.g.debug("The application does not have the privilege to get the volume.",mK);break;default:this.g.debug(iK,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 lK:this.g.warn("The application does not have the privilege to set the volume.",mK);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.T(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 FL="IDLE",EL="READY",zK="PLAYING",AK="PAUSED",XK=_.kc,QK="AUDIO",RK="TEXT",HL="PLAYER_MSG_RESOLUTION_CHANGED",GL="PLAYER_MSG_BITRATE_CHANGE",tK={PLAYREADY:"PLAYREADY",Hm:"EME_PLAYREADY",Qm:"VERIMATRIX",Wd:"WIDEVINE_CDM",Im:"EME_WIDEVINE_CDM",Sm:"WIDEVINE_CLASSIC"};_.w(xL,_.Fl);_.r=xL.prototype;_.r.og=function(){var a=this;this.g.debug("On Stream completed. Current time: ",this.getPosition());this.trigger(new _.L(_.oe));this.configuration.loop?this.seek(this.configuration.startTime||0)["catch"](function(){a.g.debug("Could not loop playback")}):this.a.stop()};_.r.mg=function(a){this.trigger(new _.L(_.fg,{currentTime:a.currentTime/1E3}))};
60
+ _.r.pg=function(a){var b=this.a.getPosition(),c=b+a.duration/1E3,d=a.text||"";this.g.debug("Got subtitles: ",d,"start:",b,"end:",c,a);(d=_.R.Pf(d))&&this.o.append([new _.di(b,c,d)],[])};_.r.ng=function(a){this.g.debug("DRM event: "+a.drmType+", data: "+a.drmData)};_.r.mh=function(){this.A||(this.g.debug("Initial buffering completed..."),this.A=!0)};
61
+ _.r.T=function(a){this.g.debug("Error: TYPE: "+a.eventType);yK(this.f,_.fp);a=new _.P(_.Q,7,7200,{tizenerror:a.eventType});this.a.release();this.trigger(new _.L(_.pe,{detail:a}))};
62
+ _.r.init=function(a,b){this.configuration=this.B=b;this.w=a;this.a.on(DL,this.og,this);this.a.on(fL,this.mg,this);this.a.on(JL,this.pg,this);this.a.on(KL,this.ng,this);this.a.on(LL,this.T,this);this.a.on(CL,this.mh,this);this.f.initialize();this.l.initialize(this);this.g.debug("Initializing player surface");this.w.hideMediaElement();var c=ML;ML+=1;this.j=_.Fp(_.Ve,{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=[_.Ig,_.te,"position",_.Be,"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];_.Hp(c,f);yL(this)}};_.r.getSurface=function(){return this.w};_.r.getConfiguration=function(){return this.configuration};
64
+ _.r.destroy=function(){var a=this;return _.E(function(b){switch(b.a){case 1:return _.x(b,a.release(),2);case 2:a.a.off(DL,a.og);a.a.off(fL,a.mg);a.a.off(JL,a.pg);a.a.off(KL,a.ng);a.a.off(LL,a.T);a.a.off(CL,a.mh);if(!a.h){b.F(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 NL};_.r.getPlaybackRate=function(){return this.a.getPlaybackRate()};
65
+ _.r.setDrmCustomDataModifier=function(){};_.r.setCdnErrorCallback=function(){};_.r.detach=function(){};_.r.setPlaybackRate=function(a){this.a.setPlaybackRate(a)};_.r.getPosition=function(){return 0<(this.configuration.startTime||0)&&!this.A?0:this.f.getState()===_.bp?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()};_.r.getPresentationStartTime=function(){return null};
66
+ _.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.a.getDuration()};_.r.getBufferInfo=function(){this.g.warn(_.ua);return new _.El};_.r.getTrackManager=function(){return this.l};_.r.unload=function(){var a=this;return this.a.release().then(function(){a.l.release()})};
67
67
  _.r.release=function(){var a=this;return _.E(function(b){switch(b.a){case 1:if(!a.h){b.F(2);break}return _.x(b,a.h.release(),2);case 2:if(!a.o){b.F(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)}})};
68
- _.r.load=function(a){var b=this,c,d,e,f,g;return _.E(function(h){switch(h.a){case 1:_.Cl(a)&&(b.configuration=_.Bl(b.B,a));c=_.uo(b.configuration,[_.se,"native"]);b.o=c.create(b);d=_.Yo(b.configuration)[0];e=!!b.configuration.tizen&&b.configuration.tizen.sideStreamText;if(!e){h.F(2);break}b.h=new fK;b.h.initialize(b);_.A(h,3);return _.x(h,b.h.load(d),5);case 5:b.h.start();_.ah(h,2);break;case 3:f=_.C(h),b.g.error(f);case 2:return _.A(h,6),_.x(h,b.a.load(b.configuration),8);case 8:_.ah(h,7);break;
69
- case 6:throw g=_.C(h),b.onError(g),g;case 7:b.l.load(),_.y(h)}})};_.r.play=function(){var a=this;this.trigger(new _.L(_.gf));bL(this);return this.a.play().then(function(){eK(a.f)})};_.r.pause=function(){var a=this;return this.a.pause().then(function(){eK(a.f)})};_.r.getState=function(){return this.f.getState()};_.r.getPeriods=function(){return[]};_.r.onError=function(a){var b=new _.L(_.ne,{detail:a});a.severity===_.Q&&(bK(this.f,_.Ro),this.a.release());this.trigger(b);b.defaultPrevented&&(b.a=!0)};
70
- _.r.getDrmInfo=function(){return this.a.getDrmInfo()};_.r.isEnded=function(){return this.f.getState()===_.No};_.r.isPaused=function(){return this.a.getState()===dK};_.r.isMuted=function(){return OK(this.a)};_.r.setMuted=function(a){XK(this.a,a)};_.r.getNetworkEngine=function(){return this.D};_.r.setNetworkEngine=function(a){this.D=a};_.r.isLive=function(){return this.a.isLive()};_.r.getStats=function(){return null};_.r.setSourceIndex=function(a){this.a.setSourceIndex(a)};_.r.getSourceIndex=function(){return this.a.getSourceIndex()};
71
- _.r.getLoadedSource=function(){return this.a.getLoadedSource()};_.r.canPlay=function(a,b){return(new cL).canPlay(a,b)};_.r.getTimelineCues=function(){return[]};_.r.getTextDisplayer=function(){return this.o};_.r.resetAbr=function(){};aL.prototype.getTextDisplayer=aL.prototype.getTextDisplayer;aL.prototype.setNetworkEngine=aL.prototype.setNetworkEngine;aL.prototype.getNetworkEngine=aL.prototype.getNetworkEngine;var qL="clpp.tizen",pL=0;cL.prototype.a=function(){return qL};
72
- cL.prototype.canPlay=function(a){a=a.type;var b=!!window.webapis;if((a===_.Tc||a===_.dl||a===_.Yc)&&b){if(_.Dj(2))return 2;if(_.Dj(3)||_.Dj(4)||_.Dj(5)||_.Dj(6))return _.J("Use of clpp.tizen.TizenComponent is not recommended for Tizen version \x3e\x3d 3."),1}return 0};cL.prototype.create=function(){return new aL};_.w(dL,_.Hr);dL.prototype.f=function(){_.zh(new cL)};dL.prototype.a=function(){var a=qL;a&&_.xh[a]&&(delete _.xh[a],_.yh.info("Removed Player factory: '"+a+"'"))};dL.prototype.id=function(){return"tizen"};_.H("clpp.tizen.TizenComponent",dL);var TK="onbufferingstart",eL="onbufferingprogress",fL="onbufferingcomplete",gL="onstreamcompleted",JK="oncurrentplaytime",lL="onevent",mL="onsubtitlechange",nL="ondrmevent",oL="onerror",UK="preparingstart",WK="preparingend";};
68
+ _.r.load=function(a){var b=this,c,d,e,f,g;return _.E(function(h){switch(h.a){case 1:b.configuration=_.Nl(b.B,a);c=_.Jo(b.configuration,[_.ve,"native"]);b.o=c.create(b);d=_.mp(b.configuration)[0];e=!!b.configuration.tizen&&b.configuration.tizen.sideStreamText;if(!e){h.F(2);break}b.h=new CK;b.h.initialize(b);_.A(h,3);return _.x(h,b.h.load(d),5);case 5:b.h.start();_.bh(h,2);break;case 3:f=_.C(h),b.g.error(f);case 2:return _.A(h,6),_.x(h,b.a.load(b.configuration),8);case 8:_.bh(h,7);break;case 6:throw g=
69
+ _.C(h),b.onError(g),g;case 7:b.l.load(),_.y(h)}})};_.r.play=function(){var a=this;this.trigger(new _.L(_.jf));yL(this);return this.a.play().then(function(){BK(a.f)})};_.r.pause=function(){var a=this;return this.a.pause().then(function(){BK(a.f)})};_.r.getState=function(){return this.f.getState()};_.r.getPeriods=function(){return[]};_.r.onError=function(a){var b=new _.L(_.pe,{detail:a});a.severity===_.Q&&(yK(this.f,_.fp),this.a.release());this.trigger(b);b.defaultPrevented&&(b.a=!0)};
70
+ _.r.getDrmInfo=function(){return this.a.getDrmInfo()};_.r.isEnded=function(){return this.f.getState()===_.bp};_.r.isPaused=function(){return this.a.getState()===AK};_.r.isMuted=function(){return kL(this.a)};_.r.setMuted=function(a){tL(this.a,a)};_.r.getNetworkEngine=function(){return this.D};_.r.setNetworkEngine=function(a){this.D=a};_.r.isLive=function(){return this.a.isLive()};_.r.getStats=function(){return null};_.r.setSourceIndex=function(a){this.a.setSourceIndex(a)};_.r.getSourceIndex=function(){return this.a.getSourceIndex()};
71
+ _.r.getLoadedSource=function(){return this.a.getLoadedSource()};_.r.canPlay=function(a,b){return(new zL).canPlay(a,b)};_.r.getTimelineCues=function(){return[]};_.r.getTextDisplayer=function(){return this.o};_.r.resetAbr=function(){};xL.prototype.getTextDisplayer=xL.prototype.getTextDisplayer;xL.prototype.setNetworkEngine=xL.prototype.setNetworkEngine;xL.prototype.getNetworkEngine=xL.prototype.getNetworkEngine;var NL="clpp.tizen",ML=0;zL.prototype.a=function(){return NL};
72
+ zL.prototype.canPlay=function(a){a=a.type;var b=!!window.webapis;if((a===_.Tc||a===_.pl||a===_.Yc)&&b){if(_.Gj(2))return 2;if(_.Gj(3)||_.Gj(4)||_.Gj(5)||_.Gj(6))return _.J("Use of clpp.tizen.TizenComponent is not recommended for Tizen version \x3e\x3d 3."),1}return 0};zL.prototype.create=function(){return new xL};_.w(AL,_.fs);AL.prototype.f=function(){_.zh(new zL)};AL.prototype.a=function(){var a=NL;a&&_.xh[a]&&(delete _.xh[a],_.yh.info("Removed Player factory: '"+a+"'"))};AL.prototype.id=function(){return"tizen"};_.I("clpp.tizen.TizenComponent",AL);var pL="onbufferingstart",BL="onbufferingprogress",CL="onbufferingcomplete",DL="onstreamcompleted",fL="oncurrentplaytime",IL="onevent",JL="onsubtitlechange",KL="ondrmevent",LL="onerror",qL="preparingstart",sL="preparingend";};
73
73
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
74
74
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
75
75
  else{_=this.clpp._;(f.call(g,this));}
package/cjs/cl.ttml.js CHANGED
@@ -1,32 +1,32 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var Rv='application/mp4; codecs\x3d"stpp.ttml"',Sv='application/mp4; codecs\x3d"stpp.ttml.im1i"',Tv='application/mp4; codecs\x3d"stpp.ttml.im1t"',Uv="backgroundColor",Vv="direction",Wv="displayAlign",Xv="region",Yv="sans-serif",Zv="textAlign",$v="textDecoration",aw="writingMode",bw=function(a,b,c){this.h=a;this.f=b;this.a=c},cw=function(a,b,c){bw.call(this,a,[],c);this.j=b||""},dw=function(a,b,c){bw.call(this,a,b,c)},ew=function(a,b,c){a=a.f;for(var d=a.length-1;0<=d;d--){var e=b.get(a[d]);if(c in
3
- e.a)return e.getAttribute(c)}return null},mw=function(a,b){var c=null;if(fw.test(a)){c=fw.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 gw.test(a)?c=hw(gw,a):iw.test(a)?c=hw(iw,a):jw.test(a)?(c=jw.exec(a),c=Number(c[1])/b.frameRate):kw.test(a)?(c=kw.exec(a),c=Number(c[1])/b.a):lw.test(a)&&(c=hw(lw,a));return c},hw=function(a,b){var c=a.exec(b);return null==c||""===c[0]?null:(Number(c[4])||0)/1E3+(Number(c[3])||
4
- 0)+60*(Number(c[2])||0)+3600*(Number(c[1])||0)},nw=function(a){return a.split(":").pop()},ow=function(a){return a.replace(/(\d*\.?\d+)c/g,"$1em")},qw=function(a,b){for(;pw.test(a);){var c=pw.exec(a)[0];a=a.replace(c,parseInt(c,10)/b+"em")}return a},rw=function(a){return a?a.replace(/(\d*\.?\d+)%/g,function(b,c){return c/100+"em"}):""},sw=function(a,b,c,d,e,f,g){bw.call(this,a,f,g);this.w=b;this.A=c;this.o=d;this.l=e;this.j=[]},tw=function(a,b,c){a=ew(a,b,Zv);if(!a&&c&&(a=ew(c,b,Zv),!a&&"rltb"===ew(c,
5
- b,aw)))return _.Kf;switch(a){case _.sd:return _.Zh;case _.Kf:case _.le:return _.Kf;default:return _.xe}},uw=function(a,b,c){if(_.R.te(a.w))return document.createTextNode(_.R.Of(a.w||""));if(a.A)return _.pp("br");for(var d=_.pp("span"),e=_.u(a.f),f=e.next();!f.done;f=e.next())_.qp(d,f.value);a=_.u(a.j);for(e=a.next();!e.done;e=a.next())d.appendChild(uw(c.get(e.value),b,c));return d},vw=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*
6
- this.f:1);c&&(a=/^(\d+) (\d+)$/g.exec(c))&&(this.frameRate*=Number(a[1])/Number(a[2]))},ww=function(a,b,c){bw.call(this,a,b,c)},zw=function(a,b,c,d){var e=xw.exec(a);a=yw.exec(a);return typeof b===_.k&&0<b&&a?100*Number(a[c])/b:e?Number(e[c]):a?Number(a[c]):d},Aw=function(a,b){return typeof b===_.k&&0<b?_.ei:yw.test(a)?0:_.ei},Bw=function(a,b){bw.call(this,"root-container",[],b);this.j=a},Cw=function(a,b,c){return typeof a===_.k?a:typeof b===_.k?b:c},Dw=function(a,b){var c=a.getAttribute("extent");
7
- return(c=yw.exec(c))?Number(c[b]):null},Fw=function(a){a=a.getAttribute("cellResolution");return(a=Ew.exec(a))?Number(a[2]):null},Gw=function(a,b,c){bw.call(this,a,b,c)},Hw=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=[]},Jw=function(a){return Iw.some(function(b){return b in a.attributes})},Kw=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,_.Og(Kw(a,
8
- a.a.get(e).f)).concat([e]));return c},Mw=function(){return"inline-"+Lw++},Nw=function(a){this.a=a.firstChild;this.f=new Set},Ow=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},Pw=function(a){return nw(a.h.nodeName)},Qw=function(){this.a=new Map},Sw=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=_.Og(l.l).concat();-1===["#text","span","br"].indexOf(b.nodeName)&&(c=l.a,d=l.j,f=_.Og(l.f).concat(),
9
- g={},Rw.forEach(function(n){n in l.attributes&&(g[n]=l.attributes[n])}))}if(b.nodeType===b.ELEMENT_NODE){b.hasAttribute(Xv)&&(c=b.getAttribute(Xv));b.hasAttribute(_.Yf)&&f.push.apply(f,_.Og(b.getAttribute(_.Yf).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=nw(h);g[m]=b.getAttribute(h)}d=g.backgroundImage}c=new Ow(b,c,d,e,f,g);a.a.set(b,c);return c},Tw=function(a){this.a=a;this.f=new DOMParser},Uw=function(a){this.f=
10
- a},Vw=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")},Ww=function(){},Xw=function(a){this.a=new Tw(a);this.g=new _.K("clpp.ttml.Mp4TtmlParser")},Yw=function(){this.j=new Ww};bw.prototype.getId=function(){return this.h};bw.prototype.getAttribute=function(a){return this.a[a]};_.w(cw,bw);_.w(dw,bw);var fw=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,gw=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,iw=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d+)$/,jw=/^(\d*(?:\.\d*)?)f$/,kw=/^(\d*(?:\.\d*)?)t$/,lw=/^(?:(\d*(?:\.\d*)?)h)?(?:(\d*(?:\.\d*)?)m)?(?:(\d*(?:\.\d*)?)s)?(?:(\d*(?:\.\d*)?)ms)?$/,xw=/^(\d{1,2}(?:\.\d+)?|100(?:\.0+)?)% (\d{1,2}(?:\.\d+)?|100(?:\.0+)?)%$/,yw=/^(\d+)px (\d+)px$/,Ew=/^(\d+) (\d+)$/,pw=/(\d+)px/,Zw=/^(\d+px|\d+em|\d*\.?\d+c)$/,Iw=[Uv,"color",Vv,Wv,"fontFamily","fontSize","fontStyle","fontWeight",
11
- "lineHeight","opacity","padding",Zv,$v,"textOutline",aw,"zIndex"],Rw=["begin",_.le];_.w(sw,dw);
12
- sw.prototype.build=function(a,b,c,d,e,f,g){var h=mw(this.a.begin,b);b=mw(this.a.end,b);if(null===h||null===b)return null;h+=c;b+=c;c=_.pp(_.Yd);for(var l=_.u(this.j),m=l.next();!m.done;m=l.next())c.appendChild(uw(g.get(m.value),e,g));g=new _.di(h,b,c.innerHTML.trim(),_.gg);g.cssClassList=_.Og(this.f).concat();g.textAlign=tw(this,e,null);g.writingMode=_.$h;g.line=-1;g.lineInterpretation=_.ai;g.lineAlign=_.bi;g.containerRows=Cw(null,Fw(a),15);if(this.o&&(f=f.get(this.o))){g.region=f.build(a,e);g.textAlign=
13
- tw(this,e,f);a:switch(ew(f,e,aw)){case "tb":case "tblr":a=_.qg;break a;case "tbrl":a=_.rg;break a;default:a=_.$h}g.writingMode=a;a:switch(ew(f,e,Wv)){case _.sd:a=50;break a;case "after":a=-1;break a;default:a=0}g.line=a;a:switch(ew(f,e,Wv)){case _.sd:a=1;break a;default:a=_.ai}g.lineInterpretation=a;a:switch(ew(f,e,Wv)){case _.sd:e=_.sd;break a;default:e=_.bi}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(),
14
- g.backgroundImage=("PNG"===e&&"Base64"===d&&0<a.length?"data:image/png;base64,"+a:null)||"");return g};_.w(ww,dw);
15
- ww.prototype.build=function(a,b){var c=new _.gi;c.id=this.getId();var d=Cw(a.j.containerWidth,Dw(a,1),720),e=Cw(a.j.containerHeight,Dw(a,2),480);a:switch(ew(this,b,Wv)){case "after":var f="flex-start";break a;case _.sd:f=_.sd;break a;default:f="flex-end"}c.displayAlign=f;a:switch(ew(this,b,aw)){case "tb":case "tblr":f="row-reverse";break a;case "tbrl":f="row";break a;default:f=_.Kd}c.writingMode=f;f=this.getAttribute("extent")||ew(this,b,"extent");c.width=zw(f,d,1,100);c.widthUnits=Aw(f,d);c.height=
16
- zw(f,e,2,100);c.heightUnits=Aw(f,e);f=this.getAttribute("origin")||ew(this,b,"origin");c.viewportAnchorX=zw(f,d,1,0);c.viewportAnchorY=zw(f,e,2,0);c.viewportAnchorUnits=Aw(f,d);c.cssClassList=_.Og(this.f).concat();return c};_.w(Bw,bw);_.w(Gw,bw);
17
- Gw.prototype.build=function(a){var b=null;var c=Fw(a);c&&(b=Cw(a.j.containerHeight,Dw(a,2),480)/c);b=Cw(a.j.fontSizeRadix,b,16);a=[];c="::ttml ."+this.h+", ::ttml ."+this.h+" * {";for(var d=_.u($w.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+":"+ow(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:"+
18
- 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&&!Zw.test(g)&&Zw.test(h)&&Zw.test(l)?(e=g,f=h):2===d.length&&!Zw.test(g)&&Zw.test(h)?(e=g,f=h):2===d.length&&Zw.test(g)&&Zw.test(h)&&(f=g);if(""!==f){f=ow(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=rw(this.a.textShadow),d=ow(d),d="text-shadow:"+
19
- d+";"):d="";c=c+d+("fontFamily"in this.a?"font-family:"+this.a.fontFamily.replace("monospaceSansSerif","monospace").replace("monospaceSerif","monospace").replace("proportionalSansSerif",Yv).replace("proportionalSerif",Yv).replace("sansSerif",Yv).replace("default",Yv)+";":"");a:{if($v 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=
20
- "text-decoration:"+d.join(" ")+";";break a}}d=""}e="padding"in this.a?"border: solid transparent;border-width:"+ow(this.a.padding)+";":"";c=c+d+e;"lineHeight"in this.a?(d="",e=this.a.lineHeight,e=ow(e),e=qw(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=ow(d);d=qw(d,b);b="font-size:"+d+";";break a}b=null}b&&(c="::ttml ."+this.h+" .clpp-text-wrapper {",a.push(c+b+"}"),
21
- c="::ttml .clpp-text-wrapper__"+this.h+" {",a.push(c+b+"}"));return a};var $w=new Map([[Uv,"background-color"],["color","color"],[Vv,Vv],["fontStyle","font-style"],["fontWeight","font-weight"],["opacity","opacity"],["zIndex","z-index"]]);Hw.prototype.yd=function(){var a=this;return this.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})};var Lw=0;Nw.prototype.Wc=function(){return!!this.a};Nw.prototype.next=function(){if(!this.a)return null;var a=this.a;do this.f.add(a),a.nodeType!==Node.TEXT_NODE&&!ax.has(nw(a.nodeName))||bx.has(nw(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&&!ax.has(nw(a.nodeName))));var b=this.a;this.a=a;return b};
22
- var ax=new Set(["tt","head","layout",_.Le,_.te,Xv,"styling",_.Yf,"body",_.Yd,"p","span","br"]),bx=new Set([_.Yf,_.te]);Ow.prototype.getId=function(){return this.attributes.id};Tw.prototype.parseInit=function(){};
23
- Tw.prototype.parseMedia=function(a,b,c){c&&c.length||(c=[a.byteLength]);var d=_.N.Ma(this.a.ttml||{}),e=_.Ui(a,0,c[0]);e=_.R.Z(e);if(""===e)return{cues:[],styles:[]};var f=null;try{f=this.f.parseFromString(e,_.dg)}catch(n){throw new _.P(_.Q,2,2005,"Failed to parse TTML.");}d=new Hw(d);e=new Qw;f=new Nw(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=_.Ui(a,b,h);l=_.dj(l);var m="urn:mpeg:14496-30:subs:"+g;d.h.set(m,new cw(m,l,{imageType:"PNG",encoding:"Base64"}));
24
- b+=h}for(;f.Wc();)a=f.next(),a=Sw(e,a),"tt"===Pw(a)&&(d.l=new Bw(d.B,Object.assign({},a.attributes))),"tt"===Pw(a)&&(d.w=new vw(a.attributes.frameRate,a.attributes.subFrameRate,a.attributes.frameRateMultiplier,a.attributes.tickRate)),Pw(a)!==_.te||a.attributes.begin||a.attributes.end||(c="#"+a.getId(),d.h.set(c,new cw(c,a.h.textContent,a.attributes))),Pw(a)===_.te&&a.attributes.begin&&a.attributes.end?(c="#"+Mw(),b=new cw(c,a.h.textContent,a.attributes),d.h.set(c,b),c=b):c=null,c&&(a.j=c.getId()),
25
- Pw(a)===_.Yf&&(c=a.getId()||Mw(),b=new Gw(c,a.f,Object.assign({},a.attributes)),d.a.set(c,b),a.a&&d.j.get(a.a).f.push(c)),Pw(a)!==_.Yf&&Jw(a)?(c=Mw(),b=new Gw(c,[],Object.assign({},a.attributes)),d.a.set(c,b),c=b):c=null,c&&a.f.push(c.getId()),Pw(a)!==_.Yd||!a.attributes.extent&&!a.attributes.origin?c=null:(c=Mw(),b=new ww(c,Kw(d,a.f),Object.assign({},a.attributes)),d.j.set(c,b),c=b),c&&(a.a=c.getId()),Pw(a)!==Xv?c=null:(c=a.getId(),b=new ww(c,Kw(d,a.f),Object.assign({},a.attributes)),d.j.set(c,b),
26
- c=b),c&&(a.a=c.getId()),c=a.l,-1===["#text","span","br"].indexOf(Pw(a))||0===c.length?c=null:(g=c[c.length-1],d.f.has(g)?(c=Mw(),b=new sw(c,"#text"===a.h.nodeName?a.h.textContent:null,"br"===Pw(a),a.a,a.j,Kw(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"===Pw(a)||a.j?(c=Mw(),b=new sw(c,null,!1,a.a,a.j,Kw(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=d.yd();f=[];a=_.u(d.a.values());for(c=a.next();!c.done;c=
27
- a.next())f.push.apply(f,_.Og(c.value.build(d.l)));return{cues:e,styles:f}};Uw.prototype.a=function(a){a=(new Tw(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=Vw(c.startTime)+" --\x3e "+Vw(c.endTime),e=[];switch(c.textAlign){case _.xe:e.push("align:left");break;case _.Kf:e.push("align:right");break;case _.Zh:e.push("align:middle");break;case _.xe:e.push("align:start");break;case _.Kf:e.push("align:end")}switch(c.writingMode){case _.qg:e.push("vertical:lr");break;
28
- case _.rg:e.push("vertical:rl")}b+=d+(e.length?" "+e.join(" "):"")+"\n";b+=c.payload+"\n\n"}return _.R.Va(b)};Ww.prototype.probe=function(a,b){return a===_.Xc&&b===_.cg};Ww.prototype.create=function(a){return new Uw(a)};Xw.prototype.parseInit=function(a){var b=!1;(new _.mm).L(_.Oe,_.nm).L(_.fg,_.nm).L(_.Je,_.nm).L(_.Ne,_.nm).L(_.Vf,_.nm).Y(_.Xf,_.om).L("stpp",function(c){b=!0;c.parser.stop()}).parse(a);if(!b)throw new _.P(_.Q,2,2007);};
29
- Xw.prototype.parseMedia=function(a,b){var c=this,d=!1,e=[],f=[],g=[];(new _.mm).L("moof",_.nm).L("traf",_.nm).Y("subs",function(h){for(var l=_.W(h.reader),m=0;m<l;++m){h.reader.skip(4);for(var n=_.hm(h.reader),p=0;p<n;++p){var q=1===h.version?_.W(h.reader):_.hm(h.reader);g.push(q);h.reader.skip(6)}}}).L(_.Ie,_.pm(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(Yw,_.Hr);Yw.prototype.f=function(){_.et[_.Xc]=Tw;_.et[_.Vc]=Xw;_.et[Rv]=Xw;_.et[Tv]=Xw;_.et[Sv]=Xw;_.ok.push(this.j)};Yw.prototype.a=function(){_.ft(_.Xc);_.ft(_.Vc);_.ft(Rv);_.ft(Tv);_.ft(Sv);_.qk(this.j)};Yw.prototype.id=function(){return"subtitles-ttml"};_.H("clpp.ttml.TtmlComponent",Yw);};
2
+ var f=function(window){var pw='application/mp4; codecs\x3d"stpp.ttml"',qw='application/mp4; codecs\x3d"stpp.ttml.im1i"',rw='application/mp4; codecs\x3d"stpp.ttml.im1t"',sw="backgroundColor",tw="direction",uw="displayAlign",vw="region",ww="sans-serif",xw="textAlign",yw="textDecoration",zw="writingMode",Aw=function(a,b,c){this.h=a;this.f=b;this.a=c},Bw=function(a,b,c){Aw.call(this,a,[],c);this.j=b||""},Cw=function(a,b,c){Aw.call(this,a,b,c)},Dw=function(a,b,c){a=a.f;for(var d=a.length-1;0<=d;d--){var e=b.get(a[d]);if(c in
3
+ e.a)return e.getAttribute(c)}return null},Lw=function(a,b){var c=null;if(Ew.test(a)){c=Ew.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 Fw.test(a)?c=Gw(Fw,a):Hw.test(a)?c=Gw(Hw,a):Iw.test(a)?(c=Iw.exec(a),c=Number(c[1])/b.frameRate):Jw.test(a)?(c=Jw.exec(a),c=Number(c[1])/b.a):Kw.test(a)&&(c=Gw(Kw,a));return c},Gw=function(a,b){var c=a.exec(b);return null==c||""===c[0]?null:(Number(c[4])||0)/1E3+(Number(c[3])||
4
+ 0)+60*(Number(c[2])||0)+3600*(Number(c[1])||0)},Mw=function(a){return a.split(":").pop()},Nw=function(a){return a.replace(/(\d*\.?\d+)c/g,"$1em")},Pw=function(a,b){for(;Ow.test(a);){var c=Ow.exec(a)[0];a=a.replace(c,parseInt(c,10)/b+"em")}return a},Qw=function(a){return a?a.replace(/(\d*\.?\d+)%/g,function(b,c){return c/100+"em"}):""},Rw=function(a,b,c,d,e,f,g){Aw.call(this,a,f,g);this.w=b;this.A=c;this.o=d;this.l=e;this.j=[]},Sw=function(a,b,c){a=Dw(a,b,xw);if(!a&&c&&(a=Dw(c,b,xw),!a&&"rltb"===Dw(c,
5
+ b,zw)))return _.Mf;switch(a){case _.td:return _.Zh;case _.Mf:case _.ne:return _.Mf;default:return _.Be}},Tw=function(a,b,c){if(_.R.te(a.w))return document.createTextNode(_.R.Pf(a.w||""));if(a.A)return _.Fp("br");for(var d=_.Fp("span"),e=_.u(a.f),f=e.next();!f.done;f=e.next())_.Gp(d,f.value);a=_.u(a.j);for(e=a.next();!e.done;e=a.next())d.appendChild(Tw(c.get(e.value),b,c));return d},Uw=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*
6
+ this.f:1);c&&(a=/^(\d+) (\d+)$/g.exec(c))&&(this.frameRate*=Number(a[1])/Number(a[2]))},Vw=function(a,b,c){Aw.call(this,a,b,c)},Yw=function(a,b,c,d){var e=Ww.exec(a);a=Xw.exec(a);return typeof b===_.k&&0<b&&a?100*Number(a[c])/b:e?Number(e[c]):a?Number(a[c]):d},Zw=function(a,b){return typeof b===_.k&&0<b?_.ei:Xw.test(a)?0:_.ei},$w=function(a,b){Aw.call(this,"root-container",[],b);this.j=a},ax=function(a,b,c){return typeof a===_.k?a:typeof b===_.k?b:c},bx=function(a,b){var c=a.getAttribute("extent");
7
+ return(c=Xw.exec(c))?Number(c[b]):null},dx=function(a){a=a.getAttribute("cellResolution");return(a=cx.exec(a))?Number(a[2]):null},ex=function(a,b,c){Aw.call(this,a,b,c)},fx=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=[]},hx=function(a){return gx.some(function(b){return b in a.attributes})},ix=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,_.Pg(ix(a,
8
+ a.a.get(e).f)).concat([e]));return c},kx=function(){return"inline-"+jx++},lx=function(a){this.a=a.firstChild;this.f=new Set},mx=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},nx=function(a){return Mw(a.h.nodeName)},ox=function(){this.a=new Map},qx=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=_.Pg(l.l).concat();-1===["#text","span","br"].indexOf(b.nodeName)&&(c=l.a,d=l.j,f=_.Pg(l.f).concat(),
9
+ g={},px.forEach(function(n){n in l.attributes&&(g[n]=l.attributes[n])}))}if(b.nodeType===b.ELEMENT_NODE){b.hasAttribute(vw)&&(c=b.getAttribute(vw));b.hasAttribute(_.$f)&&f.push.apply(f,_.Pg(b.getAttribute(_.$f).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=Mw(h);g[m]=b.getAttribute(h)}d=g.backgroundImage}c=new mx(b,c,d,e,f,g);a.a.set(b,c);return c},rx=function(a){this.a=a;this.f=new DOMParser},sx=function(a){this.f=
10
+ a},tx=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")},ux=function(){},vx=function(a){this.a=new rx(a);this.g=new _.K("clpp.ttml.Mp4TtmlParser")},wx=function(){this.j=new ux};Aw.prototype.getId=function(){return this.h};Aw.prototype.getAttribute=function(a){return this.a[a]};_.w(Bw,Aw);_.w(Cw,Aw);var Ew=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Fw=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,Hw=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d+)$/,Iw=/^(\d*(?:\.\d*)?)f$/,Jw=/^(\d*(?:\.\d*)?)t$/,Kw=/^(?:(\d*(?:\.\d*)?)h)?(?:(\d*(?:\.\d*)?)m)?(?:(\d*(?:\.\d*)?)s)?(?:(\d*(?:\.\d*)?)ms)?$/,Ww=/^(\d{1,2}(?:\.\d+)?|100(?:\.0+)?)% (\d{1,2}(?:\.\d+)?|100(?:\.0+)?)%$/,Xw=/^(\d+)px (\d+)px$/,cx=/^(\d+) (\d+)$/,Ow=/(\d+)px/,xx=/^(\d+px|\d+em|\d*\.?\d+c)$/,gx=[sw,"color",tw,uw,"fontFamily","fontSize","fontStyle","fontWeight",
11
+ "lineHeight","opacity","padding",xw,yw,"textOutline",zw,"zIndex"],px=["begin",_.ne];_.w(Rw,Cw);
12
+ Rw.prototype.build=function(a,b,c,d,e,f,g){var h=Lw(this.a.begin,b);b=Lw(this.a.end,b);if(null===h||null===b)return null;h+=c;b+=c;c=_.Fp(_.Zd);for(var l=_.u(this.j),m=l.next();!m.done;m=l.next())c.appendChild(Tw(g.get(m.value),e,g));g=new _.di(h,b,c.innerHTML.trim(),_.hg);g.cssClassList=_.Pg(this.f).concat();g.textAlign=Sw(this,e,null);g.writingMode=_.$h;g.line=-1;g.lineInterpretation=_.ai;g.lineAlign=_.bi;g.containerRows=ax(null,dx(a),15);if(this.o&&(f=f.get(this.o))){g.region=f.build(a,e);g.textAlign=
13
+ Sw(this,e,f);a:switch(Dw(f,e,zw)){case "tb":case "tblr":a=_.rg;break a;case "tbrl":a=_.sg;break a;default:a=_.$h}g.writingMode=a;a:switch(Dw(f,e,uw)){case _.td:a=50;break a;case "after":a=-1;break a;default:a=0}g.line=a;a:switch(Dw(f,e,uw)){case _.td:a=1;break a;default:a=_.ai}g.lineInterpretation=a;a:switch(Dw(f,e,uw)){case _.td:e=_.td;break a;default:e=_.bi}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(),
14
+ g.backgroundImage=("PNG"===e&&"Base64"===d&&0<a.length?"data:image/png;base64,"+a:null)||"");return g};_.w(Vw,Cw);
15
+ Vw.prototype.build=function(a,b){var c=new _.gi;c.id=this.getId();var d=ax(a.j.containerWidth,bx(a,1),720),e=ax(a.j.containerHeight,bx(a,2),480);a:switch(Dw(this,b,uw)){case "after":var f="flex-start";break a;case _.td:f=_.td;break a;default:f="flex-end"}c.displayAlign=f;a:switch(Dw(this,b,zw)){case "tb":case "tblr":f="row-reverse";break a;case "tbrl":f="row";break a;default:f=_.Ld}c.writingMode=f;f=this.getAttribute("extent")||Dw(this,b,"extent");c.width=Yw(f,d,1,100);c.widthUnits=Zw(f,d);c.height=
16
+ Yw(f,e,2,100);c.heightUnits=Zw(f,e);f=this.getAttribute("origin")||Dw(this,b,"origin");c.viewportAnchorX=Yw(f,d,1,0);c.viewportAnchorY=Yw(f,e,2,0);c.viewportAnchorUnits=Zw(f,d);c.cssClassList=_.Pg(this.f).concat();return c};_.w($w,Aw);_.w(ex,Aw);
17
+ ex.prototype.build=function(a){var b=null;var c=dx(a);c&&(b=ax(a.j.containerHeight,bx(a,2),480)/c);b=ax(a.j.fontSizeRadix,b,16);a=[];c="::ttml ."+this.h+", ::ttml ."+this.h+" * {";for(var d=_.u(yx.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+":"+Nw(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:"+
18
+ 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&&!xx.test(g)&&xx.test(h)&&xx.test(l)?(e=g,f=h):2===d.length&&!xx.test(g)&&xx.test(h)?(e=g,f=h):2===d.length&&xx.test(g)&&xx.test(h)&&(f=g);if(""!==f){f=Nw(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=Qw(this.a.textShadow),d=Nw(d),d="text-shadow:"+
19
+ d+";"):d="";c=c+d+("fontFamily"in this.a?"font-family:"+this.a.fontFamily.replace("monospaceSansSerif","monospace").replace("monospaceSerif","monospace").replace("proportionalSansSerif",ww).replace("proportionalSerif",ww).replace("sansSerif",ww).replace("default",ww)+";":"");a:{if(yw 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=
20
+ "text-decoration:"+d.join(" ")+";";break a}}d=""}e="padding"in this.a?"border: solid transparent;border-width:"+Nw(this.a.padding)+";":"";c=c+d+e;"lineHeight"in this.a?(d="",e=this.a.lineHeight,e=Nw(e),e=Pw(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=Nw(d);d=Pw(d,b);b="font-size:"+d+";";break a}b=null}b&&(c="::ttml ."+this.h+" .clpp-text-wrapper {",a.push(c+b+"}"),
21
+ c="::ttml .clpp-text-wrapper__"+this.h+" {",a.push(c+b+"}"));return a};var yx=new Map([[sw,"background-color"],["color","color"],[tw,tw],["fontStyle","font-style"],["fontWeight","font-weight"],["opacity","opacity"],["zIndex","z-index"]]);fx.prototype.Bd=function(){var a=this;return this.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})};var jx=0;lx.prototype.Tc=function(){return!!this.a};lx.prototype.next=function(){if(!this.a)return null;var a=this.a;do this.f.add(a),a.nodeType!==Node.TEXT_NODE&&!zx.has(Mw(a.nodeName))||Ax.has(Mw(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&&!zx.has(Mw(a.nodeName))));var b=this.a;this.a=a;return b};
22
+ var zx=new Set(["tt","head","layout",_.Oe,_.we,vw,"styling",_.$f,"body",_.Zd,"p","span","br"]),Ax=new Set([_.$f,_.we]);mx.prototype.getId=function(){return this.attributes.id};rx.prototype.parseInit=function(){};
23
+ rx.prototype.parseMedia=function(a,b,c){c&&c.length||(c=[a.byteLength]);var d=_.O.Na(this.a.ttml||{}),e=_.Xi(a,0,c[0]);e=_.R.Z(e);if(""===e)return{cues:[],styles:[]};var f=null;try{f=this.f.parseFromString(e,_.eg)}catch(n){throw new _.P(_.Q,2,2005,"Failed to parse TTML.");}d=new fx(d);e=new ox;f=new lx(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=_.Xi(a,b,h);l=_.gj(l);var m="urn:mpeg:14496-30:subs:"+g;d.h.set(m,new Bw(m,l,{imageType:"PNG",encoding:"Base64"}));
24
+ b+=h}for(;f.Tc();)a=f.next(),a=qx(e,a),"tt"===nx(a)&&(d.l=new $w(d.B,Object.assign({},a.attributes))),"tt"===nx(a)&&(d.w=new Uw(a.attributes.frameRate,a.attributes.subFrameRate,a.attributes.frameRateMultiplier,a.attributes.tickRate)),nx(a)!==_.we||a.attributes.begin||a.attributes.end||(c="#"+a.getId(),d.h.set(c,new Bw(c,a.h.textContent,a.attributes))),nx(a)===_.we&&a.attributes.begin&&a.attributes.end?(c="#"+kx(),b=new Bw(c,a.h.textContent,a.attributes),d.h.set(c,b),c=b):c=null,c&&(a.j=c.getId()),
25
+ nx(a)===_.$f&&(c=a.getId()||kx(),b=new ex(c,a.f,Object.assign({},a.attributes)),d.a.set(c,b),a.a&&d.j.get(a.a).f.push(c)),nx(a)!==_.$f&&hx(a)?(c=kx(),b=new ex(c,[],Object.assign({},a.attributes)),d.a.set(c,b),c=b):c=null,c&&a.f.push(c.getId()),nx(a)!==_.Zd||!a.attributes.extent&&!a.attributes.origin?c=null:(c=kx(),b=new Vw(c,ix(d,a.f),Object.assign({},a.attributes)),d.j.set(c,b),c=b),c&&(a.a=c.getId()),nx(a)!==vw?c=null:(c=a.getId(),b=new Vw(c,ix(d,a.f),Object.assign({},a.attributes)),d.j.set(c,b),
26
+ c=b),c&&(a.a=c.getId()),c=a.l,-1===["#text","span","br"].indexOf(nx(a))||0===c.length?c=null:(g=c[c.length-1],d.f.has(g)?(c=kx(),b=new Rw(c,"#text"===a.h.nodeName?a.h.textContent:null,"br"===nx(a),a.a,a.j,ix(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"===nx(a)||a.j?(c=kx(),b=new Rw(c,null,!1,a.a,a.j,ix(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=d.Bd();f=[];a=_.u(d.a.values());for(c=a.next();!c.done;c=
27
+ a.next())f.push.apply(f,_.Pg(c.value.build(d.l)));return{cues:e,styles:f}};sx.prototype.a=function(a){a=(new rx(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=tx(c.startTime)+" --\x3e "+tx(c.endTime),e=[];switch(c.textAlign){case _.Be:e.push("align:left");break;case _.Mf:e.push("align:right");break;case _.Zh:e.push("align:middle");break;case _.Be:e.push("align:start");break;case _.Mf:e.push("align:end")}switch(c.writingMode){case _.rg:e.push("vertical:lr");break;
28
+ case _.sg:e.push("vertical:rl")}b+=d+(e.length?" "+e.join(" "):"")+"\n";b+=c.payload+"\n\n"}return _.R.Ua(b)};ux.prototype.probe=function(a,b){return a===_.Xc&&b===_.dg};ux.prototype.create=function(a){return new sx(a)};vx.prototype.parseInit=function(a){var b=!1;(new _.ym).M(_.Re,_.zm).M(_.gg,_.zm).M(_.Me,_.zm).M(_.Qe,_.zm).M(_.Xf,_.zm).Y(_.Zf,_.Am).M("stpp",function(c){b=!0;c.parser.stop()}).parse(a);if(!b)throw new _.P(_.Q,2,2007);};
29
+ vx.prototype.parseMedia=function(a,b){var c=this,d=!1,e=[],f=[],g=[];(new _.ym).M("moof",_.zm).M("traf",_.zm).Y("subs",function(h){for(var l=_.W(h.reader),m=0;m<l;++m){h.reader.skip(4);for(var n=_.tm(h.reader),p=0;p<n;++p){var q=1===h.version?_.W(h.reader):_.tm(h.reader);g.push(q);h.reader.skip(6)}}}).M(_.Le,_.Bm(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(wx,_.fs);wx.prototype.f=function(){_.Tt(_.Xc,rx);_.Tt(_.Vc,vx);_.Tt(pw,vx);_.Tt(rw,vx);_.Tt(qw,vx);_.sk.push(this.j)};wx.prototype.a=function(){_.Vt(_.Xc);_.Vt(_.Vc);_.Vt(pw);_.Vt(rw);_.Vt(qw);_.uk(this.j)};wx.prototype.id=function(){return"subtitles-ttml"};_.I("clpp.ttml.TtmlComponent",wx);};
30
30
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
31
31
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
32
32
  else{_=this.clpp._;(f.call(g,this));}
@@ -1,9 +1,9 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var Fv="VerimatrixVCAS",Gv="clpp.verimatrix.Vcas",Hv="clpp.verimatrix.VcasComponent",Nv=function(a){_.$l.call(this,Fv);var b={};b[Iv]=Iv;b[Jv]=Jv;var c=a.authenticator,d=void 0===a.licenseRequestVuidLocation?Kv: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?Lv:a.fairPlayAssetIdStrategy;this.A=a.deviceId;this.a=c;
3
- this.D=d;this.B=b;this.w=Mv(this,e);this.o=Mv(this,f);this.l=Mv(this,g);this.j=h;this.H=l;this.G=m;this.g=new _.K(Gv);_.R.empty(this.w)?this.g.warn(_.pc):this.Ta(_.Rd,{licenseUrl:this.w,videoRobustness:[_.Vb,void 0],audioRobustness:[_.Ub,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:this.h.bind(this)}});_.R.empty(this.o)?this.g.warn(_.Gb):this.Ta(_.Pd,{licenseUrl:this.o,videoRobustness:["3000"],audioRobustness:["2000"],modifiers:{licenseRequest:this.h.bind(this)}});
4
- _.R.empty(this.l)?this.g.warn(_.cb):_.R.empty(this.j)?this.g.warn(_.bb):this.Ta(_.Md,{licenseUrl:this.l,certificateUrl:this.j,modifiers:{licenseRequest:this.K.bind(this),licenseResponse:this.M.bind(this),extractContentId:this.I.bind(this)}})},Mv=function(a,b){if(a.D===Kv){var c=Object.assign({},{deviceId:_.ej(_.R.fd(a.A))},a.a&&{authenticator:_.ej(_.R.fd(a.a))});return b+_.Zj(c)}return b},Ov=function(){this.g=new _.K(Hv)};_.w(Nv,_.$l);
5
- Nv.prototype.h=function(a,b){if(this.D===Pv){var c=this.B[Jv],d={};d[this.B[Iv]]=this.A;this.a&&(d[c]=this.a);Object.keys(d).forEach(function(e){b.headers[e]=d[e]})}};Nv.prototype.I=function(a,b){var c=_.vm(b);switch(this.G){case Qv:c=_.Zj({r:c,mn:this.H},!0)}return c};Nv.prototype.K=function(a,b){this.h(a,b);_.ym(b)};Nv.prototype.M=function(a,b){_.zm(b)};_.H(Gv,Nv);Nv.prototype.constructor=Nv.prototype.constructor;Nv.NAME=Fv;var Kv="query-string",Pv="http-header";
6
- Nv.LicenseRequestVuidLocation={QUERY_STRING:Kv,HTTP_HEADER:Pv};var Iv="DeviceId",Jv="Authenticator";Nv.LicenseRequestHttpHeader={DEVICE_ID_HEADER:Iv,AUTHENTICATOR_HEADER:Jv};var Lv="keyid",Qv="contentid-siteid";Nv.FairPlayAssetIdStrategy={KEYID:Lv,CONTENTID_SITEID:Qv};_.w(Ov,_.Hr);Ov.prototype.a=function(){delete _.Ul.VerimatrixVCAS};Ov.prototype.h=function(a){a=a.getConfiguration();if(a.drm&&a.drm.env===Fv){a=a.drm.customData;if(!a)throw new _.P(_.Q,7,7100,_.Sd);a=new Nv(a);this.g.info("Registering the Verimatrix VCAS Ultra environment");_.Vl(a)}};Ov.prototype.id=function(){return"verimatrix-vcas"};_.H(Hv,Ov);};
2
+ var f=function(window){var dw="VerimatrixVCAS",ew="clpp.verimatrix.Vcas",fw="clpp.verimatrix.VcasComponent",lw=function(a){_.lm.call(this,dw);var b={};b[gw]=gw;b[hw]=hw;var c=a.authenticator,d=void 0===a.licenseRequestVuidLocation?iw: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?jw:a.fairPlayAssetIdStrategy;this.A=a.deviceId;this.a=c;
3
+ this.D=d;this.B=b;this.w=kw(this,e);this.o=kw(this,f);this.l=kw(this,g);this.j=h;this.H=l;this.G=m;this.g=new _.K(ew);_.R.empty(this.w)?this.g.warn(_.oc):this.Sa(_.Sd,{licenseUrl:this.w,videoRobustness:[_.Vb,void 0],audioRobustness:[_.Ub,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:this.h.bind(this)}});_.R.empty(this.o)?this.g.warn(_.Gb):this.Sa(_.Qd,{licenseUrl:this.o,videoRobustness:["3000"],audioRobustness:["2000"],modifiers:{licenseRequest:this.h.bind(this)}});
4
+ _.R.empty(this.l)?this.g.warn(_.bb):_.R.empty(this.j)?this.g.warn(_.ab):this.Sa(_.Od,{licenseUrl:this.l,certificateUrl:this.j,modifiers:{licenseRequest:this.K.bind(this),licenseResponse:this.L.bind(this),extractContentId:this.I.bind(this)}})},kw=function(a,b){if(a.D===iw){var c=Object.assign({},{deviceId:_.hj(_.R.cd(a.A))},a.a&&{authenticator:_.hj(_.R.cd(a.a))});return b+_.dk(c)}return b},mw=function(){this.g=new _.K(fw)};_.w(lw,_.lm);
5
+ lw.prototype.h=function(a,b){if(this.D===nw){var c=this.B[hw],d={};d[this.B[gw]]=this.A;this.a&&(d[c]=this.a);Object.keys(d).forEach(function(e){b.headers[e]=d[e]})}};lw.prototype.I=function(a,b){var c=_.Jm(b);switch(this.G){case ow:c=_.dk({r:c,pn:this.H},!0)}return c};lw.prototype.K=function(a,b){this.h(a,b);_.Mm(b)};lw.prototype.L=function(a,b){_.Nm(b)};_.I(ew,lw);lw.prototype.constructor=lw.prototype.constructor;lw.NAME=dw;var iw="query-string",nw="http-header";
6
+ lw.LicenseRequestVuidLocation={QUERY_STRING:iw,HTTP_HEADER:nw};var gw="DeviceId",hw="Authenticator";lw.LicenseRequestHttpHeader={DEVICE_ID_HEADER:gw,AUTHENTICATOR_HEADER:hw};var jw="keyid",ow="contentid-siteid";lw.FairPlayAssetIdStrategy={KEYID:jw,CONTENTID_SITEID:ow};_.w(mw,_.fs);mw.prototype.a=function(){delete _.fm.VerimatrixVCAS};mw.prototype.h=function(a){a=a.getConfiguration();if(a.drm&&a.drm.env===dw){a=a.drm.customData;if(!a)throw new _.P(_.Q,7,7100,_.Td);a=new lw(a);this.g.info("Registering the Verimatrix VCAS Ultra environment");_.gm(a)}};mw.prototype.id=function(){return"verimatrix-vcas"};_.I(fw,mw);};
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,17 +1,17 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var vv="Registering listeners",wv="clpp.vimond.VimondPlugin",xv=function(a,b,c,d,e){this.G=a;this.H=b;this.I=c;this.m=d;this.D=e;this.a=new _.Eh;this.l=!0;this.f=this.j=this.A=!1;this.B=null;this.h=new _.uk(this.Cg.bind(this));this.g=new _.K("clpp.vimond.VimondDispatcher");this.o=this.w=0;this.m&&this.a&&(this.g.debug(vv),this.a.on(this.m,_.Tf,this.yj.bind(this)),this.a.on(this.m,_.eg,this.zj.bind(this)),this.a.on(this.m,_.vc,this.wj.bind(this)),this.a.on(this.m,_.wc,this.xj.bind(this)))},yv=function(a,
3
- b){a.m.trigger(new _.L(_.xg,{detail:b}))},zv=function(a,b,c){b&&(a.A=!0,a.h.stop());a.m.onError(new _.P(b?_.Q:1,9,9201,c))},Av=function(a,b,c,d,e){this.l=a;this.o=c;this.h=b;this.a=d;this.j=e;this.g=new _.K("clpp.vimond.VimondService");this.f=0},Bv=function(a){this.m=a;this.a=new _.Eh;this.g=new _.K("clpp.vimond.VimondAdapter");this.f=this.h=!1;this.m&&this.a&&(this.g.debug(vv),this.a.on(this.m,_.Gf,this.ul.bind(this)),this.a.on(this.m,_.vc,this.uj.bind(this)),this.a.on(this.m,_.wc,this.vj.bind(this)))},
4
- Cv=function(a,b){var c=a.m.getState();if(1===b)return["str-start",_.of];if(a.h)return[_.le,_.cf];if(c===_.No)return[_.le,null];if(c===_.Ro)return[_.ne,_.cf];var d=_.cf;if(c===_.Lo||c===_.Uo||a.f)d=_.of;return["period",d]},Dv=function(){this.a=!1;this.g=new _.K(wv);this.j=this.h=this.f=null},Ev=function(){};_.r=xv.prototype;_.r.zj=function(){this.f||(this.f=1<Math.abs(this.w-this.m.getPosition()));this.w=this.m.getPosition()};_.r.wj=function(){this.g.debug("Ad break started");this.j=!0};
5
- _.r.xj=function(){this.g.debug("Ad break stopped");this.j=!1};
6
- _.r.yj=function(a){var b=this,c,d,e,f,g;return _.E(function(h){if(1==h.a){c=a.detail;d=_.Po;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.F(0);
7
- b.B=e;return _.x(h,b.Cg(),3)}e===d.ENDED&&b.h.stop();_.y(h)})};
8
- _.r.Cg=function(){var a=this,b,c,d,e,f,g;return _.E(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.aa(a.l?10:a.G);a.l=!1;_.A(h,2);l=a.D;l.f++;var m=_.N.na(l.o);m.client.buildName=_.wa;m.client.buildVersion=_.ia;var n=m.client,p=l.a.m.getDrmInfo();n.drm=p?p.keySystem:"";m.client.pageUrl=document.location.href;m.client.streamUrl=l.a.m.getLoadedSource().url;m.client.userAgent=navigator.userAgent;m.client.videoFormat=
9
- l.a.m.getLoadedSource().type||"";n=m.client;p=l.a.m.getLoadedSource();p=((new _.Xj(p.url)).scheme||"").replace(":","");n.videoProtocol=p;n=Cv(l.a,l.f);m.client.playerEvent=n[0]||"";m.client.playerState=n[1]||"";m.progress.vod&&(m.progress.vod.position=l.a.getPosition());if(n=m.progress.live){p=l.a;var q=p.m.getPresentationStartTime()||0;p=Math.floor(q+p.m.getPosition());p=(new Date(1E3*p)).toISOString();n.position=p;q=l.a;p=q.m.getPosition();q=q.m.getSeekRange().end;n.onLiveEdge=30>Math.abs(q-p);
10
- typeof n.liveResumePossible!==_.hd&&(n.liveResumePossible=!0)}m.progress.eventNumber=l.f;m.timestamp=(new Date).toISOString();l.g.debug("Fire an event");n=_.rj(l.l);n.method="POST";n.contentType="application/json";n.headers.Authorization="Bearer "+l.h;n.body=_.R.fd(JSON.stringify(m));l=l.j.fetch(n).O;return _.x(h,l,4)}if(2!=h.a)return b=h.f,yv(a,b),_.ah(h,0);d=c=_.C(h);e=d.code;f=d.data;g=[1002,1003];g.includes(e)?(a.g.debug("Unreachable service"),yv(a,f),zv(a,a.H,f)):1001===e?(a.g.debug("Generic service error"),
11
- yv(a,f),zv(a,a.I,f)):a.g.error(c.toString());_.y(h)})};_.r.dispose=function(){this.g.debug(_.gc);_.Hh(this.a);this.h.stop()};Av.prototype.Uf=function(a){this.h=a};_.r=Bv.prototype;_.r.getPosition=function(){return Math.floor(this.m.getPosition())};_.r.ul=function(){this.h=!0};_.r.uj=function(){this.f=!0};_.r.vj=function(){this.f=!1};_.r.dispose=function(){this.g.debug(_.gc);_.Hh(this.a)};_.w(Dv,_.qt);_.r=Dv.prototype;_.r.onPlayerCreated=function(){};
12
- _.r.onContentWillLoad=function(a){var b=a.getConfiguration();(this.a=!_.N.R(b.vimond)&&typeof b.vimond===_.Te)?a.namespace()===_.Cd&&(this.a=!1,this.g.info("Vimond does not report when casting.")):this.g.warn("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 _.P(1,9,9200));return}this.g.debug("Configuration is valid");
13
- c=b.failIfUnreachable;typeof c!==_.hd&&(c=!0);d=b.failOnError;typeof d!==_.hd&&(d=!0);this.f=new Bv(a);this.h=new Av(b.playerEventRequest.uri,b.authToken,b.playerEventRequest.body,this.f,a.getNetworkEngine());this.j=new xv(b.playerEventRequest.eventInterval,c,d,a,this.h)}};_.r.onPlayerWillRelease=function(){this.a&&(this.f&&this.f.dispose(),this.j&&this.j.dispose(),this.j=this.h=this.f=null)};_.r.onPlayerWillDestroy=function(){};_.r.id=function(){return"vimond"};
14
- _.r.Uf=function(a){this.a&&this.h&&this.h.Uf(a)};_.H(wv,Dv);Dv.prototype.updateAuthToken=Dv.prototype.Uf;Dv.Id="vimond";Ev.prototype.create=function(){return new Dv};_.mq(new Ev);};
2
+ var f=function(window){var Uv="Registering listeners",Vv="clpp.vimond.VimondPlugin",Wv=function(a,b,c,d,e){this.G=a;this.H=b;this.I=c;this.m=d;this.D=e;this.a=new _.Eh;this.l=!0;this.f=this.j=this.A=!1;this.B=null;this.h=new _.Gk(this.Dg.bind(this));this.g=new _.K("clpp.vimond.VimondDispatcher");this.o=this.w=0;this.m&&this.a&&(this.g.debug(Uv),this.a.on(this.m,_.Vf,this.Bj.bind(this)),this.a.on(this.m,_.fg,this.Cj.bind(this)),this.a.on(this.m,_.uc,this.zj.bind(this)),this.a.on(this.m,_.vc,this.Aj.bind(this)))},Xv=function(a,
3
+ b){a.m.trigger(new _.L(_.yg,{detail:b}))},Yv=function(a,b,c){b&&(a.A=!0,a.h.stop());a.m.onError(new _.P(b?_.Q:1,9,9201,c))},Zv=function(a,b,c,d,e){this.l=a;this.o=c;this.h=b;this.a=d;this.j=e;this.g=new _.K("clpp.vimond.VimondService");this.f=0},$v=function(a){this.m=a;this.a=new _.Eh;this.g=new _.K("clpp.vimond.VimondAdapter");this.f=this.h=!1;this.m&&this.a&&(this.g.debug(Uv),this.a.on(this.m,_.If,this.xl.bind(this)),this.a.on(this.m,_.uc,this.xj.bind(this)),this.a.on(this.m,_.vc,this.yj.bind(this)))},
4
+ aw=function(a,b){var c=a.m.getState();if(1===b)return["str-start",_.tf];if(a.h)return[_.ne,_.ef];if(c===_.bp)return[_.ne,null];if(c===_.fp)return[_.pe,_.ef];var d=_.ef;if(c===_.$o||c===_.ip||a.f)d=_.tf;return["period",d]},bw=function(){this.a=!1;this.g=new _.K(Vv);this.j=this.h=this.f=null},cw=function(){};_.r=Wv.prototype;_.r.Cj=function(){this.f||(this.f=1<Math.abs(this.w-this.m.getPosition()));this.w=this.m.getPosition()};_.r.zj=function(){this.g.debug("Ad break started");this.j=!0};
5
+ _.r.Aj=function(){this.g.debug("Ad break stopped");this.j=!1};
6
+ _.r.Bj=function(a){var b=this,c,d,e,f,g;return _.E(function(h){if(1==h.a){c=a.detail;d=_.dp;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.F(0);
7
+ b.B=e;return _.x(h,b.Dg(),3)}e===d.ENDED&&b.h.stop();_.y(h)})};
8
+ _.r.Dg=function(){var a=this,b,c,d,e,f,g;return _.E(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.aa(a.l?10:a.G);a.l=!1;_.A(h,2);l=a.D;l.f++;var m=_.O.oa(l.o);m.client.buildName=_.va;m.client.buildVersion=_.ia;var n=m.client,p=l.a.m.getDrmInfo();n.drm=p?p.keySystem:"";m.client.pageUrl=document.location.href;m.client.streamUrl=l.a.m.getLoadedSource().url;m.client.userAgent=navigator.userAgent;m.client.videoFormat=
9
+ l.a.m.getLoadedSource().type||"";n=m.client;p=l.a.m.getLoadedSource();p=((new _.bk(p.url)).scheme||"").replace(":","");n.videoProtocol=p;n=aw(l.a,l.f);m.client.playerEvent=n[0]||"";m.client.playerState=n[1]||"";m.progress.vod&&(m.progress.vod.position=l.a.getPosition());if(n=m.progress.live){p=l.a;var q=p.m.getPresentationStartTime()||0;p=Math.floor(q+p.m.getPosition());p=(new Date(1E3*p)).toISOString();n.position=p;q=l.a;p=q.m.getPosition();q=q.m.getSeekRange().end;n.onLiveEdge=30>Math.abs(q-p);
10
+ typeof n.liveResumePossible!==_.id&&(n.liveResumePossible=!0)}m.progress.eventNumber=l.f;m.timestamp=(new Date).toISOString();l.g.debug("Fire an event");n=_.uj(l.l);n.method="POST";n.contentType="application/json";n.headers.Authorization="Bearer "+l.h;n.body=_.R.cd(JSON.stringify(m));l=l.j.fetch(n).O;return _.x(h,l,4)}if(2!=h.a)return b=h.f,Xv(a,b),_.bh(h,0);d=c=_.C(h);e=d.code;f=d.data;g=[1002,1003];g.includes(e)?(a.g.debug("Unreachable service"),Xv(a,f),Yv(a,a.H,f)):1001===e?(a.g.debug("Generic service error"),
11
+ Xv(a,f),Yv(a,a.I,f)):a.g.error(c.toString());_.y(h)})};_.r.dispose=function(){this.g.debug(_.gc);_.Hh(this.a);this.h.stop()};Zv.prototype.Vf=function(a){this.h=a};_.r=$v.prototype;_.r.getPosition=function(){return Math.floor(this.m.getPosition())};_.r.xl=function(){this.h=!0};_.r.xj=function(){this.f=!0};_.r.yj=function(){this.f=!1};_.r.dispose=function(){this.g.debug(_.gc);_.Hh(this.a)};_.w(bw,_.fu);_.r=bw.prototype;_.r.onPlayerCreated=function(){};
12
+ _.r.onContentWillLoad=function(a){var b=a.getConfiguration();(this.a=!_.O.R(b.vimond)&&typeof b.vimond===_.Ve)?a.namespace()===_.Dd&&(this.a=!1,this.g.info("Vimond does not report when casting.")):this.g.warn("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 _.P(1,9,9200));return}this.g.debug("Configuration is valid");
13
+ c=b.failIfUnreachable;typeof c!==_.id&&(c=!0);d=b.failOnError;typeof d!==_.id&&(d=!0);this.f=new $v(a);this.h=new Zv(b.playerEventRequest.uri,b.authToken,b.playerEventRequest.body,this.f,a.getNetworkEngine());this.j=new Wv(b.playerEventRequest.eventInterval,c,d,a,this.h)}};_.r.onPlayerWillRelease=function(){this.a&&(this.f&&this.f.dispose(),this.j&&this.j.dispose(),this.j=this.h=this.f=null)};_.r.onPlayerWillDestroy=function(){};_.r.id=function(){return"vimond"};
14
+ _.r.Vf=function(a){this.a&&this.h&&this.h.Vf(a)};_.I(Vv,bw);bw.prototype.updateAuthToken=bw.prototype.Vf;bw.Id="vimond";cw.prototype.create=function(){return new bw};_.Dq(new cw);};
15
15
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
16
16
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
17
17
  else{_=this.clpp._;(f.call(g,this));}