@castlabs/prestoplay 6.32.0-beta.3 → 6.32.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 +5 -0
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +18 -18
  5. package/cjs/cl.cast.js +126 -126
  6. package/cjs/cl.conviva.js +32 -32
  7. package/cjs/cl.core.js +604 -604
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +101 -101
  10. package/cjs/cl.externs.js +1 -29
  11. package/cjs/cl.freewheel.js +26 -26
  12. package/cjs/cl.hls.js +77 -77
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +30 -30
  15. package/cjs/cl.ima.js +26 -26
  16. package/cjs/cl.mediatailor.js +3 -3
  17. package/cjs/cl.mse.js +352 -352
  18. package/cjs/cl.muxdata.js +14 -14
  19. package/cjs/cl.onboard.js +4 -4
  20. package/cjs/cl.persistent.js +14 -14
  21. package/cjs/cl.playlist.js +6 -6
  22. package/cjs/cl.simid.js +16 -16
  23. package/cjs/cl.smooth.js +71 -71
  24. package/cjs/cl.thumbnails.js +25 -25
  25. package/cjs/cl.tizen.js +71 -71
  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 +18 -18
  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 +2 -2
  34. package/cl.adobe.js +3 -3
  35. package/cl.airplay.js +3 -3
  36. package/cl.broadpeak.js +14 -14
  37. package/cl.cast.js +100 -100
  38. package/cl.conviva.js +27 -27
  39. package/cl.core.js +488 -487
  40. package/cl.crypto.js +8 -8
  41. package/cl.dash.js +75 -75
  42. package/cl.externs.js +1 -25
  43. package/cl.freewheel.js +20 -20
  44. package/cl.hls.js +65 -65
  45. package/cl.hlssmpte.js +5 -5
  46. package/cl.htmlcue.js +26 -26
  47. package/cl.ima.js +19 -19
  48. package/cl.mediatailor.js +2 -2
  49. package/cl.mse.js +200 -200
  50. package/cl.muxdata.js +12 -12
  51. package/cl.onboard.js +3 -3
  52. package/cl.persistent.js +8 -8
  53. package/cl.playlist.js +4 -4
  54. package/cl.simid.js +2 -2
  55. package/cl.smooth.js +47 -47
  56. package/cl.thumbnails.js +12 -12
  57. package/cl.tizen.js +41 -41
  58. package/cl.ttml.js +10 -10
  59. package/cl.verimatrix.js +4 -4
  60. package/cl.vimond.js +8 -8
  61. package/cl.vr.js +3 -3
  62. package/cl.vtt.js +11 -11
  63. package/cl.yospace.js +3 -3
  64. package/cl.youbora.js +27 -27
  65. package/package.json +1 -1
  66. package/typings.d.ts +6 -22
  67. package/cjs/cl.cdn.js +0 -13
  68. package/cl.cdn.js +0 -7
