@castlabs/prestoplay 6.18.0 → 6.19.1

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 (64) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +7 -7
  5. package/cjs/cl.cast.js +115 -114
  6. package/cjs/cl.conviva.js +33 -33
  7. package/cjs/cl.core.js +581 -577
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +77 -75
  10. package/cjs/cl.externs.js +175 -293
  11. package/cjs/cl.freewheel.js +23 -24
  12. package/cjs/cl.hls.js +70 -71
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +28 -29
  15. package/cjs/cl.ima.js +24 -24
  16. package/cjs/cl.mse.js +313 -314
  17. package/cjs/cl.muxdata.js +15 -15
  18. package/cjs/cl.onboard.js +3 -3
  19. package/cjs/cl.persistent.js +14 -14
  20. package/cjs/cl.playlist.js +6 -6
  21. package/cjs/cl.sessions.js +16 -15
  22. package/cjs/cl.simid.js +15 -15
  23. package/cjs/cl.smooth.js +71 -72
  24. package/cjs/cl.thumbnails.js +26 -26
  25. package/cjs/cl.tizen.js +71 -71
  26. package/cjs/cl.ttml.js +27 -27
  27. package/cjs/cl.verimatrix.js +5 -5
  28. package/cjs/cl.vimond.js +12 -13
  29. package/cjs/cl.vr.js +19 -19
  30. package/cjs/cl.vtt.js +14 -14
  31. package/cjs/cl.youbora.js +18 -18
  32. package/cl.adobe.js +3 -3
  33. package/cl.airplay.js +3 -3
  34. package/cl.broadpeak.js +5 -5
  35. package/cl.cast.js +90 -89
  36. package/cl.conviva.js +27 -27
  37. package/cl.core.js +475 -474
  38. package/cl.crypto.js +9 -9
  39. package/cl.dash.js +72 -71
  40. package/cl.externs.js +172 -294
  41. package/cl.freewheel.js +19 -19
  42. package/cl.hls.js +74 -72
  43. package/cl.hlssmpte.js +5 -5
  44. package/cl.htmlcue.js +25 -26
  45. package/cl.ima.js +17 -17
  46. package/cl.mse.js +277 -274
  47. package/cl.muxdata.js +13 -13
  48. package/cl.onboard.js +4 -4
  49. package/cl.persistent.js +11 -11
  50. package/cl.playlist.js +5 -5
  51. package/cl.sessions.js +10 -10
  52. package/cl.simid.js +13 -13
  53. package/cl.smooth.js +59 -59
  54. package/cl.thumbnails.js +19 -19
  55. package/cl.tizen.js +57 -57
  56. package/cl.ttml.js +22 -22
  57. package/cl.verimatrix.js +4 -4
  58. package/cl.vimond.js +9 -8
  59. package/cl.vr.js +14 -14
  60. package/cl.vtt.js +12 -12
  61. package/cl.youbora.js +15 -15
  62. package/clpp.styles.css +14 -0
  63. package/package.json +1 -1
  64. package/typings.d.ts +379 -384
