@castlabs/prestoplay 6.20.0 → 6.21.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 +109 -110
  6. package/cjs/cl.conviva.js +33 -33
  7. package/cjs/cl.core.js +553 -550
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +78 -77
  10. package/cjs/cl.externs.js +81 -97
  11. package/cjs/cl.freewheel.js +24 -24
  12. package/cjs/cl.hls.js +69 -69
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +29 -29
  15. package/cjs/cl.ima.js +22 -24
  16. package/cjs/cl.mse.js +305 -305
  17. package/cjs/cl.muxdata.js +15 -15
  18. package/cjs/cl.onboard.js +3 -3
  19. package/cjs/cl.persistent.js +13 -13
  20. package/cjs/cl.playlist.js +6 -6
  21. package/cjs/cl.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 +25 -25
  25. package/cjs/cl.tizen.js +70 -69
  26. package/cjs/cl.ttml.js +29 -29
  27. package/cjs/cl.verimatrix.js +5 -5
  28. package/cjs/cl.vimond.js +13 -13
  29. package/cjs/cl.vr.js +18 -18
  30. package/cjs/cl.vtt.js +14 -14
  31. package/cjs/cl.yospace.js +9 -0
  32. package/cjs/cl.youbora.js +38 -20
  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 -89
  37. package/cl.conviva.js +27 -27
  38. package/cl.core.js +471 -468
  39. package/cl.crypto.js +8 -8
  40. package/cl.dash.js +74 -72
  41. package/cl.externs.js +71 -99
  42. package/cl.freewheel.js +19 -19
  43. package/cl.hls.js +74 -74
  44. package/cl.hlssmpte.js +5 -5
  45. package/cl.htmlcue.js +26 -26
  46. package/cl.ima.js +16 -17
  47. package/cl.mse.js +276 -276
  48. package/cl.muxdata.js +13 -13
  49. package/cl.onboard.js +4 -4
  50. package/cl.persistent.js +11 -11
  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 +59 -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 -0
  63. package/cl.youbora.js +27 -15
  64. package/package.json +3 -1
  65. package/typings.d.ts +123 -24