package/cjs/cl.tizen.js CHANGED
@@ -1,77 +1,77 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var uP="An unknown error occurred while trying to get volume",vP="Cannot get loading rendition due to platform limitations",wP="PARAM_START_POSITION",xP="SecurityError",yP="The require privilege is: http://tizen.org/privilege/tv.audio",zP="onbufferingcomplete",AP="onbufferingprogress",BP="onbufferingstart",CP="oncurrentplaytime",DP="ondrmevent",EP="onerror",FP="onstreamcompleted",GP="onsubtitlechange",HP="preparingend",IP="preparingstart",JP="|STARTBITRATE\x3d",KP=function(a,b,c){function d(e){c.call(a,
3
- e);a.removeEventListener(b,d)}a.addEventListener(b,d)},LP=function(a,b){this.h=a;this.o=null;this.a=_.Ze;this.l=null;this.j=!1;this.f=new Map;this.F=b;this.g=new _.M("clpp.tizen.DrmEngine")},OP=function(a){var b,c,d;return _.I(function(e){if(1==e.a){b=a.a===_.Md||a.a===_.Kd;if(!b)throw new _.O(_.P,6,6001,"The key system "+a.a+" is not supported by the player or the platform");c=a.f.get(a.a);if(!c.Pe)throw new _.O(_.P,6,6012,"No license server given for "+a.a);_.F(e,2);return a.a===_.Md?_.y(e,MP(a),
4
- 5):_.y(e,NP(a,c),5)}if(2!=e.a)return a.o={keySystem:a.a,licenseServerUri:c.Pe,distinctiveIdentifierRequired:!1,persistentStateRequired:c.gh,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[],keyIds:[],periodId:null},_.G(e,0);d=_.H(e);a.g.error("Error while configuring CDM for "+a.a,d);throw new _.O(_.P,6,6005,{message:JSON.stringify(d)});})},NP=function(a,b){var c,d,e,f;return _.I(function(g){c=PP;d=QP;e={};e[d.gk]=!b.gh;e[d.ik]=b.Pe;""!==b.customData&&(e[d.ek]=b.customData);
5
- f=JSON.stringify(e);a.g.debug("PlayReady properties: ",f);try{webapis.avplay.setDrm(c.PLAYREADY,"SetProperties",f)}catch(k){throw k;}_.A(g)})},MP=function(a){var b;return _.I(function(c){b=PP;try{webapis.avplay.setDrm(b.qf,"Initialize",""),webapis.avplay.setDrm(b.qf,"widevine_app_session",a.l.id),webapis.avplay.setDrm(b.qf,"widevine_data_type",a.l.type)}catch(d){throw d;}_.A(c)})},RP=function(a,b){var c,d,e,f,g,k,l,m,n,p,q,t,u,z,B,D,C;_.I(function(E){if(1==E.a){c=PP;d=a.f.get(a.a);a.g.debug("DRM Challenge data: ",
6
- b.challenge);e=atob(b.challenge);f=new Uint8Array(e.length);for(g=0;g<e.length;++g)f[g]=e.charCodeAt(g);k=b.serverurl&&""!==b.serverurl?b.serverurl:d.Pe;l=_.dl([k],_.Zk());l.type=3;l.body=f.buffer;l.method=_.rb;_.F(E,2);return _.y(E,a.F.Mb.fetch(l).U,4)}if(2!=E.a){m=E.f;if(a.j){n=_.Vi(m.data);p=n.byteLength;q="";for(t=0;t<p;t++)q+=String.fromCharCode(n[t]);u=btoa(q);z=b.session_id+wP+(u+wP);a.g.debug("Widevine license params",z);try{webapis.avplay.setDrm(c.qf,"widevine_license_data",z)}catch(x){a.g.error("License response rejected by CDM"),
7
- B=new _.O(_.P,6,6008,{browserError:JSON.stringify(x)}),a.F.onError(B)}}return _.G(E,0)}D=_.H(E);a.g.error("License request failed.",JSON.stringify(D));C=new _.O(_.P,6,6007,{message:"Error while fetching license!",url:D.data.url,status:D.data.status||NaN,response:D.data.response||"",headers:D.data.headers||{}},D);a.F.onError(C);_.A(E)})},SP=function(a){this.m=a;this.a=this.m.a;this.f=_.mu;this.j=7;this.w=(new Date).getTime();this.l=!1;this.o=-1;this.h=2;this.g=new _.M("clpp.tizen.StateManager")},UP=
8
- function(a,b){if(a.f!==b)if(a.f===_.Fo&&b!==_.mu)a.g.debug(_.MB+TP(b));else{var c=(new Date).getTime();a.j=a.f;a.f=b;2===a.f?(a.o=(new Date).getTime(),a.m.trigger(new _.Q(_.ed,{detail:{bufferedTimeMS:-1,reason:a.h}}))):2===a.j&&a.m.trigger(new _.Q(_.dd,{detail:{bufferedTimeMS:c-a.o,reason:a.h}}));var d={currentState:a.f,previousState:a.j,timeSinceLastStateChangeMS:c-a.w};a.w=c;a.m.trigger(new _.Q(_.kg,{detail:d}));a.g.debug("State changed:",TP(a.j),"-\x3e",TP(a.f))}},TP=function(a){return Object.keys(_.tu)[a]},
9
- XP=function(a){if(a.l){var b=a.a.getState(),c=a.f;switch(b){case VP:c=3;break;case WP:c=4;break;default:a.m.isEnded()?c=5:a.g.debug("Inconsistent AVPlay playback state:",b)}UP(a,c)}},YP=function(){this.o=this.A=this.f=this.h=this.B=this.m=this.j=this.a=null;this.D=!1;this.w=!0;this.l=null;this.g=new _.M("clpp.tizen.TextStreamer")},ZP=function(a){if(!a)return!1;a=a.periods;for(var b=!1,c=0;c<a.length;c++)b=b||0<a[c].textStreams.length;return b},$P=function(a){var b,c;return _.I(function(d){if(1==d.a)return b=
10
- a.m.getConfiguration(),c=null,_.y(d,_.cw(a.B.url,a.m.getNetworkEngine(),b.manifest.attemptParameters,a.B.type||null),2);(c=d.f)&&c.configure(b.manifest);return d["return"](c)})},aQ=function(a){var b=document.createElement(_.Tg),c=new _.nF,d=new _.ZC,e=a.m.getTextDisplayer();return new _.pF(b,c,e,d,a.m.getConfiguration())},bQ=function(a){var b={configuration:{},Ib:function(){return a.m.getPosition()},Y:a.h,Mb:a.m.getNetworkEngine(),Dd:null,Wg:a.Pl.bind(a),nj:a.Ol.bind(a),onError:a.Ql.bind(a),oj:function(){},
11
- onEvent:function(){},sj:a.Rl.bind(a),Yf:function(){},ye:function(){return new _.cG},Ag:function(){return!1},re:null};return new _.JG(a.a,b)},cQ=function(a){var b=a.m.getPosition(),c=null;a=_.v(a.a.periods);for(var d=a.next();!d.done;d=a.next())d=d.value,d.startTime<=b&&(c=d);return c},dQ=function(a){a.g.debug("getTextStreams()",a.a);if(a.a){var b=[],c=a.a.periods;a.g.debug("getting text streams");for(var d=0;d<c.length;d++)if(a.g.debug(c[d].startTime,a.m.getPosition()),c[d].startTime<=a.m.getPosition()){b=
12
- c[d].textStreams;break}a=b}else a=[];b=[];for(d=c=0;d<a.length;d++){var e=new _.ht(String(c++),_.jt);e.mimeType=a[d].mimeType;e.language=a[d].language;e.roles=a[d].roles;e.kind=a[d].kind||_.jC;var f=new _.pt(String(a[d].id),e);f.bandwidth=a[d].bandwidth||null;e.renditions.push(f);b.push(e)}return b},eQ=function(a){if(a.h&&!a.h.getTextDisplayer().isTextVisible())return null;if(a.f){var b=_.MG(a.f,_.Gn),c=null;if(b){a=dQ(a);for(var d=0;d<a.length;d++)if(a[d].renditions[0].id===String(b.id)){c=a[d].renditions[0];
13
- break}}return c}return null},fQ=function(a,b){var c,d,e,f;_.I(function(g){if(1==g.a){c=_.cJ;a.g.debug("Set active track",b);if(!b)return g.C(0);a.o=b.language;a.A=b.roles[0]||"";a.D=b.kind===c.Jh;if(!a.a||!a.f)return g.C(0);a.setTextVisibility(!0);d=cQ(a);e=b.renditions[0];f=d.textStreams.find(function(k){return String(k.id)===e.id});return f?a.w?(a.g.debug("Switching period defer text selection"),a.l=f,g.C(4)):_.y(g,_.fH(a.f,f),5):(a.g.error("No stream with id",e.id),g["return"]())}4!=g.a&&a.m.trigger(new _.Q(_.wg));
14
- a.o=f.language;_.A(g)})},gQ=function(){this.j=this.a=this.m=null;this.f={};this.g=new _.M("clpp.tizen.TrackManager");this.w=this.o=this.l=null;this.A=!1;this.h=1},hQ=function(a,b){a.m.trigger(new _.Q(_.Xg,{details:{width:b.width,height:b.height,bandwidth:b.bandwidth,track:b.track,abrSelection:a.a.o}}))},iQ=function(a){var b=a.sa();b&&a.m.trigger(new _.Q(_.bd,{detail:{width:b.width,height:b.height,bandwidth:b.bandwidth,rendition:b}}))},jQ=function(a){var b=a.m.getConfiguration(),c=_.Ni(b.preferredAudioLanguage||
15
- []),d=a.f[_.X]||[];if(d.length){var e=null;c.some(function(g){e=_.QC(g,d.map(function(k){return k.language}));return!!e});if(e){var f=d.filter(function(g){return g.language===e});c=f[0];1<f.length&&b.preferredAudioRole&&(f=f.filter(function(g){return 0<=g.roles.indexOf(b.preferredAudioRole)}),0<f.length&&(c=f[0]));a.g.debug("Setting audio track with preferred language:",e);a.La(c)}else a.g.debug("Preferred language(s) not available")}else a.g.debug("Could not set preferred audio language")},nQ=function(a,
16
- b){if(b){var c=b.track.type.toUpperCase();kQ(a.a,c,Number(b.id)).then(function(){c===lQ&&(a.l=b,a.m.trigger(new _.Q(_.$c)));c===mQ&&(a.o=b,a.m.trigger(new _.Q(_.wg)))})["catch"](function(){a.g.error("Could not select "+c+" track.")})}else a.g.debug("Must provide valid rendition")},oQ=function(a,b,c){var d=_.vo(b.language||_.Gg);c.language=_.it(d);c.originalLanguage=d;c.channelsCount=b.channels?Number(b.channels):null;c.mimeType=_.Xc;a=new _.pt(String(a),c);a.track=c;a.codec=b.fourCC||null;a.bandwidth=
17
- b.bit_rate||null;return a},pQ=function(a,b,c){c.mimeType=_.Vg;a=new _.pt(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},qQ=function(a,b,c){b=_.vo(b.track_lang||_.Gg);c.mimeType="text/ttml";c.language=_.it(b);c.originalLanguage=b;c.kind=_.jC;return new _.pt(String(a),c)},rQ=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
- uQ=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===sQ}),f=b.filter(function(n){return n.type===lQ}),g=[],k=0;k<f.length;k++){var l=rQ(a,f[k].extra_info);if(l){var m=_.vo(l.language||_.Gg);m=_.it(m);m=c(g,m);m||(m=new _.ht(String(a.h++),_.X),g.push(m));m.renditions.push(oQ(f[k].index,l,m))}else a.g.warn("Skipping audio stream with no extra info")}f=new _.ht(String(a.h++),
19
- _.kt);for(k=0;k<e.length;k++)(l=rQ(a,e[k].extra_info))?f.renditions.push(pQ(e[k].index,l,f)):a.g.warn("Skipping video stream with no extra info");e=[];e=a.j?dQ(a.j):tQ(a,b);d[_.kt]=[f];d[_.X]=g;d[_.jt]=e;return d},tQ=function(a,b){for(var c=b.filter(function(k){return k.type===mQ}),d=[],e=0;e<c.length;e++){var f=rQ(a,c[e].extra_info);if(f){var g=new _.ht(String(a.h++),_.jt);g.renditions.push(qQ(c[e].index,f,g));d.push(g)}else a.g.warn("Skipping text stream with no extra info")}return d},vQ=function(a,
20
- b){for(var c=a.f[_.kt]||[],d=[],e=0;e<c.length;e++)for(var f=0;f<c[e].renditions.length;f++)_.N.ua(c[e].renditions[f],b,Object.keys(b))&&d.push(c[e].renditions[f]);return d[0]||null},wQ=function(a,b,c){a=a.f[c]||[];b=String(b.index);c=null;for(var d=0;d<a.length;d++)for(var e=0;e<a[d].renditions.length;e++)if(a[d].renditions[e].id===b){c=a[d].renditions[e];break}return c},yQ=function(a,b){if(b===_.jt&&a.j)return eQ(a.j);var c=xQ(a.a)||[];if(0===c.length)return null;c=c.filter(function(e){return e.type===
21
- b.toUpperCase()})[0];var d=null;b===_.kt&&(d=rQ(a,c.extra_info),d=vQ(a,{width:d.Width,height:d.Height}));b===_.X&&(c?(d=wQ(a,c,_.X),a.l=d):d=a.l);b===_.jt&&(c?(d=wQ(a,c,_.jt),a.o=d):d=a.o);return d},zQ=function(a){_.Ii.call(this);this.m=a;this.h=null;this.g=new _.M("clpp.tizen.Middleware");this.D=1;this.B=!1;this.l=null;this.G=0;this.o=!0;this.f=!1;this.a=null;this.A=1;this.w=!1;this.j={}},AQ=function(a){return _.I(function(b){tizen.systeminfo.getPropertyValue("DISPLAY",function(c){a.A=c.resolutionWidth/
22
- 1920;a.g.debug("Display resolution ratio: ",a.A)},function(c){a.g.debug("Could not load DISPLAY property");throw c;});_.A(b)})},BQ=function(a){try{webapis.avplay.setListener({onbufferingstart:a.Jl.bind(a),onbufferingprogress:a.Il.bind(a),onbufferingcomplete:a.Hl.bind(a),onstreamcompleted:a.Ml.bind(a),oncurrentplaytime:function(b){a.trigger(new _.Q(CP,{currentTime:b}))},onevent:a.Ll.bind(a),onsubtitlechange:a.Nl.bind(a),ondrmevent:a.Kl.bind(a),onerror:a.ne.bind(a)})}catch(b){a.g.error(b)}},CQ=function(a){var b=
23
- !!a.m.getTrackManager().hb();try{webapis.avplay.setSilentSubtitle(!b)}catch(c){a.g.debug("Could not set AVPlay subtitle config",c)}},DQ=function(a,b){try{var c=b.estimatedBandwidth||0,d=b.currentBandwidth||0;a.g.debug({estimatedBandwidth:c,Tp:d});0!==c&&0!==d&&c>=1.15*d&&webapis.avplay.setStreamingProperty("ADAPTIVE_INFO",JP+d)}catch(e){a.g.debug(e)}},EQ=function(a,b){try{webapis.avplay.setStreamingProperty("ADAPTIVE_INFO","|BITRATES\x3d"+b+JP+b)}catch(c){throw a.g.debug("Could not set fixed bandwidth",
24
- c),c;}},HQ=function(a){return{position:a.getPosition(),state:a.m.getState(),Th:a.getState(),playbackRate:a.getPlaybackRate(),isLive:a.isLive(),duration:a.getDuration(),isMuted:FQ(a),volume:a.getVolume(),np:GQ(a),bm:xQ(a)}},JQ=function(a){var b,c;return _.I(function(d){if(1==d.a)return _.y(d,IQ(),2);if(3!=d.a)return b=new Promise(function(e){(new _.lj(e)).ia(5)}),_.y(d,Promise.race([AQ(a).then(function(){return!0}),b.then(function(){return!1})]),3);c=d.f;if(!c)return a.g.debug("Took to long for the SDK to be ready"),
25
- d["return"](Promise.reject("SDK Timeout"));_.A(d)})},MQ=function(a,b,c){var d,e,f,g,k,l,m,n;return _.I(function(p){switch(p.a){case 1:a.l=_.Vn(b);d=a.G;e=c||{estimatedBandwidth:0,currentBandwidth:0,nextBandwidth:null,currentPosition:0};a.g.debug("Loading manifest URL: "+a.l[d].url);f=b.startTime||void 0;a.f&&(a.trigger(new _.Q(BP)),f=c.currentPosition);_.F(p,2);g=a.l[d].url;k=a.l[d].type;k!==_.Lc||g.includes(".mpd")||(l=new URL(g),l.searchParams.append("cl-ext",".mpd"),g=l.toString());webapis.avplay.open(g);
26
- e.nextBandwidth?(EQ(a,e.nextBandwidth),a.o=!1):(a.o||DQ(a,e),a.o=!0);BQ(a);if(!b.drm||!b.drm.env){a.g.debug("No DRM configuration was provided. Assuming clear content");p.C(4);break}m={onError:function(q){return a.m.onError(q)},Mb:a.m.getNetworkEngine()};a.h=new LP(b.drm,m);return _.y(p,a.h.init(),4);case 4:return a.f||a.trigger(new _.Q(IP)),_.y(p,KQ(a),6);case 6:a.f||a.trigger(new _.Q(HP));f&&typeof f===_.h&&0<f&&a.seek(f)["catch"](function(q){a.g.debug("Couldn't set start position",q)});a.f||(b.volume&&
27
- a.setVolume(b.volume),b.muted&&LQ(a,b.muted),b.autoplay&&a.m.play()["catch"](function(q){a.g.debug("Autoplay failed",q)}));_.G(p,0);break;case 2:throw n=_.H(p),a.g.debug("Error while attempting to load source."),n;}})},KQ=function(a){return _.I(function(b){a.g.debug("avplay.prepare()");return b["return"](new Promise(function(c,d){try{webapis.avplay.prepareAsync(function(){a.g.debug("AVPlay is ready!");CQ(a);c()},function(e){a.g.debug("prepareAsync failed",e);d(e)})}catch(e){a.g.debug("Failed to prepare media player for playback"),
28
- d(e)}}))})},NQ=function(a,b,c){a.g.debug("switchVideoTrack()");try{var d={estimatedBandwidth:parseInt(webapis.avplay.getStreamingProperty("CURRENT_BANDWITH"),10),currentBandwidth:b,nextBandwidth:c,currentPosition:a.getPosition()};a.a=HQ(a);a.f=!0;webapis.avplay.stop();webapis.avplay.close();return a.load(a.m.getConfiguration(),d).then(function(){var e=a.a.Th;a.f=!1;a.a=null;return e===WP?a.pause():a.play()})}catch(e){return Promise.reject(e)}},GQ=function(a){return a.f&&a.a?a.a.np:webapis.avplay.getTotalTrackInfo()},
29
- xQ=function(a){return a.f&&a.a?a.a.bm:webapis.avplay.getCurrentStreamInfo()},kQ=function(a,b,c){b=b.toUpperCase();b===mQ&&OQ(a,!0);var d=a.j[b];d&&(d.jg.stop(),a.j[b]=null,a.g.debug("Cancelled pending track switch for "+b));return new Promise(function(e,f){function g(k,l,m){m=void 0===m?!1:m;try{webapis.avplay.setSelectTrack(k,l),a.j[k]=null,e()}catch(n){a.g.debug("Could not set "+k+" track. Trying again...AVPlay state: "+(a.getState()+", buffering: ")+a.w,n),!1===m&&(a.j[k]={type:k,index:l,Ph:0,
30
- jg:new _.lj(function(){return g(k,c,!0)})}),(l=a.j[k])&&3>l.Ph?(a.w||++l.Ph,l.jg.ia(a.w?.5:.25)):(a.g.debug("Could not set track after multiple attempts.Giving up..."),l&&l.jg.stop(),a.j[k]=null,f())}}g(b,c)})},OQ=function(a,b){var c=a.m.getTextDisplayer();c&&c.setTextVisibility(b);c=a.m.h;try{c||webapis.avplay.setSilentSubtitle(!b)}catch(d){a.g.debug("Could not set text track visibility",d)}},LQ=function(a,b){try{tizen.tvaudiocontrol.setMute(b)}catch(c){switch(c.name){case xP:a.g.warn("The application does not have the privilege to set mute.",
31
- yP);break;default:a.g.warn(uP,c)}}},FQ=function(a){var b=null;try{b=tizen.tvaudiocontrol.isMute()}catch(c){switch(c.name){case xP:a.g.warn("The application doesn't have the privilege to get the mute state.",yP);break;default:a.g.warn(uP,c)}}return!!b},IQ=function(){return new Promise(function(a,b){if(window.webapis)a();else{var c=document.createElement("script");KP(c,_.Ke,function(d){return a(d)});KP(c,_.qe,function(d){return b(d)});c.src="$WEBAPIS/webapis/webapis.js";document.querySelector("head").appendChild(c)}})},
32
- PQ=function(){_.Ii.call(this);this.a=new zQ(this);this.f=new SP(this);this.configuration=this.B=_.Pn();this.w=null;this.g=new _.M("clpp.tizen.Player");this.j=null;this.l=new gQ;this.D=new _.an;this.o=this.h=null;this.A=!1},QQ=function(a){if("NONE"!==a.a.getState()){var b=a.j.getBoundingClientRect();a=a.a;var c=Math.floor(b.left*a.A),d=Math.floor(b.top*a.A),e=Math.floor(b.width*a.A);b=Math.floor(b.height*a.A);a.g.debug("Setting display area to","x:",c,"y:",d,"width:",e,"height:",b);webapis.avplay.setDisplayRect(c,
33
- d,e,b);0===c&&0===d&&1920===e&&1080===b&&webapis.avplay.setDisplayMethod("PLAYER_DISPLAY_MODE_LETTER_BOX")}else a.g.debug("Could not apply dimension. Player state "+a.a.getState())},RQ=function(){},SQ=function(){};
34
- LP.prototype.init=function(){var a=this,b,c,d,e,f,g;return _.I(function(k){if(1==k.a){b=_.Yn[a.h.env]||null;if(!b)throw a.g.debug(_.Ca,_.wb+a.h.env+_.aa),new _.O(_.P,6,6015,_.Da+a.h.env+"' is missing.");a.l={id:String(Math.floor(1E4*Math.random())),type:"MPEG-DASH"};c=Object.keys(a.h.customData||{}).length?btoa(JSON.stringify(a.h.customData)):"";d=_.$n(b,a.h.customData);(e=d[_.Kd])&&a.f.set(_.Kd,{Pe:e.licenseUrl||"",customData:c,gh:!1});(f=d[_.Md])&&a.f.set(_.Md,{Pe:f.licenseUrl||"",customData:c,
35
- gh:!1});if(0===a.f.size)throw new _.O(_.P,6,6E3);if((g=a.h.preferredDrmSystem)&&a.f.get(g))a.a=g;else if(a.f.get(_.Kd))a.a=_.Kd;else if(a.f.get(_.Md))a.a=_.Md;else throw new _.O(_.P,6,6001,"Configuration for the target system is missing.");return _.y(k,OP(a),2)}a.j=!0;_.A(k)})};LP.prototype.release=function(){var a=this;return _.I(function(b){a.j=!1;a.o=null;a.a=_.Ze;a.l=null;a.f=new Map;_.A(b)})};LP.prototype.getDrmInfo=function(){return this.o};
36
- var QP={gk:"DeleteLicenseAfterUse",ik:"LicenseServer",Fp:"GetChallenge",Gp:"HttpHeader",Ip:"UserAgent",Cp:"Cookie",ek:"CustomData"};_.r=SP.prototype;_.r.initialize=function(){this.a.on(BP,this.ki,this);this.a.on(AP,this.ji,this);this.a.on(zP,this.ii,this);this.a.on(IP,this.uj,this);this.a.on(HP,this.tj,this);this.a.on(FP,this.li,this)};_.r.release=function(){UP(this,_.mu);this.l=!1;this.o=-1;this.h=2};_.r.destroy=function(){this.release();this.a.off(BP,this.ki);this.a.off(AP,this.ji);this.a.off(zP,this.ii);this.a.off(IP,this.uj);this.a.off(HP,this.tj);this.a.off(FP,this.li);this.m=this.a=null};
37
- _.r.ki=function(){this.g.debug("Buffering start. Player state: ",this.a.getState());this.h=this.a.B?1:2;UP(this,2)};_.r.ji=function(a){this.g.debug("Buffering progress: "+a.percent+" %. Player state: ",TP(this.f))};_.r.ii=function(){this.g.debug("Buffering complete. Player state: ",this.a.getState());if(!this.l){this.l=!0;var a=this.m.getConfiguration().autoplay,b=this.a.getState()===TQ;if(!a&&b){UP(this,4);return}}if(a=1!==this.f)a=this.a.getState(),a=a===VP||a===WP;a&&XP(this)};
38
- _.r.uj=function(){this.g.debug("Preparing starts. AVPlay State: ",this.a.getState());this.a.getState()===UQ?UP(this,1):this.g.error("AVPlay prepares while state is not IDLE")};_.r.tj=function(){this.g.debug("Preparing ends: AVPlay state:",this.a.getState())};_.r.li=function(){UP(this,5)};_.r.getState=function(){return this.f};_.r=YP.prototype;_.r.initialize=function(a){this.m=a};
39
- _.r.load=function(a){var b=this,c,d,e,f,g,k,l;return _.I(function(m){switch(m.a){case 1:if(!b.m)return b.g.debug("Text streamer is not initialized. Will not load()"),m["return"]();b.B=a;c=b;return _.y(m,$P(b),2);case 2:c.j=m.f;if(!b.j)return b.g.debug("Could not find manifest parser for source. Make sure parsers are registered."),m["return"]();d={configurationId:"",networkingEngine:b.m.getNetworkEngine(),onContentSteeringInfoFound:function(){return null},filterNewPeriod:function(){},filterAllPeriods:function(){},
40
- onEvent:function(){},onError:function(){}};_.F(m,3);e=b;return _.y(m,b.j.start(a.url,d),5);case 5:e.a=m.f;_.G(m,4);break;case 3:return f=_.H(m),b.g.warn(f),_.F(m,6),g=b,_.y(m,b.j.start(a.url.replace(_.Ae,_.ze),d),8);case 8:g.a=m.f;_.G(m,4);break;case 6:k=_.H(m),b.g.error(k),b.a=null;case 4:if(!b.a||!ZP(b.a)){m.C(0);break}b.h=aQ(b);_.F(m,10);return _.y(m,b.h.open(),12);case 12:b.f=bQ(b);l=b.m.getConfiguration();b.f.h=l.streaming;b.o=l.preferredTextLanguage;b.A=l.preferredTextRole;b.D=l.preferForcedSubtitles;
41
- _.G(m,0);break;case 10:_.H(m),b.g.debug("Could not setup media source..."),b.h=null,b.f=null,b.j=null,b.a=null,_.A(m)}})};_.r.Pl=function(a){this.g.debug(_.dC,a.id);this.w=!0;var b=_.bG(a.textStreams,this.o||"",this.A||"",this.D)[0]||null;this.l&&(a.textStreams.includes(this.l)&&(b=this.l),this.l=null);return{video:null,audio:null,text:b,qb:null}};_.r.Ol=function(){var a=this;return _.I(function(b){if(1==b.a)return a.g.debug("canSwitch_"),a.w=!1,a.l?_.y(b,_.fH(a.f,a.l),3):b.C(0);a.l=null;_.A(b)})};
42
- _.r.Ql=function(){this.g.debug("onError_")};_.r.Rl=function(){this.j&&this.j.update&&this.j.update()};_.r.start=function(){var a=this;return _.I(function(b){if(!a.f)return b["return"]();try{a.f.start()}catch(c){a.g.error("Error while starting streaming engine",c)}_.A(b)})};_.r.setTextVisibility=function(a){this.g.debug("Set text visibility",a);this.h&&this.h.getTextDisplayer().setTextVisibility(a)};
43
- _.r.release=function(){var a=this;return _.I(function(b){a.m=null;a.a=null;a.B=null;a.A=null;a.o=null;a.w=!0;a.l=null;_.A(b)})};_.r.destroy=function(){var a=this;return _.I(function(b){switch(b.a){case 1:if(!a.j){b.C(2);break}return _.y(b,a.j.stop(),3);case 3:a.j=null;case 2:if(!a.f){b.C(4);break}return _.y(b,a.f.destroy(),5);case 5:a.f=null,a.w=!0;case 4:if(!a.h){b.C(0);break}return _.y(b,a.h.destroy(),7);case 7:a.h=null,_.A(b)}})};_.w(gQ,_.Ft);_.r=gQ.prototype;_.r.lj=function(a){var b=a.eventid;a=a.data;switch(b){case VQ:0<Object.keys(this.f).length||(this.g.debug("Loading track manager!"),this.load());b=webapis.avplay.getCurrentStreamInfo();0<b.length&&(b=+rQ(this,b[0].extra_info).Bit_rate,b=vQ(this,{bandwidth:b}))&&(this.w=b,hQ(this,b));break;case WQ:iQ(this);break;default:this.g.debug("Event type: "+b+" data: "+a)}};_.r.$g=function(a){3===a.detail.currentState&&this.m.off(_.kg,this.$g)};
44
- _.r.initialize=function(a){var b=this;this.m=a;this.a=this.m.a;this.m.on(_.kg,function(c){b.A||(c=c.detail,3===c.currentState&&(b.g.debug("Current state",c.currentState),b.A=!0,jQ(b)))});this.a.on("onevent",this.lj,this)};_.r.release=function(){this.f={};this.j=this.w=this.o=this.l=null;this.A=!1;this.h=1};
45
- _.r.load=function(){if(this.a&&!(0<Object.keys(this.f).length)){this.j=this.m.h;this.m.off(_.kg,this.$g);this.m.on(_.kg,this.$g,this);try{var a=GQ(this.a);this.f=uQ(this,a);var b=this.f[_.X]||[];b.length&&(this.l=b[0].renditions[0]||null);iQ(this)}catch(c){this.g.debug("Could not load track manager")}}};_.r.destroy=function(){this.a.off("onevent",this.lj);this.a=this.m=null};_.r.getVideoTracks=function(){return this.f[_.kt]||[]};_.r.getAudioTracks=function(){return this.f[_.X]||[]};
46
- _.r.ra=function(){return this.f[_.jt]||[]};_.r.sa=function(){return yQ(this,_.kt)};_.r.Za=function(){return yQ(this,_.X)};_.r.hb=function(){return yQ(this,_.jt)};_.r.Hb=function(){return this.w};_.r.Xb=function(){this.g.info(vP);return null};_.r.Yb=function(){this.g.info(vP);return null};_.r.Ra=function(){var a=this.sa();return a?a.track:null};_.r.qa=function(){var a=this.Za();return a?a.track:null};_.r.wa=function(){var a=this.hb();return a?a.track:null};
47
- _.r.Qb=function(a){var b=this;null===a?(a=this.sa(),NQ(this.a,a.bandwidth,null).then(function(){iQ(b)})):0<a.renditions.length&&this.Db(a.renditions[0])};_.r.La=function(a){a?nQ(this,a.renditions[0]):this.g.warn("Cannot disable audio tracks on this platform.","Consider muting audio instead...")};_.r.kb=function(a){a?(a=a.renditions[0],this.j?fQ(this.j,a.track):nQ(this,a)):(this.g.debug("Disabling text tracks"),this.o=null,OQ(this.a,!1),this.m.trigger(new _.Q(_.wg)))};
48
- _.r.Db=function(a){var b=this,c=this.sa();this.a.o||a.width!==c.width||a.height!==c.height||a.bandwidth!==c.bandwidth?(this.w=a,hQ(this,a),NQ(this.a,c.bandwidth,a.bandwidth).then(function(){iQ(b)})["catch"](function(d){var e=new _.O(_.P,7,7200,{tizenerror:d});b.g.debug("Error while switching video track",d);b.m.onError(e)})):this.g.debug("Trying to switch to already active rendition. Doing nothing...")};_.r.Ob=function(a){nQ(this,a)};_.r.Pb=function(a){this.j?fQ(this.j,a.track):nQ(this,a)};
49
- _.r.addTextTrack=function(){};_.r.xa=function(){return this.a.o};gQ.prototype.isAbrEnabled=gQ.prototype.xa;gQ.prototype.addTextTrack=gQ.prototype.addTextTrack;gQ.prototype.setTextRendition=gQ.prototype.Pb;gQ.prototype.setAudioRendition=gQ.prototype.Ob;gQ.prototype.setVideoRendition=gQ.prototype.Db;gQ.prototype.setTextTrack=gQ.prototype.kb;gQ.prototype.setAudioTrack=gQ.prototype.La;gQ.prototype.setVideoTrack=gQ.prototype.Qb;gQ.prototype.getTextTrack=gQ.prototype.wa;gQ.prototype.getAudioTrack=gQ.prototype.qa;
50
- gQ.prototype.getVideoTrack=gQ.prototype.Ra;gQ.prototype.getLoadingTextRendition=gQ.prototype.Yb;gQ.prototype.getLoadingAudioRendition=gQ.prototype.Xb;gQ.prototype.getLoadingVideoRendition=gQ.prototype.Hb;gQ.prototype.getTextRendition=gQ.prototype.hb;gQ.prototype.getAudioRendition=gQ.prototype.Za;gQ.prototype.getVideoRendition=gQ.prototype.sa;gQ.prototype.getTextTracks=gQ.prototype.ra;gQ.prototype.getAudioTracks=gQ.prototype.getAudioTracks;gQ.prototype.getVideoTracks=gQ.prototype.getVideoTracks;_.w(zQ,_.Ii);_.r=zQ.prototype;_.r.Jl=function(){this.w=!0;this.f||this.trigger(new _.Q(BP))};_.r.Il=function(a){this.w=!0;this.trigger(new _.Q(AP,{percent:a}))};_.r.Hl=function(){this.w=!1;this.trigger(new _.Q(zP))};_.r.Ml=function(){this.trigger(new _.Q(FP))};_.r.Ll=function(a,b){this.trigger(new _.Q("onevent",{eventid:a,data:b}))};_.r.Nl=function(a,b,c,d,e){this.trigger(new _.Q(GP,{duration:a,text:b,subtitleType:c,attriCount:d,attributes:e}))};
51
- _.r.Kl=function(a,b){this.trigger(new _.Q(DP,{drmType:a,drmData:b}));if(this.h){var c=this.h;if(c.j)if(c.a===_.Md&&"Challenge"===b.name)RP(c,b);else if("DrmError"===b.name){c.g.debug("DrmError event",b);var d=new _.O(_.P,6,6005,{message:JSON.stringify(b)});c.F.onError(d)}}};_.r.ne=function(a){this.trigger(new _.Q(EP,{eventType:a}))};
52
- _.r.play=function(){function a(){return new Promise(function(d,e){function f(){d();clearTimeout(g)}var g=null;b.one(CP,f,b);g=setTimeout(function(){b.off(CP,f);e("Timeout")},3E4)})}var b=this,c=this.getState();if(c===UQ)return(new Promise(function(d,e){webapis.avplay.prepareAsync(function(){CQ(b);d(webapis.avplay.play())},function(f){b.trigger(new _.Q(EP));e(f)})})).then(function(){return a()});if(c===WP||c===TQ)try{return webapis.avplay.play(),a()}catch(d){return Promise.reject(d)}return c===VP?
53
- Promise.resolve():Promise.reject("Player is in invalid state")};_.r.pause=function(){try{webapis.avplay.pause()}catch(a){Promise.reject(a)}return this.getState()===WP?Promise.resolve():Promise.reject()};
54
- _.r.setPlaybackRate=function(a){var b=this.getState();if(b===TQ||b===VP||b===WP){try{webapis.avplay.setSpeed(a),this.D=a}catch(c){return this.g.debug("Error while trying to set playback rate",c),this.setPlaybackRate(this.D)}return!0}this.g.debug("Cannot set playback rate; AVPlay is in inconsistent state: "+b);return!1};_.r.getPlaybackRate=function(){return this.D};
55
- _.r.load=function(a,b){var c=this,d;return _.I(function(e){switch(e.a){case 1:return c.g.debug("configure()",b||""),_.F(e,2),_.y(e,JQ(c),4);case 4:return _.y(e,MQ(c,a,b),5);case 5:_.G(e,0);break;case 2:throw d=_.H(e),new _.O(_.P,7,7003,null,d);}})};_.r.getState=function(){if(this.f&&this.a)return this.a.Th;try{return webapis.avplay.getState()}catch(a){this.ne(JSON.stringify(a))}};
56
- _.r.seek=function(a){var b=this,c=1E3*a;return new Promise(function(d,e){b.B=!0;b.m.trigger(new _.Q(_.Og));webapis.avplay.seekTo(c,function(){b.B=!1;b.m.trigger(new _.Q(_.Ng));d()},function(){b.B=!1;e()})})};_.r.getPosition=function(){if(this.f&&this.a)return this.a.position;try{return webapis.avplay.getCurrentTime()/1E3}catch(a){this.ne(JSON.stringify(a))}};_.r.getDuration=function(){if(this.f&&this.a)return this.a.duration;try{return webapis.avplay.getDuration()/1E3}catch(a){this.ne(JSON.stringify(a))}};
57
- _.r.release=function(){var a=this;return new Promise(function(b,c){try{a.h&&(a.h.release(),a.h=null);webapis.avplay.stop();webapis.avplay.close();for(var d in a.j){var e=a.j[d];e&&e.jg.stop()}a.j={};a.D=1;a.B=!1;a.l=null;a.a=null;return b()}catch(f){return c(f)}})};_.r.getVolume=function(){var a=null;try{a=tizen.tvaudiocontrol.getVolume()}catch(b){switch(b.name){case xP:this.g.debug("The application does not have the privilege to get the volume.",yP);break;default:this.g.debug(uP,b)}}return a};
58
- _.r.setVolume=function(a){try{tizen.tvaudiocontrol.setVolume(Math.max(0,Math.min(100*a,100)))}catch(b){switch(b.name){case "InvalidValueError":this.g.warn("Invalid value passed for setVolume.","The passed value value should be in the range of 0 to 1.");break;case xP:this.g.warn("The application does not have the privilege to set the volume.",yP);break;default:this.g.warn("An unknown error occurred while trying to set volume",b)}}};
59
- _.r.isLive=function(){if(this.f&&this.a)return this.a.isLive;try{return"1"===webapis.avplay.getStreamingProperty("IS_LIVE")}catch(a){this.ne(JSON.stringify(a))}};_.r.stop=function(){try{webapis.avplay.stop()}catch(a){this.g.debug(a)}};_.r.getDrmInfo=function(){this.h&&this.h.getDrmInfo();return null};_.r.setSourceIndex=function(a){this.G=a};_.r.getSourceIndex=function(){return this.G};_.r.getLoadedSource=function(){return this.l&&this.l[this.getSourceIndex()]};
60
- var UQ="IDLE",TQ="READY",VP="PLAYING",WP="PAUSED",sQ=_.Ub,lQ=_.ja,mQ="TEXT",WQ="PLAYER_MSG_RESOLUTION_CHANGED",VQ="PLAYER_MSG_BITRATE_CHANGE",PP={PLAYREADY:"PLAYREADY",Dp:"EME_PLAYREADY",Jp:"VERIMATRIX",qf:"WIDEVINE_CDM",Ep:"EME_WIDEVINE_CDM",Lp:"WIDEVINE_CLASSIC"};_.w(PQ,_.Ii);_.r=PQ.prototype;_.r.gi=function(){var a=this;this.g.debug("On Stream completed. Current time: ",this.getPosition());this.trigger(new _.Q(_.pe));this.configuration.loop?this.seek(this.configuration.startTime||0)["catch"](function(){a.g.debug("Could not loop playback")}):this.a.stop()};_.r.di=function(a){this.trigger(new _.Q(_.Bg,{currentTime:a.currentTime/1E3}))};
61
- _.r.hi=function(a){var b=this.a.getPosition(),c=b+a.duration/1E3,d=a.text||"";this.g.debug("Got subtitles: ",d,"start:",b,"end:",c,a);(d=_.R.uh(d))&&this.o.append([new _.Jp(b,c,d)],[])};_.r.ei=function(a){this.g.debug("DRM event: "+a.drmType+", data: "+a.drmData)};_.r.mj=function(){this.A||(this.g.debug("Initial buffering completed..."),this.A=!0)};
62
- _.r.fi=function(a){this.g.debug("Error: TYPE: "+a.eventType);UP(this.f,_.Fo);a=new _.O(_.P,7,7200,{tizenerror:a.eventType});this.a.release();this.trigger(new _.Q(_.qe,{detail:a}))};
63
- _.r.init=function(a,b){this.configuration=this.B=b;this.w=a;this.a.on(FP,this.gi,this);this.a.on(CP,this.di,this);this.a.on(GP,this.hi,this);this.a.on(DP,this.ei,this);this.a.on(EP,this.fi,this);this.a.on(zP,this.mj,this);this.f.initialize();this.l.initialize(this);this.g.debug("Initializing player surface");this.w.hideMediaElement();var c=XQ;XQ+=1;this.j=_.cj(_.$e,{id:"__clpp_tizen_player_"+c,type:"application/avplayer"});this.w.addElementToContainer(this.j,!0);var d=this.w.getMedia();if(d){c=this.j;
64
- var e=[_.hh,_.ve,"position",_.Ee,"top"],f={};d=null!==d.parentElement?window.getComputedStyle(d,null):d.style;if(!e||0===e.length){e||(e=[]);for(var g in d)e.push(g)}g=_.v(e);for(e=g.next();!e.done;e=g.next())e=e.value,f[e]=d[e];_.ej(c,f);QQ(this)}};_.r.getSurface=function(){return this.w};_.r.getConfiguration=function(){return this.configuration};_.r.getTimeline=function(){return null};_.r.setupPlaylist=function(){return Promise.reject(_.nb)};_.r.appendLoad=function(){return Promise.reject(_.nb)};
2
+ var f=function(window){var qP="An unknown error occurred while trying to get volume",rP="Cannot get loading rendition due to platform limitations",sP="PARAM_START_POSITION",tP="SecurityError",uP="The require privilege is: http://tizen.org/privilege/tv.audio",vP="onbufferingcomplete",wP="onbufferingprogress",xP="onbufferingstart",yP="oncurrentplaytime",zP="ondrmevent",AP="onerror",BP="onstreamcompleted",CP="onsubtitlechange",DP="preparingend",EP="preparingstart",FP="|STARTBITRATE\x3d",GP=function(a,b,c){function d(e){c.call(a,
3
+ e);a.removeEventListener(b,d)}a.addEventListener(b,d)},HP=function(a,b){this.h=a;this.o=null;this.a=_.Ze;this.l=null;this.j=!1;this.f=new Map;this.F=b;this.g=new _.M("clpp.tizen.DrmEngine")},KP=function(a){var b,c,d;return _.I(function(e){if(1==e.a){b=a.a===_.Nd||a.a===_.Ld;if(!b)throw new _.O(_.P,6,6001,"The key system "+a.a+" is not supported by the player or the platform");c=a.f.get(a.a);if(!c.Qe)throw new _.O(_.P,6,6012,"No license server given for "+a.a);_.F(e,2);return a.a===_.Nd?_.x(e,IP(a),
4
+ 5):_.x(e,JP(a,c),5)}if(2!=e.a)return a.o={keySystem:a.a,licenseServerUri:c.Qe,distinctiveIdentifierRequired:!1,persistentStateRequired:c.dh,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[],keyIds:[],periodId:null},_.G(e,0);d=_.H(e);a.g.error("Error while configuring CDM for "+a.a,d);throw new _.O(_.P,6,6005,{message:JSON.stringify(d)});})},JP=function(a,b){var c,d,e,f;return _.I(function(g){c=LP;d=MP;e={};e[d.ek]=!b.dh;e[d.gk]=b.Qe;""!==b.customData&&(e[d.ck]=b.customData);
5
+ f=JSON.stringify(e);a.g.debug("PlayReady properties: ",f);try{webapis.avplay.setDrm(c.PLAYREADY,"SetProperties",f)}catch(k){throw k;}_.A(g)})},IP=function(a){var b;return _.I(function(c){b=LP;try{webapis.avplay.setDrm(b.pf,"Initialize",""),webapis.avplay.setDrm(b.pf,"widevine_app_session",a.l.id),webapis.avplay.setDrm(b.pf,"widevine_data_type",a.l.type)}catch(d){throw d;}_.A(c)})},NP=function(a,b){var c,d,e,f,g,k,l,m,n,p,q,t,u,y,B,D,C;_.I(function(E){if(1==E.a){c=LP;d=a.f.get(a.a);a.g.debug("DRM Challenge data: ",
6
+ b.challenge);e=atob(b.challenge);f=new Uint8Array(e.length);for(g=0;g<e.length;++g)f[g]=e.charCodeAt(g);k=b.serverurl&&""!==b.serverurl?b.serverurl:d.Qe;l=_.Zk([k],_.Vk());l.type=3;l.body=f.buffer;l.method=_.rb;_.F(E,2);return _.x(E,a.F.Mb.fetch(l).U,4)}if(2!=E.a){m=E.f;if(a.j){n=_.Ri(m.data);p=n.byteLength;q="";for(t=0;t<p;t++)q+=String.fromCharCode(n[t]);u=btoa(q);y=b.session_id+sP+(u+sP);a.g.debug("Widevine license params",y);try{webapis.avplay.setDrm(c.pf,"widevine_license_data",y)}catch(z){a.g.error("License response rejected by CDM"),
7
+ B=new _.O(_.P,6,6008,{browserError:JSON.stringify(z)}),a.F.onError(B)}}return _.G(E,0)}D=_.H(E);a.g.error("License request failed.",JSON.stringify(D));C=new _.O(_.P,6,6007,{message:"Error while fetching license!",url:D.data.url,status:D.data.status||NaN,response:D.data.response||"",headers:D.data.headers||{}},D);a.F.onError(C);_.A(E)})},OP=function(a){this.m=a;this.a=this.m.a;this.f=_.iu;this.j=7;this.w=(new Date).getTime();this.l=!1;this.o=-1;this.h=2;this.g=new _.M("clpp.tizen.StateManager")},QP=
8
+ function(a,b){if(a.f!==b)if(a.f===_.Bo&&b!==_.iu)a.g.debug(_.IB+PP(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(_.fd,{detail:{bufferedTimeMS:-1,reason:a.h}}))):2===a.j&&a.m.trigger(new _.Q(_.ed,{detail:{bufferedTimeMS:c-a.o,reason:a.h}}));var d={currentState:a.f,previousState:a.j,timeSinceLastStateChangeMS:c-a.w};a.w=c;a.m.trigger(new _.Q(_.kg,{detail:d}));a.g.debug("State changed:",PP(a.j),"-\x3e",PP(a.f))}},PP=function(a){return Object.keys(_.pu)[a]},
9
+ TP=function(a){if(a.l){var b=a.a.getState(),c=a.f;switch(b){case RP:c=3;break;case SP:c=4;break;default:a.m.isEnded()?c=5:a.g.debug("Inconsistent AVPlay playback state:",b)}QP(a,c)}},UP=function(){this.o=this.A=this.f=this.h=this.B=this.m=this.j=this.a=null;this.D=!1;this.w=!0;this.l=null;this.g=new _.M("clpp.tizen.TextStreamer")},VP=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},WP=function(a){var b,c;return _.I(function(d){if(1==d.a)return b=
10
+ a.m.getConfiguration(),c=null,_.x(d,_.Zv(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)})},XP=function(a){var b=document.createElement(_.Tg),c=new _.jF,d=new _.VC,e=a.m.getTextDisplayer();return new _.lF(b,c,e,d,a.m.getConfiguration())},YP=function(a){var b={configuration:{},Ib:function(){return a.m.getPosition()},Y:a.h,Mb:a.m.getNetworkEngine(),Cd:null,Tg:a.Ll.bind(a),kj:a.Kl.bind(a),onError:a.Ml.bind(a),lj:function(){},
11
+ onEvent:function(){},pj:a.Nl.bind(a),Wf:function(){},ze:function(){return new _.ZF},xg:function(){return!1},se:null};return new _.FG(a.a,b)},ZP=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},$P=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 _.$s(String(c++),_.bt);e.mimeType=a[d].mimeType;e.language=a[d].language;e.roles=a[d].roles;e.kind=a[d].kind||_.fC;var f=new _.ht(String(a[d].id),e);f.bandwidth=a[d].bandwidth||null;e.renditions.push(f);b.push(e)}return b},aQ=function(a){if(a.h&&!a.h.getTextDisplayer().isTextVisible())return null;if(a.f){var b=_.IG(a.f,_.Cn),c=null;if(b){a=$P(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},bQ=function(a,b){var c,d,e,f;_.I(function(g){if(1==g.a){c=_.ZI;a.g.debug("Set active track",b);if(!b)return g.C(0);a.o=b.language;a.A=b.roles[0]||"";a.D=b.kind===c.Fh;if(!a.a||!a.f)return g.C(0);a.setTextVisibility(!0);d=ZP(a);e=b.renditions[0];f=d.textStreams.find(function(k){return String(k.id)===e.id});return f?a.w?(a.g.debug("Switching period defer text selection"),a.l=f,g.C(4)):_.x(g,_.bH(a.f,f),5):(a.g.error("No stream with id",e.id),g["return"]())}4!=g.a&&a.m.trigger(new _.Q(_.wg));
14
+ a.o=f.language;_.A(g)})},cQ=function(){this.j=this.a=this.m=null;this.f={};this.g=new _.M("clpp.tizen.TrackManager");this.w=this.o=this.l=null;this.A=!1;this.h=1},dQ=function(a,b){a.m.trigger(new _.Q(_.Xg,{details:{width:b.width,height:b.height,bandwidth:b.bandwidth,track:b.track,abrSelection:a.a.o}}))},eQ=function(a){var b=a.sa();b&&a.m.trigger(new _.Q(_.cd,{detail:{width:b.width,height:b.height,bandwidth:b.bandwidth,rendition:b}}))},fQ=function(a){var b=a.m.getConfiguration(),c=_.Ji(b.preferredAudioLanguage||
15
+ []),d=a.f[_.X]||[];if(d.length){var e=null;c.some(function(g){e=_.MC(g,d.map(function(k){return k.language}));return!!e});if(e){var f=d.filter(function(g){return g.language===e});c=f[0];1<f.length&&b.preferredAudioRole&&(f=f.filter(function(g){return 0<=g.roles.indexOf(b.preferredAudioRole)}),0<f.length&&(c=f[0]));a.g.debug("Setting audio track with preferred language:",e);a.La(c)}else a.g.debug("Preferred language(s) not available")}else a.g.debug("Could not set preferred audio language")},jQ=function(a,
16
+ b){if(b){var c=b.track.type.toUpperCase();gQ(a.a,c,Number(b.id)).then(function(){c===hQ&&(a.l=b,a.m.trigger(new _.Q(_.ad)));c===iQ&&(a.o=b,a.m.trigger(new _.Q(_.wg)))})["catch"](function(){a.g.error("Could not select "+c+" track.")})}else a.g.debug("Must provide valid rendition")},kQ=function(a,b,c){var d=_.ro(b.language||_.Gg);c.language=_.at(d);c.originalLanguage=d;c.channelsCount=b.channels?Number(b.channels):null;c.mimeType=_.Yc;a=new _.ht(String(a),c);a.track=c;a.codec=b.fourCC||null;a.bandwidth=
17
+ b.bit_rate||null;return a},lQ=function(a,b,c){c.mimeType=_.Vg;a=new _.ht(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},mQ=function(a,b,c){b=_.ro(b.track_lang||_.Gg);c.mimeType="text/ttml";c.language=_.at(b);c.originalLanguage=b;c.kind=_.fC;return new _.ht(String(a),c)},nQ=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
+ qQ=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===oQ}),f=b.filter(function(n){return n.type===hQ}),g=[],k=0;k<f.length;k++){var l=nQ(a,f[k].extra_info);if(l){var m=_.ro(l.language||_.Gg);m=_.at(m);m=c(g,m);m||(m=new _.$s(String(a.h++),_.X),g.push(m));m.renditions.push(kQ(f[k].index,l,m))}else a.g.warn("Skipping audio stream with no extra info")}f=new _.$s(String(a.h++),
19
+ _.ct);for(k=0;k<e.length;k++)(l=nQ(a,e[k].extra_info))?f.renditions.push(lQ(e[k].index,l,f)):a.g.warn("Skipping video stream with no extra info");e=[];e=a.j?$P(a.j):pQ(a,b);d[_.ct]=[f];d[_.X]=g;d[_.bt]=e;return d},pQ=function(a,b){for(var c=b.filter(function(k){return k.type===iQ}),d=[],e=0;e<c.length;e++){var f=nQ(a,c[e].extra_info);if(f){var g=new _.$s(String(a.h++),_.bt);g.renditions.push(mQ(c[e].index,f,g));d.push(g)}else a.g.warn("Skipping text stream with no extra info")}return d},rQ=function(a,
20
+ b){for(var c=a.f[_.ct]||[],d=[],e=0;e<c.length;e++)for(var f=0;f<c[e].renditions.length;f++)_.N.ua(c[e].renditions[f],b,Object.keys(b))&&d.push(c[e].renditions[f]);return d[0]||null},sQ=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},uQ=function(a,b){if(b===_.bt&&a.j)return aQ(a.j);var c=tQ(a.a)||[];if(0===c.length)return null;c=c.filter(function(e){return e.type===
21
+ b.toUpperCase()})[0];var d=null;b===_.ct&&(d=nQ(a,c.extra_info),d=rQ(a,{width:d.Width,height:d.Height}));b===_.X&&(c?(d=sQ(a,c,_.X),a.l=d):d=a.l);b===_.bt&&(c?(d=sQ(a,c,_.bt),a.o=d):d=a.o);return d},vQ=function(a){_.Ei.call(this);this.m=a;this.h=null;this.g=new _.M("clpp.tizen.Middleware");this.D=1;this.B=!1;this.l=null;this.G=0;this.o=!0;this.f=!1;this.a=null;this.A=1;this.w=!1;this.j={}},wQ=function(a){return _.I(function(b){tizen.systeminfo.getPropertyValue("DISPLAY",function(c){a.A=c.resolutionWidth/
22
+ 1920;a.g.debug("Display resolution ratio: ",a.A)},function(c){a.g.debug("Could not load DISPLAY property");throw c;});_.A(b)})},xQ=function(a){try{webapis.avplay.setListener({onbufferingstart:a.Fl.bind(a),onbufferingprogress:a.El.bind(a),onbufferingcomplete:a.Dl.bind(a),onstreamcompleted:a.Il.bind(a),oncurrentplaytime:function(b){a.trigger(new _.Q(yP,{currentTime:b}))},onevent:a.Hl.bind(a),onsubtitlechange:a.Jl.bind(a),ondrmevent:a.Gl.bind(a),onerror:a.oe.bind(a)})}catch(b){a.g.error(b)}},yQ=function(a){var b=
23
+ !!a.m.getTrackManager().gb();try{webapis.avplay.setSilentSubtitle(!b)}catch(c){a.g.debug("Could not set AVPlay subtitle config",c)}},zQ=function(a,b){try{var c=b.estimatedBandwidth||0,d=b.currentBandwidth||0;a.g.debug({estimatedBandwidth:c,Qp:d});0!==c&&0!==d&&c>=1.15*d&&webapis.avplay.setStreamingProperty("ADAPTIVE_INFO",FP+d)}catch(e){a.g.debug(e)}},AQ=function(a,b){try{webapis.avplay.setStreamingProperty("ADAPTIVE_INFO","|BITRATES\x3d"+b+FP+b)}catch(c){throw a.g.debug("Could not set fixed bandwidth",
24
+ c),c;}},DQ=function(a){return{position:a.getPosition(),state:a.m.getState(),Qh:a.getState(),playbackRate:a.getPlaybackRate(),isLive:a.isLive(),duration:a.getDuration(),isMuted:BQ(a),volume:a.getVolume(),jp:CQ(a),Yl:tQ(a)}},FQ=function(a){var b,c;return _.I(function(d){if(1==d.a)return _.x(d,EQ(),2);if(3!=d.a)return b=new Promise(function(e){(new _.hj(e)).ia(5)}),_.x(d,Promise.race([wQ(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"));_.A(d)})},IQ=function(a,b,c){var d,e,f,g,k,l,m,n;return _.I(function(p){switch(p.a){case 1:a.l=_.Rn(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(xP)),f=c.currentPosition);_.F(p,2);g=a.l[d].url;k=a.l[d].type;k!==_.Lc||g.includes(".mpd")||(l=new URL(g),l.searchParams.append("cl-ext",".mpd"),g=l.toString());webapis.avplay.open(g);
26
+ e.nextBandwidth?(AQ(a,e.nextBandwidth),a.o=!1):(a.o||zQ(a,e),a.o=!0);xQ(a);if(!b.drm||!b.drm.env){a.g.debug("No DRM configuration was provided. Assuming clear content");p.C(4);break}m={onError:function(q){return a.m.onError(q)},Mb:a.m.getNetworkEngine()};a.h=new HP(b.drm,m);return _.x(p,a.h.init(),4);case 4:return a.f||a.trigger(new _.Q(EP)),_.x(p,GQ(a),6);case 6:a.f||a.trigger(new _.Q(DP));f&&typeof f===_.h&&0<f&&a.seek(f)["catch"](function(q){a.g.debug("Couldn't set start position",q)});a.f||(b.volume&&
27
+ a.setVolume(b.volume),b.muted&&HQ(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;}})},GQ=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!");yQ(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)}}))})},JQ=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=DQ(a);a.f=!0;webapis.avplay.stop();webapis.avplay.close();return a.load(a.m.getConfiguration(),d).then(function(){var e=a.a.Qh;a.f=!1;a.a=null;return e===SP?a.pause():a.play()})}catch(e){return Promise.reject(e)}},CQ=function(a){return a.f&&a.a?a.a.jp:webapis.avplay.getTotalTrackInfo()},
29
+ tQ=function(a){return a.f&&a.a?a.a.Yl:webapis.avplay.getCurrentStreamInfo()},gQ=function(a,b,c){b=b.toUpperCase();b===iQ&&KQ(a,!0);var d=a.j[b];d&&(d.gg.stop(),a.j[b]=null,a.g.debug("Cancelled pending track switch for "+b));return new Promise(function(e,f){function g(k,l,m){m=void 0===m?!1:m;try{webapis.avplay.setSelectTrack(k,l),a.j[k]=null,e()}catch(n){a.g.debug("Could not set "+k+" track. Trying again...AVPlay state: "+(a.getState()+", buffering: ")+a.w,n),!1===m&&(a.j[k]={type:k,index:l,Mh:0,
30
+ gg:new _.hj(function(){return g(k,c,!0)})}),(l=a.j[k])&&3>l.Mh?(a.w||++l.Mh,l.gg.ia(a.w?.5:.25)):(a.g.debug("Could not set track after multiple attempts.Giving up..."),l&&l.gg.stop(),a.j[k]=null,f())}}g(b,c)})},KQ=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)}},HQ=function(a,b){try{tizen.tvaudiocontrol.setMute(b)}catch(c){switch(c.name){case tP:a.g.warn("The application does not have the privilege to set mute.",
31
+ uP);break;default:a.g.warn(qP,c)}}},BQ=function(a){var b=null;try{b=tizen.tvaudiocontrol.isMute()}catch(c){switch(c.name){case tP:a.g.warn("The application doesn't have the privilege to get the mute state.",uP);break;default:a.g.warn(qP,c)}}return!!b},EQ=function(){return new Promise(function(a,b){if(window.webapis)a();else{var c=document.createElement("script");GP(c,_.Ke,function(d){return a(d)});GP(c,_.re,function(d){return b(d)});c.src="$WEBAPIS/webapis/webapis.js";document.querySelector("head").appendChild(c)}})},
32
+ LQ=function(){_.Ei.call(this);this.a=new vQ(this);this.f=new OP(this);this.configuration=this.B=_.Ln();this.w=null;this.g=new _.M("clpp.tizen.Player");this.j=null;this.l=new cQ;this.D=new _.Xm;this.o=this.h=null;this.A=!1},MQ=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())},NQ=function(){},OQ=function(){};
34
+ HP.prototype.init=function(){var a=this,b,c,d,e,f,g;return _.I(function(k){if(1==k.a){b=_.Un[a.h.env]||null;if(!b)throw a.g.debug(_.Ca,_.wb+a.h.env+_.aa),new _.O(_.P,6,6015,_.Da+a.h.env+"' is missing.");a.l={id:String(Math.floor(1E4*Math.random())),type:"MPEG-DASH"};c=Object.keys(a.h.customData||{}).length?btoa(JSON.stringify(a.h.customData)):"";d=_.Wn(b,a.h.customData);(e=d[_.Ld])&&a.f.set(_.Ld,{Qe:e.licenseUrl||"",customData:c,dh:!1});(f=d[_.Nd])&&a.f.set(_.Nd,{Qe:f.licenseUrl||"",customData:c,
35
+ dh:!1});if(0===a.f.size)throw new _.O(_.P,6,6E3);if((g=a.h.preferredDrmSystem)&&a.f.get(g))a.a=g;else if(a.f.get(_.Ld))a.a=_.Ld;else if(a.f.get(_.Nd))a.a=_.Nd;else throw new _.O(_.P,6,6001,"Configuration for the target system is missing.");return _.x(k,KP(a),2)}a.j=!0;_.A(k)})};HP.prototype.release=function(){var a=this;return _.I(function(b){a.j=!1;a.o=null;a.a=_.Ze;a.l=null;a.f=new Map;_.A(b)})};HP.prototype.getDrmInfo=function(){return this.o};
36
+ var MP={ek:"DeleteLicenseAfterUse",gk:"LicenseServer",Bp:"GetChallenge",Cp:"HttpHeader",Ep:"UserAgent",yp:"Cookie",ck:"CustomData"};_.r=OP.prototype;_.r.initialize=function(){this.a.on(xP,this.hi,this);this.a.on(wP,this.gi,this);this.a.on(vP,this.fi,this);this.a.on(EP,this.rj,this);this.a.on(DP,this.qj,this);this.a.on(BP,this.ii,this)};_.r.release=function(){QP(this,_.iu);this.l=!1;this.o=-1;this.h=2};_.r.destroy=function(){this.release();this.a.off(xP,this.hi);this.a.off(wP,this.gi);this.a.off(vP,this.fi);this.a.off(EP,this.rj);this.a.off(DP,this.qj);this.a.off(BP,this.ii);this.m=this.a=null};
37
+ _.r.hi=function(){this.g.debug("Buffering start. Player state: ",this.a.getState());this.h=this.a.B?1:2;QP(this,2)};_.r.gi=function(a){this.g.debug("Buffering progress: "+a.percent+" %. Player state: ",PP(this.f))};_.r.fi=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()===PQ;if(!a&&b){QP(this,4);return}}if(a=1!==this.f)a=this.a.getState(),a=a===RP||a===SP;a&&TP(this)};
38
+ _.r.rj=function(){this.g.debug("Preparing starts. AVPlay State: ",this.a.getState());this.a.getState()===QQ?QP(this,1):this.g.error("AVPlay prepares while state is not IDLE")};_.r.qj=function(){this.g.debug("Preparing ends: AVPlay state:",this.a.getState())};_.r.ii=function(){QP(this,5)};_.r.getState=function(){return this.f};_.r=UP.prototype;_.r.initialize=function(a){this.m=a};
39
+ _.r.load=function(a){var b=this,c,d,e,f,g,k,l;return _.I(function(m){switch(m.a){case 1:if(!b.m)return b.g.debug("Text streamer is not initialized. Will not load()"),m["return"]();b.B=a;c=b;return _.x(m,WP(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(_.Ae,"http://"),d),8);case 8:g.a=m.f;_.G(m,4);break;case 6:k=_.H(m),b.g.error(k),b.a=null;case 4:if(!b.a||!VP(b.a)){m.C(0);break}b.h=XP(b);_.F(m,10);return _.x(m,b.h.open(),12);case 12:b.f=YP(b);l=b.m.getConfiguration();b.f.h=l.streaming;b.o=l.preferredTextLanguage;b.A=l.preferredTextRole;b.D=l.preferForcedSubtitles;
41
+ _.G(m,0);break;case 10:_.H(m),b.g.debug("Could not setup media source..."),b.h=null,b.f=null,b.j=null,b.a=null,_.A(m)}})};_.r.Ll=function(a){this.g.debug(_.$B,a.id);this.w=!0;var b=_.YF(a.textStreams,this.o||"",this.A||"",this.D)[0]||null;this.l&&(a.textStreams.includes(this.l)&&(b=this.l),this.l=null);return{video:null,audio:null,text:b,pb:null}};_.r.Kl=function(){var a=this;return _.I(function(b){if(1==b.a)return a.g.debug("canSwitch_"),a.w=!1,a.l?_.x(b,_.bH(a.f,a.l),3):b.C(0);a.l=null;_.A(b)})};
42
+ _.r.Ml=function(){this.g.debug("onError_")};_.r.Nl=function(){this.j&&this.j.update&&this.j.update()};_.r.start=function(){var a=this;return _.I(function(b){if(!a.f)return b["return"]();try{a.f.start()}catch(c){a.g.error("Error while starting streaming engine",c)}_.A(b)})};_.r.setTextVisibility=function(a){this.g.debug("Set text visibility",a);this.h&&this.h.getTextDisplayer().setTextVisibility(a)};
43
+ _.r.release=function(){var a=this;return _.I(function(b){a.m=null;a.a=null;a.B=null;a.A=null;a.o=null;a.w=!0;a.l=null;_.A(b)})};_.r.destroy=function(){var a=this;return _.I(function(b){switch(b.a){case 1:if(!a.j){b.C(2);break}return _.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,_.A(b)}})};_.w(cQ,_.xt);_.r=cQ.prototype;_.r.ij=function(a){var b=a.eventid;a=a.data;switch(b){case RQ:0<Object.keys(this.f).length||(this.g.debug("Loading track manager!"),this.load());b=webapis.avplay.getCurrentStreamInfo();0<b.length&&(b=+nQ(this,b[0].extra_info).Bit_rate,b=rQ(this,{bandwidth:b}))&&(this.w=b,dQ(this,b));break;case SQ:eQ(this);break;default:this.g.debug("Event type: "+b+" data: "+a)}};_.r.Xg=function(a){3===a.detail.currentState&&this.m.off(_.kg,this.Xg)};
44
+ _.r.initialize=function(a){var b=this;this.m=a;this.a=this.m.a;this.m.on(_.kg,function(c){b.A||(c=c.detail,3===c.currentState&&(b.g.debug("Current state",c.currentState),b.A=!0,fQ(b)))});this.a.on("onevent",this.ij,this)};_.r.release=function(){this.f={};this.j=this.w=this.o=this.l=null;this.A=!1;this.h=1};
45
+ _.r.load=function(){if(this.a&&!(0<Object.keys(this.f).length)){this.j=this.m.h;this.m.off(_.kg,this.Xg);this.m.on(_.kg,this.Xg,this);try{var a=CQ(this.a);this.f=qQ(this,a);var b=this.f[_.X]||[];b.length&&(this.l=b[0].renditions[0]||null);eQ(this)}catch(c){this.g.debug("Could not load track manager")}}};_.r.destroy=function(){this.a.off("onevent",this.ij);this.a=this.m=null};_.r.getVideoTracks=function(){return this.f[_.ct]||[]};_.r.getAudioTracks=function(){return this.f[_.X]||[]};
46
+ _.r.ra=function(){return this.f[_.bt]||[]};_.r.sa=function(){return uQ(this,_.ct)};_.r.Ya=function(){return uQ(this,_.X)};_.r.gb=function(){return uQ(this,_.bt)};_.r.Hb=function(){return this.w};_.r.Xb=function(){this.g.info(rP);return null};_.r.Yb=function(){this.g.info(rP);return null};_.r.Qa=function(){var a=this.sa();return a?a.track:null};_.r.qa=function(){var a=this.Ya();return a?a.track:null};_.r.wa=function(){var a=this.gb();return a?a.track:null};
47
+ _.r.Qb=function(a){var b=this;null===a?(a=this.sa(),JQ(this.a,a.bandwidth,null).then(function(){eQ(b)})):0<a.renditions.length&&this.Db(a.renditions[0])};_.r.La=function(a){a?jQ(this,a.renditions[0]):this.g.warn("Cannot disable audio tracks on this platform.","Consider muting audio instead...")};_.r.jb=function(a){a?(a=a.renditions[0],this.j?bQ(this.j,a.track):jQ(this,a)):(this.g.debug("Disabling text tracks"),this.o=null,KQ(this.a,!1),this.m.trigger(new _.Q(_.wg)))};
48
+ _.r.Db=function(a){var b=this,c=this.sa();this.a.o||a.width!==c.width||a.height!==c.height||a.bandwidth!==c.bandwidth?(this.w=a,dQ(this,a),JQ(this.a,c.bandwidth,a.bandwidth).then(function(){eQ(b)})["catch"](function(d){var e=new _.O(_.P,7,7200,{tizenerror:d});b.g.debug("Error while switching video track",d);b.m.onError(e)})):this.g.debug("Trying to switch to already active rendition. Doing nothing...")};_.r.Ob=function(a){jQ(this,a)};_.r.Pb=function(a){this.j?bQ(this.j,a.track):jQ(this,a)};
49
+ _.r.addTextTrack=function(){};_.r.xa=function(){return this.a.o};cQ.prototype.isAbrEnabled=cQ.prototype.xa;cQ.prototype.addTextTrack=cQ.prototype.addTextTrack;cQ.prototype.setTextRendition=cQ.prototype.Pb;cQ.prototype.setAudioRendition=cQ.prototype.Ob;cQ.prototype.setVideoRendition=cQ.prototype.Db;cQ.prototype.setTextTrack=cQ.prototype.jb;cQ.prototype.setAudioTrack=cQ.prototype.La;cQ.prototype.setVideoTrack=cQ.prototype.Qb;cQ.prototype.getTextTrack=cQ.prototype.wa;cQ.prototype.getAudioTrack=cQ.prototype.qa;
50
+ cQ.prototype.getVideoTrack=cQ.prototype.Qa;cQ.prototype.getLoadingTextRendition=cQ.prototype.Yb;cQ.prototype.getLoadingAudioRendition=cQ.prototype.Xb;cQ.prototype.getLoadingVideoRendition=cQ.prototype.Hb;cQ.prototype.getTextRendition=cQ.prototype.gb;cQ.prototype.getAudioRendition=cQ.prototype.Ya;cQ.prototype.getVideoRendition=cQ.prototype.sa;cQ.prototype.getTextTracks=cQ.prototype.ra;cQ.prototype.getAudioTracks=cQ.prototype.getAudioTracks;cQ.prototype.getVideoTracks=cQ.prototype.getVideoTracks;_.w(vQ,_.Ei);_.r=vQ.prototype;_.r.Fl=function(){this.w=!0;this.f||this.trigger(new _.Q(xP))};_.r.El=function(a){this.w=!0;this.trigger(new _.Q(wP,{percent:a}))};_.r.Dl=function(){this.w=!1;this.trigger(new _.Q(vP))};_.r.Il=function(){this.trigger(new _.Q(BP))};_.r.Hl=function(a,b){this.trigger(new _.Q("onevent",{eventid:a,data:b}))};_.r.Jl=function(a,b,c,d,e){this.trigger(new _.Q(CP,{duration:a,text:b,subtitleType:c,attriCount:d,attributes:e}))};
51
+ _.r.Gl=function(a,b){this.trigger(new _.Q(zP,{drmType:a,drmData:b}));if(this.h){var c=this.h;if(c.j)if(c.a===_.Nd&&"Challenge"===b.name)NP(c,b);else if("DrmError"===b.name){c.g.debug("DrmError event",b);var d=new _.O(_.P,6,6005,{message:JSON.stringify(b)});c.F.onError(d)}}};_.r.oe=function(a){this.trigger(new _.Q(AP,{eventType:a}))};
52
+ _.r.play=function(){function a(){return new Promise(function(d,e){function f(){d();clearTimeout(g)}var g=null;b.one(yP,f,b);g=setTimeout(function(){b.off(yP,f);e("Timeout")},3E4)})}var b=this,c=this.getState();if(c===QQ)return(new Promise(function(d,e){webapis.avplay.prepareAsync(function(){yQ(b);d(webapis.avplay.play())},function(f){b.trigger(new _.Q(AP));e(f)})})).then(function(){return a()});if(c===SP||c===PQ)try{return webapis.avplay.play(),a()}catch(d){return Promise.reject(d)}return c===RP?
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()===SP?Promise.resolve():Promise.reject()};
54
+ _.r.setPlaybackRate=function(a){var b=this.getState();if(b===PQ||b===RP||b===SP){try{webapis.avplay.setSpeed(a),this.D=a}catch(c){return this.g.debug("Error while trying to set playback rate",c),this.setPlaybackRate(this.D)}return!0}this.g.debug("Cannot set playback rate; AVPlay is in inconsistent state: "+b);return!1};_.r.getPlaybackRate=function(){return this.D};
55
+ _.r.load=function(a,b){var c=this,d;return _.I(function(e){switch(e.a){case 1:return c.g.debug("configure()",b||""),_.F(e,2),_.x(e,FQ(c),4);case 4:return _.x(e,IQ(c,a,b),5);case 5:_.G(e,0);break;case 2:throw d=_.H(e),new _.O(_.P,7,7003,null,d);}})};_.r.getState=function(){if(this.f&&this.a)return this.a.Qh;try{return webapis.avplay.getState()}catch(a){this.oe(JSON.stringify(a))}};
56
+ _.r.seek=function(a){var b=this,c=1E3*a;return new Promise(function(d,e){b.B=!0;b.m.trigger(new _.Q(_.Og));webapis.avplay.seekTo(c,function(){b.B=!1;b.m.trigger(new _.Q(_.Ng));d()},function(){b.B=!1;e()})})};_.r.getPosition=function(){if(this.f&&this.a)return this.a.position;try{return webapis.avplay.getCurrentTime()/1E3}catch(a){this.oe(JSON.stringify(a))}};_.r.getDuration=function(){if(this.f&&this.a)return this.a.duration;try{return webapis.avplay.getDuration()/1E3}catch(a){this.oe(JSON.stringify(a))}};
57
+ _.r.release=function(){var a=this;return new Promise(function(b,c){try{a.h&&(a.h.release(),a.h=null);webapis.avplay.stop();webapis.avplay.close();for(var d in a.j){var e=a.j[d];e&&e.gg.stop()}a.j={};a.D=1;a.B=!1;a.l=null;a.a=null;return b()}catch(f){return c(f)}})};_.r.getVolume=function(){var a=null;try{a=tizen.tvaudiocontrol.getVolume()}catch(b){switch(b.name){case tP:this.g.debug("The application does not have the privilege to get the volume.",uP);break;default:this.g.debug(qP,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 tP:this.g.warn("The application does not have the privilege to set the volume.",uP);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.oe(JSON.stringify(a))}};_.r.stop=function(){try{webapis.avplay.stop()}catch(a){this.g.debug(a)}};_.r.getDrmInfo=function(){this.h&&this.h.getDrmInfo();return null};_.r.setSourceIndex=function(a){this.G=a};_.r.getSourceIndex=function(){return this.G};_.r.getLoadedSource=function(){return this.l&&this.l[this.getSourceIndex()]};
60
+ var QQ="IDLE",PQ="READY",RP="PLAYING",SP="PAUSED",oQ=_.Ub,hQ=_.ja,iQ="TEXT",SQ="PLAYER_MSG_RESOLUTION_CHANGED",RQ="PLAYER_MSG_BITRATE_CHANGE",LP={PLAYREADY:"PLAYREADY",zp:"EME_PLAYREADY",Fp:"VERIMATRIX",pf:"WIDEVINE_CDM",Ap:"EME_WIDEVINE_CDM",Hp:"WIDEVINE_CLASSIC"};_.w(LQ,_.Ei);_.r=LQ.prototype;_.r.di=function(){var a=this;this.g.debug("On Stream completed. Current time: ",this.getPosition());this.trigger(new _.Q(_.qe));this.configuration.loop?this.seek(this.configuration.startTime||0)["catch"](function(){a.g.debug("Could not loop playback")}):this.a.stop()};_.r.ai=function(a){this.trigger(new _.Q(_.Bg,{currentTime:a.currentTime/1E3}))};
61
+ _.r.ei=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.qh(d))&&this.o.append([new _.Fp(b,c,d)],[])};_.r.bi=function(a){this.g.debug("DRM event: "+a.drmType+", data: "+a.drmData)};_.r.jj=function(){this.A||(this.g.debug("Initial buffering completed..."),this.A=!0)};
62
+ _.r.ci=function(a){this.g.debug("Error: TYPE: "+a.eventType);QP(this.f,_.Bo);a=new _.O(_.P,7,7200,{tizenerror:a.eventType});this.a.release();this.trigger(new _.Q(_.re,{detail:a}))};
63
+ _.r.init=function(a,b){this.configuration=this.B=b;this.w=a;this.a.on(BP,this.di,this);this.a.on(yP,this.ai,this);this.a.on(CP,this.ei,this);this.a.on(zP,this.bi,this);this.a.on(AP,this.ci,this);this.a.on(vP,this.jj,this);this.f.initialize();this.l.initialize(this);this.g.debug("Initializing player surface");this.w.hideMediaElement();var c=TQ;TQ+=1;this.j=_.Zi(_.$e,{id:"__clpp_tizen_player_"+c,type:"application/avplayer"});this.w.addElementToContainer(this.j,!0);var d=this.w.getMedia();if(d){c=this.j;
64
+ var e=[_.hh,_.we,"position",_.Ee,"top"],f={};d=null!==d.parentElement?window.getComputedStyle(d,null):d.style;if(!e||0===e.length){e||(e=[]);for(var g in d)e.push(g)}g=_.v(e);for(e=g.next();!e.done;e=g.next())e=e.value,f[e]=d[e];_.aj(c,f);MQ(this)}};_.r.getSurface=function(){return this.w};_.r.getConfiguration=function(){return this.configuration};_.r.getTimeline=function(){return null};_.r.setupPlaylist=function(){return Promise.reject(_.nb)};_.r.appendLoad=function(){return Promise.reject(_.nb)};
65
65
  _.r.seekWith=function(){return Promise.reject(_.nb)};_.r.setSeekInterceptor=function(){};_.r.setPlaybackSessionId=function(){};_.r.getBandwidthEstimate=function(){return null};
