@castlabs/prestoplay 6.26.0 → 6.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +7 -7
  5. package/cjs/cl.cast.js +115 -113
  6. package/cjs/cl.conviva.js +32 -32
  7. package/cjs/cl.core.js +623 -623
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +89 -89
  10. package/cjs/cl.externs.js +112 -72
  11. package/cjs/cl.freewheel.js +25 -25
  12. package/cjs/cl.hls.js +78 -77
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +30 -30
  15. package/cjs/cl.ima.js +23 -24
  16. package/cjs/cl.mediatailor.js +3 -3
  17. package/cjs/cl.mse.js +353 -345
  18. package/cjs/cl.muxdata.js +14 -15
  19. package/cjs/cl.onboard.js +4 -3
  20. package/cjs/cl.persistent.js +15 -15
  21. package/cjs/cl.playlist.js +6 -6
  22. package/cjs/cl.simid.js +16 -17
  23. package/cjs/cl.smooth.js +72 -72
  24. package/cjs/cl.thumbnails.js +26 -26
  25. package/cjs/cl.tizen.js +73 -72
  26. package/cjs/cl.ttml.js +29 -29
  27. package/cjs/cl.verimatrix.js +5 -5
  28. package/cjs/cl.vimond.js +12 -12
  29. package/cjs/cl.vr.js +19 -19
  30. package/cjs/cl.vtt.js +14 -14
  31. package/cjs/cl.yospace.js +4 -4
  32. package/cjs/cl.youbora.js +38 -38
  33. package/cjs/polyfill.min.js +15 -3
  34. package/cl.adobe.js +3 -3
  35. package/cl.airplay.js +3 -3
  36. package/cl.broadpeak.js +6 -5
  37. package/cl.cast.js +93 -90
  38. package/cl.conviva.js +27 -27
  39. package/cl.core.js +506 -507
  40. package/cl.crypto.js +9 -9
  41. package/cl.dash.js +83 -82
  42. package/cl.externs.js +112 -72
  43. package/cl.freewheel.js +19 -19
  44. package/cl.hls.js +80 -79
  45. package/cl.hlssmpte.js +5 -5
  46. package/cl.htmlcue.js +26 -26
  47. package/cl.ima.js +17 -17
  48. package/cl.mediatailor.js +2 -3
  49. package/cl.mse.js +308 -305
  50. package/cl.muxdata.js +13 -13
  51. package/cl.onboard.js +4 -4
  52. package/cl.persistent.js +11 -11
  53. package/cl.playlist.js +5 -5
  54. package/cl.simid.js +14 -14
  55. package/cl.smooth.js +60 -60
  56. package/cl.thumbnails.js +19 -19
  57. package/cl.tizen.js +57 -57
  58. package/cl.ttml.js +22 -22
  59. package/cl.verimatrix.js +4 -4
  60. package/cl.vimond.js +8 -8
  61. package/cl.vr.js +15 -15
  62. package/cl.vtt.js +12 -12
  63. package/cl.yospace.js +3 -3
  64. package/cl.youbora.js +31 -29
  65. package/package.json +1 -1
  66. package/typings.d.ts +115 -63
  67. package/cjs/cl.sessions.js +0 -21
  68. package/cl.sessions.js +0 -10