package/cjs/cl.tizen.js CHANGED
@@ -1,75 +1,76 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var nO="An unknown error occurred while trying to get volume",oO="Cannot get loading rendition due to platform limitations",pO="PARAM_START_POSITION",qO="SecurityError",rO="The require privilege is: http://tizen.org/privilege/tv.audio",sO="|STARTBITRATE\x3d",tO=function(a,b,c){function d(e){c.call(a,e);a.removeEventListener(b,d)}a.addEventListener(b,d)},uO=function(a,b){this.h=a;this.o=null;this.a=_.Te;this.l=null;this.j=!1;this.f=new Map;this.D=b;this.g=new _.K("clpp.tizen.DrmEngine")},xO=function(a){var b,
3
- c,d;return _.I(function(e){if(1==e.a){b=a.a===_.Pd||a.a===_.Nd;if(!b)throw new _.N(_.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.Zd)throw new _.N(_.P,6,6012,"No license server given for "+a.a);_.D(e,2);return a.a===_.Pd?_.y(e,vO(a),5):_.y(e,wO(a,c),5)}if(2!=e.a)return a.o={keySystem:a.a,licenseServerUri:c.Zd,distinctiveIdentifierRequired:!1,persistentStateRequired:c.eg,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[],
4
- keyIds:[],periodId:null},_.mh(e,0);d=_.E(e);a.g.error("Error while configuring CDM for "+a.a,d);throw new _.N(_.P,6,6005,{message:JSON.stringify(d)});})},wO=function(a,b){var c,d,e,f;return _.I(function(g){c=yO;d=zO;e={};e[d.Ui]=!b.eg;e[d.Wi]=b.Zd;""!==b.customData&&(e[d.Ti]=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)})},vO=function(a){var b;return _.I(function(c){b=yO;try{webapis.avplay.setDrm(b.oe,
5
- "Initialize",""),webapis.avplay.setDrm(b.oe,"widevine_app_session",a.l.id),webapis.avplay.setDrm(b.oe,"widevine_data_type",a.l.type)}catch(d){throw d;}_.B(c)})},AO=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,t,v,z,C,F,G;_.I(function(A){if(1==A.a){c=yO;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.Zd;l=_.Wj([h],_.Sj());l.type=3;l.body=f.buffer;l.method=
6
- _.Ib;_.D(A,2);return _.y(A,a.D.Jb.fetch(l).U,4)}if(2!=A.a){m=A.f;if(a.j){n=_.xj(m.data);p=n.byteLength;q="";for(t=0;t<p;t++)q+=String.fromCharCode(n[t]);v=btoa(q);z=b.session_id+pO+(v+pO);a.g.debug("Widevine license params",z);try{webapis.avplay.setDrm(c.oe,"widevine_license_data",z)}catch(H){a.g.error("License response rejected by CDM"),C=new _.N(_.P,6,6008,{browserError:JSON.stringify(H)}),a.D.onError(C)}}return _.mh(A,0)}F=_.E(A);a.g.error("License request failed.",JSON.stringify(F));G=new _.N(_.P,
7
- 6,6007,{message:_.ab,url:F.data.url,status:F.data.status||NaN,response:F.data.response||"",headers:F.data.headers||{}},F);a.D.onError(G);_.B(A)})},BO=function(a){this.m=a;this.a=this.m.a;this.f=_.yp;this.j=_.zp;this.w=(new Date).getTime();this.l=!1;this.o=-1;this.h=2;this.g=new _.K("clpp.tizen.StateManager")},DO=function(a,b){if(a.f!==b)if(a.f===_.Jp&&b!==_.yp)a.g.debug(_.ZB+CO(b));else{var c=(new Date).getTime();a.j=a.f;a.f=b;a.f===_.Dp?(a.o=(new Date).getTime(),a.m.trigger(new _.L(_.kd,{detail:{bufferedTimeMS:-1,
8
- reason:a.h}}))):a.j===_.Dp&&a.m.trigger(new _.L(_.jd,{detail:{bufferedTimeMS:c-a.o,reason:a.h}}));var d={currentState:a.f,previousState:a.j,timeSinceLastStateChangeMS:c-a.w};a.w=c;a.m.trigger(new _.L(_.cg,{detail:d}));a.g.debug("State changed:",CO(a.j),"-\x3e",CO(a.f))}},CO=function(a){return Object.keys(_.Hp)[a]},GO=function(a){if(a.l){var b=a.a.getState(),c=a.f;switch(b){case EO:c=_.Mp;break;case FO:c=_.Lp;break;default:a.m.isEnded()?c=_.Fp:a.g.debug("Inconsistent AVPlay playback state:",b)}DO(a,
9
- c)}},HO=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")},IO=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},JO=function(a){var b,c;return _.I(function(d){if(1==d.a)return b=a.m.getConfiguration(),c=null,_.y(d,_.eu(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
- KO=function(a){var b=document.createElement(_.r),c=new _.mF,d=new _.jD,e=a.m.getTextDisplayer();return new _.oF(b,c,e,d,a.m.getConfiguration())},LO=function(a){var b={configuration:{},Pb:function(){return a.m.getPosition()},W:a.h,Jb:a.m.getNetworkEngine(),Uf:a.vk.bind(a),Tf:a.uk.bind(a),onError:a.S.bind(a),fi:function(){},onEvent:function(){},ki:a.wk.bind(a),Qe:function(){},ze:function(){return new _.QF},rf:function(){return!1},Fd:null};return new _.LG(a.a,b)},MO=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},NO=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 _.vk(String(c++),_.S);e.mimeType=a[d].mimeType;e.language=a[d].language;e.roles=a[d].roles;e.kind=
12
- a[d].kind||_.EC;var f=new _.Ek(String(a[d].id),e);f.bandwidth=a[d].bandwidth||null;e.renditions.push(f);b.push(e)}return b},OO=function(a){if(a.h&&!a.h.getTextDisplayer().isTextVisible())return null;if(a.f){var b=_.OG(a.f,_.Q),c=null;if(b){a=NO(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},PO=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===_.pe,a.a&&a.f)){a.setTextVisibility(!0);
13
- var c=MO(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):(_.ZG(a.f,c,!0,0),a.m.trigger(new _.L(_.dm))),a.o=c.language):a.g.error(_.YB,d.id)}},QO=function(){this.h=this.a=this.m=null;this.f={};this.g=new _.K("clpp.tizen.TrackManager");this.w=this.l=this.j=null;this.A=!1;this.o=1},RO=function(a,b){a.m.trigger(new _.L(_.Hg,{details:{width:b.width,height:b.height,bandwidth:b.bandwidth,track:b.track,abrSelection:a.a.o}}))},
14
- SO=function(a){var b=a.na();b&&a.m.trigger(new _.L(_.hd,{detail:{width:b.width,height:b.height,bandwidth:b.bandwidth,rendition:b}}))},TO=function(a){var b=a.m.getConfiguration(),c=_.ti(b.preferredAudioLanguage||[]),d=a.f[_.xk]||[];if(d.length){var e=null;c.some(function(g){e=_.aD(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.Da(c)}else a.g.debug("Preferred language(s) not available")}else a.g.debug("Could not set preferred audio language")},XO=function(a,b){if(b){var c=b.track.type.toUpperCase();UO(a.a,c,Number(b.id)).then(function(){c===VO&&(a.j=b,a.m.trigger(new _.L(_.cm)));c===WO&&(a.l=b,a.m.trigger(new _.L(_.dm)))})["catch"](function(){a.g.error("Could not select "+c+" track.")})}else a.g.debug("Must provide valid rendition")},YO=
16
- function(a,b,c){var d=_.oj(b.language||_.rg);c.language=_.wk(d);c.originalLanguage=d;c.channelsCount=b.channels?Number(b.channels):null;c.mimeType=_.dd;a=new _.Ek(String(a),c);a.track=c;a.codec=b.fourCC||null;a.bandwidth=b.bit_rate||null;return a},ZO=function(a,b,c){c.mimeType=_.Fg;a=new _.Ek(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},$O=function(a,b,c){b=_.oj(b.track_lang||_.rg);c.mimeType="text/ttml";
17
- c.language=_.wk(b);c.originalLanguage=b;c.kind=_.EC;return new _.Ek(String(a),c)},aP=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},dP=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===bP}),f=b.filter(function(n){return n.type===VO}),g=[],h=0;h<f.length;h++){var l=aP(a,f[h].extra_info);if(l){var m=
18
- _.oj(l.language||_.rg);m=_.wk(m);m=c(g,m);m||(m=new _.vk(String(a.o++),_.xk),g.push(m));m.renditions.push(YO(f[h].index,l,m))}else a.g.warn("Skipping audio stream with no extra info")}f=new _.vk(String(a.o++),_.yk);for(h=0;h<e.length;h++)(l=aP(a,e[h].extra_info))?f.renditions.push(ZO(e[h].index,l,f)):a.g.warn("Skipping video stream with no extra info");e=[];e=a.h?NO(a.h):cP(a,b);d[_.yk]=[f];d[_.xk]=g;d[_.S]=e;return d},cP=function(a,b){for(var c=b.filter(function(h){return h.type===WO}),d=[],e=0;e<
19
- c.length;e++){var f=aP(a,c[e].extra_info);if(f){var g=new _.vk(String(a.o++),_.S);g.renditions.push($O(c[e].index,f,g));d.push(g)}else a.g.warn("Skipping text stream with no extra info")}return d},eP=function(a,b){for(var c=a.f[_.yk]||[],d=[],e=0;e<c.length;e++)for(var f=0;f<c[e].renditions.length;f++)_.M.la(c[e].renditions[f],b,Object.keys(b))&&d.push(c[e].renditions[f]);return d[0]||null},fP=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},hP=function(a,b){if(b===_.S&&a.h)return OO(a.h);var c=gP(a.a)||[];if(0===c.length)return null;c=c.filter(function(e){return e.type===b.toUpperCase()})[0];var d=null;b===_.yk&&(d=aP(a,c.extra_info),d=eP(a,{width:d.Width,height:d.Height}));b===_.xk&&(c?(d=fP(a,c,_.xk),a.j=d):d=a.j);b===_.S&&(c?(d=fP(a,c,_.S),a.l=d):d=a.l);return d},iP=function(a){_.jm.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={}},jP=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)})},lP=function(a){try{webapis.avplay.setListener({onbufferingstart:a.pk.bind(a),onbufferingprogress:a.nk.bind(a),onbufferingcomplete:a.mk.bind(a),onstreamcompleted:a.sk.bind(a),oncurrentplaytime:function(b){a.trigger(new _.L(kP,
22
- {currentTime:b}))},onevent:a.rk.bind(a),onsubtitlechange:a.tk.bind(a),ondrmevent:a.qk.bind(a),onerror:a.S.bind(a)})}catch(b){a.g.error(b)}},mP=function(a){var b=!!a.m.getTrackManager().Na();try{webapis.avplay.setSilentSubtitle(!b)}catch(c){a.g.debug("Could not set AVPlay subtitle config",c)}},nP=function(a,b){try{var c=b.estimatedBandwidth||0,d=b.currentBandwidth||0;a.g.debug({estimatedBandwidth:c,lo:d});0!==c&&0!==d&&c>=1.15*d&&webapis.avplay.setStreamingProperty("ADAPTIVE_INFO",sO+d)}catch(e){a.g.debug(e)}},
23
- oP=function(a,b){try{webapis.avplay.setStreamingProperty("ADAPTIVE_INFO","|BITRATES\x3d"+b+sO+b)}catch(c){throw a.g.debug("Could not set fixed bandwidth",c),c;}},rP=function(a){return{position:a.getPosition(),state:a.m.getState(),Kg:a.getState(),playbackRate:a.getPlaybackRate(),isLive:a.isLive(),duration:a.getDuration(),isMuted:pP(a),volume:a.getVolume(),Hn:qP(a),Ik:gP(a)}},tP=function(a){var b,c;return _.I(function(d){if(1==d.a)return _.y(d,sP(),2);if(3!=d.a)return b=new Promise(function(e){(new _.ll(e)).ea(5)}),
24
- _.y(d,Promise.race([jP(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)})},zP=function(a,b,c){var d,e,f,g,h,l,m,n;return _.I(function(p){switch(p.a){case 1:a.l=_.Qp(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(uP)),f=c.currentPosition);
25
- _.D(p,2);g=a.l[d].url;h=a.l[d].type;h!==_.Tc||g.includes(".mpd")||(l=new URL(g),l.searchParams.append("cl-ext",".mpd"),g=l.toString());webapis.avplay.open(g);e.nextBandwidth?(oP(a,e.nextBandwidth),a.o=!1):(a.o||nP(a,e),a.o=!0);lP(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)},Jb:a.m.getNetworkEngine()};a.h=new uO(b.drm,m);return _.y(p,a.h.init(),4);case 4:return a.f||a.trigger(new _.L(vP)),
26
- _.y(p,wP(a),6);case 6:a.f||a.trigger(new _.L(xP));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&&yP(a,b.muted),b.autoplay&&a.m.play()["catch"](function(q){a.g.debug("Autoplay failed",q)}));_.mh(p,0);break;case 2:throw n=_.E(p),a.g.debug("Error while attempting to load source."),n;}})},wP=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
- mP(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)}}))})},AP=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=rP(a);a.f=!0;webapis.avplay.stop();webapis.avplay.close();return a.load(a.m.getConfiguration(),d).then(function(){var e=a.a.Kg;a.f=!1;a.a=
28
- null;return e===FO?a.pause():a.play()})}catch(e){return Promise.reject(e)}},qP=function(a){return a.f&&a.a?a.a.Hn:webapis.avplay.getTotalTrackInfo()},gP=function(a){return a.f&&a.a?a.a.Ik:webapis.avplay.getCurrentStreamInfo()},UO=function(a,b,c){b=b.toUpperCase();b===WO&&BP(a,!0);var d=a.j[b];d&&(d.Ve.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,Hg:0,Ve:new _.ll(function(){return g(h,c,!0)})}),(l=a.j[h])&&3>l.Hg?(!a.w&&++l.Hg,l.Ve.ea(a.w?.5:.25)):(a.g.debug("Could not set track after multiple attempts.Giving up..."),l&&l.Ve.stop(),a.j[h]=null,f())}}g(b,c)})},BP=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)}},yP=function(a,b){try{tizen.tvaudiocontrol.setMute(b)}catch(c){switch(c.name){case qO:a.g.warn("The application does not have the privilege to set mute.",rO);break;default:a.g.warn(nO,c)}}},pP=function(a){var b=null;try{b=tizen.tvaudiocontrol.isMute()}catch(c){switch(c.name){case qO:a.g.warn("The application doesn't have the privilege to get the mute state.",rO);break;default:a.g.warn(nO,c)}}return!!b},sP=function(){return new Promise(function(a,b){if(window.webapis)a();else{var c=document.createElement("script");
31
- tO(c,_.Ee,function(d){return a(d)});tO(c,_.ne,function(d){return b(d)});c.src="$WEBAPIS/webapis/webapis.js";document.querySelector("head").appendChild(c)}})},CP=function(){_.jm.call(this);this.a=new iP(this);this.f=new BO(this);this.configuration=this.B=_.pm();this.w=null;this.g=new _.K("clpp.tizen.Player");this.j=null;this.l=new QO;this.C=new _.rk;this.o=this.h=null;this.A=!1},DP=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())},EP=function(){},FP=function(){};
33
- uO.prototype.init=function(){var a=this,b,c,d,e,f,g;return _.I(function(h){if(1==h.a){b=_.Km[a.h.env]||null;if(!b)throw a.g.debug(_.Aa,_.Ob+a.h.env+_.ba),new _.N(_.P,6,6015,_.Ba+a.h.env+"' is missing.");a.l={id:String(Math.floor(1E4*Math.random())),type:"MPEG-DASH"};c=Object.keys(a.h.customData||{}).length?btoa(JSON.stringify(a.h.customData)):"";d=_.Mm(b,a.h.customData);(e=d[_.Nd])&&a.f.set(_.Nd,{Zd:e.licenseUrl||"",customData:c,eg:!1});(f=d[_.Pd])&&a.f.set(_.Pd,{Zd:f.licenseUrl||"",customData:c,
34
- eg:!1});if(0===a.f.size)throw new _.N(_.P,6,6E3);if((g=a.h.preferredDrmSystem)&&a.f.get(g))a.a=g;else if(a.f.get(_.Nd))a.a=_.Nd;else if(a.f.get(_.Pd))a.a=_.Pd;else throw new _.N(_.P,6,6001,"Configuration for the target system is missing.");return _.y(h,xO(a),2)}a.j=!0;_.B(h)})};uO.prototype.release=function(){var a=this;return _.I(function(b){a.j=!1;a.o=null;a.a=_.Te;a.l=null;a.f=new Map;_.B(b)})};uO.prototype.getDrmInfo=function(){return this.o};
35
- var zO={Ui:"DeleteLicenseAfterUse",Wi:"LicenseServer",Wn:"GetChallenge",Xn:"HttpHeader",Zn:"UserAgent",Sn:"Cookie",Ti:"CustomData"};_.u=BO.prototype;_.u.initialize=function(){this.a.on(uP,this.gh,this);this.a.on(GP,this.fh,this);this.a.on(HP,this.eh,this);this.a.on(vP,this.mi,this);this.a.on(xP,this.li,this);this.a.on(IP,this.hh,this)};_.u.release=function(){DO(this,_.yp);this.l=!1;this.o=-1;this.h=2};_.u.destroy=function(){this.release();this.a.off(uP,this.gh);this.a.off(GP,this.fh);this.a.off(HP,this.eh);this.a.off(vP,this.mi);this.a.off(xP,this.li);this.a.off(IP,this.hh);this.m=this.a=null};
36
- _.u.gh=function(){this.g.debug("Buffering start. Player state: ",this.a.getState());this.h=this.a.B?1:2;DO(this,_.Dp)};_.u.fh=function(a){this.g.debug("Buffering progress: "+a.percent+" %. Player state: ",CO(this.f))};_.u.eh=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()===JP;if(!a&&b){DO(this,_.Lp);return}}if(a=this.f!==_.Kp)a=this.a.getState(),a=a===EO||a===FO;a&&GO(this)};
37
- _.u.mi=function(){this.g.debug("Preparing starts. AVPlay State: ",this.a.getState());this.a.getState()===KP?DO(this,_.Kp):this.g.error("AVPlay prepares while state is not IDLE")};_.u.li=function(){this.g.debug("Preparing ends: AVPlay state:",this.a.getState())};_.u.hh=function(){DO(this,_.Fp)};_.u.getState=function(){return this.f};_.u=HO.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,JO(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
- _.D(m,3);e=b;return _.y(m,b.j.start(a.url,d),5);case 5:e.a=m.f;_.mh(m,4);break;case 3:return f=_.E(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;_.mh(m,4);break;case 6:h=_.E(m),b.g.error(h),b.a=null;case 4:if(!b.a||!IO(b.a)){m.F(0);break}b.h=KO(b);_.D(m,10);return _.y(m,b.h.open(),12);case 12:b.f=LO(b);l=b.m.getConfiguration();b.f.h=l.streaming;b.o=l.preferredTextLanguage;b.A=l.preferredTextRole;b.C=l.preferForcedSubtitles;_.mh(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)}})};_.u.vk=function(a){this.g.debug(_.wC,a);this.w=!0;var b=_.PF(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}};_.u.uk=function(){this.g.debug("canSwitch_");this.w=!1;this.l&&(_.ZG(this.f,this.l,!0,0),this.l=null)};_.u.S=function(){this.g.debug("onError_")};_.u.wk=function(){this.j&&this.j.update&&this.j.update()};
41
- _.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)}_.B(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;_.B(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,_.B(b)}})};_.x(QO,_.U);_.u=QO.prototype;_.u.ci=function(a){var b=a.eventid;a=a.data;switch(b){case LP:0<Object.keys(this.f).length||(this.g.debug("Loading track manager!"),this.load());b=webapis.avplay.getCurrentStreamInfo();0<b.length&&(b=+aP(this,b[0].extra_info).Bit_rate,b=eP(this,{bandwidth:b}))&&(this.w=b,RO(this,b));break;case MP:SO(this);break;default:this.g.debug("Event type: "+b+" data: "+a)}};_.u.Zf=function(a){a.detail.currentState===_.Mp&&this.m.off(_.cg,this.Zf)};
43
- _.u.initialize=function(a){var b=this;this.m=a;this.a=this.m.a;this.m.on(_.cg,function(c){b.A||(c=c.detail,c.currentState===_.Mp&&(b.g.debug("Current state",c.currentState),b.A=!0,TO(b)))});this.a.on(NP,this.ci,this)};_.u.release=function(){this.f={};this.h=this.w=this.l=this.j=null;this.A=!1;this.o=1};
44
- _.u.load=function(){if(this.a&&!(0<Object.keys(this.f).length)){this.h=this.m.h;this.m.off(_.cg,this.Zf);this.m.on(_.cg,this.Zf,this);try{var a=qP(this.a);this.f=dP(this,a);var b=this.f[_.xk]||[];b.length&&(this.j=b[0].renditions[0]||null);SO(this)}catch(c){this.g.debug("Could not load track manager")}}};_.u.destroy=function(){this.a.off(NP,this.ci);this.a=this.m=null};_.u.getVideoTracks=function(){return this.f[_.yk]||[]};_.u.getAudioTracks=function(){return this.f[_.xk]||[]};
45
- _.u.ia=function(){return this.f[_.S]||[]};_.u.na=function(){return hP(this,_.yk)};_.u.Sa=function(){return hP(this,_.xk)};_.u.Na=function(){return hP(this,_.S)};_.u.lb=function(){return this.w};_.u.Ab=function(){this.g.info(oO);return null};_.u.Bb=function(){this.g.info(oO);return null};_.u.Oa=function(){var a=this.na();return a?a.track:null};_.u.ma=function(){var a=this.Sa();return a?a.track:null};_.u.xa=function(){var a=this.Na();return a?a.track:null};
46
- _.u.wb=function(a){var b=this;null===a?(a=this.na(),AP(this.a,a.bandwidth,null).then(function(){SO(b)})):0<a.renditions.length&&this.cb(a.renditions[0])};_.u.Da=function(a){a?XO(this,a.renditions[0]):this.g.warn("Cannot disable audio tracks on this platform.","Consider muting audio instead...")};_.u.Qa=function(a){a?(a=a.renditions[0],this.h?PO(this.h,a.track):XO(this,a)):(this.g.debug("Disabling text tracks"),this.l=null,BP(this.a,!1),this.m.trigger(new _.L(_.dm)))};
47
- _.u.cb=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,RO(this,a),AP(this.a,c.bandwidth,a.bandwidth).then(function(){SO(b)})["catch"](function(d){var e=new _.N(_.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.ub=function(a){XO(this,a)};_.u.vb=function(a){this.h?PO(this.h,a.track):XO(this,a)};
48
- _.u.addTextTrack=function(){};_.u.ra=function(){return this.a.o};QO.prototype.isAbrEnabled=QO.prototype.ra;QO.prototype.addTextTrack=QO.prototype.addTextTrack;QO.prototype.setTextRendition=QO.prototype.vb;QO.prototype.setAudioRendition=QO.prototype.ub;QO.prototype.setVideoRendition=QO.prototype.cb;QO.prototype.setTextTrack=QO.prototype.Qa;QO.prototype.setAudioTrack=QO.prototype.Da;QO.prototype.setVideoTrack=QO.prototype.wb;QO.prototype.getTextTrack=QO.prototype.xa;QO.prototype.getAudioTrack=QO.prototype.ma;
49
- QO.prototype.getVideoTrack=QO.prototype.Oa;QO.prototype.getLoadingTextRendition=QO.prototype.Bb;QO.prototype.getLoadingAudioRendition=QO.prototype.Ab;QO.prototype.getLoadingVideoRendition=QO.prototype.lb;QO.prototype.getTextRendition=QO.prototype.Na;QO.prototype.getAudioRendition=QO.prototype.Sa;QO.prototype.getVideoRendition=QO.prototype.na;QO.prototype.getTextTracks=QO.prototype.ia;QO.prototype.getAudioTracks=QO.prototype.getAudioTracks;QO.prototype.getVideoTracks=QO.prototype.getVideoTracks;_.x(iP,_.jm);_.u=iP.prototype;_.u.pk=function(){this.w=!0;this.f||this.trigger(new _.L(uP))};_.u.nk=function(a){this.w=!0;this.trigger(new _.L(GP,{percent:a}))};_.u.mk=function(){this.w=!1;this.trigger(new _.L(HP))};_.u.sk=function(){this.trigger(new _.L(IP))};_.u.rk=function(a,b){this.trigger(new _.L(NP,{eventid:a,data:b}))};_.u.tk=function(a,b,c,d,e){this.trigger(new _.L(OP,{duration:a,text:b,subtitleType:c,attriCount:d,attributes:e}))};
50
- _.u.qk=function(a,b){this.trigger(new _.L(PP,{drmType:a,drmData:b}));if(this.h){var c=this.h;if(c.j)if(c.a===_.Pd&&"Challenge"===b.name)AO(c,b);else if("DrmError"===b.name){c.g.debug("DrmError event",b);var d=new _.N(_.P,6,6005,{message:JSON.stringify(b)});c.D.onError(d)}}};_.u.S=function(a){this.trigger(new _.L(QP,{eventType:a}))};
51
- _.u.play=function(){function a(){return new Promise(function(d,e){function f(){d();clearTimeout(g)}var g=null;b.one(kP,f,b);g=setTimeout(function(){b.off(kP,f);e("Timeout")},3E4)})}var b=this,c=this.getState();if(c===KP)return(new Promise(function(d,e){webapis.avplay.prepareAsync(function(){mP(b);d(webapis.avplay.play())},function(f){b.trigger(new _.L(QP));e(f)})})).then(function(){return a()});if(c===FO||c===JP)try{return webapis.avplay.play(),a()}catch(d){return Promise.reject(d)}return c===EO?
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()===FO?Promise.resolve():Promise.reject()};
53
- _.u.setPlaybackRate=function(a){var b=this.getState();if(b===JP||b===EO||b===FO){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,tP(c),4);case 4:return _.y(e,zP(c,a,b),5);case 5:_.mh(e,0);break;case 2:throw d=_.E(e),new _.N(_.P,7,7003,null,d);}})};_.u.getState=function(){if(this.f&&this.a)return this.a.Kg;try{return webapis.avplay.getState()}catch(a){this.S(JSON.stringify(a))}};
2
+ var f=function(window){var YO="An unknown error occurred while trying to get volume",ZO="Cannot get loading rendition due to platform limitations",$O="PARAM_START_POSITION",aP="SecurityError",bP="The require privilege is: http://tizen.org/privilege/tv.audio",cP="|STARTBITRATE\x3d",dP=function(a,b,c){function d(e){c.call(a,e);a.removeEventListener(b,d)}a.addEventListener(b,d)},eP=function(a,b){this.h=a;this.o=null;this.a=_.Te;this.l=null;this.j=!1;this.f=new Map;this.D=b;this.g=new _.K("clpp.tizen.DrmEngine")},hP=function(a){var b,
3
+ c,d;return _.I(function(e){if(1==e.a){b=a.a===_.Pd||a.a===_.Nd;if(!b)throw new _.N(_.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.Zd)throw new _.N(_.P,6,6012,"No license server given for "+a.a);_.D(e,2);return a.a===_.Pd?_.y(e,fP(a),5):_.y(e,gP(a,c),5)}if(2!=e.a)return a.o={keySystem:a.a,licenseServerUri:c.Zd,distinctiveIdentifierRequired:!1,persistentStateRequired:c.fg,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[],
4
+ keyIds:[],periodId:null},_.oh(e,0);d=_.E(e);a.g.error("Error while configuring CDM for "+a.a,d);throw new _.N(_.P,6,6005,{message:JSON.stringify(d)});})},gP=function(a,b){var c,d,e,f;return _.I(function(g){c=iP;d=jP;e={};e[d.Xi]=!b.fg;e[d.Zi]=b.Zd;""!==b.customData&&(e[d.Wi]=b.customData);f=JSON.stringify(e);a.g.debug("PlayReady properties: ",f);try{webapis.avplay.setDrm(c.PLAYREADY,"SetProperties",f)}catch(h){throw h;}_.A(g)})},fP=function(a){var b;return _.I(function(c){b=iP;try{webapis.avplay.setDrm(b.oe,
5
+ "Initialize",""),webapis.avplay.setDrm(b.oe,"widevine_app_session",a.l.id),webapis.avplay.setDrm(b.oe,"widevine_data_type",a.l.type)}catch(d){throw d;}_.A(c)})},kP=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,t,v,z,C,F,G;_.I(function(B){if(1==B.a){c=iP;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.Zd;l=_.Yj([h],_.Uj());l.type=3;l.body=f.buffer;l.method=
6
+ _.Ib;_.D(B,2);return _.y(B,a.D.Jb.fetch(l).U,4)}if(2!=B.a){m=B.f;if(a.j){n=_.zj(m.data);p=n.byteLength;q="";for(t=0;t<p;t++)q+=String.fromCharCode(n[t]);v=btoa(q);z=b.session_id+$O+(v+$O);a.g.debug("Widevine license params",z);try{webapis.avplay.setDrm(c.oe,"widevine_license_data",z)}catch(H){a.g.error("License response rejected by CDM"),C=new _.N(_.P,6,6008,{browserError:JSON.stringify(H)}),a.D.onError(C)}}return _.oh(B,0)}F=_.E(B);a.g.error("License request failed.",JSON.stringify(F));G=new _.N(_.P,
7
+ 6,6007,{message:_.ab,url:F.data.url,status:F.data.status||NaN,response:F.data.response||"",headers:F.data.headers||{}},F);a.D.onError(G);_.A(B)})},lP=function(a){this.m=a;this.a=this.m.a;this.f=_.Gp;this.j=_.Hp;this.w=(new Date).getTime();this.l=!1;this.o=-1;this.h=2;this.g=new _.K("clpp.tizen.StateManager")},nP=function(a,b){if(a.f!==b)if(a.f===_.Rp&&b!==_.Gp)a.g.debug(_.GC+mP(b));else{var c=(new Date).getTime();a.j=a.f;a.f=b;a.f===_.Lp?(a.o=(new Date).getTime(),a.m.trigger(new _.L(_.kd,{detail:{bufferedTimeMS:-1,
8
+ reason:a.h}}))):a.j===_.Lp&&a.m.trigger(new _.L(_.jd,{detail:{bufferedTimeMS:c-a.o,reason:a.h}}));var d={currentState:a.f,previousState:a.j,timeSinceLastStateChangeMS:c-a.w};a.w=c;a.m.trigger(new _.L(_.cg,{detail:d}));a.g.debug("State changed:",mP(a.j),"-\x3e",mP(a.f))}},mP=function(a){return Object.keys(_.Pp)[a]},qP=function(a){if(a.l){var b=a.a.getState(),c=a.f;switch(b){case oP:c=_.Up;break;case pP:c=_.Tp;break;default:a.m.isEnded()?c=_.Np:a.g.debug("Inconsistent AVPlay playback state:",b)}nP(a,
9
+ c)}},rP=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")},sP=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},tP=function(a){var b,c;return _.I(function(d){if(1==d.a)return b=a.m.getConfiguration(),c=null,_.y(d,_.pu(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
+ uP=function(a){var b=document.createElement(_.r),c=new _.VF,d=new _.SD,e=a.m.getTextDisplayer();return new _.XF(b,c,e,d,a.m.getConfiguration())},vP=function(a){var b={configuration:{},Qb:function(){return a.m.getPosition()},W:a.h,Jb:a.m.getNetworkEngine(),Vf:a.yk.bind(a),Uf:a.xk.bind(a),onError:a.S.bind(a),ji:function(){},onEvent:function(){},oi:a.zk.bind(a),Qe:function(){},ze:function(){return new _.yG},rf:function(){return!1},Fd:null};return new _.tH(a.a,b)},wP=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},xP=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 _.zk(String(c++),_.S);e.mimeType=a[d].mimeType;e.language=a[d].language;e.roles=a[d].roles;e.kind=
12
+ a[d].kind||_.mD;var f=new _.Ik(String(a[d].id),e);f.bandwidth=a[d].bandwidth||null;e.renditions.push(f);b.push(e)}return b},yP=function(a){if(a.h&&!a.h.getTextDisplayer().isTextVisible())return null;if(a.f){var b=_.wH(a.f,_.Q),c=null;if(b){a=xP(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},zP=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===_.pe,a.a&&a.f)){a.setTextVisibility(!0);
13
+ var c=wP(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):(_.HH(a.f,c,!0,0),a.m.trigger(new _.L(_.hm))),a.o=c.language):a.g.error(_.FC,d.id)}},AP=function(){this.h=this.a=this.m=null;this.f={};this.g=new _.K("clpp.tizen.TrackManager");this.w=this.l=this.j=null;this.A=!1;this.o=1},BP=function(a,b){a.m.trigger(new _.L(_.Hg,{details:{width:b.width,height:b.height,bandwidth:b.bandwidth,track:b.track,abrSelection:a.a.o}}))},
14
+ CP=function(a){var b=a.ja();b&&a.m.trigger(new _.L(_.hd,{detail:{width:b.width,height:b.height,bandwidth:b.bandwidth,rendition:b}}))},DP=function(a){var b=a.m.getConfiguration(),c=_.vi(b.preferredAudioLanguage||[]),d=a.f[_.Bk]||[];if(d.length){var e=null;c.some(function(g){e=_.JD(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.Ea(c)}else a.g.debug("Preferred language(s) not available")}else a.g.debug("Could not set preferred audio language")},HP=function(a,b){if(b){var c=b.track.type.toUpperCase();EP(a.a,c,Number(b.id)).then(function(){c===FP&&(a.j=b,a.m.trigger(new _.L(_.gm)));c===GP&&(a.l=b,a.m.trigger(new _.L(_.hm)))})["catch"](function(){a.g.error("Could not select "+c+" track.")})}else a.g.debug("Must provide valid rendition")},IP=
16
+ function(a,b,c){var d=_.qj(b.language||_.rg);c.language=_.Ak(d);c.originalLanguage=d;c.channelsCount=b.channels?Number(b.channels):null;c.mimeType=_.dd;a=new _.Ik(String(a),c);a.track=c;a.codec=b.fourCC||null;a.bandwidth=b.bit_rate||null;return a},JP=function(a,b,c){c.mimeType=_.Eg;a=new _.Ik(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},KP=function(a,b,c){b=_.qj(b.track_lang||_.rg);c.mimeType="text/ttml";
17
+ c.language=_.Ak(b);c.originalLanguage=b;c.kind=_.mD;return new _.Ik(String(a),c)},LP=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},OP=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===MP}),f=b.filter(function(n){return n.type===FP}),g=[],h=0;h<f.length;h++){var l=LP(a,f[h].extra_info);if(l){var m=
18
+ _.qj(l.language||_.rg);m=_.Ak(m);m=c(g,m);m||(m=new _.zk(String(a.o++),_.Bk),g.push(m));m.renditions.push(IP(f[h].index,l,m))}else a.g.warn("Skipping audio stream with no extra info")}f=new _.zk(String(a.o++),_.Ck);for(h=0;h<e.length;h++)(l=LP(a,e[h].extra_info))?f.renditions.push(JP(e[h].index,l,f)):a.g.warn("Skipping video stream with no extra info");e=[];e=a.h?xP(a.h):NP(a,b);d[_.Ck]=[f];d[_.Bk]=g;d[_.S]=e;return d},NP=function(a,b){for(var c=b.filter(function(h){return h.type===GP}),d=[],e=0;e<
19
+ c.length;e++){var f=LP(a,c[e].extra_info);if(f){var g=new _.zk(String(a.o++),_.S);g.renditions.push(KP(c[e].index,f,g));d.push(g)}else a.g.warn("Skipping text stream with no extra info")}return d},PP=function(a,b){for(var c=a.f[_.Ck]||[],d=[],e=0;e<c.length;e++)for(var f=0;f<c[e].renditions.length;f++)_.M.ma(c[e].renditions[f],b,Object.keys(b))&&d.push(c[e].renditions[f]);return d[0]||null},QP=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},SP=function(a,b){if(b===_.S&&a.h)return yP(a.h);var c=RP(a.a)||[];if(0===c.length)return null;c=c.filter(function(e){return e.type===b.toUpperCase()})[0];var d=null;b===_.Ck&&(d=LP(a,c.extra_info),d=PP(a,{width:d.Width,height:d.Height}));b===_.Bk&&(c?(d=QP(a,c,_.Bk),a.j=d):d=a.j);b===_.S&&(c?(d=QP(a,c,_.S),a.l=d):d=a.l);return d},TP=function(a){_.nm.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={}},UP=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;});_.A(b)})},WP=function(a){try{webapis.avplay.setListener({onbufferingstart:a.sk.bind(a),onbufferingprogress:a.rk.bind(a),onbufferingcomplete:a.qk.bind(a),onstreamcompleted:a.vk.bind(a),oncurrentplaytime:function(b){a.trigger(new _.L(VP,
22
+ {currentTime:b}))},onevent:a.uk.bind(a),onsubtitlechange:a.wk.bind(a),ondrmevent:a.tk.bind(a),onerror:a.S.bind(a)})}catch(b){a.g.error(b)}},XP=function(a){var b=!!a.m.getTrackManager().Ra();try{webapis.avplay.setSilentSubtitle(!b)}catch(c){a.g.debug("Could not set AVPlay subtitle config",c)}},YP=function(a,b){try{var c=b.estimatedBandwidth||0,d=b.currentBandwidth||0;a.g.debug({estimatedBandwidth:c,po:d});0!==c&&0!==d&&c>=1.15*d&&webapis.avplay.setStreamingProperty("ADAPTIVE_INFO",cP+d)}catch(e){a.g.debug(e)}},
23
+ ZP=function(a,b){try{webapis.avplay.setStreamingProperty("ADAPTIVE_INFO","|BITRATES\x3d"+b+cP+b)}catch(c){throw a.g.debug("Could not set fixed bandwidth",c),c;}},bQ=function(a){return{position:a.getPosition(),state:a.m.getState(),Og:a.getState(),playbackRate:a.getPlaybackRate(),isLive:a.isLive(),duration:a.getDuration(),isMuted:$P(a),volume:a.getVolume(),Kn:aQ(a),Lk:RP(a)}},dQ=function(a){var b,c;return _.I(function(d){if(1==d.a)return _.y(d,cQ(),2);if(3!=d.a)return b=new Promise(function(e){(new _.pl(e)).ea(5)}),
24
+ _.y(d,Promise.race([UP(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"));_.A(d)})},jQ=function(a,b,c){var d,e,f,g,h,l,m,n;return _.I(function(p){switch(p.a){case 1:a.l=_.Yp(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(eQ)),f=c.currentPosition);
25
+ _.D(p,2);g=a.l[d].url;h=a.l[d].type;h!==_.Tc||g.includes(".mpd")||(l=new URL(g),l.searchParams.append("cl-ext",".mpd"),g=l.toString());webapis.avplay.open(g);e.nextBandwidth?(ZP(a,e.nextBandwidth),a.o=!1):(a.o||YP(a,e),a.o=!0);WP(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)},Jb:a.m.getNetworkEngine()};a.h=new eP(b.drm,m);return _.y(p,a.h.init(),4);case 4:return a.f||a.trigger(new _.L(fQ)),
26
+ _.y(p,gQ(a),6);case 6:a.f||a.trigger(new _.L(hQ));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&&iQ(a,b.muted),b.autoplay&&a.m.play()["catch"](function(q){a.g.debug("Autoplay failed",q)}));_.oh(p,0);break;case 2:throw n=_.E(p),a.g.debug("Error while attempting to load source."),n;}})},gQ=function(a){return _.I(function(b){a.g.debug("avplay.prepare()");return b["return"](new Promise(function(c,d){try{webapis.avplay.prepareAsync(function(){a.g.debug("AVPlay is ready!");
27
+ XP(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)}}))})},kQ=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=bQ(a);a.f=!0;webapis.avplay.stop();webapis.avplay.close();return a.load(a.m.getConfiguration(),d).then(function(){var e=a.a.Og;a.f=!1;a.a=
28
+ null;return e===pP?a.pause():a.play()})}catch(e){return Promise.reject(e)}},aQ=function(a){return a.f&&a.a?a.a.Kn:webapis.avplay.getTotalTrackInfo()},RP=function(a){return a.f&&a.a?a.a.Lk:webapis.avplay.getCurrentStreamInfo()},EP=function(a,b,c){b=b.toUpperCase();b===GP&&lQ(a,!0);var d=a.j[b];d&&(d.Ve.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,Lg:0,Ve:new _.pl(function(){return g(h,c,!0)})}),(l=a.j[h])&&3>l.Lg?(!a.w&&++l.Lg,l.Ve.ea(a.w?.5:.25)):(a.g.debug("Could not set track after multiple attempts.Giving up..."),l&&l.Ve.stop(),a.j[h]=null,f())}}g(b,c)})},lQ=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)}},iQ=function(a,b){try{tizen.tvaudiocontrol.setMute(b)}catch(c){switch(c.name){case aP:a.g.warn("The application does not have the privilege to set mute.",bP);break;default:a.g.warn(YO,c)}}},$P=function(a){var b=null;try{b=tizen.tvaudiocontrol.isMute()}catch(c){switch(c.name){case aP:a.g.warn("The application doesn't have the privilege to get the mute state.",bP);break;default:a.g.warn(YO,c)}}return!!b},cQ=function(){return new Promise(function(a,b){if(window.webapis)a();else{var c=document.createElement("script");
31
+ dP(c,_.Ee,function(d){return a(d)});dP(c,_.ne,function(d){return b(d)});c.src="$WEBAPIS/webapis/webapis.js";document.querySelector("head").appendChild(c)}})},mQ=function(){_.nm.call(this);this.a=new TP(this);this.f=new lP(this);this.configuration=this.B=_.tm();this.w=null;this.g=new _.K("clpp.tizen.Player");this.j=null;this.l=new AP;this.C=new _.tk;this.o=this.h=null;this.A=!1},nQ=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())},oQ=function(){},pQ=function(){};
33
+ eP.prototype.init=function(){var a=this,b,c,d,e,f,g;return _.I(function(h){if(1==h.a){b=_.Om[a.h.env]||null;if(!b)throw a.g.debug(_.Aa,_.Ob+a.h.env+_.ba),new _.N(_.P,6,6015,_.Ba+a.h.env+"' is missing.");a.l={id:String(Math.floor(1E4*Math.random())),type:"MPEG-DASH"};c=Object.keys(a.h.customData||{}).length?btoa(JSON.stringify(a.h.customData)):"";d=_.Qm(b,a.h.customData);(e=d[_.Nd])&&a.f.set(_.Nd,{Zd:e.licenseUrl||"",customData:c,fg:!1});(f=d[_.Pd])&&a.f.set(_.Pd,{Zd:f.licenseUrl||"",customData:c,
34
+ fg:!1});if(0===a.f.size)throw new _.N(_.P,6,6E3);if((g=a.h.preferredDrmSystem)&&a.f.get(g))a.a=g;else if(a.f.get(_.Nd))a.a=_.Nd;else if(a.f.get(_.Pd))a.a=_.Pd;else throw new _.N(_.P,6,6001,"Configuration for the target system is missing.");return _.y(h,hP(a),2)}a.j=!0;_.A(h)})};eP.prototype.release=function(){var a=this;return _.I(function(b){a.j=!1;a.o=null;a.a=_.Te;a.l=null;a.f=new Map;_.A(b)})};eP.prototype.getDrmInfo=function(){return this.o};
35
+ var jP={Xi:"DeleteLicenseAfterUse",Zi:"LicenseServer",Zn:"GetChallenge",$n:"HttpHeader",bo:"UserAgent",Vn:"Cookie",Wi:"CustomData"};_.u=lP.prototype;_.u.initialize=function(){this.a.on(eQ,this.kh,this);this.a.on(qQ,this.jh,this);this.a.on(rQ,this.ih,this);this.a.on(fQ,this.ri,this);this.a.on(hQ,this.pi,this);this.a.on(sQ,this.lh,this)};_.u.release=function(){nP(this,_.Gp);this.l=!1;this.o=-1;this.h=2};_.u.destroy=function(){this.release();this.a.off(eQ,this.kh);this.a.off(qQ,this.jh);this.a.off(rQ,this.ih);this.a.off(fQ,this.ri);this.a.off(hQ,this.pi);this.a.off(sQ,this.lh);this.m=this.a=null};
36
+ _.u.kh=function(){this.g.debug("Buffering start. Player state: ",this.a.getState());this.h=this.a.B?1:2;nP(this,_.Lp)};_.u.jh=function(a){this.g.debug("Buffering progress: "+a.percent+" %. Player state: ",mP(this.f))};_.u.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()===tQ;if(!a&&b){nP(this,_.Tp);return}}if(a=this.f!==_.Sp)a=this.a.getState(),a=a===oP||a===pP;a&&qP(this)};
37
+ _.u.ri=function(){this.g.debug("Preparing starts. AVPlay State: ",this.a.getState());this.a.getState()===uQ?nP(this,_.Sp):this.g.error("AVPlay prepares while state is not IDLE")};_.u.pi=function(){this.g.debug("Preparing ends: AVPlay state:",this.a.getState())};_.u.lh=function(){nP(this,_.Np)};_.u.getState=function(){return this.f};_.u=rP.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,tP(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
+ _.D(m,3);e=b;return _.y(m,b.j.start(a.url,d),5);case 5:e.a=m.f;_.oh(m,4);break;case 3:return f=_.E(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;_.oh(m,4);break;case 6:h=_.E(m),b.g.error(h),b.a=null;case 4:if(!b.a||!sP(b.a)){m.F(0);break}b.h=uP(b);_.D(m,10);return _.y(m,b.h.open(),12);case 12:b.f=vP(b);l=b.m.getConfiguration();b.f.h=l.streaming;b.o=l.preferredTextLanguage;b.A=l.preferredTextRole;b.C=l.preferForcedSubtitles;_.oh(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,_.A(m)}})};_.u.yk=function(a){this.g.debug(_.eD,a);this.w=!0;var b=_.xG(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}};_.u.xk=function(){this.g.debug("canSwitch_");this.w=!1;this.l&&(_.HH(this.f,this.l,!0,0),this.l=null)};_.u.S=function(){this.g.debug("onError_")};_.u.zk=function(){this.j&&this.j.update&&this.j.update()};
41
+ _.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)}_.A(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;_.A(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,_.A(b)}})};_.x(AP,_.U);_.u=AP.prototype;_.u.gi=function(a){var b=a.eventid;a=a.data;switch(b){case vQ:0<Object.keys(this.f).length||(this.g.debug("Loading track manager!"),this.load());b=webapis.avplay.getCurrentStreamInfo();0<b.length&&(b=+LP(this,b[0].extra_info).Bit_rate,b=PP(this,{bandwidth:b}))&&(this.w=b,BP(this,b));break;case wQ:CP(this);break;default:this.g.debug("Event type: "+b+" data: "+a)}};_.u.$f=function(a){a.detail.currentState===_.Up&&this.m.off(_.cg,this.$f)};
43
+ _.u.initialize=function(a){var b=this;this.m=a;this.a=this.m.a;this.m.on(_.cg,function(c){b.A||(c=c.detail,c.currentState===_.Up&&(b.g.debug("Current state",c.currentState),b.A=!0,DP(b)))});this.a.on(xQ,this.gi,this)};_.u.release=function(){this.f={};this.h=this.w=this.l=this.j=null;this.A=!1;this.o=1};
44
+ _.u.load=function(){if(this.a&&!(0<Object.keys(this.f).length)){this.h=this.m.h;this.m.off(_.cg,this.$f);this.m.on(_.cg,this.$f,this);try{var a=aQ(this.a);this.f=OP(this,a);var b=this.f[_.Bk]||[];b.length&&(this.j=b[0].renditions[0]||null);CP(this)}catch(c){this.g.debug("Could not load track manager")}}};_.u.destroy=function(){this.a.off(xQ,this.gi);this.a=this.m=null};_.u.getVideoTracks=function(){return this.f[_.Ck]||[]};_.u.getAudioTracks=function(){return this.f[_.Bk]||[]};
45
+ _.u.ia=function(){return this.f[_.S]||[]};_.u.ja=function(){return SP(this,_.Ck)};_.u.Va=function(){return SP(this,_.Bk)};_.u.Ra=function(){return SP(this,_.S)};_.u.qb=function(){return this.w};_.u.Ab=function(){this.g.info(ZO);return null};_.u.Bb=function(){this.g.info(ZO);return null};_.u.Ga=function(){var a=this.ja();return a?a.track:null};_.u.na=function(){var a=this.Va();return a?a.track:null};_.u.xa=function(){var a=this.Ra();return a?a.track:null};
46
+ _.u.xb=function(a){var b=this;null===a?(a=this.ja(),kQ(this.a,a.bandwidth,null).then(function(){CP(b)})):0<a.renditions.length&&this.hb(a.renditions[0])};_.u.Ea=function(a){a?HP(this,a.renditions[0]):this.g.warn("Cannot disable audio tracks on this platform.","Consider muting audio instead...")};_.u.Ta=function(a){a?(a=a.renditions[0],this.h?zP(this.h,a.track):HP(this,a)):(this.g.debug("Disabling text tracks"),this.l=null,lQ(this.a,!1),this.m.trigger(new _.L(_.hm)))};
47
+ _.u.hb=function(a){var b=this,c=this.ja();this.a.o||a.width!==c.width||a.height!==c.height||a.bandwidth!==c.bandwidth?(this.w=a,BP(this,a),kQ(this.a,c.bandwidth,a.bandwidth).then(function(){CP(b)})["catch"](function(d){var e=new _.N(_.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.vb=function(a){HP(this,a)};_.u.wb=function(a){this.h?zP(this.h,a.track):HP(this,a)};
48
+ _.u.addTextTrack=function(){};_.u.ra=function(){return this.a.o};AP.prototype.isAbrEnabled=AP.prototype.ra;AP.prototype.addTextTrack=AP.prototype.addTextTrack;AP.prototype.setTextRendition=AP.prototype.wb;AP.prototype.setAudioRendition=AP.prototype.vb;AP.prototype.setVideoRendition=AP.prototype.hb;AP.prototype.setTextTrack=AP.prototype.Ta;AP.prototype.setAudioTrack=AP.prototype.Ea;AP.prototype.setVideoTrack=AP.prototype.xb;AP.prototype.getTextTrack=AP.prototype.xa;AP.prototype.getAudioTrack=AP.prototype.na;
49
+ AP.prototype.getVideoTrack=AP.prototype.Ga;AP.prototype.getLoadingTextRendition=AP.prototype.Bb;AP.prototype.getLoadingAudioRendition=AP.prototype.Ab;AP.prototype.getLoadingVideoRendition=AP.prototype.qb;AP.prototype.getTextRendition=AP.prototype.Ra;AP.prototype.getAudioRendition=AP.prototype.Va;AP.prototype.getVideoRendition=AP.prototype.ja;AP.prototype.getTextTracks=AP.prototype.ia;AP.prototype.getAudioTracks=AP.prototype.getAudioTracks;AP.prototype.getVideoTracks=AP.prototype.getVideoTracks;_.x(TP,_.nm);_.u=TP.prototype;_.u.sk=function(){this.w=!0;this.f||this.trigger(new _.L(eQ))};_.u.rk=function(a){this.w=!0;this.trigger(new _.L(qQ,{percent:a}))};_.u.qk=function(){this.w=!1;this.trigger(new _.L(rQ))};_.u.vk=function(){this.trigger(new _.L(sQ))};_.u.uk=function(a,b){this.trigger(new _.L(xQ,{eventid:a,data:b}))};_.u.wk=function(a,b,c,d,e){this.trigger(new _.L(yQ,{duration:a,text:b,subtitleType:c,attriCount:d,attributes:e}))};
50
+ _.u.tk=function(a,b){this.trigger(new _.L(zQ,{drmType:a,drmData:b}));if(this.h){var c=this.h;if(c.j)if(c.a===_.Pd&&"Challenge"===b.name)kP(c,b);else if("DrmError"===b.name){c.g.debug("DrmError event",b);var d=new _.N(_.P,6,6005,{message:JSON.stringify(b)});c.D.onError(d)}}};_.u.S=function(a){this.trigger(new _.L(AQ,{eventType:a}))};
51
+ _.u.play=function(){function a(){return new Promise(function(d,e){function f(){d();clearTimeout(g)}var g=null;b.one(VP,f,b);g=setTimeout(function(){b.off(VP,f);e("Timeout")},3E4)})}var b=this,c=this.getState();if(c===uQ)return(new Promise(function(d,e){webapis.avplay.prepareAsync(function(){XP(b);d(webapis.avplay.play())},function(f){b.trigger(new _.L(AQ));e(f)})})).then(function(){return a()});if(c===pP||c===tQ)try{return webapis.avplay.play(),a()}catch(d){return Promise.reject(d)}return c===oP?
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()===pP?Promise.resolve():Promise.reject()};
53
+ _.u.setPlaybackRate=function(a){var b=this.getState();if(b===tQ||b===oP||b===pP){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,dQ(c),4);case 4:return _.y(e,jQ(c,a,b),5);case 5:_.oh(e,0);break;case 2:throw d=_.E(e),new _.N(_.P,7,7003,null,d);}})};_.u.getState=function(){if(this.f&&this.a)return this.a.Og;try{return webapis.avplay.getState()}catch(a){this.S(JSON.stringify(a))}};
55
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(_.xg));webapis.avplay.seekTo(c,function(){b.B=!1;b.m.trigger(new _.L(_.wg));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.S(JSON.stringify(a))}};_.u.getDuration=function(){if(this.f&&this.a)return this.a.duration;try{return webapis.avplay.getDuration()/1E3}catch(a){this.S(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.Ve.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 qO:this.g.debug("The application does not have the privilege to get the volume.",rO);break;default:this.g.debug(nO,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 qO:this.g.warn("The application does not have the privilege to set the volume.",rO);break;default:this.g.warn("An unknown error occurred while trying to set volume",b)}}};
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.Ve.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 aP:this.g.debug("The application does not have the privilege to get the volume.",bP);break;default:this.g.debug(YO,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 aP:this.g.warn("The application does not have the privilege to set the volume.",bP);break;default:this.g.warn("An unknown error occurred while trying to set volume",b)}}};
58
58
  _.u.isLive=function(){if(this.f&&this.a)return this.a.isLive;try{return"1"===webapis.avplay.getStreamingProperty("IS_LIVE")}catch(a){this.S(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 KP="IDLE",JP="READY",EO="PLAYING",FO="PAUSED",bP=_.jc,VO="AUDIO",WO="TEXT",MP="PLAYER_MSG_RESOLUTION_CHANGED",LP="PLAYER_MSG_BITRATE_CHANGE",yO={PLAYREADY:"PLAYREADY",Un:"EME_PLAYREADY",$n:"VERIMATRIX",oe:"WIDEVINE_CDM",Vn:"EME_WIDEVINE_CDM",bo:"WIDEVINE_CLASSIC"};_.x(CP,_.jm);_.u=CP.prototype;_.u.bh=function(){var a=this;this.g.debug("On Stream completed. Current time: ",this.getPosition());this.trigger(new _.L(_.me));this.configuration.loop?this.seek(this.configuration.startTime||0)["catch"](function(){a.g.debug("Could not loop playback")}):this.a.stop()};_.u.$g=function(a){this.trigger(new _.L(_.ng,{currentTime:a.currentTime/1E3}))};
60
- _.u.dh=function(a){var b=this.a.getPosition(),c=b+a.duration/1E3,d=a.text||"";this.g.debug("Got subtitles: ",d,"start:",b,"end:",c,a);(d=_.R.tg(d))&&this.o.append([new _.Fi(b,c,d)],[])};_.u.ah=function(a){this.g.debug("DRM event: "+a.drmType+", data: "+a.drmData)};_.u.ei=function(){this.A||(this.g.debug("Initial buffering completed..."),this.A=!0)};
61
- _.u.S=function(a){this.g.debug("Error: TYPE: "+a.eventType);DO(this.f,_.Jp);a=new _.N(_.P,7,7200,{tizenerror:a.eventType});this.a.release();this.trigger(new _.L(_.ne,{detail:a}))};
62
- _.u.init=function(a,b){this.configuration=this.B=b;this.w=a;this.a.on(IP,this.bh,this);this.a.on(kP,this.$g,this);this.a.on(OP,this.dh,this);this.a.on(PP,this.ah,this);this.a.on(QP,this.S,this);this.a.on(HP,this.ei,this);this.f.initialize();this.l.initialize(this);this.g.debug("Initializing player surface");this.w.hideMediaElement();var c=RP;RP+=1;this.j=_.lq(_.Ue,{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=[_.Sg,_.se,"position",_.ye,"top"],f={};d=null!==d.parentElement?window.getComputedStyle(d,null):d.style;if(!e||0===e.length){e||(e=[]);for(var g in d)e.push(g)}g=_.w(e);for(e=g.next();!e.done;e=g.next())e=e.value,f[e]=d[e];_.nq(c,f);DP(this)}};_.u.getSurface=function(){return this.w};_.u.getConfiguration=function(){return this.configuration};_.u.getTimeline=function(){return null};_.u.setupPlaylist=function(){return Promise.reject(_.Eb)};_.u.appendLoad=function(){return Promise.reject(_.Eb)};
64
- _.u.seekWith=function(){return Promise.reject(_.Eb)};_.u.setSeekInterceptor=function(){};_.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(IP,a.bh);a.a.off(kP,a.$g);a.a.off(OP,a.dh);a.a.off(PP,a.ah);a.a.off(QP,a.S);a.a.off(HP,a.ei);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)}})};_.u.namespace=function(){return SP};
65
- _.u.getPlaybackRate=function(){return this.a.getPlaybackRate()};_.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()===_.Fp?this.getDuration():this.a.getPosition()||0};
66
- _.u.seek=function(a){return typeof a===_.k&&0<=a?(this.isLive()||(a=Math.min(a,this.getDuration())),this.a.seek(a)):Promise.reject()};_.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()};
67
- _.u.getBufferInfo=function(){this.g.warn(_.ua);return new _.im};_.u.getTrackManager=function(){return this.l};_.u.unload=function(){var a=this;return this.a.release().then(function(){a.l.release()})};_.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,_.B(b)}})};
68
- _.u.load=function(a){var b=this,c,d,e,f,g;return _.I(function(h){switch(h.a){case 1:b.configuration=_.rm(b.B,a);c=_.mp(b.configuration,[_.ue,"native"]);b.o=c.create(b);d=_.Qp(b.configuration)[0];e=!!b.configuration.tizen&&b.configuration.tizen.sideStreamText;if(!e){h.F(2);break}b.h=new HO;b.h.initialize(b);_.D(h,3);return _.y(h,b.h.load(d),5);case 5:b.h.start();_.mh(h,2);break;case 3:f=_.E(h),b.g.error(f);case 2:return _.D(h,6),_.y(h,b.a.load(b.configuration),8);case 8:_.mh(h,7);break;case 6:throw g=
69
- _.E(h),b.onError(g),g;case 7:b.l.load(),_.B(h)}})};_.u.play=function(){var a=this;this.trigger(new _.L(_.hf));DP(this);return this.a.play().then(function(){GO(a.f)})};_.u.pause=function(){var a=this;return this.a.pause().then(function(){GO(a.f)})};_.u.getState=function(){return this.f.getState()};_.u.getPeriods=function(){return[]};_.u.onError=function(a){var b=new _.L(_.ne,{detail:a});a.severity===_.P&&(DO(this.f,_.Jp),this.a.release());this.trigger(b);b.defaultPrevented&&(b.a=!0)};
70
- _.u.getDrmInfo=function(){return this.a.getDrmInfo()};_.u.isEnded=function(){return this.f.getState()===_.Fp};_.u.isPaused=function(){return this.a.getState()===FO};_.u.isMuted=function(){return pP(this.a)};_.u.setMuted=function(a){yP(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)};
71
- _.u.getSourceIndex=function(){return this.a.getSourceIndex()};_.u.getLoadedSource=function(){return this.a.getLoadedSource()};_.u.canPlay=function(a,b){return(new EP).canPlay(a,b)};_.u.getTimelineCues=function(){return[]};_.u.getCueTimeline=function(){return null};_.u.getTextDisplayer=function(){return this.o};_.u.resetAbr=function(){};CP.prototype.getTextDisplayer=CP.prototype.getTextDisplayer;CP.prototype.setNetworkEngine=CP.prototype.setNetworkEngine;CP.prototype.getNetworkEngine=CP.prototype.getNetworkEngine;
72
- var SP="clpp.tizen",RP=0;EP.prototype.a=function(){return SP};EP.prototype.canPlay=function(a){a=a.type;var b=!!window.webapis;if((a===_.Tc||a===_.Ul||a===_.Yc)&&b){if(_.mk(2))return 2;if(_.mk(3)||_.mk(4)||_.mk(5)||_.mk(6))return _.Bh("Use of clpp.tizen.TizenComponent is not recommended for Tizen version \x3e\x3d 3."),1}return 0};EP.prototype.f=function(a){return a===_.pa};EP.prototype.create=function(){return new CP};_.x(FP,_.it);FP.prototype.f=function(){_.Lh(new EP)};FP.prototype.a=function(){var a=SP;a&&_.Jh[a]&&(delete _.Jh[a],_.Kh.info("Removed Player factory: '"+a+"'"))};FP.prototype.id=function(){return"tizen"};_.J("clpp.tizen.TizenComponent",FP);var uP="onbufferingstart",GP="onbufferingprogress",HP="onbufferingcomplete",IP="onstreamcompleted",kP="oncurrentplaytime",NP="onevent",OP="onsubtitlechange",PP="ondrmevent",QP="onerror",vP="preparingstart",xP="preparingend";};
59
+ var uQ="IDLE",tQ="READY",oP="PLAYING",pP="PAUSED",MP=_.jc,FP="AUDIO",GP="TEXT",wQ="PLAYER_MSG_RESOLUTION_CHANGED",vQ="PLAYER_MSG_BITRATE_CHANGE",iP={PLAYREADY:"PLAYREADY",Xn:"EME_PLAYREADY",co:"VERIMATRIX",oe:"WIDEVINE_CDM",Yn:"EME_WIDEVINE_CDM",fo:"WIDEVINE_CLASSIC"};_.x(mQ,_.nm);_.u=mQ.prototype;_.u.gh=function(){var a=this;this.g.debug("On Stream completed. Current time: ",this.getPosition());this.trigger(new _.L(_.me));this.configuration.loop?this.seek(this.configuration.startTime||0)["catch"](function(){a.g.debug("Could not loop playback")}):this.a.stop()};_.u.eh=function(a){this.trigger(new _.L(_.ng,{currentTime:a.currentTime/1E3}))};
60
+ _.u.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=_.R.vg(d))&&this.o.append([new _.Hi(b,c,d)],[])};_.u.fh=function(a){this.g.debug("DRM event: "+a.drmType+", data: "+a.drmData)};_.u.ii=function(){this.A||(this.g.debug("Initial buffering completed..."),this.A=!0)};
61
+ _.u.S=function(a){this.g.debug("Error: TYPE: "+a.eventType);nP(this.f,_.Rp);a=new _.N(_.P,7,7200,{tizenerror:a.eventType});this.a.release();this.trigger(new _.L(_.ne,{detail:a}))};
62
+ _.u.init=function(a,b){this.configuration=this.B=b;this.w=a;this.a.on(sQ,this.gh,this);this.a.on(VP,this.eh,this);this.a.on(yQ,this.hh,this);this.a.on(zQ,this.fh,this);this.a.on(AQ,this.S,this);this.a.on(rQ,this.ii,this);this.f.initialize();this.l.initialize(this);this.g.debug("Initializing player surface");this.w.hideMediaElement();var c=BQ;BQ+=1;this.j=_.tq(_.Ue,{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=[_.Sg,_.se,"position",_.ye,"top"],f={};d=null!==d.parentElement?window.getComputedStyle(d,null):d.style;if(!e||0===e.length){e||(e=[]);for(var g in d)e.push(g)}g=_.w(e);for(e=g.next();!e.done;e=g.next())e=e.value,f[e]=d[e];_.vq(c,f);nQ(this)}};_.u.getSurface=function(){return this.w};_.u.getConfiguration=function(){return this.configuration};_.u.getTimeline=function(){return null};_.u.setupPlaylist=function(){return Promise.reject(_.Eb)};_.u.appendLoad=function(){return Promise.reject(_.Eb)};
64
+ _.u.seekWith=function(){return Promise.reject(_.Eb)};_.u.setSeekInterceptor=function(){};_.u.setPlaybackSessionId=function(){};
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(sQ,a.gh);a.a.off(VP,a.eh);a.a.off(yQ,a.hh);a.a.off(zQ,a.fh);a.a.off(AQ,a.S);a.a.off(rQ,a.ii);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,_.A(b)}})};_.u.namespace=function(){return CQ};_.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()===_.Np?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(_.ua);return new _.mm};_.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,_.A(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=_.vm(b.B,a);c=_.up(b.configuration,[_.ue,"native"]);b.o=c.create(b);d=_.Yp(b.configuration)[0];e=!!b.configuration.tizen&&b.configuration.tizen.sideStreamText;if(!e){h.F(2);break}b.h=new rP;b.h.initialize(b);_.D(h,3);return _.y(h,b.h.load(d),5);case 5:b.h.start();_.oh(h,2);break;case 3:f=_.E(h),b.g.error(f);case 2:return _.D(h,6),_.y(h,b.a.load(b.configuration),8);case 8:_.oh(h,7);break;case 6:throw g=
70
+ _.E(h),b.onError(g),g;case 7:b.l.load(),_.A(h)}})};_.u.play=function(){var a=this;this.trigger(new _.L(_.hf));nQ(this);return this.a.play().then(function(){qP(a.f)})};_.u.pause=function(){var a=this;return this.a.pause().then(function(){qP(a.f)})};_.u.getState=function(){return this.f.getState()};_.u.getPeriods=function(){return[]};_.u.onError=function(a){var b=new _.L(_.ne,{detail:a});a.severity===_.P&&(nP(this.f,_.Rp),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()===_.Np};_.u.isPaused=function(){return this.a.getState()===pP};_.u.isMuted=function(){return $P(this.a)};_.u.setMuted=function(a){iQ(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 oQ).canPlay(a,b)};_.u.getTimelineCues=function(){return[]};_.u.getCueTimeline=function(){return null};_.u.getTextDisplayer=function(){return this.o};_.u.resetAbr=function(){};var CQ="clpp.tizen",BQ=0;oQ.prototype.a=function(){return CQ};
73
+ oQ.prototype.canPlay=function(a){a=a.type;var b=!!window.webapis;if((a===_.Tc||a===_.Yl||a===_.Yc)&&b){if(_.ok(2))return 2;if(_.ok(3)||_.ok(4)||_.ok(5)||_.ok(6))return _.Dh("Use of clpp.tizen.TizenComponent is not recommended for Tizen version \x3e\x3d 3."),1}return 0};oQ.prototype.f=function(a){return a===_.pa};oQ.prototype.create=function(){return new mQ};_.x(pQ,_.tt);pQ.prototype.f=function(){_.Nh(new oQ)};pQ.prototype.a=function(){var a=CQ;a&&_.Lh[a]&&(delete _.Lh[a],_.Mh.info("Removed Player factory: '"+a+"'"))};pQ.prototype.id=function(){return"tizen"};_.J("clpp.tizen.TizenComponent",pQ);var eQ="onbufferingstart",qQ="onbufferingprogress",rQ="onbufferingcomplete",sQ="onstreamcompleted",VP="oncurrentplaytime",xQ="onevent",yQ="onsubtitlechange",zQ="ondrmevent",AQ="onerror",fQ="preparingstart",hQ="preparingend";};
73
74
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
74
75
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
75
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 nx='application/mp4; codecs\x3d"stpp.ttml"',ox='application/mp4; codecs\x3d"stpp.ttml.im1i"',px='application/mp4; codecs\x3d"stpp.ttml.im1t"',qx="backgroundColor",rx="direction",sx="displayAlign",tx="region",ux="sans-serif",vx="textAlign",wx="textDecoration",xx="writingMode",yx=function(a,b,c){this.h=a;this.f=b;this.a=c},zx=function(a,b,c){yx.call(this,a,[],c);this.j=b||""},Ax=function(a,b,c){yx.call(this,a,b,c)},Bx=function(a,b,c){a=a.f;for(var d=a.length-1;0<=d;d--){var e=b.get(a[d]);if(c in
3
- e.a)return e.getAttribute(c)}return null},Jx=function(a,b){var c=null;if(Cx.test(a)){c=Cx.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 Dx.test(a)?c=Ex(Dx,a):Fx.test(a)?c=Ex(Fx,a):Gx.test(a)?(c=Gx.exec(a),c=Number(c[1])/b.frameRate):Hx.test(a)?(c=Hx.exec(a),c=Number(c[1])/b.a):Ix.test(a)&&(c=Ex(Ix,a));return c},Ex=function(a,b){var c=a.exec(b);return null==c||""===c[0]?null:(Number(c[4])||0)/1E3+(Number(c[3])||
4
- 0)+60*(Number(c[2])||0)+3600*(Number(c[1])||0)},Kx=function(a){return a.split(":").pop()},Lx=function(a){return a.replace(/(\d*\.?\d+)c/g,"$1em")},Nx=function(a,b){for(;Mx.test(a);){var c=Mx.exec(a)[0];a=a.replace(c,parseInt(c,10)/b+"em")}return a},Ox=function(a){return a?a.replace(/(\d*\.?\d+)%/g,function(b,c){return c/100+"em"}):""},Px=function(a,b,c,d,e,f,g){yx.call(this,a,f,g);this.w=b;this.A=c;this.o=d;this.l=e;this.j=[]},Qx=function(a,b,c){a=Bx(a,b,vx);if(!a&&c&&(a=Bx(c,b,vx),!a&&"rltb"===Bx(c,
5
- b,xx)))return _.Pf;switch(a){case _.sd:return _.Ai;case _.Pf:case _.le:return _.Pf;default:return _.ye}},Rx=function(a,b,c){if(_.R.Me(a.w))return document.createTextNode(_.R.tg(a.w||""));if(a.A)return _.lq("br");for(var d=_.lq("span"),e=_.w(a.f),f=e.next();!f.done;f=e.next())_.mq(d,f.value);a=_.w(a.j);for(e=a.next();!e.done;e=a.next())d.appendChild(Rx(c.get(e.value),b,c));return d},Sx=function(a,b,c,d){this.frameRate=Number(a)||30;this.f=Number(b)||1;this.a=Number(d);0===this.a&&(this.a=a?this.frameRate*
6
- this.f:1);c&&(a=/^(\d+) (\d+)$/g.exec(c))&&(this.frameRate*=Number(a[1])/Number(a[2]))},Tx=function(a,b,c){yx.call(this,a,b,c)},Wx=function(a,b,c,d){var e=Ux.exec(a);a=Vx.exec(a);return typeof b===_.k&&0<b&&a?100*Number(a[c])/b:e?Number(e[c]):a?Number(a[c]):d},Xx=function(a,b){return typeof b===_.k&&0<b?_.Gi:Vx.test(a)?0:_.Gi},Yx=function(a,b){yx.call(this,"root-container",[],b);this.j=a},Zx=function(a,b,c){return typeof a===_.k?a:typeof b===_.k?b:c},$x=function(a,b){var c=a.getAttribute("extent");
7
- return(c=Vx.exec(c))?Number(c[b]):null},by=function(a){a=a.getAttribute("cellResolution");return(a=ay.exec(a))?Number(a[2]):null},cy=function(a,b,c){yx.call(this,a,b,c)},dy=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=[]},fy=function(a){return ey.some(function(b){return b in a.attributes})},gy=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,_.Zg(gy(a,
8
- a.a.get(e).f)).concat([e]));return c},iy=function(){return"inline-"+hy++},jy=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})},ky=function(a){this.a=a.firstChild;this.f=new Set},ly=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},my=function(a){return Kx(a.h.nodeName)},ny=function(){this.a=new Map},py=function(a,b){if(a.a.has(b))return a.a.get(b);var c=null,d=null,e=[],f=[],g={},h=b.parentNode;
9
- if(h&&a.a.has(h)){var l=a.a.get(h);e=_.Zg(l.l).concat();-1===["#text","span","br"].indexOf(b.nodeName)&&(c=l.a,d=l.j,f=_.Zg(l.f).concat(),g={},oy.forEach(function(n){n in l.attributes&&(g[n]=l.attributes[n])}))}if(b.nodeType===b.ELEMENT_NODE){b.hasAttribute(tx)&&(c=b.getAttribute(tx));b.hasAttribute(_.hg)&&f.push.apply(f,_.Zg(b.getAttribute(_.hg).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=Kx(h);g[m]=b.getAttribute(h)}d=
10
- g.backgroundImage}c=new ly(b,c,d,e,f,g);a.a.set(b,c);return c},qy=function(a){this.a=a;this.f=new DOMParser},ry=function(a){this.f=a},sy=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")},ty=function(){},uy=function(a){this.a=new qy(a);this.g=new _.K("clpp.ttml.Mp4TtmlParser")},vy=function(){this.j=new ty};yx.prototype.getId=function(){return this.h};
11
- yx.prototype.getAttribute=function(a){return this.a[a]};_.x(zx,yx);_.x(Ax,yx);var Cx=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Dx=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,Fx=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d+)$/,Gx=/^(\d*(?:\.\d*)?)f$/,Hx=/^(\d*(?:\.\d*)?)t$/,Ix=/^(?:(\d*(?:\.\d*)?)h)?(?:(\d*(?:\.\d*)?)m)?(?:(\d*(?:\.\d*)?)s)?(?:(\d*(?:\.\d*)?)ms)?$/,Ux=/^(\d{1,2}(?:\.\d+)?|100(?:\.0+)?)% (\d{1,2}(?:\.\d+)?|100(?:\.0+)?)%$/,Vx=/^(\d+)px (\d+)px$/,ay=/^(\d+) (\d+)$/,Mx=/(\d+)px/,wy=/^(\d+px|\d+em|\d*\.?\d+c)$/,ey=[qx,"color",rx,sx,"fontFamily","fontSize","fontStyle","fontWeight",
12
- "lineHeight","opacity","padding",vx,wx,"textOutline",xx,"zIndex"],oy=["begin",_.le];_.x(Px,Ax);
13
- Px.prototype.build=function(a,b,c,d,e,f,g){var h=Jx(this.a.begin,b);b=Jx(this.a.end,b);if(null===h||null===b)return null;h+=c;b+=c;c=_.lq(_.Wd);for(var l=_.w(this.j),m=l.next();!m.done;m=l.next())c.appendChild(Rx(g.get(m.value),e,g));g=new _.Fi(h,b,c.innerHTML.trim(),_.pg);g.cssClassList=_.Zg(this.f).concat();g.textAlign=Qx(this,e,null);g.writingMode=_.Bi;g.line=-1;g.lineInterpretation=_.Ci;g.lineAlign=_.Di;g.containerRows=Zx(null,by(a),15);if(this.o&&(f=f.get(this.o))){g.region=f.build(a,e);g.textAlign=
14
- Qx(this,e,f);a:switch(Bx(f,e,xx)){case "tb":case "tblr":a=_.Bg;break a;case "tbrl":a=_.Cg;break a;default:a=_.Bi}g.writingMode=a;a:switch(Bx(f,e,sx)){case _.sd:a=50;break a;case "after":a=-1;break a;default:a=0}g.line=a;a:switch(Bx(f,e,sx)){case _.sd:a=1;break a;default:a=_.Ci}g.lineInterpretation=a;a:switch(Bx(f,e,sx)){case _.sd:e=_.sd;break a;default:e=_.Di}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(Tx,Ax);
16
- Tx.prototype.build=function(a,b){var c=new _.Ii;c.id=this.getId();var d=Zx(a.j.containerWidth,$x(a,1),720),e=Zx(a.j.containerHeight,$x(a,2),480);a:switch(Bx(this,b,sx)){case "after":var f="flex-start";break a;case _.sd:f=_.sd;break a;default:f="flex-end"}c.displayAlign=f;a:switch(Bx(this,b,xx)){case "tb":case "tblr":f="row-reverse";break a;case "tbrl":f="row";break a;default:f=_.Id}c.writingMode=f;f=this.getAttribute("extent")||Bx(this,b,"extent");c.width=Wx(f,d,1,100);c.widthUnits=Xx(f,d);c.height=
17
- Wx(f,e,2,100);c.heightUnits=Xx(f,e);f=this.getAttribute("origin")||Bx(this,b,"origin");c.viewportAnchorX=Wx(f,d,1,0);c.viewportAnchorY=Wx(f,e,2,0);c.viewportAnchorUnits=Xx(f,d);c.cssClassList=_.Zg(this.f).concat();return c};_.x(Yx,yx);_.x(cy,yx);
18
- cy.prototype.build=function(a){var b=null;var c=by(a);c&&(b=Zx(a.j.containerHeight,$x(a,2),480)/c);b=Zx(a.j.fontSizeRadix,b,16);a=[];c="::ttml ."+this.h+", ::ttml ."+this.h+" * {";for(var d=_.w(xy.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+":"+Lx(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&&!wy.test(g)&&wy.test(h)&&wy.test(l)?(e=g,f=h):2===d.length&&!wy.test(g)&&wy.test(h)?(e=g,f=h):2===d.length&&wy.test(g)&&wy.test(h)&&(f=g);if(""!==f){f=Lx(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=Ox(this.a.textShadow),d=Lx(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",ux).replace("proportionalSerif",ux).replace("sansSerif",ux).replace("default",ux)+";":"");a:{if(wx 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:"+Lx(this.a.padding)+";":"";c=c+d+e;"lineHeight"in this.a?(d="",e=this.a.lineHeight,e=Lx(e),e=Nx(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=Lx(d);d=Nx(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 xy=new Map([[qx,"background-color"],["color","color"],[rx,rx],["fontStyle","font-style"],["fontWeight","font-weight"],["opacity","opacity"],["zIndex","z-index"]]);var hy=0;ky.prototype.Rd=function(){return!!this.a};ky.prototype.next=function(){if(!this.a)return null;var a=this.a;do this.f.add(a),a.nodeType!==Node.TEXT_NODE&&!yy.has(Kx(a.nodeName))||zy.has(Kx(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&&!yy.has(Kx(a.nodeName))));var b=this.a;this.a=a;return b};
23
- var yy=new Set(["tt","head","layout",_.Ne,_.ve,tx,"styling",_.hg,"body",_.Wd,"p","span","br"]),zy=new Set([_.hg,_.ve]);ly.prototype.getId=function(){return this.attributes.id};qy.prototype.parseInit=function(){};
24
- qy.prototype.parseMedia=function(a,b,c){c&&c.length||(c=[a.byteLength]);var d=_.M.$a(this.a.ttml||{}),e=_.xj(a,0,c[0]);e=_.R.aa(e);if(""===e)return{cues:[],styles:[]};var f=null;try{f=this.f.parseFromString(e,_.mg)}catch(n){throw new _.N(_.P,2,2005,"Failed to parse TTML.");}d=new dy(d);e=new ny;f=new ky(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=_.xj(a,b,h);l=_.Hj(l);var m="urn:mpeg:14496-30:subs:"+g;d.h.set(m,new zx(m,l,{imageType:"PNG",encoding:"Base64"}));
25
- b+=h}for(;f.Rd();)a=f.next(),a=py(e,a),"tt"===my(a)&&(d.l=new Yx(d.B,Object.assign({},a.attributes))),"tt"===my(a)&&(d.w=new Sx(a.attributes.frameRate,a.attributes.subFrameRate,a.attributes.frameRateMultiplier,a.attributes.tickRate)),my(a)!==_.ve||a.attributes.begin||a.attributes.end||(c="#"+a.getId(),d.h.set(c,new zx(c,a.h.textContent,a.attributes))),my(a)===_.ve&&a.attributes.begin&&a.attributes.end?(c="#"+iy(),b=new zx(c,a.h.textContent,a.attributes),d.h.set(c,b),c=b):c=null,c&&(a.j=c.getId()),
26
- my(a)===_.hg&&(c=a.getId()||iy(),b=new cy(c,a.f,Object.assign({},a.attributes)),d.a.set(c,b),a.a&&d.j.get(a.a).f.push(c)),my(a)!==_.hg&&fy(a)?(c=iy(),b=new cy(c,[],Object.assign({},a.attributes)),d.a.set(c,b),c=b):c=null,c&&a.f.push(c.getId()),my(a)!==_.Wd||!a.attributes.extent&&!a.attributes.origin?c=null:(c=iy(),b=new Tx(c,gy(d,a.f),Object.assign({},a.attributes)),d.j.set(c,b),c=b),c&&(a.a=c.getId()),my(a)!==tx?c=null:(c=a.getId(),b=new Tx(c,gy(d,a.f),Object.assign({},a.attributes)),d.j.set(c,b),
27
- c=b),c&&(a.a=c.getId()),c=a.l,-1===["#text","span","br"].indexOf(my(a))||0===c.length?c=null:(g=c[c.length-1],d.f.has(g)?(c=iy(),b=new Px(c,"#text"===a.h.nodeName?a.h.textContent:null,"br"===my(a),a.a,a.j,gy(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"===my(a)||a.j?(c=iy(),b=new Px(c,null,!1,a.a,a.j,gy(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=jy(d);f=[];a=_.w(d.a.values());for(c=a.next();!c.done;c=a.next())f.push.apply(f,
28
- _.Zg(c.value.build(d.l)));return{cues:e,styles:f}};ry.prototype.a=function(a){a=(new qy(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=sy(c.startTime)+" --\x3e "+sy(c.endTime),e=[];switch(c.textAlign){case _.ye:e.push("align:left");break;case _.Pf:e.push("align:right");break;case _.Ai:e.push("align:middle");break;case _.ye:e.push("align:start");break;case _.Pf:e.push("align:end")}switch(c.writingMode){case _.Bg:e.push("vertical:lr");break;
29
- case _.Cg:e.push("vertical:rl")}b+=d+(e.length?" "+e.join(" "):"")+"\n";b+=c.payload+"\n\n"}return _.R.Ya(b)};ty.prototype.probe=function(a,b){return a===_.Xc&&b===_.lg};ty.prototype.create=function(a){return new ry(a)};uy.prototype.parseInit=function(a){var b=!1;(new _.cn).M(_.Qe,_.dn).M(_.og,_.dn).M(_.Le,_.dn).M(_.Pe,_.dn).M(_.eg,_.dn).Y(_.gg,_.en).M("stpp",function(c){b=!0;c.parser.stop()}).parse(a);if(!b)throw new _.N(_.P,2,2007);};
30
- uy.prototype.parseMedia=function(a,b){var c=this,d=!1,e=[],f=[],g=[];(new _.cn).M("moof",_.dn).M("traf",_.dn).Y("subs",function(h){for(var l=_.W(h.reader),m=0;m<l;++m){h.reader.skip(4);for(var n=_.Ym(h.reader),p=0;p<n;++p){var q=1===h.version?_.W(h.reader):_.Ym(h.reader);g.push(q);h.reader.skip(6)}}}).M(_.Ke,_.fn(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(vy,_.it);vy.prototype.f=function(){_.Lu(_.Xc,qy);_.Lu(_.Vc,uy);_.Lu(nx,uy);_.Lu(px,uy);_.Lu(ox,uy);_.Wk.push(this.j)};vy.prototype.a=function(){_.Uu(_.Xc);_.Uu(_.Vc);_.Uu(nx);_.Uu(px);_.Uu(ox);_.Yk(this.j)};vy.prototype.id=function(){return"subtitles-ttml"};_.J("clpp.ttml.TtmlComponent",vy);};
2
+ var f=function(window){var Vx='application/mp4; codecs\x3d"stpp.ttml"',Wx='application/mp4; codecs\x3d"stpp.ttml.im1i"',Xx='application/mp4; codecs\x3d"stpp.ttml.im1t"',Yx="backgroundColor",Zx="direction",$x="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(c in
3
+ e.a)return e.getAttribute(c)}return null},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])||
4
+ 0)+60*(Number(c[2])||0)+3600*(Number(c[1])||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,
5
+ b,ey)))return _.Pf;switch(a){case _.sd:return _.Ci;case _.Pf:case _.le:return _.Pf;default:return _.ye}},yy=function(a,b,c){if(_.R.Me(a.w))return document.createTextNode(_.R.vg(a.w||""));if(a.A)return _.tq("br");for(var d=_.tq("span"),e=_.w(a.f),f=e.next();!f.done;f=e.next())_.uq(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*
6
+ this.f:1);c&&(a=/^(\d+) (\d+)$/g.exec(c))&&(this.frameRate*=Number(a[1])/Number(a[2]))},Ay=function(a,b,c){fy.call(this,a,b,c)},Dy=function(a,b,c,d){var e=By.exec(a);a=Cy.exec(a);return typeof b===_.k&&0<b&&a?100*Number(a[c])/b:e?Number(e[c]):a?Number(a[c]):d},Ey=function(a,b){return typeof b===_.k&&0<b?_.Ii:Cy.test(a)?0:_.Ii},Fy=function(a,b){fy.call(this,"root-container",[],b);this.j=a},Gy=function(a,b,c){return typeof a===_.k?a:typeof b===_.k?b:c},Hy=function(a,b){var c=a.getAttribute("extent");
7
+ return(c=Cy.exec(c))?Number(c[b]):null},Jy=function(a){a=a.getAttribute("cellResolution");return(a=Iy.exec(a))?Number(a[2]):null},Ky=function(a,b,c){fy.call(this,a,b,c)},Ly=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=[]},Ny=function(a){return My.some(function(b){return b in a.attributes})},Oy=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,_.ah(Oy(a,
8
+ a.a.get(e).f)).concat([e]));return c},Qy=function(){return"inline-"+Py++},Ry=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})},Sy=function(a){this.a=a.firstChild;this.f=new Set},Ty=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},Uy=function(a){return ry(a.h.nodeName)},Vy=function(){this.a=new Map},Xy=function(a,b){if(a.a.has(b))return a.a.get(b);var c=null,d=null,e=[],f=[],g={},h=b.parentNode;
9
+ if(h&&a.a.has(h)){var l=a.a.get(h);e=_.ah(l.l).concat();-1===["#text","span","br"].indexOf(b.nodeName)&&(c=l.a,d=l.j,f=_.ah(l.f).concat(),g={},Wy.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(_.hg)&&f.push.apply(f,_.ah(b.getAttribute(_.hg).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=
10
+ g.backgroundImage}c=new Ty(b,c,d,e,f,g);a.a.set(b,c);return c},Yy=function(a){this.a=a;this.f=new DOMParser},Zy=function(a){this.f=a},$y=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 Yy(a);this.g=new _.K("clpp.ttml.Mp4TtmlParser")},cz=function(){this.j=new az};fy.prototype.getId=function(){return this.h};
11
+ 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)?$/,By=/^(\d{1,2}(?:\.\d+)?|100(?:\.0+)?)% (\d{1,2}(?:\.\d+)?|100(?:\.0+)?)%$/,Cy=/^(\d+)px (\d+)px$/,Iy=/^(\d+) (\d+)$/,ty=/(\d+)px/,dz=/^(\d+px|\d+em|\d*\.?\d+c)$/,My=[Yx,"color",Zx,$x,"fontFamily","fontSize","fontStyle","fontWeight",
12
+ "lineHeight","opacity","padding",cy,dy,"textOutline",ey,"zIndex"],Wy=["begin",_.le];_.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=_.tq(_.Wd);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 _.Hi(h,b,c.innerHTML.trim(),_.pg);g.cssClassList=_.ah(this.f).concat();g.textAlign=xy(this,e,null);g.writingMode=_.Di;g.line=-1;g.lineInterpretation=_.Ei;g.lineAlign=_.Fi;g.containerRows=Gy(null,Jy(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=_.Ag;break a;case "tbrl":a=_.Bg;break a;default:a=_.Di}g.writingMode=a;a:switch(iy(f,e,$x)){case _.sd:a=50;break a;case "after":a=-1;break a;default:a=0}g.line=a;a:switch(iy(f,e,$x)){case _.sd:a=1;break a;default:a=_.Ei}g.lineInterpretation=a;a:switch(iy(f,e,$x)){case _.sd:e=_.sd;break a;default:e=_.Fi}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(Ay,hy);
16
+ Ay.prototype.build=function(a,b){var c=new _.Ki;c.id=this.getId();var d=Gy(a.j.containerWidth,Hy(a,1),720),e=Gy(a.j.containerHeight,Hy(a,2),480);a:switch(iy(this,b,$x)){case "after":var f="flex-start";break a;case _.sd:f=_.sd;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=Dy(f,d,1,100);c.widthUnits=Ey(f,d);c.height=
17
+ Dy(f,e,2,100);c.heightUnits=Ey(f,e);f=this.getAttribute("origin")||iy(this,b,"origin");c.viewportAnchorX=Dy(f,d,1,0);c.viewportAnchorY=Dy(f,e,2,0);c.viewportAnchorUnits=Ey(f,d);c.cssClassList=_.ah(this.f).concat();return c};_.x(Fy,fy);_.x(Ky,fy);
18
+ Ky.prototype.build=function(a){var b=null;var c=Jy(a);c&&(b=Gy(a.j.containerHeight,Hy(a,2),480)/c);b=Gy(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([[Yx,"background-color"],["color","color"],[Zx,Zx],["fontStyle","font-style"],["fontWeight","font-weight"],["opacity","opacity"],["zIndex","z-index"]]);var Py=0;Sy.prototype.Rd=function(){return!!this.a};Sy.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",_.Ne,_.ve,ay,"styling",_.hg,"body",_.Wd,"p","span","br"]),gz=new Set([_.hg,_.ve]);Ty.prototype.getId=function(){return this.attributes.id};Yy.prototype.parseInit=function(){};
24
+ Yy.prototype.parseMedia=function(a,b,c){c&&c.length||(c=[a.byteLength]);var d=_.M.bb(this.a.ttml||{}),e=_.zj(a,0,c[0]);e=_.R.aa(e);if(""===e)return{cues:[],styles:[]};var f=null;try{f=this.f.parseFromString(e,_.mg)}catch(n){throw new _.N(_.P,2,2005,"Failed to parse TTML.");}d=new Ly(d);e=new Vy;f=new Sy(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=_.zj(a,b,h);l=_.Jj(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.Rd();)a=f.next(),a=Xy(e,a),"tt"===Uy(a)&&(d.l=new Fy(d.B,Object.assign({},a.attributes))),"tt"===Uy(a)&&(d.w=new zy(a.attributes.frameRate,a.attributes.subFrameRate,a.attributes.frameRateMultiplier,a.attributes.tickRate)),Uy(a)!==_.ve||a.attributes.begin||a.attributes.end||(c="#"+a.getId(),d.h.set(c,new gy(c,a.h.textContent,a.attributes))),Uy(a)===_.ve&&a.attributes.begin&&a.attributes.end?(c="#"+Qy(),b=new gy(c,a.h.textContent,a.attributes),d.h.set(c,b),c=b):c=null,c&&(a.j=c.getId()),
26
+ Uy(a)===_.hg&&(c=a.getId()||Qy(),b=new Ky(c,a.f,Object.assign({},a.attributes)),d.a.set(c,b),a.a&&d.j.get(a.a).f.push(c)),Uy(a)!==_.hg&&Ny(a)?(c=Qy(),b=new Ky(c,[],Object.assign({},a.attributes)),d.a.set(c,b),c=b):c=null,c&&a.f.push(c.getId()),Uy(a)!==_.Wd||!a.attributes.extent&&!a.attributes.origin?c=null:(c=Qy(),b=new Ay(c,Oy(d,a.f),Object.assign({},a.attributes)),d.j.set(c,b),c=b),c&&(a.a=c.getId()),Uy(a)!==ay?c=null:(c=a.getId(),b=new Ay(c,Oy(d,a.f),Object.assign({},a.attributes)),d.j.set(c,b),
27
+ c=b),c&&(a.a=c.getId()),c=a.l,-1===["#text","span","br"].indexOf(Uy(a))||0===c.length?c=null:(g=c[c.length-1],d.f.has(g)?(c=Qy(),b=new wy(c,"#text"===a.h.nodeName?a.h.textContent:null,"br"===Uy(a),a.a,a.j,Oy(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"===Uy(a)||a.j?(c=Qy(),b=new wy(c,null,!1,a.a,a.j,Oy(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=Ry(d);f=[];a=_.w(d.a.values());for(c=a.next();!c.done;c=a.next())f.push.apply(f,
28
+ _.ah(c.value.build(d.l)));return{cues:e,styles:f}};Zy.prototype.a=function(a){a=(new Yy(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=$y(c.startTime)+" --\x3e "+$y(c.endTime),e=[];switch(c.textAlign){case _.ye:e.push("align:left");break;case _.Pf:e.push("align:right");break;case _.Ci:e.push("align:middle");break;case _.ye:e.push("align:start");break;case _.Pf:e.push("align:end")}switch(c.writingMode){case _.Ag:e.push("vertical:lr");break;
29
+ case _.Bg:e.push("vertical:rl")}b+=d+(e.length?" "+e.join(" "):"")+"\n";b+=c.payload+"\n\n"}return _.R.$a(b)};az.prototype.probe=function(a,b){return a===_.Xc&&b===_.lg};az.prototype.create=function(a){return new Zy(a)};bz.prototype.parseInit=function(a){var b=!1;(new _.gn).M(_.Qe,_.hn).M(_.og,_.hn).M(_.Le,_.hn).M(_.Pe,_.hn).M(_.eg,_.hn).Y(_.gg,_.jn).M("stpp",function(c){b=!0;c.parser.stop()}).parse(a);if(!b)throw new _.N(_.P,2,2007);};
30
+ bz.prototype.parseMedia=function(a,b){var c=this,d=!1,e=[],f=[],g=[];(new _.gn).M("moof",_.hn).M("traf",_.hn).Y("subs",function(h){for(var l=_.W(h.reader),m=0;m<l;++m){h.reader.skip(4);for(var n=_.bn(h.reader),p=0;p<n;++p){var q=1===h.version?_.W(h.reader):_.bn(h.reader);g.push(q);h.reader.skip(6)}}}).M(_.Je,_.kn(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,_.tt);cz.prototype.f=function(){_.cv(_.Xc,Yy);_.cv(_.Vc,bz);_.cv(Vx,bz);_.cv(Xx,bz);_.cv(Wx,bz);_.$k.push(this.j)};cz.prototype.a=function(){_.ev(_.Xc);_.ev(_.Vc);_.ev(Vx);_.ev(Xx);_.ev(Wx);_.bl(this.j)};cz.prototype.id=function(){return"subtitles-ttml"};_.J("clpp.ttml.TtmlComponent",cz);};
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 bx="VerimatrixVCAS",cx="clpp.verimatrix.Vcas",dx="clpp.verimatrix.VcasComponent",jx=function(a){_.Qm.call(this,bx);var b={};b[ex]=ex;b[fx]=fx;var c=a.authenticator,d=void 0===a.licenseRequestVuidLocation?gx: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?hx:a.fairPlayAssetIdStrategy;this.A=a.deviceId;this.a=c;
3
- this.C=d;this.B=b;this.w=ix(this,e);this.o=ix(this,f);this.l=ix(this,g);this.j=h;this.H=l;this.G=m;this.g=new _.K(cx);_.R.empty(this.w)?this.g.warn(_.oc):this.Wa(_.Pd,{licenseUrl:this.w,videoRobustness:[_.Wb,void 0],audioRobustness:[_.Vb,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:this.h.bind(this)}});_.R.empty(this.o)?this.g.warn(_.Jb):this.Wa(_.Nd,{licenseUrl:this.o,videoRobustness:["3000"],audioRobustness:["2000"],modifiers:{licenseRequest:this.h.bind(this)}});
4
- _.R.empty(this.l)?this.g.warn(_.cb):_.R.empty(this.j)?this.g.warn(_.bb):this.Wa(_.Kd,{licenseUrl:this.l,certificateUrl:this.j,modifiers:{licenseRequest:this.K.bind(this),licenseResponse:this.L.bind(this),extractContentId:this.I.bind(this)}})},ix=function(a,b){if(a.C===gx){var c=Object.assign({},{deviceId:_.Ij(_.R.ld(a.A))},a.a&&{authenticator:_.Ij(_.R.ld(a.a))});return b+_.Hk(c)}return b},kx=function(){this.g=new _.K(dx)};_.x(jx,_.Qm);
5
- jx.prototype.h=function(a,b){if(this.C===lx){var c=this.B[fx],d={};d[this.B[ex]]=this.A;this.a&&(d[c]=this.a);Object.keys(d).forEach(function(e){b.headers[e]=d[e]})}};jx.prototype.I=function(a,b){var c=_.mn(b);switch(this.G){case mx:c=_.Hk({r:c,zo:this.H},!0)}return c};jx.prototype.K=function(a,b){this.h(a,b);_.pn(b)};jx.prototype.L=function(a,b){_.qn(b)};_.J(cx,jx);jx.prototype.constructor=jx.prototype.constructor;jx.NAME=bx;var gx="query-string",lx="http-header";
6
- jx.LicenseRequestVuidLocation={QUERY_STRING:gx,HTTP_HEADER:lx};var ex="DeviceId",fx="Authenticator";jx.LicenseRequestHttpHeader={DEVICE_ID_HEADER:ex,AUTHENTICATOR_HEADER:fx};var hx="keyid",mx="contentid-siteid";jx.FairPlayAssetIdStrategy={KEYID:hx,CONTENTID_SITEID:mx};_.x(kx,_.it);kx.prototype.a=function(){delete _.Km.VerimatrixVCAS};kx.prototype.h=function(a){a=a.getConfiguration();if(a.drm&&a.drm.env===bx){a=a.drm.customData;if(!a)throw new _.N(_.P,7,7100,_.Qd);a=new jx(a);this.g.info("Registering the Verimatrix VCAS Ultra environment");_.Lm(a)}};kx.prototype.id=function(){return"verimatrix-vcas"};_.J(dx,kx);};
2
+ var f=function(window){var Jx="VerimatrixVCAS",Kx="clpp.verimatrix.Vcas",Lx="clpp.verimatrix.VcasComponent",Rx=function(a){_.Um.call(this,Jx);var b={};b[Mx]=Mx;b[Nx]=Nx;var c=a.authenticator,d=void 0===a.licenseRequestVuidLocation?Ox: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?Px:a.fairPlayAssetIdStrategy;this.A=a.deviceId;this.a=c;
3
+ this.C=d;this.B=b;this.w=Qx(this,e);this.o=Qx(this,f);this.l=Qx(this,g);this.j=h;this.H=l;this.G=m;this.g=new _.K(Kx);_.R.empty(this.w)?this.g.warn(_.nc):this.Ya(_.Pd,{licenseUrl:this.w,videoRobustness:[_.Wb,void 0],audioRobustness:[_.Vb,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:this.h.bind(this)}});_.R.empty(this.o)?this.g.warn(_.Kb):this.Ya(_.Nd,{licenseUrl:this.o,videoRobustness:["3000"],audioRobustness:["2000"],modifiers:{licenseRequest:this.h.bind(this)}});
4
+ _.R.empty(this.l)?this.g.warn(_.cb):_.R.empty(this.j)?this.g.warn(_.bb):this.Ya(_.Kd,{licenseUrl:this.l,certificateUrl:this.j,modifiers:{licenseRequest:this.K.bind(this),licenseResponse:this.L.bind(this),extractContentId:this.I.bind(this)}})},Qx=function(a,b){if(a.C===Ox){var c=Object.assign({},{deviceId:_.Kj(_.R.ld(a.A))},a.a&&{authenticator:_.Kj(_.R.ld(a.a))});return b+_.Lk(c)}return b},Sx=function(){this.g=new _.K(Lx)};_.x(Rx,_.Um);
5
+ Rx.prototype.h=function(a,b){if(this.C===Tx){var c=this.B[Nx],d={};d[this.B[Mx]]=this.A;this.a&&(d[c]=this.a);Object.keys(d).forEach(function(e){b.headers[e]=d[e]})}};Rx.prototype.I=function(a,b){var c=_.qn(b);switch(this.G){case Ux:c=_.Lk({r:c,Do:this.H},!0)}return c};Rx.prototype.K=function(a,b){this.h(a,b);_.tn(b)};Rx.prototype.L=function(a,b){_.un(b)};_.J(Kx,Rx);Rx.prototype.constructor=Rx.prototype.constructor;Rx.NAME=Jx;var Ox="query-string",Tx="http-header";
6
+ Rx.LicenseRequestVuidLocation={QUERY_STRING:Ox,HTTP_HEADER:Tx};var Mx="DeviceId",Nx="Authenticator";Rx.LicenseRequestHttpHeader={DEVICE_ID_HEADER:Mx,AUTHENTICATOR_HEADER:Nx};var Px="keyid",Ux="contentid-siteid";Rx.FairPlayAssetIdStrategy={KEYID:Px,CONTENTID_SITEID:Ux};_.x(Sx,_.tt);Sx.prototype.a=function(){delete _.Om.VerimatrixVCAS};Sx.prototype.h=function(a){a=a.getConfiguration();if(a.drm&&a.drm.env===Jx){a=a.drm.customData;if(!a)throw new _.N(_.P,7,7100,_.Qd);a=new Rx(a);this.g.info("Registering the Verimatrix VCAS Ultra environment");_.Pm(a)}};Sx.prototype.id=function(){return"verimatrix-vcas"};_.J(Lx,Sx);};
7
7
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
8
8
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
9
9
  else{_=this.clpp._;(f.call(g,this));}
package/cjs/cl.vimond.js CHANGED
@@ -1,17 +1,17 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var Sw="Registering listeners",Tw="clpp.vimond.VimondPlugin",Uw=function(a,b,c,d,e){this.G=a;this.H=b;this.I=c;this.m=d;this.C=e;this.a=new _.Qh;this.l=!0;this.f=this.j=this.A=!1;this.B=null;this.h=new _.ll(this.rh.bind(this));this.g=new _.K("clpp.vimond.VimondDispatcher");this.o=this.w=0;this.m&&this.a&&(this.g.debug(Sw),this.a.on(this.m,_.cg,this.zk.bind(this)),this.a.on(this.m,_.ng,this.Ak.bind(this)),this.a.on(this.m,_.uc,this.xk.bind(this)),this.a.on(this.m,_.vc,this.yk.bind(this)))},Vw=function(a,
3
- b){a.m.trigger(new _.L(_.Ig,{detail:b}))},Ww=function(a,b,c){b&&(a.A=!0,a.h.stop());a.m.onError(new _.N(b?_.P:1,9,9201,c))},Xw=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},Yw=function(a){this.m=a;this.a=new _.Qh;this.g=new _.K("clpp.vimond.VimondAdapter");this.f=this.h=!1;this.m&&this.a&&(this.g.debug(Sw),this.a.on(this.m,_.Lf,this.o.bind(this)),this.a.on(this.m,_.uc,this.j.bind(this)),this.a.on(this.m,_.vc,this.l.bind(this)))},
4
- Zw=function(a,b){var c=a.m.getState();if(1===b)return["str-start",_.tf];if(a.h)return[_.le,_.df];if(c===_.Fp)return[_.le,null];if(c===_.Jp)return[_.ne,_.df];var d=_.df;if(c===_.Dp||c===_.Mp||a.f)d=_.tf;return["period",d]},$w=function(){this.a=!1;this.g=new _.K(Tw);this.j=this.h=this.f=null},ax=function(){};_.u=Uw.prototype;_.u.Ak=function(){this.f||(this.f=1<Math.abs(this.w-this.m.getPosition()));this.w=this.m.getPosition()};_.u.xk=function(){this.g.debug("Ad break started");this.j=!0};
5
- _.u.yk=function(){this.g.debug("Ad break stopped");this.j=!1};
6
- _.u.zk=function(a){var b=this,c,d,e,f,g;return _.I(function(h){if(1==h.a){c=a.detail;d=_.Hp;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.rh(),3)}e===d.ENDED&&b.h.stop();_.B(h)})};
8
- _.u.rh=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;_.D(h,2);l=a.C;l.f++;var m=_.M.pa(l.o);m.client.buildName=_.va;m.client.buildVersion=_.ja;var n=m.client,p=l.a.m.getDrmInfo();n.drm=p?p.keySystem:"";m.client.pageUrl=document.location.href;m.client.streamUrl=l.a.m.getLoadedSource().url;m.client.userAgent=navigator.userAgent;m.client.videoFormat=
9
- l.a.m.getLoadedSource().type||"";n=m.client;p=l.a.m.getLoadedSource();p=((new _.Fk(p.url)).scheme||"").replace(":","");n.videoProtocol=p;n=Zw(l.a,l.f);m.client.playerEvent=n[0]||"";m.client.playerState=n[1]||"";m.progress.vod&&(m.progress.vod.position=l.a.getPosition());if(n=m.progress.live){p=l.a;var q=p.m.getPresentationStartTime()||0;p=Math.floor(q+p.m.getPosition());p=(new Date(1E3*p)).toISOString();n.position=p;q=l.a;p=q.m.getPosition();q=q.m.getSeekRange().end;n.onLiveEdge=30>Math.abs(q-p);
10
- typeof n.liveResumePossible!==_.id&&(n.liveResumePossible=!0)}m.progress.eventNumber=l.f;m.timestamp=(new Date).toISOString();l.g.debug("Fire an event");n=_.Wj(l.l);n.method=_.Ib;n.contentType="application/json";n.headers.Authorization="Bearer "+l.h;n.body=_.R.ld(JSON.stringify(m));l=l.j.fetch(n).U;return _.y(h,l,4)}if(2!=h.a)return b=h.f,Vw(a,b),_.mh(h,0);d=c=_.E(h);e=d.code;f=d.data;g=[1002,1003];g.includes(e)?(a.g.debug("Unreachable service"),Vw(a,f),Ww(a,a.H,f)):1001===e?(a.g.debug("Generic service error"),
11
- Vw(a,f),Ww(a,a.I,f)):a.g.error(c.toString());_.B(h)})};Xw.prototype.Bg=function(a){this.h=a};Yw.prototype.getPosition=function(){return Math.floor(this.m.getPosition())};Yw.prototype.o=function(){this.h=!0};Yw.prototype.j=function(){this.f=!0};Yw.prototype.l=function(){this.f=!1};_.x($w,_.ev);_.u=$w.prototype;_.u.onPlayerCreated=function(){};
12
- _.u.onContentWillLoad=function(a){var b=a.getConfiguration();(this.a=!_.M.R(b.vimond)&&typeof b.vimond===_.Ue)?a.namespace()===_.Ad&&(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 _.N(1,9,9200));return}this.g.debug(_.xa);
13
- c=b.failIfUnreachable;typeof c!==_.id&&(c=!0);d=b.failOnError;typeof d!==_.id&&(d=!0);this.f=new Yw(a);this.h=new Xw(b.playerEventRequest.uri,b.authToken,b.playerEventRequest.body,this.f,a.getNetworkEngine());this.j=new Uw(b.playerEventRequest.eventInterval,c,d,a,this.h)}};_.u.onPlayerWillRelease=function(){if(this.a){if(this.f){var a=this.f;a.g.debug(_.gc);_.Th(a.a)}this.j&&(a=this.j,a.g.debug(_.gc),_.Th(a.a),a.h.stop());this.j=this.h=this.f=null}};_.u.onPlayerWillDestroy=function(){};_.u.id=function(){return"vimond"};
14
- _.u.Bg=function(a){this.a&&this.h&&this.h.Bg(a)};_.J(Tw,$w);$w.prototype.updateAuthToken=$w.prototype.Bg;$w.Id="vimond";ax.prototype.create=function(){return new $w};_.Fs(new ax);};
2
+ var f=function(window){var zx="Registering listeners",Ax="clpp.vimond.VimondPlugin",Bx=function(a,b,c,d,e){this.G=a;this.H=b;this.I=c;this.m=d;this.C=e;this.a=new _.Sh;this.l=!0;this.f=this.j=this.A=!1;this.B=null;this.h=new _.pl(this.vh.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,_.cg,this.Ck.bind(this)),this.a.on(this.m,_.ng,this.Dk.bind(this)),this.a.on(this.m,_.uc,this.Ak.bind(this)),this.a.on(this.m,_.vc,this.Bk.bind(this)))},Cx=function(a,
3
+ b){a.m.trigger(new _.L(_.Ig,{detail:b}))},Dx=function(a,b,c){b&&(a.A=!0,a.h.stop());a.m.onError(new _.N(b?_.P:1,9,9201,c))},Ex=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},Fx=function(a){this.m=a;this.a=new _.Sh;this.g=new _.K("clpp.vimond.VimondAdapter");this.f=this.h=!1;this.m&&this.a&&(this.g.debug(zx),this.a.on(this.m,_.Lf,this.o.bind(this)),this.a.on(this.m,_.uc,this.j.bind(this)),this.a.on(this.m,_.vc,this.l.bind(this)))},
4
+ Gx=function(a,b){var c=a.m.getState();if(1===b)return["str-start",_.tf];if(a.h)return[_.le,_.df];if(c===_.Np)return[_.le,null];if(c===_.Rp)return[_.ne,_.df];var d=_.df;if(c===_.Lp||c===_.Up||a.f)d=_.tf;return["period",d]},Hx=function(){this.a=!1;this.g=new _.K(Ax);this.j=this.h=this.f=null},Ix=function(){};_.u=Bx.prototype;_.u.Dk=function(){this.f||(this.f=1<Math.abs(this.w-this.m.getPosition()));this.w=this.m.getPosition()};_.u.Ak=function(){this.g.debug("Ad break started");this.j=!0};
5
+ _.u.Bk=function(){this.g.debug("Ad break stopped");this.j=!1};
6
+ _.u.Ck=function(a){var b=this,c,d,e,f,g;return _.I(function(h){if(1==h.a){c=a.detail;d=_.Pp;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.vh(),3)}e===d.ENDED&&b.h.stop();_.A(h)})};
8
+ _.u.vh=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;_.D(h,2);l=a.C;l.f++;var m=_.M.pa(l.o);m.client.buildName=_.va;m.client.buildVersion=_.ja;var n=m.client,p=l.a.m.getDrmInfo();n.drm=p?p.keySystem:"";m.client.pageUrl=document.location.href;m.client.streamUrl=l.a.m.getLoadedSource().url;m.client.userAgent=navigator.userAgent;m.client.videoFormat=
9
+ l.a.m.getLoadedSource().type||"";n=m.client;p=l.a.m.getLoadedSource();p=((new _.Jk(p.url)).scheme||"").replace(":","");n.videoProtocol=p;n=Gx(l.a,l.f);m.client.playerEvent=n[0]||"";m.client.playerState=n[1]||"";m.progress.vod&&(m.progress.vod.position=l.a.getPosition());if(n=m.progress.live){p=l.a;var q=p.m.getPresentationStartTime()||0;p=Math.floor(q+p.m.getPosition());p=(new Date(1E3*p)).toISOString();n.position=p;q=l.a;p=q.m.getPosition();q=q.m.getSeekRange().end;n.onLiveEdge=30>Math.abs(q-p);
10
+ typeof n.liveResumePossible!==_.id&&(n.liveResumePossible=!0)}m.progress.eventNumber=l.f;m.timestamp=(new Date).toISOString();l.g.debug("Fire an event");n=_.Yj(l.l);n.method=_.Ib;n.contentType="application/json";n.headers.Authorization="Bearer "+l.h;n.body=_.R.ld(JSON.stringify(m));l=l.j.fetch(n).U;return _.y(h,l,4)}if(2!=h.a)return b=h.f,Cx(a,b),_.oh(h,0);d=c=_.E(h);e=d.code;f=d.data;g=[1002,1003];g.includes(e)?(a.g.debug("Unreachable service"),Cx(a,f),Dx(a,a.H,f)):1001===e?(a.g.debug("Generic service error"),
11
+ Cx(a,f),Dx(a,a.I,f)):a.g.error(c.toString());_.A(h)})};Ex.prototype.Dg=function(a){this.h=a};Fx.prototype.getPosition=function(){return Math.floor(this.m.getPosition())};Fx.prototype.o=function(){this.h=!0};Fx.prototype.j=function(){this.f=!0};Fx.prototype.l=function(){this.f=!1};_.x(Hx,_.pv);_.u=Hx.prototype;_.u.onPlayerCreated=function(){};
12
+ _.u.onContentWillLoad=function(a){var b=a.getConfiguration();(this.a=!_.M.R(b.vimond)&&typeof b.vimond===_.Ue)?a.namespace()===_.Ad&&(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 _.N(1,9,9200));return}this.g.debug(_.wa);
13
+ c=b.failIfUnreachable;typeof c!==_.id&&(c=!0);d=b.failOnError;typeof d!==_.id&&(d=!0);this.f=new Fx(a);this.h=new Ex(b.playerEventRequest.uri,b.authToken,b.playerEventRequest.body,this.f,a.getNetworkEngine());this.j=new Bx(b.playerEventRequest.eventInterval,c,d,a,this.h)}};_.u.onPlayerWillRelease=function(){if(this.a){if(this.f){var a=this.f;a.g.debug(_.gc);_.Vh(a.a)}this.j&&(a=this.j,a.g.debug(_.gc),_.Vh(a.a),a.h.stop());this.j=this.h=this.f=null}};_.u.onPlayerWillDestroy=function(){};_.u.id=function(){return"vimond"};
14
+ _.u.Dg=function(a){this.a&&this.h&&this.h.Dg(a)};_.J(Ax,Hx);Hx.prototype.updateAuthToken=Hx.prototype.Dg;Hx.Id="vimond";Ix.prototype.create=function(){return new Hx};_.Qs(new Ix);};
15
15
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
16
16
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
17
17
  else{_=this.clpp._;(f.call(g,this));}