@castlabs/prestoplay 6.23.1 → 6.25.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 (65) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +7 -7
  5. package/cjs/cl.cast.js +116 -116
  6. package/cjs/cl.conviva.js +32 -32
  7. package/cjs/cl.core.js +607 -591
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +88 -86
  10. package/cjs/cl.externs.js +105 -54
  11. package/cjs/cl.freewheel.js +25 -24
  12. package/cjs/cl.hls.js +77 -71
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +30 -30
  15. package/cjs/cl.ima.js +24 -23
  16. package/cjs/cl.mse.js +352 -342
  17. package/cjs/cl.muxdata.js +15 -15
  18. package/cjs/cl.onboard.js +3 -3
  19. package/cjs/cl.persistent.js +15 -14
  20. package/cjs/cl.playlist.js +6 -6
  21. package/cjs/cl.sessions.js +16 -16
  22. package/cjs/cl.simid.js +15 -15
  23. package/cjs/cl.smooth.js +72 -72
  24. package/cjs/cl.thumbnails.js +26 -26
  25. package/cjs/cl.tizen.js +72 -72
  26. package/cjs/cl.ttml.js +29 -29
  27. package/cjs/cl.verimatrix.js +5 -5
  28. package/cjs/cl.vimond.js +12 -12
  29. package/cjs/cl.vr.js +19 -19
  30. package/cjs/cl.vtt.js +14 -14
  31. package/cjs/cl.yospace.js +4 -4
  32. package/cjs/cl.youbora.js +37 -37
  33. package/cl.adobe.js +3 -3
  34. package/cl.airplay.js +3 -3
  35. package/cl.broadpeak.js +5 -5
  36. package/cl.cast.js +88 -88
  37. package/cl.conviva.js +27 -27
  38. package/cl.core.js +491 -478
  39. package/cl.crypto.js +9 -9
  40. package/cl.dash.js +82 -80
  41. package/cl.externs.js +105 -54
  42. package/cl.freewheel.js +19 -19
  43. package/cl.hls.js +79 -74
  44. package/cl.hlssmpte.js +5 -5
  45. package/cl.htmlcue.js +26 -26
  46. package/cl.ima.js +18 -17
  47. package/cl.mse.js +310 -306
  48. package/cl.muxdata.js +13 -13
  49. package/cl.onboard.js +4 -4
  50. package/cl.persistent.js +10 -10
  51. package/cl.playlist.js +5 -5
  52. package/cl.sessions.js +10 -10
  53. package/cl.simid.js +13 -13
  54. package/cl.smooth.js +60 -59
  55. package/cl.thumbnails.js +19 -19
  56. package/cl.tizen.js +57 -57
  57. package/cl.ttml.js +22 -22
  58. package/cl.verimatrix.js +4 -4
  59. package/cl.vimond.js +8 -8
  60. package/cl.vr.js +14 -14
  61. package/cl.vtt.js +12 -12
  62. package/cl.yospace.js +3 -3
  63. package/cl.youbora.js +28 -28
  64. package/package.json +1 -1
  65. package/typings.d.ts +54 -25