66
- _.r.destroy=function(){var a=this;return _.I(function(b){switch(b.a){case 1:return _.y(b,a.release(),2);case 2:a.a.off(FP,a.gi);a.a.off(CP,a.di);a.a.off(GP,a.hi);a.a.off(DP,a.ei);a.a.off(EP,a.fi);a.a.off(zP,a.mj);if(!a.h){b.C(3);break}return _.y(b,a.h.destroy(),4);case 4:a.h=null;case 3:a.j&&(a.j.parentElement.removeChild(a.j),a.j=null),a.l.destroy(),a.f.destroy(),a.l=null,a.f=null,_.A(b)}})};_.r.namespace=function(){return YQ};_.r.getPlaybackRate=function(){return this.a.getPlaybackRate()};
66
+ _.r.destroy=function(){var a=this;return _.I(function(b){switch(b.a){case 1:return _.x(b,a.release(),2);case 2:a.a.off(BP,a.di);a.a.off(yP,a.ai);a.a.off(CP,a.ei);a.a.off(zP,a.bi);a.a.off(AP,a.ci);a.a.off(vP,a.jj);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,_.A(b)}})};_.r.namespace=function(){return UQ};_.r.getPlaybackRate=function(){return this.a.getPlaybackRate()};
67
67
  _.r.setDrmCustomDataModifier=function(){};_.r.setCdnErrorCallback=function(){};_.r.detach=function(){};_.r.setPlaybackRate=function(a){this.a.setPlaybackRate(a)};_.r.getPosition=function(){return this.getMediaPosition()};_.r.getMediaPosition=function(){return 0<(this.configuration.startTime||0)&&!this.A?0:5===this.f.getState()?this.getDuration():this.a.getPosition()||0};_.r.seek=function(a){return typeof a===_.h&&0<=a?(this.isLive()||(a=Math.min(a,this.getDuration())),this.a.seek(a)):Promise.reject()};