package/cl.tizen.js CHANGED
@@ -1,57 +1,57 @@
1
- import {clpp} from "./cl.core.js";import './cl.mse.js';let g={};const _ = clpp._;var f=function(window){'use strict';var MM="An unknown error occurred while trying to get volume",NM="Cannot get loading rendition due to platform limitations",OM="SecurityError",PM="The require privilege is: http://tizen.org/privilege/tv.audio",QM="|STARTBITRATE\x3d",RM=function(a,b,c){const d=e=>{c.call(a,e);a.removeEventListener(b,d)};a.addEventListener(b,d)},UM=function(a){return _.x(function*(){if(a.a!==_.zd&&a.a!==_.xd)throw new _.H(_.F,6,6001,`The key system ${a.a} is not supported by `+"the player or the platform");
2
- const b=a.f.get(a.a);if(!b.dd)throw new _.H(_.F,6,6012,`No license server given for ${a.a}`);try{a.a===_.zd?yield SM(a):yield TM(a,b),a.o={keySystem:a.a,licenseServerUri:b.dd,distinctiveIdentifierRequired:!1,persistentStateRequired:b.te,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[],keyIds:[],periodId:null}}catch(c){throw a.g.error(`Error while configuring CDM for ${a.a}`,c),new _.H(_.F,6,6005,{message:JSON.stringify(c)});}})},WM=function(a,b){_.x(function*(){var c=a.f.get(a.a);
3
- a.g.debug("DRM Challenge data: ",b.challenge);const d=atob(b.challenge);var e=new Uint8Array(d.length);for(let h=0;h<d.length;++h)e[h]=d.charCodeAt(h);c=_.Si([b.serverurl&&""!==b.serverurl?b.serverurl:c.dd],_.Pi());c.type=3;c.body=e.buffer;c.method=_.ub;try{var f=yield a.D.vb.fetch(c).R;if(a.j){var g=_.J(f.data);const h=g.byteLength;e="";for(f=0;f<h;f++)e+=String.fromCharCode(g[f]);const k=`${b.session_id}PARAM_START_POSITION`+`${btoa(e)}PARAM_START_POSITION`;a.g.debug("Widevine license params",k);
4
- try{webapis.avplay.setDrm(VM,"widevine_license_data",k)}catch(l){a.g.error("License response rejected by CDM");const m=new _.H(_.F,6,6008,{browserError:JSON.stringify(l)});a.D.onError(m)}}}catch(h){a.g.error("License request failed.",JSON.stringify(h)),g=new _.H(_.F,6,6007,{message:_.Sa,url:h.data.url,status:h.data.status||NaN,response:h.data.response||"",headers:h.data.headers||{}},h),a.D.onError(g)}})},SM=function(a){return _.x(function*(){try{webapis.avplay.setDrm(VM,"Initialize",""),webapis.avplay.setDrm(VM,
5
- "widevine_app_session",a.l.id),webapis.avplay.setDrm(VM,"widevine_data_type",a.l.type)}catch(b){throw b;}})},TM=function(a,b){return _.x(function*(){var c={};c[XM]=!b.te;c[YM]=b.dd;""!==b.customData&&(c[ZM]=b.customData);c=JSON.stringify(c);a.g.debug("PlayReady properties: ",c);try{webapis.avplay.setDrm($M,"SetProperties",c)}catch(d){throw d;}})},bN=function(a,b){if(a.f!==b)if(a.f===_.Vn&&b!==_.Wn)a.g.debug(_.fA+`${aN(b)}`);else{var c=(new Date).getTime();a.j=a.f;a.f=b;a.f===_.Rn?(a.o=(new Date).getTime(),
6
- a.m.trigger(new _.E(_.Uc,{detail:{bufferedTimeMS:-1,reason:a.h}}))):a.j===_.Rn&&a.m.trigger(new _.E(_.Qc,{detail:{bufferedTimeMS:c-a.o,reason:a.h}}));b={currentState:a.f,previousState:a.j,timeSinceLastStateChangeMS:c-a.w};a.w=c;a.m.trigger(new _.E(_.Nf,{detail:b}));a.g.debug("State changed:",aN(a.j),"-\x3e",aN(a.f))}},aN=function(a){return Object.keys(_.Un)[a]},eN=function(a){if(a.l){var b=a.a.getState(),c=a.f;switch(b){case cN:c=_.Zn;break;case dN:c=_.Yn;break;default:a.m.isEnded()?c=_.On:a.g.debug("Inconsistent AVPlay playback state:",
7
- b)}bN(a,c)}},fN=function(a){return _.x(function*(){const b=a.m.getConfiguration();let c;(c=yield _.yr(a.B.url,a.m.getNetworkEngine(),b.manifest.attemptParameters,a.B.type||null))&&c.configure(b.manifest);return c})},gN=function(a){if(!a)return!1;a=a.periods;let b=!1;for(let c=0;c<a.length;c++)b=b||0<a[c].textStreams.length;return b},hN=function(a){const b=document.createElement(_.w),c=new _.yG,d=new _.FF,e=a.m.getTextDisplayer();return new _.AG(b,c,e,d,a.m.getConfiguration())},iN=function(a){const b=
8
- {configuration:{},Db:()=>a.m.getPosition(),$:a.h,vb:a.m.getNetworkEngine(),oe:a.G.bind(a),ne:a.F.bind(a),onError:a.U.bind(a),zf:()=>{},onEvent:()=>{},Cf:a.H.bind(a),Kd:()=>{},vd:()=>new _.rH,Td:()=>!1,Oc:null};return new _.SG(a.a,b)},jN=function(a){const b=a.m.getPosition();let c=null;for(const d of a.a.periods)d.startTime<=b&&(c=d);return c},kN=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,
9
- a.m.getPosition()),c[d].startTime<=a.m.getPosition()){b=c[d].textStreams;break}a=b}else a=[];b=[];c=0;for(d=0;d<a.length;d++){const e=new _.hj(String(c++),_.K);e.mimeType=a[d].mimeType;e.language=a[d].language;e.roles=a[d].roles;e.kind=a[d].kind||_.NA;const f=new _.pj(String(a[d].id),e);f.bandwidth=a[d].bandwidth||null;e.renditions.push(f);b.push(e)}return b},lN=function(a){if(a.h&&!a.h.getTextDisplayer().isTextVisible())return null;if(a.f){const b=_.BE(a.f,_.G);let c=null;if(b){a=kN(a);for(let d=
10
- 0;d<a.length;d++)if(a[d].renditions[0].id===String(b.id)){c=a[d].renditions[0];break}}return c}return null},mN=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===_.Wd,a.a&&a.f)){a.setTextVisibility(!0);const c=jN(a),d=b.renditions[0];(b=c.textStreams.find(e=>String(e.id)===d.id))?(a.w?(a.g.debug("Switching period defer text selection"),a.l=b):(_.QE(a.f,b,!0,0),a.m.trigger(new _.E(_.Kk))),a.o=b.language):a.g.error(_.eA,d.id)}},nN=function(a){const b=
11
- a.oa();b&&a.m.trigger(new _.E(_.Nc,{detail:{width:b.width,height:b.height,bandwidth:b.bandwidth,rendition:b}}))},oN=function(a,b){a.m.trigger(new _.E(_.rg,{details:{width:b.width,height:b.height,bandwidth:b.bandwidth,track:b.track,abrSelection:a.a.o}}))},pN=function(a,b){let c=null;try{c=JSON.parse(b)}catch(d){a.g.warn("Couldn't retrieve extra infos from stream."),c=null}return c},qN=function(a,b){a=a.f[_.N]||[];const c=[];for(let d=0;d<a.length;d++)for(let e=0;e<a[d].renditions.length;e++)_.Yg(a[d].renditions[e],
12
- b,Object.keys(b))&&c.push(a[d].renditions[e]);return c[0]||null},rN=function(a){const b=a.m.getConfiguration();var c=_.Ah(b.preferredAudioLanguage||[]);const d=a.f[_.L]||[];if(d.length){var e=null;c.some(g=>{e=_.gB(g,d.map(h=>h.language));return!!e});if(e){var f=d.filter(g=>g.language===e);c=f[0];1<f.length&&b.preferredAudioRole&&(f=f.filter(g=>0<=g.roles.indexOf(b.preferredAudioRole)),0<f.length&&(c=f[0]));a.g.debug("Setting audio track with preferred language:",e);a.wa(c)}else a.g.debug("Preferred language(s) not available")}else a.g.debug("Could not set preferred audio language")},
13
- xN=function(a,b){var c=(l,m)=>{for(let n=0;n<l.length;n++)if(l[n].language===m)return l[n];return null};const d={};if(0>=b.length)return d;var e=b.filter(l=>l.type===sN),f=b.filter(l=>l.type===tN);const g=[];for(var h=0;h<f.length;h++){const l=pN(a,f[h].extra_info);if(l){var k=_.bi(l.language||_.ag);k=_.dj(k);k=c(g,k);k||(k=new _.hj(String(a.o++),_.L),g.push(k));k.renditions.push(uN(f[h].index,l,k))}else a.g.warn("Skipping audio stream with no extra info")}c=new _.hj(String(a.o++),_.N);for(f=0;f<
14
- e.length;f++)(h=pN(a,e[f].extra_info))?c.renditions.push(vN(e[f].index,h,c)):a.g.warn("Skipping video stream with no extra info");e=[];e=a.h?kN(a.h):wN(a,b);d[_.N]=[c];d[_.L]=g;d[_.K]=e;return d},AN=function(a,b){if(b===_.K&&a.h)return lN(a.h);var c=yN(a.a)||[];if(0===c.length)return null;c=c.filter(e=>e.type===b.toUpperCase())[0];var d=null;b===_.N&&(d=pN(a,c.extra_info),d=qN(a,{width:d.Width,height:d.Height}));b===_.L&&(c?(d=zN(a,c,_.L),a.j=d):d=a.j);b===_.K&&(c?(d=zN(a,c,_.K),a.l=d):d=a.l);return d},
15
- DN=function(a,b){if(b){const c=b.track.type.toUpperCase();BN(a.a,c,Number(b.id)).then(()=>{c===tN&&(a.j=b,a.m.trigger(new _.E(_.Jk)));c===CN&&(a.l=b,a.m.trigger(new _.E(_.Kk)))}).catch(()=>{a.g.error("Could not select "+c+" track.")})}else a.g.debug("Must provide valid rendition")},uN=function(a,b,c){const d=_.bi(b.language||_.ag);c.language=_.dj(d);c.originalLanguage=d;c.channelsCount=b.channels?Number(b.channels):null;c.mimeType=_.Jc;a=new _.pj(String(a),c);a.track=c;a.codec=b.fourCC||null;a.bandwidth=
16
- b.bit_rate||null;return a},vN=function(a,b,c){c.mimeType=_.mg;a=new _.pj(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},EN=function(a,b,c){b=_.bi(b.track_lang||_.ag);c.mimeType="text/ttml";c.language=_.dj(b);c.originalLanguage=b;c.kind=_.NA;return new _.pj(String(a),c)},wN=function(a,b){b=b.filter(d=>d.type===CN);const c=[];for(let d=0;d<b.length;d++){const e=pN(a,b[d].extra_info);if(!e){a.g.warn("Skipping text stream with no extra info");
17
- continue}const f=new _.hj(String(a.o++),_.K);f.renditions.push(EN(b[d].index,e,f));c.push(f)}return c},zN=function(a,b,c){a=a.f[c]||[];b=String(b.index);c=null;for(let d=0;d<a.length;d++)for(let e=0;e<a[d].renditions.length;e++)if(a[d].renditions[e].id===b){c=a[d].renditions[e];break}return c},FN=function(a){return a.f&&a.a?a.a.zh:webapis.avplay.getTotalTrackInfo()},HN=function(a,b,c){a.g.debug("switchVideoTrack()");try{const d={estimatedBandwidth:parseInt(webapis.avplay.getStreamingProperty("CURRENT_BANDWITH"),
18
- 10),currentBandwidth:b,nextBandwidth:c,currentPosition:a.getPosition()};a.a=GN(a);a.f=!0;webapis.avplay.stop();webapis.avplay.close();return a.load(a.m.getConfiguration(),d).then(()=>{const e=a.a.We;a.f=!1;a.a=null;return e===dN?a.pause():a.play()})}catch(d){return Promise.reject(d)}},IN=function(a,b){var c=a.m.getTextDisplayer();c&&c.setTextVisibility(b);c=a.m.h;try{c||webapis.avplay.setSilentSubtitle(!b)}catch(d){a.g.debug("Could not set text track visibility",d)}},BN=function(a,b,c){b=b.toUpperCase();
19
- b===CN&&IN(a,!0);const d=a.j[b];d&&(d.Nd.stop(),a.j[b]=null,a.g.debug(`Cancelled pending track switch for ${b}`));return new Promise((e,f)=>{const g=(h,k,l)=>{l=void 0===l?!1:l;try{webapis.avplay.setSelectTrack(h,k),a.j[h]=null,e()}catch(m){a.g.debug(`Could not set ${h} track. Trying again...`+`AVPlay state: ${a.getState()}, `+`buffering: ${a.w}`,m),!1===l&&(a.j[h]={type:h,index:k,Te:0,Nd:new _.Tj(()=>g(h,c,!0))}),(k=a.j[h])&&3>k.Te?(!a.w&&++k.Te,k.Nd.ha(a.w?.5:.25)):(a.g.debug("Could not set track after multiple attempts.Giving up..."),
20
- k&&k.Nd.stop(),a.j[h]=null,f())}};g(b,c)})},yN=function(a){return a.f&&a.a?a.a.ng:webapis.avplay.getCurrentStreamInfo()},JN=function(a){return _.x(function*(){tizen.systeminfo.getPropertyValue("DISPLAY",b=>{a.A=b.resolutionWidth/1920;a.g.debug("Display resolution ratio: ",a.A)},b=>{a.g.debug("Could not load DISPLAY property");throw b;})})},LN=function(a){try{webapis.avplay.setListener({onbufferingstart:a.I.bind(a),onbufferingprogress:a.H.bind(a),onbufferingcomplete:a.G.bind(a),onstreamcompleted:a.L.bind(a),
21
- oncurrentplaytime:b=>{a.trigger(new _.E(KN,{currentTime:b}))},onevent:a.K.bind(a),onsubtitlechange:a.N.bind(a),ondrmevent:a.J.bind(a),onerror:a.U.bind(a)})}catch(b){a.g.error(b)}},MN=function(a){const b=!!a.m.getTrackManager().Ia();try{webapis.avplay.setSilentSubtitle(!b)}catch(c){a.g.debug("Could not set AVPlay subtitle config",c)}},NN=function(a,b){try{const c=b.estimatedBandwidth||0,d=b.currentBandwidth||0;a.g.debug({estimatedBandwidth:c,Ph:d});0!==c&&0!==d&&c>=1.15*d&&webapis.avplay.setStreamingProperty("ADAPTIVE_INFO",
22
- QM+d)}catch(c){a.g.debug(c)}},ON=function(a,b){try{webapis.avplay.setStreamingProperty("ADAPTIVE_INFO","|BITRATES\x3d"+b+QM+b)}catch(c){throw a.g.debug("Could not set fixed bandwidth",c),c;}},PN=function(a){let b=null;try{b=tizen.tvaudiocontrol.isMute()}catch(c){switch(c.name){case OM:a.g.warn("The application doesn't have the privilege to get the mute state.",PM);break;default:a.g.warn(MM,c)}}return!!b},GN=function(a){return{position:a.getPosition(),state:a.m.getState(),We:a.getState(),playbackRate:a.getPlaybackRate(),
23
- isLive:a.isLive(),duration:a.getDuration(),isMuted:PN(a),volume:a.getVolume(),zh:FN(a),ng:yN(a)}},QN=function(){return new Promise((a,b)=>{if(window.webapis)a();else{const c=document.createElement("script");RM(c,"load",d=>a(d));RM(c,_.r,d=>b(d));c.src="$WEBAPIS/webapis/webapis.js";document.querySelector("head").appendChild(c)}})},RN=function(a){return _.x(function*(){yield QN();const b=new Promise(c=>{(new _.Tj(c)).ha(5)});if(!(yield Promise.race([JN(a).then(()=>!0),b.then(()=>!1)])))return a.g.debug("Took to long for the SDK to be ready"),
24
- Promise.reject("SDK Timeout")})},SN=function(a){return _.x(function*(){a.g.debug("avplay.prepare()");return new Promise((b,c)=>{try{webapis.avplay.prepareAsync(()=>{a.g.debug("AVPlay is ready!");MN(a);b()},d=>{a.g.debug("prepareAsync failed",d);c(d)})}catch(d){a.g.debug("Failed to prepare media player for playback"),c(d)}})})},TN=function(a,b){try{tizen.tvaudiocontrol.setMute(b)}catch(c){switch(c.name){case OM:a.g.warn("The application does not have the privilege to set mute.",PM);break;default:a.g.warn(MM,
25
- c)}}},YN=function(a,b,c){return _.x(function*(){a.l=_.bo(b);const d=a.F,e=c||{estimatedBandwidth:0,currentBandwidth:0,nextBandwidth:null,currentPosition:0};a.g.debug(`Loading manifest URL: ${a.l[d].url}`);let f=b.startTime||void 0;a.f&&(a.trigger(new _.E(UN)),f=c.currentPosition);try{let g=a.l[d].url;if(a.l[d].type===_.zc&&!g.includes(".mpd")){const h=new URL(g);h.searchParams.append("cl-ext",".mpd");g=h.toString()}webapis.avplay.open(g);e.nextBandwidth?(ON(a,e.nextBandwidth),a.o=!1):(a.o||NN(a,e),
26
- a.o=!0);LN(a);if(b.drm&&b.drm.env){const h={onError:k=>a.m.onError(k),vb:a.m.getNetworkEngine()};a.h=new VN(b.drm,h);yield a.h.init()}else a.g.debug("No DRM configuration was provided. Assuming clear content");a.f||a.trigger(new _.E(WN));yield SN(a);a.f||a.trigger(new _.E(XN));f&&typeof f===_.t&&0<f&&a.seek(f).catch(h=>{a.g.debug("Couldn't set start position",h)});a.f||(b.volume&&a.setVolume(b.volume),b.muted&&TN(a,b.muted),b.autoplay&&a.m.play().catch(h=>{a.g.debug("Autoplay failed",h)}))}catch(g){throw a.g.debug("Error while attempting to load source."),
27
- g;}})},ZN=function(a){if("NONE"!==a.a.getState()){var b=a.j.getBoundingClientRect();{a=a.a;const c=Math.floor(b.left*a.A),d=Math.floor(b.top*a.A),e=Math.floor(b.width*a.A);b=Math.floor(b.height*a.A);a.g.debug("Setting display area to","x:",c,"y:",d,"width:",e,"height:",b);webapis.avplay.setDisplayRect(c,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())},VN=class{constructor(a,
28
- b){this.h=a;this.o=null;this.a=_.Ee;this.l=null;this.j=!1;this.f=new Map;this.D=b;this.g=new _.R("clpp.tizen.DrmEngine")}init(){const a=this;return _.x(function*(){var b=_.nl[a.h.env]||null;if(!b)throw a.g.debug(_.va,_.zb+a.h.env+_.aa),new _.H(_.F,6,6015,`DRM environment '${a.h.env}' is missing.`);a.l={id:String(Math.floor(1E4*Math.random())),type:"MPEG-DASH"};var c=Object.keys(a.h.customData||{}).length?btoa(JSON.stringify(a.h.customData)):"";b=_.pl(b,a.h.customData);const d=b[_.xd];d&&a.f.set(_.xd,
29
- {dd:d.licenseUrl||"",customData:c,te:!1});(b=b[_.zd])&&a.f.set(_.zd,{dd:b.licenseUrl||"",customData:c,te:!1});if(0===a.f.size)throw new _.H(_.F,6,6E3);if((c=a.h.preferredDrmSystem)&&a.f.get(c))a.a=c;else if(a.f.get(_.xd))a.a=_.xd;else if(a.f.get(_.zd))a.a=_.zd;else throw new _.H(_.F,6,6001,"Configuration for the target system is missing.");yield UM(a);a.j=!0})}release(){const a=this;return _.x(function*(){a.j=!1;a.o=null;a.a=_.Ee;a.l=null;a.f=new Map})}getDrmInfo(){return this.o}},XM="DeleteLicenseAfterUse",
30
- YM="LicenseServer",ZM="CustomData";var eO=class{constructor(a){this.m=a;this.a=this.m.a;this.f=_.Wn;this.j=_.At;this.w=(new Date).getTime();this.l=!1;this.o=-1;this.h=2;this.g=new _.R("clpp.tizen.StateManager")}initialize(){this.a.on(UN,this.C,this);this.a.on($N,this.B,this);this.a.on(aO,this.A,this);this.a.on(WN,this.H,this);this.a.on(XN,this.G,this);this.a.on(bO,this.F,this)}release(){bN(this,_.Wn);this.l=!1;this.o=-1;this.h=2}destroy(){this.release();this.a.off(UN,this.C);this.a.off($N,this.B);this.a.off(aO,this.A);this.a.off(WN,
31
- this.H);this.a.off(XN,this.G);this.a.off(bO,this.F);this.m=this.a=null}C(){this.g.debug("Buffering start. Player state: ",this.a.getState());this.h=this.a.B?1:2;bN(this,_.Rn)}B(a){this.g.debug("Buffering progress: "+a.percent+" %. Player state: ",aN(this.f))}A(){this.g.debug("Buffering complete. Player state: ",this.a.getState());if(!this.l){this.l=!0;var a=this.m.getConfiguration().autoplay;const b=this.a.getState()===cO;if(!a&&b){bN(this,_.Yn);return}}if(a=this.f!==_.Xn)a=this.a.getState(),a=a===
32
- cN||a===dN;a&&eN(this)}H(){this.g.debug("Preparing starts. AVPlay State: ",this.a.getState());this.a.getState()===dO?bN(this,_.Xn):this.g.error("AVPlay prepares while state is not IDLE")}G(){this.g.debug("Preparing ends: AVPlay state:",this.a.getState())}F(){bN(this,_.On)}getState(){return this.f}};var fO=class{constructor(){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 _.R("clpp.tizen.TextStreamer")}initialize(a){this.m=a}load(a){const b=this;return _.x(function*(){if(b.m)if(b.B=a,b.j=yield fN(b),b.j){var c={configurationId:"",networkingEngine:b.m.getNetworkEngine(),filterNewPeriod:()=>{},filterAllPeriods:()=>{},onTimelineCueAdded:()=>{},onEvent:()=>{},onError:()=>{}};try{b.a=yield b.j.start(a.url,c)}catch(d){b.g.warn(d);try{b.a=yield b.j.start(a.url.replace("https://",
33
- "http://"),c)}catch(e){b.g.error(e),b.a=null}}if(b.a&&gN(b.a)){b.h=hN(b);try{yield b.h.open();b.f=iN(b);const d=b.m.getConfiguration();b.f.h=d.streaming;b.o=d.preferredTextLanguage;b.A=d.preferredTextRole;b.C=d.preferForcedSubtitles}catch(d){b.g.debug("Could not setup media source..."),b.h=null,b.f=null,b.j=null,b.a=null}}}else b.g.debug("Could not find manifest parser for source. Make sure parsers are registered.");else b.g.debug("Text streamer is not initialized. Will not load()")})}G(a){this.g.debug(_.EA,
34
- a);this.w=!0;let b=_.hD(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}}F(){this.g.debug("canSwitch_");this.w=!1;this.l&&(_.QE(this.f,this.l,!0,0),this.l=null)}U(){this.g.debug("onError_")}H(){this.j&&this.j.update&&this.j.update()}start(){const a=this;return _.x(function*(){if(a.f)try{a.f.start()}catch(b){a.g.error("Error while starting streaming engine",b)}})}setTextVisibility(a){this.g.debug("Set text visibility",
35
- a);this.h&&this.h.getTextDisplayer().setTextVisibility(a)}release(){const a=this;return _.x(function*(){a.m=null;a.a=null;a.B=null;a.A=null;a.o=null;a.w=!0;a.l=null})}destroy(){const a=this;return _.x(function*(){a.j&&(yield a.j.stop(),a.j=null);a.f&&(yield a.f.destroy(),a.f=null,a.w=!0);a.h&&(yield a.h.destroy(),a.h=null)})}};var W=class extends _.S{constructor(){super();this.h=this.a=this.m=null;this.f={};this.g=new _.R("clpp.tizen.TrackManager");this.w=this.l=this.j=null;this.B=!1;this.o=1}C(a){var b=a.eventid;a=a.data;switch(b){case gO:0<Object.keys(this.f).length||(this.g.debug("Loading track manager!"),this.load());b=webapis.avplay.getCurrentStreamInfo();0<b.length&&(b=+pN(this,b[0].extra_info).Bit_rate,b=qN(this,{bandwidth:b}))&&(this.w=b,oN(this,b));break;case hO:nN(this);break;default:this.g.debug("Event type: "+
36
- b+" data: "+a)}}A(a){a.detail.currentState===_.Zn&&this.m.off(_.Nf,this.A)}initialize(a){this.m=a;this.a=this.m.a;this.m.on(_.Nf,b=>{this.B||(b=b.detail,b.currentState===_.Zn&&(this.g.debug("Current state",b.currentState),this.B=!0,rN(this)))});this.a.on(iO,this.C,this)}release(){this.f={};this.h=this.w=this.l=this.j=null;this.B=!1;this.o=1}load(){if(this.a&&!(0<Object.keys(this.f).length)){this.h=this.m.h;this.m.off(_.Nf,this.A);this.m.on(_.Nf,this.A,this);try{const a=FN(this.a);this.f=xN(this,a);
37
- const b=this.f[_.L]||[];b.length&&(this.j=b[0].renditions[0]||null);nN(this)}catch(a){this.g.debug("Could not load track manager")}}}destroy(){this.a.off(iO,this.C);this.a=this.m=null}getVideoTracks(){return this.f[_.N]||[]}getAudioTracks(){return this.f[_.L]||[]}ka(){return this.f[_.K]||[]}oa(){return AN(this,_.N)}Qa(){return AN(this,_.L)}Ia(){return AN(this,_.K)}cb(){return this.w}ob(){this.g.info(NM);return null}pb(){this.g.info(NM);return null}Ja(){const a=this.oa();return a?a.track:null}na(){const a=
38
- this.Qa();return a?a.track:null}ua(){const a=this.Ia();return a?a.track:null}jb(a){null===a?(a=this.oa(),HN(this.a,a.bandwidth,null).then(()=>{nN(this)})):0<a.renditions.length&&this.Ya(a.renditions[0])}wa(a){a?DN(this,a.renditions[0]):this.g.warn("Cannot disable audio tracks on this platform.","Consider muting audio instead...")}La(a){a?(a=a.renditions[0],this.h?mN(this.h,a.track):DN(this,a)):(this.g.debug("Disabling text tracks"),this.l=null,IN(this.a,!1),this.m.trigger(new _.E(_.Kk)))}Ya(a){const b=
39
- this.oa();this.a.o||a.width!==b.width||a.height!==b.height||a.bandwidth!==b.bandwidth?(this.w=a,oN(this,a),HN(this.a,b.bandwidth,a.bandwidth).then(()=>{nN(this)}).catch(c=>{const d=new _.H(_.F,7,7200,{tizenerror:c});this.g.debug("Error while switching video track",c);this.m.onError(d)})):this.g.debug("Trying to switch to already active rendition. Doing nothing...")}hb(a){DN(this,a)}ib(a){this.h?mN(this.h,a.track):DN(this,a)}addTextTrack(){}ra(){return this.a.o}};W.prototype.isAbrEnabled=W.prototype.ra;
40
- W.prototype.addTextTrack=W.prototype.addTextTrack;W.prototype.setTextRendition=W.prototype.ib;W.prototype.setAudioRendition=W.prototype.hb;W.prototype.setVideoRendition=W.prototype.Ya;W.prototype.setTextTrack=W.prototype.La;W.prototype.setAudioTrack=W.prototype.wa;W.prototype.setVideoTrack=W.prototype.jb;W.prototype.getTextTrack=W.prototype.ua;W.prototype.getAudioTrack=W.prototype.na;W.prototype.getVideoTrack=W.prototype.Ja;W.prototype.getLoadingTextRendition=W.prototype.pb;
41
- W.prototype.getLoadingAudioRendition=W.prototype.ob;W.prototype.getLoadingVideoRendition=W.prototype.cb;W.prototype.getTextRendition=W.prototype.Ia;W.prototype.getAudioRendition=W.prototype.Qa;W.prototype.getVideoRendition=W.prototype.oa;W.prototype.getTextTracks=W.prototype.ka;W.prototype.getAudioTracks=W.prototype.getAudioTracks;W.prototype.getVideoTracks=W.prototype.getVideoTracks;var mO=class extends _.ft{constructor(a){super();this.m=a;this.h=null;this.g=new _.R("clpp.tizen.Middleware");this.C=1;this.B=!1;this.l=null;this.F=0;this.o=!0;this.f=!1;this.a=null;this.A=1;this.w=!1;this.j={}}I(){this.w=!0;this.f||this.trigger(new _.E(UN))}H(a){this.w=!0;this.trigger(new _.E($N,{percent:a}))}G(){this.w=!1;this.trigger(new _.E(aO))}L(){this.trigger(new _.E(bO))}K(a,b){this.trigger(new _.E(iO,{eventid:a,data:b}))}N(a,b,c,d,e){this.trigger(new _.E(jO,{duration:a,text:b,subtitleType:c,
42
- attriCount:d,attributes:e}))}J(a,b){this.trigger(new _.E(kO,{drmType:a,drmData:b}));this.h&&(a=this.h,a.j&&(a.a===_.zd&&"Challenge"===b.name?WM(a,b):"DrmError"===b.name&&(a.g.debug("DrmError event",b),b=new _.H(_.F,6,6005,{message:JSON.stringify(b)}),a.D.onError(b))))}U(a){this.trigger(new _.E(lO,{eventType:a}))}play(){const a=this.getState(),b=()=>new Promise((c,d)=>{let e=null;const f=()=>{c();clearTimeout(e)};this.one(KN,f,this);e=setTimeout(()=>{this.off(KN,f);d("Timeout")},3E4)});if(a===dO)return(new Promise((c,
43
- d)=>{webapis.avplay.prepareAsync(()=>{MN(this);c(webapis.avplay.play())},e=>{this.trigger(new _.E(lO));d(e)})})).then(()=>b());if(a===dN||a===cO)try{return webapis.avplay.play(),b()}catch(c){return Promise.reject(c)}return a===cN?Promise.resolve():Promise.reject("Player is in invalid state")}pause(){try{webapis.avplay.pause()}catch(a){Promise.reject(a)}return this.getState()===dN?Promise.resolve():Promise.reject()}setPlaybackRate(a){const b=this.getState();if(b===cO||b===cN||b===dN){try{webapis.avplay.setSpeed(a),
44
- 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}getPlaybackRate(){return this.C}load(a,b){const c=this;return _.x(function*(){c.g.debug("configure()",b||"");try{yield RN(c),yield YN(c,a,b)}catch(d){throw new _.H(_.F,7,7003,null,d);}})}getState(){if(this.f&&this.a)return this.a.We;try{return webapis.avplay.getState()}catch(a){this.U(JSON.stringify(a))}}seek(a){const b=
45
- 1E3*a;return new Promise((c,d)=>{this.B=!0;this.m.trigger(new _.E(_.gg));webapis.avplay.seekTo(b,()=>{this.B=!1;this.m.trigger(new _.E(_.fg));c()},()=>{this.B=!1;d()})})}getPosition(){if(this.f&&this.a)return this.a.position;try{return webapis.avplay.getCurrentTime()/1E3}catch(a){this.U(JSON.stringify(a))}}getDuration(){if(this.f&&this.a)return this.a.duration;try{return webapis.avplay.getDuration()/1E3}catch(a){this.U(JSON.stringify(a))}}release(){return new Promise((a,b)=>{try{this.h&&(this.h.release(),
46
- this.h=null);webapis.avplay.stop();webapis.avplay.close();for(const c in this.j){const d=this.j[c];d&&d.Nd.stop()}this.j={};this.C=1;this.B=!1;this.a=this.l=null;return a()}catch(c){return b(c)}})}getVolume(){let a=null;try{a=tizen.tvaudiocontrol.getVolume()}catch(b){switch(b.name){case OM:this.g.debug("The application does not have the privilege to get the volume.",PM);break;default:this.g.debug(MM,b)}}return a}setVolume(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.",
47
- "The passed value value should be in the range of 0 to 1.");break;case OM:this.g.warn("The application does not have the privilege to set the volume.",PM);break;default:this.g.warn("An unknown error occurred while trying to set volume",b)}}}isLive(){if(this.f&&this.a)return this.a.isLive;try{return"1"===webapis.avplay.getStreamingProperty("IS_LIVE")}catch(a){this.U(JSON.stringify(a))}}stop(){try{webapis.avplay.stop()}catch(a){this.g.debug(a)}}getDrmInfo(){this.h&&this.h.getDrmInfo();return null}setSourceIndex(a){this.F=
48
- a}getSourceIndex(){return this.F}getLoadedSource(){return this.l&&this.l[this.getSourceIndex()]}},dO="IDLE",cO="READY",cN="PLAYING",dN="PAUSED",sN=_.Sb,tN="AUDIO",CN="TEXT",hO="PLAYER_MSG_RESOLUTION_CHANGED",gO="PLAYER_MSG_BITRATE_CHANGE",$M="PLAYREADY",VM="WIDEVINE_CDM";var qO=class extends _.ft{constructor(){super();this.a=new mO(this);this.f=new eO(this);this.configuration=this.B=_.Uk();this.w=null;this.g=new _.R("clpp.tizen.Player");this.j=null;this.l=new W;this.C=new _.ap;this.o=this.h=null;this.A=!1}H(){this.g.debug("On Stream completed. Current time: ",this.getPosition());this.trigger(new _.E(_.Vd));this.configuration.loop?this.seek(this.configuration.startTime||0).catch(()=>{this.g.debug("Could not loop playback")}):this.a.stop()}F(a){this.trigger(new _.E(_.Xf,
49
- {currentTime:a.currentTime/1E3}))}I(a){const b=this.a.getPosition(),c=b+a.duration/1E3;let d=a.text||"";this.g.debug("Got subtitles: ",d,"start:",b,"end:",c,a);(d=_.Bi(d))&&this.o.append([new _.Bs(b,c,d)],[])}G(a){this.g.debug("DRM event: "+a.drmType+", data: "+a.drmData)}J(){this.A||(this.g.debug("Initial buffering completed..."),this.A=!0)}U(a){this.g.debug(`Error: TYPE: ${a.eventType}`);bN(this.f,_.Vn);a=new _.H(_.F,7,7200,{tizenerror:a.eventType});this.a.release();this.trigger(new _.E(_.r,{detail:a}))}init(a,
50
- b){this.configuration=this.B=b;this.w=a;this.a.on(bO,this.H,this);this.a.on(KN,this.F,this);this.a.on(jO,this.I,this);this.a.on(kO,this.G,this);this.a.on(lO,this.U,this);this.a.on(aO,this.J,this);this.f.initialize();this.l.initialize(this);this.g.debug("Initializing player surface");this.w.hideMediaElement();a=nO;nO+=1;a="__clpp_tizen_player_"+a;this.j=_.uo(_.Fe,{id:a,type:"application/avplayer"});this.w.addElementToContainer(this.j,!0);var c=this.w.getMedia();if(c){a=this.j;{b=[_.Cg,_.Zd,"position",
51
- _.he,"top"];const e={};c=null!==c.parentElement?window.getComputedStyle(c,null):c.style;if(!b||0===b.length)for(d in b||(b=[]),c)b.push(d);for(const f of b)e[f]=c[f];var d=e}_.wo(a,d);ZN(this)}}getSurface(){return this.w}getConfiguration(){return this.configuration}getTimeline(){return null}setupPlaylist(){return Promise.reject(_.qb)}appendLoad(){return Promise.reject(_.qb)}seekWith(){return Promise.reject(_.qb)}destroy(){const a=this;return _.x(function*(){yield a.release();a.a.off(bO,a.H);a.a.off(KN,
52
- a.F);a.a.off(jO,a.I);a.a.off(kO,a.G);a.a.off(lO,a.U);a.a.off(aO,a.J);a.h&&(yield a.h.destroy(),a.h=null);a.j&&(a.j.parentElement.removeChild(a.j),a.j=null);a.l.destroy();a.f.destroy();a.l=null;a.f=null})}namespace(){return oO}getPlaybackRate(){return this.a.getPlaybackRate()}setDrmCustomDataModifier(){}setCdnErrorCallback(){}detach(){}setPlaybackRate(a){this.a.setPlaybackRate(a)}getPosition(){return this.getMediaPosition()}getMediaPosition(){return 0<(this.configuration.startTime||0)&&!this.A?0:this.f.getState()===
53
- _.On?this.getDuration():this.a.getPosition()||0}seek(a){return typeof a===_.t&&0<=a?(this.isLive()||(a=Math.min(a,this.getDuration())),this.a.seek(a)):Promise.reject()}getPresentationStartTime(){return null}getSeekRange(){return{start:0,end:0}}getVolume(){const a=this.a.getVolume();return typeof a===_.t?a/100:null}setVolume(a){this.a.setVolume(a)}getDuration(){return this.getMediaDuration()}getMediaDuration(){return this.a.getDuration()}getBufferInfo(){this.g.warn(_.qa);return new _.et}getTrackManager(){return this.l}unload(){return this.a.release().then(()=>
54
- {this.l.release()})}release(){const a=this;return _.x(function*(){a.h&&(yield a.h.release());a.o&&(yield a.o.destroy(),a.o=null);yield a.a.release();a.l.release();a.f.release();a.A=!1})}load(a){const b=this;return _.x(function*(){b.configuration=_.Wk(b.B,a);var c=_.En(b.configuration,[_.be,"native"]);b.o=c.create(b);c=_.bo(b.configuration)[0];if(b.configuration.tizen&&b.configuration.tizen.sideStreamText){b.h=new fO;b.h.initialize(b);try{yield b.h.load(c),b.h.start()}catch(d){b.g.error(d)}}try{yield b.a.load(b.configuration)}catch(d){throw b.onError(d),
55
- d;}b.l.load()})}play(){this.trigger(new _.E(_.Te));ZN(this);return this.a.play().then(()=>{eN(this.f)})}pause(){return this.a.pause().then(()=>{eN(this.f)})}getState(){return this.f.getState()}getPeriods(){return[]}onError(a){const b=new _.E(_.r,{detail:a});a.severity===_.F&&(bN(this.f,_.Vn),this.a.release());this.trigger(b);b.defaultPrevented&&(b.a=!0)}getDrmInfo(){return this.a.getDrmInfo()}isEnded(){return this.f.getState()===_.On}isPaused(){return this.a.getState()===dN}isMuted(){return PN(this.a)}setMuted(a){TN(this.a,
56
- a)}getNetworkEngine(){return this.C}setNetworkEngine(a){this.C=a}isLive(){return this.a.isLive()}getStats(){return null}setSourceIndex(a){this.a.setSourceIndex(a)}getSourceIndex(){return this.a.getSourceIndex()}getLoadedSource(){return this.a.getLoadedSource()}canPlay(a,b){return(new pO).canPlay(a,b)}getTimelineCues(){return[]}getTextDisplayer(){return this.o}resetAbr(){}};qO.prototype.getTextDisplayer=qO.prototype.getTextDisplayer;qO.prototype.setNetworkEngine=qO.prototype.setNetworkEngine;
57
- qO.prototype.getNetworkEngine=qO.prototype.getNetworkEngine;var oO="clpp.tizen",nO=0,pO=class{a(){return oO}canPlay(a){a=a.type;const b=!!window.webapis;if((a===_.zc||a===_.Ok||a===_.Ec)&&b){if(_.Xj(2))return 2;if(_.Xj(3)||_.Xj(4)||_.Xj(5)||_.Xj(6))return _.C("Use of clpp.tizen.TizenComponent is not recommended for Tizen version \x3e\x3d 3."),1}return 0}f(a){return a===_.na}create(){return new qO}};_.z("clpp.tizen.TizenComponent",class extends _.Yt{f(){_.mh(new pO)}a(){var a=oO;a&&_.kh[a]&&(delete _.kh[a],_.lh.info("Removed Player factory: '"+a+"'"))}id(){return"tizen"}});var UN="onbufferingstart",$N="onbufferingprogress",aO="onbufferingcomplete",bO="onstreamcompleted",KN="oncurrentplaytime",iO="onevent",jO="onsubtitlechange",kO="ondrmevent",lO="onerror",WN="preparingstart",XN="preparingend";};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";import './cl.mse.js';let g={};const _ = clpp._;var f=function(window){'use strict';var gN="An unknown error occurred while trying to get volume",hN="Cannot get loading rendition due to platform limitations",iN="SecurityError",jN="The require privilege is: http://tizen.org/privilege/tv.audio",kN="|STARTBITRATE\x3d",lN=function(a,b,c){const d=e=>{c.call(a,e);a.removeEventListener(b,d)};a.addEventListener(b,d)},oN=function(a){return _.w(function*(){if(a.a!==_.yd&&a.a!==_.wd)throw new _.G(_.E,6,6001,`The key system ${a.a} is not supported by `+"the player or the platform");
2
+ const b=a.f.get(a.a);if(!b.dd)throw new _.G(_.E,6,6012,`No license server given for ${a.a}`);try{a.a===_.yd?yield mN(a):yield nN(a,b),a.o={keySystem:a.a,licenseServerUri:b.dd,distinctiveIdentifierRequired:!1,persistentStateRequired:b.te,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[],keyIds:[],periodId:null}}catch(c){throw a.g.error(`Error while configuring CDM for ${a.a}`,c),new _.G(_.E,6,6005,{message:JSON.stringify(c)});}})},qN=function(a,b){_.w(function*(){var c=a.f.get(a.a);
3
+ a.g.debug("DRM Challenge data: ",b.challenge);const d=atob(b.challenge);var e=new Uint8Array(d.length);for(let h=0;h<d.length;++h)e[h]=d.charCodeAt(h);c=_.Si([b.serverurl&&""!==b.serverurl?b.serverurl:c.dd],_.Oi());c.type=3;c.body=e.buffer;c.method=_.vb;try{var f=yield a.D.Hb.fetch(c).W;if(a.j){var g=_.I(f.data);const h=g.byteLength;e="";for(f=0;f<h;f++)e+=String.fromCharCode(g[f]);const k=`${b.session_id}PARAM_START_POSITION`+`${btoa(e)}PARAM_START_POSITION`;a.g.debug("Widevine license params",k);
4
+ try{webapis.avplay.setDrm(pN,"widevine_license_data",k)}catch(l){a.g.error("License response rejected by CDM");const m=new _.G(_.E,6,6008,{browserError:JSON.stringify(l)});a.D.onError(m)}}}catch(h){a.g.error("License request failed.",JSON.stringify(h)),g=new _.G(_.E,6,6007,{message:_.Sa,url:h.data.url,status:h.data.status||NaN,response:h.data.response||"",headers:h.data.headers||{}},h),a.D.onError(g)}})},mN=function(a){return _.w(function*(){try{webapis.avplay.setDrm(pN,"Initialize",""),webapis.avplay.setDrm(pN,
5
+ "widevine_app_session",a.l.id),webapis.avplay.setDrm(pN,"widevine_data_type",a.l.type)}catch(b){throw b;}})},nN=function(a,b){return _.w(function*(){var c={};c[rN]=!b.te;c[sN]=b.dd;""!==b.customData&&(c[tN]=b.customData);c=JSON.stringify(c);a.g.debug("PlayReady properties: ",c);try{webapis.avplay.setDrm(uN,"SetProperties",c)}catch(d){throw d;}})},vN=function(a){return _.w(function*(){tizen.systeminfo.getPropertyValue("DISPLAY",b=>{a.A=b.resolutionWidth/1920;a.g.debug("Display resolution ratio: ",
6
+ a.A)},b=>{a.g.debug("Could not load DISPLAY property");throw b;})})},xN=function(a){try{webapis.avplay.setListener({onbufferingstart:a.I.bind(a),onbufferingprogress:a.H.bind(a),onbufferingcomplete:a.G.bind(a),onstreamcompleted:a.L.bind(a),oncurrentplaytime:b=>{a.trigger(new _.C(wN,{currentTime:b}))},onevent:a.K.bind(a),onsubtitlechange:a.M.bind(a),ondrmevent:a.J.bind(a),onerror:a.T.bind(a)})}catch(b){a.g.error(b)}},yN=function(a){const b=!!a.m.getTrackManager().Ka();try{webapis.avplay.setSilentSubtitle(!b)}catch(c){a.g.debug("Could not set AVPlay subtitle config",
7
+ c)}},zN=function(a,b){try{const c=b.estimatedBandwidth||0,d=b.currentBandwidth||0;a.g.debug({estimatedBandwidth:c,Sh:d});0!==c&&0!==d&&c>=1.15*d&&webapis.avplay.setStreamingProperty("ADAPTIVE_INFO",kN+d)}catch(c){a.g.debug(c)}},AN=function(a,b){try{webapis.avplay.setStreamingProperty("ADAPTIVE_INFO","|BITRATES\x3d"+b+kN+b)}catch(c){throw a.g.debug("Could not set fixed bandwidth",c),c;}},BN=function(a){let b=null;try{b=tizen.tvaudiocontrol.isMute()}catch(c){switch(c.name){case iN:a.g.warn("The application doesn't have the privilege to get the mute state.",
8
+ jN);break;default:a.g.warn(gN,c)}}return!!b},CN=function(a){return a.f&&a.a?a.a.Dh:webapis.avplay.getTotalTrackInfo()},DN=function(a){return a.f&&a.a?a.a.qg:webapis.avplay.getCurrentStreamInfo()},EN=function(a){return{position:a.getPosition(),state:a.m.getState(),Xe:a.getState(),playbackRate:a.getPlaybackRate(),isLive:a.isLive(),duration:a.getDuration(),isMuted:BN(a),volume:a.getVolume(),Dh:CN(a),qg:DN(a)}},FN=function(){return new Promise((a,b)=>{if(window.webapis)a();else{const c=document.createElement("script");
9
+ lN(c,_.qe,d=>a(d));lN(c,_.Vd,d=>b(d));c.src="$WEBAPIS/webapis/webapis.js";document.querySelector("head").appendChild(c)}})},GN=function(a){return _.w(function*(){yield FN();const b=new Promise(c=>{(new _.Wj(c)).fa(5)});if(!(yield Promise.race([vN(a).then(()=>!0),b.then(()=>!1)])))return a.g.debug("Took to long for the SDK to be ready"),Promise.reject("SDK Timeout")})},HN=function(a){return _.w(function*(){a.g.debug("avplay.prepare()");return new Promise((b,c)=>{try{webapis.avplay.prepareAsync(()=>
10
+ {a.g.debug("AVPlay is ready!");yN(a);b()},d=>{a.g.debug("prepareAsync failed",d);c(d)})}catch(d){a.g.debug("Failed to prepare media player for playback"),c(d)}})})},IN=function(a,b){try{tizen.tvaudiocontrol.setMute(b)}catch(c){switch(c.name){case iN:a.g.warn("The application does not have the privilege to set mute.",jN);break;default:a.g.warn(gN,c)}}},NN=function(a,b,c){return _.w(function*(){a.l=_.jo(b);const d=a.F,e=c||{estimatedBandwidth:0,currentBandwidth:0,nextBandwidth:null,currentPosition:0};
11
+ a.g.debug(`Loading manifest URL: ${a.l[d].url}`);let f=b.startTime||void 0;a.f&&(a.trigger(new _.C(JN)),f=c.currentPosition);try{let g=a.l[d].url;if(a.l[d].type===_.Bc&&!g.includes(".mpd")){const h=new URL(g);h.searchParams.append("cl-ext",".mpd");g=h.toString()}webapis.avplay.open(g);e.nextBandwidth?(AN(a,e.nextBandwidth),a.o=!1):(a.o||zN(a,e),a.o=!0);xN(a);if(b.drm&&b.drm.env){const h={onError:k=>a.m.onError(k),Hb:a.m.getNetworkEngine()};a.h=new KN(b.drm,h);yield a.h.init()}else a.g.debug("No DRM configuration was provided. Assuming clear content");
12
+ a.f||a.trigger(new _.C(LN));yield HN(a);a.f||a.trigger(new _.C(MN));f&&typeof f===_.r&&0<f&&a.seek(f).catch(h=>{a.g.debug("Couldn't set start position",h)});a.f||(b.volume&&a.setVolume(b.volume),b.muted&&IN(a,b.muted),b.autoplay&&a.m.play().catch(h=>{a.g.debug("Autoplay failed",h)}))}catch(g){throw a.g.debug("Error while attempting to load source."),g;}})},PN=function(a,b,c){a.g.debug("switchVideoTrack()");try{const d={estimatedBandwidth:parseInt(webapis.avplay.getStreamingProperty("CURRENT_BANDWITH"),
13
+ 10),currentBandwidth:b,nextBandwidth:c,currentPosition:a.getPosition()};a.a=EN(a);a.f=!0;webapis.avplay.stop();webapis.avplay.close();return a.load(a.m.getConfiguration(),d).then(()=>{const e=a.a.Xe;a.f=!1;a.a=null;return e===ON?a.pause():a.play()})}catch(d){return Promise.reject(d)}},QN=function(a,b){var c=a.m.getTextDisplayer();c&&c.setTextVisibility(b);c=a.m.h;try{c||webapis.avplay.setSilentSubtitle(!b)}catch(d){a.g.debug("Could not set text track visibility",d)}},SN=function(a,b,c){b=b.toUpperCase();
14
+ b===RN&&QN(a,!0);const d=a.j[b];d&&(d.Ld.stop(),a.j[b]=null,a.g.debug(`Cancelled pending track switch for ${b}`));return new Promise((e,f)=>{const g=(h,k,l)=>{l=void 0===l?!1:l;try{webapis.avplay.setSelectTrack(h,k),a.j[h]=null,e()}catch(m){a.g.debug(`Could not set ${h} track. Trying again...`+`AVPlay state: ${a.getState()}, `+`buffering: ${a.w}`,m),!1===l&&(a.j[h]={type:h,index:k,Ue:0,Ld:new _.Wj(()=>g(h,c,!0))}),(k=a.j[h])&&3>k.Ue?(!a.w&&++k.Ue,k.Ld.fa(a.w?.5:.25)):(a.g.debug("Could not set track after multiple attempts.Giving up..."),
15
+ k&&k.Ld.stop(),a.j[h]=null,f())}};g(b,c)})},UN=function(a,b){if(a.f!==b)if(a.f===_.bo&&b!==_.co)a.g.debug(_.nA+`${TN(b)}`);else{var c=(new Date).getTime();a.j=a.f;a.f=b;a.f===_.Yn?(a.o=(new Date).getTime(),a.m.trigger(new _.C(_.Wc,{detail:{bufferedTimeMS:-1,reason:a.h}}))):a.j===_.Yn&&a.m.trigger(new _.C(_.Sc,{detail:{bufferedTimeMS:c-a.o,reason:a.h}}));b={currentState:a.f,previousState:a.j,timeSinceLastStateChangeMS:c-a.w};a.w=c;a.m.trigger(new _.C(_.Mf,{detail:b}));a.g.debug("State changed:",TN(a.j),
16
+ "-\x3e",TN(a.f))}},TN=function(a){return Object.keys(_.ao)[a]},WN=function(a){if(a.l){var b=a.a.getState(),c=a.f;switch(b){case VN:c=_.go;break;case ON:c=_.fo;break;default:a.m.isEnded()?c=_.Vn:a.g.debug("Inconsistent AVPlay playback state:",b)}UN(a,c)}},XN=function(a){return _.w(function*(){const b=a.m.getConfiguration();let c;(c=yield _.mp(a.B.url,a.m.getNetworkEngine(),b.manifest.attemptParameters,a.B.type||null))&&c.configure(b.manifest);return c})},YN=function(a){if(!a)return!1;a=a.periods;let b=
17
+ !1;for(let c=0;c<a.length;c++)b=b||0<a[c].textStreams.length;return b},ZN=function(a){const b=document.createElement(_.t),c=new _.TG,d=new _.$F,e=a.m.getTextDisplayer();return new _.VG(b,c,e,d,a.m.getConfiguration())},$N=function(a){const b={configuration:{},Lb:()=>a.m.getPosition(),$:a.h,Hb:a.m.getNetworkEngine(),ne:a.G.bind(a),me:a.F.bind(a),onError:a.T.bind(a),zf:()=>{},onEvent:()=>{},Df:a.H.bind(a),Gd:()=>{},ud:()=>new _.LH,Rd:()=>!1,Rc:null};return new _.mH(a.a,b)},aO=function(a){const b=a.m.getPosition();
18
+ let c=null;for(const d of a.a.periods)d.startTime<=b&&(c=d);return c},bO=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=[];c=0;for(d=0;d<a.length;d++){const e=new _.jj(String(c++),_.J);e.mimeType=a[d].mimeType;e.language=a[d].language;e.roles=a[d].roles;e.kind=a[d].kind||_.VA;const f=new _.tj(String(a[d].id),
19
+ e);f.bandwidth=a[d].bandwidth||null;e.renditions.push(f);b.push(e)}return b},cO=function(a){if(a.h&&!a.h.getTextDisplayer().isTextVisible())return null;if(a.f){const b=_.hE(a.f,_.F);let c=null;if(b){a=bO(a);for(let 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},dO=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===_.Xd,a.a&&a.f)){a.setTextVisibility(!0);const c=aO(a),d=b.renditions[0];(b=
20
+ c.textStreams.find(e=>String(e.id)===d.id))?(a.w?(a.g.debug("Switching period defer text selection"),a.l=b):(_.tE(a.f,b,!0,0),a.m.trigger(new _.C(_.Nk))),a.o=b.language):a.g.error(_.mA,d.id)}},eO=function(a){const b=a.ma();b&&a.m.trigger(new _.C(_.Pc,{detail:{width:b.width,height:b.height,bandwidth:b.bandwidth,rendition:b}}))},fO=function(a,b){a.m.trigger(new _.C(_.sg,{details:{width:b.width,height:b.height,bandwidth:b.bandwidth,track:b.track,abrSelection:a.a.o}}))},gO=function(a,b){let c=null;try{c=
21
+ JSON.parse(b)}catch(d){a.g.warn("Couldn't retrieve extra infos from stream."),c=null}return c},hO=function(a,b){a=a.f[_.L]||[];const c=[];for(let d=0;d<a.length;d++)for(let e=0;e<a[d].renditions.length;e++)_.Zg(a[d].renditions[e],b,Object.keys(b))&&c.push(a[d].renditions[e]);return c[0]||null},iO=function(a){const b=a.m.getConfiguration();var c=_.yh(b.preferredAudioLanguage||[]);const d=a.f[_.K]||[];if(d.length){var e=null;c.some(g=>{e=_.pB(g,d.map(h=>h.language));return!!e});if(e){var f=d.filter(g=>
22
+ g.language===e);c=f[0];1<f.length&&b.preferredAudioRole&&(f=f.filter(g=>0<=g.roles.indexOf(b.preferredAudioRole)),0<f.length&&(c=f[0]));a.g.debug("Setting audio track with preferred language:",e);a.va(c)}else a.g.debug("Preferred language(s) not available")}else a.g.debug("Could not set preferred audio language")},mO=function(a,b){var c=(l,m)=>{for(let n=0;n<l.length;n++)if(l[n].language===m)return l[n];return null};const d={};if(0>=b.length)return d;var e=b.filter(l=>l.type===_.Tb),f=b.filter(l=>
23
+ l.type===_.Oz);const g=[];for(var h=0;h<f.length;h++){const l=gO(a,f[h].extra_info);if(l){var k=_.$h(l.language||_.ag);k=_.fj(k);k=c(g,k);k||(k=new _.jj(String(a.o++),_.K),g.push(k));k.renditions.push(jO(f[h].index,l,k))}else a.g.warn("Skipping audio stream with no extra info")}c=new _.jj(String(a.o++),_.L);for(f=0;f<e.length;f++)(h=gO(a,e[f].extra_info))?c.renditions.push(kO(e[f].index,h,c)):a.g.warn("Skipping video stream with no extra info");e=[];e=a.h?bO(a.h):lO(a,b);d[_.L]=[c];d[_.K]=g;d[_.J]=
24
+ e;return d},oO=function(a,b){if(b===_.J&&a.h)return cO(a.h);var c=DN(a.a)||[];if(0===c.length)return null;c=c.filter(e=>e.type===b.toUpperCase())[0];var d=null;b===_.L&&(d=gO(a,c.extra_info),d=hO(a,{width:d.Width,height:d.Height}));b===_.K&&(c?(d=nO(a,c,_.K),a.j=d):d=a.j);b===_.J&&(c?(d=nO(a,c,_.J),a.l=d):d=a.l);return d},pO=function(a,b){if(b){const c=b.track.type.toUpperCase();SN(a.a,c,Number(b.id)).then(()=>{c===_.Oz&&(a.j=b,a.m.trigger(new _.C(_.Mk)));c===RN&&(a.l=b,a.m.trigger(new _.C(_.Nk)))}).catch(()=>
25
+ {a.g.error("Could not select "+c+" track.")})}else a.g.debug("Must provide valid rendition")},jO=function(a,b,c){const d=_.$h(b.language||_.ag);c.language=_.fj(d);c.originalLanguage=d;c.channelsCount=b.channels?Number(b.channels):null;c.mimeType=_.Lc;a=new _.tj(String(a),c);a.track=c;a.codec=b.fourCC||null;a.bandwidth=b.bit_rate||null;return a},kO=function(a,b,c){c.mimeType=_.qg;a=new _.tj(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):
26
+ null;a.codec=b.fourCC||null;return a},qO=function(a,b,c){b=_.$h(b.track_lang||_.ag);c.mimeType="text/ttml";c.language=_.fj(b);c.originalLanguage=b;c.kind=_.VA;return new _.tj(String(a),c)},lO=function(a,b){b=b.filter(d=>d.type===RN);const c=[];for(let d=0;d<b.length;d++){const e=gO(a,b[d].extra_info);if(!e){a.g.warn("Skipping text stream with no extra info");continue}const f=new _.jj(String(a.o++),_.J);f.renditions.push(qO(b[d].index,e,f));c.push(f)}return c},nO=function(a,b,c){a=a.f[c]||[];b=String(b.index);
27
+ c=null;for(let d=0;d<a.length;d++)for(let e=0;e<a[d].renditions.length;e++)if(a[d].renditions[e].id===b){c=a[d].renditions[e];break}return c},rO=function(a){if("NONE"!==a.a.getState()){var b=a.j.getBoundingClientRect();{a=a.a;const c=Math.floor(b.left*a.A),d=Math.floor(b.top*a.A),e=Math.floor(b.width*a.A);b=Math.floor(b.height*a.A);a.g.debug("Setting display area to","x:",c,"y:",d,"width:",e,"height:",b);webapis.avplay.setDisplayRect(c,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 "+
28
+ a.a.getState())},KN=class{constructor(a,b){this.h=a;this.o=null;this.a=_.Ee;this.l=null;this.j=!1;this.f=new Map;this.D=b;this.g=new _.R("clpp.tizen.DrmEngine")}init(){const a=this;return _.w(function*(){var b=_.ul[a.h.env]||null;if(!b)throw a.g.debug(_.va,_.zb+a.h.env+_.aa),new _.G(_.E,6,6015,`DRM environment '${a.h.env}' is missing.`);a.l={id:String(Math.floor(1E4*Math.random())),type:"MPEG-DASH"};var c=Object.keys(a.h.customData||{}).length?btoa(JSON.stringify(a.h.customData)):"";b=_.wl(b,a.h.customData);
29
+ const d=b[_.wd];d&&a.f.set(_.wd,{dd:d.licenseUrl||"",customData:c,te:!1});(b=b[_.yd])&&a.f.set(_.yd,{dd:b.licenseUrl||"",customData:c,te:!1});if(0===a.f.size)throw new _.G(_.E,6,6E3);if((c=a.h.preferredDrmSystem)&&a.f.get(c))a.a=c;else if(a.f.get(_.wd))a.a=_.wd;else if(a.f.get(_.yd))a.a=_.yd;else throw new _.G(_.E,6,6001,"Configuration for the target system is missing.");yield oN(a);a.j=!0})}release(){const a=this;return _.w(function*(){a.j=!1;a.o=null;a.a=_.Ee;a.l=null;a.f=new Map})}getDrmInfo(){return this.o}},
30
+ rN="DeleteLicenseAfterUse",sN="LicenseServer",tN="CustomData";var BO=class extends _.rt{constructor(a){super();this.m=a;this.h=null;this.g=new _.R("clpp.tizen.Middleware");this.C=1;this.B=!1;this.l=null;this.F=0;this.o=!0;this.f=!1;this.a=null;this.A=1;this.w=!1;this.j={}}I(){this.w=!0;this.f||this.trigger(new _.C(JN))}H(a){this.w=!0;this.trigger(new _.C(sO,{percent:a}))}G(){this.w=!1;this.trigger(new _.C(tO))}L(){this.trigger(new _.C(uO))}K(a,b){this.trigger(new _.C(vO,{eventid:a,data:b}))}M(a,b,c,d,e){this.trigger(new _.C(wO,{duration:a,text:b,subtitleType:c,
31
+ attriCount:d,attributes:e}))}J(a,b){this.trigger(new _.C(xO,{drmType:a,drmData:b}));this.h&&(a=this.h,a.j&&(a.a===_.yd&&"Challenge"===b.name?qN(a,b):"DrmError"===b.name&&(a.g.debug("DrmError event",b),b=new _.G(_.E,6,6005,{message:JSON.stringify(b)}),a.D.onError(b))))}T(a){this.trigger(new _.C(yO,{eventType:a}))}play(){const a=this.getState(),b=()=>new Promise((c,d)=>{let e=null;const f=()=>{c();clearTimeout(e)};this.one(wN,f,this);e=setTimeout(()=>{this.off(wN,f);d("Timeout")},3E4)});if(a===zO)return(new Promise((c,
32
+ d)=>{webapis.avplay.prepareAsync(()=>{yN(this);c(webapis.avplay.play())},e=>{this.trigger(new _.C(yO));d(e)})})).then(()=>b());if(a===ON||a===AO)try{return webapis.avplay.play(),b()}catch(c){return Promise.reject(c)}return a===VN?Promise.resolve():Promise.reject("Player is in invalid state")}pause(){try{webapis.avplay.pause()}catch(a){Promise.reject(a)}return this.getState()===ON?Promise.resolve():Promise.reject()}setPlaybackRate(a){const b=this.getState();if(b===AO||b===VN||b===ON){try{webapis.avplay.setSpeed(a),
33
+ 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}getPlaybackRate(){return this.C}load(a,b){const c=this;return _.w(function*(){c.g.debug("configure()",b||"");try{yield GN(c),yield NN(c,a,b)}catch(d){throw new _.G(_.E,7,7003,null,d);}})}getState(){if(this.f&&this.a)return this.a.Xe;try{return webapis.avplay.getState()}catch(a){this.T(JSON.stringify(a))}}seek(a){const b=
34
+ 1E3*a;return new Promise((c,d)=>{this.B=!0;this.m.trigger(new _.C(_.gg));webapis.avplay.seekTo(b,()=>{this.B=!1;this.m.trigger(new _.C(_.fg));c()},()=>{this.B=!1;d()})})}getPosition(){if(this.f&&this.a)return this.a.position;try{return webapis.avplay.getCurrentTime()/1E3}catch(a){this.T(JSON.stringify(a))}}getDuration(){if(this.f&&this.a)return this.a.duration;try{return webapis.avplay.getDuration()/1E3}catch(a){this.T(JSON.stringify(a))}}release(){return new Promise((a,b)=>{try{this.h&&(this.h.release(),
35
+ this.h=null);webapis.avplay.stop();webapis.avplay.close();for(const c in this.j){const d=this.j[c];d&&d.Ld.stop()}this.j={};this.C=1;this.B=!1;this.a=this.l=null;return a()}catch(c){return b(c)}})}getVolume(){let a=null;try{a=tizen.tvaudiocontrol.getVolume()}catch(b){switch(b.name){case iN:this.g.debug("The application does not have the privilege to get the volume.",jN);break;default:this.g.debug(gN,b)}}return a}setVolume(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.",
36
+ "The passed value value should be in the range of 0 to 1.");break;case iN:this.g.warn("The application does not have the privilege to set the volume.",jN);break;default:this.g.warn("An unknown error occurred while trying to set volume",b)}}}isLive(){if(this.f&&this.a)return this.a.isLive;try{return"1"===webapis.avplay.getStreamingProperty("IS_LIVE")}catch(a){this.T(JSON.stringify(a))}}stop(){try{webapis.avplay.stop()}catch(a){this.g.debug(a)}}getDrmInfo(){this.h&&this.h.getDrmInfo();return null}setSourceIndex(a){this.F=
37
+ a}getSourceIndex(){return this.F}getLoadedSource(){return this.l&&this.l[this.getSourceIndex()]}},zO="IDLE",AO="READY",VN="PLAYING",ON="PAUSED",RN="TEXT",uN="PLAYREADY",pN="WIDEVINE_CDM";var CO=class{constructor(a){this.m=a;this.a=this.m.a;this.f=_.co;this.j=_.Mt;this.w=(new Date).getTime();this.l=!1;this.o=-1;this.h=2;this.g=new _.R("clpp.tizen.StateManager")}initialize(){this.a.on(JN,this.C,this);this.a.on(sO,this.B,this);this.a.on(tO,this.A,this);this.a.on(LN,this.H,this);this.a.on(MN,this.G,this);this.a.on(uO,this.F,this)}release(){UN(this,_.co);this.l=!1;this.o=-1;this.h=2}destroy(){this.release();this.a.off(JN,this.C);this.a.off(sO,this.B);this.a.off(tO,this.A);this.a.off(LN,
38
+ this.H);this.a.off(MN,this.G);this.a.off(uO,this.F);this.m=this.a=null}C(){this.g.debug("Buffering start. Player state: ",this.a.getState());this.h=this.a.B?1:2;UN(this,_.Yn)}B(a){this.g.debug("Buffering progress: "+a.percent+" %. Player state: ",TN(this.f))}A(){this.g.debug("Buffering complete. Player state: ",this.a.getState());if(!this.l){this.l=!0;var a=this.m.getConfiguration().autoplay;const b=this.a.getState()===AO;if(!a&&b){UN(this,_.fo);return}}if(a=this.f!==_.eo)a=this.a.getState(),a=a===
39
+ VN||a===ON;a&&WN(this)}H(){this.g.debug("Preparing starts. AVPlay State: ",this.a.getState());this.a.getState()===zO?UN(this,_.eo):this.g.error("AVPlay prepares while state is not IDLE")}G(){this.g.debug("Preparing ends: AVPlay state:",this.a.getState())}F(){UN(this,_.Vn)}getState(){return this.f}};var JN="onbufferingstart",sO="onbufferingprogress",tO="onbufferingcomplete",uO="onstreamcompleted",wN="oncurrentplaytime",vO="onevent",wO="onsubtitlechange",xO="ondrmevent",yO="onerror",LN="preparingstart",MN="preparingend";var DO=class{constructor(){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 _.R("clpp.tizen.TextStreamer")}initialize(a){this.m=a}load(a){const b=this;return _.w(function*(){if(b.m)if(b.B=a,b.j=yield XN(b),b.j){var c={configurationId:"",networkingEngine:b.m.getNetworkEngine(),filterNewPeriod:()=>{},filterAllPeriods:()=>{},onEvent:()=>{},onError:()=>{}};try{b.a=yield b.j.start(a.url,c)}catch(d){b.g.warn(d);try{b.a=yield b.j.start(a.url.replace("https://",
40
+ "http://"),c)}catch(e){b.g.error(e),b.a=null}}if(b.a&&YN(b.a)){b.h=ZN(b);try{yield b.h.open();b.f=$N(b);const d=b.m.getConfiguration();b.f.h=d.streaming;b.o=d.preferredTextLanguage;b.A=d.preferredTextRole;b.C=d.preferForcedSubtitles}catch(d){b.g.debug("Could not setup media source..."),b.h=null,b.f=null,b.j=null,b.a=null}}}else b.g.debug("Could not find manifest parser for source. Make sure parsers are registered.");else b.g.debug("Text streamer is not initialized. Will not load()")})}G(a){this.g.debug(_.MA,
41
+ a);this.w=!0;let b=_.pD(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}}F(){this.g.debug("canSwitch_");this.w=!1;this.l&&(_.tE(this.f,this.l,!0,0),this.l=null)}T(){this.g.debug("onError_")}H(){this.j&&this.j.update&&this.j.update()}start(){const a=this;return _.w(function*(){if(a.f)try{a.f.start()}catch(b){a.g.error("Error while starting streaming engine",b)}})}setTextVisibility(a){this.g.debug("Set text visibility",
42
+ a);this.h&&this.h.getTextDisplayer().setTextVisibility(a)}release(){const a=this;return _.w(function*(){a.m=null;a.a=null;a.B=null;a.A=null;a.o=null;a.w=!0;a.l=null})}destroy(){const a=this;return _.w(function*(){a.j&&(yield a.j.stop(),a.j=null);a.f&&(yield a.f.destroy(),a.f=null,a.w=!0);a.h&&(yield a.h.destroy(),a.h=null)})}};var W=class extends _.S{constructor(){super();this.h=this.a=this.m=null;this.f={};this.g=new _.R("clpp.tizen.TrackManager");this.w=this.l=this.j=null;this.B=!1;this.o=1}C(a){var b=a.eventid;a=a.data;switch(b){case "PLAYER_MSG_BITRATE_CHANGE":0<Object.keys(this.f).length||(this.g.debug("Loading track manager!"),this.load());b=webapis.avplay.getCurrentStreamInfo();0<b.length&&(b=+gO(this,b[0].extra_info).Bit_rate,b=hO(this,{bandwidth:b}))&&(this.w=b,fO(this,b));break;case "PLAYER_MSG_RESOLUTION_CHANGED":eO(this);
43
+ break;default:this.g.debug("Event type: "+b+" data: "+a)}}A(a){a.detail.currentState===_.go&&this.m.off(_.Mf,this.A)}initialize(a){this.m=a;this.a=this.m.a;this.m.on(_.Mf,b=>{this.B||(b=b.detail,b.currentState===_.go&&(this.g.debug("Current state",b.currentState),this.B=!0,iO(this)))});this.a.on(vO,this.C,this)}release(){this.f={};this.h=this.w=this.l=this.j=null;this.B=!1;this.o=1}load(){if(this.a&&!(0<Object.keys(this.f).length)){this.h=this.m.h;this.m.off(_.Mf,this.A);this.m.on(_.Mf,this.A,this);
44
+ try{const a=CN(this.a);this.f=mO(this,a);const b=this.f[_.K]||[];b.length&&(this.j=b[0].renditions[0]||null);eO(this)}catch(a){this.g.debug("Could not load track manager")}}}destroy(){this.a.off(vO,this.C);this.a=this.m=null}getVideoTracks(){return this.f[_.L]||[]}getAudioTracks(){return this.f[_.K]||[]}ha(){return this.f[_.J]||[]}ma(){return oO(this,_.L)}Ta(){return oO(this,_.K)}Ka(){return oO(this,_.J)}jb(){return this.w}zb(){this.g.info(hN);return null}Ab(){this.g.info(hN);return null}La(){const a=
45
+ this.ma();return a?a.track:null}la(){const a=this.Ta();return a?a.track:null}ta(){const a=this.Ka();return a?a.track:null}ub(a){null===a?(a=this.ma(),PN(this.a,a.bandwidth,null).then(()=>{eO(this)})):0<a.renditions.length&&this.ab(a.renditions[0])}va(a){a?pO(this,a.renditions[0]):this.g.warn("Cannot disable audio tracks on this platform.","Consider muting audio instead...")}Na(a){a?(a=a.renditions[0],this.h?dO(this.h,a.track):pO(this,a)):(this.g.debug("Disabling text tracks"),this.l=null,QN(this.a,
46
+ !1),this.m.trigger(new _.C(_.Nk)))}ab(a){const b=this.ma();this.a.o||a.width!==b.width||a.height!==b.height||a.bandwidth!==b.bandwidth?(this.w=a,fO(this,a),PN(this.a,b.bandwidth,a.bandwidth).then(()=>{eO(this)}).catch(c=>{const d=new _.G(_.E,7,7200,{tizenerror:c});this.g.debug("Error while switching video track",c);this.m.onError(d)})):this.g.debug("Trying to switch to already active rendition. Doing nothing...")}sb(a){pO(this,a)}tb(a){this.h?dO(this.h,a.track):pO(this,a)}addTextTrack(){}pa(){return this.a.o}};
47
+ W.prototype.isAbrEnabled=W.prototype.pa;W.prototype.addTextTrack=W.prototype.addTextTrack;W.prototype.setTextRendition=W.prototype.tb;W.prototype.setAudioRendition=W.prototype.sb;W.prototype.setVideoRendition=W.prototype.ab;W.prototype.setTextTrack=W.prototype.Na;W.prototype.setAudioTrack=W.prototype.va;W.prototype.setVideoTrack=W.prototype.ub;W.prototype.getTextTrack=W.prototype.ta;W.prototype.getAudioTrack=W.prototype.la;W.prototype.getVideoTrack=W.prototype.La;
48
+ W.prototype.getLoadingTextRendition=W.prototype.Ab;W.prototype.getLoadingAudioRendition=W.prototype.zb;W.prototype.getLoadingVideoRendition=W.prototype.jb;W.prototype.getTextRendition=W.prototype.Ka;W.prototype.getAudioRendition=W.prototype.Ta;W.prototype.getVideoRendition=W.prototype.ma;W.prototype.getTextTracks=W.prototype.ha;W.prototype.getAudioTracks=W.prototype.getAudioTracks;W.prototype.getVideoTracks=W.prototype.getVideoTracks;var HO=class extends _.rt{constructor(){super();this.a=new BO(this);this.f=new CO(this);this.configuration=this.B=_.al();this.w=null;this.g=new _.R("clpp.tizen.Player");this.j=null;this.l=new W;this.C=new _.gr;this.o=this.h=null;this.A=!1}H(){this.g.debug("On Stream completed. Current time: ",this.getPosition());this.trigger(new _.C(_.Ud));this.configuration.loop?this.seek(this.configuration.startTime||0).catch(()=>{this.g.debug("Could not loop playback")}):this.a.stop()}F(a){this.trigger(new _.C(_.Xf,
49
+ {currentTime:a.currentTime/1E3}))}I(a){const b=this.a.getPosition(),c=b+a.duration/1E3;let d=a.text||"";this.g.debug("Got subtitles: ",d,"start:",b,"end:",c,a);(d=_.Ai(d))&&this.o.append([new _.ft(b,c,d)],[])}G(a){this.g.debug("DRM event: "+a.drmType+", data: "+a.drmData)}J(){this.A||(this.g.debug("Initial buffering completed..."),this.A=!0)}T(a){this.g.debug(`Error: TYPE: ${a.eventType}`);UN(this.f,_.bo);a=new _.G(_.E,7,7200,{tizenerror:a.eventType});this.a.release();this.trigger(new _.C(_.Vd,{detail:a}))}init(a,
50
+ b){this.configuration=this.B=b;this.w=a;this.a.on(uO,this.H,this);this.a.on(wN,this.F,this);this.a.on(wO,this.I,this);this.a.on(xO,this.G,this);this.a.on(yO,this.T,this);this.a.on(tO,this.J,this);this.f.initialize();this.l.initialize(this);this.g.debug("Initializing player surface");this.w.hideMediaElement();a=EO;EO+=1;a="__clpp_tizen_player_"+a;this.j=_.Dp(_.Fe,{id:a,type:"application/avplayer"});this.w.addElementToContainer(this.j,!0);var c=this.w.getMedia();if(c){a=this.j;{b=[_.Dg,_.$d,"position",
51
+ _.ge,"top"];const e={};c=null!==c.parentElement?window.getComputedStyle(c,null):c.style;if(!b||0===b.length)for(d in b||(b=[]),c)b.push(d);for(const f of b)e[f]=c[f];var d=e}_.Fp(a,d);rO(this)}}getSurface(){return this.w}getConfiguration(){return this.configuration}getTimeline(){return null}setupPlaylist(){return Promise.reject(_.qb)}appendLoad(){return Promise.reject(_.qb)}seekWith(){return Promise.reject(_.qb)}setSeekInterceptor(){}destroy(){const a=this;return _.w(function*(){yield a.release();
52
+ a.a.off(uO,a.H);a.a.off(wN,a.F);a.a.off(wO,a.I);a.a.off(xO,a.G);a.a.off(yO,a.T);a.a.off(tO,a.J);a.h&&(yield a.h.destroy(),a.h=null);a.j&&(a.j.parentElement.removeChild(a.j),a.j=null);a.l.destroy();a.f.destroy();a.l=null;a.f=null})}namespace(){return FO}getPlaybackRate(){return this.a.getPlaybackRate()}setDrmCustomDataModifier(){}setCdnErrorCallback(){}detach(){}setPlaybackRate(a){this.a.setPlaybackRate(a)}getPosition(){return this.getMediaPosition()}getMediaPosition(){return 0<(this.configuration.startTime||
53
+ 0)&&!this.A?0:this.f.getState()===_.Vn?this.getDuration():this.a.getPosition()||0}seek(a){return typeof a===_.r&&0<=a?(this.isLive()||(a=Math.min(a,this.getDuration())),this.a.seek(a)):Promise.reject()}getPresentationStartTime(){return null}getSeekRange(){return{start:0,end:0}}getVolume(){const a=this.a.getVolume();return typeof a===_.r?a/100:null}setVolume(a){this.a.setVolume(a)}getDuration(){return this.getMediaDuration()}getMediaDuration(){return this.a.getDuration()}getBufferInfo(){this.g.warn(_.qa);
54
+ return new _.qt}getTrackManager(){return this.l}unload(){return this.a.release().then(()=>{this.l.release()})}release(){const a=this;return _.w(function*(){a.h&&(yield a.h.release());a.o&&(yield a.o.destroy(),a.o=null);yield a.a.release();a.l.release();a.f.release();a.A=!1})}load(a){const b=this;return _.w(function*(){b.configuration=_.dl(b.B,a);var c=_.Ln(b.configuration,[_.ce,"native"]);b.o=c.create(b);c=_.jo(b.configuration)[0];if(b.configuration.tizen&&b.configuration.tizen.sideStreamText){b.h=
55
+ new DO;b.h.initialize(b);try{yield b.h.load(c),b.h.start()}catch(d){b.g.error(d)}}try{yield b.a.load(b.configuration)}catch(d){throw b.onError(d),d;}b.l.load()})}play(){this.trigger(new _.C(_.Te));rO(this);return this.a.play().then(()=>{WN(this.f)})}pause(){return this.a.pause().then(()=>{WN(this.f)})}getState(){return this.f.getState()}getPeriods(){return[]}onError(a){const b=new _.C(_.Vd,{detail:a});a.severity===_.E&&(UN(this.f,_.bo),this.a.release());this.trigger(b);b.defaultPrevented&&(b.a=!0)}getDrmInfo(){return this.a.getDrmInfo()}isEnded(){return this.f.getState()===
56
+ _.Vn}isPaused(){return this.a.getState()===ON}isMuted(){return BN(this.a)}setMuted(a){IN(this.a,a)}getNetworkEngine(){return this.C}setNetworkEngine(a){this.C=a}setCmsdManager(){}isLive(){return this.a.isLive()}getStats(){return null}setSourceIndex(a){this.a.setSourceIndex(a)}getSourceIndex(){return this.a.getSourceIndex()}getLoadedSource(){return this.a.getLoadedSource()}canPlay(a,b){return(new GO).canPlay(a,b)}getTimelineCues(){return[]}getCueTimeline(){return null}getTextDisplayer(){return this.o}resetAbr(){}};
57
+ HO.prototype.getTextDisplayer=HO.prototype.getTextDisplayer;HO.prototype.setNetworkEngine=HO.prototype.setNetworkEngine;HO.prototype.getNetworkEngine=HO.prototype.getNetworkEngine;var FO="clpp.tizen",EO=0,GO=class{a(){return FO}canPlay(a){a=a.type;const b=!!window.webapis;if((a===_.Bc||a===_.Rk||a===_.Gc)&&b){if(_.ak(2))return 2;if(_.ak(3)||_.ak(4)||_.ak(5)||_.ak(6))return _.B("Use of clpp.tizen.TizenComponent is not recommended for Tizen version \x3e\x3d 3."),1}return 0}f(a){return a===_.na}create(){return new HO}};_.x("clpp.tizen.TizenComponent",class extends _.su{f(){_.Vk(new GO)}a(){var a=FO;a&&_.Tk[a]&&(delete _.Tk[a],_.Uk.info("Removed Player factory: '"+a+"'"))}id(){return"tizen"}});};f.call(g, window);
package/cl.ttml.js CHANGED
@@ -1,22 +1,22 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Qv='application/mp4; codecs\x3d"stpp.ttml"',Rv='application/mp4; codecs\x3d"stpp.ttml.im1i"',Sv='application/mp4; codecs\x3d"stpp.ttml.im1t"',Tv="backgroundColor",Uv="direction",Vv="displayAlign",Wv="region",Xv="textAlign",Yv="textDecoration",Zv="writingMode",$v=function(a,b,c){a=a.f;for(let d=a.length-1;0<=d;d--){const e=b.get(a[d]);if(c in e.a)return e.getAttribute(c)}return null},hw=function(a,b){var c=null;if(aw.test(a)){{a=aw.exec(a);c=Number(a[1]);const d=Number(a[2]);let e=
2
- Number(a[3]),f=Number(a[4]);f+=(Number(a[5])||0)/b.f;e+=f/b.frameRate;c=e+60*d+3600*c}}else bw.test(a)?c=cw(bw,a):dw.test(a)?c=cw(dw,a):ew.test(a)?(a=ew.exec(a),c=Number(a[1])/b.frameRate):fw.test(a)?(a=fw.exec(a),c=Number(a[1])/b.a):gw.test(a)&&(c=cw(gw,a));return c},cw=function(a,b){a=a.exec(b);return null==a||""===a[0]?null:(Number(a[4])||0)/1E3+(Number(a[3])||0)+60*(Number(a[2])||0)+3600*(Number(a[1])||0)},iw=function(a){return a.split(":").pop()},jw=function(a){return a.replace(/(\d*\.?\d+)c/g,
3
- "$1em")},lw=function(a,b){for(;kw.test(a);){const c=kw.exec(a)[0];a=a.replace(c,`${parseInt(c,10)/b}em`)}return a},mw=function(a){return a?a.replace(/(\d*\.?\d+)%/g,(b,c)=>`${c/100}em`):""},nw=function(a,b,c){a=$v(a,b,Xv);if(!a&&c&&(a=$v(c,b,Xv),!a&&"rltb"===$v(c,b,Zv)))return _.zf;switch(a){case _.ad:return _.ws;case _.zf:case _.Ud:return _.zf;default:return _.he}},ow=function(a,b,c){if(_.xi(a.w))return document.createTextNode(_.Bi(a.w||""));if(a.A)return _.uo("br");const d=_.uo("span");for(const e of a.f)_.vo(d,
4
- e);for(const e of a.j)d.appendChild(ow(c.get(e),b,c));return d},rw=function(a,b,c,d){const e=pw.exec(a);a=qw.exec(a);return typeof b===_.t&&0<b&&a?100*Number(a[c])/b:e?Number(e[c]):a?Number(a[c]):d},sw=function(a,b){return typeof b===_.t&&0<b?_.Es:qw.test(a)?0:_.Es},tw=function(a,b,c){return typeof a===_.t?a:typeof b===_.t?b:c},uw=function(a,b){a=a.getAttribute("extent");return(a=qw.exec(a))?Number(a[b]):null},ww=function(a){a=a.getAttribute("cellResolution");return(a=vw.exec(a))?Number(a[2]):null},
5
- yw=function(){return`${"inline-"}${xw++}`},Aw=function(a){return zw.some(b=>b in a.attributes)},Bw=function(a,b){if(0===b.length)return[];const c=[];for(const d of b)a.a.has(d)&&c.push(...Bw(a,a.a.get(d).f),d);return c},Cw=function(a){return iw(a.h.nodeName)},Fw=function(a,b){if(a.a.has(b))return a.a.get(b);var c=null,d=null;let e=[],f=[],g={};const h=b.parentNode;if(h&&a.a.has(h)){const k=a.a.get(h);e=[...k.l];-1===["#text","span","br"].indexOf(b.nodeName)&&(c=k.a,d=k.j,f=[...k.f],g={},Dw.forEach(l=>
6
- {l in k.attributes&&(g[l]=k.attributes[l])}))}if(b.nodeType===b.ELEMENT_NODE){b.hasAttribute(Wv)&&(c=b.getAttribute(Wv));b.hasAttribute(_.Sf)&&f.push(...b.getAttribute(_.Sf).split(" "));d=Array.from(b.attributes).map(k=>k.name);for(const k of d)d=iw(k),g[d]=b.getAttribute(k);d=g.backgroundImage}c=new Ew(b,c,d,e,f,g);a.a.set(b,c);return c},Gw=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*
7
- a%1E3)).padStart(3,"0")}`},Hw=class{constructor(a,b,c){this.h=a;this.f=b;this.a=c}getId(){return this.h}getAttribute(a){return this.a[a]}};var Iw=class extends Hw{constructor(a,b,c){super(a,[],c);this.j=b||""}};var Jw=class extends Hw{constructor(a,b,c){super(a,b,c)}};var aw=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,bw=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,dw=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d+)$/,ew=/^(\d*(?:\.\d*)?)f$/,fw=/^(\d*(?:\.\d*)?)t$/,gw=/^(?:(\d*(?:\.\d*)?)h)?(?:(\d*(?:\.\d*)?)m)?(?:(\d*(?:\.\d*)?)s)?(?:(\d*(?:\.\d*)?)ms)?$/,pw=/^(\d{1,2}(?:\.\d+)?|100(?:\.0+)?)% (\d{1,2}(?:\.\d+)?|100(?:\.0+)?)%$/,qw=/^(\d+)px (\d+)px$/,vw=/^(\d+) (\d+)$/,kw=/(\d+)px/,Kw=/^(\d+px|\d+em|\d*\.?\d+c)$/,zw=[Tv,"color",Uv,Vv,"fontFamily","fontSize","fontStyle","fontWeight",
8
- "lineHeight","opacity","padding",Xv,Yv,"textOutline",Zv,"zIndex"],Dw=["begin",_.Ud];var Lw=class extends Jw{constructor(a,b,c,d,e,f,g){super(a,f,g);this.w=b;this.A=c;this.o=d;this.l=e;this.j=[]}build(a,b,c,d,e,f,g){let h=hw(this.a.begin,b);b=hw(this.a.end,b);if(null===h||null===b)return null;h+=c;b+=c;c=_.uo(_.Gd);for(const k of this.j)c.appendChild(ow(g.get(k),e,g));g=new _.Bs(h,b,c.innerHTML.trim(),_.Zf);g.cssClassList=[...this.f];g.textAlign=nw(this,e,null);g.writingMode=_.xs;g.line=-1;g.lineInterpretation=_.ys;g.lineAlign=_.zs;g.containerRows=tw(null,ww(a),15);if(this.o&&(f=
9
- f.get(this.o))){g.region=f.build(a,e);g.textAlign=nw(this,e,f);a:switch($v(f,e,Zv)){case "tb":case "tblr":a=_.ig;break a;case "tbrl":a=_.jg;break a;default:a=_.xs}g.writingMode=a;a:switch($v(f,e,Vv)){case _.ad:a=50;break a;case "after":a=-1;break a;default:a=0}g.line=a;a:switch($v(f,e,Vv)){case _.ad:a=1;break a;default:a=_.ys}g.lineInterpretation=a;a:switch($v(f,e,Vv)){case _.ad:e=_.ad;break a;default:e=_.zs}g.lineAlign=e}this.l&&(d=d.get(this.l))&&(a=d,d=a.getAttribute("encoding"),e=a.getAttribute("imageType")||
10
- a.getAttribute("imagetype"),a=a.j.trim(),d="PNG"===e&&"Base64"===d&&0<a.length?`data:image/png;base64,${a}`:null,g.backgroundImage=d||"");return g}};var Mw=class{constructor(a,b,c,d){this.frameRate=Number(a)||30;this.f=Number(b)||1;this.a=Number(d);0===this.a&&(this.a=a?this.frameRate*this.f:1);c&&(a=/^(\d+) (\d+)$/g.exec(c))&&(this.frameRate*=Number(a[1])/Number(a[2]))}};var Nw=class extends Jw{constructor(a,b,c){super(a,b,c)}build(a,b){const c=new _.Gs;c.id=this.getId();const d=tw(a.j.containerWidth,uw(a,1),720);a=tw(a.j.containerHeight,uw(a,2),480);a:switch($v(this,b,Vv)){case "after":var e="flex-start";break a;case _.ad:e=_.ad;break a;default:e="flex-end"}c.displayAlign=e;a:switch($v(this,b,Zv)){case "tb":case "tblr":e="row-reverse";break a;case "tbrl":e="row";break a;default:e=_.td}c.writingMode=e;e=this.getAttribute("extent")||$v(this,b,"extent");c.width=rw(e,
11
- d,1,100);c.widthUnits=sw(e,d);c.height=rw(e,a,2,100);c.heightUnits=sw(e,a);b=this.getAttribute("origin")||$v(this,b,"origin");c.viewportAnchorX=rw(b,d,1,0);c.viewportAnchorY=rw(b,a,2,0);c.viewportAnchorUnits=sw(b,d);c.cssClassList=[...this.f];return c}};var Ow=class extends Hw{constructor(a,b){super("root-container",[],b);this.j=a}};var Qw=class extends Hw{constructor(a,b,c){super(a,b,c)}build(a){var b=null;var c=ww(a);c&&(b=tw(a.j.containerHeight,uw(a,2),480)/c);b=tw(a.j.fontSizeRadix,b,16);a=[];c=`::ttml .${this.h}, ::ttml .${this.h} * {`;for(const [g,h]of Pw.entries())g in this.a&&(c+=`${h}:${jw(this.a[g])};`);a:{if("unicodeBidi"in this.a){var d=this.a.unicodeBidi;var e="";switch(d){case "normal":case "embed":e=d;break;case "bidiOverride":e="bidi-override"}if(0<e.length){d=`unicode-bidi:${e};`;break a}}d=""}c+=d;a:{if("textOutline"in
12
- this.a){d=this.a.textOutline.split(" ");e="black";let g=".4em";const h=d[0]&&d[0].trim(),k=d[1]&&d[1].trim(),l=d[2]&&d[2].trim();3===d.length&&!Kw.test(h)&&Kw.test(k)&&Kw.test(l)?(e=h,g=k):2===d.length&&!Kw.test(h)&&Kw.test(k)?(e=h,g=k):2===d.length&&Kw.test(h)&&Kw.test(k)&&(g=h);if(""!==g){g=jw(g);d="text-shadow:"+`0 0 ${g} ${e},`+`0 0 ${g} ${e},`+`0 0 ${g} ${e};`;break a}}d=""}c+=d;"textShadow"in this.a?(d=mw(this.a.textShadow),d=jw(d),d=`text-shadow:${d};`):d="";c=c+d+("fontFamily"in this.a?`font-family:${this.a.fontFamily.replace("monospaceSansSerif",
13
- "monospace").replace("monospaceSerif","monospace").replace("proportionalSansSerif","sans-serif").replace("proportionalSerif","sans-serif").replace("sansSerif","sans-serif").replace("default","sans-serif")};`:"");a:{if(Yv in this.a){d=this.a.textDecoration.split(" ");e=[];for(f of d)switch(f){case "underline":case "overline":e.push(f);break;case "lineThrough":e.push("line-through")}if(0<e.length){var f=`text-decoration:${e.join(" ")};`;break a}}f=""}"padding"in this.a?(d="border: solid transparent;border-width:"+
14
- jw(this.a.padding),d+=";"):d="";f=c=c+f+d;"lineHeight"in this.a?(c="",d=this.a.lineHeight,d=jw(d),d=lw(d,b),c+="line-height:",c+=d,c+=";"):c="";a.push(f+c+"}");a:{if("fontSize"in this.a&&(f=this.a.fontSize.split(" "),c=null,1===f.length&&(c=f[0]),2===f.length&&(c=f[1]),c)){c=c.trim();c=jw(c);c=lw(c,b);b=`font-size:${c};`;break a}b=null}b&&(f=`::ttml .${this.h} .clpp-text-wrapper {`,f+=b,f+="}",a.push(f),f=`::ttml .clpp-text-wrapper__${this.h} {`,f+=b,f+="}",a.push(f));return a}},Pw=new Map([[Tv,"background-color"],
15
- ["color","color"],[Uv,Uv],["fontStyle","font-style"],["fontWeight","font-weight"],["opacity","opacity"],["zIndex","z-index"]]);var Rw=class{constructor(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=[]}Rc(){return this.o.map(a=>a.build(this.l,this.w,this.A,this.h,this.a,this.j,this.f)).filter(a=>null!=a)}},xw=0;var Uw=class{constructor(a){this.a=a.firstChild;this.f=new Set}Dc(){return!!this.a}next(){if(!this.a)return null;let a=this.a;do this.f.add(a),a.nodeType!==Node.TEXT_NODE&&!Sw.has(iw(a.nodeName))||Tw.has(iw(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&&!Sw.has(iw(a.nodeName))));const b=this.a;this.a=a;return b}},Sw=new Set(["tt","head","layout",_.ye,_.de,Wv,"styling",_.Sf,"body",
16
- _.Gd,"p","span","br"]),Tw=new Set([_.Sf,_.de]);var Ew=class{constructor(a,b,c,d,e,f){this.h=a;this.a=b;this.j=c;this.l=d;this.f=e;this.attributes=f}getId(){return this.attributes.id}};var Vw=class{constructor(){this.a=new Map}};var Ww=class{constructor(a){this.a=a;this.f=new DOMParser}parseInit(){}parseMedia(a,b,c){c&&c.length||(c=[a.byteLength]);var d=_.Qg(this.a.ttml||{}),e=_.J(a,0,c[0]);e=_.oi(e);if(""===e)return{cues:[],styles:[]};var f=null;try{f=this.f.parseFromString(e,_.Wf)}catch(m){throw new _.H(_.F,2,2005,"Failed to parse TTML.");}d=new Rw(d);e=new Vw;f=new Uw(f);b=b.periodStart;typeof b===_.t&&(d.A=b);b=c[0];for(var g=1;g<c.length;++g){var h=c[g],k=_.J(a,b,h);k=_.Ci(k);const m=`urn:mpeg:14496-30:subs:${g}`;d.h.set(m,
17
- new Iw(m,k,{imageType:"PNG",encoding:"Base64"}));b+=h}for(;f.Dc();)a=f.next(),a=Fw(e,a),c=d,b=a,"tt"===Cw(b)&&(c.l=new Ow(c.B,Object.assign({},b.attributes))),c=d,b=a,"tt"===Cw(b)&&(c.w=new Mw(b.attributes.frameRate,b.attributes.subFrameRate,b.attributes.frameRateMultiplier,b.attributes.tickRate)),c=d,b=a,Cw(b)!==_.de||b.attributes.begin||b.attributes.end||(g=`#${b.getId()}`,c.h.set(g,new Iw(g,b.h.textContent,b.attributes))),c=d,g=a,Cw(g)===_.de&&g.attributes.begin&&g.attributes.end?(b=`#${yw()}`,
18
- g=new Iw(b,g.h.textContent,g.attributes),c.h.set(b,g),c=g):c=null,c&&(a.j=c.getId()),c=d,b=a,Cw(b)===_.Sf&&(g=b.getId()||yw(),h=new Qw(g,b.f,Object.assign({},b.attributes)),c.a.set(g,h),b.a&&c.j.get(b.a).f.push(g)),c=d,g=a,Cw(g)!==_.Sf&&Aw(g)?(b=yw(),g=new Qw(b,[],Object.assign({},g.attributes)),c.a.set(b,g),c=g):c=null,c&&a.f.push(c.getId()),c=d,g=a,Cw(g)!==_.Gd||!g.attributes.extent&&!g.attributes.origin?c=null:(b=yw(),g=new Nw(b,Bw(c,g.f),Object.assign({},g.attributes)),c.j.set(b,g),c=g),c&&(a.a=
19
- c.getId()),c=d,g=a,Cw(g)!==Wv?c=null:(b=g.getId(),g=new Nw(b,Bw(c,g.f),Object.assign({},g.attributes)),c.j.set(b,g),c=g),c&&(a.a=c.getId()),c=d,g=a,b=g.l,-1===["#text","span","br"].indexOf(Cw(g))||0===b.length?c=null:(h=b[b.length-1],c.f.has(h)?(b=yw(),g=new Lw(b,"#text"===g.h.nodeName?g.h.textContent:null,"br"===Cw(g),g.a,g.j,Bw(c,g.f),g.attributes),c.f.set(b,g),(c=c.f.get(h))&&c.j.push(b),c=g):c=null),c&&a.l.push(c.getId()),c=d,g=a,"p"===Cw(g)||g.j?(b=yw(),g=new Lw(b,null,!1,g.a,g.j,Bw(c,g.f),g.attributes),
20
- c.f.set(b,g),c.o.push(g),c=g):c=null,c&&a.l.push(c.getId());e=d.Rc();f=[];for(l of d.a.values())f.push(...l.build(d.l));var l=f;return{cues:e,styles:l}}};var Xw=class{constructor(a){this.f=a}a(a){var b=new Ww(this.f);({cues:a}=b.parseMedia(a,{periodStart:0,segmentStart:null,segmentEnd:0}));b="WEBVTT\n\n";for(const d of a){a=b;b=Gw(d.startTime)+" --\x3e "+Gw(d.endTime);{var c=d;const e=[];switch(c.textAlign){case _.he:e.push("align:left");break;case _.zf:e.push("align:right");break;case _.ws:e.push("align:middle");break;case _.he:e.push("align:start");break;case _.zf:e.push("align:end")}switch(c.writingMode){case _.ig:e.push("vertical:lr");break;case _.jg:e.push("vertical:rl")}c=
21
- e.length?" "+e.join(" "):""}b=a+(b+c+"\n");b+=d.payload+"\n\n"}return _.si(b)}},Yw=class{probe(a,b){return a===_.Dc&&b===_.Vf}create(a){return new Xw(a)}};var Zw=class{constructor(a){this.a=new Ww(a);this.g=new _.R("clpp.ttml.Mp4TtmlParser")}parseInit(a){let b=!1;(new _.Ml).M(_.Be,_.Fl).M(_.Yf,_.Fl).M(_.we,_.Fl).M(_.Ae,_.Fl).M(_.Pf,_.Fl).ca(_.Rf,_.Gl).M("stpp",c=>{b=!0;c.parser.stop()}).parse(a);if(!b)throw new _.H(_.F,2,2007);}parseMedia(a,b){let c=!1,d=[],e=[];const f=[];(new _.Ml).M("moof",_.Fl).M("traf",_.Fl).ca("subs",g=>{const h=_.P(g.reader);for(let k=0;k<h;++k){g.reader.skip(4);const l=_.yl(g.reader);for(let m=0;m<l;++m){const n=1===g.version?
22
- _.P(g.reader):_.yl(g.reader);f.push(n);g.reader.skip(6)}}}).M(_.ve,_.Hl(g=>{c=!0;g=this.a.parseMedia(g,b,f);d=d.concat(g.cues);e=e.concat(g.styles)})).parse(a);c||this.g.warn("Couldn't find the mdat box");return{cues:d,styles:e}}};_.z("clpp.ttml.TtmlComponent",class extends _.Yt{constructor(){super();this.j=new Yw}f(){_.gs(_.Dc,Ww);_.gs(_.Bc,Zw);_.gs(Qv,Zw);_.gs(Sv,Zw);_.gs(Rv,Zw);_.Dj.push(this.j)}a(){_.is(_.Dc);_.is(_.Bc);_.is(Qv);_.is(Sv);_.is(Rv);_.Fj(this.j)}id(){return"subtitles-ttml"}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Vv='application/mp4; codecs\x3d"stpp.ttml"',Wv='application/mp4; codecs\x3d"stpp.ttml.im1i"',Xv='application/mp4; codecs\x3d"stpp.ttml.im1t"',Yv="backgroundColor",Zv="direction",$v="displayAlign",aw="region",bw="textAlign",cw="textDecoration",dw="writingMode",lw=function(a,b){var c=null;if(ew.test(a)){{a=ew.exec(a);c=Number(a[1]);const d=Number(a[2]);let e=Number(a[3]),f=Number(a[4]);f+=(Number(a[5])||0)/b.f;e+=f/b.frameRate;c=e+60*d+3600*c}}else fw.test(a)?c=gw(fw,a):hw.test(a)?
2
+ c=gw(hw,a):iw.test(a)?(a=iw.exec(a),c=Number(a[1])/b.frameRate):jw.test(a)?(a=jw.exec(a),c=Number(a[1])/b.a):kw.test(a)&&(c=gw(kw,a));return c},gw=function(a,b){a=a.exec(b);return null==a||""===a[0]?null:(Number(a[4])||0)/1E3+(Number(a[3])||0)+60*(Number(a[2])||0)+3600*(Number(a[1])||0)},mw=function(a){return a.split(":").pop()},nw=function(a){return a.replace(/(\d*\.?\d+)c/g,"$1em")},pw=function(a,b){for(;ow.test(a);){const c=ow.exec(a)[0];a=a.replace(c,`${parseInt(c,10)/b}em`)}return a},qw=function(a){return a?
3
+ a.replace(/(\d*\.?\d+)%/g,(b,c)=>`${c/100}em`):""},rw=function(a,b,c){a=a.f;for(let d=a.length-1;0<=d;d--){const e=b.get(a[d]);if(c in e.a)return e.getAttribute(c)}return null},sw=function(a,b,c){a=rw(a,b,bw);if(!a&&c&&(a=rw(c,b,bw),!a&&"rltb"===rw(c,b,dw)))return _.yf;switch(a){case _.cd:return _.at;case _.yf:case _.Td:return _.yf;default:return _.ge}},tw=function(a,b,c){if(_.wi(a.w))return document.createTextNode(_.Ai(a.w||""));if(a.A)return _.Dp("br");const d=_.Dp("span");for(const e of a.f)_.Ep(d,
4
+ e);for(const e of a.j)d.appendChild(tw(c.get(e),b,c));return d},ww=function(a,b,c,d){const e=uw.exec(a);a=vw.exec(a);return typeof b===_.r&&0<b&&a?100*Number(a[c])/b:e?Number(e[c]):a?Number(a[c]):d},xw=function(a,b){return typeof b===_.r&&0<b?_.it:vw.test(a)?0:_.it},yw=function(a,b,c){return typeof a===_.r?a:typeof b===_.r?b:c},zw=function(a,b){a=a.getAttribute("extent");return(a=vw.exec(a))?Number(a[b]):null},Bw=function(a){a=a.getAttribute("cellResolution");return(a=Aw.exec(a))?Number(a[2]):null},
5
+ Dw=function(){return`${"inline-"}${Cw++}`},Fw=function(a){return Ew.some(b=>b in a.attributes)},Gw=function(a,b){if(0===b.length)return[];const c=[];for(const d of b)a.a.has(d)&&c.push(...Gw(a,a.a.get(d).f),d);return c},Hw=function(a){return a.o.map(b=>b.build(a.l,a.w,a.A,a.h,a.a,a.j,a.f)).filter(b=>null!=b)},Iw=function(a){return mw(a.h.nodeName)},Lw=function(a,b){if(a.a.has(b))return a.a.get(b);var c=null,d=null;let e=[],f=[],g={};const h=b.parentNode;if(h&&a.a.has(h)){const k=a.a.get(h);e=[...k.l];
6
+ -1===["#text","span","br"].indexOf(b.nodeName)&&(c=k.a,d=k.j,f=[...k.f],g={},Jw.forEach(l=>{l in k.attributes&&(g[l]=k.attributes[l])}))}if(b.nodeType===b.ELEMENT_NODE){b.hasAttribute(aw)&&(c=b.getAttribute(aw));b.hasAttribute(_.Rf)&&f.push(...b.getAttribute(_.Rf).split(" "));d=Array.from(b.attributes).map(k=>k.name);for(const k of d)d=mw(k),g[d]=b.getAttribute(k);d=g.backgroundImage}c=new Kw(b,c,d,e,f,g);a.a.set(b,c);return c},Mw=function(a){return`${String(Math.floor(a/3600)).padStart(2,"0")}:${String(Math.floor(a/
7
+ 60%60)).padStart(2,"0")}:${String(Math.floor(a%60)).padStart(2,"0")}.${String(Math.floor(1E3*a%1E3)).padStart(3,"0")}`},ew=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,fw=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,hw=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d+)$/,iw=/^(\d*(?:\.\d*)?)f$/,jw=/^(\d*(?:\.\d*)?)t$/,kw=/^(?:(\d*(?:\.\d*)?)h)?(?:(\d*(?:\.\d*)?)m)?(?:(\d*(?:\.\d*)?)s)?(?:(\d*(?:\.\d*)?)ms)?$/,uw=/^(\d{1,2}(?:\.\d+)?|100(?:\.0+)?)% (\d{1,2}(?:\.\d+)?|100(?:\.0+)?)%$/,vw=/^(\d+)px (\d+)px$/,Aw=/^(\d+) (\d+)$/,
8
+ ow=/(\d+)px/,Nw=/^(\d+px|\d+em|\d*\.?\d+c)$/,Ew=[Yv,"color",Zv,$v,"fontFamily","fontSize","fontStyle","fontWeight","lineHeight","opacity","padding",bw,cw,"textOutline",dw,"zIndex"],Jw=["begin",_.Td];var Ow=class{constructor(a,b,c){this.h=a;this.f=b;this.a=c}getId(){return this.h}getAttribute(a){return this.a[a]}};var Pw=class extends Ow{constructor(a,b,c){super(a,b,c)}};var Qw=class extends Pw{constructor(a,b,c,d,e,f,g){super(a,f,g);this.w=b;this.A=c;this.o=d;this.l=e;this.j=[]}build(a,b,c,d,e,f,g){let h=lw(this.a.begin,b);b=lw(this.a.end,b);if(null===h||null===b)return null;h+=c;b+=c;c=_.Dp(_.Fd);for(const k of this.j)c.appendChild(tw(g.get(k),e,g));g=new _.ft(h,b,c.innerHTML.trim(),_.Zf);g.cssClassList=[...this.f];g.textAlign=sw(this,e,null);g.writingMode=_.bt;g.line=-1;g.lineInterpretation=_.ct;g.lineAlign=_.dt;g.containerRows=yw(null,Bw(a),15);if(this.o&&(f=
9
+ f.get(this.o))){g.region=f.build(a,e);g.textAlign=sw(this,e,f);a:switch(rw(f,e,dw)){case "tb":case "tblr":a=_.kg;break a;case "tbrl":a=_.lg;break a;default:a=_.bt}g.writingMode=a;a:switch(rw(f,e,$v)){case _.cd:a=50;break a;case "after":a=-1;break a;default:a=0}g.line=a;a:switch(rw(f,e,$v)){case _.cd:a=1;break a;default:a=_.ct}g.lineInterpretation=a;a:switch(rw(f,e,$v)){case _.cd:e=_.cd;break a;default:e=_.dt}g.lineAlign=e}this.l&&(d=d.get(this.l))&&(a=d,d=a.getAttribute("encoding"),e=a.getAttribute("imageType")||
10
+ a.getAttribute("imagetype"),a=a.j.trim(),d="PNG"===e&&"Base64"===d&&0<a.length?`data:image/png;base64,${a}`:null,g.backgroundImage=d||"");return g}};var Rw=class extends Ow{constructor(a,b,c){super(a,[],c);this.j=b||""}};var Sw=class{constructor(a,b,c,d){this.frameRate=Number(a)||30;this.f=Number(b)||1;this.a=Number(d);0===this.a&&(this.a=a?this.frameRate*this.f:1);c&&(a=/^(\d+) (\d+)$/g.exec(c))&&(this.frameRate*=Number(a[1])/Number(a[2]))}};var Tw=class extends Pw{constructor(a,b,c){super(a,b,c)}build(a,b){const c=new _.kt;c.id=this.getId();const d=yw(a.j.containerWidth,zw(a,1),720);a=yw(a.j.containerHeight,zw(a,2),480);a:switch(rw(this,b,$v)){case "after":var e="flex-start";break a;case _.cd:e=_.cd;break a;default:e="flex-end"}c.displayAlign=e;a:switch(rw(this,b,dw)){case "tb":case "tblr":e="row-reverse";break a;case "tbrl":e="row";break a;default:e=_.sd}c.writingMode=e;e=this.getAttribute("extent")||rw(this,b,"extent");c.width=ww(e,
11
+ d,1,100);c.widthUnits=xw(e,d);c.height=ww(e,a,2,100);c.heightUnits=xw(e,a);b=this.getAttribute("origin")||rw(this,b,"origin");c.viewportAnchorX=ww(b,d,1,0);c.viewportAnchorY=ww(b,a,2,0);c.viewportAnchorUnits=xw(b,d);c.cssClassList=[...this.f];return c}};var Uw=class extends Ow{constructor(a,b){super("root-container",[],b);this.j=a}};var Ww=class extends Ow{constructor(a,b,c){super(a,b,c)}build(a){var b=null;var c=Bw(a);c&&(b=yw(a.j.containerHeight,zw(a,2),480)/c);b=yw(a.j.fontSizeRadix,b,16);a=[];c=`::ttml .${this.h}, ::ttml .${this.h} * {`;for(const [g,h]of Vw.entries())g in this.a&&(c+=`${h}:${nw(this.a[g])};`);a:{if("unicodeBidi"in this.a){var d=this.a.unicodeBidi;var e="";switch(d){case "normal":case "embed":e=d;break;case "bidiOverride":e="bidi-override"}if(0<e.length){d=`unicode-bidi:${e};`;break a}}d=""}c+=d;a:{if("textOutline"in
12
+ this.a){d=this.a.textOutline.split(" ");e="black";let g=".4em";const h=d[0]&&d[0].trim(),k=d[1]&&d[1].trim(),l=d[2]&&d[2].trim();3===d.length&&!Nw.test(h)&&Nw.test(k)&&Nw.test(l)?(e=h,g=k):2===d.length&&!Nw.test(h)&&Nw.test(k)?(e=h,g=k):2===d.length&&Nw.test(h)&&Nw.test(k)&&(g=h);if(""!==g){g=nw(g);d="text-shadow:"+`0 0 ${g} ${e},`+`0 0 ${g} ${e},`+`0 0 ${g} ${e};`;break a}}d=""}c+=d;"textShadow"in this.a?(d=qw(this.a.textShadow),d=nw(d),d=`text-shadow:${d};`):d="";c=c+d+("fontFamily"in this.a?`font-family:${this.a.fontFamily.replace("monospaceSansSerif",
13
+ "monospace").replace("monospaceSerif","monospace").replace("proportionalSansSerif","sans-serif").replace("proportionalSerif","sans-serif").replace("sansSerif","sans-serif").replace("default","sans-serif")};`:"");a:{if(cw in this.a){d=this.a.textDecoration.split(" ");e=[];for(f of d)switch(f){case "underline":case "overline":e.push(f);break;case "lineThrough":e.push("line-through")}if(0<e.length){var f=`text-decoration:${e.join(" ")};`;break a}}f=""}"padding"in this.a?(d="border: solid transparent;border-width:"+
14
+ nw(this.a.padding),d+=";"):d="";f=c=c+f+d;"lineHeight"in this.a?(c="",d=this.a.lineHeight,d=nw(d),d=pw(d,b),c+="line-height:",c+=d,c+=";"):c="";a.push(f+c+"}");a:{if("fontSize"in this.a&&(f=this.a.fontSize.split(" "),c=null,1===f.length&&(c=f[0]),2===f.length&&(c=f[1]),c)){c=c.trim();c=nw(c);c=pw(c,b);b=`font-size:${c};`;break a}b=null}b&&(f=`::ttml .${this.h} .clpp-text-wrapper {`,f+=b,f+="}",a.push(f),f=`::ttml .clpp-text-wrapper__${this.h} {`,f+=b,f+="}",a.push(f));return a}},Vw=new Map([[Yv,"background-color"],
15
+ ["color","color"],[Zv,Zv],["fontStyle","font-style"],["fontWeight","font-weight"],["opacity","opacity"],["zIndex","z-index"]]);var Xw=class{constructor(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=[]}},Cw=0;var $w=class{constructor(a){this.a=a.firstChild;this.f=new Set}Wc(){return!!this.a}next(){if(!this.a)return null;let a=this.a;do this.f.add(a),a.nodeType!==Node.TEXT_NODE&&!Yw.has(mw(a.nodeName))||Zw.has(mw(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&&!Yw.has(mw(a.nodeName))));const b=this.a;this.a=a;return b}},Yw=new Set(["tt","head","layout",_.ye,_.de,aw,"styling",_.Rf,"body",
16
+ _.Fd,"p","span","br"]),Zw=new Set([_.Rf,_.de]);var Kw=class{constructor(a,b,c,d,e,f){this.h=a;this.a=b;this.j=c;this.l=d;this.f=e;this.attributes=f}getId(){return this.attributes.id}};var ax=class{constructor(){this.a=new Map}};var bx=class{constructor(a){this.a=a;this.f=new DOMParser}parseInit(){}parseMedia(a,b,c){c&&c.length||(c=[a.byteLength]);var d=_.Rg(this.a.ttml||{}),e=_.I(a,0,c[0]);e=_.ni(e);if(""===e)return{cues:[],styles:[]};var f=null;try{f=this.f.parseFromString(e,_.Vf)}catch(m){throw new _.G(_.E,2,2005,"Failed to parse TTML.");}d=new Xw(d);e=new ax;f=new $w(f);b=b.periodStart;typeof b===_.r&&(d.A=b);b=c[0];for(var g=1;g<c.length;++g){var h=c[g],k=_.I(a,b,h);k=_.Bi(k);const m=`urn:mpeg:14496-30:subs:${g}`;d.h.set(m,
17
+ new Rw(m,k,{imageType:"PNG",encoding:"Base64"}));b+=h}for(;f.Wc();)a=f.next(),a=Lw(e,a),c=d,b=a,"tt"===Iw(b)&&(c.l=new Uw(c.B,Object.assign({},b.attributes))),c=d,b=a,"tt"===Iw(b)&&(c.w=new Sw(b.attributes.frameRate,b.attributes.subFrameRate,b.attributes.frameRateMultiplier,b.attributes.tickRate)),c=d,b=a,Iw(b)!==_.de||b.attributes.begin||b.attributes.end||(g=`#${b.getId()}`,c.h.set(g,new Rw(g,b.h.textContent,b.attributes))),c=d,g=a,Iw(g)===_.de&&g.attributes.begin&&g.attributes.end?(b=`#${Dw()}`,
18
+ g=new Rw(b,g.h.textContent,g.attributes),c.h.set(b,g),c=g):c=null,c&&(a.j=c.getId()),c=d,b=a,Iw(b)===_.Rf&&(g=b.getId()||Dw(),h=new Ww(g,b.f,Object.assign({},b.attributes)),c.a.set(g,h),b.a&&c.j.get(b.a).f.push(g)),c=d,g=a,Iw(g)!==_.Rf&&Fw(g)?(b=Dw(),g=new Ww(b,[],Object.assign({},g.attributes)),c.a.set(b,g),c=g):c=null,c&&a.f.push(c.getId()),c=d,g=a,Iw(g)!==_.Fd||!g.attributes.extent&&!g.attributes.origin?c=null:(b=Dw(),g=new Tw(b,Gw(c,g.f),Object.assign({},g.attributes)),c.j.set(b,g),c=g),c&&(a.a=
19
+ c.getId()),c=d,g=a,Iw(g)!==aw?c=null:(b=g.getId(),g=new Tw(b,Gw(c,g.f),Object.assign({},g.attributes)),c.j.set(b,g),c=g),c&&(a.a=c.getId()),c=d,g=a,b=g.l,-1===["#text","span","br"].indexOf(Iw(g))||0===b.length?c=null:(h=b[b.length-1],c.f.has(h)?(b=Dw(),g=new Qw(b,"#text"===g.h.nodeName?g.h.textContent:null,"br"===Iw(g),g.a,g.j,Gw(c,g.f),g.attributes),c.f.set(b,g),(c=c.f.get(h))&&c.j.push(b),c=g):c=null),c&&a.l.push(c.getId()),c=d,g=a,"p"===Iw(g)||g.j?(b=Dw(),g=new Qw(b,null,!1,g.a,g.j,Gw(c,g.f),g.attributes),
20
+ c.f.set(b,g),c.o.push(g),c=g):c=null,c&&a.l.push(c.getId());e=Hw(d);f=[];for(l of d.a.values())f.push(...l.build(d.l));var l=f;return{cues:e,styles:l}}};var cx=class{constructor(a){this.a=new bx(a);this.g=new _.R("clpp.ttml.Mp4TtmlParser")}parseInit(a){let b=!1;(new _.Tl).N(_.Be,_.Ml).N(_.Yf,_.Ml).N(_.we,_.Ml).N(_.Ae,_.Ml).N(_.Of,_.Ml).ca(_.Qf,_.Nl).N("stpp",c=>{b=!0;c.parser.stop()}).parse(a);if(!b)throw new _.G(_.E,2,2007);}parseMedia(a,b){let c=!1,d=[],e=[];const f=[];(new _.Tl).N("moof",_.Ml).N("traf",_.Ml).ca("subs",g=>{const h=_.O(g.reader);for(let k=0;k<h;++k){g.reader.skip(4);const l=_.Fl(g.reader);for(let m=0;m<l;++m){const n=1===g.version?
21
+ _.O(g.reader):_.Fl(g.reader);f.push(n);g.reader.skip(6)}}}).N(_.ve,_.Ol(g=>{c=!0;g=this.a.parseMedia(g,b,f);d=d.concat(g.cues);e=e.concat(g.styles)})).parse(a);c||this.g.warn("Couldn't find the mdat box");return{cues:d,styles:e}}};var dx=class{constructor(a){this.f=a}a(a){var b=new bx(this.f);({cues:a}=b.parseMedia(a,{periodStart:0,segmentStart:null,segmentEnd:0}));b="WEBVTT\n\n";for(const d of a){a=b;b=Mw(d.startTime)+" --\x3e "+Mw(d.endTime);{var c=d;const e=[];switch(c.textAlign){case _.ge:e.push("align:left");break;case _.yf:e.push("align:right");break;case _.at:e.push("align:middle");break;case _.ge:e.push("align:start");break;case _.yf:e.push("align:end")}switch(c.writingMode){case _.kg:e.push("vertical:lr");break;case _.lg:e.push("vertical:rl")}c=
22
+ e.length?" "+e.join(" "):""}b=a+(b+c+"\n");b+=d.payload+"\n\n"}return _.ri(b)}},ex=class{probe(a,b){return a===_.Fc&&b===_.Uf}create(a){return new dx(a)}};_.x("clpp.ttml.TtmlComponent",class extends _.su{constructor(){super();this.j=new ex}f(){_.bs(_.Fc,bx);_.bs(_.Dc,cx);_.bs(Vv,cx);_.bs(Xv,cx);_.bs(Wv,cx);_.Gj.push(this.j)}a(){_.ds(_.Fc);_.ds(_.Dc);_.ds(Vv);_.ds(Xv);_.ds(Wv);_.Ij(this.j)}id(){return"subtitles-ttml"}});};f.call(g, window);
package/cl.verimatrix.js CHANGED
@@ -1,4 +1,4 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Fv="VerimatrixVCAS",Gv="clpp.verimatrix.Vcas",Hv="clpp.verimatrix.VcasComponent",Jv=function(a,b){return a.C===Iv?(a=Object.assign({},{deviceId:_.Di(_.ui(a.A))},a.a&&{authenticator:_.Di(_.ui(a.a))}),b+_.kj(a)):b},Pv=class extends _.kt{constructor(a){super(Fv);const b={};b[Kv]=Kv;b[Lv]=Lv;const {deviceId:c,authenticator:d,licenseRequestVuidLocation:e=Iv,httpHeaderNames:f=b,widevineLicenseUrl:g,playReadyLicenseUrl:h,fairPlayLicenseUrl:k,fairPlayCertificateUrl:l,fairPlaySiteId:m,fairPlayAssetIdStrategy:n=
2
- Mv}=a;this.A=c;this.a=d;this.C=e;this.B=f;this.w=Jv(this,g);this.o=Jv(this,h);this.l=Jv(this,k);this.j=l;this.G=m;this.F=n;this.g=new _.R(Gv);_.yi(this.w)?this.g.warn(_.Xb):this.Ta(_.zd,{licenseUrl:this.w,videoRobustness:[_.Gb,void 0],audioRobustness:[_.Fb,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:this.h.bind(this)}});_.yi(this.o)?this.g.warn(_.wb):this.Ta(_.xd,{licenseUrl:this.o,videoRobustness:["3000"],audioRobustness:["2000"],
3
- modifiers:{licenseRequest:this.h.bind(this)}});_.yi(this.l)?this.g.warn(_.Ua):_.yi(this.j)?this.g.warn(_.Ta):this.Ta(_.vd,{licenseUrl:this.l,certificateUrl:this.j,modifiers:{licenseRequest:this.J.bind(this),licenseResponse:this.K.bind(this),extractContentId:this.H.bind(this)}})}h(a,b){if(this.C===Nv){a=this.B[Lv];const c={};c[this.B[Kv]]=this.A;this.a&&(c[a]=this.a);Object.keys(c).forEach(d=>{b.headers[d]=c[d]})}}H(a,b){a=_.Ll(b);switch(this.F){case Ov:a=_.kj({r:a,Zh:this.G},!0)}return a}J(a,b){this.h(a,
4
- b);_.Ql(b)}K(a,b){_.Rl(b)}};_.z(Gv,Pv);Pv.prototype.constructor=Pv.prototype.constructor;Pv.NAME=Fv;var Iv="query-string",Nv="http-header";Pv.LicenseRequestVuidLocation={QUERY_STRING:Iv,HTTP_HEADER:Nv};var Kv="DeviceId",Lv="Authenticator";Pv.LicenseRequestHttpHeader={DEVICE_ID_HEADER:Kv,AUTHENTICATOR_HEADER:Lv};var Mv="keyid",Ov="contentid-siteid";Pv.FairPlayAssetIdStrategy={KEYID:Mv,CONTENTID_SITEID:Ov};_.z(Hv,class extends _.Yt{constructor(){super();this.g=new _.R(Hv)}a(){delete _.nl.VerimatrixVCAS}h(a){a=a.getConfiguration();if(a.drm&&a.drm.env===Fv){({customData:a}=a.drm);if(!a)throw new _.H(_.F,7,7100,_.Ad);a=new Pv(a);this.g.info("Registering the Verimatrix VCAS Ultra environment");_.ol(a)}}id(){return"verimatrix-vcas"}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Kv="VerimatrixVCAS",Lv="clpp.verimatrix.Vcas",Mv="clpp.verimatrix.VcasComponent",Ov=function(a,b){return a.C===Nv?(a=Object.assign({},{deviceId:_.Ci(_.ti(a.A))},a.a&&{authenticator:_.Ci(_.ti(a.a))}),b+_.mj(a)):b},Uv=class extends _.wt{constructor(a){super(Kv);const b={};b[Pv]=Pv;b[Qv]=Qv;const {deviceId:c,authenticator:d,licenseRequestVuidLocation:e=Nv,httpHeaderNames:f=b,widevineLicenseUrl:g,playReadyLicenseUrl:h,fairPlayLicenseUrl:k,fairPlayCertificateUrl:l,fairPlaySiteId:m,fairPlayAssetIdStrategy:n=
2
+ Rv}=a;this.A=c;this.a=d;this.C=e;this.B=f;this.w=Ov(this,g);this.o=Ov(this,h);this.l=Ov(this,k);this.j=l;this.G=m;this.F=n;this.g=new _.R(Lv);_.xi(this.w)?this.g.warn(_.Xb):this.Wa(_.yd,{licenseUrl:this.w,videoRobustness:[_.Gb,void 0],audioRobustness:[_.Fb,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:this.h.bind(this)}});_.xi(this.o)?this.g.warn(_.wb):this.Wa(_.wd,{licenseUrl:this.o,videoRobustness:["3000"],audioRobustness:["2000"],
3
+ modifiers:{licenseRequest:this.h.bind(this)}});_.xi(this.l)?this.g.warn(_.Va):_.xi(this.j)?this.g.warn(_.Ta):this.Wa(_.ud,{licenseUrl:this.l,certificateUrl:this.j,modifiers:{licenseRequest:this.J.bind(this),licenseResponse:this.K.bind(this),extractContentId:this.H.bind(this)}})}h(a,b){if(this.C===Sv){a=this.B[Qv];const c={};c[this.B[Pv]]=this.A;this.a&&(c[a]=this.a);Object.keys(c).forEach(d=>{b.headers[d]=c[d]})}}H(a,b){a=_.Sl(b);switch(this.F){case Tv:a=_.mj({r:a,ci:this.G},!0)}return a}J(a,b){this.h(a,
4
+ b);_.Xl(b)}K(a,b){_.Yl(b)}};_.x(Lv,Uv);Uv.prototype.constructor=Uv.prototype.constructor;Uv.NAME=Kv;var Nv="query-string",Sv="http-header";Uv.LicenseRequestVuidLocation={QUERY_STRING:Nv,HTTP_HEADER:Sv};var Pv="DeviceId",Qv="Authenticator";Uv.LicenseRequestHttpHeader={DEVICE_ID_HEADER:Pv,AUTHENTICATOR_HEADER:Qv};var Rv="keyid",Tv="contentid-siteid";Uv.FairPlayAssetIdStrategy={KEYID:Rv,CONTENTID_SITEID:Tv};_.x(Mv,class extends _.su{constructor(){super();this.g=new _.R(Mv)}a(){delete _.ul.VerimatrixVCAS}h(a){a=a.getConfiguration();if(a.drm&&a.drm.env===Kv){({customData:a}=a.drm);if(!a)throw new _.G(_.E,7,7100,_.zd);a=new Uv(a);this.g.info("Registering the Verimatrix VCAS Ultra environment");_.vl(a)}}id(){return"verimatrix-vcas"}});};f.call(g, window);
package/cl.vimond.js CHANGED
@@ -1,8 +1,9 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var wv="Registering listeners",xv="clpp.vimond.VimondPlugin",yv=function(a,b){a.m.trigger(new _.E(_.sg,{detail:b}))},zv=function(a,b,c){b&&(a.B=!0,a.h.stop());a.m.onError(new _.H(b?_.F:1,9,9201,c))},Av=function(a,b){const c=a.m.getState();if(1===b)return["str-start",_.df];if(a.h)return[_.Ud,_.Pe];if(c===_.On)return[_.Ud,null];if(c===_.Vn)return[_.r,_.Pe];b=_.Pe;if(c===_.Rn||c===_.Zn||a.f)b=_.df;return["period",b]},Bv=class{constructor(a,b,c,d,e){this.K=a;this.L=b;this.N=c;this.m=d;this.F=
2
- e;this.a=new _.ts;this.l=!0;this.f=this.j=this.B=!1;this.C=null;this.h=new _.Tj(this.A.bind(this));this.g=new _.R("clpp.vimond.VimondDispatcher");this.o=this.w=0;this.m&&this.a&&(this.g.debug(wv),this.a.on(this.m,_.Nf,this.I.bind(this)),this.a.on(this.m,_.Xf,this.J.bind(this)),this.a.on(this.m,_.cc,this.G.bind(this)),this.a.on(this.m,_.dc,this.H.bind(this)))}J(){this.f||(this.f=1<Math.abs(this.w-this.m.getPosition()));this.w=this.m.getPosition()}G(){this.g.debug("Ad break started");this.j=!0}H(){this.g.debug("Ad break stopped");
3
- this.j=!1}I(a){const b=this;return _.x(function*(){const c=a.detail,d=c.currentState;b.g.debug(`State changed, prev: ${c.previousState} curr: ${d}`);b.B||b.j||(d!==b.C||b.f?b.l&&d!==_.Zn||(b.f&&[_.Yn,_.Rn].includes(d)?b.g.debug("Seeking"):(b.f&&d===_.Zn&&(b.g.debug("Seeked"),b.f=!1),[_.Zn,_.Yn,_.Vn,_.On].includes(d)&&(b.C=d,yield b.A(),d===_.On&&b.h.stop()))):b.g.debug("Ignore transition"))})}A(){const a=this;return _.x(function*(){{const n=Math.floor(Date.now()/1E3);0<a.o&&a.g.debug(`Last event was ${n-
4
- a.o} seconds ago`);a.o=n}a.h.stop();a.h.ha(a.l?10:a.K);a.l=!1;try{{var b=a.F;b.f++;const q=_.Pg(b.o);q.client.buildName=_.ra;q.client.buildVersion=_.fa;var c=q.client;{const B=b.a.m.getDrmInfo();var d=B?B.keySystem:""}c.drm=d;q.client.pageUrl=document.location.href;q.client.streamUrl=b.a.m.getLoadedSource().url;q.client.userAgent=navigator.userAgent;q.client.videoFormat=b.a.m.getLoadedSource().type||"";var e=q.client;{const B=b.a.m.getLoadedSource();var f=((new _.Kl(B.url)).scheme||"").replace(":",
5
- "")}e.videoProtocol=f;const u=Av(b.a,b.f);q.client.playerEvent=u[0]||"";q.client.playerState=u[1]||"";q.progress.vod&&(q.progress.vod.position=b.a.getPosition());const v=q.progress.live;if(v){{var g=b.a;const B=g.m.getPresentationStartTime()||0,D=Math.floor(B+g.m.getPosition());var h=(new Date(1E3*D)).toISOString()}v.position=h;{var k=b.a;const B=k.m.getPosition(),D=k.m.getSeekRange().end;var l=30>Math.abs(D-B)}v.onLiveEdge=l;typeof v.liveResumePossible!==_.Pc&&(v.liveResumePossible=!0)}q.progress.eventNumber=
6
- b.f;q.timestamp=(new Date).toISOString();b.g.debug("Fire an event");const y=_.Si(b.l);y.method=_.ub;y.contentType="application/json";y.headers.Authorization=`Bearer ${b.h}`;y.body=_.ui(JSON.stringify(q));var m=b.j.fetch(y).R}const n=yield m;yv(a,n)}catch(n){m=n.code,b=n.data,[1002,1003].includes(m)?(a.g.debug("Unreachable service"),yv(a,b),zv(a,a.L,b)):1001===m?(a.g.debug("Generic service error"),yv(a,b),zv(a,a.N,b)):a.g.error(n.toString())}})}dispose(){this.g.debug(_.Pb);_.ph(this.a);this.h.stop()}};var Cv=class{constructor(a,b,c,d,e){this.l=a;this.o=c;this.h=b;this.a=d;this.j=e;this.g=new _.R("clpp.vimond.VimondService");this.f=0}Me(a){this.h=a}};var Dv=class{constructor(a){this.m=a;this.a=new _.ts;this.g=new _.R("clpp.vimond.VimondAdapter");this.f=this.h=!1;this.m&&this.a&&(this.g.debug(wv),this.a.on(this.m,_.vf,this.o.bind(this)),this.a.on(this.m,_.cc,this.j.bind(this)),this.a.on(this.m,_.dc,this.l.bind(this)))}getPosition(){return Math.floor(this.m.getPosition())}o(){this.h=!0}j(){this.f=!0}l(){this.f=!1}dispose(){this.g.debug(_.Pb);_.ph(this.a)}};var Ev=class extends _.Au{constructor(){super();this.a=!1;this.g=new _.R(xv);this.j=this.h=this.f=null}onPlayerCreated(){}onContentWillLoad(a){var b=a.getConfiguration();(this.a=!_.A(b.vimond)&&typeof b.vimond===_.Fe)?a.namespace()===_.kd&&(this.a=!1,this.g.info("Vimond does not report when casting.")):this.g.warn("Vimond plugin is loaded but not configured. Will do nothing.");if(this.a){b=a.getConfiguration().vimond;for(var c of["authToken","playerEventRequest"])if(!b[c]){this.g.warn(`${c} key is missing`);
7
- a.onError(new _.H(1,9,9200));return}this.g.debug(_.sa);c=b.failIfUnreachable;typeof c!==_.Pc&&(c=!0);var d=b.failOnError;typeof d!==_.Pc&&(d=!0);this.f=new Dv(a);this.h=new Cv(b.playerEventRequest.uri,b.authToken,b.playerEventRequest.body,this.f,a.getNetworkEngine());this.j=new Bv(b.playerEventRequest.eventInterval,c,d,a,this.h)}}onPlayerWillRelease(){this.a&&(this.f&&this.f.dispose(),this.j&&this.j.dispose(),this.j=this.h=this.f=null)}onPlayerWillDestroy(){}id(){return"vimond"}Me(a){this.a&&this.h&&
8
- this.h.Me(a)}};_.z(xv,Ev);Ev.prototype.updateAuthToken=Ev.prototype.Me;Ev.Id="vimond";_.dp(new class{create(){return new Ev}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Bv="Registering listeners",Cv="clpp.vimond.VimondPlugin",Dv=function(a,b){const c=a.m.getState();if(1===b)return["str-start",_.df];if(a.h)return[_.Td,_.Pe];if(c===_.Vn)return[_.Td,null];if(c===_.bo)return[_.Vd,_.Pe];b=_.Pe;if(c===_.Yn||c===_.go||a.f)b=_.df;return["period",b]},Ev=function(a,b){a.m.trigger(new _.C(_.tg,{detail:b}))},Fv=function(a,b,c){b&&(a.B=!0,a.h.stop());a.m.onError(new _.G(b?_.E:1,9,9201,c))},Gv=class{constructor(a,b,c,d,e){this.l=a;this.o=c;this.h=b;this.a=d;this.j=
2
+ e;this.g=new _.R("clpp.vimond.VimondService");this.f=0}Ne(a){this.h=a}};var Hv=class{constructor(a){this.m=a;this.a=new _.Fs;this.g=new _.R("clpp.vimond.VimondAdapter");this.f=this.h=!1;this.m&&this.a&&(this.g.debug(Bv),this.a.on(this.m,_.uf,this.o.bind(this)),this.a.on(this.m,_.cc,this.j.bind(this)),this.a.on(this.m,_.dc,this.l.bind(this)))}getPosition(){return Math.floor(this.m.getPosition())}o(){this.h=!0}j(){this.f=!0}l(){this.f=!1}};var Iv=class{constructor(a,b,c,d,e){this.K=a;this.L=b;this.M=c;this.m=d;this.F=e;this.a=new _.Fs;this.l=!0;this.f=this.j=this.B=!1;this.C=null;this.h=new _.Wj(this.A.bind(this));this.g=new _.R("clpp.vimond.VimondDispatcher");this.o=this.w=0;this.m&&this.a&&(this.g.debug(Bv),this.a.on(this.m,_.Mf,this.I.bind(this)),this.a.on(this.m,_.Xf,this.J.bind(this)),this.a.on(this.m,_.cc,this.G.bind(this)),this.a.on(this.m,_.dc,this.H.bind(this)))}J(){this.f||(this.f=1<Math.abs(this.w-this.m.getPosition()));
3
+ this.w=this.m.getPosition()}G(){this.g.debug("Ad break started");this.j=!0}H(){this.g.debug("Ad break stopped");this.j=!1}I(a){const b=this;return _.w(function*(){const c=a.detail,d=c.currentState;b.g.debug(`State changed, prev: ${c.previousState} curr: ${d}`);b.B||b.j||(d!==b.C||b.f?b.l&&d!==_.go||(b.f&&[_.fo,_.Yn].includes(d)?b.g.debug("Seeking"):(b.f&&d===_.go&&(b.g.debug("Seeked"),b.f=!1),[_.go,_.fo,_.bo,_.Vn].includes(d)&&(b.C=d,yield b.A(),d===_.Vn&&b.h.stop()))):b.g.debug("Ignore transition"))})}A(){const a=
4
+ this;return _.w(function*(){{const n=Math.floor(Date.now()/1E3);0<a.o&&a.g.debug(`Last event was ${n-a.o} seconds ago`);a.o=n}a.h.stop();a.h.fa(a.l?10:a.K);a.l=!1;try{{var b=a.F;b.f++;const q=_.Qg(b.o);q.client.buildName=_.ra;q.client.buildVersion=_.da;var c=q.client;{const A=b.a.m.getDrmInfo();var d=A?A.keySystem:""}c.drm=d;q.client.pageUrl=document.location.href;q.client.streamUrl=b.a.m.getLoadedSource().url;q.client.userAgent=navigator.userAgent;q.client.videoFormat=b.a.m.getLoadedSource().type||
5
+ "";var e=q.client;{const A=b.a.m.getLoadedSource();var f=((new _.Rl(A.url)).scheme||"").replace(":","")}e.videoProtocol=f;const u=Dv(b.a,b.f);q.client.playerEvent=u[0]||"";q.client.playerState=u[1]||"";q.progress.vod&&(q.progress.vod.position=b.a.getPosition());const v=q.progress.live;if(v){{var g=b.a;const A=g.m.getPresentationStartTime()||0,D=Math.floor(A+g.m.getPosition());var h=(new Date(1E3*D)).toISOString()}v.position=h;{var k=b.a;const A=k.m.getPosition(),D=k.m.getSeekRange().end;var l=30>
6
+ Math.abs(D-A)}v.onLiveEdge=l;typeof v.liveResumePossible!==_.Rc&&(v.liveResumePossible=!0)}q.progress.eventNumber=b.f;q.timestamp=(new Date).toISOString();b.g.debug("Fire an event");const y=_.Si(b.l);y.method=_.vb;y.contentType="application/json";y.headers.Authorization=`Bearer ${b.h}`;y.body=_.ti(JSON.stringify(q));var m=b.j.fetch(y).W}const n=yield m;Ev(a,n)}catch(n){m=n.code,b=n.data,[1002,1003].includes(m)?(a.g.debug("Unreachable service"),Ev(a,b),Fv(a,a.L,b)):1001===m?(a.g.debug("Generic service error"),
7
+ Ev(a,b),Fv(a,a.M,b)):a.g.error(n.toString())}})}};var Jv=class extends _.Fu{constructor(){super();this.a=!1;this.g=new _.R(Cv);this.j=this.h=this.f=null}onPlayerCreated(){}onContentWillLoad(a){var b=a.getConfiguration();(this.a=!_.z(b.vimond)&&typeof b.vimond===_.Fe)?a.namespace()===_.kd&&(this.a=!1,this.g.info("Vimond does not report when casting.")):this.g.warn("Vimond plugin is loaded but not configured. Will do nothing.");if(this.a){b=a.getConfiguration().vimond;for(var c of["authToken","playerEventRequest"])if(!b[c]){this.g.warn(`${c} key is missing`);
8
+ a.onError(new _.G(1,9,9200));return}this.g.debug(_.sa);c=b.failIfUnreachable;typeof c!==_.Rc&&(c=!0);var d=b.failOnError;typeof d!==_.Rc&&(d=!0);this.f=new Hv(a);this.h=new Gv(b.playerEventRequest.uri,b.authToken,b.playerEventRequest.body,this.f,a.getNetworkEngine());this.j=new Iv(b.playerEventRequest.eventInterval,c,d,a,this.h)}}onPlayerWillRelease(){if(this.a){if(this.f){var a=this.f;a.g.debug(_.Pb);_.nh(a.a)}this.j&&(a=this.j,a.g.debug(_.Pb),_.nh(a.a),a.h.stop());this.j=this.h=this.f=null}}onPlayerWillDestroy(){}id(){return"vimond"}Ne(a){this.a&&
9
+ this.h&&this.h.Ne(a)}};_.x(Cv,Jv);Jv.prototype.updateAuthToken=Jv.prototype.Ne;Jv.Id="vimond";_.jr(new class{create(){return new Jv}});};f.call(g, window);