package/cjs/cl.tizen.js CHANGED
@@ -1,76 +1,77 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var RN="An unknown error occurred while trying to get volume",SN="Cannot get loading rendition due to platform limitations",TN="PARAM_START_POSITION",UN="SecurityError",VN="The require privilege is: http://tizen.org/privilege/tv.audio",WN="|STARTBITRATE\x3d",XN=function(a,b,c){function d(e){c.call(a,e);a.removeEventListener(b,d)}a.addEventListener(b,d)},YN=function(a,b){this.h=a;this.o=null;this.a=_.Re;this.l=null;this.j=!1;this.f=new Map;this.C=b;this.g=new _.J("clpp.tizen.DrmEngine")},aO=function(a){var b,
3
- c,d;return _.H(function(e){if(1==e.a){b=a.a===_.Gd||a.a===_.Ed;if(!b)throw new _.N(_.O,6,6001,"The key system "+a.a+" is not supported by the player or the platform");c=a.f.get(a.a);if(!c.ye)throw new _.N(_.O,6,6012,"No license server given for "+a.a);_.D(e,2);return a.a===_.Gd?_.x(e,ZN(a),5):_.x(e,$N(a,c),5)}if(2!=e.a)return a.o={keySystem:a.a,licenseServerUri:c.ye,distinctiveIdentifierRequired:!1,persistentStateRequired:c.Fg,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[],
4
- keyIds:[],periodId:null},_.vh(e,0);d=_.F(e);a.g.error("Error while configuring CDM for "+a.a,d);throw new _.N(_.O,6,6005,{message:JSON.stringify(d)});})},$N=function(a,b){var c,d,e,f;return _.H(function(g){c=bO;d=cO;e={};e[d.xj]=!b.Fg;e[d.Bj]=b.ye;""!==b.customData&&(e[d.wj]=b.customData);f=JSON.stringify(e);a.g.debug("PlayReady properties: ",f);try{webapis.avplay.setDrm(c.PLAYREADY,"SetProperties",f)}catch(h){throw h;}_.z(g)})},ZN=function(a){var b;return _.H(function(c){b=bO;try{webapis.avplay.setDrm(b.We,
5
- "Initialize",""),webapis.avplay.setDrm(b.We,"widevine_app_session",a.l.id),webapis.avplay.setDrm(b.We,"widevine_data_type",a.l.type)}catch(d){throw d;}_.z(c)})},dO=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,t,u,y,A,B,E;_.H(function(C){if(1==C.a){c=bO;d=a.f.get(a.a);a.g.debug("DRM Challenge data: ",b.challenge);e=atob(b.challenge);f=new Uint8Array(e.length);for(g=0;g<e.length;++g)f[g]=e.charCodeAt(g);h=b.serverurl&&""!==b.serverurl?b.serverurl:d.ye;l=_.ik([h],_.ek());l.type=3;l.body=f.buffer;l.method=
6
- _.sb;_.D(C,2);return _.x(C,a.C.Db.fetch(l).T,4)}if(2!=C.a){m=C.f;if(a.j){n=_.Oj(m.data);p=n.byteLength;q="";for(t=0;t<p;t++)q+=String.fromCharCode(n[t]);u=btoa(q);y=b.session_id+TN+(u+TN);a.g.debug("Widevine license params",y);try{webapis.avplay.setDrm(c.We,"widevine_license_data",y)}catch(G){a.g.error("License response rejected by CDM"),A=new _.N(_.O,6,6008,{browserError:JSON.stringify(G)}),a.C.onError(A)}}return _.vh(C,0)}B=_.F(C);a.g.error("License request failed.",JSON.stringify(B));E=new _.N(_.O,
7
- 6,6007,{message:"Error while fetching license!",url:B.data.url,status:B.data.status||NaN,response:B.data.response||"",headers:B.data.headers||{}},B);a.C.onError(E);_.z(C)})},eO=function(a){this.m=a;this.a=this.m.a;this.f=_.wq;this.j=_.xq;this.w=(new Date).getTime();this.l=!1;this.o=-1;this.h=2;this.g=new _.J("clpp.tizen.StateManager")},gO=function(a,b){if(a.f!==b)if(a.f===_.Hq&&b!==_.wq)a.g.debug(_.XC+fO(b));else{var c=(new Date).getTime();a.j=a.f;a.f=b;a.f===_.Bq?(a.o=(new Date).getTime(),a.m.trigger(new _.K(_.ad,
8
- {detail:{bufferedTimeMS:-1,reason:a.h}}))):a.j===_.Bq&&a.m.trigger(new _.K(_.$c,{detail:{bufferedTimeMS:c-a.o,reason:a.h}}));var d={currentState:a.f,previousState:a.j,timeSinceLastStateChangeMS:c-a.w};a.w=c;a.m.trigger(new _.K(_.cg,{detail:d}));a.g.debug("State changed:",fO(a.j),"-\x3e",fO(a.f))}},fO=function(a){return Object.keys(_.Fq)[a]},jO=function(a){if(a.l){var b=a.a.getState(),c=a.f;switch(b){case hO:c=_.Kq;break;case iO:c=_.Jq;break;default:a.m.isEnded()?c=_.Dq:a.g.debug("Inconsistent AVPlay playback state:",
9
- b)}gO(a,c)}},kO=function(){this.o=this.A=this.f=this.h=this.B=this.m=this.j=this.a=null;this.F=!1;this.w=!0;this.l=null;this.g=new _.J("clpp.tizen.TextStreamer")},lO=function(a){if(!a)return!1;a=a.periods;for(var b=!1,c=0;c<a.length;c++)b=b||0<a[c].textStreams.length;return b},mO=function(a){var b,c;return _.H(function(d){if(1==d.a)return b=a.m.getConfiguration(),c=null,_.x(d,_.ev(a.B.url,a.m.getNetworkEngine(),b.manifest.attemptParameters,a.B.type||null),2);(c=d.f)&&c.configure(b.manifest);return d["return"](c)})},
10
- nO=function(a){var b=document.createElement(_.Jg),c=new _.GG,d=new _.gE,e=a.m.getTextDisplayer();return new _.IG(b,c,e,d,a.m.getConfiguration())},oO=function(a){var b={configuration:{},Pb:function(){return a.m.getPosition()},X:a.h,Db:a.m.getNetworkEngine(),pd:null,xg:a.jl.bind(a),wg:a.il.bind(a),onError:a.kl.bind(a),Li:function(){},onEvent:function(){},Qi:a.ll.bind(a),yf:function(){},ge:function(){return new _.vH},$f:function(){return!1},ae:null};return new _.bI(a.a,b)},pO=function(a){var b=a.m.getPosition(),
11
- c=null;a=_.v(a.a.periods);for(var d=a.next();!d.done;d=a.next())d=d.value,d.startTime<=b&&(c=d);return c},qO=function(a){a.g.debug("getTextStreams()",a.a);if(a.a){var b=[],c=a.a.periods;a.g.debug("getting text streams");for(var d=0;d<c.length;d++)if(a.g.debug(c[d].startTime,a.m.getPosition()),c[d].startTime<=a.m.getPosition()){b=c[d].textStreams;break}a=b}else a=[];b=[];for(d=c=0;d<a.length;d++){var e=new _.Lk(String(c++),_.S);e.mimeType=a[d].mimeType;e.language=a[d].language;e.roles=a[d].roles;e.kind=
12
- a[d].kind||_.uD;var f=new _.Tk(String(a[d].id),e);f.bandwidth=a[d].bandwidth||null;e.renditions.push(f);b.push(e)}return b},rO=function(a){if(a.h&&!a.h.getTextDisplayer().isTextVisible())return null;if(a.f){var b=_.eI(a.f,_.qj),c=null;if(b){a=qO(a);for(var d=0;d<a.length;d++)if(a[d].renditions[0].id===String(b.id)){c=a[d].renditions[0];break}}return c}return null},sO=function(a,b){a.g.debug("Set active track",b);if(b&&(a.o=b.language,a.A=b.roles[0]||"",a.F=b.kind===_.ke,a.a&&a.f)){a.setTextVisibility(!0);
13
- var c=pO(a),d=b.renditions[0];(c=c.textStreams.find(function(e){return String(e.id)===d.id}))?(a.w?(a.g.debug("Switching period defer text selection"),a.l=c):(_.qI(a.f,c,!0,0),a.m.trigger(new _.K(_.ng))),a.o=c.language):a.g.error("No stream with id",d.id)}},tO=function(){this.j=this.a=this.m=null;this.f={};this.g=new _.J("clpp.tizen.TrackManager");this.w=this.o=this.l=null;this.A=!1;this.h=1},uO=function(a,b){a.m.trigger(new _.K(_.Og,{details:{width:b.width,height:b.height,bandwidth:b.bandwidth,track:b.track,
14
- abrSelection:a.a.o}}))},vO=function(a){var b=a.pa();b&&a.m.trigger(new _.K(_.Yc,{detail:{width:b.width,height:b.height,bandwidth:b.bandwidth,rendition:b}}))},wO=function(a){var b=a.m.getConfiguration(),c=_.Hi(b.preferredAudioLanguage||[]),d=a.f[_.T]||[];if(d.length){var e=null;c.some(function(g){e=_.SD(g,d.map(function(h){return h.language}));return!!e});if(e){var f=d.filter(function(g){return g.language===e});c=f[0];1<f.length&&b.preferredAudioRole&&(f=f.filter(function(g){return 0<=g.roles.indexOf(b.preferredAudioRole)}),
15
- 0<f.length&&(c=f[0]));a.g.debug("Setting audio track with preferred language:",e);a.Ia(c)}else a.g.debug("Preferred language(s) not available")}else a.g.debug("Could not set preferred audio language")},AO=function(a,b){if(b){var c=b.track.type.toUpperCase();xO(a.a,c,Number(b.id)).then(function(){c===yO&&(a.l=b,a.m.trigger(new _.K(_.Wc)));c===zO&&(a.o=b,a.m.trigger(new _.K(_.ng)))})["catch"](function(){a.g.error("Could not select "+c+" track.")})}else a.g.debug("Must provide valid rendition")},BO=
16
- function(a,b,c){var d=_.Dj(b.language||_.xg);c.language=_.Mk(d);c.originalLanguage=d;c.channelsCount=b.channels?Number(b.channels):null;c.mimeType=_.Tc;a=new _.Tk(String(a),c);a.track=c;a.codec=b.fourCC||null;a.bandwidth=b.bit_rate||null;return a},CO=function(a,b,c){c.mimeType=_.Mg;a=new _.Tk(String(a),c);a.track=c;a.width=b.Width||null;a.height=b.Height||null;a.bandwidth=b.Bit_rate?Number(b.Bit_rate):null;a.codec=b.fourCC||null;return a},DO=function(a,b,c){b=_.Dj(b.track_lang||_.xg);c.mimeType="text/ttml";
17
- c.language=_.Mk(b);c.originalLanguage=b;c.kind=_.uD;return new _.Tk(String(a),c)},EO=function(a,b){var c=null;try{c=JSON.parse(b)}catch(d){a.g.warn("Couldn't retrieve extra infos from stream."),c=null}return c},HO=function(a,b){function c(n,p){for(var q=0;q<n.length;q++)if(n[q].language===p)return n[q];return null}var d={};if(0>=b.length)return d;for(var e=b.filter(function(n){return n.type===FO}),f=b.filter(function(n){return n.type===yO}),g=[],h=0;h<f.length;h++){var l=EO(a,f[h].extra_info);if(l){var m=
18
- _.Dj(l.language||_.xg);m=_.Mk(m);m=c(g,m);m||(m=new _.Lk(String(a.h++),_.T),g.push(m));m.renditions.push(BO(f[h].index,l,m))}else a.g.warn("Skipping audio stream with no extra info")}f=new _.Lk(String(a.h++),_.Nk);for(h=0;h<e.length;h++)(l=EO(a,e[h].extra_info))?f.renditions.push(CO(e[h].index,l,f)):a.g.warn("Skipping video stream with no extra info");e=[];e=a.j?qO(a.j):GO(a,b);d[_.Nk]=[f];d[_.T]=g;d[_.S]=e;return d},GO=function(a,b){for(var c=b.filter(function(h){return h.type===zO}),d=[],e=0;e<
19
- c.length;e++){var f=EO(a,c[e].extra_info);if(f){var g=new _.Lk(String(a.h++),_.S);g.renditions.push(DO(c[e].index,f,g));d.push(g)}else a.g.warn("Skipping text stream with no extra info")}return d},IO=function(a,b){for(var c=a.f[_.Nk]||[],d=[],e=0;e<c.length;e++)for(var f=0;f<c[e].renditions.length;f++)_.L.ra(c[e].renditions[f],b,Object.keys(b))&&d.push(c[e].renditions[f]);return d[0]||null},JO=function(a,b,c){a=a.f[c]||[];b=String(b.index);c=null;for(var d=0;d<a.length;d++)for(var e=0;e<a[d].renditions.length;e++)if(a[d].renditions[e].id===
20
- b){c=a[d].renditions[e];break}return c},LO=function(a,b){if(b===_.S&&a.j)return rO(a.j);var c=KO(a.a)||[];if(0===c.length)return null;c=c.filter(function(e){return e.type===b.toUpperCase()})[0];var d=null;b===_.Nk&&(d=EO(a,c.extra_info),d=IO(a,{width:d.Width,height:d.Height}));b===_.T&&(c?(d=JO(a,c,_.T),a.l=d):d=a.l);b===_.S&&(c?(d=JO(a,c,_.S),a.o=d):d=a.o);return d},MO=function(a){_.pm.call(this);this.m=a;this.h=null;this.g=new _.J("clpp.tizen.Middleware");this.F=1;this.B=!1;this.l=null;this.G=0;
21
- this.o=!0;this.f=!1;this.a=null;this.A=1;this.w=!1;this.j={}},NO=function(a){return _.H(function(b){tizen.systeminfo.getPropertyValue("DISPLAY",function(c){a.A=c.resolutionWidth/1920;a.g.debug("Display resolution ratio: ",a.A)},function(c){a.g.debug("Could not load DISPLAY property");throw c;});_.z(b)})},PO=function(a){try{webapis.avplay.setListener({onbufferingstart:a.cl.bind(a),onbufferingprogress:a.al.bind(a),onbufferingcomplete:a.$k.bind(a),onstreamcompleted:a.gl.bind(a),oncurrentplaytime:function(b){a.trigger(new _.K(OO,
22
- {currentTime:b}))},onevent:a.fl.bind(a),onsubtitlechange:a.hl.bind(a),ondrmevent:a.el.bind(a),onerror:a.Xd.bind(a)})}catch(b){a.g.error(b)}},QO=function(a){var b=!!a.m.getTrackManager().Ya();try{webapis.avplay.setSilentSubtitle(!b)}catch(c){a.g.debug("Could not set AVPlay subtitle config",c)}},RO=function(a,b){try{var c=b.estimatedBandwidth||0,d=b.currentBandwidth||0;a.g.debug({estimatedBandwidth:c,mp:d});0!==c&&0!==d&&c>=1.15*d&&webapis.avplay.setStreamingProperty("ADAPTIVE_INFO",WN+d)}catch(e){a.g.debug(e)}},
23
- SO=function(a,b){try{webapis.avplay.setStreamingProperty("ADAPTIVE_INFO","|BITRATES\x3d"+b+WN+b)}catch(c){throw a.g.debug("Could not set fixed bandwidth",c),c;}},VO=function(a){return{position:a.getPosition(),state:a.m.getState(),sh:a.getState(),playbackRate:a.getPlaybackRate(),isLive:a.isLive(),duration:a.getDuration(),isMuted:TO(a),volume:a.getVolume(),Ho:UO(a),xl:KO(a)}},XO=function(a){var b,c;return _.H(function(d){if(1==d.a)return _.x(d,WO(),2);if(3!=d.a)return b=new Promise(function(e){(new _.Yh(e)).ha(5)}),
24
- _.x(d,Promise.race([NO(a).then(function(){return!0}),b.then(function(){return!1})]),3);c=d.f;if(!c)return a.g.debug("Took to long for the SDK to be ready"),d["return"](Promise.reject("SDK Timeout"));_.z(d)})},cP=function(a,b,c){var d,e,f,g,h,l,m,n;return _.H(function(p){switch(p.a){case 1:a.l=_.Oq(b);d=a.G;e=c||{estimatedBandwidth:0,currentBandwidth:0,nextBandwidth:null,currentPosition:0};a.g.debug("Loading manifest URL: "+a.l[d].url);f=b.startTime||void 0;a.f&&(a.trigger(new _.K(YO)),f=c.currentPosition);
25
- _.D(p,2);g=a.l[d].url;h=a.l[d].type;h!==_.Ic||g.includes(".mpd")||(l=new URL(g),l.searchParams.append("cl-ext",".mpd"),g=l.toString());webapis.avplay.open(g);e.nextBandwidth?(SO(a,e.nextBandwidth),a.o=!1):(a.o||RO(a,e),a.o=!0);PO(a);if(!b.drm||!b.drm.env){a.g.debug("No DRM configuration was provided. Assuming clear content");p.D(4);break}m={onError:function(q){return a.m.onError(q)},Db:a.m.getNetworkEngine()};a.h=new YN(b.drm,m);return _.x(p,a.h.init(),4);case 4:return a.f||a.trigger(new _.K(ZO)),
26
- _.x(p,$O(a),6);case 6:a.f||a.trigger(new _.K(aP));f&&typeof f===_.k&&0<f&&a.seek(f)["catch"](function(q){a.g.debug("Couldn't set start position",q)});a.f||(b.volume&&a.setVolume(b.volume),b.muted&&bP(a,b.muted),b.autoplay&&a.m.play()["catch"](function(q){a.g.debug("Autoplay failed",q)}));_.vh(p,0);break;case 2:throw n=_.F(p),a.g.debug("Error while attempting to load source."),n;}})},$O=function(a){return _.H(function(b){a.g.debug("avplay.prepare()");return b["return"](new Promise(function(c,d){try{webapis.avplay.prepareAsync(function(){a.g.debug("AVPlay is ready!");
27
- QO(a);c()},function(e){a.g.debug("prepareAsync failed",e);d(e)})}catch(e){a.g.debug("Failed to prepare media player for playback"),d(e)}}))})},dP=function(a,b,c){a.g.debug("switchVideoTrack()");try{var d={estimatedBandwidth:parseInt(webapis.avplay.getStreamingProperty("CURRENT_BANDWITH"),10),currentBandwidth:b,nextBandwidth:c,currentPosition:a.getPosition()};a.a=VO(a);a.f=!0;webapis.avplay.stop();webapis.avplay.close();return a.load(a.m.getConfiguration(),d).then(function(){var e=a.a.sh;a.f=!1;a.a=
28
- null;return e===iO?a.pause():a.play()})}catch(e){return Promise.reject(e)}},UO=function(a){return a.f&&a.a?a.a.Ho:webapis.avplay.getTotalTrackInfo()},KO=function(a){return a.f&&a.a?a.a.xl:webapis.avplay.getCurrentStreamInfo()},xO=function(a,b,c){b=b.toUpperCase();b===zO&&eP(a,!0);var d=a.j[b];d&&(d.Jf.stop(),a.j[b]=null,a.g.debug("Cancelled pending track switch for "+b));return new Promise(function(e,f){function g(h,l,m){m=void 0===m?!1:m;try{webapis.avplay.setSelectTrack(h,l),a.j[h]=null,e()}catch(n){a.g.debug("Could not set "+
29
- h+" track. Trying again...AVPlay state: "+(a.getState()+", buffering: ")+a.w,n),!1===m&&(a.j[h]={type:h,index:l,oh:0,Jf:new _.Yh(function(){return g(h,c,!0)})}),(l=a.j[h])&&3>l.oh?(!a.w&&++l.oh,l.Jf.ha(a.w?.5:.25)):(a.g.debug("Could not set track after multiple attempts.Giving up..."),l&&l.Jf.stop(),a.j[h]=null,f())}}g(b,c)})},eP=function(a,b){var c=a.m.getTextDisplayer();c&&c.setTextVisibility(b);c=a.m.h;try{c||webapis.avplay.setSilentSubtitle(!b)}catch(d){a.g.debug("Could not set text track visibility",
30
- d)}},bP=function(a,b){try{tizen.tvaudiocontrol.setMute(b)}catch(c){switch(c.name){case UN:a.g.warn("The application does not have the privilege to set mute.",VN);break;default:a.g.warn(RN,c)}}},TO=function(a){var b=null;try{b=tizen.tvaudiocontrol.isMute()}catch(c){switch(c.name){case UN:a.g.warn("The application doesn't have the privilege to get the mute state.",VN);break;default:a.g.warn(RN,c)}}return!!b},WO=function(){return new Promise(function(a,b){if(window.webapis)a();else{var c=document.createElement("script");
31
- XN(c,_.Ce,function(d){return a(d)});XN(c,_.ie,function(d){return b(d)});c.src="$WEBAPIS/webapis/webapis.js";document.querySelector("head").appendChild(c)}})},fP=function(){_.pm.call(this);this.a=new MO(this);this.f=new eO(this);this.configuration=this.B=_.wm();this.w=null;this.g=new _.J("clpp.tizen.Player");this.j=null;this.l=new tO;this.F=new _.Bk;this.o=this.h=null;this.A=!1},gP=function(a){if("NONE"!==a.a.getState()){var b=a.j.getBoundingClientRect();a=a.a;var c=Math.floor(b.left*a.A),d=Math.floor(b.top*
32
- a.A),e=Math.floor(b.width*a.A);b=Math.floor(b.height*a.A);a.g.debug("Setting display area to","x:",c,"y:",d,"width:",e,"height:",b);webapis.avplay.setDisplayRect(c,d,e,b);0===c&&0===d&&1920===e&&1080===b&&webapis.avplay.setDisplayMethod("PLAYER_DISPLAY_MODE_LETTER_BOX")}else a.g.debug("Could not apply dimension. Player state "+a.a.getState())},hP=function(){},iP=function(){};
33
- YN.prototype.init=function(){var a=this,b,c,d,e,f,g;return _.H(function(h){if(1==h.a){b=_.Ym[a.h.env]||null;if(!b)throw a.g.debug(_.Ea,_.xb+a.h.env+_.aa),new _.N(_.O,6,6015,_.Fa+a.h.env+"' is missing.");a.l={id:String(Math.floor(1E4*Math.random())),type:"MPEG-DASH"};c=Object.keys(a.h.customData||{}).length?btoa(JSON.stringify(a.h.customData)):"";d=_.$m(b,a.h.customData);(e=d[_.Ed])&&a.f.set(_.Ed,{ye:e.licenseUrl||"",customData:c,Fg:!1});(f=d[_.Gd])&&a.f.set(_.Gd,{ye:f.licenseUrl||"",customData:c,
34
- Fg:!1});if(0===a.f.size)throw new _.N(_.O,6,6E3);if((g=a.h.preferredDrmSystem)&&a.f.get(g))a.a=g;else if(a.f.get(_.Ed))a.a=_.Ed;else if(a.f.get(_.Gd))a.a=_.Gd;else throw new _.N(_.O,6,6001,"Configuration for the target system is missing.");return _.x(h,aO(a),2)}a.j=!0;_.z(h)})};YN.prototype.release=function(){var a=this;return _.H(function(b){a.j=!1;a.o=null;a.a=_.Re;a.l=null;a.f=new Map;_.z(b)})};YN.prototype.getDrmInfo=function(){return this.o};
35
- var cO={xj:"DeleteLicenseAfterUse",Bj:"LicenseServer",Xo:"GetChallenge",Yo:"HttpHeader",$o:"UserAgent",Uo:"Cookie",wj:"CustomData"};_.r=eO.prototype;_.r.initialize=function(){this.a.on(YO,this.Jh,this);this.a.on(jP,this.Ih,this);this.a.on(kP,this.Hh,this);this.a.on(ZO,this.Si,this);this.a.on(aP,this.Ri,this);this.a.on(lP,this.Kh,this)};_.r.release=function(){gO(this,_.wq);this.l=!1;this.o=-1;this.h=2};_.r.destroy=function(){this.release();this.a.off(YO,this.Jh);this.a.off(jP,this.Ih);this.a.off(kP,this.Hh);this.a.off(ZO,this.Si);this.a.off(aP,this.Ri);this.a.off(lP,this.Kh);this.m=this.a=null};
36
- _.r.Jh=function(){this.g.debug("Buffering start. Player state: ",this.a.getState());this.h=this.a.B?1:2;gO(this,_.Bq)};_.r.Ih=function(a){this.g.debug("Buffering progress: "+a.percent+" %. Player state: ",fO(this.f))};_.r.Hh=function(){this.g.debug("Buffering complete. Player state: ",this.a.getState());if(!this.l){this.l=!0;var a=this.m.getConfiguration().autoplay,b=this.a.getState()===mP;if(!a&&b){gO(this,_.Jq);return}}if(a=this.f!==_.Iq)a=this.a.getState(),a=a===hO||a===iO;a&&jO(this)};
37
- _.r.Si=function(){this.g.debug("Preparing starts. AVPlay State: ",this.a.getState());this.a.getState()===nP?gO(this,_.Iq):this.g.error("AVPlay prepares while state is not IDLE")};_.r.Ri=function(){this.g.debug("Preparing ends: AVPlay state:",this.a.getState())};_.r.Kh=function(){gO(this,_.Dq)};_.r.getState=function(){return this.f};_.r=kO.prototype;_.r.initialize=function(a){this.m=a};
38
- _.r.load=function(a){var b=this,c,d,e,f,g,h,l;return _.H(function(m){switch(m.a){case 1:if(!b.m)return b.g.debug("Text streamer is not initialized. Will not load()"),m["return"]();b.B=a;c=b;return _.x(m,mO(b),2);case 2:c.j=m.f;if(!b.j)return b.g.debug("Could not find manifest parser for source. Make sure parsers are registered."),m["return"]();d={configurationId:"",networkingEngine:b.m.getNetworkEngine(),onContentSteeringInfoFound:function(){return null},filterNewPeriod:function(){},filterAllPeriods:function(){},
39
- onEvent:function(){},onError:function(){}};_.D(m,3);e=b;return _.x(m,b.j.start(a.url,d),5);case 5:e.a=m.f;_.vh(m,4);break;case 3:return f=_.F(m),b.g.warn(f),_.D(m,6),g=b,_.x(m,b.j.start(a.url.replace(_.se,"http://"),d),8);case 8:g.a=m.f;_.vh(m,4);break;case 6:h=_.F(m),b.g.error(h),b.a=null;case 4:if(!b.a||!lO(b.a)){m.D(0);break}b.h=nO(b);_.D(m,10);return _.x(m,b.h.open(),12);case 12:b.f=oO(b);l=b.m.getConfiguration();b.f.h=l.streaming;b.o=l.preferredTextLanguage;b.A=l.preferredTextRole;b.F=l.preferForcedSubtitles;
40
- _.vh(m,0);break;case 10:_.F(m),b.g.debug("Could not setup media source..."),b.h=null,b.f=null,b.j=null,b.a=null,_.z(m)}})};_.r.jl=function(a){this.g.debug(_.oD,a);this.w=!0;var b=_.uH(a.textStreams,this.o||"",this.A||"",this.F)[0]||null;this.l&&(a.textStreams.includes(this.l)&&(b=this.l),this.l=null);return{video:null,audio:null,text:b,eb:null}};_.r.il=function(){this.g.debug("canSwitch_");this.w=!1;this.l&&(_.qI(this.f,this.l,!0,0),this.l=null)};_.r.kl=function(){this.g.debug("onError_")};
41
- _.r.ll=function(){this.j&&this.j.update&&this.j.update()};_.r.start=function(){var a=this;return _.H(function(b){if(!a.f)return b["return"]();try{a.f.start()}catch(c){a.g.error("Error while starting streaming engine",c)}_.z(b)})};_.r.setTextVisibility=function(a){this.g.debug("Set text visibility",a);this.h&&this.h.getTextDisplayer().setTextVisibility(a)};_.r.release=function(){var a=this;return _.H(function(b){a.m=null;a.a=null;a.B=null;a.A=null;a.o=null;a.w=!0;a.l=null;_.z(b)})};
42
- _.r.destroy=function(){var a=this;return _.H(function(b){switch(b.a){case 1:if(!a.j){b.D(2);break}return _.x(b,a.j.stop(),3);case 3:a.j=null;case 2:if(!a.f){b.D(4);break}return _.x(b,a.f.destroy(),5);case 5:a.f=null,a.w=!0;case 4:if(!a.h){b.D(0);break}return _.x(b,a.h.destroy(),7);case 7:a.h=null,_.z(b)}})};_.w(tO,_.jl);_.r=tO.prototype;_.r.Ji=function(a){var b=a.eventid;a=a.data;switch(b){case oP:0<Object.keys(this.f).length||(this.g.debug("Loading track manager!"),this.load());b=webapis.avplay.getCurrentStreamInfo();0<b.length&&(b=+EO(this,b[0].extra_info).Bit_rate,b=IO(this,{bandwidth:b}))&&(this.w=b,uO(this,b));break;case pP:vO(this);break;default:this.g.debug("Event type: "+b+" data: "+a)}};_.r.Bg=function(a){a.detail.currentState===_.Kq&&this.m.off(_.cg,this.Bg)};
43
- _.r.initialize=function(a){var b=this;this.m=a;this.a=this.m.a;this.m.on(_.cg,function(c){b.A||(c=c.detail,c.currentState===_.Kq&&(b.g.debug("Current state",c.currentState),b.A=!0,wO(b)))});this.a.on(qP,this.Ji,this)};_.r.release=function(){this.f={};this.j=this.w=this.o=this.l=null;this.A=!1;this.h=1};
44
- _.r.load=function(){if(this.a&&!(0<Object.keys(this.f).length)){this.j=this.m.h;this.m.off(_.cg,this.Bg);this.m.on(_.cg,this.Bg,this);try{var a=UO(this.a);this.f=HO(this,a);var b=this.f[_.T]||[];b.length&&(this.l=b[0].renditions[0]||null);vO(this)}catch(c){this.g.debug("Could not load track manager")}}};_.r.destroy=function(){this.a.off(qP,this.Ji);this.a=this.m=null};_.r.getVideoTracks=function(){return this.f[_.Nk]||[]};_.r.getAudioTracks=function(){return this.f[_.T]||[]};
45
- _.r.oa=function(){return this.f[_.S]||[]};_.r.pa=function(){return LO(this,_.Nk)};_.r.Ua=function(){return LO(this,_.T)};_.r.Ya=function(){return LO(this,_.S)};_.r.Ab=function(){return this.w};_.r.Mb=function(){this.g.info(SN);return null};_.r.Nb=function(){this.g.info(SN);return null};_.r.Ma=function(){var a=this.pa();return a?a.track:null};_.r.na=function(){var a=this.Ua();return a?a.track:null};_.r.va=function(){var a=this.Ya();return a?a.track:null};
46
- _.r.Ib=function(a){var b=this;null===a?(a=this.pa(),dP(this.a,a.bandwidth,null).then(function(){vO(b)})):0<a.renditions.length&&this.sb(a.renditions[0])};_.r.Ia=function(a){a?AO(this,a.renditions[0]):this.g.warn("Cannot disable audio tracks on this platform.","Consider muting audio instead...")};_.r.Za=function(a){a?(a=a.renditions[0],this.j?sO(this.j,a.track):AO(this,a)):(this.g.debug("Disabling text tracks"),this.o=null,eP(this.a,!1),this.m.trigger(new _.K(_.ng)))};
47
- _.r.sb=function(a){var b=this,c=this.pa();this.a.o||a.width!==c.width||a.height!==c.height||a.bandwidth!==c.bandwidth?(this.w=a,uO(this,a),dP(this.a,c.bandwidth,a.bandwidth).then(function(){vO(b)})["catch"](function(d){var e=new _.N(_.O,7,7200,{tizenerror:d});b.g.debug("Error while switching video track",d);b.m.onError(e)})):this.g.debug("Trying to switch to already active rendition. Doing nothing...")};_.r.Gb=function(a){AO(this,a)};_.r.Hb=function(a){this.j?sO(this.j,a.track):AO(this,a)};
48
- _.r.addTextTrack=function(){};_.r.xa=function(){return this.a.o};tO.prototype.isAbrEnabled=tO.prototype.xa;tO.prototype.addTextTrack=tO.prototype.addTextTrack;tO.prototype.setTextRendition=tO.prototype.Hb;tO.prototype.setAudioRendition=tO.prototype.Gb;tO.prototype.setVideoRendition=tO.prototype.sb;tO.prototype.setTextTrack=tO.prototype.Za;tO.prototype.setAudioTrack=tO.prototype.Ia;tO.prototype.setVideoTrack=tO.prototype.Ib;tO.prototype.getTextTrack=tO.prototype.va;tO.prototype.getAudioTrack=tO.prototype.na;
49
- tO.prototype.getVideoTrack=tO.prototype.Ma;tO.prototype.getLoadingTextRendition=tO.prototype.Nb;tO.prototype.getLoadingAudioRendition=tO.prototype.Mb;tO.prototype.getLoadingVideoRendition=tO.prototype.Ab;tO.prototype.getTextRendition=tO.prototype.Ya;tO.prototype.getAudioRendition=tO.prototype.Ua;tO.prototype.getVideoRendition=tO.prototype.pa;tO.prototype.getTextTracks=tO.prototype.oa;tO.prototype.getAudioTracks=tO.prototype.getAudioTracks;tO.prototype.getVideoTracks=tO.prototype.getVideoTracks;_.w(MO,_.pm);_.r=MO.prototype;_.r.cl=function(){this.w=!0;this.f||this.trigger(new _.K(YO))};_.r.al=function(a){this.w=!0;this.trigger(new _.K(jP,{percent:a}))};_.r.$k=function(){this.w=!1;this.trigger(new _.K(kP))};_.r.gl=function(){this.trigger(new _.K(lP))};_.r.fl=function(a,b){this.trigger(new _.K(qP,{eventid:a,data:b}))};_.r.hl=function(a,b,c,d,e){this.trigger(new _.K(rP,{duration:a,text:b,subtitleType:c,attriCount:d,attributes:e}))};
50
- _.r.el=function(a,b){this.trigger(new _.K(sP,{drmType:a,drmData:b}));if(this.h){var c=this.h;if(c.j)if(c.a===_.Gd&&"Challenge"===b.name)dO(c,b);else if("DrmError"===b.name){c.g.debug("DrmError event",b);var d=new _.N(_.O,6,6005,{message:JSON.stringify(b)});c.C.onError(d)}}};_.r.Xd=function(a){this.trigger(new _.K(tP,{eventType:a}))};
51
- _.r.play=function(){function a(){return new Promise(function(d,e){function f(){d();clearTimeout(g)}var g=null;b.one(OO,f,b);g=setTimeout(function(){b.off(OO,f);e("Timeout")},3E4)})}var b=this,c=this.getState();if(c===nP)return(new Promise(function(d,e){webapis.avplay.prepareAsync(function(){QO(b);d(webapis.avplay.play())},function(f){b.trigger(new _.K(tP));e(f)})})).then(function(){return a()});if(c===iO||c===mP)try{return webapis.avplay.play(),a()}catch(d){return Promise.reject(d)}return c===hO?
52
- Promise.resolve():Promise.reject("Player is in invalid state")};_.r.pause=function(){try{webapis.avplay.pause()}catch(a){Promise.reject(a)}return this.getState()===iO?Promise.resolve():Promise.reject()};
53
- _.r.setPlaybackRate=function(a){var b=this.getState();if(b===mP||b===hO||b===iO){try{webapis.avplay.setSpeed(a),this.F=a}catch(c){return this.g.debug("Error while trying to set playback rate",c),this.setPlaybackRate(this.F)}return!0}this.g.debug("Cannot set playback rate; AVPlay is in inconsistent state: "+b);return!1};_.r.getPlaybackRate=function(){return this.F};
54
- _.r.load=function(a,b){var c=this,d;return _.H(function(e){switch(e.a){case 1:return c.g.debug("configure()",b||""),_.D(e,2),_.x(e,XO(c),4);case 4:return _.x(e,cP(c,a,b),5);case 5:_.vh(e,0);break;case 2:throw d=_.F(e),new _.N(_.O,7,7003,null,d);}})};_.r.getState=function(){if(this.f&&this.a)return this.a.sh;try{return webapis.avplay.getState()}catch(a){this.Xd(JSON.stringify(a))}};
55
- _.r.seek=function(a){var b=this,c=1E3*a;return new Promise(function(d,e){b.B=!0;b.m.trigger(new _.K(_.Dg));webapis.avplay.seekTo(c,function(){b.B=!1;b.m.trigger(new _.K(_.Cg));d()},function(){b.B=!1;e()})})};_.r.getPosition=function(){if(this.f&&this.a)return this.a.position;try{return webapis.avplay.getCurrentTime()/1E3}catch(a){this.Xd(JSON.stringify(a))}};_.r.getDuration=function(){if(this.f&&this.a)return this.a.duration;try{return webapis.avplay.getDuration()/1E3}catch(a){this.Xd(JSON.stringify(a))}};
56
- _.r.release=function(){var a=this;return new Promise(function(b,c){try{a.h&&(a.h.release(),a.h=null);webapis.avplay.stop();webapis.avplay.close();for(var d in a.j){var e=a.j[d];e&&e.Jf.stop()}a.j={};a.F=1;a.B=!1;a.l=null;a.a=null;return b()}catch(f){return c(f)}})};_.r.getVolume=function(){var a=null;try{a=tizen.tvaudiocontrol.getVolume()}catch(b){switch(b.name){case UN:this.g.debug("The application does not have the privilege to get the volume.",VN);break;default:this.g.debug(RN,b)}}return a};
57
- _.r.setVolume=function(a){try{tizen.tvaudiocontrol.setVolume(Math.max(0,Math.min(100*a,100)))}catch(b){switch(b.name){case "InvalidValueError":this.g.warn("Invalid value passed for setVolume.","The passed value value should be in the range of 0 to 1.");break;case UN:this.g.warn("The application does not have the privilege to set the volume.",VN);break;default:this.g.warn("An unknown error occurred while trying to set volume",b)}}};
58
- _.r.isLive=function(){if(this.f&&this.a)return this.a.isLive;try{return"1"===webapis.avplay.getStreamingProperty("IS_LIVE")}catch(a){this.Xd(JSON.stringify(a))}};_.r.stop=function(){try{webapis.avplay.stop()}catch(a){this.g.debug(a)}};_.r.getDrmInfo=function(){this.h&&this.h.getDrmInfo();return null};_.r.setSourceIndex=function(a){this.G=a};_.r.getSourceIndex=function(){return this.G};_.r.getLoadedSource=function(){return this.l&&this.l[this.getSourceIndex()]};
59
- var nP="IDLE",mP="READY",hO="PLAYING",iO="PAUSED",FO=_.Vb,yO=_.ja,zO="TEXT",pP="PLAYER_MSG_RESOLUTION_CHANGED",oP="PLAYER_MSG_BITRATE_CHANGE",bO={PLAYREADY:"PLAYREADY",Vo:"EME_PLAYREADY",ap:"VERIMATRIX",We:"WIDEVINE_CDM",Wo:"EME_WIDEVINE_CDM",cp:"WIDEVINE_CLASSIC"};_.w(fP,_.pm);_.r=fP.prototype;_.r.Fh=function(){var a=this;this.g.debug("On Stream completed. Current time: ",this.getPosition());this.trigger(new _.K(_.he));this.configuration.loop?this.seek(this.configuration.startTime||0)["catch"](function(){a.g.debug("Could not loop playback")}):this.a.stop()};_.r.Ch=function(a){this.trigger(new _.K(_.sg,{currentTime:a.currentTime/1E3}))};
60
- _.r.Gh=function(a){var b=this.a.getPosition(),c=b+a.duration/1E3,d=a.text||"";this.g.debug("Got subtitles: ",d,"start:",b,"end:",c,a);(d=_.Q.Sg(d))&&this.o.append([new _.Ti(b,c,d)],[])};_.r.Dh=function(a){this.g.debug("DRM event: "+a.drmType+", data: "+a.drmData)};_.r.Ki=function(){this.A||(this.g.debug("Initial buffering completed..."),this.A=!0)};
61
- _.r.Eh=function(a){this.g.debug("Error: TYPE: "+a.eventType);gO(this.f,_.Hq);a=new _.N(_.O,7,7200,{tizenerror:a.eventType});this.a.release();this.trigger(new _.K(_.ie,{detail:a}))};
62
- _.r.init=function(a,b){this.configuration=this.B=b;this.w=a;this.a.on(lP,this.Fh,this);this.a.on(OO,this.Ch,this);this.a.on(rP,this.Gh,this);this.a.on(sP,this.Dh,this);this.a.on(tP,this.Eh,this);this.a.on(kP,this.Ki,this);this.f.initialize();this.l.initialize(this);this.g.debug("Initializing player surface");this.w.hideMediaElement();var c=uP;uP+=1;this.j=_.hr(_.Se,{id:"__clpp_tizen_player_"+c,type:"application/avplayer"});this.w.addElementToContainer(this.j,!0);var d=this.w.getMedia();if(d){c=this.j;
63
- var e=[_.Zg,_.ne,"position",_.we,"top"],f={};d=null!==d.parentElement?window.getComputedStyle(d,null):d.style;if(!e||0===e.length){e||(e=[]);for(var g in d)e.push(g)}g=_.v(e);for(e=g.next();!e.done;e=g.next())e=e.value,f[e]=d[e];_.jr(c,f);gP(this)}};_.r.getSurface=function(){return this.w};_.r.getConfiguration=function(){return this.configuration};_.r.getTimeline=function(){return null};_.r.setupPlaylist=function(){return Promise.reject(_.ob)};_.r.appendLoad=function(){return Promise.reject(_.ob)};
64
- _.r.seekWith=function(){return Promise.reject(_.ob)};_.r.setSeekInterceptor=function(){};_.r.setPlaybackSessionId=function(){};_.r.getBandwidthEstimate=function(){return null};
65
- _.r.destroy=function(){var a=this;return _.H(function(b){switch(b.a){case 1:return _.x(b,a.release(),2);case 2:a.a.off(lP,a.Fh);a.a.off(OO,a.Ch);a.a.off(rP,a.Gh);a.a.off(sP,a.Dh);a.a.off(tP,a.Eh);a.a.off(kP,a.Ki);if(!a.h){b.D(3);break}return _.x(b,a.h.destroy(),4);case 4:a.h=null;case 3:a.j&&(a.j.parentElement.removeChild(a.j),a.j=null),a.l.destroy(),a.f.destroy(),a.l=null,a.f=null,_.z(b)}})};_.r.namespace=function(){return vP};_.r.getPlaybackRate=function(){return this.a.getPlaybackRate()};
66
- _.r.setDrmCustomDataModifier=function(){};_.r.setCdnErrorCallback=function(){};_.r.detach=function(){};_.r.setPlaybackRate=function(a){this.a.setPlaybackRate(a)};_.r.getPosition=function(){return this.getMediaPosition()};_.r.getMediaPosition=function(){return 0<(this.configuration.startTime||0)&&!this.A?0:this.f.getState()===_.Dq?this.getDuration():this.a.getPosition()||0};_.r.seek=function(a){return typeof a===_.k&&0<=a?(this.isLive()||(a=Math.min(a,this.getDuration())),this.a.seek(a)):Promise.reject()};
67
- _.r.getPresentationStartTime=function(){return null};_.r.getSeekRange=function(){return{start:0,end:0}};_.r.getVolume=function(){var a=this.a.getVolume();return typeof a===_.k?a/100:null};_.r.setVolume=function(a){this.a.setVolume(a)};_.r.getDuration=function(){return this.getMediaDuration()};_.r.getMediaDuration=function(){return this.a.getDuration()};_.r.getBufferInfo=function(){this.g.warn(_.wa);return new _.om};_.r.getTrackManager=function(){return this.l};_.r.unload=function(){var a=this;return this.a.release().then(function(){a.l.release()})};
68
- _.r.release=function(){var a=this;return _.H(function(b){switch(b.a){case 1:if(!a.h){b.D(2);break}return _.x(b,a.h.release(),2);case 2:if(!a.o){b.D(4);break}return _.x(b,a.o.destroy(),5);case 5:a.o=null;case 4:return _.x(b,a.a.release(),6);case 6:a.l.release(),a.f.release(),a.A=!1,_.z(b)}})};
69
- _.r.load=function(a){var b=this,c,d,e,f,g;return _.H(function(h){switch(h.a){case 1:b.configuration=_.ym(b.B,a);c=_.nq(b.configuration,[_.re,"native"]);b.o=c.create(b);d=_.Oq(b.configuration)[0];e=!!b.configuration.tizen&&b.configuration.tizen.sideStreamText;if(!e){h.D(2);break}b.h=new kO;b.h.initialize(b);_.D(h,3);return _.x(h,b.h.load(d),5);case 5:b.h.start();_.vh(h,2);break;case 3:f=_.F(h),b.g.error(f);case 2:return _.D(h,6),_.x(h,b.a.load(b.configuration),8);case 8:_.vh(h,7);break;case 6:throw g=
70
- _.F(h),b.onError(g),g;case 7:b.l.load(),_.z(h)}})};_.r.play=function(){var a=this;this.trigger(new _.K(_.gf));gP(this);return this.a.play().then(function(){jO(a.f)})};_.r.pause=function(){var a=this;return this.a.pause().then(function(){jO(a.f)})};_.r.getState=function(){return this.f.getState()};_.r.getPeriods=function(){return[]};_.r.onError=function(a){var b=new _.K(_.ie,{detail:a});a.severity===_.O&&(gO(this.f,_.Hq),this.a.release());this.trigger(b);b.defaultPrevented&&(b.a=!0)};
71
- _.r.getDrmInfo=function(){return this.a.getDrmInfo()};_.r.isEnded=function(){return this.f.getState()===_.Dq};_.r.isPaused=function(){return this.a.getState()===iO};_.r.isMuted=function(){return TO(this.a)};_.r.setMuted=function(a){bP(this.a,a)};_.r.getNetworkEngine=function(){return this.F};_.r.setNetworkEngine=function(a){this.F=a};_.r.setCmsdManager=function(){};_.r.isLive=function(){return this.a.isLive()};_.r.getStats=function(){return null};_.r.setSourceIndex=function(a){this.a.setSourceIndex(a)};
72
- _.r.getSourceIndex=function(){return this.a.getSourceIndex()};_.r.getLoadedSource=function(){return this.a.getLoadedSource()};_.r.canPlay=function(a,b){return(new hP).canPlay(a,b)};_.r.getTimelineCues=function(){return[]};_.r.getCueTimeline=function(){return null};_.r.getTextDisplayer=function(){return this.o};_.r.resetAbr=function(){};var vP="clpp.tizen",uP=0;hP.prototype.a=function(){return vP};
73
- hP.prototype.canPlay=function(a){a=a.type;var b=!!window.webapis;if((a===_.Ic||a===_.bm||a===_.Nc)&&b){if(_.wk(2))return 2;if(_.wk(3)||_.wk(4)||_.wk(5)||_.wk(6))return _.Kh("Use of clpp.tizen.TizenComponent is not recommended for Tizen version \x3e\x3d 3."),1}return 0};hP.prototype.f=function(a){return a===_.qa};hP.prototype.create=function(){return new fP};_.w(iP,_.Fu);iP.prototype.f=function(){_.Uh(new hP)};iP.prototype.a=function(){var a=vP;a&&_.Sh[a]&&(delete _.Sh[a],_.Th.info("Removed Player factory: '"+a+"'"))};iP.prototype.id=function(){return"tizen"};_.I("clpp.tizen.TizenComponent",iP);var YO="onbufferingstart",jP="onbufferingprogress",kP="onbufferingcomplete",lP="onstreamcompleted",OO="oncurrentplaytime",qP="onevent",rP="onsubtitlechange",sP="ondrmevent",tP="onerror",ZO="preparingstart",aP="preparingend";};
2
+ var f=function(window){var hP="An unknown error occurred while trying to get volume",iP="Cannot get loading rendition due to platform limitations",jP="PARAM_START_POSITION",kP="SecurityError",lP="The require privilege is: http://tizen.org/privilege/tv.audio",mP="onbufferingcomplete",nP="onbufferingprogress",oP="onbufferingstart",pP="oncurrentplaytime",qP="ondrmevent",rP="onerror",sP="onstreamcompleted",tP="onsubtitlechange",uP="preparingend",vP="preparingstart",wP="|STARTBITRATE\x3d",xP=function(a,b,c){function d(e){c.call(a,
3
+ e);a.removeEventListener(b,d)}a.addEventListener(b,d)},yP=function(a,b){this.h=a;this.o=null;this.a=_.Re;this.l=null;this.j=!1;this.f=new Map;this.D=b;this.g=new _.L("clpp.tizen.DrmEngine")},BP=function(a){var b,c,d;return _.I(function(e){if(1==e.a){b=a.a===_.Fd||a.a===_.Dd;if(!b)throw new _.N(_.O,6,6001,"The key system "+a.a+" is not supported by the player or the platform");c=a.f.get(a.a);if(!c.te)throw new _.N(_.O,6,6012,"No license server given for "+a.a);_.F(e,2);return a.a===_.Fd?_.x(e,zP(a),
4
+ 5):_.x(e,AP(a,c),5)}if(2!=e.a)return a.o={keySystem:a.a,licenseServerUri:c.te,distinctiveIdentifierRequired:!1,persistentStateRequired:c.Eg,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[],keyIds:[],periodId:null},_.G(e,0);d=_.H(e);a.g.error("Error while configuring CDM for "+a.a,d);throw new _.N(_.O,6,6005,{message:JSON.stringify(d)});})},AP=function(a,b){var c,d,e,f;return _.I(function(g){c=CP;d=DP;e={};e[d.Fj]=!b.Eg;e[d.Hj]=b.te;""!==b.customData&&(e[d.Dj]=b.customData);
5
+ f=JSON.stringify(e);a.g.debug("PlayReady properties: ",f);try{webapis.avplay.setDrm(c.PLAYREADY,"SetProperties",f)}catch(h){throw h;}_.z(g)})},zP=function(a){var b;return _.I(function(c){b=CP;try{webapis.avplay.setDrm(b.Pe,"Initialize",""),webapis.avplay.setDrm(b.Pe,"widevine_app_session",a.l.id),webapis.avplay.setDrm(b.Pe,"widevine_data_type",a.l.type)}catch(d){throw d;}_.z(c)})},EP=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,t,u,y,B,A,C;_.I(function(E){if(1==E.a){c=CP;d=a.f.get(a.a);a.g.debug("DRM Challenge data: ",
6
+ b.challenge);e=atob(b.challenge);f=new Uint8Array(e.length);for(g=0;g<e.length;++g)f[g]=e.charCodeAt(g);h=b.serverurl&&""!==b.serverurl?b.serverurl:d.te;l=_.Mk([h],_.Ik());l.type=3;l.body=f.buffer;l.method=_.qb;_.F(E,2);return _.x(E,a.D.Cb.fetch(l).T,4)}if(2!=E.a){m=E.f;if(a.j){n=_.Mi(m.data);p=n.byteLength;q="";for(t=0;t<p;t++)q+=String.fromCharCode(n[t]);u=btoa(q);y=b.session_id+jP+(u+jP);a.g.debug("Widevine license params",y);try{webapis.avplay.setDrm(c.Pe,"widevine_license_data",y)}catch(D){a.g.error("License response rejected by CDM"),
7
+ B=new _.N(_.O,6,6008,{browserError:JSON.stringify(D)}),a.D.onError(B)}}return _.G(E,0)}A=_.H(E);a.g.error("License request failed.",JSON.stringify(A));C=new _.N(_.O,6,6007,{message:"Error while fetching license!",url:A.data.url,status:A.data.status||NaN,response:A.data.response||"",headers:A.data.headers||{}},A);a.D.onError(C);_.z(E)})},FP=function(a){this.m=a;this.a=this.m.a;this.f=_.Wt;this.j=7;this.w=(new Date).getTime();this.l=!1;this.o=-1;this.h=2;this.g=new _.L("clpp.tizen.StateManager")},HP=
8
+ function(a,b){if(a.f!==b)if(a.f===_.zo&&b!==_.Wt)a.g.debug(_.CB+GP(b));else{var c=(new Date).getTime();a.j=a.f;a.f=b;2===a.f?(a.o=(new Date).getTime(),a.m.trigger(new _.Q(_.Zc,{detail:{bufferedTimeMS:-1,reason:a.h}}))):2===a.j&&a.m.trigger(new _.Q(_.Yc,{detail:{bufferedTimeMS:c-a.o,reason:a.h}}));var d={currentState:a.f,previousState:a.j,timeSinceLastStateChangeMS:c-a.w};a.w=c;a.m.trigger(new _.Q(_.dg,{detail:d}));a.g.debug("State changed:",GP(a.j),"-\x3e",GP(a.f))}},GP=function(a){return Object.keys(_.bu)[a]},
9
+ KP=function(a){if(a.l){var b=a.a.getState(),c=a.f;switch(b){case IP:c=3;break;case JP:c=4;break;default:a.m.isEnded()?c=5:a.g.debug("Inconsistent AVPlay playback state:",b)}HP(a,c)}},LP=function(){this.o=this.A=this.f=this.h=this.B=this.m=this.j=this.a=null;this.F=!1;this.w=!0;this.l=null;this.g=new _.L("clpp.tizen.TextStreamer")},MP=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},NP=function(a){var b,c;return _.I(function(d){if(1==d.a)return b=
10
+ a.m.getConfiguration(),c=null,_.x(d,_.Pv(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)})},OP=function(a){var b=document.createElement(_.Mg),c=new _.hF,d=new _.PC,e=a.m.getTextDisplayer();return new _.jF(b,c,e,d,a.m.getConfiguration())},PP=function(a){var b={configuration:{},Ab:function(){return a.m.getPosition()},X:a.h,Cb:a.m.getNetworkEngine(),kd:null,ug:a.kl.bind(a),Mi:a.jl.bind(a),onError:a.ll.bind(a),Ni:function(){},
11
+ onEvent:function(){},Si:a.ml.bind(a),vf:function(){},be:function(){return new _.XF},Zf:function(){return!1},Wd:null};return new _.DG(a.a,b)},QP=function(a){var b=a.m.getPosition(),c=null;a=_.v(a.a.periods);for(var d=a.next();!d.done;d=a.next())d=d.value,d.startTime<=b&&(c=d);return c},RP=function(a){a.g.debug("getTextStreams()",a.a);if(a.a){var b=[],c=a.a.periods;a.g.debug("getting text streams");for(var d=0;d<c.length;d++)if(a.g.debug(c[d].startTime,a.m.getPosition()),c[d].startTime<=a.m.getPosition()){b=
12
+ c[d].textStreams;break}a=b}else a=[];b=[];for(d=c=0;d<a.length;d++){var e=new _.Qs(String(c++),_.Ss);e.mimeType=a[d].mimeType;e.language=a[d].language;e.roles=a[d].roles;e.kind=a[d].kind||_.$B;var f=new _.Zs(String(a[d].id),e);f.bandwidth=a[d].bandwidth||null;e.renditions.push(f);b.push(e)}return b},SP=function(a){if(a.h&&!a.h.getTextDisplayer().isTextVisible())return null;if(a.f){var b=_.GG(a.f,_.tn),c=null;if(b){a=RP(a);for(var d=0;d<a.length;d++)if(a[d].renditions[0].id===String(b.id)){c=a[d].renditions[0];
13
+ break}}return c}return null},TP=function(a,b){var c,d,e,f;_.I(function(g){if(1==g.a){c=_.qJ;a.g.debug("Set active track",b);if(!b)return g.C(0);a.o=b.language;a.A=b.roles[0]||"";a.F=b.kind===c.fh;if(!a.a||!a.f)return g.C(0);a.setTextVisibility(!0);d=QP(a);e=b.renditions[0];f=d.textStreams.find(function(h){return String(h.id)===e.id});return f?a.w?(a.g.debug("Switching period defer text selection"),a.l=f,g.C(4)):_.x(g,_.$G(a.f,f),5):(a.g.error("No stream with id",e.id),g["return"]())}4!=g.a&&a.m.trigger(new _.Q(_.pg));
14
+ a.o=f.language;_.z(g)})},UP=function(){this.j=this.a=this.m=null;this.f={};this.g=new _.L("clpp.tizen.TrackManager");this.w=this.o=this.l=null;this.A=!1;this.h=1},VP=function(a,b){a.m.trigger(new _.Q(_.Qg,{details:{width:b.width,height:b.height,bandwidth:b.bandwidth,track:b.track,abrSelection:a.a.o}}))},WP=function(a){var b=a.pa();b&&a.m.trigger(new _.Q(_.Wc,{detail:{width:b.width,height:b.height,bandwidth:b.bandwidth,rendition:b}}))},XP=function(a){var b=a.m.getConfiguration(),c=_.Di(b.preferredAudioLanguage||
15
+ []),d=a.f[_.X]||[];if(d.length){var e=null;c.some(function(g){e=_.GC(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)}),0<f.length&&(c=f[0]));a.g.debug("Setting audio track with preferred language:",e);a.Ga(c)}else a.g.debug("Preferred language(s) not available")}else a.g.debug("Could not set preferred audio language")},aQ=function(a,
16
+ b){if(b){var c=b.track.type.toUpperCase();YP(a.a,c,Number(b.id)).then(function(){c===ZP&&(a.l=b,a.m.trigger(new _.Q(_.Uc)));c===$P&&(a.o=b,a.m.trigger(new _.Q(_.pg)))})["catch"](function(){a.g.error("Could not select "+c+" track.")})}else a.g.debug("Must provide valid rendition")},bQ=function(a,b,c){var d=_.jo(b.language||_.Bg);c.language=_.Rs(d);c.originalLanguage=d;c.channelsCount=b.channels?Number(b.channels):null;c.mimeType=_.Rc;a=new _.Zs(String(a),c);a.track=c;a.codec=b.fourCC||null;a.bandwidth=
17
+ b.bit_rate||null;return a},cQ=function(a,b,c){c.mimeType=_.Og;a=new _.Zs(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},dQ=function(a,b,c){b=_.jo(b.track_lang||_.Bg);c.mimeType="text/ttml";c.language=_.Rs(b);c.originalLanguage=b;c.kind=_.$B;return new _.Zs(String(a),c)},eQ=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},
18
+ hQ=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===fQ}),f=b.filter(function(n){return n.type===ZP}),g=[],h=0;h<f.length;h++){var l=eQ(a,f[h].extra_info);if(l){var m=_.jo(l.language||_.Bg);m=_.Rs(m);m=c(g,m);m||(m=new _.Qs(String(a.h++),_.X),g.push(m));m.renditions.push(bQ(f[h].index,l,m))}else a.g.warn("Skipping audio stream with no extra info")}f=new _.Qs(String(a.h++),
19
+ _.Ts);for(h=0;h<e.length;h++)(l=eQ(a,e[h].extra_info))?f.renditions.push(cQ(e[h].index,l,f)):a.g.warn("Skipping video stream with no extra info");e=[];e=a.j?RP(a.j):gQ(a,b);d[_.Ts]=[f];d[_.X]=g;d[_.Ss]=e;return d},gQ=function(a,b){for(var c=b.filter(function(h){return h.type===$P}),d=[],e=0;e<c.length;e++){var f=eQ(a,c[e].extra_info);if(f){var g=new _.Qs(String(a.h++),_.Ss);g.renditions.push(dQ(c[e].index,f,g));d.push(g)}else a.g.warn("Skipping text stream with no extra info")}return d},iQ=function(a,
20
+ b){for(var c=a.f[_.Ts]||[],d=[],e=0;e<c.length;e++)for(var f=0;f<c[e].renditions.length;f++)_.M.ra(c[e].renditions[f],b,Object.keys(b))&&d.push(c[e].renditions[f]);return d[0]||null},jQ=function(a,b,c){a=a.f[c]||[];b=String(b.index);c=null;for(var d=0;d<a.length;d++)for(var e=0;e<a[d].renditions.length;e++)if(a[d].renditions[e].id===b){c=a[d].renditions[e];break}return c},lQ=function(a,b){if(b===_.Ss&&a.j)return SP(a.j);var c=kQ(a.a)||[];if(0===c.length)return null;c=c.filter(function(e){return e.type===
21
+ b.toUpperCase()})[0];var d=null;b===_.Ts&&(d=eQ(a,c.extra_info),d=iQ(a,{width:d.Width,height:d.Height}));b===_.X&&(c?(d=jQ(a,c,_.X),a.l=d):d=a.l);b===_.Ss&&(c?(d=jQ(a,c,_.Ss),a.o=d):d=a.o);return d},mQ=function(a){_.yi.call(this);this.m=a;this.h=null;this.g=new _.L("clpp.tizen.Middleware");this.F=1;this.B=!1;this.l=null;this.G=0;this.o=!0;this.f=!1;this.a=null;this.A=1;this.w=!1;this.j={}},nQ=function(a){return _.I(function(b){tizen.systeminfo.getPropertyValue("DISPLAY",function(c){a.A=c.resolutionWidth/
22
+ 1920;a.g.debug("Display resolution ratio: ",a.A)},function(c){a.g.debug("Could not load DISPLAY property");throw c;});_.z(b)})},oQ=function(a){try{webapis.avplay.setListener({onbufferingstart:a.el.bind(a),onbufferingprogress:a.cl.bind(a),onbufferingcomplete:a.al.bind(a),onstreamcompleted:a.hl.bind(a),oncurrentplaytime:function(b){a.trigger(new _.Q(pP,{currentTime:b}))},onevent:a.gl.bind(a),onsubtitlechange:a.il.bind(a),ondrmevent:a.fl.bind(a),onerror:a.Rd.bind(a)})}catch(b){a.g.error(b)}},pQ=function(a){var b=
23
+ !!a.m.getTrackManager().Xa();try{webapis.avplay.setSilentSubtitle(!b)}catch(c){a.g.debug("Could not set AVPlay subtitle config",c)}},qQ=function(a,b){try{var c=b.estimatedBandwidth||0,d=b.currentBandwidth||0;a.g.debug({estimatedBandwidth:c,mp:d});0!==c&&0!==d&&c>=1.15*d&&webapis.avplay.setStreamingProperty("ADAPTIVE_INFO",wP+d)}catch(e){a.g.debug(e)}},rQ=function(a,b){try{webapis.avplay.setStreamingProperty("ADAPTIVE_INFO","|BITRATES\x3d"+b+wP+b)}catch(c){throw a.g.debug("Could not set fixed bandwidth",
24
+ c),c;}},uQ=function(a){return{position:a.getPosition(),state:a.m.getState(),rh:a.getState(),playbackRate:a.getPlaybackRate(),isLive:a.isLive(),duration:a.getDuration(),isMuted:sQ(a),volume:a.getVolume(),Ho:tQ(a),xl:kQ(a)}},wQ=function(a){var b,c;return _.I(function(d){if(1==d.a)return _.x(d,vQ(),2);if(3!=d.a)return b=new Promise(function(e){(new _.dj(e)).ha(5)}),_.x(d,Promise.race([nQ(a).then(function(){return!0}),b.then(function(){return!1})]),3);c=d.f;if(!c)return a.g.debug("Took to long for the SDK to be ready"),
25
+ d["return"](Promise.reject("SDK Timeout"));_.z(d)})},zQ=function(a,b,c){var d,e,f,g,h,l,m,n;return _.I(function(p){switch(p.a){case 1:a.l=_.Jn(b);d=a.G;e=c||{estimatedBandwidth:0,currentBandwidth:0,nextBandwidth:null,currentPosition:0};a.g.debug("Loading manifest URL: "+a.l[d].url);f=b.startTime||void 0;a.f&&(a.trigger(new _.Q(oP)),f=c.currentPosition);_.F(p,2);g=a.l[d].url;h=a.l[d].type;h!==_.Gc||g.includes(".mpd")||(l=new URL(g),l.searchParams.append("cl-ext",".mpd"),g=l.toString());webapis.avplay.open(g);
26
+ e.nextBandwidth?(rQ(a,e.nextBandwidth),a.o=!1):(a.o||qQ(a,e),a.o=!0);oQ(a);if(!b.drm||!b.drm.env){a.g.debug("No DRM configuration was provided. Assuming clear content");p.C(4);break}m={onError:function(q){return a.m.onError(q)},Cb:a.m.getNetworkEngine()};a.h=new yP(b.drm,m);return _.x(p,a.h.init(),4);case 4:return a.f||a.trigger(new _.Q(vP)),_.x(p,xQ(a),6);case 6:a.f||a.trigger(new _.Q(uP));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&&
27
+ a.setVolume(b.volume),b.muted&&yQ(a,b.muted),b.autoplay&&a.m.play()["catch"](function(q){a.g.debug("Autoplay failed",q)}));_.G(p,0);break;case 2:throw n=_.H(p),a.g.debug("Error while attempting to load source."),n;}})},xQ=function(a){return _.I(function(b){a.g.debug("avplay.prepare()");return b["return"](new Promise(function(c,d){try{webapis.avplay.prepareAsync(function(){a.g.debug("AVPlay is ready!");pQ(a);c()},function(e){a.g.debug("prepareAsync failed",e);d(e)})}catch(e){a.g.debug("Failed to prepare media player for playback"),
28
+ d(e)}}))})},AQ=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=uQ(a);a.f=!0;webapis.avplay.stop();webapis.avplay.close();return a.load(a.m.getConfiguration(),d).then(function(){var e=a.a.rh;a.f=!1;a.a=null;return e===JP?a.pause():a.play()})}catch(e){return Promise.reject(e)}},tQ=function(a){return a.f&&a.a?a.a.Ho:webapis.avplay.getTotalTrackInfo()},
29
+ kQ=function(a){return a.f&&a.a?a.a.xl:webapis.avplay.getCurrentStreamInfo()},YP=function(a,b,c){b=b.toUpperCase();b===$P&&BQ(a,!0);var d=a.j[b];d&&(d.If.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 "+h+" track. Trying again...AVPlay state: "+(a.getState()+", buffering: ")+a.w,n),!1===m&&(a.j[h]={type:h,index:l,mh:0,
30
+ If:new _.dj(function(){return g(h,c,!0)})}),(l=a.j[h])&&3>l.mh?(a.w||++l.mh,l.If.ha(a.w?.5:.25)):(a.g.debug("Could not set track after multiple attempts.Giving up..."),l&&l.If.stop(),a.j[h]=null,f())}}g(b,c)})},BQ=function(a,b){var c=a.m.getTextDisplayer();c&&c.setTextVisibility(b);c=a.m.h;try{c||webapis.avplay.setSilentSubtitle(!b)}catch(d){a.g.debug("Could not set text track visibility",d)}},yQ=function(a,b){try{tizen.tvaudiocontrol.setMute(b)}catch(c){switch(c.name){case kP:a.g.warn("The application does not have the privilege to set mute.",
31
+ lP);break;default:a.g.warn(hP,c)}}},sQ=function(a){var b=null;try{b=tizen.tvaudiocontrol.isMute()}catch(c){switch(c.name){case kP:a.g.warn("The application doesn't have the privilege to get the mute state.",lP);break;default:a.g.warn(hP,c)}}return!!b},vQ=function(){return new Promise(function(a,b){if(window.webapis)a();else{var c=document.createElement("script");xP(c,_.Ce,function(d){return a(d)});xP(c,_.je,function(d){return b(d)});c.src="$WEBAPIS/webapis/webapis.js";document.querySelector("head").appendChild(c)}})},
32
+ CQ=function(){_.yi.call(this);this.a=new mQ(this);this.f=new FP(this);this.configuration=this.B=_.Dn();this.w=null;this.g=new _.L("clpp.tizen.Player");this.j=null;this.l=new UP;this.F=new _.Om;this.o=this.h=null;this.A=!1},DQ=function(a){if("NONE"!==a.a.getState()){var b=a.j.getBoundingClientRect();a=a.a;var c=Math.floor(b.left*a.A),d=Math.floor(b.top*a.A),e=Math.floor(b.width*a.A);b=Math.floor(b.height*a.A);a.g.debug("Setting display area to","x:",c,"y:",d,"width:",e,"height:",b);webapis.avplay.setDisplayRect(c,
33
+ 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())},EQ=function(){},FQ=function(){};
34
+ yP.prototype.init=function(){var a=this,b,c,d,e,f,g;return _.I(function(h){if(1==h.a){b=_.Mn[a.h.env]||null;if(!b)throw a.g.debug(_.Aa,_.wb+a.h.env+_.aa),new _.N(_.O,6,6015,_.Ba+a.h.env+"' is missing.");a.l={id:String(Math.floor(1E4*Math.random())),type:"MPEG-DASH"};c=Object.keys(a.h.customData||{}).length?btoa(JSON.stringify(a.h.customData)):"";d=_.On(b,a.h.customData);(e=d[_.Dd])&&a.f.set(_.Dd,{te:e.licenseUrl||"",customData:c,Eg:!1});(f=d[_.Fd])&&a.f.set(_.Fd,{te:f.licenseUrl||"",customData:c,
35
+ Eg:!1});if(0===a.f.size)throw new _.N(_.O,6,6E3);if((g=a.h.preferredDrmSystem)&&a.f.get(g))a.a=g;else if(a.f.get(_.Dd))a.a=_.Dd;else if(a.f.get(_.Fd))a.a=_.Fd;else throw new _.N(_.O,6,6001,"Configuration for the target system is missing.");return _.x(h,BP(a),2)}a.j=!0;_.z(h)})};yP.prototype.release=function(){var a=this;return _.I(function(b){a.j=!1;a.o=null;a.a=_.Re;a.l=null;a.f=new Map;_.z(b)})};yP.prototype.getDrmInfo=function(){return this.o};
36
+ var DP={Fj:"DeleteLicenseAfterUse",Hj:"LicenseServer",Xo:"GetChallenge",Yo:"HttpHeader",$o:"UserAgent",Uo:"Cookie",Dj:"CustomData"};_.r=FP.prototype;_.r.initialize=function(){this.a.on(oP,this.Jh,this);this.a.on(nP,this.Ih,this);this.a.on(mP,this.Hh,this);this.a.on(vP,this.Ui,this);this.a.on(uP,this.Ti,this);this.a.on(sP,this.Kh,this)};_.r.release=function(){HP(this,_.Wt);this.l=!1;this.o=-1;this.h=2};_.r.destroy=function(){this.release();this.a.off(oP,this.Jh);this.a.off(nP,this.Ih);this.a.off(mP,this.Hh);this.a.off(vP,this.Ui);this.a.off(uP,this.Ti);this.a.off(sP,this.Kh);this.m=this.a=null};
37
+ _.r.Jh=function(){this.g.debug("Buffering start. Player state: ",this.a.getState());this.h=this.a.B?1:2;HP(this,2)};_.r.Ih=function(a){this.g.debug("Buffering progress: "+a.percent+" %. Player state: ",GP(this.f))};_.r.Hh=function(){this.g.debug("Buffering complete. Player state: ",this.a.getState());if(!this.l){this.l=!0;var a=this.m.getConfiguration().autoplay,b=this.a.getState()===GQ;if(!a&&b){HP(this,4);return}}if(a=1!==this.f)a=this.a.getState(),a=a===IP||a===JP;a&&KP(this)};
38
+ _.r.Ui=function(){this.g.debug("Preparing starts. AVPlay State: ",this.a.getState());this.a.getState()===HQ?HP(this,1):this.g.error("AVPlay prepares while state is not IDLE")};_.r.Ti=function(){this.g.debug("Preparing ends: AVPlay state:",this.a.getState())};_.r.Kh=function(){HP(this,5)};_.r.getState=function(){return this.f};_.r=LP.prototype;_.r.initialize=function(a){this.m=a};
39
+ _.r.load=function(a){var b=this,c,d,e,f,g,h,l;return _.I(function(m){switch(m.a){case 1:if(!b.m)return b.g.debug("Text streamer is not initialized. Will not load()"),m["return"]();b.B=a;c=b;return _.x(m,NP(b),2);case 2:c.j=m.f;if(!b.j)return b.g.debug("Could not find manifest parser for source. Make sure parsers are registered."),m["return"]();d={configurationId:"",networkingEngine:b.m.getNetworkEngine(),onContentSteeringInfoFound:function(){return null},filterNewPeriod:function(){},filterAllPeriods:function(){},
40
+ onEvent:function(){},onError:function(){}};_.F(m,3);e=b;return _.x(m,b.j.start(a.url,d),5);case 5:e.a=m.f;_.G(m,4);break;case 3:return f=_.H(m),b.g.warn(f),_.F(m,6),g=b,_.x(m,b.j.start(a.url.replace(_.se,"http://"),d),8);case 8:g.a=m.f;_.G(m,4);break;case 6:h=_.H(m),b.g.error(h),b.a=null;case 4:if(!b.a||!MP(b.a)){m.C(0);break}b.h=OP(b);_.F(m,10);return _.x(m,b.h.open(),12);case 12:b.f=PP(b);l=b.m.getConfiguration();b.f.h=l.streaming;b.o=l.preferredTextLanguage;b.A=l.preferredTextRole;b.F=l.preferForcedSubtitles;
41
+ _.G(m,0);break;case 10:_.H(m),b.g.debug("Could not setup media source..."),b.h=null,b.f=null,b.j=null,b.a=null,_.z(m)}})};_.r.kl=function(a){this.g.debug(_.UB,a.id);this.w=!0;var b=_.WF(a.textStreams,this.o||"",this.A||"",this.F)[0]||null;this.l&&(a.textStreams.includes(this.l)&&(b=this.l),this.l=null);return{video:null,audio:null,text:b,ab:null}};_.r.jl=function(){var a=this;return _.I(function(b){if(1==b.a)return a.g.debug("canSwitch_"),a.w=!1,a.l?_.x(b,_.$G(a.f,a.l),3):b.C(0);a.l=null;_.z(b)})};
42
+ _.r.ll=function(){this.g.debug("onError_")};_.r.ml=function(){this.j&&this.j.update&&this.j.update()};_.r.start=function(){var a=this;return _.I(function(b){if(!a.f)return b["return"]();try{a.f.start()}catch(c){a.g.error("Error while starting streaming engine",c)}_.z(b)})};_.r.setTextVisibility=function(a){this.g.debug("Set text visibility",a);this.h&&this.h.getTextDisplayer().setTextVisibility(a)};
43
+ _.r.release=function(){var a=this;return _.I(function(b){a.m=null;a.a=null;a.B=null;a.A=null;a.o=null;a.w=!0;a.l=null;_.z(b)})};_.r.destroy=function(){var a=this;return _.I(function(b){switch(b.a){case 1:if(!a.j){b.C(2);break}return _.x(b,a.j.stop(),3);case 3:a.j=null;case 2:if(!a.f){b.C(4);break}return _.x(b,a.f.destroy(),5);case 5:a.f=null,a.w=!0;case 4:if(!a.h){b.C(0);break}return _.x(b,a.h.destroy(),7);case 7:a.h=null,_.z(b)}})};_.w(UP,_.ot);_.r=UP.prototype;_.r.Ki=function(a){var b=a.eventid;a=a.data;switch(b){case IQ:0<Object.keys(this.f).length||(this.g.debug("Loading track manager!"),this.load());b=webapis.avplay.getCurrentStreamInfo();0<b.length&&(b=+eQ(this,b[0].extra_info).Bit_rate,b=iQ(this,{bandwidth:b}))&&(this.w=b,VP(this,b));break;case JQ:WP(this);break;default:this.g.debug("Event type: "+b+" data: "+a)}};_.r.yg=function(a){3===a.detail.currentState&&this.m.off(_.dg,this.yg)};
44
+ _.r.initialize=function(a){var b=this;this.m=a;this.a=this.m.a;this.m.on(_.dg,function(c){b.A||(c=c.detail,3===c.currentState&&(b.g.debug("Current state",c.currentState),b.A=!0,XP(b)))});this.a.on("onevent",this.Ki,this)};_.r.release=function(){this.f={};this.j=this.w=this.o=this.l=null;this.A=!1;this.h=1};
45
+ _.r.load=function(){if(this.a&&!(0<Object.keys(this.f).length)){this.j=this.m.h;this.m.off(_.dg,this.yg);this.m.on(_.dg,this.yg,this);try{var a=tQ(this.a);this.f=hQ(this,a);var b=this.f[_.X]||[];b.length&&(this.l=b[0].renditions[0]||null);WP(this)}catch(c){this.g.debug("Could not load track manager")}}};_.r.destroy=function(){this.a.off("onevent",this.Ki);this.a=this.m=null};_.r.getVideoTracks=function(){return this.f[_.Ts]||[]};_.r.getAudioTracks=function(){return this.f[_.X]||[]};
46
+ _.r.oa=function(){return this.f[_.Ss]||[]};_.r.pa=function(){return lQ(this,_.Ts)};_.r.Sa=function(){return lQ(this,_.X)};_.r.Xa=function(){return lQ(this,_.Ss)};_.r.yb=function(){return this.w};_.r.Kb=function(){this.g.info(iP);return null};_.r.Lb=function(){this.g.info(iP);return null};_.r.La=function(){var a=this.pa();return a?a.track:null};_.r.na=function(){var a=this.Sa();return a?a.track:null};_.r.va=function(){var a=this.Xa();return a?a.track:null};
47
+ _.r.Gb=function(a){var b=this;null===a?(a=this.pa(),AQ(this.a,a.bandwidth,null).then(function(){WP(b)})):0<a.renditions.length&&this.qb(a.renditions[0])};_.r.Ga=function(a){a?aQ(this,a.renditions[0]):this.g.warn("Cannot disable audio tracks on this platform.","Consider muting audio instead...")};_.r.Ya=function(a){a?(a=a.renditions[0],this.j?TP(this.j,a.track):aQ(this,a)):(this.g.debug("Disabling text tracks"),this.o=null,BQ(this.a,!1),this.m.trigger(new _.Q(_.pg)))};
48
+ _.r.qb=function(a){var b=this,c=this.pa();this.a.o||a.width!==c.width||a.height!==c.height||a.bandwidth!==c.bandwidth?(this.w=a,VP(this,a),AQ(this.a,c.bandwidth,a.bandwidth).then(function(){WP(b)})["catch"](function(d){var e=new _.N(_.O,7,7200,{tizenerror:d});b.g.debug("Error while switching video track",d);b.m.onError(e)})):this.g.debug("Trying to switch to already active rendition. Doing nothing...")};_.r.Eb=function(a){aQ(this,a)};_.r.Fb=function(a){this.j?TP(this.j,a.track):aQ(this,a)};
49
+ _.r.addTextTrack=function(){};_.r.wa=function(){return this.a.o};UP.prototype.isAbrEnabled=UP.prototype.wa;UP.prototype.addTextTrack=UP.prototype.addTextTrack;UP.prototype.setTextRendition=UP.prototype.Fb;UP.prototype.setAudioRendition=UP.prototype.Eb;UP.prototype.setVideoRendition=UP.prototype.qb;UP.prototype.setTextTrack=UP.prototype.Ya;UP.prototype.setAudioTrack=UP.prototype.Ga;UP.prototype.setVideoTrack=UP.prototype.Gb;UP.prototype.getTextTrack=UP.prototype.va;UP.prototype.getAudioTrack=UP.prototype.na;
50
+ UP.prototype.getVideoTrack=UP.prototype.La;UP.prototype.getLoadingTextRendition=UP.prototype.Lb;UP.prototype.getLoadingAudioRendition=UP.prototype.Kb;UP.prototype.getLoadingVideoRendition=UP.prototype.yb;UP.prototype.getTextRendition=UP.prototype.Xa;UP.prototype.getAudioRendition=UP.prototype.Sa;UP.prototype.getVideoRendition=UP.prototype.pa;UP.prototype.getTextTracks=UP.prototype.oa;UP.prototype.getAudioTracks=UP.prototype.getAudioTracks;UP.prototype.getVideoTracks=UP.prototype.getVideoTracks;_.w(mQ,_.yi);_.r=mQ.prototype;_.r.el=function(){this.w=!0;this.f||this.trigger(new _.Q(oP))};_.r.cl=function(a){this.w=!0;this.trigger(new _.Q(nP,{percent:a}))};_.r.al=function(){this.w=!1;this.trigger(new _.Q(mP))};_.r.hl=function(){this.trigger(new _.Q(sP))};_.r.gl=function(a,b){this.trigger(new _.Q("onevent",{eventid:a,data:b}))};_.r.il=function(a,b,c,d,e){this.trigger(new _.Q(tP,{duration:a,text:b,subtitleType:c,attriCount:d,attributes:e}))};
51
+ _.r.fl=function(a,b){this.trigger(new _.Q(qP,{drmType:a,drmData:b}));if(this.h){var c=this.h;if(c.j)if(c.a===_.Fd&&"Challenge"===b.name)EP(c,b);else if("DrmError"===b.name){c.g.debug("DrmError event",b);var d=new _.N(_.O,6,6005,{message:JSON.stringify(b)});c.D.onError(d)}}};_.r.Rd=function(a){this.trigger(new _.Q(rP,{eventType:a}))};
52
+ _.r.play=function(){function a(){return new Promise(function(d,e){function f(){d();clearTimeout(g)}var g=null;b.one(pP,f,b);g=setTimeout(function(){b.off(pP,f);e("Timeout")},3E4)})}var b=this,c=this.getState();if(c===HQ)return(new Promise(function(d,e){webapis.avplay.prepareAsync(function(){pQ(b);d(webapis.avplay.play())},function(f){b.trigger(new _.Q(rP));e(f)})})).then(function(){return a()});if(c===JP||c===GQ)try{return webapis.avplay.play(),a()}catch(d){return Promise.reject(d)}return c===IP?
53
+ Promise.resolve():Promise.reject("Player is in invalid state")};_.r.pause=function(){try{webapis.avplay.pause()}catch(a){Promise.reject(a)}return this.getState()===JP?Promise.resolve():Promise.reject()};
54
+ _.r.setPlaybackRate=function(a){var b=this.getState();if(b===GQ||b===IP||b===JP){try{webapis.avplay.setSpeed(a),this.F=a}catch(c){return this.g.debug("Error while trying to set playback rate",c),this.setPlaybackRate(this.F)}return!0}this.g.debug("Cannot set playback rate; AVPlay is in inconsistent state: "+b);return!1};_.r.getPlaybackRate=function(){return this.F};
55
+ _.r.load=function(a,b){var c=this,d;return _.I(function(e){switch(e.a){case 1:return c.g.debug("configure()",b||""),_.F(e,2),_.x(e,wQ(c),4);case 4:return _.x(e,zQ(c,a,b),5);case 5:_.G(e,0);break;case 2:throw d=_.H(e),new _.N(_.O,7,7003,null,d);}})};_.r.getState=function(){if(this.f&&this.a)return this.a.rh;try{return webapis.avplay.getState()}catch(a){this.Rd(JSON.stringify(a))}};
56
+ _.r.seek=function(a){var b=this,c=1E3*a;return new Promise(function(d,e){b.B=!0;b.m.trigger(new _.Q(_.Hg));webapis.avplay.seekTo(c,function(){b.B=!1;b.m.trigger(new _.Q(_.Gg));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.Rd(JSON.stringify(a))}};_.r.getDuration=function(){if(this.f&&this.a)return this.a.duration;try{return webapis.avplay.getDuration()/1E3}catch(a){this.Rd(JSON.stringify(a))}};
57
+ _.r.release=function(){var a=this;return new Promise(function(b,c){try{a.h&&(a.h.release(),a.h=null);webapis.avplay.stop();webapis.avplay.close();for(var d in a.j){var e=a.j[d];e&&e.If.stop()}a.j={};a.F=1;a.B=!1;a.l=null;a.a=null;return b()}catch(f){return c(f)}})};_.r.getVolume=function(){var a=null;try{a=tizen.tvaudiocontrol.getVolume()}catch(b){switch(b.name){case kP:this.g.debug("The application does not have the privilege to get the volume.",lP);break;default:this.g.debug(hP,b)}}return a};
58
+ _.r.setVolume=function(a){try{tizen.tvaudiocontrol.setVolume(Math.max(0,Math.min(100*a,100)))}catch(b){switch(b.name){case "InvalidValueError":this.g.warn("Invalid value passed for setVolume.","The passed value value should be in the range of 0 to 1.");break;case kP:this.g.warn("The application does not have the privilege to set the volume.",lP);break;default:this.g.warn("An unknown error occurred while trying to set volume",b)}}};
59
+ _.r.isLive=function(){if(this.f&&this.a)return this.a.isLive;try{return"1"===webapis.avplay.getStreamingProperty("IS_LIVE")}catch(a){this.Rd(JSON.stringify(a))}};_.r.stop=function(){try{webapis.avplay.stop()}catch(a){this.g.debug(a)}};_.r.getDrmInfo=function(){this.h&&this.h.getDrmInfo();return null};_.r.setSourceIndex=function(a){this.G=a};_.r.getSourceIndex=function(){return this.G};_.r.getLoadedSource=function(){return this.l&&this.l[this.getSourceIndex()]};
60
+ var HQ="IDLE",GQ="READY",IP="PLAYING",JP="PAUSED",fQ=_.Tb,ZP=_.ja,$P="TEXT",JQ="PLAYER_MSG_RESOLUTION_CHANGED",IQ="PLAYER_MSG_BITRATE_CHANGE",CP={PLAYREADY:"PLAYREADY",Vo:"EME_PLAYREADY",ap:"VERIMATRIX",Pe:"WIDEVINE_CDM",Wo:"EME_WIDEVINE_CDM",cp:"WIDEVINE_CLASSIC"};_.w(CQ,_.yi);_.r=CQ.prototype;_.r.Fh=function(){var a=this;this.g.debug("On Stream completed. Current time: ",this.getPosition());this.trigger(new _.Q(_.ie));this.configuration.loop?this.seek(this.configuration.startTime||0)["catch"](function(){a.g.debug("Could not loop playback")}):this.a.stop()};_.r.Ch=function(a){this.trigger(new _.Q(_.ug,{currentTime:a.currentTime/1E3}))};
61
+ _.r.Gh=function(a){var b=this.a.getPosition(),c=b+a.duration/1E3,d=a.text||"";this.g.debug("Got subtitles: ",d,"start:",b,"end:",c,a);(d=_.R.Qg(d))&&this.o.append([new _.wp(b,c,d)],[])};_.r.Dh=function(a){this.g.debug("DRM event: "+a.drmType+", data: "+a.drmData)};_.r.Li=function(){this.A||(this.g.debug("Initial buffering completed..."),this.A=!0)};
62
+ _.r.Eh=function(a){this.g.debug("Error: TYPE: "+a.eventType);HP(this.f,_.zo);a=new _.N(_.O,7,7200,{tizenerror:a.eventType});this.a.release();this.trigger(new _.Q(_.je,{detail:a}))};
63
+ _.r.init=function(a,b){this.configuration=this.B=b;this.w=a;this.a.on(sP,this.Fh,this);this.a.on(pP,this.Ch,this);this.a.on(tP,this.Gh,this);this.a.on(qP,this.Dh,this);this.a.on(rP,this.Eh,this);this.a.on(mP,this.Li,this);this.f.initialize();this.l.initialize(this);this.g.debug("Initializing player surface");this.w.hideMediaElement();var c=KQ;KQ+=1;this.j=_.Vi(_.Se,{id:"__clpp_tizen_player_"+c,type:"application/avplayer"});this.w.addElementToContainer(this.j,!0);var d=this.w.getMedia();if(d){c=this.j;
64
+ var e=[_.ah,_.oe,"position",_.we,"top"],f={};d=null!==d.parentElement?window.getComputedStyle(d,null):d.style;if(!e||0===e.length){e||(e=[]);for(var g in d)e.push(g)}g=_.v(e);for(e=g.next();!e.done;e=g.next())e=e.value,f[e]=d[e];_.Xi(c,f);DQ(this)}};_.r.getSurface=function(){return this.w};_.r.getConfiguration=function(){return this.configuration};_.r.getTimeline=function(){return null};_.r.setupPlaylist=function(){return Promise.reject(_.mb)};_.r.appendLoad=function(){return Promise.reject(_.mb)};
65
+ _.r.seekWith=function(){return Promise.reject(_.mb)};_.r.setSeekInterceptor=function(){};_.r.setPlaybackSessionId=function(){};_.r.getBandwidthEstimate=function(){return null};
66
+ _.r.destroy=function(){var a=this;return _.I(function(b){switch(b.a){case 1:return _.x(b,a.release(),2);case 2:a.a.off(sP,a.Fh);a.a.off(pP,a.Ch);a.a.off(tP,a.Gh);a.a.off(qP,a.Dh);a.a.off(rP,a.Eh);a.a.off(mP,a.Li);if(!a.h){b.C(3);break}return _.x(b,a.h.destroy(),4);case 4:a.h=null;case 3:a.j&&(a.j.parentElement.removeChild(a.j),a.j=null),a.l.destroy(),a.f.destroy(),a.l=null,a.f=null,_.z(b)}})};_.r.namespace=function(){return LQ};_.r.getPlaybackRate=function(){return this.a.getPlaybackRate()};
67
+ _.r.setDrmCustomDataModifier=function(){};_.r.setCdnErrorCallback=function(){};_.r.detach=function(){};_.r.setPlaybackRate=function(a){this.a.setPlaybackRate(a)};_.r.getPosition=function(){return this.getMediaPosition()};_.r.getMediaPosition=function(){return 0<(this.configuration.startTime||0)&&!this.A?0:5===this.f.getState()?this.getDuration():this.a.getPosition()||0};_.r.seek=function(a){return typeof a===_.k&&0<=a?(this.isLive()||(a=Math.min(a,this.getDuration())),this.a.seek(a)):Promise.reject()};
68
+ _.r.getPresentationStartTime=function(){return null};_.r.getSeekRange=function(){return{start:0,end:0}};_.r.getVolume=function(){var a=this.a.getVolume();return typeof a===_.k?a/100:null};_.r.setVolume=function(a){this.a.setVolume(a)};_.r.getDuration=function(){return this.getMediaDuration()};_.r.getMediaDuration=function(){return this.a.getDuration()};_.r.getBufferInfo=function(){this.g.warn(_.va);return new _.bi};_.r.getTrackManager=function(){return this.l};_.r.unload=function(){var a=this;return this.a.release().then(function(){a.l.release()})};
69
+ _.r.release=function(){var a=this;return _.I(function(b){switch(b.a){case 1:if(!a.h){b.C(2);break}return _.x(b,a.h.release(),2);case 2:if(!a.o){b.C(4);break}return _.x(b,a.o.destroy(),5);case 5:a.o=null;case 4:return _.x(b,a.a.release(),6);case 6:a.l.release(),a.f.release(),a.A=!1,_.z(b)}})};
70
+ _.r.load=function(a){var b=this,c,d,e,f,g;return _.I(function(h){switch(h.a){case 1:b.configuration=_.Fn([b.B,a]);c=_.Nt(b.configuration,[_.re,"native"]);b.o=c.create(b);d=_.Jn(b.configuration)[0];e=!!b.configuration.tizen&&b.configuration.tizen.sideStreamText;if(!e){h.C(2);break}b.h=new LP;b.h.initialize(b);_.F(h,3);return _.x(h,b.h.load(d),5);case 5:b.h.start();_.G(h,2);break;case 3:f=_.H(h),b.g.error(f);case 2:return _.F(h,6),_.x(h,b.a.load(b.configuration),8);case 8:_.G(h,7);break;case 6:throw g=
71
+ _.H(h),b.onError(g),g;case 7:b.l.load(),_.z(h)}})};_.r.play=function(){var a=this;this.trigger(new _.Q(_.gf));DQ(this);return this.a.play().then(function(){KP(a.f)})};_.r.pause=function(){var a=this;return this.a.pause().then(function(){KP(a.f)})};_.r.getState=function(){return this.f.getState()};_.r.getPeriods=function(){return[]};_.r.onError=function(a){var b=new _.Q(_.je,{detail:a});a.severity===_.O&&(HP(this.f,_.zo),this.a.release());this.trigger(b);b.defaultPrevented&&(b.a=!0)};
72
+ _.r.getDrmInfo=function(){return this.a.getDrmInfo()};_.r.isEnded=function(){return 5===this.f.getState()};_.r.isPaused=function(){return this.a.getState()===JP};_.r.isMuted=function(){return sQ(this.a)};_.r.setMuted=function(a){yQ(this.a,a)};_.r.getNetworkEngine=function(){return this.F};_.r.setNetworkEngine=function(a){this.F=a};_.r.setCmsdManager=function(){};_.r.isLive=function(){return this.a.isLive()};_.r.getStats=function(){return null};_.r.setSourceIndex=function(a){this.a.setSourceIndex(a)};
73
+ _.r.getSourceIndex=function(){return this.a.getSourceIndex()};_.r.getLoadedSource=function(){return this.a.getLoadedSource()};_.r.canPlay=function(a,b){return(new EQ).canPlay(a,b)};_.r.getTimelineCues=function(){return[]};_.r.getCueTimeline=function(){return null};_.r.getTextDisplayer=function(){return this.o};_.r.resetAbr=function(){};var LQ="clpp.tizen",KQ=0;EQ.prototype.a=function(){return LQ};
74
+ EQ.prototype.canPlay=function(a){a=a.type;var b=!!window.webapis;if((a===_.Gc||a===_.Il||a===_.Lc)&&b){if(_.ij(2))return 2;if(_.ij(3)||_.ij(4)||_.ij(5)||_.ij(6))return _.Lh("Use of clpp.tizen.TizenComponent is not recommended for Tizen version \x3e\x3d 3."),1}return 0};EQ.prototype.f=function(a){return a===_.pa};EQ.prototype.create=function(){return new CQ};_.w(FQ,_.Tu);FQ.prototype.install=function(){_.Vh(new EQ)};FQ.prototype.uninstall=function(){var a=LQ;a&&_.Th[a]&&(delete _.Th[a],_.Uh.info("Removed Player factory: '"+a+"'"))};FQ.prototype.id=function(){return"tizen"};_.K("clpp.tizen.TizenComponent",FQ);};
74
75
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
75
76
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
76
77
  else{_=this.clpp._;(f.call(g,this));}
package/cjs/cl.ttml.js CHANGED
@@ -1,33 +1,33 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var Jy='application/mp4; codecs\x3d"stpp.ttml"',Ky='application/mp4; codecs\x3d"stpp.ttml.im1i"',Ly='application/mp4; codecs\x3d"stpp.ttml.im1t"',My="backgroundColor",Ny="direction",Oy="displayAlign",Py="region",Qy="sans-serif",Ry="textAlign",Sy="textDecoration",Ty="writingMode",Uy=function(a,b,c){this.h=a;this.f=b;this.a=c},Vy=function(a,b,c){Uy.call(this,a,[],c);this.j=b||""},Wy=function(a,b,c){Uy.call(this,a,b,c)},Xy=function(a,b,c){a=a.f;for(var d=a.length-1;0<=d;d--){var e=b.get(a[d]);if(e.hasAttribute(c))return e.getAttribute(c)}return null},
3
- ez=function(a,b){var c=null;if(Yy.test(a)){c=Yy.exec(a);var d=Number(c[1]),e=Number(c[2]),f=Number(c[3]),g=Number(c[4]);g+=(Number(c[5])||0)/b.f;f+=g/b.frameRate;c=f+60*e+3600*d}else Zy.test(a)?c=$y(Zy,a):az.test(a)?c=$y(az,a):bz.test(a)?(c=bz.exec(a),c=Number(c[1])/b.frameRate):cz.test(a)?(c=cz.exec(a),c=Number(c[1])/b.a):dz.test(a)&&(c=$y(dz,a));return c},$y=function(a,b){var c=a.exec(b);return null==c||""===c[0]?null:(Number(c[4])||0)/1E3+(Number(c[3])||0)+60*(Number(c[2])||0)+3600*(Number(c[1])||
4
- 0)},fz=function(a){return a.split(":").pop()},gz=function(a){return a.replace(/(\d*\.?\d+)c/g,"$1em")},iz=function(a,b){for(;hz.test(a);){var c=hz.exec(a)[0];a=a.replace(c,parseInt(c,10)/b+"em")}return a},jz=function(a){return a?a.replace(/(\d*\.?\d+)%/g,function(b,c){return c/100+"em"}):""},kz=function(a,b,c,d,e,f,g){Uy.call(this,a,f,g);this.w=b;this.A=c;this.o=d;this.l=e;this.j=[]},lz=function(a,b,c){a=Xy(a,b,Ry);if(!a&&c&&(a=Xy(c,b,Ry),!a&&"rltb"===Xy(c,b,Ty)))return _.ge;switch(a){case _.id:return _.Oi;
5
- case _.Pf:case _.ge:return _.ge;default:return _.bg}},mz=function(a,b,c){if(_.Q.tf(a.w))return document.createTextNode(_.Q.Sg(a.w||""));if(a.A)return _.hr("br");for(var d=_.hr("span"),e=_.v(a.f),f=e.next();!f.done;f=e.next())_.ir(d,f.value);a=_.v(a.j);for(e=a.next();!e.done;e=a.next())d.appendChild(mz(c.get(e.value),b,c));return d},nz=function(a,b,c,d){this.frameRate=Number(a)||30;this.f=Number(b)||1;this.a=Number(d);0===this.a&&(this.a=a?this.frameRate*this.f:1);c&&(a=/^(\d+) (\d+)$/g.exec(c))&&
6
- (this.frameRate*=Number(a[1])/Number(a[2]))},oz=function(a,b,c){Uy.call(this,a,b,c)},rz=function(a,b,c,d){var e=pz.exec(a);a=qz.exec(a);return typeof b===_.k&&0<b&&a?100*Number(a[c])/b:e?Number(e[c]):a?Number(a[c]):d},sz=function(a,b){return typeof b===_.k&&0<b?_.Ui:qz.test(a)?0:_.Ui},tz=function(a,b){Uy.call(this,"root-container",[],b);this.j=a},uz=function(a,b,c){return typeof a===_.k?a:typeof b===_.k?b:c},vz=function(a,b){var c=a.getAttribute("extent");return(c=qz.exec(c))?Number(c[b]):null},xz=
7
- function(a){a=a.getAttribute("cellResolution");return(a=wz.exec(a))?Number(a[2]):null},yz=function(a,b,c){Uy.call(this,a,b,c)},zz=function(a){this.B=a;this.w=this.l=null;this.A=0;this.h=new Map;this.a=new Map;this.j=new Map;this.f=new Map;this.o=[]},Bz=function(a){return Az.some(function(b){return b in a.attributes})},Cz=function(a,b){if(0===b.length)return[];for(var c=[],d=_.v(b),e=d.next();!e.done;e=d.next())e=e.value,a.a.has(e)&&c.push.apply(c,_.hh(Cz(a,a.a.get(e).f)).concat([e]));return c},Ez=
8
- function(){return"inline-"+Dz++},Fz=function(a){return a.o.map(function(b){return b.build(a.l,a.w,a.A,a.h,a.a,a.j,a.f)}).filter(function(b){return null!=b})},Gz=function(a){this.a=a.firstChild;this.f=new Set},Hz=function(a,b,c,d,e,f){this.h=a;this.a=b;this.j=c;this.l=d;this.f=e;this.attributes=f},Iz=function(a){return fz(a.h.nodeName)},Jz=function(){this.a=new Map},Lz=function(a,b){if(a.a.has(b))return a.a.get(b);var c=null,d=null,e=[],f=[],g={},h=b.parentNode;if(h&&a.a.has(h)){var l=a.a.get(h);e=
9
- _.hh(l.l).concat();-1===[_.da,"span","br"].indexOf(b.nodeName)&&(c=l.a,d=l.j,f=_.hh(l.f).concat(),g={},Kz.forEach(function(n){n in l.attributes&&(g[n]=l.attributes[n])}))}if(b.nodeType===b.ELEMENT_NODE){b.hasAttribute(Py)&&(c=b.getAttribute(Py));b.hasAttribute(_.hg)&&f.push.apply(f,_.hh(b.getAttribute(_.hg).split(" ")));d=Array.from(b.attributes).map(function(n){return n.name});d=_.v(d);for(h=d.next();!h.done;h=d.next()){h=h.value;var m=fz(h);g[m]=b.getAttribute(h)}d=g.backgroundImage}c=new Hz(b,
10
- c,d,e,f,g);a.a.set(b,c);return c},Mz=function(a){this.a=a;this.f=new DOMParser},Nz=function(a){this.f=a},Oz=function(a){return String(Math.floor(a/3600)).padStart(2,"0")+":"+String(Math.floor(a/60%60)).padStart(2,"0")+":"+String(Math.floor(a%60)).padStart(2,"0")+"."+String(Math.floor(1E3*a%1E3)).padStart(3,"0")},Pz=function(){},Qz=function(a){this.a=new Mz(a);this.g=new _.J("clpp.ttml.Mp4TtmlParser")},Rz=function(){this.j=new Pz};Uy.prototype.getId=function(){return this.h};
11
- Uy.prototype.hasAttribute=function(a){return a in this.a};Uy.prototype.getAttribute=function(a){return this.a[a]};_.w(Vy,Uy);_.w(Wy,Uy);var Yy=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Zy=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,az=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d+)$/,bz=/^(\d*(?:\.\d*)?)f$/,cz=/^(\d*(?:\.\d*)?)t$/,dz=/^(?:(\d*(?:\.\d*)?)h)?(?:(\d*(?:\.\d*)?)m)?(?:(\d*(?:\.\d*)?)s)?(?:(\d*(?:\.\d*)?)ms)?$/,pz=/^(\d{1,2}(?:\.\d+)?|100(?:\.0+)?)% (\d{1,2}(?:\.\d+)?|100(?:\.0+)?)%$/,qz=/^(\d+)px (\d+)px$/,wz=/^(\d+) (\d+)$/,hz=/(\d+)px/,Sz=/^(\d+px|\d+em|\d*\.?\d+c)$/,Az=[My,"color",Ny,Oy,"fontFamily","fontSize","fontStyle","fontWeight",
12
- "lineHeight","opacity","padding",Ry,Sy,"textOutline",Ty,"zIndex"],Kz=["begin",_.ge];_.w(kz,Wy);
13
- kz.prototype.build=function(a,b,c,d,e,f,g){var h=ez(this.a.begin,b);b=ez(this.a.end,b);if(null===h||null===b)return null;h+=c;b+=c;c=_.hr(_.Pd);for(var l=_.v(this.j),m=l.next();!m.done;m=l.next())c.appendChild(mz(g.get(m.value),e,g));g=new _.Ti(h,b,c.innerHTML.trim(),_.vg);g.cssClassList=_.hh(this.f).concat();g.textAlign=lz(this,e,null);g.writingMode=_.Pi;g.line=-1;g.lineInterpretation=_.Qi;g.lineAlign=_.Ri;g.containerRows=uz(null,xz(a),15);if(this.o&&(f=f.get(this.o))){g.region=f.build(a,e);g.textAlign=
14
- lz(this,e,f);a:switch(Xy(f,e,Ty)){case "tb":case "tblr":a=_.Gg;break a;case "tbrl":a=_.Hg;break a;default:a=_.Pi}g.writingMode=a;a:switch(Xy(f,e,Oy)){case _.id:a=50;break a;case "after":a=-1;break a;default:a=0}g.line=a;a:switch(Xy(f,e,Oy)){case _.id:a=1;break a;default:a=_.Qi}g.lineInterpretation=a;a:switch(Xy(f,e,Oy)){case _.id:e=_.id;break a;default:e=_.Ri}g.lineAlign=e}this.l&&(a=d.get(this.l))&&(d=a.getAttribute("encoding"),e=a.getAttribute("imageType")||a.getAttribute("imagetype"),a=a.j.trim(),
15
- g.backgroundImage=("PNG"===e&&"Base64"===d&&0<a.length?"data:image/png;base64,"+a:null)||"");return g};_.w(oz,Wy);
16
- oz.prototype.build=function(a,b){var c=new _.Wi;c.id=this.getId();var d=uz(a.j.containerWidth,vz(a,1),720),e=uz(a.j.containerHeight,vz(a,2),480);a:switch(Xy(this,b,Oy)){case "after":var f="flex-start";break a;case _.id:f=_.id;break a;default:f="flex-end"}c.displayAlign=f;a:switch(Xy(this,b,Ty)){case "tb":case "tblr":f="row-reverse";break a;case "tbrl":f="row";break a;default:f=_.Ad}c.writingMode=f;f=this.getAttribute("extent")||Xy(this,b,"extent");c.width=rz(f,d,1,100);c.widthUnits=sz(f,d);c.height=
17
- rz(f,e,2,100);c.heightUnits=sz(f,e);f=this.getAttribute("origin")||Xy(this,b,"origin");c.viewportAnchorX=rz(f,d,1,0);c.viewportAnchorY=rz(f,e,2,0);c.viewportAnchorUnits=sz(f,d);c.cssClassList=_.hh(this.f).concat();return c};_.w(tz,Uy);_.w(yz,Uy);
18
- yz.prototype.build=function(a){var b=null;var c=xz(a);c&&(b=uz(a.j.containerHeight,vz(a,2),480)/c);b=uz(a.j.fontSizeRadix,b,16);a=[];c="::ttml ."+this.h+", ::ttml ."+this.h+" * {";for(var d=_.v(Tz.entries()),e=d.next();!e.done;e=d.next()){var f=_.v(e.value);e=f.next().value;f=f.next().value;e in this.a&&(c+=f+":"+gz(this.a[e])+";")}a:{if("unicodeBidi"in this.a){d=this.a.unicodeBidi;e="";switch(d){case "normal":case "embed":e=d;break;case "bidiOverride":e="bidi-override"}if(0<e.length){d="unicode-bidi:"+
19
- e+";";break a}}d=""}c+=d;a:{if("textOutline"in this.a){d=this.a.textOutline.split(" ");e="black";f=".4em";var g=d[0]&&d[0].trim(),h=d[1]&&d[1].trim(),l=d[2]&&d[2].trim();3===d.length&&!Sz.test(g)&&Sz.test(h)&&Sz.test(l)?(e=g,f=h):2===d.length&&!Sz.test(g)&&Sz.test(h)?(e=g,f=h):2===d.length&&Sz.test(g)&&Sz.test(h)&&(f=g);if(""!==f){f=gz(f);d="text-shadow:0 0 "+(f+" "+e+",0 0 ")+(f+" "+e+",0 0 ")+(f+" "+e+";");break a}}d=""}c+=d;"textShadow"in this.a?(d=jz(this.a.textShadow),d=gz(d),d="text-shadow:"+
20
- d+";"):d="";c=c+d+("fontFamily"in this.a?"font-family:"+this.a.fontFamily.replace("monospaceSansSerif","monospace").replace("monospaceSerif","monospace").replace("proportionalSansSerif",Qy).replace("proportionalSerif",Qy).replace("sansSerif",Qy).replace("default",Qy)+";":"");a:{if(Sy in this.a){d=[];e=_.v(this.a.textDecoration.split(" "));for(f=e.next();!f.done;f=e.next())switch(f=f.value,f){case "underline":case "overline":d.push(f);break;case "lineThrough":d.push("line-through")}if(0<d.length){d=
21
- "text-decoration:"+d.join(" ")+";";break a}}d=""}e="padding"in this.a?"border: solid transparent;border-width:"+gz(this.a.padding)+";":"";c=c+d+e;"lineHeight"in this.a?(d="",e=this.a.lineHeight,e=gz(e),e=iz(e,b),d=d+"line-height:"+e+";"):d="";a.push(c+d+"}");a:{if("fontSize"in this.a&&(c=this.a.fontSize.split(" "),d=null,1===c.length&&(d=c[0]),2===c.length&&(d=c[1]),d)){d=d.trim();d=gz(d);d=iz(d,b);b="font-size:"+d+";";break a}b=null}b&&(c="::ttml ."+this.h+" .clpp-text-wrapper {",a.push(c+b+"}"),
22
- c="::ttml .clpp-text-wrapper__"+this.h+" {",a.push(c+b+"}"));return a};var Tz=new Map([[My,"background-color"],["color","color"],[Ny,Ny],["fontStyle","font-style"],["fontWeight","font-weight"],["opacity","opacity"],["zIndex","z-index"]]);var Dz=0;Gz.prototype.oe=function(){return!!this.a};Gz.prototype.next=function(){if(!this.a)return null;var a=this.a;do this.f.add(a),a.nodeType!==Node.TEXT_NODE&&!Uz.has(fz(a.nodeName))||Vz.has(fz(a.nodeName))||!a.firstChild||this.f.has(a.firstChild)?a.nextSibling?a=a.nextSibling:a=a.parentNode:a=a.firstChild;while(a&&(this.f.has(a)||a.nodeType!==Node.TEXT_NODE&&!Uz.has(fz(a.nodeName))));var b=this.a;this.a=a;return b};
23
- var Uz=new Set(["tt","head","layout",_.Ke,_.te,Py,"styling",_.hg,"body",_.Pd,"p","span","br"]),Vz=new Set([_.hg,_.te]);Hz.prototype.getId=function(){return this.attributes.id};Mz.prototype.parseInit=function(){};
24
- Mz.prototype.parseMedia=function(a,b,c){c&&c.length||(c=[a.byteLength]);var d=_.L.kb(this.a.ttml||{}),e=_.Oj(a,0,c[0]);e=_.Q.ea(e);if(""===e)return{cues:[],styles:[]};var f=null;try{f=this.f.parseFromString(e,_.mg)}catch(n){throw new _.N(_.O,2,2005,"Failed to parse TTML.");}d=new zz(d);e=new Jz;f=new Gz(f);b=b.periodStart;typeof b===_.k&&(d.A=b);b=c[0];for(var g=1;g<c.length;++g){var h=c[g],l=_.Oj(a,b,h);l=_.Om(l);var m="urn:mpeg:14496-30:subs:"+g;d.h.set(m,new Vy(m,l,{imageType:"PNG",encoding:"Base64"}));
25
- b+=h}for(;f.oe();)a=f.next(),a=Lz(e,a),"tt"===Iz(a)&&(d.l=new tz(d.B,Object.assign({},a.attributes))),"tt"===Iz(a)&&(d.w=new nz(a.attributes.frameRate,a.attributes.subFrameRate,a.attributes.frameRateMultiplier,a.attributes.tickRate)),Iz(a)!==_.te||a.attributes.begin||a.attributes.end||(c="#"+a.getId(),d.h.set(c,new Vy(c,a.h.textContent,a.attributes))),Iz(a)===_.te&&a.attributes.begin&&a.attributes.end?(c="#"+Ez(),b=new Vy(c,a.h.textContent,a.attributes),d.h.set(c,b),c=b):c=null,c&&(a.j=c.getId()),
26
- Iz(a)===_.hg&&(c=a.getId()||Ez(),b=new yz(c,a.f,Object.assign({},a.attributes)),d.a.set(c,b),a.a&&d.j.get(a.a).f.push(c)),Iz(a)!==_.hg&&Bz(a)?(c=Ez(),b=new yz(c,[],Object.assign({},a.attributes)),d.a.set(c,b),c=b):c=null,c&&a.f.push(c.getId()),Iz(a)!==_.Pd||!a.attributes.extent&&!a.attributes.origin?c=null:(c=Ez(),b=new oz(c,Cz(d,a.f),Object.assign({},a.attributes)),d.j.set(c,b),c=b),c&&(a.a=c.getId()),Iz(a)!==Py?c=null:(c=a.getId(),b=new oz(c,Cz(d,a.f),Object.assign({},a.attributes)),d.j.set(c,b),
27
- c=b),c&&(a.a=c.getId()),c=a.l,-1===[_.da,"span","br"].indexOf(Iz(a))||0===c.length?c=null:(g=c[c.length-1],d.f.has(g)?(c=Ez(),b=new kz(c,a.h.nodeName===_.da?a.h.textContent:null,"br"===Iz(a),a.a,a.j,Cz(d,a.f),a.attributes),d.f.set(c,b),(g=d.f.get(g))&&g.j.push(c),c=b):c=null),c&&a.l.push(c.getId()),"p"===Iz(a)||a.j?(c=Ez(),b=new kz(c,null,!1,a.a,a.j,Cz(d,a.f),a.attributes),d.f.set(c,b),d.o.push(b),c=b):c=null,c&&a.l.push(c.getId());e=Fz(d);f=[];a=_.v(d.a.values());for(c=a.next();!c.done;c=a.next())f.push.apply(f,
28
- _.hh(c.value.build(d.l)));return{cues:e,styles:f}};Nz.prototype.a=function(a){a=(new Mz(this.f)).parseMedia(a,{periodStart:0,segmentStart:null,segmentEnd:0}).cues;var b="WEBVTT\n\n";a=_.v(a);for(var c=a.next();!c.done;c=a.next()){c=c.value;var d=Oz(c.startTime)+" --\x3e "+Oz(c.endTime),e=[];switch(c.textAlign){case _.we:e.push("align:left");break;case _.Pf:e.push("align:right");break;case _.Oi:e.push("align:middle");break;case _.bg:e.push("align:start");break;case _.ge:e.push("align:end")}switch(c.writingMode){case _.Gg:e.push("vertical:lr");break;
29
- case _.Hg:e.push("vertical:rl")}b+=d+(e.length?" "+e.join(" "):"")+"\n";b+=c.payload+"\n\n"}return _.Q.hb(b)};Pz.prototype.probe=function(a,b){return a===_.Mc&&b===_.lg};Pz.prototype.create=function(a){return new Nz(a)};Qz.prototype.parseInit=function(a){var b=!1;(new _.sn).M(_.Ne,_.tn).M(_.ug,_.tn).M(_.Ie,_.tn).M(_.Me,_.tn).M(_.eg,_.tn).aa(_.gg,_.un).M("stpp",function(c){b=!0;c.parser.stop()}).parse(a);if(!b)throw new _.N(_.O,2,2007);};
30
- Qz.prototype.parseMedia=function(a,b){var c=this,d=!1,e=[],f=[],g=[];(new _.sn).M("moof",_.tn).M("traf",_.tn).aa("subs",function(h){for(var l=_.nn(h.reader),m=0;m<l;++m){h.reader.skip(4);for(var n=_.mn(h.reader),p=0;p<n;++p){var q=1===h.version?_.nn(h.reader):_.mn(h.reader);g.push(q);h.reader.skip(6)}}}).M(_.He,_.vn(function(h){d=!0;h=c.a.parseMedia(h,b,g);e=e.concat(h.cues);f=f.concat(h.styles)})).parse(a);d||this.g.warn("Couldn't find the mdat box");return{cues:e,styles:f}};_.w(Rz,_.Fu);Rz.prototype.f=function(){_.Dv(_.Mc,Mz);_.Dv(_.Kc,Qz);_.Dv(Jy,Qz);_.Dv(Ly,Qz);_.Dv(Ky,Qz);_.gl.push(this.j)};Rz.prototype.a=function(){_.Fv(_.Mc);_.Fv(_.Kc);_.Fv(Jy);_.Fv(Ly);_.Fv(Ky);_.il(this.j)};Rz.prototype.id=function(){return"subtitles-ttml"};_.I("clpp.ttml.TtmlComponent",Rz);};
2
+ var f=function(window){var vy='application/mp4; codecs\x3d"stpp.ttml"',wy='application/mp4; codecs\x3d"stpp.ttml.im1i"',xy='application/mp4; codecs\x3d"stpp.ttml.im1t"',yy="backgroundColor",zy="direction",Ay="displayAlign",By="region",Cy="sans-serif",Dy="textAlign",Ey="textDecoration",Fy="writingMode",Gy=function(a,b,c){this.h=a;this.f=b;this.a=c},Hy=function(a,b,c){Gy.call(this,a,[],c);this.j=b||""},Iy=function(a,b,c){Gy.call(this,a,b,c)},Jy=function(a,b,c){a=a.f;for(var d=a.length-1;0<=d;d--){var e=b.get(a[d]);if(e.hasAttribute(c))return e.getAttribute(c)}return null},
3
+ Ry=function(a,b){var c=null;if(Ky.test(a)){c=Ky.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 Ly.test(a)?c=My(Ly,a):Ny.test(a)?c=My(Ny,a):Oy.test(a)?(c=Oy.exec(a),c=Number(c[1])/b.frameRate):Py.test(a)?(c=Py.exec(a),c=Number(c[1])/b.a):Qy.test(a)&&(c=My(Qy,a));return c},My=function(a,b){var c=a.exec(b);return null==c||""===c[0]?null:(Number(c[4])||0)/1E3+(Number(c[3])||0)+60*(Number(c[2])||0)+3600*(Number(c[1])||
4
+ 0)},Sy=function(a){return a.split(":").pop()},Ty=function(a){return a.replace(/(\d*\.?\d+)c/g,"$1em")},Vy=function(a,b){for(;Uy.test(a);){var c=Uy.exec(a)[0];a=a.replace(c,parseInt(c,10)/b+"em")}return a},Wy=function(a){return a?a.replace(/(\d*\.?\d+)%/g,function(b,c){return c/100+"em"}):""},Xy=function(a,b,c,d,e,f,g){Gy.call(this,a,f,g);this.w=b;this.A=c;this.o=d;this.l=e;this.j=[]},Yy=function(a,b,c){a=Jy(a,b,Dy);if(!a&&c&&(a=Jy(c,b,Dy),!a&&"rltb"===Jy(c,b,Fy)))return _.he;switch(a){case _.gd:return _.rp;
5
+ case _.Pf:case _.he:return _.he;default:return _.cg}},Zy=function(a,b,c){if(_.R.pf(a.w))return document.createTextNode(_.R.Qg(a.w||""));if(a.A)return _.Vi("br");for(var d=_.Vi("span"),e=_.v(a.f),f=e.next();!f.done;f=e.next())_.Wi(d,f.value);a=_.v(a.j);for(e=a.next();!e.done;e=a.next())d.appendChild(Zy(c.get(e.value),b,c));return d},$y=function(a,b,c,d){this.frameRate=Number(a)||30;this.f=Number(b)||1;this.a=Number(d);0===this.a&&(this.a=a?this.frameRate*this.f:1);c&&(a=/^(\d+) (\d+)$/g.exec(c))&&
6
+ (this.frameRate*=Number(a[1])/Number(a[2]))},az=function(a,b,c){Gy.call(this,a,b,c)},dz=function(a,b,c,d){var e=bz.exec(a);a=cz.exec(a);return typeof b===_.k&&0<b&&a?100*Number(a[c])/b:e?Number(e[c]):a?Number(a[c]):d},ez=function(a,b){return typeof b===_.k&&0<b?_.xp:cz.test(a)?0:_.xp},fz=function(a,b){Gy.call(this,"root-container",[],b);this.j=a},gz=function(a,b,c){return typeof a===_.k?a:typeof b===_.k?b:c},hz=function(a,b){var c=a.getAttribute("extent");return(c=cz.exec(c))?Number(c[b]):null},jz=
7
+ function(a){a=a.getAttribute("cellResolution");return(a=iz.exec(a))?Number(a[2]):null},kz=function(a,b,c){Gy.call(this,a,b,c)},lz=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=[]},nz=function(a){return mz.some(function(b){return b in a.attributes})},oz=function(a,b){if(0===b.length)return[];for(var c=[],d=_.v(b),e=d.next();!e.done;e=d.next())e=e.value,a.a.has(e)&&c.push.apply(c,_.jh(oz(a,a.a.get(e).f)).concat([e]));return c},qz=
8
+ function(){return"inline-"+pz++},rz=function(a){return a.o.map(function(b){return b.build(a.l,a.w,a.A,a.h,a.a,a.j,a.f)}).filter(function(b){return null!=b})},sz=function(a){this.a=a.firstChild;this.f=new Set},tz=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},uz=function(a){return Sy(a.h.nodeName)},vz=function(){this.a=new Map},xz=function(a,b){if(a.a.has(b))return a.a.get(b);var c=null,d=null,e=[],f=[],g={},h=b.parentNode;if(h&&a.a.has(h)){var l=a.a.get(h);e=
9
+ _.jh(l.l).concat();-1===[_.da,"span","br"].indexOf(b.nodeName)&&(c=l.a,d=l.j,f=_.jh(l.f).concat(),g={},wz.forEach(function(n){n in l.attributes&&(g[n]=l.attributes[n])}))}if(b.nodeType===b.ELEMENT_NODE){b.hasAttribute(By)&&(c=b.getAttribute(By));b.hasAttribute(_.ig)&&f.push.apply(f,_.jh(b.getAttribute(_.ig).split(" ")));d=Array.from(b.attributes).map(function(n){return n.name});d=_.v(d);for(h=d.next();!h.done;h=d.next()){h=h.value;var m=Sy(h);g[m]=b.getAttribute(h)}d=g.backgroundImage}c=new tz(b,
10
+ c,d,e,f,g);a.a.set(b,c);return c},yz=function(a){this.a=a;this.f=new DOMParser},zz=function(a){this.f=a},Az=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")},Bz=function(){},Cz=function(a){this.a=new yz(a);this.g=new _.L("clpp.ttml.Mp4TtmlParser")},Dz=function(){this.a=new Bz};Gy.prototype.getId=function(){return this.h};
11
+ Gy.prototype.hasAttribute=function(a){return a in this.a};Gy.prototype.getAttribute=function(a){return this.a[a]};_.w(Hy,Gy);_.w(Iy,Gy);var Ky=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Ly=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,Ny=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d+)$/,Oy=/^(\d*(?:\.\d*)?)f$/,Py=/^(\d*(?:\.\d*)?)t$/,Qy=/^(?:(\d*(?:\.\d*)?)h)?(?:(\d*(?:\.\d*)?)m)?(?:(\d*(?:\.\d*)?)s)?(?:(\d*(?:\.\d*)?)ms)?$/,bz=/^(\d{1,2}(?:\.\d+)?|100(?:\.0+)?)% (\d{1,2}(?:\.\d+)?|100(?:\.0+)?)%$/,cz=/^(\d+)px (\d+)px$/,iz=/^(\d+) (\d+)$/,Uy=/(\d+)px/,Ez=/^(\d+px|\d+em|\d*\.?\d+c)$/,mz=[yy,"color",zy,Ay,"fontFamily","fontSize","fontStyle","fontWeight",
12
+ "lineHeight","opacity","padding",Dy,Ey,"textOutline",Fy,"zIndex"],wz=["begin",_.he];_.w(Xy,Iy);
13
+ Xy.prototype.build=function(a,b,c,d,e,f,g){var h=Ry(this.a.begin,b);b=Ry(this.a.end,b);if(null===h||null===b)return null;h+=c;b+=c;c=_.Vi(_.Pd);for(var l=_.v(this.j),m=l.next();!m.done;m=l.next())c.appendChild(Zy(g.get(m.value),e,g));g=new _.wp(h,b,c.innerHTML.trim(),_.yg);g.cssClassList=_.jh(this.f).concat();g.textAlign=Yy(this,e,null);g.writingMode=_.sp;g.line=-1;g.lineInterpretation=_.tp;g.lineAlign=_.up;g.containerRows=gz(null,jz(a),15);if(this.o&&(f=f.get(this.o))){g.region=f.build(a,e);g.textAlign=
14
+ Yy(this,e,f);a:switch(Jy(f,e,Fy)){case "tb":case "tblr":a=_.Kg;break a;case "tbrl":a=_.Lg;break a;default:a=_.sp}g.writingMode=a;a:switch(Jy(f,e,Ay)){case _.gd:a=50;break a;case "after":a=-1;break a;default:a=0}g.line=a;a:switch(Jy(f,e,Ay)){case _.gd:a=1;break a;default:a=_.tp}g.lineInterpretation=a;a:switch(Jy(f,e,Ay)){case _.gd:e=_.gd;break a;default:e=_.up}g.lineAlign=e}this.l&&(a=d.get(this.l))&&(d=a.getAttribute("encoding"),e=a.getAttribute("imageType")||a.getAttribute("imagetype"),a=a.j.trim(),
15
+ g.backgroundImage=("PNG"===e&&"Base64"===d&&0<a.length?"data:image/png;base64,"+a:null)||"");return g};_.w(az,Iy);
16
+ az.prototype.build=function(a,b){var c=new _.zp;c.id=this.getId();var d=gz(a.j.containerWidth,hz(a,1),720),e=gz(a.j.containerHeight,hz(a,2),480);a:switch(Jy(this,b,Ay)){case "after":var f="flex-start";break a;case _.gd:f=_.gd;break a;default:f="flex-end"}c.displayAlign=f;a:switch(Jy(this,b,Fy)){case "tb":case "tblr":f="row-reverse";break a;case "tbrl":f="row";break a;default:f=_.zd}c.writingMode=f;f=this.getAttribute("extent")||Jy(this,b,"extent");c.width=dz(f,d,1,100);c.widthUnits=ez(f,d);c.height=
17
+ dz(f,e,2,100);c.heightUnits=ez(f,e);f=this.getAttribute("origin")||Jy(this,b,"origin");c.viewportAnchorX=dz(f,d,1,0);c.viewportAnchorY=dz(f,e,2,0);c.viewportAnchorUnits=ez(f,d);c.cssClassList=_.jh(this.f).concat();return c};_.w(fz,Gy);_.w(kz,Gy);
18
+ kz.prototype.build=function(a){var b=null;var c=jz(a);c&&(b=gz(a.j.containerHeight,hz(a,2),480)/c);b=gz(a.j.fontSizeRadix,b,16);a=[];c="::ttml ."+this.h+", ::ttml ."+this.h+" * {";for(var d=_.v(Fz.entries()),e=d.next();!e.done;e=d.next()){var f=_.v(e.value);e=f.next().value;f=f.next().value;e in this.a&&(c+=f+":"+Ty(this.a[e])+";")}a:{if("unicodeBidi"in this.a){d=this.a.unicodeBidi;e="";switch(d){case "normal":case "embed":e=d;break;case "bidiOverride":e="bidi-override"}if(0<e.length){d="unicode-bidi:"+
19
+ e+";";break a}}d=""}c+=d;a:{if("textOutline"in this.a){d=this.a.textOutline.split(" ");e="black";f=".4em";var g=d[0]&&d[0].trim(),h=d[1]&&d[1].trim(),l=d[2]&&d[2].trim();3===d.length&&!Ez.test(g)&&Ez.test(h)&&Ez.test(l)?(e=g,f=h):2===d.length&&!Ez.test(g)&&Ez.test(h)?(e=g,f=h):2===d.length&&Ez.test(g)&&Ez.test(h)&&(f=g);if(""!==f){f=Ty(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=Wy(this.a.textShadow),d=Ty(d),d="text-shadow:"+
20
+ d+";"):d="";c=c+d+("fontFamily"in this.a?"font-family:"+this.a.fontFamily.replace("monospaceSansSerif","monospace").replace("monospaceSerif","monospace").replace("proportionalSansSerif",Cy).replace("proportionalSerif",Cy).replace("sansSerif",Cy).replace("default",Cy)+";":"");a:{if(Ey in this.a){d=[];e=_.v(this.a.textDecoration.split(" "));for(f=e.next();!f.done;f=e.next())switch(f=f.value,f){case "underline":case "overline":d.push(f);break;case "lineThrough":d.push("line-through")}if(0<d.length){d=
21
+ "text-decoration:"+d.join(" ")+";";break a}}d=""}e="padding"in this.a?"border: solid transparent;border-width:"+Ty(this.a.padding)+";":"";c=c+d+e;"lineHeight"in this.a?(d="",e=this.a.lineHeight,e=Ty(e),e=Vy(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=Ty(d);d=Vy(d,b);b="font-size:"+d+";";break a}b=null}b&&(c="::ttml ."+this.h+" .clpp-text-wrapper {",a.push(c+b+"}"),
22
+ c="::ttml .clpp-text-wrapper__"+this.h+" {",a.push(c+b+"}"));return a};var Fz=new Map([[yy,"background-color"],["color","color"],[zy,zy],["fontStyle","font-style"],["fontWeight","font-weight"],["opacity","opacity"],["zIndex","z-index"]]);var pz=0;sz.prototype.je=function(){return!!this.a};sz.prototype.next=function(){if(!this.a)return null;var a=this.a;do this.f.add(a),a.nodeType!==Node.TEXT_NODE&&!Gz.has(Sy(a.nodeName))||Hz.has(Sy(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&&!Gz.has(Sy(a.nodeName))));var b=this.a;this.a=a;return b};
23
+ var Gz=new Set(["tt","head","layout",_.Le,_.te,By,"styling",_.ig,"body",_.Pd,"p","span","br"]),Hz=new Set([_.ig,_.te]);tz.prototype.getId=function(){return this.attributes.id};yz.prototype.parseInit=function(){};
24
+ yz.prototype.parseMedia=function(a,b,c){c&&c.length||(c=[a.byteLength]);var d=_.M.ib(this.a.ttml||{}),e=_.Mi(a,0,c[0]);e=_.R.ea(e);if(""===e)return{cues:[],styles:[]};var f=null;try{f=this.f.parseFromString(e,_.og)}catch(n){throw new _.N(_.O,2,2005,"Failed to parse TTML.");}d=new lz(d);e=new vz;f=new sz(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=_.Mi(a,b,h);l=_.Am(l);var m="urn:mpeg:14496-30:subs:"+g;d.h.set(m,new Hy(m,l,{imageType:"PNG",encoding:"Base64"}));
25
+ b+=h}for(;f.je();)a=f.next(),a=xz(e,a),"tt"===uz(a)&&(d.l=new fz(d.B,Object.assign({},a.attributes))),"tt"===uz(a)&&(d.w=new $y(a.attributes.frameRate,a.attributes.subFrameRate,a.attributes.frameRateMultiplier,a.attributes.tickRate)),uz(a)!==_.te||a.attributes.begin||a.attributes.end||(c="#"+a.getId(),d.h.set(c,new Hy(c,a.h.textContent,a.attributes))),uz(a)===_.te&&a.attributes.begin&&a.attributes.end?(c="#"+qz(),b=new Hy(c,a.h.textContent,a.attributes),d.h.set(c,b),c=b):c=null,c&&(a.j=c.getId()),
26
+ uz(a)===_.ig&&(c=a.getId()||qz(),b=new kz(c,a.f,Object.assign({},a.attributes)),d.a.set(c,b),a.a&&d.j.get(a.a).f.push(c)),uz(a)!==_.ig&&nz(a)?(c=qz(),b=new kz(c,[],Object.assign({},a.attributes)),d.a.set(c,b),c=b):c=null,c&&a.f.push(c.getId()),uz(a)!==_.Pd||!a.attributes.extent&&!a.attributes.origin?c=null:(c=qz(),b=new az(c,oz(d,a.f),Object.assign({},a.attributes)),d.j.set(c,b),c=b),c&&(a.a=c.getId()),uz(a)!==By?c=null:(c=a.getId(),b=new az(c,oz(d,a.f),Object.assign({},a.attributes)),d.j.set(c,b),
27
+ c=b),c&&(a.a=c.getId()),c=a.l,-1===[_.da,"span","br"].indexOf(uz(a))||0===c.length?c=null:(g=c[c.length-1],d.f.has(g)?(c=qz(),b=new Xy(c,a.h.nodeName===_.da?a.h.textContent:null,"br"===uz(a),a.a,a.j,oz(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"===uz(a)||a.j?(c=qz(),b=new Xy(c,null,!1,a.a,a.j,oz(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=rz(d);f=[];a=_.v(d.a.values());for(c=a.next();!c.done;c=a.next())f.push.apply(f,
28
+ _.jh(c.value.build(d.l)));return{cues:e,styles:f}};zz.prototype.a=function(a){a=(new yz(this.f)).parseMedia(a,{periodStart:0,segmentStart:null,segmentEnd:0}).cues;var b="WEBVTT\n\n";a=_.v(a);for(var c=a.next();!c.done;c=a.next()){c=c.value;var d=Az(c.startTime)+" --\x3e "+Az(c.endTime),e=[];switch(c.textAlign){case _.we:e.push("align:left");break;case _.Pf:e.push("align:right");break;case _.rp:e.push("align:middle");break;case _.cg:e.push("align:start");break;case _.he:e.push("align:end")}switch(c.writingMode){case _.Kg:e.push("vertical:lr");break;
29
+ case _.Lg:e.push("vertical:rl")}b+=d+(e.length?" "+e.join(" "):"")+"\n";b+=c.payload+"\n\n"}return _.R.eb(b)};Bz.prototype.probe=function(a,b){return a===_.Kc&&b===_.ng};Bz.prototype.create=function(a){return new zz(a)};Cz.prototype.parseInit=function(a){var b=!1;(new _.fq).M(_.Oe,_.gq).M(_.xg,_.gq).M(_.Je,_.gq).M(_.Ne,_.gq).M(_.fg,_.gq).ba(_.hg,_.hq).M("stpp",function(c){b=!0;c.parser.stop()}).parse(a);if(!b)throw new _.N(_.O,2,2007);};
30
+ Cz.prototype.parseMedia=function(a,b){var c=this,d=!1,e=[],f=[],g=[];(new _.fq).M("moof",_.gq).M("traf",_.gq).ba("subs",function(h){for(var l=_.aq(h.reader),m=0;m<l;++m){h.reader.skip(4);for(var n=_.$p(h.reader),p=0;p<n;++p){var q=1===h.version?_.aq(h.reader):_.$p(h.reader);g.push(q);h.reader.skip(6)}}}).M(_.Ie,_.iq(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(Dz,_.Tu);Dz.prototype.install=function(){_.zv(_.Kc,yz);_.zv(_.Ic,Cz);_.zv(vy,Cz);_.zv(xy,Cz);_.zv(wy,Cz);_.lt.push(this.a)};Dz.prototype.uninstall=function(){_.Bv(_.Kc);_.Bv(_.Ic);_.Bv(vy);_.Bv(xy);_.Bv(wy);_.nt(this.a)};Dz.prototype.id=function(){return"subtitles-ttml"};_.K("clpp.ttml.TtmlComponent",Dz);};
31
31
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
32
32
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
33
33
  else{_=this.clpp._;(f.call(g,this));}