68
- _.r.getPresentationStartTime=function(){return null};_.r.getSeekRange=function(){return{start:0,end:0}};_.r.getVolume=function(){var a=this.a.getVolume();return typeof a===_.h?a/100:null};_.r.setVolume=function(a){this.a.setVolume(a)};_.r.getDuration=function(){return this.getMediaDuration()};_.r.getMediaDuration=function(){return this.a.getDuration()};_.r.getBufferInfo=function(){this.g.warn(_.xa);return new _.mi};_.r.getTrackManager=function(){return this.l};_.r.unload=function(){var a=this;return this.a.release().then(function(){a.l.release()})};
69
- _.r.release=function(){var a=this;return _.I(function(b){switch(b.a){case 1:if(!a.h){b.C(2);break}return _.y(b,a.h.release(),2);case 2:if(!a.o){b.C(4);break}return _.y(b,a.o.destroy(),5);case 5:a.o=null;case 4:return _.y(b,a.a.release(),6);case 6:a.l.release(),a.f.release(),a.A=!1,_.A(b)}})};
70
- _.r.load=function(a){var b=this,c,d,e,f,g;return _.I(function(k){switch(k.a){case 1:b.configuration=_.Rn([b.B,a]);c=_.du(b.configuration,[_.ye,"native"]);b.o=c.create(b);d=_.Vn(b.configuration)[0];e=!!b.configuration.tizen&&b.configuration.tizen.sideStreamText;if(!e){k.C(2);break}b.h=new YP;b.h.initialize(b);_.F(k,3);return _.y(k,b.h.load(d),5);case 5:b.h.start();_.G(k,2);break;case 3:f=_.H(k),b.g.error(f);case 2:return _.F(k,6),_.y(k,b.a.load(b.configuration),8);case 8:_.G(k,7);break;case 6:throw g=
71
- _.H(k),b.onError(g),g;case 7:b.l.load(),_.A(k)}})};_.r.play=function(){var a=this;this.trigger(new _.Q(_.pf));QQ(this);return this.a.play().then(function(){XP(a.f)})};_.r.pause=function(){var a=this;return this.a.pause().then(function(){XP(a.f)})};_.r.getState=function(){return this.f.getState()};_.r.getPeriods=function(){return[]};_.r.onError=function(a){var b=new _.Q(_.qe,{detail:a});a.severity===_.P&&(UP(this.f,_.Fo),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()===WP};_.r.isMuted=function(){return FQ(this.a)};_.r.setMuted=function(a){LQ(this.a,a)};_.r.getNetworkEngine=function(){return this.D};_.r.setNetworkEngine=function(a){this.D=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 RQ).canPlay(a,b)};_.r.getTimelineCues=function(){return[]};_.r.getCueTimeline=function(){return null};_.r.getTextDisplayer=function(){return this.o};_.r.resetAbr=function(){};var YQ="clpp.tizen",XQ=0;RQ.prototype.a=function(){return YQ};
74
- RQ.prototype.canPlay=function(a){a=a.type;var b=!!window.webapis;if((a===_.Lc||a===_.am||a===_.Qc)&&b){if(_.qj(2))return 2;if(_.qj(3)||_.qj(4)||_.qj(5)||_.qj(6))return _.Vh("Use of clpp.tizen.TizenComponent is not recommended for Tizen version \x3e\x3d 3."),1}return 0};RQ.prototype.f=function(a){return a===_.pa};RQ.prototype.create=function(){return new PQ};_.w(SQ,_.jv);SQ.prototype.install=function(){_.fi(new RQ)};SQ.prototype.uninstall=function(){var a=YQ;a&&_.ci[a]&&(delete _.ci[a],_.di.info("Removed Player factory: '"+a+"'"))};SQ.prototype.id=function(){return"tizen"};_.K("clpp.tizen.TizenComponent",SQ);};
68
+ _.r.getPresentationStartTime=function(){return null};_.r.getSeekRange=function(){return{start:0,end:0}};_.r.getVolume=function(){var a=this.a.getVolume();return typeof a===_.h?a/100:null};_.r.setVolume=function(a){this.a.setVolume(a)};_.r.getDuration=function(){return this.getMediaDuration()};_.r.getMediaDuration=function(){return this.a.getDuration()};_.r.getBufferInfo=function(){this.g.warn(_.xa);return new _.ii};_.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,_.A(b)}})};
70
+ _.r.load=function(a){var b=this,c,d,e,f,g;return _.I(function(k){switch(k.a){case 1:b.configuration=_.Nn([b.B,a]);c=_.$t(b.configuration,[_.ze,"native"]);b.o=c.create(b);d=_.Rn(b.configuration)[0];e=!!b.configuration.tizen&&b.configuration.tizen.sideStreamText;if(!e){k.C(2);break}b.h=new UP;b.h.initialize(b);_.F(k,3);return _.x(k,b.h.load(d),5);case 5:b.h.start();_.G(k,2);break;case 3:f=_.H(k),b.g.error(f);case 2:return _.F(k,6),_.x(k,b.a.load(b.configuration),8);case 8:_.G(k,7);break;case 6:throw g=
71
+ _.H(k),b.onError(g),g;case 7:b.l.load(),_.A(k)}})};_.r.play=function(){var a=this;this.trigger(new _.Q(_.pf));MQ(this);return this.a.play().then(function(){TP(a.f)})};_.r.pause=function(){var a=this;return this.a.pause().then(function(){TP(a.f)})};_.r.getState=function(){return this.f.getState()};_.r.getPeriods=function(){return[]};_.r.onError=function(a){var b=new _.Q(_.re,{detail:a});a.severity===_.P&&(QP(this.f,_.Bo),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()===SP};_.r.isMuted=function(){return BQ(this.a)};_.r.setMuted=function(a){HQ(this.a,a)};_.r.getNetworkEngine=function(){return this.D};_.r.setNetworkEngine=function(a){this.D=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 NQ).canPlay(a,b)};_.r.getTimelineCues=function(){return[]};_.r.getCueTimeline=function(){return null};_.r.getTextDisplayer=function(){return this.o};_.r.resetAbr=function(){};var UQ="clpp.tizen",TQ=0;NQ.prototype.a=function(){return UQ};
74
+ NQ.prototype.canPlay=function(a){a=a.type;var b=!!window.webapis;if((a===_.Lc||a===_.Xl||a===_.Rc)&&b){if(_.mj(2))return 2;if(_.mj(3)||_.mj(4)||_.mj(5)||_.mj(6))return _.Rh("Use of clpp.tizen.TizenComponent is not recommended for Tizen version \x3e\x3d 3."),1}return 0};NQ.prototype.f=function(a){return a===_.pa};NQ.prototype.create=function(){return new LQ};_.w(OQ,_.fv);OQ.prototype.install=function(){_.ai(new NQ)};OQ.prototype.uninstall=function(){var a=UQ;a&&_.Zh[a]&&(delete _.Zh[a],_.$h.info("Removed Player factory: '"+a+"'"))};OQ.prototype.id=function(){return"tizen"};_.J("clpp.tizen.TizenComponent",OQ);};
75
75
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
76
76
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
77
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 Gy='application/mp4; codecs\x3d"stpp.ttml"',Hy='application/mp4; codecs\x3d"stpp.ttml.im1i"',Iy='application/mp4; codecs\x3d"stpp.ttml.im1t"',Jy="backgroundColor",Ky="direction",Ly="displayAlign",My="region",Ny="sans-serif",Oy="textAlign",Py="textDecoration",Qy="writingMode",Ry=function(a,b,c){this.h=a;this.f=b;this.a=c},Sy=function(a,b,c){Ry.call(this,a,[],c);this.j=b||""},Ty=function(a,b,c){Ry.call(this,a,b,c)},Uy=function(a,b,c){a=a.f;for(var d=a.length-1;0<=d;d--){var e=b.get(a[d]);if(e.hasAttribute(c))return e.getAttribute(c)}return null},
3
- bz=function(a,b){var c=null;if(Vy.test(a)){c=Vy.exec(a);var d=Number(c[1]),e=Number(c[2]),f=Number(c[3]),g=Number(c[4]);g+=(Number(c[5])||0)/b.f;f+=g/b.frameRate;c=f+60*e+3600*d}else Wy.test(a)?c=Xy(Wy,a):Yy.test(a)?c=Xy(Yy,a):Zy.test(a)?(c=Zy.exec(a),c=Number(c[1])/b.frameRate):$y.test(a)?(c=$y.exec(a),c=Number(c[1])/b.a):az.test(a)&&(c=Xy(az,a));return c},Xy=function(a,b){var c=a.exec(b);return null==c||""===c[0]?null:(Number(c[4])||0)/1E3+(Number(c[3])||0)+60*(Number(c[2])||0)+3600*(Number(c[1])||
4
- 0)},cz=function(a){return a.split(":").pop()},dz=function(a){return a.replace(/(\d*\.?\d+)c/g,"$1em")},fz=function(a,b){for(;ez.test(a);){var c=ez.exec(a)[0];a=a.replace(c,parseInt(c,10)/b+"em")}return a},gz=function(a){return a?a.replace(/(\d*\.?\d+)%/g,function(b,c){return c/100+"em"}):""},hz=function(a,b,c,d,e,f,g){Ry.call(this,a,f,g);this.w=b;this.A=c;this.o=d;this.l=e;this.j=[]},iz=function(a,b,c){a=Uy(a,b,Oy);if(!a&&c&&(a=Uy(c,b,Oy),!a&&"rltb"===Uy(c,b,Qy)))return _.oe;switch(a){case _.nd:return _.Ep;
5
- case _.Wf:case _.oe:return _.oe;default:return _.jg}},jz=function(a,b,c){if(_.R.Tf(a.w))return document.createTextNode(_.R.uh(a.w||""));if(a.A)return _.cj("br");for(var d=_.cj("span"),e=_.v(a.f),f=e.next();!f.done;f=e.next())_.dj(d,f.value);a=_.v(a.j);for(e=a.next();!e.done;e=a.next())d.appendChild(jz(c.get(e.value),b,c));return d},kz=function(a,b,c,d){this.frameRate=Number(a)||30;this.f=Number(b)||1;this.a=Number(d);0===this.a&&(this.a=a?this.frameRate*this.f:1);c&&(a=/^(\d+) (\d+)$/g.exec(c))&&
6
- (this.frameRate*=Number(a[1])/Number(a[2]))},lz=function(a,b,c){Ry.call(this,a,b,c)},oz=function(a,b,c,d){var e=mz.exec(a);a=nz.exec(a);return typeof b===_.h&&0<b&&a?100*Number(a[c])/b:e?Number(e[c]):a?Number(a[c]):d},pz=function(a,b){return typeof b===_.h&&0<b?_.Kp:nz.test(a)?0:_.Kp},qz=function(a,b){Ry.call(this,"root-container",[],b);this.j=a},rz=function(a,b,c){return typeof a===_.h?a:typeof b===_.h?b:c},sz=function(a,b){var c=a.getAttribute("extent");return(c=nz.exec(c))?Number(c[b]):null},uz=
7
- function(a){a=a.getAttribute("cellResolution");return(a=tz.exec(a))?Number(a[2]):null},vz=function(a,b,c){Ry.call(this,a,b,c)},wz=function(a){this.B=a;this.w=this.l=null;this.A=0;this.h=new Map;this.a=new Map;this.j=new Map;this.f=new Map;this.o=[]},yz=function(a){return xz.some(function(b){return b in a.attributes})},zz=function(a,b){if(0===b.length)return[];for(var c=[],d=_.v(b),e=d.next();!e.done;e=d.next())e=e.value,a.a.has(e)&&c.push.apply(c,_.uh(zz(a,a.a.get(e).f)).concat([e]));return c},Bz=
8
- function(){return"inline-"+Az++},Cz=function(a){return a.o.map(function(b){return b.build(a.l,a.w,a.A,a.h,a.a,a.j,a.f)}).filter(function(b){return null!=b})},Dz=function(a){this.a=a.firstChild;this.f=new Set},Ez=function(a,b,c,d,e,f){this.h=a;this.a=b;this.j=c;this.l=d;this.f=e;this.attributes=f},Fz=function(a){return cz(a.h.nodeName)},Gz=function(){this.a=new Map},Iz=function(a,b){if(a.a.has(b))return a.a.get(b);var c=null,d=null,e=[],f=[],g={},k=b.parentNode;if(k&&a.a.has(k)){var l=a.a.get(k);e=
9
- _.uh(l.l).concat();-1===[_.da,"span","br"].indexOf(b.nodeName)&&(c=l.a,d=l.j,f=_.uh(l.f).concat(),g={},Hz.forEach(function(n){n in l.attributes&&(g[n]=l.attributes[n])}))}if(b.nodeType===b.ELEMENT_NODE){b.hasAttribute(My)&&(c=b.getAttribute(My));b.hasAttribute(_.pg)&&f.push.apply(f,_.uh(b.getAttribute(_.pg).split(" ")));d=Array.from(b.attributes).map(function(n){return n.name});d=_.v(d);for(k=d.next();!k.done;k=d.next()){k=k.value;var m=cz(k);g[m]=b.getAttribute(k)}d=g.backgroundImage}c=new Ez(b,
10
- c,d,e,f,g);a.a.set(b,c);return c},Jz=function(a){this.a=a;this.f=new DOMParser},Kz=function(a){this.f=a},Lz=function(a){return String(Math.floor(a/3600)).padStart(2,"0")+":"+String(Math.floor(a/60%60)).padStart(2,"0")+":"+String(Math.floor(a%60)).padStart(2,"0")+"."+String(Math.floor(1E3*a%1E3)).padStart(3,"0")},Mz=function(){},Nz=function(a){this.a=new Jz(a);this.g=new _.M("clpp.ttml.Mp4TtmlParser")},Oz=function(){this.a=new Mz};Ry.prototype.getId=function(){return this.h};
11
- Ry.prototype.hasAttribute=function(a){return a in this.a};Ry.prototype.getAttribute=function(a){return this.a[a]};_.w(Sy,Ry);_.w(Ty,Ry);var Vy=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Wy=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,Yy=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d+)$/,Zy=/^(\d*(?:\.\d*)?)f$/,$y=/^(\d*(?:\.\d*)?)t$/,az=/^(?:(\d*(?:\.\d*)?)h)?(?:(\d*(?:\.\d*)?)m)?(?:(\d*(?:\.\d*)?)s)?(?:(\d*(?:\.\d*)?)ms)?$/,mz=/^(\d{1,2}(?:\.\d+)?|100(?:\.0+)?)% (\d{1,2}(?:\.\d+)?|100(?:\.0+)?)%$/,nz=/^(\d+)px (\d+)px$/,tz=/^(\d+) (\d+)$/,ez=/(\d+)px/,Pz=/^(\d+px|\d+em|\d*\.?\d+c)$/,xz=[Jy,"color",Ky,Ly,"fontFamily","fontSize","fontStyle","fontWeight",
12
- "lineHeight","opacity","padding",Oy,Py,"textOutline",Qy,"zIndex"],Hz=["begin",_.oe];_.w(hz,Ty);
13
- hz.prototype.build=function(a,b,c,d,e,f,g){var k=bz(this.a.begin,b);b=bz(this.a.end,b);if(null===k||null===b)return null;k+=c;b+=c;c=_.cj(_.Xd);for(var l=_.v(this.j),m=l.next();!m.done;m=l.next())c.appendChild(jz(g.get(m.value),e,g));g=new _.Jp(k,b,c.innerHTML.trim(),_.Eg);g.cssClassList=_.uh(this.f).concat();g.textAlign=iz(this,e,null);g.writingMode=_.Fp;g.line=-1;g.lineInterpretation=_.Gp;g.lineAlign=_.Hp;g.containerRows=rz(null,uz(a),15);if(this.o&&(f=f.get(this.o))){g.region=f.build(a,e);g.textAlign=
14
- iz(this,e,f);a:switch(Uy(f,e,Qy)){case "tb":case "tblr":a=_.Rg;break a;case "tbrl":a=_.Sg;break a;default:a=_.Fp}g.writingMode=a;a:switch(Uy(f,e,Ly)){case _.nd:a=50;break a;case "after":a=-1;break a;default:a=0}g.line=a;a:switch(Uy(f,e,Ly)){case _.nd:a=1;break a;default:a=_.Gp}g.lineInterpretation=a;a:switch(Uy(f,e,Ly)){case _.nd:e=_.nd;break a;default:e=_.Hp}g.lineAlign=e}this.l&&(a=d.get(this.l))&&(d=a.getAttribute("encoding"),e=a.getAttribute("imageType")||a.getAttribute("imagetype"),a=a.j.trim(),
15
- g.backgroundImage=("PNG"===e&&"Base64"===d&&0<a.length?"data:image/png;base64,"+a:null)||"");return g};_.w(lz,Ty);
16
- lz.prototype.build=function(a,b){var c=new _.Mp;c.id=this.getId();var d=rz(a.j.containerWidth,sz(a,1),720),e=rz(a.j.containerHeight,sz(a,2),480);a:switch(Uy(this,b,Ly)){case "after":var f="flex-start";break a;case _.nd:f=_.nd;break a;default:f="flex-end"}c.displayAlign=f;a:switch(Uy(this,b,Qy)){case "tb":case "tblr":f="row-reverse";break a;case "tbrl":f="row";break a;default:f=_.Gd}c.writingMode=f;f=this.getAttribute("extent")||Uy(this,b,"extent");c.width=oz(f,d,1,100);c.widthUnits=pz(f,d);c.height=
17
- oz(f,e,2,100);c.heightUnits=pz(f,e);f=this.getAttribute("origin")||Uy(this,b,"origin");c.viewportAnchorX=oz(f,d,1,0);c.viewportAnchorY=oz(f,e,2,0);c.viewportAnchorUnits=pz(f,d);c.cssClassList=_.uh(this.f).concat();return c};_.w(qz,Ry);_.w(vz,Ry);
18
- vz.prototype.build=function(a){var b=null;var c=uz(a);c&&(b=rz(a.j.containerHeight,sz(a,2),480)/c);b=rz(a.j.fontSizeRadix,b,16);a=[];c="::ttml ."+this.h+", ::ttml ."+this.h+" * {";for(var d=_.v(Qz.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+":"+dz(this.a[e])+";")}a:{if("unicodeBidi"in this.a){d=this.a.unicodeBidi;e="";switch(d){case "normal":case "embed":e=d;break;case "bidiOverride":e="bidi-override"}if(0<e.length){d="unicode-bidi:"+
19
- e+";";break a}}d=""}c+=d;a:{if("textOutline"in this.a){d=this.a.textOutline.split(" ");e="black";f=".4em";var g=d[0]&&d[0].trim(),k=d[1]&&d[1].trim(),l=d[2]&&d[2].trim();3===d.length&&!Pz.test(g)&&Pz.test(k)&&Pz.test(l)?(e=g,f=k):2===d.length&&!Pz.test(g)&&Pz.test(k)?(e=g,f=k):2===d.length&&Pz.test(g)&&Pz.test(k)&&(f=g);if(""!==f){f=dz(f);d="text-shadow:0 0 "+(f+" "+e+",0 0 ")+(f+" "+e+",0 0 ")+(f+" "+e+";");break a}}d=""}c+=d;"textShadow"in this.a?(d=gz(this.a.textShadow),d=dz(d),d="text-shadow:"+
20
- d+";"):d="";c=c+d+("fontFamily"in this.a?"font-family:"+this.a.fontFamily.replace("monospaceSansSerif","monospace").replace("monospaceSerif","monospace").replace("proportionalSansSerif",Ny).replace("proportionalSerif",Ny).replace("sansSerif",Ny).replace("default",Ny)+";":"");a:{if(Py in this.a){d=[];e=_.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:"+dz(this.a.padding)+";":"";c=c+d+e;"lineHeight"in this.a?(d="",e=this.a.lineHeight,e=dz(e),e=fz(e,b),d=d+"line-height:"+e+";"):d="";a.push(c+d+"}");a:{if("fontSize"in this.a&&(c=this.a.fontSize.split(" "),d=null,1===c.length&&(d=c[0]),2===c.length&&(d=c[1]),d)){d=d.trim();d=dz(d);d=fz(d,b);b="font-size:"+d+";";break a}b=null}b&&(c="::ttml ."+this.h+" .clpp-text-wrapper {",a.push(c+b+"}"),
22
- c="::ttml .clpp-text-wrapper__"+this.h+" {",a.push(c+b+"}"));return a};var Qz=new Map([[Jy,"background-color"],["color","color"],[Ky,Ky],["fontStyle","font-style"],["fontWeight","font-weight"],["opacity","opacity"],["zIndex","z-index"]]);var Az=0;Dz.prototype.Fe=function(){return!!this.a};Dz.prototype.next=function(){if(!this.a)return null;var a=this.a;do this.f.add(a),a.nodeType!==Node.TEXT_NODE&&!Rz.has(cz(a.nodeName))||Sz.has(cz(a.nodeName))||!a.firstChild||this.f.has(a.firstChild)?a.nextSibling?a=a.nextSibling:a=a.parentNode:a=a.firstChild;while(a&&(this.f.has(a)||a.nodeType!==Node.TEXT_NODE&&!Rz.has(cz(a.nodeName))));var b=this.a;this.a=a;return b};
23
- var Rz=new Set(["tt","head","layout",_.Se,_.Be,My,"styling",_.pg,"body",_.Xd,"p","span","br"]),Sz=new Set([_.pg,_.Be]);Ez.prototype.getId=function(){return this.attributes.id};Jz.prototype.parseInit=function(){};
24
- Jz.prototype.parseMedia=function(a,b,c){c&&c.length||(c=[a.byteLength]);var d=_.N.xb(this.a.ttml||{}),e=_.Vi(a,0,c[0]);e=_.R.ea(e);if(""===e)return{cues:[],styles:[]};var f=null;try{f=this.f.parseFromString(e,_.vg)}catch(n){throw new _.O(_.P,2,2005,"Failed to parse TTML.");}d=new wz(d);e=new Gz;f=new Dz(f);b=b.periodStart;typeof b===_.h&&(d.A=b);b=c[0];for(var g=1;g<c.length;++g){var k=c[g],l=_.Vi(a,b,k);l=_.Nm(l);var m="urn:mpeg:14496-30:subs:"+g;d.h.set(m,new Sy(m,l,{imageType:"PNG",encoding:"Base64"}));
25
- b+=k}for(;f.Fe();)a=f.next(),a=Iz(e,a),"tt"===Fz(a)&&(d.l=new qz(d.B,Object.assign({},a.attributes))),"tt"===Fz(a)&&(d.w=new kz(a.attributes.frameRate,a.attributes.subFrameRate,a.attributes.frameRateMultiplier,a.attributes.tickRate)),Fz(a)!==_.Be||a.attributes.begin||a.attributes.end||(c="#"+a.getId(),d.h.set(c,new Sy(c,a.h.textContent,a.attributes))),Fz(a)===_.Be&&a.attributes.begin&&a.attributes.end?(c="#"+Bz(),b=new Sy(c,a.h.textContent,a.attributes),d.h.set(c,b),c=b):c=null,c&&(a.j=c.getId()),
26
- Fz(a)===_.pg&&(c=a.getId()||Bz(),b=new vz(c,a.f,Object.assign({},a.attributes)),d.a.set(c,b),a.a&&d.j.get(a.a).f.push(c)),Fz(a)!==_.pg&&yz(a)?(c=Bz(),b=new vz(c,[],Object.assign({},a.attributes)),d.a.set(c,b),c=b):c=null,c&&a.f.push(c.getId()),Fz(a)!==_.Xd||!a.attributes.extent&&!a.attributes.origin?c=null:(c=Bz(),b=new lz(c,zz(d,a.f),Object.assign({},a.attributes)),d.j.set(c,b),c=b),c&&(a.a=c.getId()),Fz(a)!==My?c=null:(c=a.getId(),b=new lz(c,zz(d,a.f),Object.assign({},a.attributes)),d.j.set(c,b),
27
- c=b),c&&(a.a=c.getId()),c=a.l,-1===[_.da,"span","br"].indexOf(Fz(a))||0===c.length?c=null:(g=c[c.length-1],d.f.has(g)?(c=Bz(),b=new hz(c,a.h.nodeName===_.da?a.h.textContent:null,"br"===Fz(a),a.a,a.j,zz(d,a.f),a.attributes),d.f.set(c,b),(g=d.f.get(g))&&g.j.push(c),c=b):c=null),c&&a.l.push(c.getId()),"p"===Fz(a)||a.j?(c=Bz(),b=new hz(c,null,!1,a.a,a.j,zz(d,a.f),a.attributes),d.f.set(c,b),d.o.push(b),c=b):c=null,c&&a.l.push(c.getId());e=Cz(d);f=[];a=_.v(d.a.values());for(c=a.next();!c.done;c=a.next())f.push.apply(f,
28
- _.uh(c.value.build(d.l)));return{cues:e,styles:f}};Kz.prototype.a=function(a){a=(new Jz(this.f)).parseMedia(a,{periodStart:0,segmentStart:null,segmentEnd:0}).cues;var b="WEBVTT\n\n";a=_.v(a);for(var c=a.next();!c.done;c=a.next()){c=c.value;var d=Lz(c.startTime)+" --\x3e "+Lz(c.endTime),e=[];switch(c.textAlign){case _.Ee:e.push("align:left");break;case _.Wf:e.push("align:right");break;case _.Ep:e.push("align:middle");break;case _.jg:e.push("align:start");break;case _.oe:e.push("align:end")}switch(c.writingMode){case _.Rg:e.push("vertical:lr");break;
29
- case _.Sg:e.push("vertical:rl")}b+=d+(e.length?" "+e.join(" "):"")+"\n";b+=c.payload+"\n\n"}return _.R.ub(b)};Mz.prototype.probe=function(a,b){return a===_.Pc&&b===_.ug};Mz.prototype.create=function(a){return new Kz(a)};Nz.prototype.parseInit=function(a){var b=!1;(new _.tq).N(_.We,_.uq).N(_.Dg,_.uq).N(_.Qe,_.uq).N(_.Ve,_.uq).N(_.mg,_.uq).da(_.og,_.vq).N("stpp",function(c){b=!0;c.parser.stop()}).parse(a);if(!b)throw new _.O(_.P,2,2007);};
30
- Nz.prototype.parseMedia=function(a,b){var c=this,d=!1,e=[],f=[],g=[];(new _.tq).N("moof",_.uq).N("traf",_.uq).da("subs",function(k){for(var l=_.oq(k.reader),m=0;m<l;++m){k.reader.skip(4);for(var n=_.nq(k.reader),p=0;p<n;++p){var q=1===k.version?_.oq(k.reader):_.nq(k.reader);g.push(q);k.reader.skip(6)}}}).N(_.Pe,_.wq(function(k){d=!0;k=c.a.parseMedia(k,b,g);e=e.concat(k.cues);f=f.concat(k.styles)})).parse(a);d||this.g.warn("Couldn't find the mdat box");return{cues:e,styles:f}};_.w(Oz,_.jv);Oz.prototype.install=function(){_.Bv(_.Pc,Jz);_.Bv(_.Nc,Nz);_.Bv(Gy,Nz);_.Bv(Iy,Nz);_.Bv(Hy,Nz);_.Ct.push(this.a)};Oz.prototype.uninstall=function(){_.Dv(_.Pc);_.Dv(_.Nc);_.Dv(Gy);_.Dv(Iy);_.Dv(Hy);_.Et(this.a)};Oz.prototype.id=function(){return"subtitles-ttml"};_.K("clpp.ttml.TtmlComponent",Oz);};
2
+ var f=function(window){var Cy='application/mp4; codecs\x3d"stpp.ttml"',Dy='application/mp4; codecs\x3d"stpp.ttml.im1i"',Ey='application/mp4; codecs\x3d"stpp.ttml.im1t"',Fy="backgroundColor",Gy="direction",Hy="displayAlign",Iy="region",Jy="sans-serif",Ky="textAlign",Ly="textDecoration",My="writingMode",Ny=function(a,b,c){this.h=a;this.f=b;this.a=c},Oy=function(a,b,c){Ny.call(this,a,[],c);this.j=b||""},Py=function(a,b,c){Ny.call(this,a,b,c)},Qy=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
+ Yy=function(a,b){var c=null;if(Ry.test(a)){c=Ry.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 Sy.test(a)?c=Ty(Sy,a):Uy.test(a)?c=Ty(Uy,a):Vy.test(a)?(c=Vy.exec(a),c=Number(c[1])/b.frameRate):Wy.test(a)?(c=Wy.exec(a),c=Number(c[1])/b.a):Xy.test(a)&&(c=Ty(Xy,a));return c},Ty=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)},Zy=function(a){return a.split(":").pop()},$y=function(a){return a.replace(/(\d*\.?\d+)c/g,"$1em")},bz=function(a,b){for(;az.test(a);){var c=az.exec(a)[0];a=a.replace(c,parseInt(c,10)/b+"em")}return a},cz=function(a){return a?a.replace(/(\d*\.?\d+)%/g,function(b,c){return c/100+"em"}):""},dz=function(a,b,c,d,e,f,g){Ny.call(this,a,f,g);this.w=b;this.A=c;this.o=d;this.l=e;this.j=[]},ez=function(a,b,c){a=Qy(a,b,Ky);if(!a&&c&&(a=Qy(c,b,Ky),!a&&"rltb"===Qy(c,b,My)))return _.pe;switch(a){case _.od:return _.Ap;
5
+ case _.Wf:case _.pe:return _.pe;default:return _.jg}},fz=function(a,b,c){if(_.R.Rf(a.w))return document.createTextNode(_.R.qh(a.w||""));if(a.A)return _.Zi("br");for(var d=_.Zi("span"),e=_.v(a.f),f=e.next();!f.done;f=e.next())_.$i(d,f.value);a=_.v(a.j);for(e=a.next();!e.done;e=a.next())d.appendChild(fz(c.get(e.value),b,c));return d},gz=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]))},hz=function(a,b,c){Ny.call(this,a,b,c)},kz=function(a,b,c,d){var e=iz.exec(a);a=jz.exec(a);return typeof b===_.h&&0<b&&a?100*Number(a[c])/b:e?Number(e[c]):a?Number(a[c]):d},lz=function(a,b){return typeof b===_.h&&0<b?_.Gp:jz.test(a)?0:_.Gp},mz=function(a,b){Ny.call(this,"root-container",[],b);this.j=a},nz=function(a,b,c){return typeof a===_.h?a:typeof b===_.h?b:c},oz=function(a,b){var c=a.getAttribute("extent");return(c=jz.exec(c))?Number(c[b]):null},qz=
7
+ function(a){a=a.getAttribute("cellResolution");return(a=pz.exec(a))?Number(a[2]):null},rz=function(a,b,c){Ny.call(this,a,b,c)},sz=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=[]},uz=function(a){return tz.some(function(b){return b in a.attributes})},vz=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,_.qh(vz(a,a.a.get(e).f)).concat([e]));return c},xz=
8
+ function(){return"inline-"+wz++},yz=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})},zz=function(a){this.a=a.firstChild;this.f=new Set},Az=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},Bz=function(a){return Zy(a.h.nodeName)},Cz=function(){this.a=new Map},Ez=function(a,b){if(a.a.has(b))return a.a.get(b);var c=null,d=null,e=[],f=[],g={},k=b.parentNode;if(k&&a.a.has(k)){var l=a.a.get(k);e=
9
+ _.qh(l.l).concat();-1===[_.da,"span","br"].indexOf(b.nodeName)&&(c=l.a,d=l.j,f=_.qh(l.f).concat(),g={},Dz.forEach(function(n){n in l.attributes&&(g[n]=l.attributes[n])}))}if(b.nodeType===b.ELEMENT_NODE){b.hasAttribute(Iy)&&(c=b.getAttribute(Iy));b.hasAttribute(_.pg)&&f.push.apply(f,_.qh(b.getAttribute(_.pg).split(" ")));d=Array.from(b.attributes).map(function(n){return n.name});d=_.v(d);for(k=d.next();!k.done;k=d.next()){k=k.value;var m=Zy(k);g[m]=b.getAttribute(k)}d=g.backgroundImage}c=new Az(b,
10
+ c,d,e,f,g);a.a.set(b,c);return c},Fz=function(a){this.a=a;this.f=new DOMParser},Gz=function(a){this.f=a},Hz=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")},Iz=function(){},Jz=function(a){this.a=new Fz(a);this.g=new _.M("clpp.ttml.Mp4TtmlParser")},Kz=function(){this.a=new Iz};Ny.prototype.getId=function(){return this.h};
11
+ Ny.prototype.hasAttribute=function(a){return a in this.a};Ny.prototype.getAttribute=function(a){return this.a[a]};_.w(Oy,Ny);_.w(Py,Ny);var Ry=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Sy=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,Uy=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d+)$/,Vy=/^(\d*(?:\.\d*)?)f$/,Wy=/^(\d*(?:\.\d*)?)t$/,Xy=/^(?:(\d*(?:\.\d*)?)h)?(?:(\d*(?:\.\d*)?)m)?(?:(\d*(?:\.\d*)?)s)?(?:(\d*(?:\.\d*)?)ms)?$/,iz=/^(\d{1,2}(?:\.\d+)?|100(?:\.0+)?)% (\d{1,2}(?:\.\d+)?|100(?:\.0+)?)%$/,jz=/^(\d+)px (\d+)px$/,pz=/^(\d+) (\d+)$/,az=/(\d+)px/,Lz=/^(\d+px|\d+em|\d*\.?\d+c)$/,tz=[Fy,"color",Gy,Hy,"fontFamily","fontSize","fontStyle","fontWeight",
12
+ "lineHeight","opacity","padding",Ky,Ly,"textOutline",My,"zIndex"],Dz=["begin",_.pe];_.w(dz,Py);
13
+ dz.prototype.build=function(a,b,c,d,e,f,g){var k=Yy(this.a.begin,b);b=Yy(this.a.end,b);if(null===k||null===b)return null;k+=c;b+=c;c=_.Zi(_.Yd);for(var l=_.v(this.j),m=l.next();!m.done;m=l.next())c.appendChild(fz(g.get(m.value),e,g));g=new _.Fp(k,b,c.innerHTML.trim(),_.Eg);g.cssClassList=_.qh(this.f).concat();g.textAlign=ez(this,e,null);g.writingMode=_.Bp;g.line=-1;g.lineInterpretation=_.Cp;g.lineAlign=_.Dp;g.containerRows=nz(null,qz(a),15);if(this.o&&(f=f.get(this.o))){g.region=f.build(a,e);g.textAlign=
14
+ ez(this,e,f);a:switch(Qy(f,e,My)){case "tb":case "tblr":a=_.Rg;break a;case "tbrl":a=_.Sg;break a;default:a=_.Bp}g.writingMode=a;a:switch(Qy(f,e,Hy)){case _.od:a=50;break a;case "after":a=-1;break a;default:a=0}g.line=a;a:switch(Qy(f,e,Hy)){case _.od:a=1;break a;default:a=_.Cp}g.lineInterpretation=a;a:switch(Qy(f,e,Hy)){case _.od:e=_.od;break a;default:e=_.Dp}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(hz,Py);
16
+ hz.prototype.build=function(a,b){var c=new _.Ip;c.id=this.getId();var d=nz(a.j.containerWidth,oz(a,1),720),e=nz(a.j.containerHeight,oz(a,2),480);a:switch(Qy(this,b,Hy)){case "after":var f="flex-start";break a;case _.od:f=_.od;break a;default:f="flex-end"}c.displayAlign=f;a:switch(Qy(this,b,My)){case "tb":case "tblr":f="row-reverse";break a;case "tbrl":f="row";break a;default:f=_.Hd}c.writingMode=f;f=this.getAttribute("extent")||Qy(this,b,"extent");c.width=kz(f,d,1,100);c.widthUnits=lz(f,d);c.height=
17
+ kz(f,e,2,100);c.heightUnits=lz(f,e);f=this.getAttribute("origin")||Qy(this,b,"origin");c.viewportAnchorX=kz(f,d,1,0);c.viewportAnchorY=kz(f,e,2,0);c.viewportAnchorUnits=lz(f,d);c.cssClassList=_.qh(this.f).concat();return c};_.w(mz,Ny);_.w(rz,Ny);
18
+ rz.prototype.build=function(a){var b=null;var c=qz(a);c&&(b=nz(a.j.containerHeight,oz(a,2),480)/c);b=nz(a.j.fontSizeRadix,b,16);a=[];c="::ttml ."+this.h+", ::ttml ."+this.h+" * {";for(var d=_.v(Mz.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+":"+$y(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(),k=d[1]&&d[1].trim(),l=d[2]&&d[2].trim();3===d.length&&!Lz.test(g)&&Lz.test(k)&&Lz.test(l)?(e=g,f=k):2===d.length&&!Lz.test(g)&&Lz.test(k)?(e=g,f=k):2===d.length&&Lz.test(g)&&Lz.test(k)&&(f=g);if(""!==f){f=$y(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=cz(this.a.textShadow),d=$y(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",Jy).replace("proportionalSerif",Jy).replace("sansSerif",Jy).replace("default",Jy)+";":"");a:{if(Ly 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:"+$y(this.a.padding)+";":"";c=c+d+e;"lineHeight"in this.a?(d="",e=this.a.lineHeight,e=$y(e),e=bz(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=$y(d);d=bz(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 Mz=new Map([[Fy,"background-color"],["color","color"],[Gy,Gy],["fontStyle","font-style"],["fontWeight","font-weight"],["opacity","opacity"],["zIndex","z-index"]]);var wz=0;zz.prototype.Ge=function(){return!!this.a};zz.prototype.next=function(){if(!this.a)return null;var a=this.a;do this.f.add(a),a.nodeType!==Node.TEXT_NODE&&!Nz.has(Zy(a.nodeName))||Oz.has(Zy(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&&!Nz.has(Zy(a.nodeName))));var b=this.a;this.a=a;return b};
23
+ var Nz=new Set(["tt","head","layout",_.Se,_.Be,Iy,"styling",_.pg,"body",_.Yd,"p","span","br"]),Oz=new Set([_.pg,_.Be]);Az.prototype.getId=function(){return this.attributes.id};Fz.prototype.parseInit=function(){};
24
+ Fz.prototype.parseMedia=function(a,b,c){c&&c.length||(c=[a.byteLength]);var d=_.N.xb(this.a.ttml||{}),e=_.Ri(a,0,c[0]);e=_.R.ga(e);if(""===e)return{cues:[],styles:[]};var f=null;try{f=this.f.parseFromString(e,_.vg)}catch(n){throw new _.O(_.P,2,2005,"Failed to parse TTML.");}d=new sz(d);e=new Cz;f=new zz(f);b=b.periodStart;typeof b===_.h&&(d.A=b);b=c[0];for(var g=1;g<c.length;++g){var k=c[g],l=_.Ri(a,b,k);l=_.Jm(l);var m="urn:mpeg:14496-30:subs:"+g;d.h.set(m,new Oy(m,l,{imageType:"PNG",encoding:"Base64"}));
25
+ b+=k}for(;f.Ge();)a=f.next(),a=Ez(e,a),"tt"===Bz(a)&&(d.l=new mz(d.B,Object.assign({},a.attributes))),"tt"===Bz(a)&&(d.w=new gz(a.attributes.frameRate,a.attributes.subFrameRate,a.attributes.frameRateMultiplier,a.attributes.tickRate)),Bz(a)!==_.Be||a.attributes.begin||a.attributes.end||(c="#"+a.getId(),d.h.set(c,new Oy(c,a.h.textContent,a.attributes))),Bz(a)===_.Be&&a.attributes.begin&&a.attributes.end?(c="#"+xz(),b=new Oy(c,a.h.textContent,a.attributes),d.h.set(c,b),c=b):c=null,c&&(a.j=c.getId()),
26
+ Bz(a)===_.pg&&(c=a.getId()||xz(),b=new rz(c,a.f,Object.assign({},a.attributes)),d.a.set(c,b),a.a&&d.j.get(a.a).f.push(c)),Bz(a)!==_.pg&&uz(a)?(c=xz(),b=new rz(c,[],Object.assign({},a.attributes)),d.a.set(c,b),c=b):c=null,c&&a.f.push(c.getId()),Bz(a)!==_.Yd||!a.attributes.extent&&!a.attributes.origin?c=null:(c=xz(),b=new hz(c,vz(d,a.f),Object.assign({},a.attributes)),d.j.set(c,b),c=b),c&&(a.a=c.getId()),Bz(a)!==Iy?c=null:(c=a.getId(),b=new hz(c,vz(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(Bz(a))||0===c.length?c=null:(g=c[c.length-1],d.f.has(g)?(c=xz(),b=new dz(c,a.h.nodeName===_.da?a.h.textContent:null,"br"===Bz(a),a.a,a.j,vz(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"===Bz(a)||a.j?(c=xz(),b=new dz(c,null,!1,a.a,a.j,vz(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=yz(d);f=[];a=_.v(d.a.values());for(c=a.next();!c.done;c=a.next())f.push.apply(f,
28
+ _.qh(c.value.build(d.l)));return{cues:e,styles:f}};Gz.prototype.a=function(a){a=(new Fz(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=Hz(c.startTime)+" --\x3e "+Hz(c.endTime),e=[];switch(c.textAlign){case _.Ee:e.push("align:left");break;case _.Wf:e.push("align:right");break;case _.Ap:e.push("align:middle");break;case _.jg:e.push("align:start");break;case _.pe:e.push("align:end")}switch(c.writingMode){case _.Rg:e.push("vertical:lr");break;
29
+ case _.Sg:e.push("vertical:rl")}b+=d+(e.length?" "+e.join(" "):"")+"\n";b+=c.payload+"\n\n"}return _.R.ub(b)};Iz.prototype.probe=function(a,b){return a===_.Qc&&b===_.ug};Iz.prototype.create=function(a){return new Gz(a)};Jz.prototype.parseInit=function(a){var b=!1;(new _.oq).N(_.We,_.pq).N(_.Dg,_.pq).N(_.Qe,_.pq).N(_.Ve,_.pq).N(_.mg,_.pq).da(_.og,_.qq).N("stpp",function(c){b=!0;c.parser.stop()}).parse(a);if(!b)throw new _.O(_.P,2,2007);};
30
+ Jz.prototype.parseMedia=function(a,b){var c=this,d=!1,e=[],f=[],g=[];(new _.oq).N("moof",_.pq).N("traf",_.pq).da("subs",function(k){for(var l=_.jq(k.reader),m=0;m<l;++m){k.reader.skip(4);for(var n=_.iq(k.reader),p=0;p<n;++p){var q=1===k.version?_.jq(k.reader):_.iq(k.reader);g.push(q);k.reader.skip(6)}}}).N(_.Pe,_.rq(function(k){d=!0;k=c.a.parseMedia(k,b,g);e=e.concat(k.cues);f=f.concat(k.styles)})).parse(a);d||this.g.warn("Couldn't find the mdat box");return{cues:e,styles:f}};_.w(Kz,_.fv);Kz.prototype.install=function(){_.xv(_.Qc,Fz);_.xv(_.Nc,Jz);_.xv(Cy,Jz);_.xv(Ey,Jz);_.xv(Dy,Jz);_.ut.push(this.a)};Kz.prototype.uninstall=function(){_.zv(_.Qc);_.zv(_.Nc);_.zv(Cy);_.zv(Ey);_.zv(Dy);_.wt(this.a)};Kz.prototype.id=function(){return"subtitles-ttml"};_.J("clpp.ttml.TtmlComponent",Kz);};
31
31
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
32
32
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
33
33
  else{_=this.clpp._;(f.call(g,this));}
@@ -1,9 +1,9 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var uy="VerimatrixVCAS",vy="clpp.verimatrix.Vcas",wy="clpp.verimatrix.VcasComponent",Cy=function(a){_.eq.call(this,uy);var b={};b[xy]=xy;b[yy]=yy;var c=a.authenticator,d=void 0===a.licenseRequestVuidLocation?zy:a.licenseRequestVuidLocation;b=void 0===a.httpHeaderNames?b:a.httpHeaderNames;var e=a.widevineLicenseUrl,f=a.playReadyLicenseUrl,g=a.fairPlayLicenseUrl,k=a.fairPlayCertificateUrl,l=a.fairPlaySiteId,m=void 0===a.fairPlayAssetIdStrategy?Ay:a.fairPlayAssetIdStrategy;this.A=a.deviceId;this.a=c;
3
- this.D=d;this.B=b;this.w=By(this,e);this.o=By(this,f);this.l=By(this,g);this.j=k;this.H=l;this.G=m;this.g=new _.M(vy);_.R.empty(this.w)?this.g.warn(_.Yb):this.Ma(_.Md,{licenseUrl:this.w,videoRobustness:[_.Db,void 0],audioRobustness:[_.Cb,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:this.h.bind(this)}});_.R.empty(this.o)?this.g.warn(_.sb):this.Ma(_.Kd,{licenseUrl:this.o,videoRobustness:["3000"],audioRobustness:["2000"],modifiers:{licenseRequest:this.h.bind(this)}});
4
- _.R.empty(this.l)?this.g.warn(_.Pa):_.R.empty(this.j)?this.g.warn(_.Oa):this.Ma(_.Id,{licenseUrl:this.l,certificateUrl:this.j,modifiers:{licenseRequest:this.K.bind(this),licenseResponse:this.L.bind(this),extractContentId:this.I.bind(this)}})},By=function(a,b){if(a.D===zy){var c=Object.assign({},{deviceId:_.Om(_.R.Yd(a.A))},a.a&&{authenticator:_.Om(_.R.Yd(a.a))});return b+_.Bn(c)}return b},Dy=function(){this.g=new _.M(wy)};_.w(Cy,_.eq);
5
- Cy.prototype.h=function(a,b){if(this.D===Ey){var c=this.B[yy],d={};d[this.B[xy]]=this.A;this.a&&(d[c]=this.a);Object.keys(d).forEach(function(e){b.headers[e]=d[e]})}};Cy.prototype.I=function(a,b){var c=_.Cq(b);switch(this.G){case Fy:c=_.Bn({r:c,iq:this.H},!0)}return c};Cy.prototype.K=function(a,b){this.h(a,b);_.Fq(b)};Cy.prototype.L=function(a,b){_.Gq(b)};_.K(vy,Cy);Cy.prototype.constructor=Cy.prototype.constructor;Cy.NAME=uy;var zy="query-string",Ey="http-header";
6
- Cy.LicenseRequestVuidLocation={QUERY_STRING:zy,HTTP_HEADER:Ey};var xy="DeviceId",yy="Authenticator";Cy.LicenseRequestHttpHeader={DEVICE_ID_HEADER:xy,AUTHENTICATOR_HEADER:yy};var Ay="keyid",Fy="contentid-siteid";Cy.FairPlayAssetIdStrategy={KEYID:Ay,CONTENTID_SITEID:Fy};_.w(Dy,_.jv);Dy.prototype.uninstall=function(){delete _.Yn.VerimatrixVCAS};Dy.prototype.beforeLoad=function(a){a=a.getConfiguration();if(a.drm&&a.drm.env===uy){a=a.drm.customData;if(!a)throw new _.O(_.P,7,7100,_.Nd);a=new Cy(a);this.g.info("Registering the Verimatrix VCAS Ultra environment");_.Zn(a)}};Dy.prototype.id=function(){return"verimatrix-vcas"};_.K(wy,Dy);};
2
+ var f=function(window){var qy="VerimatrixVCAS",ry="clpp.verimatrix.Vcas",sy="clpp.verimatrix.VcasComponent",yy=function(a){_.$p.call(this,qy);var b={};b[ty]=ty;b[uy]=uy;var c=a.authenticator,d=void 0===a.licenseRequestVuidLocation?vy:a.licenseRequestVuidLocation;b=void 0===a.httpHeaderNames?b:a.httpHeaderNames;var e=a.widevineLicenseUrl,f=a.playReadyLicenseUrl,g=a.fairPlayLicenseUrl,k=a.fairPlayCertificateUrl,l=a.fairPlaySiteId,m=void 0===a.fairPlayAssetIdStrategy?wy:a.fairPlayAssetIdStrategy;this.A=a.deviceId;this.a=c;
3
+ this.D=d;this.B=b;this.w=xy(this,e);this.o=xy(this,f);this.l=xy(this,g);this.j=k;this.H=l;this.G=m;this.g=new _.M(ry);_.R.empty(this.w)?this.g.warn(_.Yb):this.rb(_.Nd,{licenseUrl:this.w,videoRobustness:[_.Db,void 0],audioRobustness:[_.Cb,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:this.h.bind(this)}});_.R.empty(this.o)?this.g.warn(_.sb):this.rb(_.Ld,{licenseUrl:this.o,videoRobustness:["3000"],audioRobustness:["2000"],modifiers:{licenseRequest:this.h.bind(this)}});
4
+ _.R.empty(this.l)?this.g.warn(_.Pa):_.R.empty(this.j)?this.g.warn(_.Oa):this.rb(_.Jd,{licenseUrl:this.l,certificateUrl:this.j,modifiers:{licenseRequest:this.K.bind(this),licenseResponse:this.L.bind(this),extractContentId:this.I.bind(this)}})},xy=function(a,b){if(a.D===vy){var c=Object.assign({},{deviceId:_.Km(_.R.Xd(a.A))},a.a&&{authenticator:_.Km(_.R.Xd(a.a))});return b+_.xn(c)}return b},zy=function(){this.g=new _.M(sy)};_.w(yy,_.$p);
5
+ yy.prototype.h=function(a,b){if(this.D===Ay){var c=this.B[uy],d={};d[this.B[ty]]=this.A;this.a&&(d[c]=this.a);Object.keys(d).forEach(function(e){b.headers[e]=d[e]})}};yy.prototype.I=function(a,b){var c=_.xq(b);switch(this.G){case By:c=_.xn({r:c,fq:this.H},!0)}return c};yy.prototype.K=function(a,b){this.h(a,b);_.Aq(b)};yy.prototype.L=function(a,b){_.Bq(b)};_.J(ry,yy);yy.prototype.constructor=yy.prototype.constructor;yy.NAME=qy;var vy="query-string",Ay="http-header";
6
+ yy.LicenseRequestVuidLocation={QUERY_STRING:vy,HTTP_HEADER:Ay};var ty="DeviceId",uy="Authenticator";yy.LicenseRequestHttpHeader={DEVICE_ID_HEADER:ty,AUTHENTICATOR_HEADER:uy};var wy="keyid",By="contentid-siteid";yy.FairPlayAssetIdStrategy={KEYID:wy,CONTENTID_SITEID:By};_.w(zy,_.fv);zy.prototype.uninstall=function(){delete _.Un.VerimatrixVCAS};zy.prototype.beforeLoad=function(a){a=a.getConfiguration();if(a.drm&&a.drm.env===qy){a=a.drm.customData;if(!a)throw new _.O(_.P,7,7100,_.Pd);a=new yy(a);this.g.info("Registering the Verimatrix VCAS Ultra environment");_.Vn(a)}};zy.prototype.id=function(){return"verimatrix-vcas"};_.J(sy,zy);};
7
7
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
8
8
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
9
9
  else{_=this.clpp._;(f.call(g,this));}
package/cjs/cl.vimond.js CHANGED
@@ -1,16 +1,16 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var ky="Registering listeners",ly="clpp.vimond.VimondPlugin",my=function(a,b,c,d,e){this.G=a;this.H=b;this.I=c;this.m=d;this.D=e;this.a=new _.Bi;this.l=!0;this.h=this.j=this.A=!1;this.B=null;this.f=new _.lj(this.zi.bind(this));this.g=new _.M("clpp.vimond.VimondDispatcher");this.o=this.w=0;this.m&&this.a&&(this.g.debug(ky),this.a.on(this.m,_.kg,this.Ul.bind(this)),this.a.on(this.m,_.Bg,this.Vl.bind(this)),this.a.on(this.m,_.ic,this.Sl.bind(this)),this.a.on(this.m,_.jc,this.Tl.bind(this)))},ny=function(a,
3
- b){a.m.trigger(new _.Q(_.Yg,{detail:b}))},oy=function(a,b,c){b&&(a.A=!0,a.f.stop());a.m.onError(new _.O(b?_.P:1,9,9201,c))},py=function(a,b,c,d,e){this.l=a;this.o=c;this.h=b;this.a=d;this.j=e;this.g=new _.M("clpp.vimond.VimondService");this.f=0},qy=function(a){this.m=a;this.a=new _.Bi;this.g=new _.M("clpp.vimond.VimondAdapter");this.f=this.h=!1;this.m&&this.a&&(this.g.debug(ky),this.a.on(this.m,_.Sf,this.o.bind(this)),this.a.on(this.m,_.ic,this.j.bind(this)),this.a.on(this.m,_.jc,this.l.bind(this)))},
4
- ry=function(a,b){var c=a.m.getState();if(1===b)return["str-start",_.Af];if(a.h)return[_.oe,_.lf];if(5===c)return[_.oe,null];if(c===_.Fo)return[_.qe,_.lf];var d=_.lf;if(2===c||3===c||a.f)d=_.Af;return["period",d]},sy=function(){this.a=!1;this.g=new _.M(ly);this.j=this.h=this.f=null},ty=function(){};_.r=my.prototype;_.r.Vl=function(){this.h||(this.h=1<Math.abs(this.w-this.m.getPosition()));this.w=this.m.getPosition()};_.r.Sl=function(){this.g.debug("Ad break started");this.j=!0};
5
- _.r.Tl=function(){this.g.debug("Ad break stopped");this.j=!1};
6
- _.r.Ul=function(a){var b=this,c,d,e,f,g;return _.I(function(k){if(1==k.a){c=a.detail;d=_.tu;e=c.currentState;f=c.previousState;b.g.debug("State changed, prev: "+f+" curr: "+e);if(b.A||b.j)return k["return"]();if(e===b.B&&!b.h)return b.g.debug("Ignore transition"),k["return"]();if(b.l&&e!==d.PLAYING)return k["return"]();if(b.h&&[d.PAUSED,d.BUFFERING].includes(e))return b.g.debug("Seeking"),k["return"]();b.h&&e===d.PLAYING&&(b.g.debug("Seeked"),b.h=!1);g=[d.PLAYING,d.PAUSED,d.ERROR,d.ENDED];if(!g.includes(e))return k.C(0);
7
- b.B=e;return _.y(k,b.zi(),3)}e===d.ENDED&&b.f.stop();_.A(k)})};
8
- _.r.zi=function(){var a=this,b,c,d,e,f,g;return _.I(function(k){if(1==k.a){var l=Math.floor(Date.now()/1E3);0<a.o&&a.g.debug("Last event was "+(l-a.o)+" seconds ago");a.o=l;a.f.stop();a.f.ia(a.l?10:a.G);a.l=!1;_.F(k,2);return _.y(k,a.D.fireEvent(),4)}if(2!=k.a)return b=k.f,ny(a,b),_.G(k,0);d=c=_.H(k);e=d.code;f=d.data;g=[1002,1003];g.includes(e)?(a.g.debug("Unreachable service"),ny(a,f),oy(a,a.H,f)):1001===e?(a.g.debug("Generic service error"),ny(a,f),oy(a,a.I,f)):a.g.error(c.toString());_.A(k)})};py.prototype.fireEvent=function(){this.f++;var a=_.N.ta(this.o);a.client.buildName=_.ya;a.client.buildVersion=_.ia;var b=a.client,c=this.a.m.getDrmInfo();b.drm=c?c.keySystem:"";a.client.pageUrl=document.location.href;a.client.streamUrl=this.a.m.ab().url;a.client.userAgent=navigator.userAgent;a.client.videoFormat=this.a.m.ab().type||"";b=a.client;c=this.a.m.ab();c=((new _.zn(c.url)).scheme||"").replace(":","");b.videoProtocol=c;b=ry(this.a,this.f);a.client.playerEvent=b[0]||"";a.client.playerState=
9
- b[1]||"";a.progress.vod&&(a.progress.vod.position=this.a.getPosition());if(b=a.progress.live){c=this.a;var d=c.m.getPresentationStartTime()||0;c=Math.floor(d+c.m.getPosition());c=(new Date(1E3*c)).toISOString();b.position=c;d=this.a;c=d.m.getPosition();d=d.m.getSeekRange().end;b.onLiveEdge=30>Math.abs(d-c);typeof b.liveResumePossible!==_.cd&&(b.liveResumePossible=!0)}a.progress.eventNumber=this.f;a.timestamp=(new Date).toISOString();this.g.debug("Fire an event");b=_.dl(this.l);b.method=_.rb;b.contentType=
10
- "application/json";b.headers.Authorization="Bearer "+this.h;b.body=_.R.Yd(JSON.stringify(a));return this.j.fetch(b).U};py.prototype.Ch=function(a){this.h=a};qy.prototype.getPosition=function(){return Math.floor(this.m.getPosition())};qy.prototype.o=function(){this.h=!0};qy.prototype.j=function(){this.f=!0};qy.prototype.l=function(){this.f=!1};_.w(sy,_.gw);_.r=sy.prototype;_.r.onPlayerCreated=function(){};
11
- _.r.onContentWillLoad=function(a){var b=a.getConfiguration();(this.a=!_.N.R(b.vimond)&&typeof b.vimond===_.$e)?a.namespace()===_.xd&&(this.a=!1,this.g.info("Vimond does not report when casting.")):this.g.debug("Vimond plugin is loaded but not configured. Will do nothing.");if(this.a){b=a.getConfiguration().vimond;for(var c=_.v(["authToken","playerEventRequest"]),d=c.next();!d.done;d=c.next())if(d=d.value,!b[d]){this.g.warn(d+" key is missing");a.onError(new _.O(1,9,9200));return}this.g.debug("Configuration is valid");
12
- c=b.failIfUnreachable;typeof c!==_.cd&&(c=!0);d=b.failOnError;typeof d!==_.cd&&(d=!0);this.f=new qy(a);this.h=new py(b.playerEventRequest.uri,b.authToken,b.playerEventRequest.body,this.f,a.getNetworkEngine());this.j=new my(b.playerEventRequest.eventInterval,c,d,a,this.h)}};_.r.onPlayerWillRelease=function(){if(this.a){if(this.f){var a=this.f;a.g.debug(_.Qb);_.Ei(a.a)}this.j&&(a=this.j,a.g.debug(_.Qb),_.Ei(a.a),a.f.stop());this.j=this.h=this.f=null}};_.r.onPlayerWillDestroy=function(){};_.r.id=function(){return"vimond"};
13
- _.r.Ch=function(a){this.a&&this.h&&this.h.Ch(a)};_.K(ly,sy);sy.prototype.updateAuthToken=sy.prototype.Ch;sy.Id="vimond";ty.prototype.create=function(){return new sy};_.fp(new ty);};
2
+ var f=function(window){var gy="Registering listeners",hy="clpp.vimond.VimondPlugin",iy=function(a,b,c,d,e){this.G=a;this.H=b;this.I=c;this.m=d;this.D=e;this.a=new _.xi;this.l=!0;this.h=this.j=this.A=!1;this.B=null;this.f=new _.hj(this.wi.bind(this));this.g=new _.M("clpp.vimond.VimondDispatcher");this.o=this.w=0;this.m&&this.a&&(this.g.debug(gy),this.a.on(this.m,_.kg,this.Ql.bind(this)),this.a.on(this.m,_.Bg,this.Rl.bind(this)),this.a.on(this.m,_.ic,this.Ol.bind(this)),this.a.on(this.m,_.jc,this.Pl.bind(this)))},jy=function(a,
3
+ b){a.m.trigger(new _.Q(_.Yg,{detail:b}))},ky=function(a,b,c){b&&(a.A=!0,a.f.stop());a.m.onError(new _.O(b?_.P:1,9,9201,c))},ly=function(a,b,c,d,e){this.l=a;this.o=c;this.h=b;this.a=d;this.j=e;this.g=new _.M("clpp.vimond.VimondService");this.f=0},my=function(a){this.m=a;this.a=new _.xi;this.g=new _.M("clpp.vimond.VimondAdapter");this.f=this.h=!1;this.m&&this.a&&(this.g.debug(gy),this.a.on(this.m,_.Sf,this.o.bind(this)),this.a.on(this.m,_.ic,this.j.bind(this)),this.a.on(this.m,_.jc,this.l.bind(this)))},
4
+ ny=function(a,b){var c=a.m.getState();if(1===b)return["str-start",_.Af];if(a.h)return[_.pe,_.lf];if(5===c)return[_.pe,null];if(c===_.Bo)return[_.re,_.lf];var d=_.lf;if(2===c||3===c||a.f)d=_.Af;return["period",d]},oy=function(){this.a=!1;this.g=new _.M(hy);this.j=this.h=this.f=null},py=function(){};_.r=iy.prototype;_.r.Rl=function(){this.h||(this.h=1<Math.abs(this.w-this.m.getPosition()));this.w=this.m.getPosition()};_.r.Ol=function(){this.g.debug("Ad break started");this.j=!0};
5
+ _.r.Pl=function(){this.g.debug("Ad break stopped");this.j=!1};
6
+ _.r.Ql=function(a){var b=this,c,d,e,f,g;return _.I(function(k){if(1==k.a){c=a.detail;d=_.pu;e=c.currentState;f=c.previousState;b.g.debug("State changed, prev: "+f+" curr: "+e);if(b.A||b.j)return k["return"]();if(e===b.B&&!b.h)return b.g.debug("Ignore transition"),k["return"]();if(b.l&&e!==d.PLAYING)return k["return"]();if(b.h&&[d.PAUSED,d.BUFFERING].includes(e))return b.g.debug("Seeking"),k["return"]();b.h&&e===d.PLAYING&&(b.g.debug("Seeked"),b.h=!1);g=[d.PLAYING,d.PAUSED,d.ERROR,d.ENDED];if(!g.includes(e))return k.C(0);
7
+ b.B=e;return _.x(k,b.wi(),3)}e===d.ENDED&&b.f.stop();_.A(k)})};
8
+ _.r.wi=function(){var a=this,b,c,d,e,f,g;return _.I(function(k){if(1==k.a){var l=Math.floor(Date.now()/1E3);0<a.o&&a.g.debug("Last event was "+(l-a.o)+" seconds ago");a.o=l;a.f.stop();a.f.ia(a.l?10:a.G);a.l=!1;_.F(k,2);return _.x(k,a.D.fireEvent(),4)}if(2!=k.a)return b=k.f,jy(a,b),_.G(k,0);d=c=_.H(k);e=d.code;f=d.data;g=[1002,1003];g.includes(e)?(a.g.debug("Unreachable service"),jy(a,f),ky(a,a.H,f)):1001===e?(a.g.debug("Generic service error"),jy(a,f),ky(a,a.I,f)):a.g.error(c.toString());_.A(k)})};ly.prototype.fireEvent=function(){this.f++;var a=_.N.ta(this.o);a.client.buildName=_.ya;a.client.buildVersion=_.ia;var b=a.client,c=this.a.m.getDrmInfo();b.drm=c?c.keySystem:"";a.client.pageUrl=document.location.href;a.client.streamUrl=this.a.m.$a().url;a.client.userAgent=navigator.userAgent;a.client.videoFormat=this.a.m.$a().type||"";b=a.client;c=this.a.m.$a();c=((new _.vn(c.url)).scheme||"").replace(":","");b.videoProtocol=c;b=ny(this.a,this.f);a.client.playerEvent=b[0]||"";a.client.playerState=
9
+ b[1]||"";a.progress.vod&&(a.progress.vod.position=this.a.getPosition());if(b=a.progress.live){c=this.a;var d=c.m.getPresentationStartTime()||0;c=Math.floor(d+c.m.getPosition());c=(new Date(1E3*c)).toISOString();b.position=c;d=this.a;c=d.m.getPosition();d=d.m.getSeekRange().end;b.onLiveEdge=30>Math.abs(d-c);typeof b.liveResumePossible!==_.dd&&(b.liveResumePossible=!0)}a.progress.eventNumber=this.f;a.timestamp=(new Date).toISOString();this.g.debug("Fire an event");b=_.Zk(this.l);b.method=_.rb;b.contentType=
10
+ "application/json";b.headers.Authorization="Bearer "+this.h;b.body=_.R.Xd(JSON.stringify(a));return this.j.fetch(b).U};ly.prototype.yh=function(a){this.h=a};my.prototype.getPosition=function(){return Math.floor(this.m.getPosition())};my.prototype.o=function(){this.h=!0};my.prototype.j=function(){this.f=!0};my.prototype.l=function(){this.f=!1};_.w(oy,_.cw);_.r=oy.prototype;_.r.onPlayerCreated=function(){};
11
+ _.r.onContentWillLoad=function(a){var b=a.getConfiguration();(this.a=!_.N.R(b.vimond)&&typeof b.vimond===_.$e)?a.namespace()===_.yd&&(this.a=!1,this.g.info("Vimond does not report when casting.")):this.g.debug("Vimond plugin is loaded but not configured. Will do nothing.");if(this.a){b=a.getConfiguration().vimond;for(var c=_.v(["authToken","playerEventRequest"]),d=c.next();!d.done;d=c.next())if(d=d.value,!b[d]){this.g.warn(d+" key is missing");a.onError(new _.O(1,9,9200));return}this.g.debug("Configuration is valid");
12
+ c=b.failIfUnreachable;typeof c!==_.dd&&(c=!0);d=b.failOnError;typeof d!==_.dd&&(d=!0);this.f=new my(a);this.h=new ly(b.playerEventRequest.uri,b.authToken,b.playerEventRequest.body,this.f,a.getNetworkEngine());this.j=new iy(b.playerEventRequest.eventInterval,c,d,a,this.h)}};_.r.onPlayerWillRelease=function(){if(this.a){if(this.f){var a=this.f;a.g.debug(_.Qb);_.Ai(a.a)}this.j&&(a=this.j,a.g.debug(_.Qb),_.Ai(a.a),a.f.stop());this.j=this.h=this.f=null}};_.r.onPlayerWillDestroy=function(){};_.r.id=function(){return"vimond"};
13
+ _.r.yh=function(a){this.a&&this.h&&this.h.yh(a)};_.J(hy,oy);oy.prototype.updateAuthToken=oy.prototype.yh;oy.Id="vimond";py.prototype.create=function(){return new oy};_.bp(new py);};
14
14
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
15
15
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
16
16
  else{_=this.clpp._;(f.call(g,this));}