package/cjs/cl.tizen.js CHANGED
@@ -1,76 +1,76 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var $P="An unknown error occurred while trying to get volume",aQ="Cannot get loading rendition due to platform limitations",bQ="PARAM_START_POSITION",cQ="SecurityError",dQ="The require privilege is: http://tizen.org/privilege/tv.audio",eQ="|STARTBITRATE\x3d",fQ=function(a,b,c){function d(e){c.call(a,e);a.removeEventListener(b,d)}a.addEventListener(b,d)},gQ=function(a,b){this.h=a;this.o=null;this.a=_.Ye;this.l=null;this.j=!1;this.f=new Map;this.D=b;this.g=new _.K("clpp.tizen.DrmEngine")},jQ=function(a){var b,
3
- c,d;return _.I(function(e){if(1==e.a){b=a.a===_.Qd||a.a===_.Od;if(!b)throw new _.P(_.Q,6,6001,"The key system "+a.a+" is not supported by the player or the platform");c=a.f.get(a.a);if(!c.qe)throw new _.P(_.Q,6,6012,"No license server given for "+a.a);_.C(e,2);return a.a===_.Qd?_.y(e,hQ(a),5):_.y(e,iQ(a,c),5)}if(2!=e.a)return a.o={keySystem:a.a,licenseServerUri:c.qe,distinctiveIdentifierRequired:!1,persistentStateRequired:c.Cg,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[],
4
- keyIds:[],periodId:null},_.uh(e,0);d=_.E(e);a.g.error("Error while configuring CDM for "+a.a,d);throw new _.P(_.Q,6,6005,{message:JSON.stringify(d)});})},iQ=function(a,b){var c,d,e,f;return _.I(function(g){c=kQ;d=lQ;e={};e[d.zj]=!b.Cg;e[d.Bj]=b.qe;""!==b.customData&&(e[d.xj]=b.customData);f=JSON.stringify(e);a.g.debug("PlayReady properties: ",f);try{webapis.avplay.setDrm(c.PLAYREADY,"SetProperties",f)}catch(h){throw h;}_.B(g)})},hQ=function(a){var b;return _.I(function(c){b=kQ;try{webapis.avplay.setDrm(b.Je,
5
- "Initialize",""),webapis.avplay.setDrm(b.Je,"widevine_app_session",a.l.id),webapis.avplay.setDrm(b.Je,"widevine_data_type",a.l.type)}catch(d){throw d;}_.B(c)})},mQ=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,u,v,z,A,H,G;_.I(function(D){if(1==D.a){c=kQ;d=a.f.get(a.a);a.g.debug("DRM Challenge data: ",b.challenge);e=atob(b.challenge);f=new Uint8Array(e.length);for(g=0;g<e.length;++g)f[g]=e.charCodeAt(g);h=b.serverurl&&""!==b.serverurl?b.serverurl:d.qe;l=_.gk([h],_.ck());l.type=3;l.body=f.buffer;l.method=
6
- _.Gb;_.C(D,2);return _.y(D,a.D.xb.fetch(l).T,4)}if(2!=D.a){m=D.f;if(a.j){n=_.Hj(m.data);p=n.byteLength;q="";for(u=0;u<p;u++)q+=String.fromCharCode(n[u]);v=btoa(q);z=b.session_id+bQ+(v+bQ);a.g.debug("Widevine license params",z);try{webapis.avplay.setDrm(c.Je,"widevine_license_data",z)}catch(F){a.g.error("License response rejected by CDM"),A=new _.P(_.Q,6,6008,{browserError:JSON.stringify(F)}),a.D.onError(A)}}return _.uh(D,0)}H=_.E(D);a.g.error("License request failed.",JSON.stringify(H));G=new _.P(_.Q,
7
- 6,6007,{message:"Error while fetching license!",url:H.data.url,status:H.data.status||NaN,response:H.data.response||"",headers:H.data.headers||{}},H);a.D.onError(G);_.B(D)})},nQ=function(a){this.m=a;this.a=this.m.a;this.f=_.uq;this.j=_.vq;this.w=(new Date).getTime();this.l=!1;this.o=-1;this.h=2;this.g=new _.K("clpp.tizen.StateManager")},pQ=function(a,b){if(a.f!==b)if(a.f===_.Fq&&b!==_.uq)a.g.debug(_.iD+oQ(b));else{var c=(new Date).getTime();a.j=a.f;a.f=b;a.f===_.zq?(a.o=(new Date).getTime(),a.m.trigger(new _.L(_.jd,
8
- {detail:{bufferedTimeMS:-1,reason:a.h}}))):a.j===_.zq&&a.m.trigger(new _.L(_.id,{detail:{bufferedTimeMS:c-a.o,reason:a.h}}));var d={currentState:a.f,previousState:a.j,timeSinceLastStateChangeMS:c-a.w};a.w=c;a.m.trigger(new _.L(_.ig,{detail:d}));a.g.debug("State changed:",oQ(a.j),"-\x3e",oQ(a.f))}},oQ=function(a){return Object.keys(_.Dq)[a]},sQ=function(a){if(a.l){var b=a.a.getState(),c=a.f;switch(b){case qQ:c=_.Iq;break;case rQ:c=_.Hq;break;default:a.m.isEnded()?c=_.Bq:a.g.debug("Inconsistent AVPlay playback state:",
9
- b)}pQ(a,c)}},tQ=function(){this.o=this.A=this.f=this.h=this.B=this.m=this.j=this.a=null;this.C=!1;this.w=!0;this.l=null;this.g=new _.K("clpp.tizen.TextStreamer")},uQ=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},vQ=function(a){var b,c;return _.I(function(d){if(1==d.a)return b=a.m.getConfiguration(),c=null,_.y(d,_.Ku(a.B.url,a.m.getNetworkEngine(),b.manifest.attemptParameters,a.B.type||null),2);(c=d.f)&&c.configure(b.manifest);return d["return"](c)})},
10
- wQ=function(a){var b=document.createElement(_.r),c=new _.VG,d=new _.BE,e=a.m.getTextDisplayer();return new _.XG(b,c,e,d,a.m.getConfiguration())},xQ=function(a){var b={configuration:{},Wb:function(){return a.m.getPosition()},W:a.h,xb:a.m.getNetworkEngine(),gd:null,sg:a.hl.bind(a),rg:a.gl.bind(a),onError:a.il.bind(a),Oi:function(){},onEvent:function(){},Ti:a.jl.bind(a),nf:function(){},ae:function(){return new _.yH},Qf:function(){return!1},Vd:null};return new _.tI(a.a,b)},yQ=function(a){var b=a.m.getPosition(),
11
- c=null;a=_.w(a.a.periods);for(var d=a.next();!d.done;d=a.next())d=d.value,d.startTime<=b&&(c=d);return c},zQ=function(a){a.g.debug("getTextStreams()",a.a);if(a.a){var b=[],c=a.a.periods;a.g.debug("getting text streams");for(var d=0;d<c.length;d++)if(a.g.debug(c[d].startTime,a.m.getPosition()),c[d].startTime<=a.m.getPosition()){b=c[d].textStreams;break}a=b}else a=[];b=[];for(d=c=0;d<a.length;d++){var e=new _.Hk(String(c++),_.U);e.mimeType=a[d].mimeType;e.language=a[d].language;e.roles=a[d].roles;e.kind=
12
- a[d].kind||_.RD;var f=new _.Qk(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=_.wI(a.f,_.R),c=null;if(b){a=zQ(a);for(var d=0;d<a.length;d++)if(a[d].renditions[0].id===String(b.id)){c=a[d].renditions[0];break}}return c}return null},BQ=function(a,b){a.g.debug("Set active track",b);if(b&&(a.o=b.language,a.A=b.roles[0]||"",a.C=b.kind===_.ue,a.a&&a.f)){a.setTextVisibility(!0);
13
- var c=yQ(a),d=b.renditions[0];(c=c.textStreams.find(function(e){return String(e.id)===d.id}))?(a.w?(a.g.debug("Switching period defer text selection"),a.l=c):(_.HI(a.f,c,!0,0),a.m.trigger(new _.L(_.rm))),a.o=c.language):a.g.error(_.gD,d.id)}},CQ=function(){this.j=this.a=this.m=null;this.f={};this.g=new _.K("clpp.tizen.TrackManager");this.w=this.o=this.l=null;this.A=!1;this.h=1},DQ=function(a,b){a.m.trigger(new _.L(_.Ng,{details:{width:b.width,height:b.height,bandwidth:b.bandwidth,track:b.track,abrSelection:a.a.o}}))},
14
- EQ=function(a){var b=a.ma();b&&a.m.trigger(new _.L(_.gd,{detail:{width:b.width,height:b.height,bandwidth:b.bandwidth,rendition:b}}))},FQ=function(a){var b=a.m.getConfiguration(),c=_.Bi(b.preferredAudioLanguage||[]),d=a.f[_.Jk]||[];if(d.length){var e=null;c.some(function(g){e=_.nE(g,d.map(function(h){return h.language}));return!!e});if(e){var f=d.filter(function(g){return g.language===e});c=f[0];1<f.length&&b.preferredAudioRole&&(f=f.filter(function(g){return 0<=g.roles.indexOf(b.preferredAudioRole)}),
15
- 0<f.length&&(c=f[0]));a.g.debug("Setting audio track with preferred language:",e);a.Ha(c)}else a.g.debug("Preferred language(s) not available")}else a.g.debug("Could not set preferred audio language")},JQ=function(a,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 _.L(_.qm)));c===IQ&&(a.o=b,a.m.trigger(new _.L(_.rm)))})["catch"](function(){a.g.error("Could not select "+c+" track.")})}else a.g.debug("Must provide valid rendition")},KQ=
16
- function(a,b,c){var d=_.yj(b.language||_.xg);c.language=_.Ik(d);c.originalLanguage=d;c.channelsCount=b.channels?Number(b.channels):null;c.mimeType=_.cd;a=new _.Qk(String(a),c);a.track=c;a.codec=b.fourCC||null;a.bandwidth=b.bit_rate||null;return a},LQ=function(a,b,c){c.mimeType=_.Lg;a=new _.Qk(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=_.yj(b.track_lang||_.xg);c.mimeType="text/ttml";
17
- c.language=_.Ik(b);c.originalLanguage=b;c.kind=_.RD;return new _.Qk(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},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=[],h=0;h<f.length;h++){var l=NQ(a,f[h].extra_info);if(l){var m=
18
- _.yj(l.language||_.xg);m=_.Ik(m);m=c(g,m);m||(m=new _.Hk(String(a.h++),_.Jk),g.push(m));m.renditions.push(KQ(f[h].index,l,m))}else a.g.warn("Skipping audio stream with no extra info")}f=new _.Hk(String(a.h++),_.Kk);for(h=0;h<e.length;h++)(l=NQ(a,e[h].extra_info))?f.renditions.push(LQ(e[h].index,l,f)):a.g.warn("Skipping video stream with no extra info");e=[];e=a.j?zQ(a.j):PQ(a,b);d[_.Kk]=[f];d[_.Jk]=g;d[_.U]=e;return d},PQ=function(a,b){for(var c=b.filter(function(h){return h.type===IQ}),d=[],e=0;e<
19
- c.length;e++){var f=NQ(a,c[e].extra_info);if(f){var g=new _.Hk(String(a.h++),_.U);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,b){for(var c=a.f[_.Kk]||[],d=[],e=0;e<c.length;e++)for(var f=0;f<c[e].renditions.length;f++)_.N.pa(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===
20
- b){c=a[d].renditions[e];break}return c},UQ=function(a,b){if(b===_.U&&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===b.toUpperCase()})[0];var d=null;b===_.Kk&&(d=NQ(a,c.extra_info),d=RQ(a,{width:d.Width,height:d.Height}));b===_.Jk&&(c?(d=SQ(a,c,_.Jk),a.l=d):d=a.l);b===_.U&&(c?(d=SQ(a,c,_.U),a.o=d):d=a.o);return d},VQ=function(a){_.xm.call(this);this.m=a;this.h=null;this.g=new _.K("clpp.tizen.Middleware");this.C=1;this.B=!1;this.l=null;this.G=
21
- 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/1920;a.g.debug("Display resolution ratio: ",a.A)},function(c){a.g.debug("Could not load DISPLAY property");throw c;});_.B(b)})},YQ=function(a){try{webapis.avplay.setListener({onbufferingstart:a.bl.bind(a),onbufferingprogress:a.al.bind(a),onbufferingcomplete:a.$k.bind(a),onstreamcompleted:a.el.bind(a),oncurrentplaytime:function(b){a.trigger(new _.L(XQ,
22
- {currentTime:b}))},onevent:a.dl.bind(a),onsubtitlechange:a.fl.bind(a),ondrmevent:a.cl.bind(a),onerror:a.Pd.bind(a)})}catch(b){a.g.error(b)}},ZQ=function(a){var b=!!a.m.getTrackManager().Va();try{webapis.avplay.setSilentSubtitle(!b)}catch(c){a.g.debug("Could not set AVPlay subtitle config",c)}},$Q=function(a,b){try{var c=b.estimatedBandwidth||0,d=b.currentBandwidth||0;a.g.debug({estimatedBandwidth:c,Vo:d});0!==c&&0!==d&&c>=1.15*d&&webapis.avplay.setStreamingProperty("ADAPTIVE_INFO",eQ+d)}catch(e){a.g.debug(e)}},
23
- aR=function(a,b){try{webapis.avplay.setStreamingProperty("ADAPTIVE_INFO","|BITRATES\x3d"+b+eQ+b)}catch(c){throw a.g.debug("Could not set fixed bandwidth",c),c;}},dR=function(a){return{position:a.getPosition(),state:a.m.getState(),mh:a.getState(),playbackRate:a.getPlaybackRate(),isLive:a.isLive(),duration:a.getDuration(),isMuted:bR(a),volume:a.getVolume(),ro:cR(a),vl:TQ(a)}},fR=function(a){var b,c;return _.I(function(d){if(1==d.a)return _.y(d,eR(),2);if(3!=d.a)return b=new Promise(function(e){(new _.yl(e)).ea(5)}),
24
- _.y(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"),d["return"](Promise.reject("SDK Timeout"));_.B(d)})},lR=function(a,b,c){var d,e,f,g,h,l,m,n;return _.I(function(p){switch(p.a){case 1:a.l=_.Mq(b);d=a.G;e=c||{estimatedBandwidth:0,currentBandwidth:0,nextBandwidth:null,currentPosition:0};a.g.debug("Loading manifest URL: "+a.l[d].url);f=b.startTime||void 0;a.f&&(a.trigger(new _.L(gR)),f=c.currentPosition);
25
- _.C(p,2);g=a.l[d].url;h=a.l[d].type;h!==_.Sc||g.includes(".mpd")||(l=new URL(g),l.searchParams.append("cl-ext",".mpd"),g=l.toString());webapis.avplay.open(g);e.nextBandwidth?(aR(a,e.nextBandwidth),a.o=!1):(a.o||$Q(a,e),a.o=!0);YQ(a);if(!b.drm||!b.drm.env){a.g.debug("No DRM configuration was provided. Assuming clear content");p.F(4);break}m={onError:function(q){return a.m.onError(q)},xb:a.m.getNetworkEngine()};a.h=new gQ(b.drm,m);return _.y(p,a.h.init(),4);case 4:return a.f||a.trigger(new _.L(hR)),
26
- _.y(p,iR(a),6);case 6:a.f||a.trigger(new _.L(jR));f&&typeof f===_.k&&0<f&&a.seek(f)["catch"](function(q){a.g.debug("Couldn't set start position",q)});a.f||(b.volume&&a.setVolume(b.volume),b.muted&&kR(a,b.muted),b.autoplay&&a.m.play()["catch"](function(q){a.g.debug("Autoplay failed",q)}));_.uh(p,0);break;case 2:throw n=_.E(p),a.g.debug("Error while attempting to load source."),n;}})},iR=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!");
27
- ZQ(a);c()},function(e){a.g.debug("prepareAsync failed",e);d(e)})}catch(e){a.g.debug("Failed to prepare media player for playback"),d(e)}}))})},mR=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=dR(a);a.f=!0;webapis.avplay.stop();webapis.avplay.close();return a.load(a.m.getConfiguration(),d).then(function(){var e=a.a.mh;a.f=!1;a.a=
28
- null;return e===rQ?a.pause():a.play()})}catch(e){return Promise.reject(e)}},cR=function(a){return a.f&&a.a?a.a.ro:webapis.avplay.getTotalTrackInfo()},TQ=function(a){return a.f&&a.a?a.a.vl:webapis.avplay.getCurrentStreamInfo()},GQ=function(a,b,c){b=b.toUpperCase();b===IQ&&nR(a,!0);var d=a.j[b];d&&(d.yf.stop(),a.j[b]=null,a.g.debug("Cancelled pending track switch for "+b));return new Promise(function(e,f){function g(h,l,m){m=void 0===m?!1:m;try{webapis.avplay.setSelectTrack(h,l),a.j[h]=null,e()}catch(n){a.g.debug("Could not set "+
29
- h+" track. Trying again...AVPlay state: "+(a.getState()+", buffering: ")+a.w,n),!1===m&&(a.j[h]={type:h,index:l,jh:0,yf:new _.yl(function(){return g(h,c,!0)})}),(l=a.j[h])&&3>l.jh?(!a.w&&++l.jh,l.yf.ea(a.w?.5:.25)):(a.g.debug("Could not set track after multiple attempts.Giving up..."),l&&l.yf.stop(),a.j[h]=null,f())}}g(b,c)})},nR=function(a,b){var c=a.m.getTextDisplayer();c&&c.setTextVisibility(b);c=a.m.h;try{c||webapis.avplay.setSilentSubtitle(!b)}catch(d){a.g.debug("Could not set text track visibility",
30
- d)}},kR=function(a,b){try{tizen.tvaudiocontrol.setMute(b)}catch(c){switch(c.name){case cQ:a.g.warn("The application does not have the privilege to set mute.",dQ);break;default:a.g.warn($P,c)}}},bR=function(a){var b=null;try{b=tizen.tvaudiocontrol.isMute()}catch(c){switch(c.name){case cQ:a.g.warn("The application doesn't have the privilege to get the mute state.",dQ);break;default:a.g.warn($P,c)}}return!!b},eR=function(){return new Promise(function(a,b){if(window.webapis)a();else{var c=document.createElement("script");
31
- fQ(c,_.Je,function(d){return a(d)});fQ(c,_.se,function(d){return b(d)});c.src="$WEBAPIS/webapis/webapis.js";document.querySelector("head").appendChild(c)}})},oR=function(){_.xm.call(this);this.a=new VQ(this);this.f=new nQ(this);this.configuration=this.B=_.Em();this.w=null;this.g=new _.K("clpp.tizen.Player");this.j=null;this.l=new CQ;this.C=new _.Bk;this.o=this.h=null;this.A=!1},pR=function(a){if("NONE"!==a.a.getState()){var b=a.j.getBoundingClientRect();a=a.a;var c=Math.floor(b.left*a.A),d=Math.floor(b.top*
32
- a.A),e=Math.floor(b.width*a.A);b=Math.floor(b.height*a.A);a.g.debug("Setting display area to","x:",c,"y:",d,"width:",e,"height:",b);webapis.avplay.setDisplayRect(c,d,e,b);0===c&&0===d&&1920===e&&1080===b&&webapis.avplay.setDisplayMethod("PLAYER_DISPLAY_MODE_LETTER_BOX")}else a.g.debug("Could not apply dimension. Player state "+a.a.getState())},qR=function(){},rR=function(){};
33
- gQ.prototype.init=function(){var a=this,b,c,d,e,f,g;return _.I(function(h){if(1==h.a){b=_.Ym[a.h.env]||null;if(!b)throw a.g.debug(_.za,_.Lb+a.h.env+_.aa),new _.P(_.Q,6,6015,_.Aa+a.h.env+"' is missing.");a.l={id:String(Math.floor(1E4*Math.random())),type:"MPEG-DASH"};c=Object.keys(a.h.customData||{}).length?btoa(JSON.stringify(a.h.customData)):"";d=_.$m(b,a.h.customData);(e=d[_.Od])&&a.f.set(_.Od,{qe:e.licenseUrl||"",customData:c,Cg:!1});(f=d[_.Qd])&&a.f.set(_.Qd,{qe:f.licenseUrl||"",customData:c,
34
- Cg:!1});if(0===a.f.size)throw new _.P(_.Q,6,6E3);if((g=a.h.preferredDrmSystem)&&a.f.get(g))a.a=g;else if(a.f.get(_.Od))a.a=_.Od;else if(a.f.get(_.Qd))a.a=_.Qd;else throw new _.P(_.Q,6,6001,"Configuration for the target system is missing.");return _.y(h,jQ(a),2)}a.j=!0;_.B(h)})};gQ.prototype.release=function(){var a=this;return _.I(function(b){a.j=!1;a.o=null;a.a=_.Ye;a.l=null;a.f=new Map;_.B(b)})};gQ.prototype.getDrmInfo=function(){return this.o};
35
- var lQ={zj:"DeleteLicenseAfterUse",Bj:"LicenseServer",Go:"GetChallenge",Ho:"HttpHeader",Jo:"UserAgent",Do:"Cookie",xj:"CustomData"};_.t=nQ.prototype;_.t.initialize=function(){this.a.on(gR,this.Kh,this);this.a.on(sR,this.Jh,this);this.a.on(tR,this.Ih,this);this.a.on(hR,this.Vi,this);this.a.on(jR,this.Ui,this);this.a.on(uR,this.Lh,this)};_.t.release=function(){pQ(this,_.uq);this.l=!1;this.o=-1;this.h=2};_.t.destroy=function(){this.release();this.a.off(gR,this.Kh);this.a.off(sR,this.Jh);this.a.off(tR,this.Ih);this.a.off(hR,this.Vi);this.a.off(jR,this.Ui);this.a.off(uR,this.Lh);this.m=this.a=null};
36
- _.t.Kh=function(){this.g.debug("Buffering start. Player state: ",this.a.getState());this.h=this.a.B?1:2;pQ(this,_.zq)};_.t.Jh=function(a){this.g.debug("Buffering progress: "+a.percent+" %. Player state: ",oQ(this.f))};_.t.Ih=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()===vR;if(!a&&b){pQ(this,_.Hq);return}}if(a=this.f!==_.Gq)a=this.a.getState(),a=a===qQ||a===rQ;a&&sQ(this)};
37
- _.t.Vi=function(){this.g.debug("Preparing starts. AVPlay State: ",this.a.getState());this.a.getState()===wR?pQ(this,_.Gq):this.g.error("AVPlay prepares while state is not IDLE")};_.t.Ui=function(){this.g.debug("Preparing ends: AVPlay state:",this.a.getState())};_.t.Lh=function(){pQ(this,_.Bq)};_.t.getState=function(){return this.f};_.t=tQ.prototype;_.t.initialize=function(a){this.m=a};
38
- _.t.load=function(a){var b=this,c,d,e,f,g,h,l;return _.I(function(m){switch(m.a){case 1:if(!b.m)return b.g.debug("Text streamer is not initialized. Will not load()"),m["return"]();b.B=a;c=b;return _.y(m,vQ(b),2);case 2:c.j=m.f;if(!b.j)return b.g.debug("Could not find manifest parser for source. Make sure parsers are registered."),m["return"]();d={configurationId:"",networkingEngine:b.m.getNetworkEngine(),filterNewPeriod:function(){},filterAllPeriods:function(){},onEvent:function(){},onError:function(){}};
39
- _.C(m,3);e=b;return _.y(m,b.j.start(a.url,d),5);case 5:e.a=m.f;_.uh(m,4);break;case 3:return f=_.E(m),b.g.warn(f),_.C(m,6),g=b,_.y(m,b.j.start(a.url.replace("https://","http://"),d),8);case 8:g.a=m.f;_.uh(m,4);break;case 6:h=_.E(m),b.g.error(h),b.a=null;case 4:if(!b.a||!uQ(b.a)){m.F(0);break}b.h=wQ(b);_.C(m,10);return _.y(m,b.h.open(),12);case 12:b.f=xQ(b);l=b.m.getConfiguration();b.f.h=l.streaming;b.o=l.preferredTextLanguage;b.A=l.preferredTextRole;b.C=l.preferForcedSubtitles;_.uh(m,0);break;case 10:_.E(m),
40
- b.g.debug("Could not setup media source..."),b.h=null,b.f=null,b.j=null,b.a=null,_.B(m)}})};_.t.hl=function(a){this.g.debug(_.JD,a);this.w=!0;var b=_.xH(a.textStreams,this.o||"",this.A||"",this.C)[0]||null;this.l&&(a.textStreams.includes(this.l)&&(b=this.l),this.l=null);return{variant:null,text:b}};_.t.gl=function(){this.g.debug("canSwitch_");this.w=!1;this.l&&(_.HI(this.f,this.l,!0,0),this.l=null)};_.t.il=function(){this.g.debug("onError_")};_.t.jl=function(){this.j&&this.j.update&&this.j.update()};
41
- _.t.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)}_.B(b)})};_.t.setTextVisibility=function(a){this.g.debug("Set text visibility",a);this.h&&this.h.getTextDisplayer().setTextVisibility(a)};_.t.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;_.B(b)})};
42
- _.t.destroy=function(){var a=this;return _.I(function(b){switch(b.a){case 1:if(!a.j){b.F(2);break}return _.y(b,a.j.stop(),3);case 3:a.j=null;case 2:if(!a.f){b.F(4);break}return _.y(b,a.f.destroy(),5);case 5:a.f=null,a.w=!0;case 4:if(!a.h){b.F(0);break}return _.y(b,a.h.destroy(),7);case 7:a.h=null,_.B(b)}})};_.x(CQ,_.ll);_.t=CQ.prototype;_.t.Li=function(a){var b=a.eventid;a=a.data;switch(b){case xR: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 yR:EQ(this);break;default:this.g.debug("Event type: "+b+" data: "+a)}};_.t.xg=function(a){a.detail.currentState===_.Iq&&this.m.off(_.ig,this.xg)};
43
- _.t.initialize=function(a){var b=this;this.m=a;this.a=this.m.a;this.m.on(_.ig,function(c){b.A||(c=c.detail,c.currentState===_.Iq&&(b.g.debug("Current state",c.currentState),b.A=!0,FQ(b)))});this.a.on(zR,this.Li,this)};_.t.release=function(){this.f={};this.j=this.w=this.o=this.l=null;this.A=!1;this.h=1};
44
- _.t.load=function(){if(this.a&&!(0<Object.keys(this.f).length)){this.j=this.m.h;this.m.off(_.ig,this.xg);this.m.on(_.ig,this.xg,this);try{var a=cR(this.a);this.f=QQ(this,a);var b=this.f[_.Jk]||[];b.length&&(this.l=b[0].renditions[0]||null);EQ(this)}catch(c){this.g.debug("Could not load track manager")}}};_.t.destroy=function(){this.a.off(zR,this.Li);this.a=this.m=null};_.t.getVideoTracks=function(){return this.f[_.Kk]||[]};_.t.getAudioTracks=function(){return this.f[_.Jk]||[]};
45
- _.t.la=function(){return this.f[_.U]||[]};_.t.ma=function(){return UQ(this,_.Kk)};_.t.Ya=function(){return UQ(this,_.Jk)};_.t.Va=function(){return UQ(this,_.U)};_.t.vb=function(){return this.w};_.t.Hb=function(){this.g.info(aQ);return null};_.t.Ib=function(){this.g.info(aQ);return null};_.t.La=function(){var a=this.ma();return a?a.track:null};_.t.qa=function(){var a=this.Ya();return a?a.track:null};_.t.Ba=function(){var a=this.Va();return a?a.track:null};
46
- _.t.Db=function(a){var b=this;null===a?(a=this.ma(),mR(this.a,a.bandwidth,null).then(function(){EQ(b)})):0<a.renditions.length&&this.ob(a.renditions[0])};_.t.Ha=function(a){a?JQ(this,a.renditions[0]):this.g.warn("Cannot disable audio tracks on this platform.","Consider muting audio instead...")};_.t.Wa=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,nR(this.a,!1),this.m.trigger(new _.L(_.rm)))};
47
- _.t.ob=function(a){var b=this,c=this.ma();this.a.o||a.width!==c.width||a.height!==c.height||a.bandwidth!==c.bandwidth?(this.w=a,DQ(this,a),mR(this.a,c.bandwidth,a.bandwidth).then(function(){EQ(b)})["catch"](function(d){var e=new _.P(_.Q,7,7200,{tizenerror:d});b.g.debug("Error while switching video track",d);b.m.onError(e)})):this.g.debug("Trying to switch to already active rendition. Doing nothing...")};_.t.Bb=function(a){JQ(this,a)};_.t.Cb=function(a){this.j?BQ(this.j,a.track):JQ(this,a)};
48
- _.t.addTextTrack=function(){};_.t.wa=function(){return this.a.o};CQ.prototype.isAbrEnabled=CQ.prototype.wa;CQ.prototype.addTextTrack=CQ.prototype.addTextTrack;CQ.prototype.setTextRendition=CQ.prototype.Cb;CQ.prototype.setAudioRendition=CQ.prototype.Bb;CQ.prototype.setVideoRendition=CQ.prototype.ob;CQ.prototype.setTextTrack=CQ.prototype.Wa;CQ.prototype.setAudioTrack=CQ.prototype.Ha;CQ.prototype.setVideoTrack=CQ.prototype.Db;CQ.prototype.getTextTrack=CQ.prototype.Ba;CQ.prototype.getAudioTrack=CQ.prototype.qa;
49
- CQ.prototype.getVideoTrack=CQ.prototype.La;CQ.prototype.getLoadingTextRendition=CQ.prototype.Ib;CQ.prototype.getLoadingAudioRendition=CQ.prototype.Hb;CQ.prototype.getLoadingVideoRendition=CQ.prototype.vb;CQ.prototype.getTextRendition=CQ.prototype.Va;CQ.prototype.getAudioRendition=CQ.prototype.Ya;CQ.prototype.getVideoRendition=CQ.prototype.ma;CQ.prototype.getTextTracks=CQ.prototype.la;CQ.prototype.getAudioTracks=CQ.prototype.getAudioTracks;CQ.prototype.getVideoTracks=CQ.prototype.getVideoTracks;_.x(VQ,_.xm);_.t=VQ.prototype;_.t.bl=function(){this.w=!0;this.f||this.trigger(new _.L(gR))};_.t.al=function(a){this.w=!0;this.trigger(new _.L(sR,{percent:a}))};_.t.$k=function(){this.w=!1;this.trigger(new _.L(tR))};_.t.el=function(){this.trigger(new _.L(uR))};_.t.dl=function(a,b){this.trigger(new _.L(zR,{eventid:a,data:b}))};_.t.fl=function(a,b,c,d,e){this.trigger(new _.L(AR,{duration:a,text:b,subtitleType:c,attriCount:d,attributes:e}))};
50
- _.t.cl=function(a,b){this.trigger(new _.L(BR,{drmType:a,drmData:b}));if(this.h){var c=this.h;if(c.j)if(c.a===_.Qd&&"Challenge"===b.name)mQ(c,b);else if("DrmError"===b.name){c.g.debug("DrmError event",b);var d=new _.P(_.Q,6,6005,{message:JSON.stringify(b)});c.D.onError(d)}}};_.t.Pd=function(a){this.trigger(new _.L(CR,{eventType:a}))};
51
- _.t.play=function(){function a(){return new Promise(function(d,e){function f(){d();clearTimeout(g)}var g=null;b.one(XQ,f,b);g=setTimeout(function(){b.off(XQ,f);e("Timeout")},3E4)})}var b=this,c=this.getState();if(c===wR)return(new Promise(function(d,e){webapis.avplay.prepareAsync(function(){ZQ(b);d(webapis.avplay.play())},function(f){b.trigger(new _.L(CR));e(f)})})).then(function(){return a()});if(c===rQ||c===vR)try{return webapis.avplay.play(),a()}catch(d){return Promise.reject(d)}return c===qQ?
52
- Promise.resolve():Promise.reject("Player is in invalid state")};_.t.pause=function(){try{webapis.avplay.pause()}catch(a){Promise.reject(a)}return this.getState()===rQ?Promise.resolve():Promise.reject()};
53
- _.t.setPlaybackRate=function(a){var b=this.getState();if(b===vR||b===qQ||b===rQ){try{webapis.avplay.setSpeed(a),this.C=a}catch(c){return this.g.debug("Error while trying to set playback rate",c),this.setPlaybackRate(this.C)}return!0}this.g.debug("Cannot set playback rate; AVPlay is in inconsistent state: "+b);return!1};_.t.getPlaybackRate=function(){return this.C};
54
- _.t.load=function(a,b){var c=this,d;return _.I(function(e){switch(e.a){case 1:return c.g.debug("configure()",b||""),_.C(e,2),_.y(e,fR(c),4);case 4:return _.y(e,lR(c,a,b),5);case 5:_.uh(e,0);break;case 2:throw d=_.E(e),new _.P(_.Q,7,7003,null,d);}})};_.t.getState=function(){if(this.f&&this.a)return this.a.mh;try{return webapis.avplay.getState()}catch(a){this.Pd(JSON.stringify(a))}};
55
- _.t.seek=function(a){var b=this,c=1E3*a;return new Promise(function(d,e){b.B=!0;b.m.trigger(new _.L(_.Dg));webapis.avplay.seekTo(c,function(){b.B=!1;b.m.trigger(new _.L(_.Cg));d()},function(){b.B=!1;e()})})};_.t.getPosition=function(){if(this.f&&this.a)return this.a.position;try{return webapis.avplay.getCurrentTime()/1E3}catch(a){this.Pd(JSON.stringify(a))}};_.t.getDuration=function(){if(this.f&&this.a)return this.a.duration;try{return webapis.avplay.getDuration()/1E3}catch(a){this.Pd(JSON.stringify(a))}};
56
- _.t.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.yf.stop()}a.j={};a.C=1;a.B=!1;a.l=null;a.a=null;return b()}catch(f){return c(f)}})};_.t.getVolume=function(){var a=null;try{a=tizen.tvaudiocontrol.getVolume()}catch(b){switch(b.name){case cQ:this.g.debug("The application does not have the privilege to get the volume.",dQ);break;default:this.g.debug($P,b)}}return a};
57
- _.t.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 cQ:this.g.warn("The application does not have the privilege to set the volume.",dQ);break;default:this.g.warn("An unknown error occurred while trying to set volume",b)}}};
58
- _.t.isLive=function(){if(this.f&&this.a)return this.a.isLive;try{return"1"===webapis.avplay.getStreamingProperty("IS_LIVE")}catch(a){this.Pd(JSON.stringify(a))}};_.t.stop=function(){try{webapis.avplay.stop()}catch(a){this.g.debug(a)}};_.t.getDrmInfo=function(){this.h&&this.h.getDrmInfo();return null};_.t.setSourceIndex=function(a){this.G=a};_.t.getSourceIndex=function(){return this.G};_.t.getLoadedSource=function(){return this.l&&this.l[this.getSourceIndex()]};
59
- var wR="IDLE",vR="READY",qQ="PLAYING",rQ="PAUSED",OQ=_.fc,HQ="AUDIO",IQ="TEXT",yR="PLAYER_MSG_RESOLUTION_CHANGED",xR="PLAYER_MSG_BITRATE_CHANGE",kQ={PLAYREADY:"PLAYREADY",Eo:"EME_PLAYREADY",Ko:"VERIMATRIX",Je:"WIDEVINE_CDM",Fo:"EME_WIDEVINE_CDM",Mo:"WIDEVINE_CLASSIC"};_.x(oR,_.xm);_.t=oR.prototype;_.t.Gh=function(){var a=this;this.g.debug("On Stream completed. Current time: ",this.getPosition());this.trigger(new _.L(_.re));this.configuration.loop?this.seek(this.configuration.startTime||0)["catch"](function(){a.g.debug("Could not loop playback")}):this.a.stop()};_.t.Dh=function(a){this.trigger(new _.L(_.tg,{currentTime:a.currentTime/1E3}))};
60
- _.t.Hh=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=_.T.Rg(d))&&this.o.append([new _.Ni(b,c,d)],[])};_.t.Eh=function(a){this.g.debug("DRM event: "+a.drmType+", data: "+a.drmData)};_.t.Ni=function(){this.A||(this.g.debug("Initial buffering completed..."),this.A=!0)};
61
- _.t.Fh=function(a){this.g.debug("Error: TYPE: "+a.eventType);pQ(this.f,_.Fq);a=new _.P(_.Q,7,7200,{tizenerror:a.eventType});this.a.release();this.trigger(new _.L(_.se,{detail:a}))};
62
- _.t.init=function(a,b){this.configuration=this.B=b;this.w=a;this.a.on(uR,this.Gh,this);this.a.on(XQ,this.Dh,this);this.a.on(AR,this.Hh,this);this.a.on(BR,this.Eh,this);this.a.on(CR,this.Fh,this);this.a.on(tR,this.Ni,this);this.f.initialize();this.l.initialize(this);this.g.debug("Initializing player surface");this.w.hideMediaElement();var c=DR;DR+=1;this.j=_.ir(_.Ze,{id:"__clpp_tizen_player_"+c,type:"application/avplayer"});this.w.addElementToContainer(this.j,!0);var d=this.w.getMedia();if(d){c=this.j;
63
- var e=[_.Yg,_.xe,"position",_.De,"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=_.w(e);for(e=g.next();!e.done;e=g.next())e=e.value,f[e]=d[e];_.kr(c,f);pR(this)}};_.t.getSurface=function(){return this.w};_.t.getConfiguration=function(){return this.configuration};_.t.getTimeline=function(){return null};_.t.setupPlaylist=function(){return Promise.reject(_.Cb)};_.t.appendLoad=function(){return Promise.reject(_.Cb)};
64
- _.t.seekWith=function(){return Promise.reject(_.Cb)};_.t.setSeekInterceptor=function(){};_.t.setPlaybackSessionId=function(){};
65
- _.t.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(uR,a.Gh);a.a.off(XQ,a.Dh);a.a.off(AR,a.Hh);a.a.off(BR,a.Eh);a.a.off(CR,a.Fh);a.a.off(tR,a.Ni);if(!a.h){b.F(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,_.B(b)}})};_.t.namespace=function(){return ER};_.t.getPlaybackRate=function(){return this.a.getPlaybackRate()};
66
- _.t.setDrmCustomDataModifier=function(){};_.t.setCdnErrorCallback=function(){};_.t.detach=function(){};_.t.setPlaybackRate=function(a){this.a.setPlaybackRate(a)};_.t.getPosition=function(){return this.getMediaPosition()};_.t.getMediaPosition=function(){return 0<(this.configuration.startTime||0)&&!this.A?0:this.f.getState()===_.Bq?this.getDuration():this.a.getPosition()||0};_.t.seek=function(a){return typeof a===_.k&&0<=a?(this.isLive()||(a=Math.min(a,this.getDuration())),this.a.seek(a)):Promise.reject()};
67
- _.t.getPresentationStartTime=function(){return null};_.t.getSeekRange=function(){return{start:0,end:0}};_.t.getVolume=function(){var a=this.a.getVolume();return typeof a===_.k?a/100:null};_.t.setVolume=function(a){this.a.setVolume(a)};_.t.getDuration=function(){return this.getMediaDuration()};_.t.getMediaDuration=function(){return this.a.getDuration()};_.t.getBufferInfo=function(){this.g.warn(_.ua);return new _.wm};_.t.getTrackManager=function(){return this.l};_.t.unload=function(){var a=this;return this.a.release().then(function(){a.l.release()})};
68
- _.t.release=function(){var a=this;return _.I(function(b){switch(b.a){case 1:if(!a.h){b.F(2);break}return _.y(b,a.h.release(),2);case 2:if(!a.o){b.F(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,_.B(b)}})};
69
- _.t.load=function(a){var b=this,c,d,e,f,g;return _.I(function(h){switch(h.a){case 1:b.configuration=_.Gm(b.B,a);c=_.lq(b.configuration,[_.ze,"native"]);b.o=c.create(b);d=_.Mq(b.configuration)[0];e=!!b.configuration.tizen&&b.configuration.tizen.sideStreamText;if(!e){h.F(2);break}b.h=new tQ;b.h.initialize(b);_.C(h,3);return _.y(h,b.h.load(d),5);case 5:b.h.start();_.uh(h,2);break;case 3:f=_.E(h),b.g.error(f);case 2:return _.C(h,6),_.y(h,b.a.load(b.configuration),8);case 8:_.uh(h,7);break;case 6:throw g=
70
- _.E(h),b.onError(g),g;case 7:b.l.load(),_.B(h)}})};_.t.play=function(){var a=this;this.trigger(new _.L(_.of));pR(this);return this.a.play().then(function(){sQ(a.f)})};_.t.pause=function(){var a=this;return this.a.pause().then(function(){sQ(a.f)})};_.t.getState=function(){return this.f.getState()};_.t.getPeriods=function(){return[]};_.t.onError=function(a){var b=new _.L(_.se,{detail:a});a.severity===_.Q&&(pQ(this.f,_.Fq),this.a.release());this.trigger(b);b.defaultPrevented&&(b.a=!0)};
71
- _.t.getDrmInfo=function(){return this.a.getDrmInfo()};_.t.isEnded=function(){return this.f.getState()===_.Bq};_.t.isPaused=function(){return this.a.getState()===rQ};_.t.isMuted=function(){return bR(this.a)};_.t.setMuted=function(a){kR(this.a,a)};_.t.getNetworkEngine=function(){return this.C};_.t.setNetworkEngine=function(a){this.C=a};_.t.setCmsdManager=function(){};_.t.isLive=function(){return this.a.isLive()};_.t.getStats=function(){return null};_.t.setSourceIndex=function(a){this.a.setSourceIndex(a)};
72
- _.t.getSourceIndex=function(){return this.a.getSourceIndex()};_.t.getLoadedSource=function(){return this.a.getLoadedSource()};_.t.canPlay=function(a,b){return(new qR).canPlay(a,b)};_.t.getTimelineCues=function(){return[]};_.t.getCueTimeline=function(){return null};_.t.getTextDisplayer=function(){return this.o};_.t.resetAbr=function(){};var ER="clpp.tizen",DR=0;qR.prototype.a=function(){return ER};
73
- qR.prototype.canPlay=function(a){a=a.type;var b=!!window.webapis;if((a===_.Sc||a===_.hm||a===_.Xc)&&b){if(_.wk(2))return 2;if(_.wk(3)||_.wk(4)||_.wk(5)||_.wk(6))return _.Jh("Use of clpp.tizen.TizenComponent is not recommended for Tizen version \x3e\x3d 3."),1}return 0};qR.prototype.f=function(a){return a===_.oa};qR.prototype.create=function(){return new oR};_.x(rR,_.ku);rR.prototype.f=function(){_.Th(new qR)};rR.prototype.a=function(){var a=ER;a&&_.Rh[a]&&(delete _.Rh[a],_.Sh.info("Removed Player factory: '"+a+"'"))};rR.prototype.id=function(){return"tizen"};_.J("clpp.tizen.TizenComponent",rR);var gR="onbufferingstart",sR="onbufferingprogress",tR="onbufferingcomplete",uR="onstreamcompleted",XQ="oncurrentplaytime",zR="onevent",AR="onsubtitlechange",BR="ondrmevent",CR="onerror",hR="preparingstart",jR="preparingend";};
2
+ var f=function(window){var UQ="An unknown error occurred while trying to get volume",VQ="Cannot get loading rendition due to platform limitations",WQ="PARAM_START_POSITION",XQ="SecurityError",YQ="The require privilege is: http://tizen.org/privilege/tv.audio",ZQ="|STARTBITRATE\x3d",$Q=function(a,b,c){function d(e){c.call(a,e);a.removeEventListener(b,d)}a.addEventListener(b,d)},aR=function(a,b){this.h=a;this.o=null;this.a=_.ff;this.l=null;this.j=!1;this.f=new Map;this.D=b;this.g=new _.K("clpp.tizen.DrmEngine")},dR=function(a){var b,
3
+ c,d;return _.I(function(e){if(1==e.a){b=a.a===_.Xd||a.a===_.Vd;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.ue)throw new _.O(_.P,6,6012,"No license server given for "+a.a);_.D(e,2);return a.a===_.Xd?_.y(e,bR(a),5):_.y(e,cR(a,c),5)}if(2!=e.a)return a.o={keySystem:a.a,licenseServerUri:c.ue,distinctiveIdentifierRequired:!1,persistentStateRequired:c.Fg,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[],
4
+ keyIds:[],periodId:null},_.Jh(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)});})},cR=function(a,b){var c,d,e,f;return _.I(function(g){c=eR;d=fR;e={};e[d.Fj]=!b.Fg;e[d.Ij]=b.ue;""!==b.customData&&(e[d.Dj]=b.customData);f=JSON.stringify(e);a.g.debug("PlayReady properties: ",f);try{webapis.avplay.setDrm(c.PLAYREADY,"SetProperties",f)}catch(h){throw h;}_.C(g)})},bR=function(a){var b;return _.I(function(c){b=eR;try{webapis.avplay.setDrm(b.Qe,
5
+ "Initialize",""),webapis.avplay.setDrm(b.Qe,"widevine_app_session",a.l.id),webapis.avplay.setDrm(b.Qe,"widevine_data_type",a.l.type)}catch(d){throw d;}_.C(c)})},gR=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,t,v,z,A,E,G;_.I(function(B){if(1==B.a){c=eR;d=a.f.get(a.a);a.g.debug("DRM Challenge data: ",b.challenge);e=atob(b.challenge);f=new Uint8Array(e.length);for(g=0;g<e.length;++g)f[g]=e.charCodeAt(g);h=b.serverurl&&""!==b.serverurl?b.serverurl:d.ue;l=_.pk([h],_.lk());l.type=3;l.body=f.buffer;l.method=
6
+ _.Jb;_.D(B,2);return _.y(B,a.D.Eb.fetch(l).T,4)}if(2!=B.a){m=B.f;if(a.j){n=_.bk(m.data);p=n.byteLength;q="";for(t=0;t<p;t++)q+=String.fromCharCode(n[t]);v=btoa(q);z=b.session_id+WQ+(v+WQ);a.g.debug("Widevine license params",z);try{webapis.avplay.setDrm(c.Qe,"widevine_license_data",z)}catch(F){a.g.error("License response rejected by CDM"),A=new _.O(_.P,6,6008,{browserError:JSON.stringify(F)}),a.D.onError(A)}}return _.Jh(B,0)}E=_.H(B);a.g.error("License request failed.",JSON.stringify(E));G=new _.O(_.P,
7
+ 6,6007,{message:"Error while fetching license!",url:E.data.url,status:E.data.status||NaN,response:E.data.response||"",headers:E.data.headers||{}},E);a.D.onError(G);_.C(B)})},hR=function(a){this.m=a;this.a=this.m.a;this.f=_.Hq;this.j=_.Iq;this.w=(new Date).getTime();this.l=!1;this.o=-1;this.h=2;this.g=new _.K("clpp.tizen.StateManager")},jR=function(a,b){if(a.f!==b)if(a.f===_.Sq&&b!==_.Hq)a.g.debug(_.ED+iR(b));else{var c=(new Date).getTime();a.j=a.f;a.f=b;a.f===_.Mq?(a.o=(new Date).getTime(),a.m.trigger(new _.L(_.qd,
8
+ {detail:{bufferedTimeMS:-1,reason:a.h}}))):a.j===_.Mq&&a.m.trigger(new _.L(_.od,{detail:{bufferedTimeMS:c-a.o,reason:a.h}}));var d={currentState:a.f,previousState:a.j,timeSinceLastStateChangeMS:c-a.w};a.w=c;a.m.trigger(new _.L(_.rg,{detail:d}));a.g.debug("State changed:",iR(a.j),"-\x3e",iR(a.f))}},iR=function(a){return Object.keys(_.Qq)[a]},mR=function(a){if(a.l){var b=a.a.getState(),c=a.f;switch(b){case kR:c=_.Vq;break;case lR:c=_.Uq;break;default:a.m.isEnded()?c=_.Oq:a.g.debug("Inconsistent AVPlay playback state:",
9
+ b)}jR(a,c)}},nR=function(){this.o=this.A=this.f=this.h=this.B=this.m=this.j=this.a=null;this.C=!1;this.w=!0;this.l=null;this.g=new _.K("clpp.tizen.TextStreamer")},oR=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},pR=function(a){var b,c;return _.I(function(d){if(1==d.a)return b=a.m.getConfiguration(),c=null,_.y(d,_.fv(a.B.url,a.m.getNetworkEngine(),b.manifest.attemptParameters,a.B.type||null),2);(c=d.f)&&c.configure(b.manifest);return d["return"](c)})},
10
+ qR=function(a){var b=document.createElement(_.r),c=new _.wH,d=new _.ZE,e=a.m.getTextDisplayer();return new _.yH(b,c,e,d,a.m.getConfiguration())},rR=function(a){var b={configuration:{},Qb:function(){return a.m.getPosition()},X:a.h,Eb:a.m.getNetworkEngine(),pd:null,xg:a.ql.bind(a),wg:a.pl.bind(a),onError:a.rl.bind(a),Ti:function(){},onEvent:function(){},Yi:a.sl.bind(a),wf:function(){},ee:function(){return new _.$H},Wf:function(){return!1},Zd:null};return new _.UI(a.a,b)},sR=function(a){var b=a.m.getPosition(),
11
+ c=null;a=_.w(a.a.periods);for(var d=a.next();!d.done;d=a.next())d=d.value,d.startTime<=b&&(c=d);return c},tR=function(a){a.g.debug("getTextStreams()",a.a);if(a.a){var b=[],c=a.a.periods;a.g.debug("getting text streams");for(var d=0;d<c.length;d++)if(a.g.debug(c[d].startTime,a.m.getPosition()),c[d].startTime<=a.m.getPosition()){b=c[d].textStreams;break}a=b}else a=[];b=[];for(d=c=0;d<a.length;d++){var e=new _.Qk(String(c++),_.Sk);e.mimeType=a[d].mimeType;e.language=a[d].language;e.roles=a[d].roles;
12
+ e.kind=a[d].kind||_.mE;var f=new _.Zk(String(a[d].id),e);f.bandwidth=a[d].bandwidth||null;e.renditions.push(f);b.push(e)}return b},uR=function(a){if(a.h&&!a.h.getTextDisplayer().isTextVisible())return null;if(a.f){var b=_.XI(a.f,_.Q),c=null;if(b){a=tR(a);for(var d=0;d<a.length;d++)if(a[d].renditions[0].id===String(b.id)){c=a[d].renditions[0];break}}return c}return null},vR=function(a,b){a.g.debug("Set active track",b);if(b&&(a.o=b.language,a.A=b.roles[0]||"",a.C=b.kind===_.Ce,a.a&&a.f)){a.setTextVisibility(!0);
13
+ var c=sR(a),d=b.renditions[0];(c=c.textStreams.find(function(e){return String(e.id)===d.id}))?(a.w?(a.g.debug("Switching period defer text selection"),a.l=c):(_.iJ(a.f,c,!0,0),a.m.trigger(new _.L(_.Cg))),a.o=c.language):a.g.error("No stream with id",d.id)}},wR=function(){this.j=this.a=this.m=null;this.f={};this.g=new _.K("clpp.tizen.TrackManager");this.w=this.o=this.l=null;this.A=!1;this.h=1},xR=function(a,b){a.m.trigger(new _.L(_.bh,{details:{width:b.width,height:b.height,bandwidth:b.bandwidth,track:b.track,
14
+ abrSelection:a.a.o}}))},yR=function(a){var b=a.na();b&&a.m.trigger(new _.L(_.md,{detail:{width:b.width,height:b.height,bandwidth:b.bandwidth,rendition:b}}))},zR=function(a){var b=a.m.getConfiguration(),c=_.Vi(b.preferredAudioLanguage||[]),d=a.f[_.V]||[];if(d.length){var e=null;c.some(function(g){e=_.LE(g,d.map(function(h){return h.language}));return!!e});if(e){var f=d.filter(function(g){return g.language===e});c=f[0];1<f.length&&b.preferredAudioRole&&(f=f.filter(function(g){return 0<=g.roles.indexOf(b.preferredAudioRole)}),
15
+ 0<f.length&&(c=f[0]));a.g.debug("Setting audio track with preferred language:",e);a.Ka(c)}else a.g.debug("Preferred language(s) not available")}else a.g.debug("Could not set preferred audio language")},DR=function(a,b){if(b){var c=b.track.type.toUpperCase();AR(a.a,c,Number(b.id)).then(function(){c===BR&&(a.l=b,a.m.trigger(new _.L(_.kd)));c===CR&&(a.o=b,a.m.trigger(new _.L(_.Cg)))})["catch"](function(){a.g.error("Could not select "+c+" track.")})}else a.g.debug("Must provide valid rendition")},ER=
16
+ function(a,b,c){var d=_.Pj(b.language||_.Ng);c.language=_.Rk(d);c.originalLanguage=d;c.channelsCount=b.channels?Number(b.channels):null;c.mimeType=_.hd;a=new _.Zk(String(a),c);a.track=c;a.codec=b.fourCC||null;a.bandwidth=b.bit_rate||null;return a},FR=function(a,b,c){c.mimeType=_.$g;a=new _.Zk(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},GR=function(a,b,c){b=_.Pj(b.track_lang||_.Ng);c.mimeType="text/ttml";
17
+ c.language=_.Rk(b);c.originalLanguage=b;c.kind=_.mE;return new _.Zk(String(a),c)},HR=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},KR=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===IR}),f=b.filter(function(n){return n.type===BR}),g=[],h=0;h<f.length;h++){var l=HR(a,f[h].extra_info);if(l){var m=
18
+ _.Pj(l.language||_.Ng);m=_.Rk(m);m=c(g,m);m||(m=new _.Qk(String(a.h++),_.V),g.push(m));m.renditions.push(ER(f[h].index,l,m))}else a.g.warn("Skipping audio stream with no extra info")}f=new _.Qk(String(a.h++),_.Tk);for(h=0;h<e.length;h++)(l=HR(a,e[h].extra_info))?f.renditions.push(FR(e[h].index,l,f)):a.g.warn("Skipping video stream with no extra info");e=[];e=a.j?tR(a.j):JR(a,b);d[_.Tk]=[f];d[_.V]=g;d[_.Sk]=e;return d},JR=function(a,b){for(var c=b.filter(function(h){return h.type===CR}),d=[],e=0;e<
19
+ c.length;e++){var f=HR(a,c[e].extra_info);if(f){var g=new _.Qk(String(a.h++),_.Sk);g.renditions.push(GR(c[e].index,f,g));d.push(g)}else a.g.warn("Skipping text stream with no extra info")}return d},LR=function(a,b){for(var c=a.f[_.Tk]||[],d=[],e=0;e<c.length;e++)for(var f=0;f<c[e].renditions.length;f++)_.N.qa(c[e].renditions[f],b,Object.keys(b))&&d.push(c[e].renditions[f]);return d[0]||null},MR=function(a,b,c){a=a.f[c]||[];b=String(b.index);c=null;for(var d=0;d<a.length;d++)for(var e=0;e<a[d].renditions.length;e++)if(a[d].renditions[e].id===
20
+ b){c=a[d].renditions[e];break}return c},OR=function(a,b){if(b===_.Sk&&a.j)return uR(a.j);var c=NR(a.a)||[];if(0===c.length)return null;c=c.filter(function(e){return e.type===b.toUpperCase()})[0];var d=null;b===_.Tk&&(d=HR(a,c.extra_info),d=LR(a,{width:d.Width,height:d.Height}));b===_.V&&(c?(d=MR(a,c,_.V),a.l=d):d=a.l);b===_.Sk&&(c?(d=MR(a,c,_.Sk),a.o=d):d=a.o);return d},PR=function(a){_.Am.call(this);this.m=a;this.h=null;this.g=new _.K("clpp.tizen.Middleware");this.C=1;this.B=!1;this.l=null;this.G=
21
+ 0;this.o=!0;this.f=!1;this.a=null;this.A=1;this.w=!1;this.j={}},QR=function(a){return _.I(function(b){tizen.systeminfo.getPropertyValue("DISPLAY",function(c){a.A=c.resolutionWidth/1920;a.g.debug("Display resolution ratio: ",a.A)},function(c){a.g.debug("Could not load DISPLAY property");throw c;});_.C(b)})},SR=function(a){try{webapis.avplay.setListener({onbufferingstart:a.kl.bind(a),onbufferingprogress:a.jl.bind(a),onbufferingcomplete:a.il.bind(a),onstreamcompleted:a.nl.bind(a),oncurrentplaytime:function(b){a.trigger(new _.L(RR,
22
+ {currentTime:b}))},onevent:a.ml.bind(a),onsubtitlechange:a.ol.bind(a),ondrmevent:a.ll.bind(a),onerror:a.Vd.bind(a)})}catch(b){a.g.error(b)}},TR=function(a){var b=!!a.m.getTrackManager().Za();try{webapis.avplay.setSilentSubtitle(!b)}catch(c){a.g.debug("Could not set AVPlay subtitle config",c)}},UR=function(a,b){try{var c=b.estimatedBandwidth||0,d=b.currentBandwidth||0;a.g.debug({estimatedBandwidth:c,np:d});0!==c&&0!==d&&c>=1.15*d&&webapis.avplay.setStreamingProperty("ADAPTIVE_INFO",ZQ+d)}catch(e){a.g.debug(e)}},
23
+ VR=function(a,b){try{webapis.avplay.setStreamingProperty("ADAPTIVE_INFO","|BITRATES\x3d"+b+ZQ+b)}catch(c){throw a.g.debug("Could not set fixed bandwidth",c),c;}},ZR=function(a){return{position:a.getPosition(),state:a.m.getState(),sh:a.getState(),playbackRate:a.getPlaybackRate(),isLive:a.isLive(),duration:a.getDuration(),isMuted:WR(a),volume:a.getVolume(),Jo:YR(a),El:NR(a)}},aS=function(a){var b,c;return _.I(function(d){if(1==d.a)return _.y(d,$R(),2);if(3!=d.a)return b=new Promise(function(e){(new _.mi(e)).fa(5)}),
24
+ _.y(d,Promise.race([QR(a).then(function(){return!0}),b.then(function(){return!1})]),3);c=d.f;if(!c)return a.g.debug("Took to long for the SDK to be ready"),d["return"](Promise.reject("SDK Timeout"));_.C(d)})},gS=function(a,b,c){var d,e,f,g,h,l,m,n;return _.I(function(p){switch(p.a){case 1:a.l=_.Zq(b);d=a.G;e=c||{estimatedBandwidth:0,currentBandwidth:0,nextBandwidth:null,currentPosition:0};a.g.debug("Loading manifest URL: "+a.l[d].url);f=b.startTime||void 0;a.f&&(a.trigger(new _.L(bS)),f=c.currentPosition);
25
+ _.D(p,2);g=a.l[d].url;h=a.l[d].type;h!==_.Xc||g.includes(".mpd")||(l=new URL(g),l.searchParams.append("cl-ext",".mpd"),g=l.toString());webapis.avplay.open(g);e.nextBandwidth?(VR(a,e.nextBandwidth),a.o=!1):(a.o||UR(a,e),a.o=!0);SR(a);if(!b.drm||!b.drm.env){a.g.debug("No DRM configuration was provided. Assuming clear content");p.F(4);break}m={onError:function(q){return a.m.onError(q)},Eb:a.m.getNetworkEngine()};a.h=new aR(b.drm,m);return _.y(p,a.h.init(),4);case 4:return a.f||a.trigger(new _.L(cS)),
26
+ _.y(p,dS(a),6);case 6:a.f||a.trigger(new _.L(eS));f&&typeof f===_.k&&0<f&&a.seek(f)["catch"](function(q){a.g.debug("Couldn't set start position",q)});a.f||(b.volume&&a.setVolume(b.volume),b.muted&&fS(a,b.muted),b.autoplay&&a.m.play()["catch"](function(q){a.g.debug("Autoplay failed",q)}));_.Jh(p,0);break;case 2:throw n=_.H(p),a.g.debug("Error while attempting to load source."),n;}})},dS=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!");
27
+ TR(a);c()},function(e){a.g.debug("prepareAsync failed",e);d(e)})}catch(e){a.g.debug("Failed to prepare media player for playback"),d(e)}}))})},hS=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=ZR(a);a.f=!0;webapis.avplay.stop();webapis.avplay.close();return a.load(a.m.getConfiguration(),d).then(function(){var e=a.a.sh;a.f=!1;a.a=
28
+ null;return e===lR?a.pause():a.play()})}catch(e){return Promise.reject(e)}},YR=function(a){return a.f&&a.a?a.a.Jo:webapis.avplay.getTotalTrackInfo()},NR=function(a){return a.f&&a.a?a.a.El:webapis.avplay.getCurrentStreamInfo()},AR=function(a,b,c){b=b.toUpperCase();b===CR&&iS(a,!0);var d=a.j[b];d&&(d.Ef.stop(),a.j[b]=null,a.g.debug("Cancelled pending track switch for "+b));return new Promise(function(e,f){function g(h,l,m){m=void 0===m?!1:m;try{webapis.avplay.setSelectTrack(h,l),a.j[h]=null,e()}catch(n){a.g.debug("Could not set "+
29
+ h+" track. Trying again...AVPlay state: "+(a.getState()+", buffering: ")+a.w,n),!1===m&&(a.j[h]={type:h,index:l,oh:0,Ef:new _.mi(function(){return g(h,c,!0)})}),(l=a.j[h])&&3>l.oh?(!a.w&&++l.oh,l.Ef.fa(a.w?.5:.25)):(a.g.debug("Could not set track after multiple attempts.Giving up..."),l&&l.Ef.stop(),a.j[h]=null,f())}}g(b,c)})},iS=function(a,b){var c=a.m.getTextDisplayer();c&&c.setTextVisibility(b);c=a.m.h;try{c||webapis.avplay.setSilentSubtitle(!b)}catch(d){a.g.debug("Could not set text track visibility",
30
+ d)}},fS=function(a,b){try{tizen.tvaudiocontrol.setMute(b)}catch(c){switch(c.name){case XQ:a.g.warn("The application does not have the privilege to set mute.",YQ);break;default:a.g.warn(UQ,c)}}},WR=function(a){var b=null;try{b=tizen.tvaudiocontrol.isMute()}catch(c){switch(c.name){case XQ:a.g.warn("The application doesn't have the privilege to get the mute state.",YQ);break;default:a.g.warn(UQ,c)}}return!!b},$R=function(){return new Promise(function(a,b){if(window.webapis)a();else{var c=document.createElement("script");
31
+ $Q(c,_.Se,function(d){return a(d)});$Q(c,_.Ae,function(d){return b(d)});c.src="$WEBAPIS/webapis/webapis.js";document.querySelector("head").appendChild(c)}})},jS=function(){_.Am.call(this);this.a=new PR(this);this.f=new hR(this);this.configuration=this.B=_.Hm();this.w=null;this.g=new _.K("clpp.tizen.Player");this.j=null;this.l=new wR;this.C=new _.Kk;this.o=this.h=null;this.A=!1},kS=function(a){if("NONE"!==a.a.getState()){var b=a.j.getBoundingClientRect();a=a.a;var c=Math.floor(b.left*a.A),d=Math.floor(b.top*
32
+ a.A),e=Math.floor(b.width*a.A);b=Math.floor(b.height*a.A);a.g.debug("Setting display area to","x:",c,"y:",d,"width:",e,"height:",b);webapis.avplay.setDisplayRect(c,d,e,b);0===c&&0===d&&1920===e&&1080===b&&webapis.avplay.setDisplayMethod("PLAYER_DISPLAY_MODE_LETTER_BOX")}else a.g.debug("Could not apply dimension. Player state "+a.a.getState())},lS=function(){},mS=function(){};
33
+ aR.prototype.init=function(){var a=this,b,c,d,e,f,g;return _.I(function(h){if(1==h.a){b=_.jn[a.h.env]||null;if(!b)throw a.g.debug(_.Ea,_.Ob+a.h.env+_.aa),new _.O(_.P,6,6015,_.Fa+a.h.env+"' is missing.");a.l={id:String(Math.floor(1E4*Math.random())),type:"MPEG-DASH"};c=Object.keys(a.h.customData||{}).length?btoa(JSON.stringify(a.h.customData)):"";d=_.ln(b,a.h.customData);(e=d[_.Vd])&&a.f.set(_.Vd,{ue:e.licenseUrl||"",customData:c,Fg:!1});(f=d[_.Xd])&&a.f.set(_.Xd,{ue:f.licenseUrl||"",customData:c,
34
+ Fg:!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(_.Vd))a.a=_.Vd;else if(a.f.get(_.Xd))a.a=_.Xd;else throw new _.O(_.P,6,6001,"Configuration for the target system is missing.");return _.y(h,dR(a),2)}a.j=!0;_.C(h)})};aR.prototype.release=function(){var a=this;return _.I(function(b){a.j=!1;a.o=null;a.a=_.ff;a.l=null;a.f=new Map;_.C(b)})};aR.prototype.getDrmInfo=function(){return this.o};
35
+ var fR={Fj:"DeleteLicenseAfterUse",Ij:"LicenseServer",Yo:"GetChallenge",Zo:"HttpHeader",ap:"UserAgent",Vo:"Cookie",Dj:"CustomData"};_.u=hR.prototype;_.u.initialize=function(){this.a.on(bS,this.Ph,this);this.a.on(nS,this.Oh,this);this.a.on(oS,this.Nh,this);this.a.on(cS,this.$i,this);this.a.on(eS,this.Zi,this);this.a.on(pS,this.Qh,this)};_.u.release=function(){jR(this,_.Hq);this.l=!1;this.o=-1;this.h=2};_.u.destroy=function(){this.release();this.a.off(bS,this.Ph);this.a.off(nS,this.Oh);this.a.off(oS,this.Nh);this.a.off(cS,this.$i);this.a.off(eS,this.Zi);this.a.off(pS,this.Qh);this.m=this.a=null};
36
+ _.u.Ph=function(){this.g.debug("Buffering start. Player state: ",this.a.getState());this.h=this.a.B?1:2;jR(this,_.Mq)};_.u.Oh=function(a){this.g.debug("Buffering progress: "+a.percent+" %. Player state: ",iR(this.f))};_.u.Nh=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()===qS;if(!a&&b){jR(this,_.Uq);return}}if(a=this.f!==_.Tq)a=this.a.getState(),a=a===kR||a===lR;a&&mR(this)};
37
+ _.u.$i=function(){this.g.debug("Preparing starts. AVPlay State: ",this.a.getState());this.a.getState()===rS?jR(this,_.Tq):this.g.error("AVPlay prepares while state is not IDLE")};_.u.Zi=function(){this.g.debug("Preparing ends: AVPlay state:",this.a.getState())};_.u.Qh=function(){jR(this,_.Oq)};_.u.getState=function(){return this.f};_.u=nR.prototype;_.u.initialize=function(a){this.m=a};
38
+ _.u.load=function(a){var b=this,c,d,e,f,g,h,l;return _.I(function(m){switch(m.a){case 1:if(!b.m)return b.g.debug("Text streamer is not initialized. Will not load()"),m["return"]();b.B=a;c=b;return _.y(m,pR(b),2);case 2:c.j=m.f;if(!b.j)return b.g.debug("Could not find manifest parser for source. Make sure parsers are registered."),m["return"]();d={configurationId:"",networkingEngine:b.m.getNetworkEngine(),onContentSteeringInfoFound:function(){return null},filterNewPeriod:function(){},filterAllPeriods:function(){},
39
+ onEvent:function(){},onError:function(){}};_.D(m,3);e=b;return _.y(m,b.j.start(a.url,d),5);case 5:e.a=m.f;_.Jh(m,4);break;case 3:return f=_.H(m),b.g.warn(f),_.D(m,6),g=b,_.y(m,b.j.start(a.url.replace("https://","http://"),d),8);case 8:g.a=m.f;_.Jh(m,4);break;case 6:h=_.H(m),b.g.error(h),b.a=null;case 4:if(!b.a||!oR(b.a)){m.F(0);break}b.h=qR(b);_.D(m,10);return _.y(m,b.h.open(),12);case 12:b.f=rR(b);l=b.m.getConfiguration();b.f.h=l.streaming;b.o=l.preferredTextLanguage;b.A=l.preferredTextRole;b.C=
40
+ l.preferForcedSubtitles;_.Jh(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,_.C(m)}})};_.u.ql=function(a){this.g.debug(_.eE,a);this.w=!0;var b=_.ZH(a.textStreams,this.o||"",this.A||"",this.C)[0]||null;this.l&&(a.textStreams.includes(this.l)&&(b=this.l),this.l=null);return{video:null,audio:null,text:b,fb:null}};_.u.pl=function(){this.g.debug("canSwitch_");this.w=!1;this.l&&(_.iJ(this.f,this.l,!0,0),this.l=null)};_.u.rl=function(){this.g.debug("onError_")};
41
+ _.u.sl=function(){this.j&&this.j.update&&this.j.update()};_.u.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)}_.C(b)})};_.u.setTextVisibility=function(a){this.g.debug("Set text visibility",a);this.h&&this.h.getTextDisplayer().setTextVisibility(a)};_.u.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;_.C(b)})};
42
+ _.u.destroy=function(){var a=this;return _.I(function(b){switch(b.a){case 1:if(!a.j){b.F(2);break}return _.y(b,a.j.stop(),3);case 3:a.j=null;case 2:if(!a.f){b.F(4);break}return _.y(b,a.f.destroy(),5);case 5:a.f=null,a.w=!0;case 4:if(!a.h){b.F(0);break}return _.y(b,a.h.destroy(),7);case 7:a.h=null,_.C(b)}})};_.x(wR,_.ul);_.u=wR.prototype;_.u.Qi=function(a){var b=a.eventid;a=a.data;switch(b){case sS:0<Object.keys(this.f).length||(this.g.debug("Loading track manager!"),this.load());b=webapis.avplay.getCurrentStreamInfo();0<b.length&&(b=+HR(this,b[0].extra_info).Bit_rate,b=LR(this,{bandwidth:b}))&&(this.w=b,xR(this,b));break;case tS:yR(this);break;default:this.g.debug("Event type: "+b+" data: "+a)}};_.u.Bg=function(a){a.detail.currentState===_.Vq&&this.m.off(_.rg,this.Bg)};
43
+ _.u.initialize=function(a){var b=this;this.m=a;this.a=this.m.a;this.m.on(_.rg,function(c){b.A||(c=c.detail,c.currentState===_.Vq&&(b.g.debug("Current state",c.currentState),b.A=!0,zR(b)))});this.a.on(uS,this.Qi,this)};_.u.release=function(){this.f={};this.j=this.w=this.o=this.l=null;this.A=!1;this.h=1};
44
+ _.u.load=function(){if(this.a&&!(0<Object.keys(this.f).length)){this.j=this.m.h;this.m.off(_.rg,this.Bg);this.m.on(_.rg,this.Bg,this);try{var a=YR(this.a);this.f=KR(this,a);var b=this.f[_.V]||[];b.length&&(this.l=b[0].renditions[0]||null);yR(this)}catch(c){this.g.debug("Could not load track manager")}}};_.u.destroy=function(){this.a.off(uS,this.Qi);this.a=this.m=null};_.u.getVideoTracks=function(){return this.f[_.Tk]||[]};_.u.getAudioTracks=function(){return this.f[_.V]||[]};
45
+ _.u.ma=function(){return this.f[_.Sk]||[]};_.u.na=function(){return OR(this,_.Tk)};_.u.Va=function(){return OR(this,_.V)};_.u.Za=function(){return OR(this,_.Sk)};_.u.Bb=function(){return this.w};_.u.Nb=function(){this.g.info(VQ);return null};_.u.Ob=function(){this.g.info(VQ);return null};_.u.Na=function(){var a=this.na();return a?a.track:null};_.u.ra=function(){var a=this.Va();return a?a.track:null};_.u.Ba=function(){var a=this.Za();return a?a.track:null};
46
+ _.u.Jb=function(a){var b=this;null===a?(a=this.na(),hS(this.a,a.bandwidth,null).then(function(){yR(b)})):0<a.renditions.length&&this.ub(a.renditions[0])};_.u.Ka=function(a){a?DR(this,a.renditions[0]):this.g.warn("Cannot disable audio tracks on this platform.","Consider muting audio instead...")};_.u.$a=function(a){a?(a=a.renditions[0],this.j?vR(this.j,a.track):DR(this,a)):(this.g.debug("Disabling text tracks"),this.o=null,iS(this.a,!1),this.m.trigger(new _.L(_.Cg)))};
47
+ _.u.ub=function(a){var b=this,c=this.na();this.a.o||a.width!==c.width||a.height!==c.height||a.bandwidth!==c.bandwidth?(this.w=a,xR(this,a),hS(this.a,c.bandwidth,a.bandwidth).then(function(){yR(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...")};_.u.Hb=function(a){DR(this,a)};_.u.Ib=function(a){this.j?vR(this.j,a.track):DR(this,a)};
48
+ _.u.addTextTrack=function(){};_.u.wa=function(){return this.a.o};wR.prototype.isAbrEnabled=wR.prototype.wa;wR.prototype.addTextTrack=wR.prototype.addTextTrack;wR.prototype.setTextRendition=wR.prototype.Ib;wR.prototype.setAudioRendition=wR.prototype.Hb;wR.prototype.setVideoRendition=wR.prototype.ub;wR.prototype.setTextTrack=wR.prototype.$a;wR.prototype.setAudioTrack=wR.prototype.Ka;wR.prototype.setVideoTrack=wR.prototype.Jb;wR.prototype.getTextTrack=wR.prototype.Ba;wR.prototype.getAudioTrack=wR.prototype.ra;
49
+ wR.prototype.getVideoTrack=wR.prototype.Na;wR.prototype.getLoadingTextRendition=wR.prototype.Ob;wR.prototype.getLoadingAudioRendition=wR.prototype.Nb;wR.prototype.getLoadingVideoRendition=wR.prototype.Bb;wR.prototype.getTextRendition=wR.prototype.Za;wR.prototype.getAudioRendition=wR.prototype.Va;wR.prototype.getVideoRendition=wR.prototype.na;wR.prototype.getTextTracks=wR.prototype.ma;wR.prototype.getAudioTracks=wR.prototype.getAudioTracks;wR.prototype.getVideoTracks=wR.prototype.getVideoTracks;_.x(PR,_.Am);_.u=PR.prototype;_.u.kl=function(){this.w=!0;this.f||this.trigger(new _.L(bS))};_.u.jl=function(a){this.w=!0;this.trigger(new _.L(nS,{percent:a}))};_.u.il=function(){this.w=!1;this.trigger(new _.L(oS))};_.u.nl=function(){this.trigger(new _.L(pS))};_.u.ml=function(a,b){this.trigger(new _.L(uS,{eventid:a,data:b}))};_.u.ol=function(a,b,c,d,e){this.trigger(new _.L(vS,{duration:a,text:b,subtitleType:c,attriCount:d,attributes:e}))};
50
+ _.u.ll=function(a,b){this.trigger(new _.L(wS,{drmType:a,drmData:b}));if(this.h){var c=this.h;if(c.j)if(c.a===_.Xd&&"Challenge"===b.name)gR(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.D.onError(d)}}};_.u.Vd=function(a){this.trigger(new _.L(xS,{eventType:a}))};
51
+ _.u.play=function(){function a(){return new Promise(function(d,e){function f(){d();clearTimeout(g)}var g=null;b.one(RR,f,b);g=setTimeout(function(){b.off(RR,f);e("Timeout")},3E4)})}var b=this,c=this.getState();if(c===rS)return(new Promise(function(d,e){webapis.avplay.prepareAsync(function(){TR(b);d(webapis.avplay.play())},function(f){b.trigger(new _.L(xS));e(f)})})).then(function(){return a()});if(c===lR||c===qS)try{return webapis.avplay.play(),a()}catch(d){return Promise.reject(d)}return c===kR?
52
+ Promise.resolve():Promise.reject("Player is in invalid state")};_.u.pause=function(){try{webapis.avplay.pause()}catch(a){Promise.reject(a)}return this.getState()===lR?Promise.resolve():Promise.reject()};
53
+ _.u.setPlaybackRate=function(a){var b=this.getState();if(b===qS||b===kR||b===lR){try{webapis.avplay.setSpeed(a),this.C=a}catch(c){return this.g.debug("Error while trying to set playback rate",c),this.setPlaybackRate(this.C)}return!0}this.g.debug("Cannot set playback rate; AVPlay is in inconsistent state: "+b);return!1};_.u.getPlaybackRate=function(){return this.C};
54
+ _.u.load=function(a,b){var c=this,d;return _.I(function(e){switch(e.a){case 1:return c.g.debug("configure()",b||""),_.D(e,2),_.y(e,aS(c),4);case 4:return _.y(e,gS(c,a,b),5);case 5:_.Jh(e,0);break;case 2:throw d=_.H(e),new _.O(_.P,7,7003,null,d);}})};_.u.getState=function(){if(this.f&&this.a)return this.a.sh;try{return webapis.avplay.getState()}catch(a){this.Vd(JSON.stringify(a))}};
55
+ _.u.seek=function(a){var b=this,c=1E3*a;return new Promise(function(d,e){b.B=!0;b.m.trigger(new _.L(_.Ug));webapis.avplay.seekTo(c,function(){b.B=!1;b.m.trigger(new _.L(_.Tg));d()},function(){b.B=!1;e()})})};_.u.getPosition=function(){if(this.f&&this.a)return this.a.position;try{return webapis.avplay.getCurrentTime()/1E3}catch(a){this.Vd(JSON.stringify(a))}};_.u.getDuration=function(){if(this.f&&this.a)return this.a.duration;try{return webapis.avplay.getDuration()/1E3}catch(a){this.Vd(JSON.stringify(a))}};
56
+ _.u.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.Ef.stop()}a.j={};a.C=1;a.B=!1;a.l=null;a.a=null;return b()}catch(f){return c(f)}})};_.u.getVolume=function(){var a=null;try{a=tizen.tvaudiocontrol.getVolume()}catch(b){switch(b.name){case XQ:this.g.debug("The application does not have the privilege to get the volume.",YQ);break;default:this.g.debug(UQ,b)}}return a};
57
+ _.u.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 XQ:this.g.warn("The application does not have the privilege to set the volume.",YQ);break;default:this.g.warn("An unknown error occurred while trying to set volume",b)}}};
58
+ _.u.isLive=function(){if(this.f&&this.a)return this.a.isLive;try{return"1"===webapis.avplay.getStreamingProperty("IS_LIVE")}catch(a){this.Vd(JSON.stringify(a))}};_.u.stop=function(){try{webapis.avplay.stop()}catch(a){this.g.debug(a)}};_.u.getDrmInfo=function(){this.h&&this.h.getDrmInfo();return null};_.u.setSourceIndex=function(a){this.G=a};_.u.getSourceIndex=function(){return this.G};_.u.getLoadedSource=function(){return this.l&&this.l[this.getSourceIndex()]};
59
+ var rS="IDLE",qS="READY",kR="PLAYING",lR="PAUSED",IR=_.jc,BR=_.ja,CR="TEXT",tS="PLAYER_MSG_RESOLUTION_CHANGED",sS="PLAYER_MSG_BITRATE_CHANGE",eR={PLAYREADY:"PLAYREADY",Wo:"EME_PLAYREADY",bp:"VERIMATRIX",Qe:"WIDEVINE_CDM",Xo:"EME_WIDEVINE_CDM",ep:"WIDEVINE_CLASSIC"};_.x(jS,_.Am);_.u=jS.prototype;_.u.Lh=function(){var a=this;this.g.debug("On Stream completed. Current time: ",this.getPosition());this.trigger(new _.L(_.ze));this.configuration.loop?this.seek(this.configuration.startTime||0)["catch"](function(){a.g.debug("Could not loop playback")}):this.a.stop()};_.u.Ih=function(a){this.trigger(new _.L(_.Hg,{currentTime:a.currentTime/1E3}))};
60
+ _.u.Mh=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=_.T.Ug(d))&&this.o.append([new _.gj(b,c,d)],[])};_.u.Jh=function(a){this.g.debug("DRM event: "+a.drmType+", data: "+a.drmData)};_.u.Si=function(){this.A||(this.g.debug("Initial buffering completed..."),this.A=!0)};
61
+ _.u.Kh=function(a){this.g.debug("Error: TYPE: "+a.eventType);jR(this.f,_.Sq);a=new _.O(_.P,7,7200,{tizenerror:a.eventType});this.a.release();this.trigger(new _.L(_.Ae,{detail:a}))};
62
+ _.u.init=function(a,b){this.configuration=this.B=b;this.w=a;this.a.on(pS,this.Lh,this);this.a.on(RR,this.Ih,this);this.a.on(vS,this.Mh,this);this.a.on(wS,this.Jh,this);this.a.on(xS,this.Kh,this);this.a.on(oS,this.Si,this);this.f.initialize();this.l.initialize(this);this.g.debug("Initializing player surface");this.w.hideMediaElement();var c=yS;yS+=1;this.j=_.tr(_.gf,{id:"__clpp_tizen_player_"+c,type:"application/avplayer"});this.w.addElementToContainer(this.j,!0);var d=this.w.getMedia();if(d){c=this.j;
63
+ var e=[_.mh,_.Fe,"position",_.Le,"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=_.w(e);for(e=g.next();!e.done;e=g.next())e=e.value,f[e]=d[e];_.vr(c,f);kS(this)}};_.u.getSurface=function(){return this.w};_.u.getConfiguration=function(){return this.configuration};_.u.getTimeline=function(){return null};_.u.setupPlaylist=function(){return Promise.reject(_.Fb)};_.u.appendLoad=function(){return Promise.reject(_.Fb)};
64
+ _.u.seekWith=function(){return Promise.reject(_.Fb)};_.u.setSeekInterceptor=function(){};_.u.setPlaybackSessionId=function(){};_.u.getBandwidthEstimate=function(){return null};
65
+ _.u.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(pS,a.Lh);a.a.off(RR,a.Ih);a.a.off(vS,a.Mh);a.a.off(wS,a.Jh);a.a.off(xS,a.Kh);a.a.off(oS,a.Si);if(!a.h){b.F(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,_.C(b)}})};_.u.namespace=function(){return zS};_.u.getPlaybackRate=function(){return this.a.getPlaybackRate()};
66
+ _.u.setDrmCustomDataModifier=function(){};_.u.setCdnErrorCallback=function(){};_.u.detach=function(){};_.u.setPlaybackRate=function(a){this.a.setPlaybackRate(a)};_.u.getPosition=function(){return this.getMediaPosition()};_.u.getMediaPosition=function(){return 0<(this.configuration.startTime||0)&&!this.A?0:this.f.getState()===_.Oq?this.getDuration():this.a.getPosition()||0};_.u.seek=function(a){return typeof a===_.k&&0<=a?(this.isLive()||(a=Math.min(a,this.getDuration())),this.a.seek(a)):Promise.reject()};
67
+ _.u.getPresentationStartTime=function(){return null};_.u.getSeekRange=function(){return{start:0,end:0}};_.u.getVolume=function(){var a=this.a.getVolume();return typeof a===_.k?a/100:null};_.u.setVolume=function(a){this.a.setVolume(a)};_.u.getDuration=function(){return this.getMediaDuration()};_.u.getMediaDuration=function(){return this.a.getDuration()};_.u.getBufferInfo=function(){this.g.warn(_.wa);return new _.zm};_.u.getTrackManager=function(){return this.l};_.u.unload=function(){var a=this;return this.a.release().then(function(){a.l.release()})};
68
+ _.u.release=function(){var a=this;return _.I(function(b){switch(b.a){case 1:if(!a.h){b.F(2);break}return _.y(b,a.h.release(),2);case 2:if(!a.o){b.F(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,_.C(b)}})};
69
+ _.u.load=function(a){var b=this,c,d,e,f,g;return _.I(function(h){switch(h.a){case 1:b.configuration=_.Jm(b.B,a);c=_.yq(b.configuration,[_.He,"native"]);b.o=c.create(b);d=_.Zq(b.configuration)[0];e=!!b.configuration.tizen&&b.configuration.tizen.sideStreamText;if(!e){h.F(2);break}b.h=new nR;b.h.initialize(b);_.D(h,3);return _.y(h,b.h.load(d),5);case 5:b.h.start();_.Jh(h,2);break;case 3:f=_.H(h),b.g.error(f);case 2:return _.D(h,6),_.y(h,b.a.load(b.configuration),8);case 8:_.Jh(h,7);break;case 6:throw g=
70
+ _.H(h),b.onError(g),g;case 7:b.l.load(),_.C(h)}})};_.u.play=function(){var a=this;this.trigger(new _.L(_.wf));kS(this);return this.a.play().then(function(){mR(a.f)})};_.u.pause=function(){var a=this;return this.a.pause().then(function(){mR(a.f)})};_.u.getState=function(){return this.f.getState()};_.u.getPeriods=function(){return[]};_.u.onError=function(a){var b=new _.L(_.Ae,{detail:a});a.severity===_.P&&(jR(this.f,_.Sq),this.a.release());this.trigger(b);b.defaultPrevented&&(b.a=!0)};
71
+ _.u.getDrmInfo=function(){return this.a.getDrmInfo()};_.u.isEnded=function(){return this.f.getState()===_.Oq};_.u.isPaused=function(){return this.a.getState()===lR};_.u.isMuted=function(){return WR(this.a)};_.u.setMuted=function(a){fS(this.a,a)};_.u.getNetworkEngine=function(){return this.C};_.u.setNetworkEngine=function(a){this.C=a};_.u.setCmsdManager=function(){};_.u.isLive=function(){return this.a.isLive()};_.u.getStats=function(){return null};_.u.setSourceIndex=function(a){this.a.setSourceIndex(a)};
72
+ _.u.getSourceIndex=function(){return this.a.getSourceIndex()};_.u.getLoadedSource=function(){return this.a.getLoadedSource()};_.u.canPlay=function(a,b){return(new lS).canPlay(a,b)};_.u.getTimelineCues=function(){return[]};_.u.getCueTimeline=function(){return null};_.u.getTextDisplayer=function(){return this.o};_.u.resetAbr=function(){};var zS="clpp.tizen",yS=0;lS.prototype.a=function(){return zS};
73
+ lS.prototype.canPlay=function(a){a=a.type;var b=!!window.webapis;if((a===_.Xc||a===_.mm||a===_.bd)&&b){if(_.Fk(2))return 2;if(_.Fk(3)||_.Fk(4)||_.Fk(5)||_.Fk(6))return _.Yh("Use of clpp.tizen.TizenComponent is not recommended for Tizen version \x3e\x3d 3."),1}return 0};lS.prototype.f=function(a){return a===_.qa};lS.prototype.create=function(){return new jS};_.x(mS,_.Gu);mS.prototype.f=function(){_.hi(new lS)};mS.prototype.a=function(){var a=zS;a&&_.fi[a]&&(delete _.fi[a],_.gi.info("Removed Player factory: '"+a+"'"))};mS.prototype.id=function(){return"tizen"};_.J("clpp.tizen.TizenComponent",mS);var bS="onbufferingstart",nS="onbufferingprogress",oS="onbufferingcomplete",pS="onstreamcompleted",RR="oncurrentplaytime",uS="onevent",vS="onsubtitlechange",wS="ondrmevent",xS="onerror",cS="preparingstart",eS="preparingend";};
74
74
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
75
75
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
76
76
  else{_=this.clpp._;(f.call(g,this));}
package/cjs/cl.ttml.js CHANGED
@@ -1,33 +1,33 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var uy='application/mp4; codecs\x3d"stpp.ttml"',vy='application/mp4; codecs\x3d"stpp.ttml.im1i"',wy='application/mp4; codecs\x3d"stpp.ttml.im1t"',xy="backgroundColor",yy="direction",zy="displayAlign",Ay="region",By="sans-serif",Cy="textAlign",Dy="textDecoration",Ey="writingMode",Fy=function(a,b,c){this.h=a;this.f=b;this.a=c},Gy=function(a,b,c){Fy.call(this,a,[],c);this.j=b||""},Hy=function(a,b,c){Fy.call(this,a,b,c)},Iy=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
- Qy=function(a,b){var c=null;if(Jy.test(a)){c=Jy.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 Ky.test(a)?c=Ly(Ky,a):My.test(a)?c=Ly(My,a):Ny.test(a)?(c=Ny.exec(a),c=Number(c[1])/b.frameRate):Oy.test(a)?(c=Oy.exec(a),c=Number(c[1])/b.a):Py.test(a)&&(c=Ly(Py,a));return c},Ly=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)},Ry=function(a){return a.split(":").pop()},Sy=function(a){return a.replace(/(\d*\.?\d+)c/g,"$1em")},Uy=function(a,b){for(;Ty.test(a);){var c=Ty.exec(a)[0];a=a.replace(c,parseInt(c,10)/b+"em")}return a},Vy=function(a){return a?a.replace(/(\d*\.?\d+)%/g,function(b,c){return c/100+"em"}):""},Wy=function(a,b,c,d,e,f,g){Fy.call(this,a,f,g);this.w=b;this.A=c;this.o=d;this.l=e;this.j=[]},Xy=function(a,b,c){a=Iy(a,b,Cy);if(!a&&c&&(a=Iy(c,b,Cy),!a&&"rltb"===Iy(c,b,Ey)))return _.Vf;switch(a){case _.rd:return _.Ii;
5
- case _.Vf:case _.qe:return _.Vf;default:return _.De}},Yy=function(a,b,c){if(_.T.jf(a.w))return document.createTextNode(_.T.Rg(a.w||""));if(a.A)return _.ir("br");for(var d=_.ir("span"),e=_.w(a.f),f=e.next();!f.done;f=e.next())_.jr(d,f.value);a=_.w(a.j);for(e=a.next();!e.done;e=a.next())d.appendChild(Yy(c.get(e.value),b,c));return d},Zy=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]))},$y=function(a,b,c){Fy.call(this,a,b,c)},cz=function(a,b,c,d){var e=az.exec(a);a=bz.exec(a);return typeof b===_.k&&0<b&&a?100*Number(a[c])/b:e?Number(e[c]):a?Number(a[c]):d},dz=function(a,b){return typeof b===_.k&&0<b?_.Oi:bz.test(a)?0:_.Oi},ez=function(a,b){Fy.call(this,"root-container",[],b);this.j=a},fz=function(a,b,c){return typeof a===_.k?a:typeof b===_.k?b:c},gz=function(a,b){var c=a.getAttribute("extent");return(c=bz.exec(c))?Number(c[b]):null},iz=
7
- function(a){a=a.getAttribute("cellResolution");return(a=hz.exec(a))?Number(a[2]):null},jz=function(a,b,c){Fy.call(this,a,b,c)},kz=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=[]},mz=function(a){return lz.some(function(b){return b in a.attributes})},nz=function(a,b){if(0===b.length)return[];for(var c=[],d=_.w(b),e=d.next();!e.done;e=d.next())e=e.value,a.a.has(e)&&c.push.apply(c,_.gh(nz(a,a.a.get(e).f)).concat([e]));return c},pz=
8
- function(){return"inline-"+oz++},qz=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})},rz=function(a){this.a=a.firstChild;this.f=new Set},sz=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},tz=function(a){return Ry(a.h.nodeName)},uz=function(){this.a=new Map},wz=function(a,b){if(a.a.has(b))return a.a.get(b);var c=null,d=null,e=[],f=[],g={},h=b.parentNode;if(h&&a.a.has(h)){var l=a.a.get(h);e=
9
- _.gh(l.l).concat();-1===[_.da,"span","br"].indexOf(b.nodeName)&&(c=l.a,d=l.j,f=_.gh(l.f).concat(),g={},vz.forEach(function(n){n in l.attributes&&(g[n]=l.attributes[n])}))}if(b.nodeType===b.ELEMENT_NODE){b.hasAttribute(Ay)&&(c=b.getAttribute(Ay));b.hasAttribute(_.ng)&&f.push.apply(f,_.gh(b.getAttribute(_.ng).split(" ")));d=Array.from(b.attributes).map(function(n){return n.name});d=_.w(d);for(h=d.next();!h.done;h=d.next()){h=h.value;var m=Ry(h);g[m]=b.getAttribute(h)}d=g.backgroundImage}c=new sz(b,
10
- c,d,e,f,g);a.a.set(b,c);return c},xz=function(a){this.a=a;this.f=new DOMParser},yz=function(a){this.f=a},zz=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")},Az=function(){},Bz=function(a){this.a=new xz(a);this.g=new _.K("clpp.ttml.Mp4TtmlParser")},Cz=function(){this.j=new Az};Fy.prototype.getId=function(){return this.h};
11
- Fy.prototype.hasAttribute=function(a){return a in this.a};Fy.prototype.getAttribute=function(a){return this.a[a]};_.x(Gy,Fy);_.x(Hy,Fy);var Jy=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Ky=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,My=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d+)$/,Ny=/^(\d*(?:\.\d*)?)f$/,Oy=/^(\d*(?:\.\d*)?)t$/,Py=/^(?:(\d*(?:\.\d*)?)h)?(?:(\d*(?:\.\d*)?)m)?(?:(\d*(?:\.\d*)?)s)?(?:(\d*(?:\.\d*)?)ms)?$/,az=/^(\d{1,2}(?:\.\d+)?|100(?:\.0+)?)% (\d{1,2}(?:\.\d+)?|100(?:\.0+)?)%$/,bz=/^(\d+)px (\d+)px$/,hz=/^(\d+) (\d+)$/,Ty=/(\d+)px/,Dz=/^(\d+px|\d+em|\d*\.?\d+c)$/,lz=[xy,"color",yy,zy,"fontFamily","fontSize","fontStyle","fontWeight",
12
- "lineHeight","opacity","padding",Cy,Dy,"textOutline",Ey,"zIndex"],vz=["begin",_.qe];_.x(Wy,Hy);
13
- Wy.prototype.build=function(a,b,c,d,e,f,g){var h=Qy(this.a.begin,b);b=Qy(this.a.end,b);if(null===h||null===b)return null;h+=c;b+=c;c=_.ir(_.Zd);for(var l=_.w(this.j),m=l.next();!m.done;m=l.next())c.appendChild(Yy(g.get(m.value),e,g));g=new _.Ni(h,b,c.innerHTML.trim(),_.vg);g.cssClassList=_.gh(this.f).concat();g.textAlign=Xy(this,e,null);g.writingMode=_.Ji;g.line=-1;g.lineInterpretation=_.Ki;g.lineAlign=_.Li;g.containerRows=fz(null,iz(a),15);if(this.o&&(f=f.get(this.o))){g.region=f.build(a,e);g.textAlign=
14
- Xy(this,e,f);a:switch(Iy(f,e,Ey)){case "tb":case "tblr":a=_.Hg;break a;case "tbrl":a=_.Jg;break a;default:a=_.Ji}g.writingMode=a;a:switch(Iy(f,e,zy)){case _.rd:a=50;break a;case "after":a=-1;break a;default:a=0}g.line=a;a:switch(Iy(f,e,zy)){case _.rd:a=1;break a;default:a=_.Ki}g.lineInterpretation=a;a:switch(Iy(f,e,zy)){case _.rd:e=_.rd;break a;default:e=_.Li}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};_.x($y,Hy);
16
- $y.prototype.build=function(a,b){var c=new _.Qi;c.id=this.getId();var d=fz(a.j.containerWidth,gz(a,1),720),e=fz(a.j.containerHeight,gz(a,2),480);a:switch(Iy(this,b,zy)){case "after":var f="flex-start";break a;case _.rd:f=_.rd;break a;default:f="flex-end"}c.displayAlign=f;a:switch(Iy(this,b,Ey)){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")||Iy(this,b,"extent");c.width=cz(f,d,1,100);c.widthUnits=dz(f,d);c.height=
17
- cz(f,e,2,100);c.heightUnits=dz(f,e);f=this.getAttribute("origin")||Iy(this,b,"origin");c.viewportAnchorX=cz(f,d,1,0);c.viewportAnchorY=cz(f,e,2,0);c.viewportAnchorUnits=dz(f,d);c.cssClassList=_.gh(this.f).concat();return c};_.x(ez,Fy);_.x(jz,Fy);
18
- jz.prototype.build=function(a){var b=null;var c=iz(a);c&&(b=fz(a.j.containerHeight,gz(a,2),480)/c);b=fz(a.j.fontSizeRadix,b,16);a=[];c="::ttml ."+this.h+", ::ttml ."+this.h+" * {";for(var d=_.w(Ez.entries()),e=d.next();!e.done;e=d.next()){var f=_.w(e.value);e=f.next().value;f=f.next().value;e in this.a&&(c+=f+":"+Sy(this.a[e])+";")}a:{if("unicodeBidi"in this.a){d=this.a.unicodeBidi;e="";switch(d){case "normal":case "embed":e=d;break;case "bidiOverride":e="bidi-override"}if(0<e.length){d="unicode-bidi:"+
19
- e+";";break a}}d=""}c+=d;a:{if("textOutline"in this.a){d=this.a.textOutline.split(" ");e="black";f=".4em";var g=d[0]&&d[0].trim(),h=d[1]&&d[1].trim(),l=d[2]&&d[2].trim();3===d.length&&!Dz.test(g)&&Dz.test(h)&&Dz.test(l)?(e=g,f=h):2===d.length&&!Dz.test(g)&&Dz.test(h)?(e=g,f=h):2===d.length&&Dz.test(g)&&Dz.test(h)&&(f=g);if(""!==f){f=Sy(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=Vy(this.a.textShadow),d=Sy(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",By).replace("proportionalSerif",By).replace("sansSerif",By).replace("default",By)+";":"");a:{if(Dy in this.a){d=[];e=_.w(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:"+Sy(this.a.padding)+";":"";c=c+d+e;"lineHeight"in this.a?(d="",e=this.a.lineHeight,e=Sy(e),e=Uy(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=Sy(d);d=Uy(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 Ez=new Map([[xy,"background-color"],["color","color"],[yy,yy],["fontStyle","font-style"],["fontWeight","font-weight"],["opacity","opacity"],["zIndex","z-index"]]);var oz=0;rz.prototype.ge=function(){return!!this.a};rz.prototype.next=function(){if(!this.a)return null;var a=this.a;do this.f.add(a),a.nodeType!==Node.TEXT_NODE&&!Fz.has(Ry(a.nodeName))||Gz.has(Ry(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&&!Fz.has(Ry(a.nodeName))));var b=this.a;this.a=a;return b};
23
- var Fz=new Set(["tt","head","layout",_.Se,_.Ae,Ay,"styling",_.ng,"body",_.Zd,"p","span","br"]),Gz=new Set([_.ng,_.Ae]);sz.prototype.getId=function(){return this.attributes.id};xz.prototype.parseInit=function(){};
24
- xz.prototype.parseMedia=function(a,b,c){c&&c.length||(c=[a.byteLength]);var d=_.N.gb(this.a.ttml||{}),e=_.Hj(a,0,c[0]);e=_.T.ba(e);if(""===e)return{cues:[],styles:[]};var f=null;try{f=this.f.parseFromString(e,_.sg)}catch(n){throw new _.P(_.Q,2,2005,"Failed to parse TTML.");}d=new kz(d);e=new uz;f=new rz(f);b=b.periodStart;typeof b===_.k&&(d.A=b);b=c[0];for(var g=1;g<c.length;++g){var h=c[g],l=_.Hj(a,b,h);l=_.Rj(l);var m="urn:mpeg:14496-30:subs:"+g;d.h.set(m,new Gy(m,l,{imageType:"PNG",encoding:"Base64"}));
25
- b+=h}for(;f.ge();)a=f.next(),a=wz(e,a),"tt"===tz(a)&&(d.l=new ez(d.B,Object.assign({},a.attributes))),"tt"===tz(a)&&(d.w=new Zy(a.attributes.frameRate,a.attributes.subFrameRate,a.attributes.frameRateMultiplier,a.attributes.tickRate)),tz(a)!==_.Ae||a.attributes.begin||a.attributes.end||(c="#"+a.getId(),d.h.set(c,new Gy(c,a.h.textContent,a.attributes))),tz(a)===_.Ae&&a.attributes.begin&&a.attributes.end?(c="#"+pz(),b=new Gy(c,a.h.textContent,a.attributes),d.h.set(c,b),c=b):c=null,c&&(a.j=c.getId()),
26
- tz(a)===_.ng&&(c=a.getId()||pz(),b=new jz(c,a.f,Object.assign({},a.attributes)),d.a.set(c,b),a.a&&d.j.get(a.a).f.push(c)),tz(a)!==_.ng&&mz(a)?(c=pz(),b=new jz(c,[],Object.assign({},a.attributes)),d.a.set(c,b),c=b):c=null,c&&a.f.push(c.getId()),tz(a)!==_.Zd||!a.attributes.extent&&!a.attributes.origin?c=null:(c=pz(),b=new $y(c,nz(d,a.f),Object.assign({},a.attributes)),d.j.set(c,b),c=b),c&&(a.a=c.getId()),tz(a)!==Ay?c=null:(c=a.getId(),b=new $y(c,nz(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(tz(a))||0===c.length?c=null:(g=c[c.length-1],d.f.has(g)?(c=pz(),b=new Wy(c,a.h.nodeName===_.da?a.h.textContent:null,"br"===tz(a),a.a,a.j,nz(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"===tz(a)||a.j?(c=pz(),b=new Wy(c,null,!1,a.a,a.j,nz(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=qz(d);f=[];a=_.w(d.a.values());for(c=a.next();!c.done;c=a.next())f.push.apply(f,
28
- _.gh(c.value.build(d.l)));return{cues:e,styles:f}};yz.prototype.a=function(a){a=(new xz(this.f)).parseMedia(a,{periodStart:0,segmentStart:null,segmentEnd:0}).cues;var b="WEBVTT\n\n";a=_.w(a);for(var c=a.next();!c.done;c=a.next()){c=c.value;var d=zz(c.startTime)+" --\x3e "+zz(c.endTime),e=[];switch(c.textAlign){case _.De:e.push("align:left");break;case _.Vf:e.push("align:right");break;case _.Ii:e.push("align:middle");break;case _.De:e.push("align:start");break;case _.Vf:e.push("align:end")}switch(c.writingMode){case _.Hg:e.push("vertical:lr");break;
29
- case _.Jg:e.push("vertical:rl")}b+=d+(e.length?" "+e.join(" "):"")+"\n";b+=c.payload+"\n\n"}return _.T.cb(b)};Az.prototype.probe=function(a,b){return a===_.Wc&&b===_.rg};Az.prototype.create=function(a){return new yz(a)};Bz.prototype.parseInit=function(a){var b=!1;(new _.sn).N(_.Ve,_.tn).N(_.ug,_.tn).N(_.Qe,_.tn).N(_.Ue,_.tn).N(_.kg,_.tn).Z(_.mg,_.un).N("stpp",function(c){b=!0;c.parser.stop()}).parse(a);if(!b)throw new _.P(_.Q,2,2007);};
30
- Bz.prototype.parseMedia=function(a,b){var c=this,d=!1,e=[],f=[],g=[];(new _.sn).N("moof",_.tn).N("traf",_.tn).Z("subs",function(h){for(var l=_.nn(h.reader),m=0;m<l;++m){h.reader.skip(4);for(var n=_.mn(h.reader),p=0;p<n;++p){var q=1===h.version?_.nn(h.reader):_.mn(h.reader);g.push(q);h.reader.skip(6)}}}).N(_.Pe,_.vn(function(h){d=!0;h=c.a.parseMedia(h,b,g);e=e.concat(h.cues);f=f.concat(h.styles)})).parse(a);d||this.g.warn("Couldn't find the mdat box");return{cues:e,styles:f}};_.x(Cz,_.ku);Cz.prototype.f=function(){_.iv(_.Wc,xz);_.iv(_.Uc,Bz);_.iv(uy,Bz);_.iv(wy,Bz);_.iv(vy,Bz);_.il.push(this.j)};Cz.prototype.a=function(){_.Av(_.Wc);_.Av(_.Uc);_.Av(uy);_.Av(wy);_.Av(vy);_.kl(this.j)};Cz.prototype.id=function(){return"subtitles-ttml"};_.J("clpp.ttml.TtmlComponent",Cz);};
2
+ var f=function(window){var Qy='application/mp4; codecs\x3d"stpp.ttml"',Ry='application/mp4; codecs\x3d"stpp.ttml.im1i"',Sy='application/mp4; codecs\x3d"stpp.ttml.im1t"',Ty="backgroundColor",Uy="direction",Vy="displayAlign",Wy="region",Xy="sans-serif",Yy="textAlign",Zy="textDecoration",$y="writingMode",az=function(a,b,c){this.h=a;this.f=b;this.a=c},bz=function(a,b,c){az.call(this,a,[],c);this.j=b||""},cz=function(a,b,c){az.call(this,a,b,c)},dz=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
+ lz=function(a,b){var c=null;if(ez.test(a)){c=ez.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 fz.test(a)?c=gz(fz,a):hz.test(a)?c=gz(hz,a):iz.test(a)?(c=iz.exec(a),c=Number(c[1])/b.frameRate):jz.test(a)?(c=jz.exec(a),c=Number(c[1])/b.a):kz.test(a)&&(c=gz(kz,a));return c},gz=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)},mz=function(a){return a.split(":").pop()},nz=function(a){return a.replace(/(\d*\.?\d+)c/g,"$1em")},pz=function(a,b){for(;oz.test(a);){var c=oz.exec(a)[0];a=a.replace(c,parseInt(c,10)/b+"em")}return a},qz=function(a){return a?a.replace(/(\d*\.?\d+)%/g,function(b,c){return c/100+"em"}):""},rz=function(a,b,c,d,e,f,g){az.call(this,a,f,g);this.w=b;this.A=c;this.o=d;this.l=e;this.j=[]},sz=function(a,b,c){a=dz(a,b,Yy);if(!a&&c&&(a=dz(c,b,Yy),!a&&"rltb"===dz(c,b,$y)))return _.dg;switch(a){case _.yd:return _.bj;
5
+ case _.dg:case _.ye:return _.dg;default:return _.Le}},tz=function(a,b,c){if(_.T.qf(a.w))return document.createTextNode(_.T.Ug(a.w||""));if(a.A)return _.tr("br");for(var d=_.tr("span"),e=_.w(a.f),f=e.next();!f.done;f=e.next())_.ur(d,f.value);a=_.w(a.j);for(e=a.next();!e.done;e=a.next())d.appendChild(tz(c.get(e.value),b,c));return d},uz=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]))},vz=function(a,b,c){az.call(this,a,b,c)},yz=function(a,b,c,d){var e=wz.exec(a);a=xz.exec(a);return typeof b===_.k&&0<b&&a?100*Number(a[c])/b:e?Number(e[c]):a?Number(a[c]):d},zz=function(a,b){return typeof b===_.k&&0<b?_.hj:xz.test(a)?0:_.hj},Az=function(a,b){az.call(this,"root-container",[],b);this.j=a},Bz=function(a,b,c){return typeof a===_.k?a:typeof b===_.k?b:c},Cz=function(a,b){var c=a.getAttribute("extent");return(c=xz.exec(c))?Number(c[b]):null},Ez=
7
+ function(a){a=a.getAttribute("cellResolution");return(a=Dz.exec(a))?Number(a[2]):null},Fz=function(a,b,c){az.call(this,a,b,c)},Gz=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=[]},Iz=function(a){return Hz.some(function(b){return b in a.attributes})},Jz=function(a,b){if(0===b.length)return[];for(var c=[],d=_.w(b),e=d.next();!e.done;e=d.next())e=e.value,a.a.has(e)&&c.push.apply(c,_.vh(Jz(a,a.a.get(e).f)).concat([e]));return c},Lz=
8
+ function(){return"inline-"+Kz++},Mz=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})},Nz=function(a){this.a=a.firstChild;this.f=new Set},Oz=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},Pz=function(a){return mz(a.h.nodeName)},Qz=function(){this.a=new Map},Sz=function(a,b){if(a.a.has(b))return a.a.get(b);var c=null,d=null,e=[],f=[],g={},h=b.parentNode;if(h&&a.a.has(h)){var l=a.a.get(h);e=
9
+ _.vh(l.l).concat();-1===[_.da,"span","br"].indexOf(b.nodeName)&&(c=l.a,d=l.j,f=_.vh(l.f).concat(),g={},Rz.forEach(function(n){n in l.attributes&&(g[n]=l.attributes[n])}))}if(b.nodeType===b.ELEMENT_NODE){b.hasAttribute(Wy)&&(c=b.getAttribute(Wy));b.hasAttribute(_.wg)&&f.push.apply(f,_.vh(b.getAttribute(_.wg).split(" ")));d=Array.from(b.attributes).map(function(n){return n.name});d=_.w(d);for(h=d.next();!h.done;h=d.next()){h=h.value;var m=mz(h);g[m]=b.getAttribute(h)}d=g.backgroundImage}c=new Oz(b,
10
+ c,d,e,f,g);a.a.set(b,c);return c},Tz=function(a){this.a=a;this.f=new DOMParser},Uz=function(a){this.f=a},Vz=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")},Wz=function(){},Xz=function(a){this.a=new Tz(a);this.g=new _.K("clpp.ttml.Mp4TtmlParser")},Yz=function(){this.j=new Wz};az.prototype.getId=function(){return this.h};
11
+ az.prototype.hasAttribute=function(a){return a in this.a};az.prototype.getAttribute=function(a){return this.a[a]};_.x(bz,az);_.x(cz,az);var ez=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,fz=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,hz=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d+)$/,iz=/^(\d*(?:\.\d*)?)f$/,jz=/^(\d*(?:\.\d*)?)t$/,kz=/^(?:(\d*(?:\.\d*)?)h)?(?:(\d*(?:\.\d*)?)m)?(?:(\d*(?:\.\d*)?)s)?(?:(\d*(?:\.\d*)?)ms)?$/,wz=/^(\d{1,2}(?:\.\d+)?|100(?:\.0+)?)% (\d{1,2}(?:\.\d+)?|100(?:\.0+)?)%$/,xz=/^(\d+)px (\d+)px$/,Dz=/^(\d+) (\d+)$/,oz=/(\d+)px/,Zz=/^(\d+px|\d+em|\d*\.?\d+c)$/,Hz=[Ty,"color",Uy,Vy,"fontFamily","fontSize","fontStyle","fontWeight",
12
+ "lineHeight","opacity","padding",Yy,Zy,"textOutline",$y,"zIndex"],Rz=["begin",_.ye];_.x(rz,cz);
13
+ rz.prototype.build=function(a,b,c,d,e,f,g){var h=lz(this.a.begin,b);b=lz(this.a.end,b);if(null===h||null===b)return null;h+=c;b+=c;c=_.tr(_.fe);for(var l=_.w(this.j),m=l.next();!m.done;m=l.next())c.appendChild(tz(g.get(m.value),e,g));g=new _.gj(h,b,c.innerHTML.trim(),_.Kg);g.cssClassList=_.vh(this.f).concat();g.textAlign=sz(this,e,null);g.writingMode=_.cj;g.line=-1;g.lineInterpretation=_.dj;g.lineAlign=_.ej;g.containerRows=Bz(null,Ez(a),15);if(this.o&&(f=f.get(this.o))){g.region=f.build(a,e);g.textAlign=
14
+ sz(this,e,f);a:switch(dz(f,e,$y)){case "tb":case "tblr":a=_.Xg;break a;case "tbrl":a=_.Yg;break a;default:a=_.cj}g.writingMode=a;a:switch(dz(f,e,Vy)){case _.yd:a=50;break a;case "after":a=-1;break a;default:a=0}g.line=a;a:switch(dz(f,e,Vy)){case _.yd:a=1;break a;default:a=_.dj}g.lineInterpretation=a;a:switch(dz(f,e,Vy)){case _.yd:e=_.yd;break a;default:e=_.ej}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};_.x(vz,cz);
16
+ vz.prototype.build=function(a,b){var c=new _.jj;c.id=this.getId();var d=Bz(a.j.containerWidth,Cz(a,1),720),e=Bz(a.j.containerHeight,Cz(a,2),480);a:switch(dz(this,b,Vy)){case "after":var f="flex-start";break a;case _.yd:f=_.yd;break a;default:f="flex-end"}c.displayAlign=f;a:switch(dz(this,b,$y)){case "tb":case "tblr":f="row-reverse";break a;case "tbrl":f="row";break a;default:f=_.Pd}c.writingMode=f;f=this.getAttribute("extent")||dz(this,b,"extent");c.width=yz(f,d,1,100);c.widthUnits=zz(f,d);c.height=
17
+ yz(f,e,2,100);c.heightUnits=zz(f,e);f=this.getAttribute("origin")||dz(this,b,"origin");c.viewportAnchorX=yz(f,d,1,0);c.viewportAnchorY=yz(f,e,2,0);c.viewportAnchorUnits=zz(f,d);c.cssClassList=_.vh(this.f).concat();return c};_.x(Az,az);_.x(Fz,az);
18
+ Fz.prototype.build=function(a){var b=null;var c=Ez(a);c&&(b=Bz(a.j.containerHeight,Cz(a,2),480)/c);b=Bz(a.j.fontSizeRadix,b,16);a=[];c="::ttml ."+this.h+", ::ttml ."+this.h+" * {";for(var d=_.w($z.entries()),e=d.next();!e.done;e=d.next()){var f=_.w(e.value);e=f.next().value;f=f.next().value;e in this.a&&(c+=f+":"+nz(this.a[e])+";")}a:{if("unicodeBidi"in this.a){d=this.a.unicodeBidi;e="";switch(d){case "normal":case "embed":e=d;break;case "bidiOverride":e="bidi-override"}if(0<e.length){d="unicode-bidi:"+
19
+ e+";";break a}}d=""}c+=d;a:{if("textOutline"in this.a){d=this.a.textOutline.split(" ");e="black";f=".4em";var g=d[0]&&d[0].trim(),h=d[1]&&d[1].trim(),l=d[2]&&d[2].trim();3===d.length&&!Zz.test(g)&&Zz.test(h)&&Zz.test(l)?(e=g,f=h):2===d.length&&!Zz.test(g)&&Zz.test(h)?(e=g,f=h):2===d.length&&Zz.test(g)&&Zz.test(h)&&(f=g);if(""!==f){f=nz(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=qz(this.a.textShadow),d=nz(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",Xy).replace("proportionalSerif",Xy).replace("sansSerif",Xy).replace("default",Xy)+";":"");a:{if(Zy in this.a){d=[];e=_.w(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:"+nz(this.a.padding)+";":"";c=c+d+e;"lineHeight"in this.a?(d="",e=this.a.lineHeight,e=nz(e),e=pz(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=nz(d);d=pz(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 $z=new Map([[Ty,"background-color"],["color","color"],[Uy,Uy],["fontStyle","font-style"],["fontWeight","font-weight"],["opacity","opacity"],["zIndex","z-index"]]);var Kz=0;Nz.prototype.le=function(){return!!this.a};Nz.prototype.next=function(){if(!this.a)return null;var a=this.a;do this.f.add(a),a.nodeType!==Node.TEXT_NODE&&!aA.has(mz(a.nodeName))||bA.has(mz(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&&!aA.has(mz(a.nodeName))));var b=this.a;this.a=a;return b};
23
+ var aA=new Set(["tt","head","layout",_.$e,_.Ie,Wy,"styling",_.wg,"body",_.fe,"p","span","br"]),bA=new Set([_.wg,_.Ie]);Oz.prototype.getId=function(){return this.attributes.id};Tz.prototype.parseInit=function(){};
24
+ Tz.prototype.parseMedia=function(a,b,c){c&&c.length||(c=[a.byteLength]);var d=_.N.nb(this.a.ttml||{}),e=_.bk(a,0,c[0]);e=_.T.ea(e);if(""===e)return{cues:[],styles:[]};var f=null;try{f=this.f.parseFromString(e,_.Bg)}catch(n){throw new _.O(_.P,2,2005,"Failed to parse TTML.");}d=new Gz(d);e=new Qz;f=new Nz(f);b=b.periodStart;typeof b===_.k&&(d.A=b);b=c[0];for(var g=1;g<c.length;++g){var h=c[g],l=_.bk(a,b,h);l=_.Zm(l);var m="urn:mpeg:14496-30:subs:"+g;d.h.set(m,new bz(m,l,{imageType:"PNG",encoding:"Base64"}));
25
+ b+=h}for(;f.le();)a=f.next(),a=Sz(e,a),"tt"===Pz(a)&&(d.l=new Az(d.B,Object.assign({},a.attributes))),"tt"===Pz(a)&&(d.w=new uz(a.attributes.frameRate,a.attributes.subFrameRate,a.attributes.frameRateMultiplier,a.attributes.tickRate)),Pz(a)!==_.Ie||a.attributes.begin||a.attributes.end||(c="#"+a.getId(),d.h.set(c,new bz(c,a.h.textContent,a.attributes))),Pz(a)===_.Ie&&a.attributes.begin&&a.attributes.end?(c="#"+Lz(),b=new bz(c,a.h.textContent,a.attributes),d.h.set(c,b),c=b):c=null,c&&(a.j=c.getId()),
26
+ Pz(a)===_.wg&&(c=a.getId()||Lz(),b=new Fz(c,a.f,Object.assign({},a.attributes)),d.a.set(c,b),a.a&&d.j.get(a.a).f.push(c)),Pz(a)!==_.wg&&Iz(a)?(c=Lz(),b=new Fz(c,[],Object.assign({},a.attributes)),d.a.set(c,b),c=b):c=null,c&&a.f.push(c.getId()),Pz(a)!==_.fe||!a.attributes.extent&&!a.attributes.origin?c=null:(c=Lz(),b=new vz(c,Jz(d,a.f),Object.assign({},a.attributes)),d.j.set(c,b),c=b),c&&(a.a=c.getId()),Pz(a)!==Wy?c=null:(c=a.getId(),b=new vz(c,Jz(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(Pz(a))||0===c.length?c=null:(g=c[c.length-1],d.f.has(g)?(c=Lz(),b=new rz(c,a.h.nodeName===_.da?a.h.textContent:null,"br"===Pz(a),a.a,a.j,Jz(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"===Pz(a)||a.j?(c=Lz(),b=new rz(c,null,!1,a.a,a.j,Jz(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=Mz(d);f=[];a=_.w(d.a.values());for(c=a.next();!c.done;c=a.next())f.push.apply(f,
28
+ _.vh(c.value.build(d.l)));return{cues:e,styles:f}};Uz.prototype.a=function(a){a=(new Tz(this.f)).parseMedia(a,{periodStart:0,segmentStart:null,segmentEnd:0}).cues;var b="WEBVTT\n\n";a=_.w(a);for(var c=a.next();!c.done;c=a.next()){c=c.value;var d=Vz(c.startTime)+" --\x3e "+Vz(c.endTime),e=[];switch(c.textAlign){case _.Le:e.push("align:left");break;case _.dg:e.push("align:right");break;case _.bj:e.push("align:middle");break;case _.Le:e.push("align:start");break;case _.dg:e.push("align:end")}switch(c.writingMode){case _.Xg:e.push("vertical:lr");break;
29
+ case _.Yg:e.push("vertical:rl")}b+=d+(e.length?" "+e.join(" "):"")+"\n";b+=c.payload+"\n\n"}return _.T.ib(b)};Wz.prototype.probe=function(a,b){return a===_.ad&&b===_.Ag};Wz.prototype.create=function(a){return new Uz(a)};Xz.prototype.parseInit=function(a){var b=!1;(new _.Dn).N(_.cf,_.En).N(_.Jg,_.En).N(_.Ye,_.En).N(_.bf,_.En).N(_.tg,_.En).aa(_.vg,_.Fn).N("stpp",function(c){b=!0;c.parser.stop()}).parse(a);if(!b)throw new _.O(_.P,2,2007);};
30
+ Xz.prototype.parseMedia=function(a,b){var c=this,d=!1,e=[],f=[],g=[];(new _.Dn).N("moof",_.En).N("traf",_.En).aa("subs",function(h){for(var l=_.yn(h.reader),m=0;m<l;++m){h.reader.skip(4);for(var n=_.xn(h.reader),p=0;p<n;++p){var q=1===h.version?_.yn(h.reader):_.xn(h.reader);g.push(q);h.reader.skip(6)}}}).N(_.Xe,_.Gn(function(h){d=!0;h=c.a.parseMedia(h,b,g);e=e.concat(h.cues);f=f.concat(h.styles)})).parse(a);d||this.g.warn("Couldn't find the mdat box");return{cues:e,styles:f}};_.x(Yz,_.Gu);Yz.prototype.f=function(){_.Fv(_.ad,Tz);_.Fv(_.Zc,Xz);_.Fv(Qy,Xz);_.Fv(Sy,Xz);_.Fv(Ry,Xz);_.rl.push(this.j)};Yz.prototype.a=function(){_.Hv(_.ad);_.Hv(_.Zc);_.Hv(Qy);_.Hv(Sy);_.Hv(Ry);_.tl(this.j)};Yz.prototype.id=function(){return"subtitles-ttml"};_.J("clpp.ttml.TtmlComponent",Yz);};
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 iy="VerimatrixVCAS",jy="clpp.verimatrix.Vcas",ky="clpp.verimatrix.VcasComponent",qy=function(a){_.dn.call(this,iy);var b={};b[ly]=ly;b[my]=my;var c=a.authenticator,d=void 0===a.licenseRequestVuidLocation?ny:a.licenseRequestVuidLocation;b=void 0===a.httpHeaderNames?b:a.httpHeaderNames;var e=a.widevineLicenseUrl,f=a.playReadyLicenseUrl,g=a.fairPlayLicenseUrl,h=a.fairPlayCertificateUrl,l=a.fairPlaySiteId,m=void 0===a.fairPlayAssetIdStrategy?oy:a.fairPlayAssetIdStrategy;this.A=a.deviceId;this.a=c;
3
- this.C=d;this.B=b;this.w=py(this,e);this.o=py(this,f);this.l=py(this,g);this.j=h;this.H=l;this.G=m;this.g=new _.K(jy);_.T.empty(this.w)?this.g.warn(_.jc):this.ab(_.Qd,{licenseUrl:this.w,videoRobustness:[_.Sb,void 0],audioRobustness:[_.Rb,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:this.h.bind(this)}});_.T.empty(this.o)?this.g.warn(_.Hb):this.ab(_.Od,{licenseUrl:this.o,videoRobustness:["3000"],audioRobustness:["2000"],modifiers:{licenseRequest:this.h.bind(this)}});
4
- _.T.empty(this.l)?this.g.warn(_.bb):_.T.empty(this.j)?this.g.warn(_.ab):this.ab(_.Kd,{licenseUrl:this.l,certificateUrl:this.j,modifiers:{licenseRequest:this.K.bind(this),licenseResponse:this.L.bind(this),extractContentId:this.I.bind(this)}})},py=function(a,b){if(a.C===ny){var c=Object.assign({},{deviceId:_.Sj(_.T.xd(a.A))},a.a&&{authenticator:_.Sj(_.T.xd(a.a))});return b+_.Tk(c)}return b},ry=function(){this.g=new _.K(ky)};_.x(qy,_.dn);
5
- qy.prototype.h=function(a,b){if(this.C===sy){var c=this.B[my],d={};d[this.B[ly]]=this.A;this.a&&(d[c]=this.a);Object.keys(d).forEach(function(e){b.headers[e]=d[e]})}};qy.prototype.I=function(a,b){var c=_.Bn(b);switch(this.G){case ty:c=_.Tk({r:c,kp:this.H},!0)}return c};qy.prototype.K=function(a,b){this.h(a,b);_.En(b)};qy.prototype.L=function(a,b){_.Fn(b)};_.J(jy,qy);qy.prototype.constructor=qy.prototype.constructor;qy.NAME=iy;var ny="query-string",sy="http-header";
6
- qy.LicenseRequestVuidLocation={QUERY_STRING:ny,HTTP_HEADER:sy};var ly="DeviceId",my="Authenticator";qy.LicenseRequestHttpHeader={DEVICE_ID_HEADER:ly,AUTHENTICATOR_HEADER:my};var oy="keyid",ty="contentid-siteid";qy.FairPlayAssetIdStrategy={KEYID:oy,CONTENTID_SITEID:ty};_.x(ry,_.ku);ry.prototype.a=function(){delete _.Ym.VerimatrixVCAS};ry.prototype.h=function(a){a=a.getConfiguration();if(a.drm&&a.drm.env===iy){a=a.drm.customData;if(!a)throw new _.P(_.Q,7,7100,_.Rd);a=new qy(a);this.g.info("Registering the Verimatrix VCAS Ultra environment");_.Zm(a)}};ry.prototype.id=function(){return"verimatrix-vcas"};_.J(ky,ry);};
2
+ var f=function(window){var Ey="VerimatrixVCAS",Fy="clpp.verimatrix.Vcas",Gy="clpp.verimatrix.VcasComponent",My=function(a){_.pn.call(this,Ey);var b={};b[Hy]=Hy;b[Iy]=Iy;var c=a.authenticator,d=void 0===a.licenseRequestVuidLocation?Jy:a.licenseRequestVuidLocation;b=void 0===a.httpHeaderNames?b:a.httpHeaderNames;var e=a.widevineLicenseUrl,f=a.playReadyLicenseUrl,g=a.fairPlayLicenseUrl,h=a.fairPlayCertificateUrl,l=a.fairPlaySiteId,m=void 0===a.fairPlayAssetIdStrategy?Ky:a.fairPlayAssetIdStrategy;this.A=a.deviceId;this.a=c;
3
+ this.C=d;this.B=b;this.w=Ly(this,e);this.o=Ly(this,f);this.l=Ly(this,g);this.j=h;this.H=l;this.G=m;this.g=new _.K(Fy);_.T.empty(this.w)?this.g.warn(_.nc):this.gb(_.Xd,{licenseUrl:this.w,videoRobustness:[_.Vb,void 0],audioRobustness:[_.Ub,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:this.h.bind(this)}});_.T.empty(this.o)?this.g.warn(_.Kb):this.gb(_.Vd,{licenseUrl:this.o,videoRobustness:["3000"],audioRobustness:["2000"],modifiers:{licenseRequest:this.h.bind(this)}});
4
+ _.T.empty(this.l)?this.g.warn(_.fb):_.T.empty(this.j)?this.g.warn(_.eb):this.gb(_.Sd,{licenseUrl:this.l,certificateUrl:this.j,modifiers:{licenseRequest:this.K.bind(this),licenseResponse:this.L.bind(this),extractContentId:this.I.bind(this)}})},Ly=function(a,b){if(a.C===Jy){var c=Object.assign({},{deviceId:_.$m(_.T.Ed(a.A))},a.a&&{authenticator:_.$m(_.T.Ed(a.a))});return b+_.bl(c)}return b},Ny=function(){this.g=new _.K(Gy)};_.x(My,_.pn);
5
+ My.prototype.h=function(a,b){if(this.C===Oy){var c=this.B[Iy],d={};d[this.B[Hy]]=this.A;this.a&&(d[c]=this.a);Object.keys(d).forEach(function(e){b.headers[e]=d[e]})}};My.prototype.I=function(a,b){var c=_.Mn(b);switch(this.G){case Py:c=_.bl({r:c,Cp:this.H},!0)}return c};My.prototype.K=function(a,b){this.h(a,b);_.Pn(b)};My.prototype.L=function(a,b){_.Rn(b)};_.J(Fy,My);My.prototype.constructor=My.prototype.constructor;My.NAME=Ey;var Jy="query-string",Oy="http-header";
6
+ My.LicenseRequestVuidLocation={QUERY_STRING:Jy,HTTP_HEADER:Oy};var Hy="DeviceId",Iy="Authenticator";My.LicenseRequestHttpHeader={DEVICE_ID_HEADER:Hy,AUTHENTICATOR_HEADER:Iy};var Ky="keyid",Py="contentid-siteid";My.FairPlayAssetIdStrategy={KEYID:Ky,CONTENTID_SITEID:Py};_.x(Ny,_.Gu);Ny.prototype.a=function(){delete _.jn.VerimatrixVCAS};Ny.prototype.h=function(a){a=a.getConfiguration();if(a.drm&&a.drm.env===Ey){a=a.drm.customData;if(!a)throw new _.O(_.P,7,7100,_.Yd);a=new My(a);this.g.info("Registering the Verimatrix VCAS Ultra environment");_.kn(a)}};Ny.prototype.id=function(){return"verimatrix-vcas"};_.J(Gy,Ny);};
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 Zx="Registering listeners",$x="clpp.vimond.VimondPlugin",ay=function(a,b,c,d,e){this.G=a;this.H=b;this.I=c;this.m=d;this.C=e;this.a=new _.Yh;this.l=!0;this.f=this.j=this.A=!1;this.B=null;this.h=new _.yl(this.Wh.bind(this));this.g=new _.K("clpp.vimond.VimondDispatcher");this.o=this.w=0;this.m&&this.a&&(this.g.debug(Zx),this.a.on(this.m,_.ig,this.ml.bind(this)),this.a.on(this.m,_.tg,this.nl.bind(this)),this.a.on(this.m,_.qc,this.kl.bind(this)),this.a.on(this.m,_.sc,this.ll.bind(this)))},by=function(a,
3
- b){a.m.trigger(new _.L(_.Og,{detail:b}))},cy=function(a,b,c){b&&(a.A=!0,a.h.stop());a.m.onError(new _.P(b?_.Q:1,9,9201,c))},dy=function(a,b,c,d,e){this.l=a;this.o=c;this.h=b;this.a=d;this.j=e;this.g=new _.K("clpp.vimond.VimondService");this.f=0},ey=function(a){this.m=a;this.a=new _.Yh;this.g=new _.K("clpp.vimond.VimondAdapter");this.f=this.h=!1;this.m&&this.a&&(this.g.debug(Zx),this.a.on(this.m,_.Rf,this.o.bind(this)),this.a.on(this.m,_.qc,this.j.bind(this)),this.a.on(this.m,_.sc,this.l.bind(this)))},
4
- fy=function(a,b){var c=a.m.getState();if(1===b)return["str-start",_.zf];if(a.h)return[_.qe,_.kf];if(c===_.Bq)return[_.qe,null];if(c===_.Fq)return[_.se,_.kf];var d=_.kf;if(c===_.zq||c===_.Iq||a.f)d=_.zf;return["period",d]},gy=function(){this.a=!1;this.g=new _.K($x);this.j=this.h=this.f=null},hy=function(){};_.t=ay.prototype;_.t.nl=function(){this.f||(this.f=1<Math.abs(this.w-this.m.getPosition()));this.w=this.m.getPosition()};_.t.kl=function(){this.g.debug("Ad break started");this.j=!0};
5
- _.t.ll=function(){this.g.debug("Ad break stopped");this.j=!1};
6
- _.t.ml=function(a){var b=this,c,d,e,f,g;return _.I(function(h){if(1==h.a){c=a.detail;d=_.Dq;e=c.currentState;f=c.previousState;b.g.debug("State changed, prev: "+f+" curr: "+e);if(b.A||b.j)return h["return"]();if(e===b.B&&!b.f)return b.g.debug("Ignore transition"),h["return"]();if(b.l&&e!==d.PLAYING)return h["return"]();if(b.f&&[d.PAUSED,d.BUFFERING].includes(e))return b.g.debug("Seeking"),h["return"]();b.f&&e===d.PLAYING&&(b.g.debug("Seeked"),b.f=!1);g=[d.PLAYING,d.PAUSED,d.ERROR,d.ENDED];if(!g.includes(e))return h.F(0);
7
- b.B=e;return _.y(h,b.Wh(),3)}e===d.ENDED&&b.h.stop();_.B(h)})};
8
- _.t.Wh=function(){var a=this,b,c,d,e,f,g;return _.I(function(h){if(1==h.a){var l=Math.floor(Date.now()/1E3);0<a.o&&a.g.debug("Last event was "+(l-a.o)+" seconds ago");a.o=l;a.h.stop();a.h.ea(a.l?10:a.G);a.l=!1;_.C(h,2);return _.y(h,a.C.fireEvent(),4)}if(2!=h.a)return b=h.f,by(a,b),_.uh(h,0);d=c=_.E(h);e=d.code;f=d.data;g=[1002,1003];g.includes(e)?(a.g.debug("Unreachable service"),by(a,f),cy(a,a.H,f)):1001===e?(a.g.debug("Generic service error"),by(a,f),cy(a,a.I,f)):a.g.error(c.toString());_.B(h)})};dy.prototype.fireEvent=function(){this.f++;var a=_.N.ta(this.o);a.client.buildName=_.va;a.client.buildVersion=_.ia;var b=a.client,c=this.a.m.getDrmInfo();b.drm=c?c.keySystem:"";a.client.pageUrl=document.location.href;a.client.streamUrl=this.a.m.getLoadedSource().url;a.client.userAgent=navigator.userAgent;a.client.videoFormat=this.a.m.getLoadedSource().type||"";b=a.client;c=this.a.m.getLoadedSource();c=((new _.Rk(c.url)).scheme||"").replace(":","");b.videoProtocol=c;b=fy(this.a,this.f);a.client.playerEvent=
9
- b[0]||"";a.client.playerState=b[1]||"";a.progress.vod&&(a.progress.vod.position=this.a.getPosition());if(b=a.progress.live){c=this.a;var d=c.m.getPresentationStartTime()||0;c=Math.floor(d+c.m.getPosition());c=(new Date(1E3*c)).toISOString();b.position=c;d=this.a;c=d.m.getPosition();d=d.m.getSeekRange().end;b.onLiveEdge=30>Math.abs(d-c);typeof b.liveResumePossible!==_.hd&&(b.liveResumePossible=!0)}a.progress.eventNumber=this.f;a.timestamp=(new Date).toISOString();this.g.debug("Fire an event");b=_.gk(this.l);
10
- b.method=_.Gb;b.contentType="application/json";b.headers.Authorization="Bearer "+this.h;b.body=_.T.xd(JSON.stringify(a));return this.j.fetch(b).T};dy.prototype.Zg=function(a){this.h=a};ey.prototype.getPosition=function(){return Math.floor(this.m.getPosition())};ey.prototype.o=function(){this.h=!0};ey.prototype.j=function(){this.f=!0};ey.prototype.l=function(){this.f=!1};_.x(gy,_.Lv);_.t=gy.prototype;_.t.onPlayerCreated=function(){};
11
- _.t.onContentWillLoad=function(a){var b=a.getConfiguration();(this.a=!_.N.R(b.vimond)&&typeof b.vimond===_.Ze)?a.namespace()===_.zd&&(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=_.w(["authToken","playerEventRequest"]),d=c.next();!d.done;d=c.next())if(d=d.value,!b[d]){this.g.warn(d+" key is missing");a.onError(new _.P(1,9,9200));return}this.g.debug(_.wa);
12
- c=b.failIfUnreachable;typeof c!==_.hd&&(c=!0);d=b.failOnError;typeof d!==_.hd&&(d=!0);this.f=new ey(a);this.h=new dy(b.playerEventRequest.uri,b.authToken,b.playerEventRequest.body,this.f,a.getNetworkEngine());this.j=new ay(b.playerEventRequest.eventInterval,c,d,a,this.h)}};_.t.onPlayerWillRelease=function(){if(this.a){if(this.f){var a=this.f;a.g.debug(_.cc);_.ai(a.a)}this.j&&(a=this.j,a.g.debug(_.cc),_.ai(a.a),a.h.stop());this.j=this.h=this.f=null}};_.t.onPlayerWillDestroy=function(){};_.t.id=function(){return"vimond"};
13
- _.t.Zg=function(a){this.a&&this.h&&this.h.Zg(a)};_.J($x,gy);gy.prototype.updateAuthToken=gy.prototype.Zg;gy.Id="vimond";hy.prototype.create=function(){return new gy};_.Ht(new hy);};
2
+ var f=function(window){var uy="Registering listeners",vy="clpp.vimond.VimondPlugin",wy=function(a,b,c,d,e){this.G=a;this.H=b;this.I=c;this.m=d;this.C=e;this.a=new _.wi;this.l=!0;this.f=this.j=this.A=!1;this.B=null;this.h=new _.mi(this.$h.bind(this));this.g=new _.K("clpp.vimond.VimondDispatcher");this.o=this.w=0;this.m&&this.a&&(this.g.debug(uy),this.a.on(this.m,_.rg,this.vl.bind(this)),this.a.on(this.m,_.Hg,this.wl.bind(this)),this.a.on(this.m,_.xc,this.tl.bind(this)),this.a.on(this.m,_.yc,this.ul.bind(this)))},xy=function(a,
3
+ b){a.m.trigger(new _.L(_.ch,{detail:b}))},yy=function(a,b,c){b&&(a.A=!0,a.h.stop());a.m.onError(new _.O(b?_.P:1,9,9201,c))},zy=function(a,b,c,d,e){this.l=a;this.o=c;this.h=b;this.a=d;this.j=e;this.g=new _.K("clpp.vimond.VimondService");this.f=0},Ay=function(a){this.m=a;this.a=new _.wi;this.g=new _.K("clpp.vimond.VimondAdapter");this.f=this.h=!1;this.m&&this.a&&(this.g.debug(uy),this.a.on(this.m,_.$f,this.o.bind(this)),this.a.on(this.m,_.xc,this.j.bind(this)),this.a.on(this.m,_.yc,this.l.bind(this)))},
4
+ By=function(a,b){var c=a.m.getState();if(1===b)return["str-start",_.Lf];if(a.h)return[_.ye,_.sf];if(c===_.Oq)return[_.ye,null];if(c===_.Sq)return[_.Ae,_.sf];var d=_.sf;if(c===_.Mq||c===_.Vq||a.f)d=_.Lf;return["period",d]},Cy=function(){this.a=!1;this.g=new _.K(vy);this.j=this.h=this.f=null},Dy=function(){};_.u=wy.prototype;_.u.wl=function(){this.f||(this.f=1<Math.abs(this.w-this.m.getPosition()));this.w=this.m.getPosition()};_.u.tl=function(){this.g.debug("Ad break started");this.j=!0};
5
+ _.u.ul=function(){this.g.debug("Ad break stopped");this.j=!1};
6
+ _.u.vl=function(a){var b=this,c,d,e,f,g;return _.I(function(h){if(1==h.a){c=a.detail;d=_.Qq;e=c.currentState;f=c.previousState;b.g.debug("State changed, prev: "+f+" curr: "+e);if(b.A||b.j)return h["return"]();if(e===b.B&&!b.f)return b.g.debug("Ignore transition"),h["return"]();if(b.l&&e!==d.PLAYING)return h["return"]();if(b.f&&[d.PAUSED,d.BUFFERING].includes(e))return b.g.debug("Seeking"),h["return"]();b.f&&e===d.PLAYING&&(b.g.debug("Seeked"),b.f=!1);g=[d.PLAYING,d.PAUSED,d.ERROR,d.ENDED];if(!g.includes(e))return h.F(0);
7
+ b.B=e;return _.y(h,b.$h(),3)}e===d.ENDED&&b.h.stop();_.C(h)})};
8
+ _.u.$h=function(){var a=this,b,c,d,e,f,g;return _.I(function(h){if(1==h.a){var l=Math.floor(Date.now()/1E3);0<a.o&&a.g.debug("Last event was "+(l-a.o)+" seconds ago");a.o=l;a.h.stop();a.h.fa(a.l?10:a.G);a.l=!1;_.D(h,2);return _.y(h,a.C.fireEvent(),4)}if(2!=h.a)return b=h.f,xy(a,b),_.Jh(h,0);d=c=_.H(h);e=d.code;f=d.data;g=[1002,1003];g.includes(e)?(a.g.debug("Unreachable service"),xy(a,f),yy(a,a.H,f)):1001===e?(a.g.debug("Generic service error"),xy(a,f),yy(a,a.I,f)):a.g.error(c.toString());_.C(h)})};zy.prototype.fireEvent=function(){this.f++;var a=_.N.ua(this.o);a.client.buildName=_.xa;a.client.buildVersion=_.ia;var b=a.client,c=this.a.m.getDrmInfo();b.drm=c?c.keySystem:"";a.client.pageUrl=document.location.href;a.client.streamUrl=this.a.m.getLoadedSource().url;a.client.userAgent=navigator.userAgent;a.client.videoFormat=this.a.m.getLoadedSource().type||"";b=a.client;c=this.a.m.getLoadedSource();c=((new _.$k(c.url)).scheme||"").replace(":","");b.videoProtocol=c;b=By(this.a,this.f);a.client.playerEvent=
9
+ b[0]||"";a.client.playerState=b[1]||"";a.progress.vod&&(a.progress.vod.position=this.a.getPosition());if(b=a.progress.live){c=this.a;var d=c.m.getPresentationStartTime()||0;c=Math.floor(d+c.m.getPosition());c=(new Date(1E3*c)).toISOString();b.position=c;d=this.a;c=d.m.getPosition();d=d.m.getSeekRange().end;b.onLiveEdge=30>Math.abs(d-c);typeof b.liveResumePossible!==_.nd&&(b.liveResumePossible=!0)}a.progress.eventNumber=this.f;a.timestamp=(new Date).toISOString();this.g.debug("Fire an event");b=_.pk(this.l);
10
+ b.method=_.Jb;b.contentType="application/json";b.headers.Authorization="Bearer "+this.h;b.body=_.T.Ed(JSON.stringify(a));return this.j.fetch(b).T};zy.prototype.bh=function(a){this.h=a};Ay.prototype.getPosition=function(){return Math.floor(this.m.getPosition())};Ay.prototype.o=function(){this.h=!0};Ay.prototype.j=function(){this.f=!0};Ay.prototype.l=function(){this.f=!1};_.x(Cy,_.gw);_.u=Cy.prototype;_.u.onPlayerCreated=function(){};
11
+ _.u.onContentWillLoad=function(a){var b=a.getConfiguration();(this.a=!_.N.R(b.vimond)&&typeof b.vimond===_.gf)?a.namespace()===_.Hd&&(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=_.w(["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(_.ya);
12
+ c=b.failIfUnreachable;typeof c!==_.nd&&(c=!0);d=b.failOnError;typeof d!==_.nd&&(d=!0);this.f=new Ay(a);this.h=new zy(b.playerEventRequest.uri,b.authToken,b.playerEventRequest.body,this.f,a.getNetworkEngine());this.j=new wy(b.playerEventRequest.eventInterval,c,d,a,this.h)}};_.u.onPlayerWillRelease=function(){if(this.a){if(this.f){var a=this.f;a.g.debug(_.fc);_.zi(a.a)}this.j&&(a=this.j,a.g.debug(_.fc),_.zi(a.a),a.h.stop());this.j=this.h=this.f=null}};_.u.onPlayerWillDestroy=function(){};_.u.id=function(){return"vimond"};
13
+ _.u.bh=function(a){this.a&&this.h&&this.h.bh(a)};_.J(vy,Cy);Cy.prototype.updateAuthToken=Cy.prototype.bh;Cy.Id="vimond";Dy.prototype.create=function(){return new Cy};_.cu(new Dy);};
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));}