@castlabs/prestoplay 6.14.0 → 6.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +7 -7
  5. package/cjs/cl.cast.js +113 -111
  6. package/cjs/cl.conviva.js +33 -33
  7. package/cjs/cl.core.js +550 -529
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +74 -73
  10. package/cjs/cl.externs.js +191 -64
  11. package/cjs/cl.freewheel.js +24 -24
  12. package/cjs/cl.hls.js +69 -68
  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 +290 -275
  17. package/cjs/cl.muxdata.js +15 -15
  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 +72 -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 +89 -88
  35. package/cl.conviva.js +27 -27
  36. package/cl.core.js +457 -438
  37. package/cl.crypto.js +9 -9
  38. package/cl.dash.js +70 -68
  39. package/cl.externs.js +187 -64
  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 +255 -240
  46. package/cl.muxdata.js +13 -13
  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 +15 -15
  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 +1 -1
  62. package/typings.d.ts +387 -90
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.D=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.Jd)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.Jd,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.Xh]=!b.Ff;e[d.Yh]=b.Jd;""!==b.customData&&(e[d.Wh]=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.Jd;l=_.rj([h],_.oj());l.type=3;l.body=f.buffer;l.method=
6
- "POST";_.A(B,2);return _.x(B,a.D.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.D.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.D.onError(F);_.y(B)})},$J=function(a){this.m=a;this.a=this.m.a;this.f=_.Ho;this.j=_.Io;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===_.So&&b!==_.Ho)a.g.debug(_.Uy+aK(b));else{var c=(new Date).getTime();a.j=a.f;a.f=b;a.f===_.Mo?(a.o=(new Date).getTime(),a.m.trigger(new _.L(_.jd,{detail:{bufferedTimeMS:-1,
8
- reason:a.h}}))):a.j===_.Mo&&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(_.Qo)[a]},eK=function(a){if(a.l){var b=a.a.getState(),c=a.f;switch(b){case cK:c=_.Vo;break;case dK:c=_.Uo;break;default:a.m.isEnded()?c=_.Oo: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.C=!1;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,_.Cs(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 _.KA,d=new _.Sz(function(){return null}),e=a.m.getTextDisplayer();return new _.MA(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.tj.bind(a),vf:a.sj.bind(a),onError:a.U.bind(a),nh:function(){},onEvent:function(){},rh:a.uj.bind(a),xe:function(){},ef:function(){return new _.RB},Se:function(){return!1},vd:null};return new _.PC(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=_.SC(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.C=b.kind===_.oe,a.a&&a.f)){a.setTextVisibility(!0);
13
- var c=kK(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):(_.cD(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.ka();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=_.Gz(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.ta(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.C=1;this.B=!1;this.l=null;this.G=0;
21
- this.o=!0;this.f=!1;this.a=null;this.A=1;this.w=!1;this.j={}},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.nj.bind(a),onbufferingprogress:a.mj.bind(a),onbufferingcomplete:a.lj.bind(a),onstreamcompleted:a.qj.bind(a),oncurrentplaytime:function(b){a.trigger(new _.L(JK,
22
- {currentTime:b}))},onevent:a.pj.bind(a),onsubtitlechange:a.rj.bind(a),ondrmevent:a.oj.bind(a),onerror:a.U.bind(a)})}catch(b){a.g.error(b)}},LK=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)}},MK=function(a,b){try{var c=b.estimatedBandwidth||0,d=b.currentBandwidth||0;a.g.debug({estimatedBandwidth:c,Zm: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(),eg:a.getState(),playbackRate:a.getPlaybackRate(),isLive:a.isLive(),duration:a.getDuration(),isMuted:OK(a),volume:a.getVolume(),vm:PK(a),Ij: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=_.Zo(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.eg;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.vm:webapis.avplay.getTotalTrackInfo()},FK=function(a){return a.f&&a.a?a.a.Ij:webapis.avplay.getCurrentStreamInfo()},sK=function(a,b,c){b=b.toUpperCase();b===uK&&$K(a,!0);var d=a.j[b];d&&(d.Be.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,Be:new _.uk(function(){return g(h,c,!0)})}),(l=a.j[h])&&3>l.bg?(!a.w&&++l.bg,l.Be.aa(a.w?.5:.25)):(a.g.debug("Could not set track after multiple attempts.Giving up..."),l&&l.Be.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.C=new _.Kj;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(_.za,_.Mb+a.h.env+_.ca),new _.P(_.Q,6,6015,_.Aa+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,{Jd:e.licenseUrl||"",customData:c,Ff:!1});(f=d[_.Rd])&&a.f.set(_.Rd,{Jd: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={Xh:"DeleteLicenseAfterUse",Yh:"LicenseServer",Jm:"GetChallenge",Km:"HttpHeader",Om:"UserAgent",Fm:"Cookie",Wh:"CustomData"};_.r=$J.prototype;_.r.initialize=function(){this.a.on(TK,this.sg,this);this.a.on(eL,this.rg,this);this.a.on(fL,this.qg,this);this.a.on(UK,this.uh,this);this.a.on(WK,this.th,this);this.a.on(gL,this.tg,this)};_.r.release=function(){bK(this,_.Ho);this.l=!1;this.o=-1;this.h=2};_.r.destroy=function(){this.release();this.a.off(TK,this.sg);this.a.off(eL,this.rg);this.a.off(fL,this.qg);this.a.off(UK,this.uh);this.a.off(WK,this.th);this.a.off(gL,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;bK(this,_.Mo)};_.r.rg=function(a){this.g.debug("Buffering progress: "+a.percent+" %. Player state: ",aK(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()===hL;if(!a&&b){bK(this,_.Uo);return}}if(a=this.f!==_.To)a=this.a.getState(),a=a===cK||a===dK;a&&eK(this)};
37
- _.r.uh=function(){this.g.debug("Preparing starts. AVPlay State: ",this.a.getState());this.a.getState()===iL?bK(this,_.To):this.g.error("AVPlay prepares while state is not IDLE")};_.r.th=function(){this.g.debug("Preparing ends: AVPlay state:",this.a.getState())};_.r.tg=function(){bK(this,_.Oo)};_.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;b.C=l.preferForcedSubtitles;_.ah(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.tj=function(a){this.g.debug(_.iz,a);this.w=!0;var b=_.uB(a.textStreams,this.o||"",this.A||"",this.C)[0]||null;this.l&&(a.textStreams.includes(this.l)&&(b=this.l),this.l=null);return{variant:null,text:b}};_.r.sj=function(){this.g.debug("canSwitch_");this.w=!1;this.l&&(_.cD(this.f,this.l,!0,0),this.l=null)};_.r.U=function(){this.g.debug("onError_")};
41
- _.r.uj=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(oK,_.U);_.r=oK.prototype;_.r.jh=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===_.Vo&&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===_.Vo&&(b.g.debug("Current state",c.currentState),b.A=!0,rK(b)))});this.a.on(lL,this.jh,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.jh);this.a=this.m=null};_.r.getVideoTracks=function(){return this.f[_.Qj]||[]};_.r.getAudioTracks=function(){return this.f[_.T]||[]};
45
- _.r.fa=function(){return this.f[_.S]||[]};_.r.ka=function(){return GK(this,_.Qj)};_.r.Qa=function(){return GK(this,_.T)};_.r.Ha=function(){return GK(this,_.S)};_.r.bb=function(){return this.w};_.r.mb=function(){this.g.info(NJ);return null};_.r.nb=function(){this.g.info(NJ);return null};_.r.Ia=function(){var a=this.ka();return a?a.track:null};_.r.ja=function(){var a=this.Qa();return a?a.track:null};_.r.ua=function(){var a=this.Ha();return a?a.track:null};
46
- _.r.ib=function(a){var b=this;null===a?(a=this.ka(),ZK(this.a,a.bandwidth,null).then(function(){qK(b)})):0<a.renditions.length&&this.Ya(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.La=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.Ya=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,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.gb=function(a){vK(this,a)};_.r.hb=function(a){this.h?nK(this.h,a.track):vK(this,a)};
48
- _.r.addTextTrack=function(){};_.r.ma=function(){return this.a.o};oK.prototype.isAbrEnabled=oK.prototype.ma;oK.prototype.addTextTrack=oK.prototype.addTextTrack;oK.prototype.setTextRendition=oK.prototype.hb;oK.prototype.setAudioRendition=oK.prototype.gb;oK.prototype.setVideoRendition=oK.prototype.Ya;oK.prototype.setTextTrack=oK.prototype.La;oK.prototype.setAudioTrack=oK.prototype.za;oK.prototype.setVideoTrack=oK.prototype.ib;oK.prototype.getTextTrack=oK.prototype.ua;oK.prototype.getAudioTrack=oK.prototype.ja;
49
- oK.prototype.getVideoTrack=oK.prototype.Ia;oK.prototype.getLoadingTextRendition=oK.prototype.nb;oK.prototype.getLoadingAudioRendition=oK.prototype.mb;oK.prototype.getLoadingVideoRendition=oK.prototype.bb;oK.prototype.getTextRendition=oK.prototype.Ha;oK.prototype.getAudioRendition=oK.prototype.Qa;oK.prototype.getVideoRendition=oK.prototype.ka;oK.prototype.getTextTracks=oK.prototype.fa;oK.prototype.getAudioTracks=oK.prototype.getAudioTracks;oK.prototype.getVideoTracks=oK.prototype.getVideoTracks;_.w(HK,_.tl);_.r=HK.prototype;_.r.nj=function(){this.w=!0;this.f||this.trigger(new _.L(TK))};_.r.mj=function(a){this.w=!0;this.trigger(new _.L(eL,{percent:a}))};_.r.lj=function(){this.w=!1;this.trigger(new _.L(fL))};_.r.qj=function(){this.trigger(new _.L(gL))};_.r.pj=function(a,b){this.trigger(new _.L(lL,{eventid:a,data:b}))};_.r.rj=function(a,b,c,d,e){this.trigger(new _.L(mL,{duration:a,text:b,subtitleType:c,attriCount:d,attributes:e}))};
50
- _.r.oj=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.D.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.C=a}catch(c){return this.g.debug("Error while trying to set playback rate",c),this.setPlaybackRate(this.C)}return!0}this.g.debug("Cannot set playback rate; AVPlay is in inconsistent state: "+b);return!1};_.r.getPlaybackRate=function(){return this.C};
54
- _.r.load=function(a,b){var c=this,d;return _.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.eg;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(_.og));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.Be.stop()}a.j={};a.C=1;a.B=!1;a.l=null;a.a=null;return b()}catch(f){return c(f)}})};_.r.getVolume=function(){var a=null;try{a=tizen.tvaudiocontrol.getVolume()}catch(b){switch(b.name){case 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)}}};
2
+ var f=function(window){var xL="An unknown error occurred while trying to get volume",yL="Cannot get loading rendition due to platform limitations",zL="PARAM_START_POSITION",AL="SecurityError",BL="The require privilege is: http://tizen.org/privilege/tv.audio",CL="|STARTBITRATE\x3d",DL=function(a,b,c){function d(e){c.call(a,e);a.removeEventListener(b,d)}a.addEventListener(b,d)},EL=function(a,b){this.h=a;this.o=null;this.a=_.We;this.l=null;this.j=!1;this.f=new Map;this.C=b;this.g=new _.K("clpp.tizen.DrmEngine")},HL=function(a){var b,
3
+ c,d;return _.E(function(e){if(1==e.a){b=a.a===_.Td||a.a===_.Rd;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.Sd)throw new _.P(_.Q,6,6012,"No license server given for "+a.a);_.A(e,2);return a.a===_.Td?_.x(e,FL(a),5):_.x(e,GL(a,c),5)}if(2!=e.a)return a.o={keySystem:a.a,licenseServerUri:c.Sd,distinctiveIdentifierRequired:!1,persistentStateRequired:c.Qf,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[],
4
+ keyIds:[],periodId:null},_.oh(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)});})},GL=function(a,b){var c,d,e,f;return _.E(function(g){c=IL;d=JL;e={};e[d.pi]=!b.Qf;e[d.ri]=b.Sd;""!==b.customData&&(e[d.oi]=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)})},FL=function(a){var b;return _.E(function(c){b=IL;try{webapis.avplay.setDrm(b.fe,
5
+ "Initialize",""),webapis.avplay.setDrm(b.fe,"widevine_app_session",a.l.id),webapis.avplay.setDrm(b.fe,"widevine_data_type",a.l.type)}catch(d){throw d;}_.y(c)})},KL=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,u,v,z,B,I,F;_.E(function(D){if(1==D.a){c=IL;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.Sd;l=_.Jj([h],_.Gj());l.type=3;l.body=f.buffer;l.method=
6
+ "POST";_.A(D,2);return _.x(D,a.C.tb.fetch(l).P,4)}if(2!=D.a){m=D.f;if(a.j){n=_.lj(m.data);p=n.byteLength;q="";for(u=0;u<p;u++)q+=String.fromCharCode(n[u]);v=btoa(q);z=b.session_id+zL+(v+zL);a.g.debug("Widevine license params",z);try{webapis.avplay.setDrm(c.fe,"widevine_license_data",z)}catch(G){a.g.error("License response rejected by CDM"),B=new _.P(_.Q,6,6008,{browserError:JSON.stringify(G)}),a.C.onError(B)}}return _.oh(D,0)}I=_.C(D);a.g.error("License request failed.",JSON.stringify(I));F=new _.P(_.Q,
7
+ 6,6007,{message:_.Za,url:I.data.url,status:I.data.status||NaN,response:I.data.response||"",headers:I.data.headers||{}},I);a.C.onError(F);_.y(D)})},LL=function(a){this.m=a;this.a=this.m.a;this.f=_.jp;this.j=_.kp;this.w=(new Date).getTime();this.l=!1;this.o=-1;this.h=2;this.g=new _.K("clpp.tizen.StateManager")},NL=function(a,b){if(a.f!==b)if(a.f===_.up&&b!==_.jp)a.g.debug(_.Sz+ML(b));else{var c=(new Date).getTime();a.j=a.f;a.f=b;a.f===_.op?(a.o=(new Date).getTime(),a.m.trigger(new _.L(_.md,{detail:{bufferedTimeMS:-1,
8
+ reason:a.h}}))):a.j===_.op&&a.m.trigger(new _.L(_.ld,{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(_.eg,{detail:d}));a.g.debug("State changed:",ML(a.j),"-\x3e",ML(a.f))}},ML=function(a){return Object.keys(_.sp)[a]},QL=function(a){if(a.l){var b=a.a.getState(),c=a.f;switch(b){case OL:c=_.xp;break;case PL:c=_.wp;break;default:a.m.isEnded()?c=_.qp:a.g.debug("Inconsistent AVPlay playback state:",b)}NL(a,
9
+ c)}},RL=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")},SL=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},TL=function(a){var b,c;return _.E(function(d){if(1==d.a)return b=a.m.getConfiguration(),c=null,_.x(d,_.zt(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
+ UL=function(a){var b=document.createElement(_.Fg),c=new _.lC,d=new _.NA(function(){return null}),e=a.m.getTextDisplayer();return new _.nC(b,c,e,d,a.m.getConfiguration())},VL=function(a){var b={configuration:{},Db:function(){return a.m.getPosition()},W:a.h,tb:a.m.getNetworkEngine(),Hf:a.Mj.bind(a),Gf:a.Lj.bind(a),onError:a.U.bind(a),Fh:function(){},onEvent:function(){},Jh:a.Nj.bind(a),Ee:function(){},uf:function(){return new _.yD},ef:function(){return!1},vd:null};return new _.eE(a.a,b)},WL=function(a){var b=
11
+ a.m.getPosition(),c=null;a=_.t(a.a.periods);for(var d=a.next();!d.done;d=a.next())d=d.value,d.startTime<=b&&(c=d);return c},XL=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 _.gk(String(c++),_.T);e.mimeType=a[d].mimeType;e.language=a[d].language;e.roles=
12
+ a[d].roles;e.kind=a[d].kind||_.lA;var f=new _.pk(String(a[d].id),e);f.bandwidth=a[d].bandwidth||null;e.renditions.push(f);b.push(e)}return b},YL=function(a){if(a.h&&!a.h.getTextDisplayer().isTextVisible())return null;if(a.f){var b=_.hE(a.f,_.Ri),c=null;if(b){a=XL(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},ZL=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===_.se,a.a&&a.f)){a.setTextVisibility(!0);
13
+ var c=WL(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):(_.sE(a.f,c,!0,0),a.m.trigger(new _.L(_.Ol))),a.o=c.language):a.g.error(_.Rz,d.id)}},$L=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},aM=function(a,b){a.m.trigger(new _.L(_.Jg,{details:{width:b.width,height:b.height,bandwidth:b.bandwidth,track:b.track,abrSelection:a.a.o}}))},
14
+ bM=function(a){var b=a.ma();b&&a.m.trigger(new _.L(_.jd,{detail:{width:b.width,height:b.height,bandwidth:b.bandwidth,rendition:b}}))},cM=function(a){var b=a.m.getConfiguration(),c=_.gi(b.preferredAudioLanguage||[]),d=a.f[_.ik]||[];if(d.length){var e=null;c.some(function(g){e=_.GA(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.xa(c)}else a.g.debug("Preferred language(s) not available")}else a.g.debug("Could not set preferred audio language")},gM=function(a,b){if(b){var c=b.track.type.toUpperCase();dM(a.a,c,Number(b.id)).then(function(){c===eM&&(a.j=b,a.m.trigger(new _.L(_.Nl)));c===fM&&(a.l=b,a.m.trigger(new _.L(_.Ol)))})["catch"](function(){a.g.error("Could not select "+c+" track.")})}else a.g.debug("Must provide valid rendition")},hM=
16
+ function(a,b,c){var d=_.dj(b.language||_.vg);c.language=_.hk(d);c.originalLanguage=d;c.channelsCount=b.channels?Number(b.channels):null;c.mimeType=_.fd;a=new _.pk(String(a),c);a.track=c;a.codec=b.fourCC||null;a.bandwidth=b.bit_rate||null;return a},iM=function(a,b,c){c.mimeType=_.Hg;a=new _.pk(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},jM=function(a,b,c){b=_.dj(b.track_lang||_.vg);c.mimeType="text/ttml";
17
+ c.language=_.hk(b);c.originalLanguage=b;c.kind=_.lA;return new _.pk(String(a),c)},kM=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},nM=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===lM}),f=b.filter(function(n){return n.type===eM}),g=[],h=0;h<f.length;h++){var l=kM(a,f[h].extra_info);if(l){var m=
18
+ _.dj(l.language||_.vg);m=_.hk(m);m=c(g,m);m||(m=new _.gk(String(a.o++),_.ik),g.push(m));m.renditions.push(hM(f[h].index,l,m))}else a.g.warn("Skipping audio stream with no extra info")}f=new _.gk(String(a.o++),_.jk);for(h=0;h<e.length;h++)(l=kM(a,e[h].extra_info))?f.renditions.push(iM(e[h].index,l,f)):a.g.warn("Skipping video stream with no extra info");e=[];e=a.h?XL(a.h):mM(a,b);d[_.jk]=[f];d[_.ik]=g;d[_.T]=e;return d},mM=function(a,b){for(var c=b.filter(function(h){return h.type===fM}),d=[],e=0;e<
19
+ c.length;e++){var f=kM(a,c[e].extra_info);if(f){var g=new _.gk(String(a.o++),_.T);g.renditions.push(jM(c[e].index,f,g));d.push(g)}else a.g.warn("Skipping text stream with no extra info")}return d},oM=function(a,b){for(var c=a.f[_.jk]||[],d=[],e=0;e<c.length;e++)for(var f=0;f<c[e].renditions.length;f++)_.O.ka(c[e].renditions[f],b,Object.keys(b))&&d.push(c[e].renditions[f]);return d[0]||null},pM=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},rM=function(a,b){if(b===_.T&&a.h)return YL(a.h);var c=qM(a.a)||[];if(0===c.length)return null;c=c.filter(function(e){return e.type===b.toUpperCase()})[0];var d=null;b===_.jk&&(d=kM(a,c.extra_info),d=oM(a,{width:d.Width,height:d.Height}));b===_.ik&&(c?(d=pM(a,c,_.ik),a.j=d):d=a.j);b===_.T&&(c?(d=pM(a,c,_.T),a.l=d):d=a.l);return d},sM=function(a){_.Ul.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={}},tM=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)})},vM=function(a){try{webapis.avplay.setListener({onbufferingstart:a.Gj.bind(a),onbufferingprogress:a.Fj.bind(a),onbufferingcomplete:a.Ej.bind(a),onstreamcompleted:a.Jj.bind(a),oncurrentplaytime:function(b){a.trigger(new _.L(uM,
22
+ {currentTime:b}))},onevent:a.Ij.bind(a),onsubtitlechange:a.Kj.bind(a),ondrmevent:a.Hj.bind(a),onerror:a.U.bind(a)})}catch(b){a.g.error(b)}},wM=function(a){var b=!!a.m.getTrackManager().Ga();try{webapis.avplay.setSilentSubtitle(!b)}catch(c){a.g.debug("Could not set AVPlay subtitle config",c)}},xM=function(a,b){try{var c=b.estimatedBandwidth||0,d=b.currentBandwidth||0;a.g.debug({estimatedBandwidth:c,zn:d});0!==c&&0!==d&&c>=1.15*d&&webapis.avplay.setStreamingProperty("ADAPTIVE_INFO",CL+d)}catch(e){a.g.debug(e)}},
23
+ yM=function(a,b){try{webapis.avplay.setStreamingProperty("ADAPTIVE_INFO","|BITRATES\x3d"+b+CL+b)}catch(c){throw a.g.debug("Could not set fixed bandwidth",c),c;}},BM=function(a){return{position:a.getPosition(),state:a.m.getState(),tg:a.getState(),playbackRate:a.getPlaybackRate(),isLive:a.isLive(),duration:a.getDuration(),isMuted:zM(a),volume:a.getVolume(),Tm:AM(a),ak:qM(a)}},DM=function(a){var b,c;return _.E(function(d){if(1==d.a)return _.x(d,CM(),2);if(3!=d.a)return b=new Promise(function(e){(new _.Vk(e)).da(5)}),
24
+ _.x(d,Promise.race([tM(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)})},JM=function(a,b,c){var d,e,f,g,h,l,m,n;return _.E(function(p){switch(p.a){case 1:a.l=_.Bp(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(EM)),f=c.currentPosition);
25
+ _.A(p,2);g=a.l[d].url;h=a.l[d].type;h!==_.Uc||g.includes(".mpd")||(l=new URL(g),l.searchParams.append("cl-ext",".mpd"),g=l.toString());webapis.avplay.open(g);e.nextBandwidth?(yM(a,e.nextBandwidth),a.o=!1):(a.o||xM(a,e),a.o=!0);vM(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)},tb:a.m.getNetworkEngine()};a.h=new EL(b.drm,m);return _.x(p,a.h.init(),4);case 4:return a.f||a.trigger(new _.L(FM)),
26
+ _.x(p,GM(a),6);case 6:a.f||a.trigger(new _.L(HM));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&&IM(a,b.muted),b.autoplay&&a.m.play()["catch"](function(q){a.g.debug("Autoplay failed",q)}));_.oh(p,0);break;case 2:throw n=_.C(p),a.g.debug("Error while attempting to load source."),n;}})},GM=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
+ wM(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)}}))})},KM=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=BM(a);a.f=!0;webapis.avplay.stop();webapis.avplay.close();return a.load(a.m.getConfiguration(),d).then(function(){var e=a.a.tg;a.f=!1;a.a=
28
+ null;return e===PL?a.pause():a.play()})}catch(e){return Promise.reject(e)}},AM=function(a){return a.f&&a.a?a.a.Tm:webapis.avplay.getTotalTrackInfo()},qM=function(a){return a.f&&a.a?a.a.ak:webapis.avplay.getCurrentStreamInfo()},dM=function(a,b,c){b=b.toUpperCase();b===fM&&LM(a,!0);var d=a.j[b];d&&(d.Ke.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,qg:0,Ke:new _.Vk(function(){return g(h,c,!0)})}),(l=a.j[h])&&3>l.qg?(!a.w&&++l.qg,l.Ke.da(a.w?.5:.25)):(a.g.debug("Could not set track after multiple attempts.Giving up..."),l&&l.Ke.stop(),a.j[h]=null,f())}}g(b,c)})},LM=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)}},IM=function(a,b){try{tizen.tvaudiocontrol.setMute(b)}catch(c){switch(c.name){case AL:a.g.warn("The application does not have the privilege to set mute.",BL);break;default:a.g.warn(xL,c)}}},zM=function(a){var b=null;try{b=tizen.tvaudiocontrol.isMute()}catch(c){switch(c.name){case AL:a.g.warn("The application doesn't have the privilege to get the mute state.",BL);break;default:a.g.warn(xL,c)}}return!!b},CM=function(){return new Promise(function(a,b){if(window.webapis)a();else{var c=document.createElement("script");
31
+ DL(c,"load",function(d){return a(d)});DL(c,_.re,function(d){return b(d)});c.src="$WEBAPIS/webapis/webapis.js";document.querySelector("head").appendChild(c)}})},MM=function(){_.Ul.call(this);this.a=new sM(this);this.f=new LL(this);this.configuration=this.B=_.$l();this.w=null;this.g=new _.K("clpp.tizen.Player");this.j=null;this.l=new $L;this.D=new _.ck;this.o=this.h=null;this.A=!1},NM=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())},OM=function(){},PM=function(){};
33
+ EL.prototype.init=function(){var a=this,b,c,d,e,f,g;return _.E(function(h){if(1==h.a){b=_.um[a.h.env]||null;if(!b)throw a.g.debug(_.ya,_.Pb+a.h.env+_.ba),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=_.wm(b,a.h.customData);(e=d[_.Rd])&&a.f.set(_.Rd,{Sd:e.licenseUrl||"",customData:c,Qf:!1});(f=d[_.Td])&&a.f.set(_.Td,{Sd:f.licenseUrl||"",customData:c,
34
+ Qf:!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(_.Rd))a.a=_.Rd;else if(a.f.get(_.Td))a.a=_.Td;else throw new _.P(_.Q,6,6001,"Configuration for the target system is missing.");return _.x(h,HL(a),2)}a.j=!0;_.y(h)})};EL.prototype.release=function(){var a=this;return _.E(function(b){a.j=!1;a.o=null;a.a=_.We;a.l=null;a.f=new Map;_.y(b)})};EL.prototype.getDrmInfo=function(){return this.o};
35
+ var JL={pi:"DeleteLicenseAfterUse",ri:"LicenseServer",hn:"GetChallenge",jn:"HttpHeader",nn:"UserAgent",dn:"Cookie",oi:"CustomData"};_.r=LL.prototype;_.r.initialize=function(){this.a.on(EM,this.Hg,this);this.a.on(QM,this.Gg,this);this.a.on(RM,this.Fg,this);this.a.on(FM,this.Mh,this);this.a.on(HM,this.Lh,this);this.a.on(SM,this.Ig,this)};_.r.release=function(){NL(this,_.jp);this.l=!1;this.o=-1;this.h=2};_.r.destroy=function(){this.release();this.a.off(EM,this.Hg);this.a.off(QM,this.Gg);this.a.off(RM,this.Fg);this.a.off(FM,this.Mh);this.a.off(HM,this.Lh);this.a.off(SM,this.Ig);this.m=this.a=null};
36
+ _.r.Hg=function(){this.g.debug("Buffering start. Player state: ",this.a.getState());this.h=this.a.B?1:2;NL(this,_.op)};_.r.Gg=function(a){this.g.debug("Buffering progress: "+a.percent+" %. Player state: ",ML(this.f))};_.r.Fg=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()===TM;if(!a&&b){NL(this,_.wp);return}}if(a=this.f!==_.vp)a=this.a.getState(),a=a===OL||a===PL;a&&QL(this)};
37
+ _.r.Mh=function(){this.g.debug("Preparing starts. AVPlay State: ",this.a.getState());this.a.getState()===UM?NL(this,_.vp):this.g.error("AVPlay prepares while state is not IDLE")};_.r.Lh=function(){this.g.debug("Preparing ends: AVPlay state:",this.a.getState())};_.r.Ig=function(){NL(this,_.qp)};_.r.getState=function(){return this.f};_.r=RL.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,TL(b),2);case 2:c.j=m.f;if(!b.j)return b.g.debug("Could not find manifest parser for source. Make sure parsers are registered."),m["return"]();d={configurationId:"",networkingEngine:b.m.getNetworkEngine(),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;_.oh(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;_.oh(m,4);break;case 6:h=_.C(m),b.g.error(h),b.a=null;case 4:if(!b.a||!SL(b.a)){m.F(0);break}b.h=UL(b);_.A(m,10);return _.x(m,b.h.open(),12);case 12:b.f=VL(b);l=b.m.getConfiguration();b.f.h=l.streaming;b.o=l.preferredTextLanguage;b.A=l.preferredTextRole;b.D=l.preferForcedSubtitles;
40
+ _.oh(m,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.Mj=function(a){this.g.debug(_.fA,a);this.w=!0;var b=_.XC(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.Lj=function(){this.g.debug("canSwitch_");this.w=!1;this.l&&(_.sE(this.f,this.l,!0,0),this.l=null)};_.r.U=function(){this.g.debug("onError_")};
41
+ _.r.Nj=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($L,_.U);_.r=$L.prototype;_.r.Bh=function(a){var b=a.eventid;a=a.data;switch(b){case VM:0<Object.keys(this.f).length||(this.g.debug("Loading track manager!"),this.load());b=webapis.avplay.getCurrentStreamInfo();0<b.length&&(b=+kM(this,b[0].extra_info).Bit_rate,b=oM(this,{bandwidth:b}))&&(this.w=b,aM(this,b));break;case WM:bM(this);break;default:this.g.debug("Event type: "+b+" data: "+a)}};_.r.Lf=function(a){a.detail.currentState===_.xp&&this.m.off(_.eg,this.Lf)};
43
+ _.r.initialize=function(a){var b=this;this.m=a;this.a=this.m.a;this.m.on(_.eg,function(c){b.A||(c=c.detail,c.currentState===_.xp&&(b.g.debug("Current state",c.currentState),b.A=!0,cM(b)))});this.a.on(XM,this.Bh,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(_.eg,this.Lf);this.m.on(_.eg,this.Lf,this);try{var a=AM(this.a);this.f=nM(this,a);var b=this.f[_.ik]||[];b.length&&(this.j=b[0].renditions[0]||null);bM(this)}catch(c){this.g.debug("Could not load track manager")}}};_.r.destroy=function(){this.a.off(XM,this.Bh);this.a=this.m=null};_.r.getVideoTracks=function(){return this.f[_.jk]||[]};_.r.getAudioTracks=function(){return this.f[_.ik]||[]};
45
+ _.r.ha=function(){return this.f[_.T]||[]};_.r.ma=function(){return rM(this,_.jk)};_.r.Oa=function(){return rM(this,_.ik)};_.r.Ga=function(){return rM(this,_.T)};_.r.cb=function(){return this.w};_.r.mb=function(){this.g.info(yL);return null};_.r.nb=function(){this.g.info(yL);return null};_.r.Ha=function(){var a=this.ma();return a?a.track:null};_.r.la=function(){var a=this.Oa();return a?a.track:null};_.r.ta=function(){var a=this.Ga();return a?a.track:null};
46
+ _.r.jb=function(a){var b=this;null===a?(a=this.ma(),KM(this.a,a.bandwidth,null).then(function(){bM(b)})):0<a.renditions.length&&this.Ya(a.renditions[0])};_.r.xa=function(a){a?gM(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?ZL(this.h,a.track):gM(this,a)):(this.g.debug("Disabling text tracks"),this.l=null,LM(this.a,!1),this.m.trigger(new _.L(_.Ol)))};
47
+ _.r.Ya=function(a){var b=this,c=this.ma();this.a.o||a.width!==c.width||a.height!==c.height||a.bandwidth!==c.bandwidth?(this.w=a,aM(this,a),KM(this.a,c.bandwidth,a.bandwidth).then(function(){bM(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){gM(this,a)};_.r.ib=function(a){this.h?ZL(this.h,a.track):gM(this,a)};
48
+ _.r.addTextTrack=function(){};_.r.pa=function(){return this.a.o};$L.prototype.isAbrEnabled=$L.prototype.pa;$L.prototype.addTextTrack=$L.prototype.addTextTrack;$L.prototype.setTextRendition=$L.prototype.ib;$L.prototype.setAudioRendition=$L.prototype.hb;$L.prototype.setVideoRendition=$L.prototype.Ya;$L.prototype.setTextTrack=$L.prototype.Ja;$L.prototype.setAudioTrack=$L.prototype.xa;$L.prototype.setVideoTrack=$L.prototype.jb;$L.prototype.getTextTrack=$L.prototype.ta;$L.prototype.getAudioTrack=$L.prototype.la;
49
+ $L.prototype.getVideoTrack=$L.prototype.Ha;$L.prototype.getLoadingTextRendition=$L.prototype.nb;$L.prototype.getLoadingAudioRendition=$L.prototype.mb;$L.prototype.getLoadingVideoRendition=$L.prototype.cb;$L.prototype.getTextRendition=$L.prototype.Ga;$L.prototype.getAudioRendition=$L.prototype.Oa;$L.prototype.getVideoRendition=$L.prototype.ma;$L.prototype.getTextTracks=$L.prototype.ha;$L.prototype.getAudioTracks=$L.prototype.getAudioTracks;$L.prototype.getVideoTracks=$L.prototype.getVideoTracks;_.w(sM,_.Ul);_.r=sM.prototype;_.r.Gj=function(){this.w=!0;this.f||this.trigger(new _.L(EM))};_.r.Fj=function(a){this.w=!0;this.trigger(new _.L(QM,{percent:a}))};_.r.Ej=function(){this.w=!1;this.trigger(new _.L(RM))};_.r.Jj=function(){this.trigger(new _.L(SM))};_.r.Ij=function(a,b){this.trigger(new _.L(XM,{eventid:a,data:b}))};_.r.Kj=function(a,b,c,d,e){this.trigger(new _.L(YM,{duration:a,text:b,subtitleType:c,attriCount:d,attributes:e}))};
50
+ _.r.Hj=function(a,b){this.trigger(new _.L(ZM,{drmType:a,drmData:b}));if(this.h){var c=this.h;if(c.j)if(c.a===_.Td&&"Challenge"===b.name)KL(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($M,{eventType:a}))};
51
+ _.r.play=function(){function a(){return new Promise(function(d,e){function f(){d();clearTimeout(g)}var g=null;b.one(uM,f,b);g=setTimeout(function(){b.off(uM,f);e("Timeout")},3E4)})}var b=this,c=this.getState();if(c===UM)return(new Promise(function(d,e){webapis.avplay.prepareAsync(function(){wM(b);d(webapis.avplay.play())},function(f){b.trigger(new _.L($M));e(f)})})).then(function(){return a()});if(c===PL||c===TM)try{return webapis.avplay.play(),a()}catch(d){return Promise.reject(d)}return c===OL?
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()===PL?Promise.resolve():Promise.reject()};
53
+ _.r.setPlaybackRate=function(a){var b=this.getState();if(b===TM||b===OL||b===PL){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,DM(c),4);case 4:return _.x(e,JM(c,a,b),5);case 5:_.oh(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.tg;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(_.Bg));webapis.avplay.seekTo(c,function(){b.B=!1;b.m.trigger(new _.L(_.Ag));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.Ke.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 AL:this.g.debug("The application does not have the privilege to get the volume.",BL);break;default:this.g.debug(xL,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 AL:this.g.warn("The application does not have the privilege to set the volume.",BL);break;default:this.g.warn("An unknown error occurred while trying to set volume",b)}}};
58
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=_.kc,tK="AUDIO",uK="TEXT",kL="PLAYER_MSG_RESOLUTION_CHANGED",jL="PLAYER_MSG_BITRATE_CHANGE",XJ={PLAYREADY:"PLAYREADY",Gm:"EME_PLAYREADY",Pm:"VERIMATRIX",Vd:"WIDEVINE_CDM",Hm:"EME_WIDEVINE_CDM",Rm:"WIDEVINE_CLASSIC"};_.w(aL,_.tl);_.r=aL.prototype;_.r.og=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.mg=function(a){this.trigger(new _.L(_.eg,{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.lh=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,_.So);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.og,this);this.a.on(JK,this.mg,this);this.a.on(mL,this.pg,this);this.a.on(nL,this.ng,this);this.a.on(oL,this.U,this);this.a.on(fL,this.lh,this);this.f.initialize();this.l.initialize(this);this.g.debug("Initializing player surface");this.w.hideMediaElement();var c=pL;pL+=1;this.j=_.qp(_.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,_.re,"position",_.ye,"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];_.sp(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.og);a.a.off(JK,a.mg);a.a.off(mL,a.pg);a.a.off(nL,a.ng);a.a.off(oL,a.U);a.a.off(fL,a.lh);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()===_.Oo?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()})};
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=_.vo(b.configuration,[_.te,"native"]);b.o=c.create(b);d=_.Zo(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,_.So),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()===_.Oo};_.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.C};_.r.setNetworkEngine=function(a){this.C=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,_.Ir);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";};
59
+ var UM="IDLE",TM="READY",OL="PLAYING",PL="PAUSED",lM=_.nc,eM="AUDIO",fM="TEXT",WM="PLAYER_MSG_RESOLUTION_CHANGED",VM="PLAYER_MSG_BITRATE_CHANGE",IL={PLAYREADY:"PLAYREADY",en:"EME_PLAYREADY",pn:"VERIMATRIX",fe:"WIDEVINE_CDM",fn:"EME_WIDEVINE_CDM",rn:"WIDEVINE_CLASSIC"};_.w(MM,_.Ul);_.r=MM.prototype;_.r.Dg=function(){var a=this;this.g.debug("On Stream completed. Current time: ",this.getPosition());this.trigger(new _.L(_.qe));this.configuration.loop?this.seek(this.configuration.startTime||0)["catch"](function(){a.g.debug("Could not loop playback")}):this.a.stop()};_.r.Bg=function(a){this.trigger(new _.L(_.rg,{currentTime:a.currentTime/1E3}))};
60
+ _.r.Eg=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.ag(d))&&this.o.append([new _.ri(b,c,d)],[])};_.r.Cg=function(a){this.g.debug("DRM event: "+a.drmType+", data: "+a.drmData)};_.r.Dh=function(){this.A||(this.g.debug("Initial buffering completed..."),this.A=!0)};
61
+ _.r.U=function(a){this.g.debug("Error: TYPE: "+a.eventType);NL(this.f,_.up);a=new _.P(_.Q,7,7200,{tizenerror:a.eventType});this.a.release();this.trigger(new _.L(_.re,{detail:a}))};
62
+ _.r.init=function(a,b){this.configuration=this.B=b;this.w=a;this.a.on(SM,this.Dg,this);this.a.on(uM,this.Bg,this);this.a.on(YM,this.Eg,this);this.a.on(ZM,this.Cg,this);this.a.on($M,this.U,this);this.a.on(RM,this.Dh,this);this.f.initialize();this.l.initialize(this);this.g.debug("Initializing player surface");this.w.hideMediaElement();var c=aN;aN+=1;this.j=_.Up(_.Xe,{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=[_.Ug,_.ve,"position",_.Ce,"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=_.t(e);for(e=g.next();!e.done;e=g.next())e=e.value,f[e]=d[e];_.Wp(c,f);NM(this)}};_.r.getSurface=function(){return this.w};_.r.getConfiguration=function(){return this.configuration};_.r.getTimeline=function(){return null};_.r.setupPlaylist=function(){return Promise.reject(_.Gb)};_.r.appendLoad=function(){return Promise.reject(_.Gb)};
64
+ _.r.seekWith=function(){return Promise.reject(_.Gb)};_.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(SM,a.Dg);a.a.off(uM,a.Bg);a.a.off(YM,a.Eg);a.a.off(ZM,a.Cg);a.a.off($M,a.U);a.a.off(RM,a.Dh);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 bN};
65
+ _.r.getPlaybackRate=function(){return this.a.getPlaybackRate()};_.r.setDrmCustomDataModifier=function(){};_.r.setCdnErrorCallback=function(){};_.r.detach=function(){};_.r.setPlaybackRate=function(a){this.a.setPlaybackRate(a)};_.r.getPosition=function(){return this.getMediaPosition()};_.r.getMediaPosition=function(){return 0<(this.configuration.startTime||0)&&!this.A?0:this.f.getState()===_.qp?this.getDuration():this.a.getPosition()||0};
66
+ _.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};_.r.getSeekRange=function(){return{start:0,end:0}};_.r.getVolume=function(){var a=this.a.getVolume();return typeof a===_.k?a/100:null};_.r.setVolume=function(a){this.a.setVolume(a)};_.r.getDuration=function(){return this.getMediaDuration()};_.r.getMediaDuration=function(){return this.a.getDuration()};
67
+ _.r.getBufferInfo=function(){this.g.warn(_.ua);return new _.Tl};_.r.getTrackManager=function(){return this.l};_.r.unload=function(){var a=this;return this.a.release().then(function(){a.l.release()})};_.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:b.configuration=_.bm(b.B,a);c=_.Yo(b.configuration,[_.xe,"native"]);b.o=c.create(b);d=_.Bp(b.configuration)[0];e=!!b.configuration.tizen&&b.configuration.tizen.sideStreamText;if(!e){h.F(2);break}b.h=new RL;b.h.initialize(b);_.A(h,3);return _.x(h,b.h.load(d),5);case 5:b.h.start();_.oh(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:_.oh(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(_.lf));NM(this);return this.a.play().then(function(){QL(a.f)})};_.r.pause=function(){var a=this;return this.a.pause().then(function(){QL(a.f)})};_.r.getState=function(){return this.f.getState()};_.r.getPeriods=function(){return[]};_.r.onError=function(a){var b=new _.L(_.re,{detail:a});a.severity===_.Q&&(NL(this.f,_.up),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()===_.qp};_.r.isPaused=function(){return this.a.getState()===PL};_.r.isMuted=function(){return zM(this.a)};_.r.setMuted=function(a){IM(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 OM).canPlay(a,b)};_.r.getTimelineCues=function(){return[]};_.r.getTextDisplayer=function(){return this.o};_.r.resetAbr=function(){};MM.prototype.getTextDisplayer=MM.prototype.getTextDisplayer;MM.prototype.setNetworkEngine=MM.prototype.setNetworkEngine;MM.prototype.getNetworkEngine=MM.prototype.getNetworkEngine;var bN="clpp.tizen",aN=0;OM.prototype.a=function(){return bN};
72
+ OM.prototype.canPlay=function(a){a=a.type;var b=!!window.webapis;if((a===_.Uc||a===_.El||a===_.$c)&&b){if(_.Vj(2))return 2;if(_.Vj(3)||_.Vj(4)||_.Vj(5)||_.Vj(6))return _.J("Use of clpp.tizen.TizenComponent is not recommended for Tizen version \x3e\x3d 3."),1}return 0};OM.prototype.f=function(a){return a===_.pa};OM.prototype.create=function(){return new MM};_.w(PM,_.Cs);PM.prototype.f=function(){_.Nh(new OM)};PM.prototype.a=function(){var a=bN;a&&_.Kh[a]&&(delete _.Kh[a],_.Mh.info("Removed Player factory: '"+a+"'"))};PM.prototype.id=function(){return"tizen"};_.H("clpp.tizen.TizenComponent",PM);var EM="onbufferingstart",QM="onbufferingprogress",RM="onbufferingcomplete",SM="onstreamcompleted",uM="oncurrentplaytime",XM="onevent",YM="onsubtitlechange",ZM="ondrmevent",$M="onerror",FM="preparingstart",HM="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 Sv='application/mp4; codecs\x3d"stpp.ttml"',Tv='application/mp4; codecs\x3d"stpp.ttml.im1i"',Uv='application/mp4; codecs\x3d"stpp.ttml.im1t"',Vv="backgroundColor",Wv="direction",Xv="displayAlign",Yv="region",Zv="sans-serif",$v="textAlign",aw="textDecoration",bw="writingMode",cw=function(a,b,c){this.h=a;this.f=b;this.a=c},dw=function(a,b,c){cw.call(this,a,[],c);this.j=b||""},ew=function(a,b,c){cw.call(this,a,b,c)},fw=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},nw=function(a,b){var c=null;if(gw.test(a)){c=gw.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 hw.test(a)?c=iw(hw,a):jw.test(a)?c=iw(jw,a):kw.test(a)?(c=kw.exec(a),c=Number(c[1])/b.frameRate):lw.test(a)?(c=lw.exec(a),c=Number(c[1])/b.a):mw.test(a)&&(c=iw(mw,a));return c},iw=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)},ow=function(a){return a.split(":").pop()},pw=function(a){return a.replace(/(\d*\.?\d+)c/g,"$1em")},rw=function(a,b){for(;qw.test(a);){var c=qw.exec(a)[0];a=a.replace(c,parseInt(c,10)/b+"em")}return a},sw=function(a){return a?a.replace(/(\d*\.?\d+)%/g,function(b,c){return c/100+"em"}):""},tw=function(a,b,c,d,e,f,g){cw.call(this,a,f,g);this.w=b;this.A=c;this.o=d;this.l=e;this.j=[]},uw=function(a,b,c){a=fw(a,b,$v);if(!a&&c&&(a=fw(c,b,$v),!a&&"rltb"===fw(c,
5
- b,bw)))return _.Kf;switch(a){case _.sd:return _.Zh;case _.Kf:case _.le:return _.Kf;default:return _.ye}},vw=function(a,b,c){if(_.R.ue(a.w))return document.createTextNode(_.R.Pf(a.w||""));if(a.A)return _.qp("br");for(var d=_.qp("span"),e=_.u(a.f),f=e.next();!f.done;f=e.next())_.rp(d,f.value);a=_.u(a.j);for(e=a.next();!e.done;e=a.next())d.appendChild(vw(c.get(e.value),b,c));return d},ww=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]))},xw=function(a,b,c){cw.call(this,a,b,c)},Aw=function(a,b,c,d){var e=yw.exec(a);a=zw.exec(a);return typeof b===_.k&&0<b&&a?100*Number(a[c])/b:e?Number(e[c]):a?Number(a[c]):d},Bw=function(a,b){return typeof b===_.k&&0<b?_.ei:zw.test(a)?0:_.ei},Cw=function(a,b){cw.call(this,"root-container",[],b);this.j=a},Dw=function(a,b,c){return typeof a===_.k?a:typeof b===_.k?b:c},Ew=function(a,b){var c=a.getAttribute("extent");
7
- return(c=zw.exec(c))?Number(c[b]):null},Gw=function(a){a=a.getAttribute("cellResolution");return(a=Fw.exec(a))?Number(a[2]):null},Hw=function(a,b,c){cw.call(this,a,b,c)},Iw=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=[]},Kw=function(a){return Jw.some(function(b){return b in a.attributes})},Lw=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(Lw(a,
8
- a.a.get(e).f)).concat([e]));return c},Nw=function(){return"inline-"+Mw++},Ow=function(a){this.a=a.firstChild;this.f=new Set},Pw=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},Qw=function(a){return ow(a.h.nodeName)},Rw=function(){this.a=new Map},Tw=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={},Sw.forEach(function(n){n in l.attributes&&(g[n]=l.attributes[n])}))}if(b.nodeType===b.ELEMENT_NODE){b.hasAttribute(Yv)&&(c=b.getAttribute(Yv));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=ow(h);g[m]=b.getAttribute(h)}d=g.backgroundImage}c=new Pw(b,c,d,e,f,g);a.a.set(b,c);return c},Uw=function(a){this.a=a;this.f=new DOMParser},Vw=function(a){this.f=
10
- a},Ww=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")},Xw=function(){},Yw=function(a){this.a=new Uw(a);this.g=new _.K("clpp.ttml.Mp4TtmlParser")},Zw=function(){this.j=new Xw};cw.prototype.getId=function(){return this.h};cw.prototype.getAttribute=function(a){return this.a[a]};_.w(dw,cw);_.w(ew,cw);var gw=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,hw=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,jw=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d+)$/,kw=/^(\d*(?:\.\d*)?)f$/,lw=/^(\d*(?:\.\d*)?)t$/,mw=/^(?:(\d*(?:\.\d*)?)h)?(?:(\d*(?:\.\d*)?)m)?(?:(\d*(?:\.\d*)?)s)?(?:(\d*(?:\.\d*)?)ms)?$/,yw=/^(\d{1,2}(?:\.\d+)?|100(?:\.0+)?)% (\d{1,2}(?:\.\d+)?|100(?:\.0+)?)%$/,zw=/^(\d+)px (\d+)px$/,Fw=/^(\d+) (\d+)$/,qw=/(\d+)px/,$w=/^(\d+px|\d+em|\d*\.?\d+c)$/,Jw=[Vv,"color",Wv,Xv,"fontFamily","fontSize","fontStyle","fontWeight",
11
- "lineHeight","opacity","padding",$v,aw,"textOutline",bw,"zIndex"],Sw=["begin",_.le];_.w(tw,ew);
12
- tw.prototype.build=function(a,b,c,d,e,f,g){var h=nw(this.a.begin,b);b=nw(this.a.end,b);if(null===h||null===b)return null;h+=c;b+=c;c=_.qp(_.Yd);for(var l=_.u(this.j),m=l.next();!m.done;m=l.next())c.appendChild(vw(g.get(m.value),e,g));g=new _.di(h,b,c.innerHTML.trim(),_.gg);g.cssClassList=_.Og(this.f).concat();g.textAlign=uw(this,e,null);g.writingMode=_.$h;g.line=-1;g.lineInterpretation=_.ai;g.lineAlign=_.bi;g.containerRows=Dw(null,Gw(a),15);if(this.o&&(f=f.get(this.o))){g.region=f.build(a,e);g.textAlign=
13
- uw(this,e,f);a:switch(fw(f,e,bw)){case "tb":case "tblr":a=_.qg;break a;case "tbrl":a=_.rg;break a;default:a=_.$h}g.writingMode=a;a:switch(fw(f,e,Xv)){case _.sd:a=50;break a;case "after":a=-1;break a;default:a=0}g.line=a;a:switch(fw(f,e,Xv)){case _.sd:a=1;break a;default:a=_.ai}g.lineInterpretation=a;a:switch(fw(f,e,Xv)){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(xw,ew);
15
- xw.prototype.build=function(a,b){var c=new _.gi;c.id=this.getId();var d=Dw(a.j.containerWidth,Ew(a,1),720),e=Dw(a.j.containerHeight,Ew(a,2),480);a:switch(fw(this,b,Xv)){case "after":var f="flex-start";break a;case _.sd:f=_.sd;break a;default:f="flex-end"}c.displayAlign=f;a:switch(fw(this,b,bw)){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")||fw(this,b,"extent");c.width=Aw(f,d,1,100);c.widthUnits=Bw(f,d);c.height=
16
- Aw(f,e,2,100);c.heightUnits=Bw(f,e);f=this.getAttribute("origin")||fw(this,b,"origin");c.viewportAnchorX=Aw(f,d,1,0);c.viewportAnchorY=Aw(f,e,2,0);c.viewportAnchorUnits=Bw(f,d);c.cssClassList=_.Og(this.f).concat();return c};_.w(Cw,cw);_.w(Hw,cw);
17
- Hw.prototype.build=function(a){var b=null;var c=Gw(a);c&&(b=Dw(a.j.containerHeight,Ew(a,2),480)/c);b=Dw(a.j.fontSizeRadix,b,16);a=[];c="::ttml ."+this.h+", ::ttml ."+this.h+" * {";for(var d=_.u(ax.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+":"+pw(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&&!$w.test(g)&&$w.test(h)&&$w.test(l)?(e=g,f=h):2===d.length&&!$w.test(g)&&$w.test(h)?(e=g,f=h):2===d.length&&$w.test(g)&&$w.test(h)&&(f=g);if(""!==f){f=pw(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=sw(this.a.textShadow),d=pw(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",Zv).replace("proportionalSerif",Zv).replace("sansSerif",Zv).replace("default",Zv)+";":"");a:{if(aw 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:"+pw(this.a.padding)+";":"";c=c+d+e;"lineHeight"in this.a?(d="",e=this.a.lineHeight,e=pw(e),e=rw(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=pw(d);d=rw(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 ax=new Map([[Vv,"background-color"],["color","color"],[Wv,Wv],["fontStyle","font-style"],["fontWeight","font-weight"],["opacity","opacity"],["zIndex","z-index"]]);Iw.prototype.zd=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 Mw=0;Ow.prototype.Vc=function(){return!!this.a};Ow.prototype.next=function(){if(!this.a)return null;var a=this.a;do this.f.add(a),a.nodeType!==Node.TEXT_NODE&&!bx.has(ow(a.nodeName))||cx.has(ow(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&&!bx.has(ow(a.nodeName))));var b=this.a;this.a=a;return b};
22
- var bx=new Set(["tt","head","layout",_.Le,_.ue,Yv,"styling",_.Yf,"body",_.Yd,"p","span","br"]),cx=new Set([_.Yf,_.ue]);Pw.prototype.getId=function(){return this.attributes.id};Uw.prototype.parseInit=function(){};
23
- Uw.prototype.parseMedia=function(a,b,c){c&&c.length||(c=[a.byteLength]);var d=_.N.Oa(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 Iw(d);e=new Rw;f=new Ow(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 dw(m,l,{imageType:"PNG",encoding:"Base64"}));
24
- b+=h}for(;f.Vc();)a=f.next(),a=Tw(e,a),"tt"===Qw(a)&&(d.l=new Cw(d.B,Object.assign({},a.attributes))),"tt"===Qw(a)&&(d.w=new ww(a.attributes.frameRate,a.attributes.subFrameRate,a.attributes.frameRateMultiplier,a.attributes.tickRate)),Qw(a)!==_.ue||a.attributes.begin||a.attributes.end||(c="#"+a.getId(),d.h.set(c,new dw(c,a.h.textContent,a.attributes))),Qw(a)===_.ue&&a.attributes.begin&&a.attributes.end?(c="#"+Nw(),b=new dw(c,a.h.textContent,a.attributes),d.h.set(c,b),c=b):c=null,c&&(a.j=c.getId()),
25
- Qw(a)===_.Yf&&(c=a.getId()||Nw(),b=new Hw(c,a.f,Object.assign({},a.attributes)),d.a.set(c,b),a.a&&d.j.get(a.a).f.push(c)),Qw(a)!==_.Yf&&Kw(a)?(c=Nw(),b=new Hw(c,[],Object.assign({},a.attributes)),d.a.set(c,b),c=b):c=null,c&&a.f.push(c.getId()),Qw(a)!==_.Yd||!a.attributes.extent&&!a.attributes.origin?c=null:(c=Nw(),b=new xw(c,Lw(d,a.f),Object.assign({},a.attributes)),d.j.set(c,b),c=b),c&&(a.a=c.getId()),Qw(a)!==Yv?c=null:(c=a.getId(),b=new xw(c,Lw(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(Qw(a))||0===c.length?c=null:(g=c[c.length-1],d.f.has(g)?(c=Nw(),b=new tw(c,"#text"===a.h.nodeName?a.h.textContent:null,"br"===Qw(a),a.a,a.j,Lw(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"===Qw(a)||a.j?(c=Nw(),b=new tw(c,null,!1,a.a,a.j,Lw(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.zd();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}};Vw.prototype.a=function(a){a=(new Uw(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=Ww(c.startTime)+" --\x3e "+Ww(c.endTime),e=[];switch(c.textAlign){case _.ye:e.push("align:left");break;case _.Kf:e.push("align:right");break;case _.Zh:e.push("align:middle");break;case _.ye: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)};Xw.prototype.probe=function(a,b){return a===_.Xc&&b===_.cg};Xw.prototype.create=function(a){return new Vw(a)};Yw.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
- Yw.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(Zw,_.Ir);Zw.prototype.f=function(){_.ft[_.Xc]=Uw;_.ft[_.Vc]=Yw;_.ft[Sv]=Yw;_.ft[Uv]=Yw;_.ft[Tv]=Yw;_.ok.push(this.j)};Zw.prototype.a=function(){_.gt(_.Xc);_.gt(_.Vc);_.gt(Sv);_.gt(Uv);_.gt(Tv);_.qk(this.j)};Zw.prototype.id=function(){return"subtitles-ttml"};_.H("clpp.ttml.TtmlComponent",Zw);};
2
+ var f=function(window){var Qw='application/mp4; codecs\x3d"stpp.ttml"',Rw='application/mp4; codecs\x3d"stpp.ttml.im1i"',Sw='application/mp4; codecs\x3d"stpp.ttml.im1t"',Tw="backgroundColor",Uw="direction",Vw="displayAlign",Ww="region",Xw="sans-serif",Yw="textAlign",Zw="textDecoration",$w="writingMode",ax=function(a,b,c){this.h=a;this.f=b;this.a=c},bx=function(a,b,c){ax.call(this,a,[],c);this.j=b||""},cx=function(a,b,c){ax.call(this,a,b,c)},dx=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},lx=function(a,b){var c=null;if(ex.test(a)){c=ex.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 fx.test(a)?c=gx(fx,a):hx.test(a)?c=gx(hx,a):ix.test(a)?(c=ix.exec(a),c=Number(c[1])/b.frameRate):jx.test(a)?(c=jx.exec(a),c=Number(c[1])/b.a):kx.test(a)&&(c=gx(kx,a));return c},gx=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)},mx=function(a){return a.split(":").pop()},nx=function(a){return a.replace(/(\d*\.?\d+)c/g,"$1em")},px=function(a,b){for(;ox.test(a);){var c=ox.exec(a)[0];a=a.replace(c,parseInt(c,10)/b+"em")}return a},qx=function(a){return a?a.replace(/(\d*\.?\d+)%/g,function(b,c){return c/100+"em"}):""},rx=function(a,b,c,d,e,f,g){ax.call(this,a,f,g);this.w=b;this.A=c;this.o=d;this.l=e;this.j=[]},sx=function(a,b,c){a=dx(a,b,Yw);if(!a&&c&&(a=dx(c,b,Yw),!a&&"rltb"===dx(c,
5
+ b,$w)))return _.Sf;switch(a){case _.ud:return _.mi;case _.Sf:case _.pe:return _.Sf;default:return _.Ce}},tx=function(a,b,c){if(_.R.Ae(a.w))return document.createTextNode(_.R.ag(a.w||""));if(a.A)return _.Up("br");for(var d=_.Up("span"),e=_.t(a.f),f=e.next();!f.done;f=e.next())_.Vp(d,f.value);a=_.t(a.j);for(e=a.next();!e.done;e=a.next())d.appendChild(tx(c.get(e.value),b,c));return d},ux=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]))},vx=function(a,b,c){ax.call(this,a,b,c)},yx=function(a,b,c,d){var e=wx.exec(a);a=xx.exec(a);return typeof b===_.k&&0<b&&a?100*Number(a[c])/b:e?Number(e[c]):a?Number(a[c]):d},zx=function(a,b){return typeof b===_.k&&0<b?_.si:xx.test(a)?0:_.si},Ax=function(a,b){ax.call(this,"root-container",[],b);this.j=a},Bx=function(a,b,c){return typeof a===_.k?a:typeof b===_.k?b:c},Cx=function(a,b){var c=a.getAttribute("extent");
7
+ return(c=xx.exec(c))?Number(c[b]):null},Ex=function(a){a=a.getAttribute("cellResolution");return(a=Dx.exec(a))?Number(a[2]):null},Fx=function(a,b,c){ax.call(this,a,b,c)},Gx=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=[]},Ix=function(a){return Hx.some(function(b){return b in a.attributes})},Jx=function(a,b){if(0===b.length)return[];for(var c=[],d=_.t(b),e=d.next();!e.done;e=d.next())e=e.value,a.a.has(e)&&c.push.apply(c,_.ah(Jx(a,
8
+ a.a.get(e).f)).concat([e]));return c},Lx=function(){return"inline-"+Kx++},Mx=function(a){this.a=a.firstChild;this.f=new Set},Nx=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},Ox=function(a){return mx(a.h.nodeName)},Px=function(){this.a=new Map},Rx=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=_.ah(l.l).concat();-1===["#text","span","br"].indexOf(b.nodeName)&&(c=l.a,d=l.j,f=_.ah(l.f).concat(),
9
+ g={},Qx.forEach(function(n){n in l.attributes&&(g[n]=l.attributes[n])}))}if(b.nodeType===b.ELEMENT_NODE){b.hasAttribute(Ww)&&(c=b.getAttribute(Ww));b.hasAttribute(_.jg)&&f.push.apply(f,_.ah(b.getAttribute(_.jg).split(" ")));d=Array.from(b.attributes).map(function(n){return n.name});d=_.t(d);for(h=d.next();!h.done;h=d.next()){h=h.value;var m=mx(h);g[m]=b.getAttribute(h)}d=g.backgroundImage}c=new Nx(b,c,d,e,f,g);a.a.set(b,c);return c},Sx=function(a){this.a=a;this.f=new DOMParser},Tx=function(a){this.f=
10
+ a},Ux=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")},Vx=function(){},Wx=function(a){this.a=new Sx(a);this.g=new _.K("clpp.ttml.Mp4TtmlParser")},Xx=function(){this.j=new Vx};ax.prototype.getId=function(){return this.h};ax.prototype.getAttribute=function(a){return this.a[a]};_.w(bx,ax);_.w(cx,ax);var ex=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,fx=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,hx=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d+)$/,ix=/^(\d*(?:\.\d*)?)f$/,jx=/^(\d*(?:\.\d*)?)t$/,kx=/^(?:(\d*(?:\.\d*)?)h)?(?:(\d*(?:\.\d*)?)m)?(?:(\d*(?:\.\d*)?)s)?(?:(\d*(?:\.\d*)?)ms)?$/,wx=/^(\d{1,2}(?:\.\d+)?|100(?:\.0+)?)% (\d{1,2}(?:\.\d+)?|100(?:\.0+)?)%$/,xx=/^(\d+)px (\d+)px$/,Dx=/^(\d+) (\d+)$/,ox=/(\d+)px/,Yx=/^(\d+px|\d+em|\d*\.?\d+c)$/,Hx=[Tw,"color",Uw,Vw,"fontFamily","fontSize","fontStyle","fontWeight",
11
+ "lineHeight","opacity","padding",Yw,Zw,"textOutline",$w,"zIndex"],Qx=["begin",_.pe];_.w(rx,cx);
12
+ rx.prototype.build=function(a,b,c,d,e,f,g){var h=lx(this.a.begin,b);b=lx(this.a.end,b);if(null===h||null===b)return null;h+=c;b+=c;c=_.Up(_.ae);for(var l=_.t(this.j),m=l.next();!m.done;m=l.next())c.appendChild(tx(g.get(m.value),e,g));g=new _.ri(h,b,c.innerHTML.trim(),_.ug);g.cssClassList=_.ah(this.f).concat();g.textAlign=sx(this,e,null);g.writingMode=_.ni;g.line=-1;g.lineInterpretation=_.oi;g.lineAlign=_.pi;g.containerRows=Bx(null,Ex(a),15);if(this.o&&(f=f.get(this.o))){g.region=f.build(a,e);g.textAlign=
13
+ sx(this,e,f);a:switch(dx(f,e,$w)){case "tb":case "tblr":a=_.Dg;break a;case "tbrl":a=_.Eg;break a;default:a=_.ni}g.writingMode=a;a:switch(dx(f,e,Vw)){case _.ud:a=50;break a;case "after":a=-1;break a;default:a=0}g.line=a;a:switch(dx(f,e,Vw)){case _.ud:a=1;break a;default:a=_.oi}g.lineInterpretation=a;a:switch(dx(f,e,Vw)){case _.ud:e=_.ud;break a;default:e=_.pi}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(vx,cx);
15
+ vx.prototype.build=function(a,b){var c=new _.ui;c.id=this.getId();var d=Bx(a.j.containerWidth,Cx(a,1),720),e=Bx(a.j.containerHeight,Cx(a,2),480);a:switch(dx(this,b,Vw)){case "after":var f="flex-start";break a;case _.ud:f=_.ud;break a;default:f="flex-end"}c.displayAlign=f;a:switch(dx(this,b,$w)){case "tb":case "tblr":f="row-reverse";break a;case "tbrl":f="row";break a;default:f=_.Nd}c.writingMode=f;f=this.getAttribute("extent")||dx(this,b,"extent");c.width=yx(f,d,1,100);c.widthUnits=zx(f,d);c.height=
16
+ yx(f,e,2,100);c.heightUnits=zx(f,e);f=this.getAttribute("origin")||dx(this,b,"origin");c.viewportAnchorX=yx(f,d,1,0);c.viewportAnchorY=yx(f,e,2,0);c.viewportAnchorUnits=zx(f,d);c.cssClassList=_.ah(this.f).concat();return c};_.w(Ax,ax);_.w(Fx,ax);
17
+ Fx.prototype.build=function(a){var b=null;var c=Ex(a);c&&(b=Bx(a.j.containerHeight,Cx(a,2),480)/c);b=Bx(a.j.fontSizeRadix,b,16);a=[];c="::ttml ."+this.h+", ::ttml ."+this.h+" * {";for(var d=_.t(Zx.entries()),e=d.next();!e.done;e=d.next()){var f=_.t(e.value);e=f.next().value;f=f.next().value;e in this.a&&(c+=f+":"+nx(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&&!Yx.test(g)&&Yx.test(h)&&Yx.test(l)?(e=g,f=h):2===d.length&&!Yx.test(g)&&Yx.test(h)?(e=g,f=h):2===d.length&&Yx.test(g)&&Yx.test(h)&&(f=g);if(""!==f){f=nx(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=qx(this.a.textShadow),d=nx(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",Xw).replace("proportionalSerif",Xw).replace("sansSerif",Xw).replace("default",Xw)+";":"");a:{if(Zw in this.a){d=[];e=_.t(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:"+nx(this.a.padding)+";":"";c=c+d+e;"lineHeight"in this.a?(d="",e=this.a.lineHeight,e=nx(e),e=px(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=nx(d);d=px(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 Zx=new Map([[Tw,"background-color"],["color","color"],[Uw,Uw],["fontStyle","font-style"],["fontWeight","font-weight"],["opacity","opacity"],["zIndex","z-index"]]);Gx.prototype.Cd=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 Kx=0;Mx.prototype.Xc=function(){return!!this.a};Mx.prototype.next=function(){if(!this.a)return null;var a=this.a;do this.f.add(a),a.nodeType!==Node.TEXT_NODE&&!$x.has(mx(a.nodeName))||ay.has(mx(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&&!$x.has(mx(a.nodeName))));var b=this.a;this.a=a;return b};
22
+ var $x=new Set(["tt","head","layout",_.Qe,_.ye,Ww,"styling",_.jg,"body",_.ae,"p","span","br"]),ay=new Set([_.jg,_.ye]);Nx.prototype.getId=function(){return this.attributes.id};Sx.prototype.parseInit=function(){};
23
+ Sx.prototype.parseMedia=function(a,b,c){c&&c.length||(c=[a.byteLength]);var d=_.O.Ma(this.a.ttml||{}),e=_.lj(a,0,c[0]);e=_.R.aa(e);if(""===e)return{cues:[],styles:[]};var f=null;try{f=this.f.parseFromString(e,_.og)}catch(n){throw new _.P(_.Q,2,2005,"Failed to parse TTML.");}d=new Gx(d);e=new Px;f=new Mx(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=_.lj(a,b,h);l=_.vj(l);var m="urn:mpeg:14496-30:subs:"+g;d.h.set(m,new bx(m,l,{imageType:"PNG",encoding:"Base64"}));
24
+ b+=h}for(;f.Xc();)a=f.next(),a=Rx(e,a),"tt"===Ox(a)&&(d.l=new Ax(d.B,Object.assign({},a.attributes))),"tt"===Ox(a)&&(d.w=new ux(a.attributes.frameRate,a.attributes.subFrameRate,a.attributes.frameRateMultiplier,a.attributes.tickRate)),Ox(a)!==_.ye||a.attributes.begin||a.attributes.end||(c="#"+a.getId(),d.h.set(c,new bx(c,a.h.textContent,a.attributes))),Ox(a)===_.ye&&a.attributes.begin&&a.attributes.end?(c="#"+Lx(),b=new bx(c,a.h.textContent,a.attributes),d.h.set(c,b),c=b):c=null,c&&(a.j=c.getId()),
25
+ Ox(a)===_.jg&&(c=a.getId()||Lx(),b=new Fx(c,a.f,Object.assign({},a.attributes)),d.a.set(c,b),a.a&&d.j.get(a.a).f.push(c)),Ox(a)!==_.jg&&Ix(a)?(c=Lx(),b=new Fx(c,[],Object.assign({},a.attributes)),d.a.set(c,b),c=b):c=null,c&&a.f.push(c.getId()),Ox(a)!==_.ae||!a.attributes.extent&&!a.attributes.origin?c=null:(c=Lx(),b=new vx(c,Jx(d,a.f),Object.assign({},a.attributes)),d.j.set(c,b),c=b),c&&(a.a=c.getId()),Ox(a)!==Ww?c=null:(c=a.getId(),b=new vx(c,Jx(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(Ox(a))||0===c.length?c=null:(g=c[c.length-1],d.f.has(g)?(c=Lx(),b=new rx(c,"#text"===a.h.nodeName?a.h.textContent:null,"br"===Ox(a),a.a,a.j,Jx(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"===Ox(a)||a.j?(c=Lx(),b=new rx(c,null,!1,a.a,a.j,Jx(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.Cd();f=[];a=_.t(d.a.values());for(c=a.next();!c.done;c=
27
+ a.next())f.push.apply(f,_.ah(c.value.build(d.l)));return{cues:e,styles:f}};Tx.prototype.a=function(a){a=(new Sx(this.f)).parseMedia(a,{periodStart:0,segmentStart:null,segmentEnd:0}).cues;var b="WEBVTT\n\n";a=_.t(a);for(var c=a.next();!c.done;c=a.next()){c=c.value;var d=Ux(c.startTime)+" --\x3e "+Ux(c.endTime),e=[];switch(c.textAlign){case _.Ce:e.push("align:left");break;case _.Sf:e.push("align:right");break;case _.mi:e.push("align:middle");break;case _.Ce:e.push("align:start");break;case _.Sf:e.push("align:end")}switch(c.writingMode){case _.Dg:e.push("vertical:lr");break;
28
+ case _.Eg:e.push("vertical:rl")}b+=d+(e.length?" "+e.join(" "):"")+"\n";b+=c.payload+"\n\n"}return _.R.Ua(b)};Vx.prototype.probe=function(a,b){return a===_.Zc&&b===_.ng};Vx.prototype.create=function(a){return new Tx(a)};Wx.prototype.parseInit=function(a){var b=!1;(new _.Pm).M(_.Te,_.Qm).M(_.sg,_.Qm).M(_.Oe,_.Qm).M(_.Se,_.Qm).M(_.gg,_.Qm).Y(_.ig,_.Rm).M("stpp",function(c){b=!0;c.parser.stop()}).parse(a);if(!b)throw new _.P(_.Q,2,2007);};
29
+ Wx.prototype.parseMedia=function(a,b){var c=this,d=!1,e=[],f=[],g=[];(new _.Pm).M("moof",_.Qm).M("traf",_.Qm).Y("subs",function(h){for(var l=_.W(h.reader),m=0;m<l;++m){h.reader.skip(4);for(var n=_.Im(h.reader),p=0;p<n;++p){var q=1===h.version?_.W(h.reader):_.Im(h.reader);g.push(q);h.reader.skip(6)}}}).M(_.Ne,_.Sm(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(Xx,_.Cs);Xx.prototype.f=function(){_.ru(_.Zc,Sx);_.ru(_.Xc,Wx);_.ru(Qw,Wx);_.ru(Sw,Wx);_.ru(Rw,Wx);_.Hk.push(this.j)};Xx.prototype.a=function(){_.tu(_.Zc);_.tu(_.Xc);_.tu(Qw);_.tu(Sw);_.tu(Rw);_.Jk(this.j)};Xx.prototype.id=function(){return"subtitles-ttml"};_.H("clpp.ttml.TtmlComponent",Xx);};
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 Gv="VerimatrixVCAS",Hv="clpp.verimatrix.Vcas",Iv="clpp.verimatrix.VcasComponent",Ov=function(a){_.$l.call(this,Gv);var b={};b[Jv]=Jv;b[Kv]=Kv;var c=a.authenticator,d=void 0===a.licenseRequestVuidLocation?Lv: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?Mv:a.fairPlayAssetIdStrategy;this.A=a.deviceId;this.a=c;
3
- this.C=d;this.B=b;this.w=Nv(this,e);this.o=Nv(this,f);this.l=Nv(this,g);this.j=h;this.H=l;this.G=m;this.g=new _.K(Hv);_.R.empty(this.w)?this.g.warn(_.oc):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)}})},Nv=function(a,b){if(a.C===Lv){var c=Object.assign({},{deviceId:_.ej(_.R.ed(a.A))},a.a&&{authenticator:_.ej(_.R.ed(a.a))});return b+_.Zj(c)}return b},Pv=function(){this.g=new _.K(Iv)};_.w(Ov,_.$l);
5
- Ov.prototype.h=function(a,b){if(this.C===Qv){var c=this.B[Kv],d={};d[this.B[Jv]]=this.A;this.a&&(d[c]=this.a);Object.keys(d).forEach(function(e){b.headers[e]=d[e]})}};Ov.prototype.I=function(a,b){var c=_.vm(b);switch(this.G){case Rv:c=_.Zj({r:c,nn:this.H},!0)}return c};Ov.prototype.K=function(a,b){this.h(a,b);_.ym(b)};Ov.prototype.M=function(a,b){_.zm(b)};_.H(Hv,Ov);Ov.prototype.constructor=Ov.prototype.constructor;Ov.NAME=Gv;var Lv="query-string",Qv="http-header";
6
- Ov.LicenseRequestVuidLocation={QUERY_STRING:Lv,HTTP_HEADER:Qv};var Jv="DeviceId",Kv="Authenticator";Ov.LicenseRequestHttpHeader={DEVICE_ID_HEADER:Jv,AUTHENTICATOR_HEADER:Kv};var Mv="keyid",Rv="contentid-siteid";Ov.FairPlayAssetIdStrategy={KEYID:Mv,CONTENTID_SITEID:Rv};_.w(Pv,_.Ir);Pv.prototype.a=function(){delete _.Ul.VerimatrixVCAS};Pv.prototype.h=function(a){a=a.getConfiguration();if(a.drm&&a.drm.env===Gv){a=a.drm.customData;if(!a)throw new _.P(_.Q,7,7100,_.Sd);a=new Ov(a);this.g.info("Registering the Verimatrix VCAS Ultra environment");_.Vl(a)}};Pv.prototype.id=function(){return"verimatrix-vcas"};_.H(Iv,Pv);};
2
+ var f=function(window){var Ew="VerimatrixVCAS",Fw="clpp.verimatrix.Vcas",Gw="clpp.verimatrix.VcasComponent",Mw=function(a){_.Am.call(this,Ew);var b={};b[Hw]=Hw;b[Iw]=Iw;var c=a.authenticator,d=void 0===a.licenseRequestVuidLocation?Jw: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?Kw:a.fairPlayAssetIdStrategy;this.A=a.deviceId;this.a=c;
3
+ this.D=d;this.B=b;this.w=Lw(this,e);this.o=Lw(this,f);this.l=Lw(this,g);this.j=h;this.H=l;this.G=m;this.g=new _.K(Fw);_.R.empty(this.w)?this.g.warn(_.rc):this.Sa(_.Td,{licenseUrl:this.w,videoRobustness:[_.Xb,void 0],audioRobustness:[_.Wb,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:this.h.bind(this)}});_.R.empty(this.o)?this.g.warn(_.Kb):this.Sa(_.Rd,{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.Sa(_.Pd,{licenseUrl:this.l,certificateUrl:this.j,modifiers:{licenseRequest:this.K.bind(this),licenseResponse:this.L.bind(this),extractContentId:this.I.bind(this)}})},Lw=function(a,b){if(a.D===Jw){var c=Object.assign({},{deviceId:_.wj(_.R.gd(a.A))},a.a&&{authenticator:_.wj(_.R.gd(a.a))});return b+_.sk(c)}return b},Nw=function(){this.g=new _.K(Gw)};_.w(Mw,_.Am);
5
+ Mw.prototype.h=function(a,b){if(this.D===Ow){var c=this.B[Iw],d={};d[this.B[Hw]]=this.A;this.a&&(d[c]=this.a);Object.keys(d).forEach(function(e){b.headers[e]=d[e]})}};Mw.prototype.I=function(a,b){var c=_.Ym(b);switch(this.G){case Pw:c=_.sk({r:c,Nn:this.H},!0)}return c};Mw.prototype.K=function(a,b){this.h(a,b);_.an(b)};Mw.prototype.L=function(a,b){_.bn(b)};_.H(Fw,Mw);Mw.prototype.constructor=Mw.prototype.constructor;Mw.NAME=Ew;var Jw="query-string",Ow="http-header";
6
+ Mw.LicenseRequestVuidLocation={QUERY_STRING:Jw,HTTP_HEADER:Ow};var Hw="DeviceId",Iw="Authenticator";Mw.LicenseRequestHttpHeader={DEVICE_ID_HEADER:Hw,AUTHENTICATOR_HEADER:Iw};var Kw="keyid",Pw="contentid-siteid";Mw.FairPlayAssetIdStrategy={KEYID:Kw,CONTENTID_SITEID:Pw};_.w(Nw,_.Cs);Nw.prototype.a=function(){delete _.um.VerimatrixVCAS};Nw.prototype.h=function(a){a=a.getConfiguration();if(a.drm&&a.drm.env===Ew){a=a.drm.customData;if(!a)throw new _.P(_.Q,7,7100,_.Ud);a=new Mw(a);this.g.info("Registering the Verimatrix VCAS Ultra environment");_.vm(a)}};Nw.prototype.id=function(){return"verimatrix-vcas"};_.H(Gw,Nw);};
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 wv="Registering listeners",xv="clpp.vimond.VimondPlugin",yv=function(a,b,c,d,e){this.G=a;this.H=b;this.I=c;this.m=d;this.C=e;this.a=new _.Eh;this.l=!0;this.f=this.j=this.A=!1;this.B=null;this.h=new _.uk(this.Dg.bind(this));this.g=new _.K("clpp.vimond.VimondDispatcher");this.o=this.w=0;this.m&&this.a&&(this.g.debug(wv),this.a.on(this.m,_.Tf,this.zj.bind(this)),this.a.on(this.m,_.eg,this.Aj.bind(this)),this.a.on(this.m,_.uc,this.xj.bind(this)),this.a.on(this.m,_.vc,this.yj.bind(this)))},zv=function(a,
3
- b){a.m.trigger(new _.L(_.xg,{detail:b}))},Av=function(a,b,c){b&&(a.A=!0,a.h.stop());a.m.onError(new _.P(b?_.Q:1,9,9201,c))},Bv=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},Cv=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(wv),this.a.on(this.m,_.Gf,this.wl.bind(this)),this.a.on(this.m,_.uc,this.vj.bind(this)),this.a.on(this.m,_.vc,this.wj.bind(this)))},
4
- Dv=function(a,b){var c=a.m.getState();if(1===b)return["str-start",_.of];if(a.h)return[_.le,_.cf];if(c===_.Oo)return[_.le,null];if(c===_.So)return[_.ne,_.cf];var d=_.cf;if(c===_.Mo||c===_.Vo||a.f)d=_.of;return["period",d]},Ev=function(){this.a=!1;this.g=new _.K(xv);this.j=this.h=this.f=null},Fv=function(){};_.r=yv.prototype;_.r.Aj=function(){this.f||(this.f=1<Math.abs(this.w-this.m.getPosition()));this.w=this.m.getPosition()};_.r.xj=function(){this.g.debug("Ad break started");this.j=!0};
5
- _.r.yj=function(){this.g.debug("Ad break stopped");this.j=!1};
6
- _.r.zj=function(a){var b=this,c,d,e,f,g;return _.E(function(h){if(1==h.a){c=a.detail;d=_.Qo;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.C;l.f++;var m=_.N.oa(l.o);m.client.buildName=_.wa;m.client.buildVersion=_.ja;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=Dv(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.ed(JSON.stringify(m));l=l.j.fetch(n).O;return _.x(h,l,4)}if(2!=h.a)return b=h.f,zv(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"),zv(a,f),Av(a,a.H,f)):1001===e?(a.g.debug("Generic service error"),
11
- zv(a,f),Av(a,a.I,f)):a.g.error(c.toString());_.y(h)})};_.r.dispose=function(){this.g.debug(_.gc);_.Hh(this.a);this.h.stop()};Bv.prototype.Vf=function(a){this.h=a};_.r=Cv.prototype;_.r.getPosition=function(){return Math.floor(this.m.getPosition())};_.r.wl=function(){this.h=!0};_.r.vj=function(){this.f=!0};_.r.wj=function(){this.f=!1};_.r.dispose=function(){this.g.debug(_.gc);_.Hh(this.a)};_.w(Ev,_.rt);_.r=Ev.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 Cv(a);this.h=new Bv(b.playerEventRequest.uri,b.authToken,b.playerEventRequest.body,this.f,a.getNetworkEngine());this.j=new yv(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)};_.H(xv,Ev);Ev.prototype.updateAuthToken=Ev.prototype.Vf;Ev.Id="vimond";Fv.prototype.create=function(){return new Ev};_.nq(new Fv);};
2
+ var f=function(window){var uw="Registering listeners",vw="clpp.vimond.VimondPlugin",ww=function(a,b,c,d,e){this.G=a;this.H=b;this.I=c;this.m=d;this.D=e;this.a=new _.Sh;this.l=!0;this.f=this.j=this.A=!1;this.B=null;this.h=new _.Vk(this.Sg.bind(this));this.g=new _.K("clpp.vimond.VimondDispatcher");this.o=this.w=0;this.m&&this.a&&(this.g.debug(uw),this.a.on(this.m,_.eg,this.Sj.bind(this)),this.a.on(this.m,_.rg,this.Tj.bind(this)),this.a.on(this.m,_.xc,this.Qj.bind(this)),this.a.on(this.m,_.yc,this.Rj.bind(this)))},xw=function(a,
3
+ b){a.m.trigger(new _.L(_.Kg,{detail:b}))},yw=function(a,b,c){b&&(a.A=!0,a.h.stop());a.m.onError(new _.P(b?_.Q:1,9,9201,c))},zw=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},Aw=function(a){this.m=a;this.a=new _.Sh;this.g=new _.K("clpp.vimond.VimondAdapter");this.f=this.h=!1;this.m&&this.a&&(this.g.debug(uw),this.a.on(this.m,_.Of,this.Ul.bind(this)),this.a.on(this.m,_.xc,this.Oj.bind(this)),this.a.on(this.m,_.yc,this.Pj.bind(this)))},
4
+ Bw=function(a,b){var c=a.m.getState();if(1===b)return["str-start",_.zf];if(a.h)return[_.pe,_.gf];if(c===_.qp)return[_.pe,null];if(c===_.up)return[_.re,_.gf];var d=_.gf;if(c===_.op||c===_.xp||a.f)d=_.zf;return["period",d]},Cw=function(){this.a=!1;this.g=new _.K(vw);this.j=this.h=this.f=null},Dw=function(){};_.r=ww.prototype;_.r.Tj=function(){this.f||(this.f=1<Math.abs(this.w-this.m.getPosition()));this.w=this.m.getPosition()};_.r.Qj=function(){this.g.debug("Ad break started");this.j=!0};
5
+ _.r.Rj=function(){this.g.debug("Ad break stopped");this.j=!1};
6
+ _.r.Sj=function(a){var b=this,c,d,e,f,g;return _.E(function(h){if(1==h.a){c=a.detail;d=_.sp;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.Sg(),3)}e===d.ENDED&&b.h.stop();_.y(h)})};
8
+ _.r.Sg=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.da(a.l?10:a.G);a.l=!1;_.A(h,2);l=a.D;l.f++;var m=_.O.na(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 _.qk(p.url)).scheme||"").replace(":","");n.videoProtocol=p;n=Bw(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!==_.kd&&(n.liveResumePossible=!0)}m.progress.eventNumber=l.f;m.timestamp=(new Date).toISOString();l.g.debug("Fire an event");n=_.Jj(l.l);n.method="POST";n.contentType="application/json";n.headers.Authorization="Bearer "+l.h;n.body=_.R.gd(JSON.stringify(m));l=l.j.fetch(n).P;return _.x(h,l,4)}if(2!=h.a)return b=h.f,xw(a,b),_.oh(h,0);d=c=_.C(h);e=d.code;f=d.data;g=[1002,1003];g.includes(e)?(a.g.debug("Unreachable service"),xw(a,f),yw(a,a.H,f)):1001===e?(a.g.debug("Generic service error"),
11
+ xw(a,f),yw(a,a.I,f)):a.g.error(c.toString());_.y(h)})};_.r.dispose=function(){this.g.debug(_.jc);_.Vh(this.a);this.h.stop()};zw.prototype.ig=function(a){this.h=a};_.r=Aw.prototype;_.r.getPosition=function(){return Math.floor(this.m.getPosition())};_.r.Ul=function(){this.h=!0};_.r.Oj=function(){this.f=!0};_.r.Pj=function(){this.f=!1};_.r.dispose=function(){this.g.debug(_.jc);_.Vh(this.a)};_.w(Cw,_.Eu);_.r=Cw.prototype;_.r.onPlayerCreated=function(){};
12
+ _.r.onContentWillLoad=function(a){var b=a.getConfiguration();(this.a=!_.O.R(b.vimond)&&typeof b.vimond===_.Xe)?a.namespace()===_.Fd&&(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=_.t(["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!==_.kd&&(c=!0);d=b.failOnError;typeof d!==_.kd&&(d=!0);this.f=new Aw(a);this.h=new zw(b.playerEventRequest.uri,b.authToken,b.playerEventRequest.body,this.f,a.getNetworkEngine());this.j=new ww(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.ig=function(a){this.a&&this.h&&this.h.ig(a)};_.H(vw,Cw);Cw.prototype.updateAuthToken=Cw.prototype.ig;Cw.Id="vimond";Dw.prototype.create=function(){return new Cw};_.Vq(new Dw);};
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));}