@castlabs/prestoplay 6.2.6 → 6.2.7

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 (59) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +1 -1
  3. package/cjs/cl.adobe.js +3 -3
  4. package/cjs/cl.airplay.js +3 -3
  5. package/cjs/cl.broadpeak.js +6 -6
  6. package/cjs/cl.cast.js +101 -101
  7. package/cjs/cl.conviva.js +32 -32
  8. package/cjs/cl.core.js +362 -362
  9. package/cjs/cl.crypto.js +9 -9
  10. package/cjs/cl.dash.js +68 -68
  11. package/cjs/cl.externs.js +63 -32
  12. package/cjs/cl.freewheel.js +19 -19
  13. package/cjs/cl.hls.js +43 -43
  14. package/cjs/cl.hlssmpte.js +6 -6
  15. package/cjs/cl.htmlcue.js +30 -30
  16. package/cjs/cl.ima.js +18 -18
  17. package/cjs/cl.mse.js +252 -249
  18. package/cjs/cl.muxdata.js +11 -11
  19. package/cjs/cl.onboard.js +3 -3
  20. package/cjs/cl.persistent.js +13 -13
  21. package/cjs/cl.playlist.js +5 -5
  22. package/cjs/cl.smooth.js +69 -69
  23. package/cjs/cl.thumbnails.js +22 -22
  24. package/cjs/cl.tizen.js +69 -69
  25. package/cjs/cl.ttml.js +26 -26
  26. package/cjs/cl.verimatrix.js +5 -5
  27. package/cjs/cl.vimond.js +12 -12
  28. package/cjs/cl.vr.js +24 -0
  29. package/cjs/cl.vtt.js +14 -14
  30. package/cjs/cl.youbora.js +16 -16
  31. package/cl.adobe.js +3 -3
  32. package/cl.airplay.js +3 -3
  33. package/cl.broadpeak.js +5 -5
  34. package/cl.cast.js +78 -78
  35. package/cl.conviva.js +25 -25
  36. package/cl.core.js +172 -171
  37. package/cl.crypto.js +8 -8
  38. package/cl.dash.js +61 -61
  39. package/cl.externs.js +59 -32
  40. package/cl.freewheel.js +18 -18
  41. package/cl.hls.js +36 -36
  42. package/cl.hlssmpte.js +5 -5
  43. package/cl.htmlcue.js +24 -24
  44. package/cl.ima.js +15 -15
  45. package/cl.mse.js +223 -220
  46. package/cl.muxdata.js +9 -9
  47. package/cl.onboard.js +3 -3
  48. package/cl.persistent.js +9 -9
  49. package/cl.playlist.js +4 -4
  50. package/cl.smooth.js +57 -57
  51. package/cl.thumbnails.js +15 -15
  52. package/cl.tizen.js +55 -55
  53. package/cl.ttml.js +21 -21
  54. package/cl.verimatrix.js +4 -4
  55. package/cl.vimond.js +7 -7
  56. package/cl.vr.js +14 -0
  57. package/cl.vtt.js +7 -7
  58. package/cl.youbora.js +8 -8
  59. package/package.json +1 -1
package/cl.cast.js CHANGED
@@ -1,83 +1,83 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var rH="Cannot seek during ads playout.",sH="Cannot switch track",tH="Media session does not exist.",uH="No receivers available",vH="Reset ABR functionality not available on cast.",wH="SDK not yet ready",xH="Sender is destroyed.",yH="clpp.cast.CastProxy",zH="clpp.cast.Player",AH="clpp.cast.Receiver",BH="urn:x-cast:castlabs",CH="urn:x-cast:com.google.cast.media",DH=function(a){return _.v(function*(){yield _.Gl(a,_.wd);yield _.Gl(a,_.vd)})},EH=function(a){return JSON.stringify(a,(b,c)=>
2
- {if("license"!==b&&typeof c!==_.Qc){if(c instanceof Event){b={};for(const d in c){const e=c[d];typeof e===_.rd?"detail"===d&&(b[d]=e):d in Event||(b[d]=e)}return b}return typeof c===_.p?isNaN(c)?"NaN":isFinite(c)?c:0>c?"-Infinity":"Infinity":c}})},FH=function(a){if(typeof a!==_.ee)return a;try{return JSON.parse(a,(b,c)=>"NaN"===c?NaN:"-Infinity"===c?-Infinity:"Infinity"===c?Infinity:c)}catch(b){return a}},GH=function(a,b,c,d){return _.v(function*(){if(b.includes(a.mimeType))return a;var e=null;let f=
3
- null,g=null;for(var h=0;h<b.length&&!f;)g=b[h++],f=_.Dg(d,a.mimeType,g);f&&g&&(h=_.wg(a.url),(h=yield c.fetch(h).N)&&h.data&&(e=f.a(_.L(h.data)),e={url:URL.createObjectURL(new Blob([e])),kind:a.kind,language:a.language,label:a.label,mimeType:g}));return e})},HH=function(a,b){let c,d;if(window.chrome&&chrome.cast&&chrome.cast.media)c=chrome.cast.media.HlsSegmentFormat,d=chrome.cast.media.HlsVideoSegmentFormat;else if(window.cast&&cast.framework&&cast.framework.messages)c=cast.framework.messages.HlsSegmentFormat,
4
- d=cast.framework.messages.HlsVideoSegmentFormat;else return;switch(a){case _.Be:return d.FMP4;case _.Ae:return b===_.K?d.MPEG2_TS:c.TS;case _.Sb:return c.AAC;case _.Tb:return c.AC3;case _.Ub:return c.E_AC3;case "audio/mpeg":return c.MP3;case _.Vb:return c.FMP4}},IH=function(a,b){return a.g.filter(c=>c.type===b)},KH=function(a,b){const c=JH(a);return IH(a,b).find(d=>c.includes(d.id))||null},MH=function(a,b,c){const d=a.a.a;if(d)if(c){a.f[b]=c.renditions[0];c=[+c.id];if(b!==_.I){const e=a.ia();e&&c.push(+e.id)}c=
5
- new chrome.cast.media.EditTracksInfoRequest(c);d.editTracksInfo(c,()=>{a.f[b]=null;LH(a,b)},e=>{a.f[b]=null;a.h.debug(sH,e)})}else b===_.I&&(c=new chrome.cast.media.EditTracksInfoRequest([]),d.editTracksInfo(c,()=>{LH(a,b)},e=>{a.h.debug(sH,e)}))},JH=function(a){return(a=a.a?a.a.a:null)?a.activeTrackIds.map(b=>b.toString()):[]},LH=function(a,b){b===_.J?a.a.trigger(new _.F(_.Vg)):b===_.I&&a.a.trigger(new _.F(_.Wg))},PH=function(a){if(a)for(const b of NH)OH(b)},OH=function(a){if(!a.A&&window.chrome&&
6
- chrome.cast&&chrome.cast.isAvailable&&window.cast&&cast.framework&&cast.framework.CastContext&&a.U.length){a.A=!0;a.w.Md();var b=cast.framework.CastContext.getInstance(),c=new cast.framework.CastOptions;c.receiverApplicationId=a.U;c.autoJoinPolicy=chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED;b.setOptions(c);b.addEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.P);b.addEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.da);QH&&a.w.$(.02)}},RH=function(a){return _.v(function*(){NH.delete(a);
7
- if(a.A){a.A=!1;var b=cast.framework.CastContext.getInstance();b.removeEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.P);b.removeEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.da)}b=[];a.g&&(b.push(a.g.destroy()),a.g=null);a.j&&(b.push(a.j.destroy()),a.j=null);yield Promise.all(b);a.B=!1;a.w&&(a.w.stop(),a.w=null);a.S=null;a.Z=null})},SH=function(a){return _.v(function*(){a.Ya()||(yield cast.framework.CastContext.getInstance().requestSession())})},
8
- UH=function(a,b,c){c=void 0===c?0:c;return _.v(function*(){var d=a.g.ia();d&&d.language&&(a.h.preferredTextLanguage=d.language);(d=a.g.ha())&&d.language&&(a.h.preferredAudioLanguage=d.language);yield TH(a,{source:a.getLoadedSource(),currentTime:c,isLive:a.isLive(),autoplay:b,Ea:a.h})})},TH=function(a,b){return _.v(function*(){var c=chrome.cast.media.StreamType;yield SH(a);if(b){var d=cast.framework.CastContext.getInstance().getCurrentSession(),e=new chrome.cast.media.MediaInfo(b.source.url,b.source.type);
9
- e.streamType=b.isLive?c.LIVE:c.BUFFERED;c=b.audioMimeType;e.hlsVideoSegmentFormat=HH(b.tb,_.K);e.hlsSegmentFormat=HH(c,_.J);b.Ea&&(a.L&&(c=yield Promise.resolve(a.L(b.Ea)))&&(b.Ea=c),a.h=b.Ea,a.D=_.Fk(a.h),a.C=a.D.findIndex(f=>f.url===b.source.url),b.Ea.remoteTextTracks&&(c=yield Promise.all(b.Ea.remoteTextTracks.map(a.ua.bind(a))),e.tracks=c.filter(f=>f),b.Ea.remoteTextTracks=void 0),delete b.Ea.autoplay,b.Ea.startTime=null,e.customData={playerConfiguration:EH(b.Ea)});b.source.name&&a.Pc(b.source.name);
10
- a.f&&(e.metadata=a.f);e=new chrome.cast.media.LoadRequest(e);typeof b.autoplay===_.Zb&&(e.autoplay=b.autoplay);typeof b.currentTime===_.p&&(e.currentTime=b.currentTime);yield d.loadMedia(e)}})},WH=function(a,b){VH(a,b.getMediaSession());b.addEventListener(cast.framework.SessionEventType.MEDIA_SESSION,a.V);b.addMessageListener(BH,a.R)},VH=function(a,b){b!==a.a&&(a.a=b,a.a&&(a.I.release(),a.H=null,a.o=null,a.o=new cast.framework.RemotePlayer,a.H=new cast.framework.RemotePlayerController(a.o),a.I.on(a.H,
11
- cast.framework.RemotePlayerEventType.CURRENT_TIME_CHANGED,a.ma.bind(a)),a.g&&a.g.load(),a.j&&a.j.init(),a.trigger(new _.F(_.dd))))},ZH=function(a){return new XH(a.h,()=>{a.trigger(new _.F(_.hc))},(b,c)=>{{const d=a.f.getConfiguration();d.source=c.source;d.autoplay=!1;d.startTime=c.currentTime?Math.max(c.currentTime-1,0):null;d.ima&&d.startTime&&(d.ima.playAdsAfterTime=d.startTime);c.Ud&&(d.preferredAudioLanguage=c.Ud);c.Ae&&(d.preferredTextLanguage=c.Ae);_.Il(a.f,null);a.trigger(new _.F("castingended"));
12
- a.j(b,d)}},()=>YH(a))},YH=function(a){return _.v(function*(){a.trigger(new _.F(_.gc));a.f.a!==a.a&&a.f&&a.a&&(yield a.f.release(),_.Il(a.f,a.a))})},$H=function(){return[cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,cast.framework.events.EventType.TIMED_METADATA_CHANGED,cast.framework.events.EventType.TIMED_METADATA_ENTER,cast.framework.events.EventType.TIMED_METADATA_EXIT]},aI=function(a){const b=a.dashTimedMetadata;let c=_.se;b&&(c=b.schemeIdUri);return{type:c.startsWith(_.re)?_.Hf:_.Ff,schemeIdUri:c,
13
- id:a.id||"",startTime:a.startTime,endTime:a.endTime,value:b&&b.value||"",eventElement:b&&b.eventElement}},bI=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},dI=function(a){a.a=bI().getTextTracksManager();const b=a.a.getTracks();a.m=cI(_.I,b)},cI=function(a,b){const c=[];for(const d of b)b=new _.Uf(d.trackId.toString(),a),b.roles=d.roles||[],b.kind=d.subtype||null,b.language=d.language||null,b.label=d.name||null,b.src=d.trackContentId||null,b.mimeType=d.trackContentType||
14
- null,d.customData&&(b.mimeType=d.customData.mimeType||b.mimeType,b.src=d.customData.url||b.src),b.renditions.push(new _.sn(b.id,b)),c.push(b);return c},eI=function(a,b,c,d){c=_.Jg(c).filter(g=>g);var e=!1;let f=[];b===_.J?f=a.getAudioTracks():b===_.I&&(f=a.ea());if(c=c.find(g=>{const h=_.Gg(g);return f.some(k=>{k=_.Gg(k.language||"");return _.Hg(h,k)})})){const g=_.Gg(c);c=f.filter(h=>{h=_.Gg(h.language||"");return _.Hg(g,h)});f=c.length?c:f;e=e||!!c.length}_.pg(d)&&(c=f.filter(g=>g.roles.includes(d)),
15
- f=c.length?c:f,e=e||!!c.length);e&&f[0]&&(e=f[0],a.g.info("Will select track",e),b===_.J?a.ka(e):b===_.I&&a.ta(e))},fI=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},iI=function(a,b){var c=()=>{b.protectionSystem=cast.framework.ContentProtection.NONE;b.licenseUrl=void 0;b.licenseRequestHandler=void 0;b.licenseHandler=void 0};if(a&&a.drm){var d=a.drm,e=_.ti(d);if(e){var f=[_.xc];_.Fk(a)[0].type!==_.Ob&&f.unshift(_.yc);d.preferredDrmSystem===_.xc&&f.reverse();
16
- for(var g,h;f.length&&!h;)g=f.shift(),h=e.Oa[g];h?(c=g===_.yc?cast.framework.ContentProtection.WIDEVINE:g===_.xc?cast.framework.ContentProtection.PLAYREADY:void 0,b.protectionSystem=c,b.licenseUrl=h.licenseUrl,c={ldlDelay:0,customData:{}},gI(b,h,a,c),hI(b,h,a,c)):c()}else c()}else c()},gI=function(a,b,c,d){b.modifiers.licenseRequest?a.licenseRequestHandler=e=>{const f=_.wg(e.url);e.headers&&(f.headers=e.headers);f.body=e.content;f.allowCrossSiteCredentials=e.withCredentials;b.modifiers.licenseRequest(c,
17
- f,d);e.url=f.uris[0];e.headers=f.headers;e.content=f.body;e.withCredentials=f.allowCrossSiteCredentials}:a.licenseRequestHandler=void 0},hI=function(a,b,c,d){b.modifiers.licenseResponse?a.licenseHandler=e=>{e=_.xg({},e.buffer,200,"");b.modifiers.licenseResponse(c,e,d);return _.L(e.data)}:a.licenseHandler=void 0},lI=function(a,b,c){return _.v(function*(){var d=b.adTagUrl;if(d)try{jI=!1;const e=_.wg(d),f=yield c.fetch(e).N;if(f&&f.data){const g=_.gg(f.data),h=(new DOMParser).parseFromString(g,_.le);
18
- if(h.getElementsByTagName("vmap:VMAP").length)_.z("VMAP detected."),a.vmapAdsRequest=kI(g);else if(h.getElementsByTagName("VAST").length){_.z("VAST detected.");{d=g;const k=new cast.framework.messages.BreakClip("bc1");k.vastAdsRequest=kI(d);const l=new cast.framework.messages.Break("b1",[k.id],0);a.breakClips=[k];a.breaks=[l]}}else _.z("Unsupported schema."),jI=!0}}catch(e){_.z("Failed to fetch an ad",e),jI=!0}})},kI=function(a){const b=new cast.framework.messages.VastAdsRequest;b.adsResponse=a;return b},
19
- mI=function(a,b){b=new _.H(1,10,10003,{errorType:b});a.l.onError(b)},nI=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},pI=function(a,b,c){if(c instanceof cast.framework.events.BreaksEvent||-1!==a.getPosition()){var d=null;(c=oI(a,c))&&(d={ad:c});a.l.trigger(new _.F(b,d))}},oI=function(a,b){let c=null;if(a.a&&b instanceof cast.framework.events.BreaksEvent){let d=null,e=null,f;typeof b.breakClipId===_.ee&&(d=a.a.getBreakClipById(b.breakClipId));typeof b.breakId===
20
- _.ee&&(e=a.a.getBreakById(b.breakId),!e&&d&&(e=a.a.getBreaks().find(g=>g.breakClipIds.includes(d.id))||null),e&&(f=a.a.getBreaks().filter(g=>0<=g.position).sort((g,h)=>g.position-h.position).findIndex(g=>g===e)));c=new X(d,e,b.index,b.total,f)}return c},sI=function(){return qI||(qI=new rI)},uI=function(a,b){a.h.debug("Detected HLS, parsing");var c=cast.framework.messages.HlsVideoSegmentFormat;a=cast.framework.CastReceiverContext.getInstance();var {hlsVideoSegmentFormat:d}=a.getPlayerManager().getMediaInformation();
21
- c=d===c.FMP4?_.Be:_.Ae;b=b.replace(/\r\n|\r(?=[^\n]|$)/gm,"\n");b=b.split(/\n+/m);d=[];let e=0;for(;e<b.length;){const f=b[e].trim();if(b[e].startsWith("#EXT-X-STREAM-INF")){const g=tI(f,_.ja),h=tI(f,"RESOLUTION");let [k,l]=[];h&&([k,l]=h.split("x").map(m=>+m));if(!a.canDisplayType(c,g,k,l)){e+=2;continue}}d.push(f);++e}return d.join("\n")},tI=function(a,b){let c;b+="\x3d";let d=a.indexOf(b);0<=d&&(c=a.substring(d+b.length),c.startsWith('"')?(c=c.substring(1),c=c.substring(0,c.indexOf('"'))):(d=c.indexOf(","),
22
- 0<=d&&(c=c.substring(0,d))));return c},wI=function(a,b){let c=null;const d=vI(a);d&&(c={ad:d});a.f.trigger(new _.F(b,c))},vI=function(a){var b=null;if(a.a&&a.a.mediaInfo){b=a.a.mediaInfo;let c=null,d=null,e,f;const g=a.a.currentBreakClipNumber;b.breaks&&(c=b.breaks.find(h=>h.id===a.a.breakId)||null)&&(e=c.breakClipIds.length,f=0>=c.position?c.position:b.breaks.filter(h=>0<=h.position).sort((h,k)=>h.position-k.position).findIndex(h=>h===c));b.breakClips&&(d=b.breakClips.find(h=>h.id===a.a.breakClipId)||
23
- null);b=new X(d,c,g,e,f)}return b},xI=class{constructor(a,b){this.log=new _.O(b);this.f=a;this.m=null;this.h=_.zk;this.o=_.go;this.j=2;this.C=Date.now();this.B=-1}release(){this.a(_.zk)}destroy(){this.m=this.f=null;return Promise.resolve()}getState(){return this.h}onError(a){a.severity===_.G&&this.a(_.yk)}a(a){if(a!==this.h)if(this.h===_.yk&&a!==_.zk)this.log.debug("Player is in ERROR state and can not switch to",a);else{var b=Date.now();this.o=this.h;this.h=a;this.h===_.uk?(this.B=b,this.f.trigger(new _.F(_.ac,
24
- {detail:{bufferedTimeMS:-1,reason:this.j}}))):this.o===_.uk&&this.f.trigger(new _.F(_.$b,{detail:{bufferedTimeMS:b-this.B,reason:this.j}}));a={currentState:this.h,previousState:this.o,timeSinceLastStateChangeMS:b-this.C};this.C=b;this.m&&_.fk(this.m,this.h);this.f.trigger(new _.F(_.be,{detail:a}))}}};_.x("clpp.cast.CastUtils",class{});var yI=class extends xI{constructor(a){super(a,"clpp.cast.SenderStateManager");this.w=this.g=null;this.A=this.D.bind(this)}init(){const a=this.f,b=a.a;b&&(this.g&&this.g.removeUpdateListener(this.A),this.g=b,this.g.addUpdateListener(this.A),this.w=a.o)}destroy(){const a=this,b=()=>Object.getPrototypeOf(Object.getPrototypeOf(this)).destroy;return _.v(function*(){a.g&&(a.g.removeUpdateListener(a.A),a.g=null);yield b().call(a)})}a(a){const b=this.f.o;b&&b.isPlayingBreak||super.a(a)}D(){if(this.g&&this.w&&
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var NH="Cannot seek during ads playout.",OH="Cannot switch track",PH="Media session does not exist.",QH="No receivers available",RH="Reset ABR functionality not available on cast.",SH="SDK not yet ready",TH="Sender is destroyed.",UH="clpp.cast.CastProxy",VH="clpp.cast.Player",WH="clpp.cast.Receiver",XH="urn:x-cast:castlabs",YH="urn:x-cast:com.google.cast.media",ZH=function(a){return _.v(function*(){yield _.Gl(a,_.wd);yield _.Gl(a,_.vd)})},$H=function(a){return JSON.stringify(a,(b,c)=>
2
+ {if("license"!==b&&typeof c!==_.Qc){if(c instanceof Event){b={};for(const d in c){const e=c[d];typeof e===_.rd?"detail"===d&&(b[d]=e):d in Event||(b[d]=e)}return b}return typeof c===_.p?isNaN(c)?"NaN":isFinite(c)?c:0>c?"-Infinity":"Infinity":c}})},aI=function(a){if(typeof a!==_.ee)return a;try{return JSON.parse(a,(b,c)=>"NaN"===c?NaN:"-Infinity"===c?-Infinity:"Infinity"===c?Infinity:c)}catch(b){return a}},bI=function(a,b,c,d){return _.v(function*(){if(b.includes(a.mimeType))return a;var e=null;let f=
3
+ null,g=null;for(var h=0;h<b.length&&!f;)g=b[h++],f=_.Dg(d,a.mimeType,g);f&&g&&(h=_.wg(a.url),(h=yield c.fetch(h).O)&&h.data&&(e=f.a(_.L(h.data)),e={url:URL.createObjectURL(new Blob([e])),kind:a.kind,language:a.language,label:a.label,mimeType:g}));return e})},cI=function(a,b){let c,d;if(window.chrome&&chrome.cast&&chrome.cast.media)c=chrome.cast.media.HlsSegmentFormat,d=chrome.cast.media.HlsVideoSegmentFormat;else if(window.cast&&cast.framework&&cast.framework.messages)c=cast.framework.messages.HlsSegmentFormat,
4
+ d=cast.framework.messages.HlsVideoSegmentFormat;else return;switch(a){case _.Be:return d.FMP4;case _.Ae:return b===_.K?d.MPEG2_TS:c.TS;case _.Sb:return c.AAC;case _.Tb:return c.AC3;case _.Ub:return c.E_AC3;case "audio/mpeg":return c.MP3;case _.Vb:return c.FMP4}},dI=function(a,b){return a.g.filter(c=>c.type===b)},fI=function(a,b){const c=eI(a);return dI(a,b).find(d=>c.includes(d.id))||null},hI=function(a,b,c){const d=a.a.a;if(d)if(c){a.f[b]=c.renditions[0];c=[+c.id];if(b!==_.I){const e=a.ia();e&&c.push(+e.id)}c=
5
+ new chrome.cast.media.EditTracksInfoRequest(c);d.editTracksInfo(c,()=>{a.f[b]=null;gI(a,b)},e=>{a.f[b]=null;a.h.debug(OH,e)})}else b===_.I&&(c=new chrome.cast.media.EditTracksInfoRequest([]),d.editTracksInfo(c,()=>{gI(a,b)},e=>{a.h.debug(OH,e)}))},eI=function(a){return(a=a.a?a.a.a:null)?a.activeTrackIds.map(b=>b.toString()):[]},gI=function(a,b){b===_.J?a.a.trigger(new _.F(_.Vg)):b===_.I&&a.a.trigger(new _.F(_.Wg))},kI=function(a){if(a)for(const b of iI)jI(b)},jI=function(a){if(!a.A&&window.chrome&&
6
+ chrome.cast&&chrome.cast.isAvailable&&window.cast&&cast.framework&&cast.framework.CastContext&&a.T.length){a.A=!0;a.w.Od();var b=cast.framework.CastContext.getInstance(),c=new cast.framework.CastOptions;c.receiverApplicationId=a.T;c.autoJoinPolicy=chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED;b.setOptions(c);b.addEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.N);b.addEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.ca);lI&&a.w.$(.02)}},mI=function(a){return _.v(function*(){iI.delete(a);
7
+ if(a.A){a.A=!1;var b=cast.framework.CastContext.getInstance();b.removeEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.N);b.removeEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.ca)}b=[];a.g&&(b.push(a.g.destroy()),a.g=null);a.j&&(b.push(a.j.destroy()),a.j=null);yield Promise.all(b);a.B=!1;a.w&&(a.w.stop(),a.w=null);a.S=null;a.W=null})},nI=function(a){return _.v(function*(){a.Ya()||(yield cast.framework.CastContext.getInstance().requestSession())})},
8
+ pI=function(a,b,c){c=void 0===c?0:c;return _.v(function*(){var d=a.g.ia();d&&d.language&&(a.h.preferredTextLanguage=d.language);(d=a.g.ha())&&d.language&&(a.h.preferredAudioLanguage=d.language);yield oI(a,{source:a.getLoadedSource(),currentTime:c,isLive:a.isLive(),autoplay:b,Ea:a.h})})},oI=function(a,b){return _.v(function*(){var c=chrome.cast.media.StreamType;yield nI(a);if(b){var d=cast.framework.CastContext.getInstance().getCurrentSession(),e=new chrome.cast.media.MediaInfo(b.source.url,b.source.type);
9
+ e.streamType=b.isLive?c.LIVE:c.BUFFERED;c=b.audioMimeType;e.hlsVideoSegmentFormat=cI(b.tb,_.K);e.hlsSegmentFormat=cI(c,_.J);b.Ea&&(a.L&&(c=yield Promise.resolve(a.L(b.Ea)))&&(b.Ea=c),a.h=b.Ea,a.D=_.Fk(a.h),a.C=a.D.findIndex(f=>f.url===b.source.url),b.Ea.remoteTextTracks&&(c=yield Promise.all(b.Ea.remoteTextTracks.map(a.ua.bind(a))),e.tracks=c.filter(f=>f),b.Ea.remoteTextTracks=void 0),delete b.Ea.autoplay,b.Ea.startTime=null,e.customData={playerConfiguration:$H(b.Ea)});b.source.name&&a.Rc(b.source.name);
10
+ a.f&&(e.metadata=a.f);e=new chrome.cast.media.LoadRequest(e);typeof b.autoplay===_.Zb&&(e.autoplay=b.autoplay);typeof b.currentTime===_.p&&(e.currentTime=b.currentTime);yield d.loadMedia(e)}})},rI=function(a,b){qI(a,b.getMediaSession());b.addEventListener(cast.framework.SessionEventType.MEDIA_SESSION,a.V);b.addMessageListener(XH,a.R)},qI=function(a,b){b!==a.a&&(a.a=b,a.a&&(a.I.release(),a.H=null,a.o=null,a.o=new cast.framework.RemotePlayer,a.H=new cast.framework.RemotePlayerController(a.o),a.I.on(a.H,
11
+ cast.framework.RemotePlayerEventType.CURRENT_TIME_CHANGED,a.na.bind(a)),a.g&&a.g.load(),a.j&&a.j.init(),a.trigger(new _.F(_.dd))))},uI=function(a){return new sI(a.h,()=>{a.trigger(new _.F(_.hc))},(b,c)=>{{const d=a.f.getConfiguration();d.source=c.source;d.autoplay=!1;d.startTime=c.currentTime?Math.max(c.currentTime-1,0):null;d.ima&&d.startTime&&(d.ima.playAdsAfterTime=d.startTime);c.Wd&&(d.preferredAudioLanguage=c.Wd);c.Ae&&(d.preferredTextLanguage=c.Ae);_.Il(a.f,null);a.trigger(new _.F("castingended"));
12
+ a.j(b,d)}},()=>tI(a))},tI=function(a){return _.v(function*(){a.trigger(new _.F(_.gc));a.f.a!==a.a&&a.f&&a.a&&(yield a.f.release(),_.Il(a.f,a.a))})},vI=function(){return[cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,cast.framework.events.EventType.TIMED_METADATA_CHANGED,cast.framework.events.EventType.TIMED_METADATA_ENTER,cast.framework.events.EventType.TIMED_METADATA_EXIT]},wI=function(a){const b=a.dashTimedMetadata;let c=_.se;b&&(c=b.schemeIdUri);return{type:c.startsWith(_.re)?_.Hf:_.Ff,schemeIdUri:c,
13
+ id:a.id||"",startTime:a.startTime,endTime:a.endTime,value:b&&b.value||"",eventElement:b&&b.eventElement}},xI=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},zI=function(a){a.a=xI().getTextTracksManager();const b=a.a.getTracks();a.m=yI(_.I,b)},yI=function(a,b){const c=[];for(const d of b)b=new _.Uf(d.trackId.toString(),a),b.roles=d.roles||[],b.kind=d.subtype||null,b.language=d.language||null,b.label=d.name||null,b.src=d.trackContentId||null,b.mimeType=d.trackContentType||
14
+ null,d.customData&&(b.mimeType=d.customData.mimeType||b.mimeType,b.src=d.customData.url||b.src),b.renditions.push(new _.sn(b.id,b)),c.push(b);return c},AI=function(a,b,c,d){c=_.Jg(c).filter(g=>g);var e=!1;let f=[];b===_.J?f=a.getAudioTracks():b===_.I&&(f=a.ea());if(c=c.find(g=>{const h=_.Gg(g);return f.some(k=>{k=_.Gg(k.language||"");return _.Hg(h,k)})})){const g=_.Gg(c);c=f.filter(h=>{h=_.Gg(h.language||"");return _.Hg(g,h)});f=c.length?c:f;e=e||!!c.length}_.pg(d)&&(c=f.filter(g=>g.roles.includes(d)),
15
+ f=c.length?c:f,e=e||!!c.length);e&&f[0]&&(e=f[0],a.g.info("Will select track",e),b===_.J?a.la(e):b===_.I&&a.ta(e))},BI=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},EI=function(a,b){var c=()=>{b.protectionSystem=cast.framework.ContentProtection.NONE;b.licenseUrl=void 0;b.licenseRequestHandler=void 0;b.licenseHandler=void 0};if(a&&a.drm){var d=a.drm,e=_.ti(d);if(e){var f=[_.xc];_.Fk(a)[0].type!==_.Ob&&f.unshift(_.yc);d.preferredDrmSystem===_.xc&&f.reverse();
16
+ for(var g,h;f.length&&!h;)g=f.shift(),h=e.Oa[g];h?(c=g===_.yc?cast.framework.ContentProtection.WIDEVINE:g===_.xc?cast.framework.ContentProtection.PLAYREADY:void 0,b.protectionSystem=c,b.licenseUrl=h.licenseUrl,c={ldlDelay:0,customData:{}},CI(b,h,a,c),DI(b,h,a,c)):c()}else c()}else c()},CI=function(a,b,c,d){b.modifiers.licenseRequest?a.licenseRequestHandler=e=>{const f=_.wg(e.url);e.headers&&(f.headers=e.headers);f.body=e.content;f.allowCrossSiteCredentials=e.withCredentials;b.modifiers.licenseRequest(c,
17
+ f,d);e.url=f.uris[0];e.headers=f.headers;e.content=f.body;e.withCredentials=f.allowCrossSiteCredentials}:a.licenseRequestHandler=void 0},DI=function(a,b,c,d){b.modifiers.licenseResponse?a.licenseHandler=e=>{e=_.xg({},e.buffer,200,"");b.modifiers.licenseResponse(c,e,d);return _.L(e.data)}:a.licenseHandler=void 0},HI=function(a,b,c){return _.v(function*(){var d=b.adTagUrl;if(d)try{FI=!1;const e=_.wg(d),f=yield c.fetch(e).O;if(f&&f.data){const g=_.gg(f.data),h=(new DOMParser).parseFromString(g,_.le);
18
+ if(h.getElementsByTagName("vmap:VMAP").length)_.z("VMAP detected."),a.vmapAdsRequest=GI(g);else if(h.getElementsByTagName("VAST").length){_.z("VAST detected.");{d=g;const k=new cast.framework.messages.BreakClip("bc1");k.vastAdsRequest=GI(d);const l=new cast.framework.messages.Break("b1",[k.id],0);a.breakClips=[k];a.breaks=[l]}}else _.z("Unsupported schema."),FI=!0}}catch(e){_.z("Failed to fetch an ad",e),FI=!0}})},GI=function(a){const b=new cast.framework.messages.VastAdsRequest;b.adsResponse=a;return b},
19
+ II=function(a,b){b=new _.H(1,10,10003,{errorType:b});a.l.onError(b)},JI=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},LI=function(a,b,c){if(c instanceof cast.framework.events.BreaksEvent||-1!==a.getPosition()){var d=null;(c=KI(a,c))&&(d={ad:c});a.l.trigger(new _.F(b,d))}},KI=function(a,b){let c=null;if(a.a&&b instanceof cast.framework.events.BreaksEvent){let d=null,e=null,f;typeof b.breakClipId===_.ee&&(d=a.a.getBreakClipById(b.breakClipId));typeof b.breakId===
20
+ _.ee&&(e=a.a.getBreakById(b.breakId),!e&&d&&(e=a.a.getBreaks().find(g=>g.breakClipIds.includes(d.id))||null),e&&(f=a.a.getBreaks().filter(g=>0<=g.position).sort((g,h)=>g.position-h.position).findIndex(g=>g===e)));c=new X(d,e,b.index,b.total,f)}return c},OI=function(){return MI||(MI=new NI)},QI=function(a,b){a.h.debug("Detected HLS, parsing");var c=cast.framework.messages.HlsVideoSegmentFormat;a=cast.framework.CastReceiverContext.getInstance();var {hlsVideoSegmentFormat:d}=a.getPlayerManager().getMediaInformation();
21
+ c=d===c.FMP4?_.Be:_.Ae;b=b.replace(/\r\n|\r(?=[^\n]|$)/gm,"\n");b=b.split(/\n+/m);d=[];let e=0;for(;e<b.length;){const f=b[e].trim();if(b[e].startsWith("#EXT-X-STREAM-INF")){const g=PI(f,_.ja),h=PI(f,"RESOLUTION");let [k,l]=[];h&&([k,l]=h.split("x").map(m=>+m));if(!a.canDisplayType(c,g,k,l)){e+=2;continue}}d.push(f);++e}return d.join("\n")},PI=function(a,b){let c;b+="\x3d";let d=a.indexOf(b);0<=d&&(c=a.substring(d+b.length),c.startsWith('"')?(c=c.substring(1),c=c.substring(0,c.indexOf('"'))):(d=c.indexOf(","),
22
+ 0<=d&&(c=c.substring(0,d))));return c},SI=function(a,b){let c=null;const d=RI(a);d&&(c={ad:d});a.f.trigger(new _.F(b,c))},RI=function(a){var b=null;if(a.a&&a.a.mediaInfo){b=a.a.mediaInfo;let c=null,d=null,e,f;const g=a.a.currentBreakClipNumber;b.breaks&&(c=b.breaks.find(h=>h.id===a.a.breakId)||null)&&(e=c.breakClipIds.length,f=0>=c.position?c.position:b.breaks.filter(h=>0<=h.position).sort((h,k)=>h.position-k.position).findIndex(h=>h===c));b.breakClips&&(d=b.breakClips.find(h=>h.id===a.a.breakClipId)||
23
+ null);b=new X(d,c,g,e,f)}return b},TI=class{constructor(a,b){this.log=new _.O(b);this.f=a;this.m=null;this.h=_.zk;this.o=_.go;this.j=2;this.C=Date.now();this.B=-1}release(){this.a(_.zk)}destroy(){this.m=this.f=null;return Promise.resolve()}getState(){return this.h}onError(a){a.severity===_.G&&this.a(_.yk)}a(a){if(a!==this.h)if(this.h===_.yk&&a!==_.zk)this.log.debug("Player is in ERROR state and can not switch to",a);else{var b=Date.now();this.o=this.h;this.h=a;this.h===_.uk?(this.B=b,this.f.trigger(new _.F(_.ac,
24
+ {detail:{bufferedTimeMS:-1,reason:this.j}}))):this.o===_.uk&&this.f.trigger(new _.F(_.$b,{detail:{bufferedTimeMS:b-this.B,reason:this.j}}));a={currentState:this.h,previousState:this.o,timeSinceLastStateChangeMS:b-this.C};this.C=b;this.m&&_.fk(this.m,this.h);this.f.trigger(new _.F(_.be,{detail:a}))}}};_.x("clpp.cast.CastUtils",class{});var UI=class extends TI{constructor(a){super(a,"clpp.cast.SenderStateManager");this.w=this.g=null;this.A=this.D.bind(this)}init(){const a=this.f,b=a.a;b&&(this.g&&this.g.removeUpdateListener(this.A),this.g=b,this.g.addUpdateListener(this.A),this.w=a.o)}destroy(){const a=this,b=()=>Object.getPrototypeOf(Object.getPrototypeOf(this)).destroy;return _.v(function*(){a.g&&(a.g.removeUpdateListener(a.A),a.g=null);yield b().call(a)})}a(a){const b=this.f.o;b&&b.isPlayingBreak||super.a(a)}D(){if(this.g&&this.w&&
25
25
  !this.w.isPlayingBreak)switch(this.g.playerState){case chrome.cast.media.PlayerState.IDLE:switch(this.g.idleReason){case chrome.cast.media.IdleReason.FINISHED:this.a(_.rk);break;case chrome.cast.media.IdleReason.ERROR:this.a(_.yk);break;default:this.a(_.zk)}break;case chrome.cast.media.PlayerState.PLAYING:this.a(_.Ck);break;case chrome.cast.media.PlayerState.PAUSED:this.a(_.Bk);break;case chrome.cast.media.PlayerState.BUFFERING:this.a(_.uk)}}};var Y=class extends _.P{constructor(){super();this.h=new _.O("clpp.cast.SenderTrackManager");this.a=null;this.g=[];this.f={}}j(a){this.a=a}release(){this.g=[];this.f={}}load(){this.release();var a=this.a.a;a&&(a=a.media)&&(this.g=(a=a.tracks)?a.map(b=>{switch(b.type){case chrome.cast.media.TrackType.VIDEO:var c=_.K;break;case chrome.cast.media.TrackType.AUDIO:c=_.J;break;case chrome.cast.media.TrackType.TEXT:c=_.I}c=new _.Uf(b.trackId.toString(),c);c.kind=b.subtype;c.language=b.language;c.label=b.name;
26
- c.src=b.trackContentId;c.mimeType=b.trackContentType;b.customData&&(c.src=b.customData.url||c.src,c.mimeType=b.customData.mimeType||c.mimeType);c.renditions.push(new _.sn(c.id,c));return c}):[],this.a.trigger(new _.F(_.xn)))}destroy(){this.a=null}getVideoTracks(){return IH(this,_.K)}getAudioTracks(){return IH(this,_.J)}ea(){return IH(this,_.I)}fa(){const a=this.Aa();return a?a.renditions[0]:null}xa(){const a=this.ha();return a?a.renditions[0]:null}za(){const a=this.ia();return a?a.renditions[0]:null}Ia(){return this.f[_.K]||
27
- null}Ua(){return this.f[_.J]||null}Va(){return this.f[_.I]||null}Aa(){return KH(this,_.K)}ha(){return KH(this,_.J)}ia(){return KH(this,_.I)}Na(a){MH(this,_.K,a)}ka(a){MH(this,_.J,a)}ta(a){MH(this,_.I,a)}Ma(a){this.Na(a&&a.track)}bb(a){this.ka(a&&a.track)}cb(a){this.ta(a&&a.track)}addTextTrack(){return _.v(function*(){})}ja(){return!0}};Y.prototype.isAbrEnabled=Y.prototype.ja;Y.prototype.addTextTrack=Y.prototype.addTextTrack;Y.prototype.setTextRendition=Y.prototype.cb;
28
- Y.prototype.setAudioRendition=Y.prototype.bb;Y.prototype.setVideoRendition=Y.prototype.Ma;Y.prototype.setTextTrack=Y.prototype.ta;Y.prototype.setAudioTrack=Y.prototype.ka;Y.prototype.setVideoTrack=Y.prototype.Na;Y.prototype.getTextTrack=Y.prototype.ia;Y.prototype.getAudioTrack=Y.prototype.ha;Y.prototype.getVideoTrack=Y.prototype.Aa;Y.prototype.getLoadingTextRendition=Y.prototype.Va;Y.prototype.getLoadingAudioRendition=Y.prototype.Ua;Y.prototype.getLoadingVideoRendition=Y.prototype.Ia;
29
- Y.prototype.getTextRendition=Y.prototype.za;Y.prototype.getAudioRendition=Y.prototype.xa;Y.prototype.getVideoRendition=Y.prototype.fa;Y.prototype.getTextTracks=Y.prototype.ea;Y.prototype.getAudioTracks=Y.prototype.getAudioTracks;Y.prototype.getVideoTracks=Y.prototype.getVideoTracks;var XH=class extends _.zn{constructor(a,b,c,d){super();this.m=new _.O(_.pc);this.U=a;this.w=new _.rh(b);this.S=c;this.Z=d;this.h=this.J=_.Wh();this.D=[];this.C=0;this.K=new _.zl;this.H=this.o=this.a=null;this.B=this.A=!1;this.ca="";this.ga=1E6;this.g=new Y;this.g.j(this);this.j=new yI(this);this.I=new _.cn;this.f=null;this.F=new Set;this.P=this.Qa.bind(this);this.da=this.Ta.bind(this);this.V=this.Sa.bind(this);this.R=this.Ra.bind(this);this.L=null;window.cast||Object.defineProperty(window,"cast",
30
- {get:()=>window.cast_,set:e=>{window.cast_=e;window.setTimeout(()=>{PH(!0)},0)}});OH(this);NH.add(this)}init(a,b){this.h=this.J=b}unload(){return new Promise((a,b)=>{this.g&&this.g.release();this.a&&!this.a.idleReason||a();this.a.stop(null,a,b)})}release(){return this.unload().then(()=>{this.j&&this.j.release()})}destroy(){return _.v(function*(){})}Ac(a){this.L=a}Pb(){return this.A}Ya(){return this.B}gd(){return this.ca}sendMessage(a,b){const c=this;return _.v(function*(){let d;const e=cast.framework.CastContext.getInstance().getCurrentSession();
31
- if(e)try{yield e.sendMessage(a,EH(b))}catch(f){d=new _.H(1,8,8E3,{detailedErrorCode:f})}else d=new _.H(1,8,8004,void 0);if(d)c.onError(d)})}cast(){const a=this;return _.v(function*(){if(!a.Pb())throw a.m.warn(wH),new _.H(1,8,8001,void 0);if(!QH)throw a.m.warn(uH),new _.H(1,8,8002,void 0);if(a.Ya())throw a.m.warn("Already casting"),new _.H(1,8,8003,void 0);try{yield SH(a)}catch(b){const c={};b instanceof chrome.cast.Error?(c.detailedErrorCode=b.code,c.details=b.details,c.reason=b.description):c.detailedErrorCode=
32
- b;throw new _.H(1,8,8E3,c);}})}bd(){this.Ya()&&cast.framework.CastContext.getInstance().endCurrentSession(!0)}addMessageListener(a){typeof a===_.Qc&&this.F.add(a)}removeMessageListener(a){typeof a===_.Qc&&this.F.delete(a)}play(){return this.isEnded()?UH(this,!0):new Promise((a,b)=>{if(!this.a)return b(tH);this.a.play(null,a,b)})}pause(){return new Promise((a,b)=>{this.isEnded()&&a();if(!this.a)return b(tH);this.a.pause(null,a,b)})}isPaused(){return!!this.a&&this.a.playerState===chrome.cast.media.PlayerState.PAUSED}isEnded(){return this.getState()===
33
- _.rk}seek(a){return this.isEnded()?UH(this,!1,a):new Promise((b,c)=>{this.a||c(tH);this.o.isPlayingBreak&&c(rH);const d=new chrome.cast.media.SeekRequest;d.currentTime=a;this.trigger(new _.F(_.ve));this.a.seek(d,()=>{this.trigger(new _.F(_.te));b()},c)})}getPosition(){return this.a&&this.a.getEstimatedTime()||0}getDuration(){return this.a&&this.a.media&&typeof this.a.media.duration===_.p?this.a.media.duration:0}setDrmCustomDataModifier(){}setCdnErrorCallback(){}getPlaybackRate(){return this.a&&this.a.playbackRate||
34
- 0}setPlaybackRate(a){this.a&&0<a&&this.sendMessage(CH,{type:"SET_PLAYBACK_RATE",requestId:Math.round(1E3*Math.random()),mediaSessionId:this.a.mediaSessionId,playbackRate:a})}getVolume(){return this.a&&this.a.volume.level}setVolume(a){this.a&&0<=a&&1>=a&&(a=new chrome.cast.media.VolumeRequest(new chrome.cast.Volume(a)),this.a.setVolume(a))}isMuted(){return this.a&&this.a.volume.muted}setMuted(a){this.a&&(a=new chrome.cast.media.VolumeRequest(new chrome.cast.Volume(void 0,a)),this.a.setVolume(a))}getPresentationStartTime(){return this.a&&
35
- this.a.media.startAbsoluteTime||0}getSeekRange(){let a={start:0,end:this.getDuration()};if(this.isLive()){const b=this.a.getEstimatedLiveSeekableRange();b&&typeof b.start===_.p&&typeof b.end===_.p&&(a={start:b.start,end:b.end})}return a}getState(){return this.j?this.j.getState():_.go}getStats(){return this.a&&this.a.customData&&this.a.customData.stats?FH(this.a.customData.stats):_.jk()}isLive(){return-1===this.getDuration()}load(a){const b=this;return _.v(function*(){if(b.Pb())if(QH){b.D=_.Fk(a);
36
- _.Zh(a)&&(b.h=_.Yh(b.J,a));var c=b.D[b.C];yield TH(b,{source:c,isLive:c.isLive,autoplay:b.h.autoplay,Ea:b.h,tb:c.tb,audioMimeType:c.audioMimeType})}else b.m.warn(uH);else b.m.warn(wH)})}getBufferInfo(){return new _.yn}getTrackManager(){return this.g}getConfiguration(){return this.h}getSurface(){return null}setNetworkEngine(a){this.K=a}getNetworkEngine(){return this.K}getSourceIndex(){return this.C}setSourceIndex(a){this.C=a}getLoadedSource(){return this.D[this.C]}getPeriods(){return[]}getDrmInfo(){return null}getTimelineCues(){return[]}resetAbr(){this.m.warn(vH)}onError(a){if(a&&
37
- (this.trigger(new _.F(_.Oc,{detail:a})),this.j))this.j.onError(a)}namespace(){return _.pc}canPlay(){return this.Pb()?2:0}Hd(a){this.f=a}Xc(){this.f=null}Pc(a){this.f||(this.f={metadataType:chrome.cast.media.MetadataType.GENERIC});this.f.title=a}Gd(a){this.f||(this.f={metadataType:chrome.cast.media.MetadataType.GENERIC});this.f.images=[{url:a}]}Fd(a){this.f||(this.f={});this.f.metadataType=chrome.cast.media.MetadataType.MUSIC_TRACK;this.f.artist=a}Jd(a){this.f||(this.f={metadataType:chrome.cast.media.MetadataType.GENERIC});
38
- this.f.releaseDate=a}Qa(a){const b=cast.framework.CastContext.getInstance(),c=a.castState===cast.framework.CastState.CONNECTED;QH=a.castState!==cast.framework.CastState.NO_DEVICES_AVAILABLE;this.ca=c?b.getCurrentSession().getCastDevice().friendlyName:"";this.w.Md()}Ta(a){this.m.debug(`state: ${a.sessionState}, details:`,a);switch(a.sessionState){case cast.framework.SessionState.SESSION_STARTED:this.B=!0;WH(this,a.session);break;case cast.framework.SessionState.SESSION_RESUMED:this.Ya()||(this.B=!0,
39
- WH(this,a.session),this.Z());break;case cast.framework.SessionState.SESSION_ENDED:if(this.Ya()&&this.a){const d=this.a.media;var b=this.g.ha(),c=this.g.ia();b=b&&b.language||void 0;c=c&&c.language||void 0;this.S(this.getState(),{source:{url:d.contentId,type:d.contentType,isLive:d.streamType===chrome.cast.media.StreamType.LIVE},currentTime:this.getPosition(),Ae:c,Ud:b})}a.session.removeEventListener(cast.framework.SessionEventType.MEDIA_SESSION,this.V);a.session.removeMessageListener(BH,this.R);this.B=
40
- !1;this.a=null;this.I.release();this.o=this.H=null}}Sa(a){this.m.debug("New media session",a.mediaSession);VH(this,a.mediaSession)}Ra(a,b){if(a===BH&&0<this.F.size){const c=FH(b);this.F.forEach(d=>d(c))}}ma(a){this.trigger(new _.F(_.me,{currentTime:a.value}))}ua(a){const b=this;return _.v(function*(){let c=null;const d=yield GH(a,[_.ke,_.Nb],b.K,b.h);d&&(c=new chrome.cast.media.Track(b.ga++,chrome.cast.media.TrackType.TEXT),c.language=d.language,c.name=d.label||null,c.trackContentId=d.url,c.trackContentType=
41
- d.mimeType,c.customData={mimeType:a.mimeType,url:a.url});return c})}getTextDisplayer(){return null}};XH.prototype.getTextDisplayer=XH.prototype.getTextDisplayer;XH.prototype.getNetworkEngine=XH.prototype.getNetworkEngine;XH.prototype.setNetworkEngine=XH.prototype.setNetworkEngine;var QH=!1,NH=new Set;window.__onGCastApiAvailable=PH;var zI=class extends _.zn{constructor(a,b,c){super();this.f=a;this.h=b;this.j=typeof c===_.Qc?c:(d,e)=>{this.f&&d!==_.rk&&d!==_.zk&&this.f.load(e)};this.a=ZH(this);this.g=new _.O(yH);this.addDelegate(this.f)}destroy(){const a=this;return _.v(function*(){a.a&&(yield RH(a.a),a.a=null);a.removeDelegate(a.f)})}Wc(){return!!this.a&&this.a.Pb()&&QH}Ya(){return!!this.a&&this.a.Ya()}gd(){return this.a?this.a.gd():""}Ac(a){this.a&&this.a.Ac(a)}cast(a){const b=this;return _.v(function*(){if(b.a){var c,d=null;
26
+ c.src=b.trackContentId;c.mimeType=b.trackContentType;b.customData&&(c.src=b.customData.url||c.src,c.mimeType=b.customData.mimeType||c.mimeType);c.renditions.push(new _.sn(c.id,c));return c}):[],this.a.trigger(new _.F(_.xn)))}destroy(){this.a=null}getVideoTracks(){return dI(this,_.K)}getAudioTracks(){return dI(this,_.J)}ea(){return dI(this,_.I)}fa(){const a=this.Aa();return a?a.renditions[0]:null}xa(){const a=this.ha();return a?a.renditions[0]:null}za(){const a=this.ia();return a?a.renditions[0]:null}Ia(){return this.f[_.K]||
27
+ null}Ua(){return this.f[_.J]||null}Va(){return this.f[_.I]||null}Aa(){return fI(this,_.K)}ha(){return fI(this,_.J)}ia(){return fI(this,_.I)}Na(a){hI(this,_.K,a)}la(a){hI(this,_.J,a)}ta(a){hI(this,_.I,a)}Ma(a){this.Na(a&&a.track)}bb(a){this.la(a&&a.track)}cb(a){this.ta(a&&a.track)}addTextTrack(){return _.v(function*(){})}ja(){return!0}};Y.prototype.isAbrEnabled=Y.prototype.ja;Y.prototype.addTextTrack=Y.prototype.addTextTrack;Y.prototype.setTextRendition=Y.prototype.cb;
28
+ Y.prototype.setAudioRendition=Y.prototype.bb;Y.prototype.setVideoRendition=Y.prototype.Ma;Y.prototype.setTextTrack=Y.prototype.ta;Y.prototype.setAudioTrack=Y.prototype.la;Y.prototype.setVideoTrack=Y.prototype.Na;Y.prototype.getTextTrack=Y.prototype.ia;Y.prototype.getAudioTrack=Y.prototype.ha;Y.prototype.getVideoTrack=Y.prototype.Aa;Y.prototype.getLoadingTextRendition=Y.prototype.Va;Y.prototype.getLoadingAudioRendition=Y.prototype.Ua;Y.prototype.getLoadingVideoRendition=Y.prototype.Ia;
29
+ Y.prototype.getTextRendition=Y.prototype.za;Y.prototype.getAudioRendition=Y.prototype.xa;Y.prototype.getVideoRendition=Y.prototype.fa;Y.prototype.getTextTracks=Y.prototype.ea;Y.prototype.getAudioTracks=Y.prototype.getAudioTracks;Y.prototype.getVideoTracks=Y.prototype.getVideoTracks;var sI=class extends _.zn{constructor(a,b,c,d){super();this.m=new _.O(_.pc);this.T=a;this.w=new _.rh(b);this.S=c;this.W=d;this.h=this.J=_.Wh();this.D=[];this.C=0;this.K=new _.zl;this.H=this.o=this.a=null;this.B=this.A=!1;this.aa="";this.ga=1E6;this.g=new Y;this.g.j(this);this.j=new UI(this);this.I=new _.cn;this.f=null;this.F=new Set;this.N=this.Qa.bind(this);this.ca=this.Ta.bind(this);this.V=this.Sa.bind(this);this.R=this.Ra.bind(this);this.L=null;window.cast||Object.defineProperty(window,"cast",
30
+ {get:()=>window.cast_,set:e=>{window.cast_=e;window.setTimeout(()=>{kI(!0)},0)}});jI(this);iI.add(this)}init(a,b){this.h=this.J=b}unload(){return new Promise((a,b)=>{this.g&&this.g.release();this.a&&!this.a.idleReason||a();this.a.stop(null,a,b)})}release(){return this.unload().then(()=>{this.j&&this.j.release()})}destroy(){return _.v(function*(){})}Ac(a){this.L=a}Rb(){return this.A}Ya(){return this.B}jd(){return this.aa}sendMessage(a,b){const c=this;return _.v(function*(){let d;const e=cast.framework.CastContext.getInstance().getCurrentSession();
31
+ if(e)try{yield e.sendMessage(a,$H(b))}catch(f){d=new _.H(1,8,8E3,{detailedErrorCode:f})}else d=new _.H(1,8,8004,void 0);if(d)c.onError(d)})}cast(){const a=this;return _.v(function*(){if(!a.Rb())throw a.m.warn(SH),new _.H(1,8,8001,void 0);if(!lI)throw a.m.warn(QH),new _.H(1,8,8002,void 0);if(a.Ya())throw a.m.warn("Already casting"),new _.H(1,8,8003,void 0);try{yield nI(a)}catch(b){const c={};b instanceof chrome.cast.Error?(c.detailedErrorCode=b.code,c.details=b.details,c.reason=b.description):c.detailedErrorCode=
32
+ b;throw new _.H(1,8,8E3,c);}})}dd(){this.Ya()&&cast.framework.CastContext.getInstance().endCurrentSession(!0)}addMessageListener(a){typeof a===_.Qc&&this.F.add(a)}removeMessageListener(a){typeof a===_.Qc&&this.F.delete(a)}play(){return this.isEnded()?pI(this,!0):new Promise((a,b)=>{if(!this.a)return b(PH);this.a.play(null,a,b)})}pause(){return new Promise((a,b)=>{this.isEnded()&&a();if(!this.a)return b(PH);this.a.pause(null,a,b)})}isPaused(){return!!this.a&&this.a.playerState===chrome.cast.media.PlayerState.PAUSED}isEnded(){return this.getState()===
33
+ _.rk}seek(a){return this.isEnded()?pI(this,!1,a):new Promise((b,c)=>{this.a||c(PH);this.o.isPlayingBreak&&c(NH);const d=new chrome.cast.media.SeekRequest;d.currentTime=a;this.trigger(new _.F(_.ue));this.a.seek(d,()=>{this.trigger(new _.F(_.te));b()},c)})}getPosition(){return this.a&&this.a.getEstimatedTime()||0}getDuration(){return this.a&&this.a.media&&typeof this.a.media.duration===_.p?this.a.media.duration:0}setDrmCustomDataModifier(){}setCdnErrorCallback(){}getPlaybackRate(){return this.a&&this.a.playbackRate||
34
+ 0}setPlaybackRate(a){this.a&&0<a&&this.sendMessage(YH,{type:"SET_PLAYBACK_RATE",requestId:Math.round(1E3*Math.random()),mediaSessionId:this.a.mediaSessionId,playbackRate:a})}getVolume(){return this.a&&this.a.volume.level}setVolume(a){this.a&&0<=a&&1>=a&&(a=new chrome.cast.media.VolumeRequest(new chrome.cast.Volume(a)),this.a.setVolume(a))}isMuted(){return this.a&&this.a.volume.muted}setMuted(a){this.a&&(a=new chrome.cast.media.VolumeRequest(new chrome.cast.Volume(void 0,a)),this.a.setVolume(a))}getPresentationStartTime(){return this.a&&
35
+ this.a.media.startAbsoluteTime||0}getSeekRange(){let a={start:0,end:this.getDuration()};if(this.isLive()){const b=this.a.getEstimatedLiveSeekableRange();b&&typeof b.start===_.p&&typeof b.end===_.p&&(a={start:b.start,end:b.end})}return a}getState(){return this.j?this.j.getState():_.go}getStats(){return this.a&&this.a.customData&&this.a.customData.stats?aI(this.a.customData.stats):_.jk()}isLive(){return-1===this.getDuration()}load(a){const b=this;return _.v(function*(){if(b.Rb())if(lI){b.D=_.Fk(a);
36
+ _.Zh(a)&&(b.h=_.Yh(b.J,a));var c=b.D[b.C];yield oI(b,{source:c,isLive:c.isLive,autoplay:b.h.autoplay,Ea:b.h,tb:c.tb,audioMimeType:c.audioMimeType})}else b.m.warn(QH);else b.m.warn(SH)})}getBufferInfo(){return new _.yn}getTrackManager(){return this.g}getConfiguration(){return this.h}getSurface(){return null}setNetworkEngine(a){this.K=a}getNetworkEngine(){return this.K}getSourceIndex(){return this.C}setSourceIndex(a){this.C=a}getLoadedSource(){return this.D[this.C]}getPeriods(){return[]}getDrmInfo(){return null}getTimelineCues(){return[]}resetAbr(){this.m.warn(RH)}onError(a){if(a&&
37
+ (this.trigger(new _.F(_.Oc,{detail:a})),this.j))this.j.onError(a)}namespace(){return _.pc}canPlay(){return this.Rb()?2:0}Kd(a){this.f=a}Zc(){this.f=null}Rc(a){this.f||(this.f={metadataType:chrome.cast.media.MetadataType.GENERIC});this.f.title=a}Jd(a){this.f||(this.f={metadataType:chrome.cast.media.MetadataType.GENERIC});this.f.images=[{url:a}]}Hd(a){this.f||(this.f={});this.f.metadataType=chrome.cast.media.MetadataType.MUSIC_TRACK;this.f.artist=a}Ld(a){this.f||(this.f={metadataType:chrome.cast.media.MetadataType.GENERIC});
38
+ this.f.releaseDate=a}Qa(a){const b=cast.framework.CastContext.getInstance(),c=a.castState===cast.framework.CastState.CONNECTED;lI=a.castState!==cast.framework.CastState.NO_DEVICES_AVAILABLE;this.aa=c?b.getCurrentSession().getCastDevice().friendlyName:"";this.w.Od()}Ta(a){this.m.debug(`state: ${a.sessionState}, details:`,a);switch(a.sessionState){case cast.framework.SessionState.SESSION_STARTED:this.B=!0;rI(this,a.session);break;case cast.framework.SessionState.SESSION_RESUMED:this.Ya()||(this.B=!0,
39
+ rI(this,a.session),this.W());break;case cast.framework.SessionState.SESSION_ENDED:if(this.Ya()&&this.a){const d=this.a.media;var b=this.g.ha(),c=this.g.ia();b=b&&b.language||void 0;c=c&&c.language||void 0;this.S(this.getState(),{source:{url:d.contentId,type:d.contentType,isLive:d.streamType===chrome.cast.media.StreamType.LIVE},currentTime:this.getPosition(),Ae:c,Wd:b})}a.session.removeEventListener(cast.framework.SessionEventType.MEDIA_SESSION,this.V);a.session.removeMessageListener(XH,this.R);this.B=
40
+ !1;this.a=null;this.I.release();this.o=this.H=null}}Sa(a){this.m.debug("New media session",a.mediaSession);qI(this,a.mediaSession)}Ra(a,b){if(a===XH&&0<this.F.size){const c=aI(b);this.F.forEach(d=>d(c))}}na(a){this.trigger(new _.F(_.me,{currentTime:a.value}))}ua(a){const b=this;return _.v(function*(){let c=null;const d=yield bI(a,[_.ke,_.Nb],b.K,b.h);d&&(c=new chrome.cast.media.Track(b.ga++,chrome.cast.media.TrackType.TEXT),c.language=d.language,c.name=d.label||null,c.trackContentId=d.url,c.trackContentType=
41
+ d.mimeType,c.customData={mimeType:a.mimeType,url:a.url});return c})}getTextDisplayer(){return null}};sI.prototype.getTextDisplayer=sI.prototype.getTextDisplayer;sI.prototype.getNetworkEngine=sI.prototype.getNetworkEngine;sI.prototype.setNetworkEngine=sI.prototype.setNetworkEngine;var lI=!1,iI=new Set;window.__onGCastApiAvailable=kI;var VI=class extends _.zn{constructor(a,b,c){super();this.f=a;this.h=b;this.j=typeof c===_.Qc?c:(d,e)=>{this.f&&d!==_.rk&&d!==_.zk&&this.f.load(e)};this.a=uI(this);this.g=new _.O(UH);this.addDelegate(this.f)}destroy(){const a=this;return _.v(function*(){a.a&&(yield mI(a.a),a.a=null);a.removeDelegate(a.f)})}Yc(){return!!this.a&&this.a.Rb()&&lI}Ya(){return!!this.a&&this.a.Ya()}jd(){return this.a?this.a.jd():""}Ac(a){this.a&&this.a.Ac(a)}cast(a){const b=this;return _.v(function*(){if(b.a){var c,d=null;
42
42
  if(c=b.f.getLoadedSource()){var e=b.f.getTrackManager();d=e.getVideoTracks()[0];let f,g;d&&d.mimeType&&(f=d.mimeType);d=b.f.getConfiguration();const h=e.ha();h&&(h.mimeType&&(g=h.mimeType),h.language&&(d.preferredAudioLanguage=h.language),h.roles.length&&(d.preferredAudioRole=h.roles[0]));if(e=e.ia())e.language&&(d.preferredTextLanguage=e.language),e.roles.length&&(d.preferredTextRole=e.roles[0]);e=c&&typeof c.isLive===_.Zb?c.isLive:b.f.isLive();d={source:c,isLive:e,autoplay:!b.f.isPaused(),currentTime:Math.max(b.f.getPosition()-
43
- 1,0),tb:f,audioMimeType:g,Ea:d}}c=d;try{yield b.a.cast(),b.f&&b.a&&(yield YH(b),b.a&&(c&&(c.autoplay=!b.f.isPaused()),a?yield b.f.load(a):b.a.a||(yield TH(b.a,c))))}catch(f){b.g.error("Error while trying to cast",f),c=new _.F(_.Oc,{detail:f}),b.trigger(c)}}})}bd(){this.a&&this.a.bd()}Ke(a){const b=this;return _.v(function*(){a!==b.h&&(b.h=a,b.a&&(yield RH(b.a)),b.a=ZH(b))})}sendMessage(a){const b=this;return _.v(function*(){b.a?yield b.a.sendMessage(BH,a):b.g.warn(xH)})}addMessageListener(a){this.a?
44
- this.a.addMessageListener(a):this.g.warn(xH)}removeMessageListener(a){this.a?this.a.removeMessageListener(a):this.g.warn(xH)}Hd(a){this.a&&this.a.Hd(a)}Xc(){this.a&&this.a.Xc()}Pc(a){this.a&&this.a.Pc(a)}Gd(a){this.a&&this.a.Gd(a)}Fd(a){this.a&&this.a.Fd(a)}Jd(a){this.a&&this.a.Jd(a)}};_.x(yH,zI);zI.prototype.setContentReleaseDate=zI.prototype.Jd;zI.prototype.setContentArtist=zI.prototype.Fd;zI.prototype.setContentImage=zI.prototype.Gd;zI.prototype.setContentTitle=zI.prototype.Pc;
45
- zI.prototype.clearContentMetadata=zI.prototype.Xc;zI.prototype.setContentMetadata=zI.prototype.Hd;zI.prototype.removeMessageListener=zI.prototype.removeMessageListener;zI.prototype.addMessageListener=zI.prototype.addMessageListener;zI.prototype.sendMessage=zI.prototype.sendMessage;zI.prototype.changeReceiverId=zI.prototype.Ke;zI.prototype.forceDisconnect=zI.prototype.bd;zI.prototype.cast=zI.prototype.cast;zI.prototype.setPlayerConfigInterceptor=zI.prototype.Ac;zI.prototype.getReceiverName=zI.prototype.gd;
46
- zI.prototype.isCasting=zI.prototype.Ya;zI.prototype.canCast=zI.prototype.Wc;zI.prototype.destroy=zI.prototype.destroy;var AI=class extends xI{constructor(a){super(a,"clpp.cast.StateManager");this.I=this.S.bind(this);this.H=this.R.bind(this);this.A=this.ca.bind(this);this.w=this.Z.bind(this);this.K=this.V.bind(this);this.J=this.U.bind(this);this.L=this.ga.bind(this);this.F=this.da.bind(this);this.D=this.T.bind(this);this.g=this.P.bind(this)}init(){const a=cast.framework.events.EventType,b=cast.framework.CastReceiverContext.getInstance().getPlayerManager();b.addEventListener(a.PLAYING,this.I);b.addEventListener(a.PAUSE,
43
+ 1,0),tb:f,audioMimeType:g,Ea:d}}c=d;try{yield b.a.cast(),b.f&&b.a&&(yield tI(b),b.a&&(c&&(c.autoplay=!b.f.isPaused()),a?yield b.f.load(a):b.a.a||(yield oI(b.a,c))))}catch(f){b.g.error("Error while trying to cast",f),c=new _.F(_.Oc,{detail:f}),b.trigger(c)}}})}dd(){this.a&&this.a.dd()}Oe(a){const b=this;return _.v(function*(){a!==b.h&&(b.h=a,b.a&&(yield mI(b.a)),b.a=uI(b))})}sendMessage(a){const b=this;return _.v(function*(){b.a?yield b.a.sendMessage(XH,a):b.g.warn(TH)})}addMessageListener(a){this.a?
44
+ this.a.addMessageListener(a):this.g.warn(TH)}removeMessageListener(a){this.a?this.a.removeMessageListener(a):this.g.warn(TH)}Kd(a){this.a&&this.a.Kd(a)}Zc(){this.a&&this.a.Zc()}Rc(a){this.a&&this.a.Rc(a)}Jd(a){this.a&&this.a.Jd(a)}Hd(a){this.a&&this.a.Hd(a)}Ld(a){this.a&&this.a.Ld(a)}};_.x(UH,VI);VI.prototype.setContentReleaseDate=VI.prototype.Ld;VI.prototype.setContentArtist=VI.prototype.Hd;VI.prototype.setContentImage=VI.prototype.Jd;VI.prototype.setContentTitle=VI.prototype.Rc;
45
+ VI.prototype.clearContentMetadata=VI.prototype.Zc;VI.prototype.setContentMetadata=VI.prototype.Kd;VI.prototype.removeMessageListener=VI.prototype.removeMessageListener;VI.prototype.addMessageListener=VI.prototype.addMessageListener;VI.prototype.sendMessage=VI.prototype.sendMessage;VI.prototype.changeReceiverId=VI.prototype.Oe;VI.prototype.forceDisconnect=VI.prototype.dd;VI.prototype.cast=VI.prototype.cast;VI.prototype.setPlayerConfigInterceptor=VI.prototype.Ac;VI.prototype.getReceiverName=VI.prototype.jd;
46
+ VI.prototype.isCasting=VI.prototype.Ya;VI.prototype.canCast=VI.prototype.Yc;VI.prototype.destroy=VI.prototype.destroy;var WI=class extends TI{constructor(a){super(a,"clpp.cast.StateManager");this.I=this.S.bind(this);this.H=this.R.bind(this);this.A=this.aa.bind(this);this.w=this.W.bind(this);this.K=this.V.bind(this);this.J=this.T.bind(this);this.L=this.ga.bind(this);this.F=this.ca.bind(this);this.D=this.U.bind(this);this.g=this.N.bind(this)}init(){const a=cast.framework.events.EventType,b=cast.framework.CastReceiverContext.getInstance().getPlayerManager();b.addEventListener(a.PLAYING,this.I);b.addEventListener(a.PAUSE,
47
47
  this.H);b.addEventListener(a.MEDIA_FINISHED,this.A);b.addEventListener(a.BUFFERING,this.w);b.addEventListener(a.SEEKING,this.K);b.addEventListener(a.SEEKED,this.J);b.addEventListener(a.STALLED,this.L);b.addEventListener(a.PLAYER_LOADING,this.F);b.addEventListener(a.ERROR,this.D);b.addEventListener(a.BITRATE_CHANGED,this.g)}destroy(){const a=this,b=()=>Object.getPrototypeOf(Object.getPrototypeOf(this)).destroy;return _.v(function*(){const c=cast.framework.events.EventType,d=cast.framework.CastReceiverContext.getInstance().getPlayerManager();
48
- d.removeEventListener(c.PLAYING,a.I);d.removeEventListener(c.PAUSE,a.H);d.removeEventListener(c.MEDIA_FINISHED,a.A);d.removeEventListener(c.BUFFERING,a.w);d.removeEventListener(c.SEEKING,a.K);d.removeEventListener(c.SEEKED,a.J);d.removeEventListener(c.STALLED,a.L);d.removeEventListener(c.PLAYER_LOADING,a.F);d.removeEventListener(c.ERROR,a.D);d.removeEventListener(c.BITRATE_CHANGED,a.g);yield b().call(a)})}S(){this.f.trigger(new _.F(_.Jd));this.a(_.Ck)}R(){this.a(_.Bk)}ca(){this.a(_.rk)}Z(a){a.isBuffering?
49
- this.a(_.uk):(a=this.f.isPaused()?_.Bk:_.Ck,this.a(a))}V(){this.j=1;this.f.trigger(new _.F(_.ve))}U(){this.f.trigger(new _.F(_.te))}ga(){this.j=2}da(){this.a(_.Ak)}P(a){const b=this.f.getStats();this.f.trigger(new _.F(_.Yb,{detail:{bandwidth:a.totalBitrate,width:b.width,height:b.height}}))}T(a){a=new _.H(_.G,7,7300,{detailedErrorCode:a.detailedErrorCode,error:a.error,reason:a.reason});this.f.trigger(new _.F(_.Oc,{detail:a}));this.a(_.yk)}};var BI=class{constructor(a){this.Gb=a;this.a=this.f.bind(this)}init(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().addEventListener($H(),this.a)}release(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().removeEventListener($H(),this.a)}getTimelineCues(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager().getTimedMetadata().map(a=>aI(a))}f(a){if(a instanceof cast.framework.events.TimedMetadataEvent){var b=null;switch(a.type){case cast.framework.events.EventType.TIMED_METADATA_CHANGED:b=
50
- _.If;break;case cast.framework.events.EventType.TIMED_METADATA_ENTER:b=_.Kf;break;case cast.framework.events.EventType.TIMED_METADATA_EXIT:b=_.Lf}b&&this.Gb(new _.F(b,{detail:aI(a.timedMetadataInfo)}))}else for(b of this.getTimelineCues())this.Gb(new _.F(_.If,{detail:b}))}};var Z=class extends _.P{constructor(){super();this.g=new _.O("clpp.cast.TrackManager");this.l=null;this.w=1E9;this.h=[];this.m=[];this.o=this.A.bind(this);this.a=this.f=null}j(a){this.l=a;bI().addEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.o)}release(){this.h=[];this.m=[];this.a=this.f=null}load(){}destroy(){this.l=null;bI().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.o)}getVideoTracks(){return[]}getAudioTracks(){return this.h}ea(){return this.m}fa(){return null}xa(){const a=
51
- this.ha();return a&&a.renditions[0]}za(){const a=this.ia();return a&&a.renditions[0]}Ia(){return null}Ua(){return null}Va(){return null}Aa(){return null}ha(){let a=null;if(this.f){let b=this.f.getActiveId();typeof b===_.p&&(b=b.toString(),a=this.getAudioTracks().find(c=>c.id===b)||null)}return a}ia(){let a=null;if(this.a){let b=this.a.getActiveIds()[0];typeof b===_.p&&(b=b.toString(),a=this.ea().find(c=>c.id===b)||null)}return a}Na(){this.g.warn("Video tracks unavailable on Cast")}ka(a){a&&this.f&&
52
- this.f.setActiveById(+a.id)}ta(a){this.a&&(a?this.a.setActiveByIds([+a.id]):this.a.setActiveByIds([]))}Ma(){this.g.warn("Video renditions unavailable on Cast")}bb(a){this.ka(a&&a.track)}cb(a){this.ta(a&&a.track)}addTextTrack(a){const b=this;return _.v(function*(){var c=b.l.getConfiguration();if((c=yield GH(a,Object.values(cast.framework.messages.CaptionMimeType),b.l.getNetworkEngine(),c))&&b.a){const d=new cast.framework.messages.Track(b.w++,cast.framework.messages.TrackType.TEXT);d.isInBand=!1;d.language=
53
- c.language;d.name=c.label;d.subtype=c.kind;d.trackContentId=c.url;d.trackContentType=c.mimeType;d.customData={mimeType:a.mimeType,url:a.url};try{b.a.addTracks([d]),dI(b)}catch(e){throw b.g.warn("failed on track",a),e;}}})}ja(){return!0}A(){this.f=bI().getAudioTracksManager();var a=this.f.getTracks();this.h=cI(_.J,a);dI(this);a=this.l.getConfiguration();eI(this,_.J,a.preferredAudioLanguage,a.preferredAudioRole);eI(this,_.I,a.preferredTextLanguage,a.preferredTextRole)}};Z.prototype.isAbrEnabled=Z.prototype.ja;
54
- Z.prototype.addTextTrack=Z.prototype.addTextTrack;Z.prototype.setTextRendition=Z.prototype.cb;Z.prototype.setAudioRendition=Z.prototype.bb;Z.prototype.setVideoRendition=Z.prototype.Ma;Z.prototype.setTextTrack=Z.prototype.ta;Z.prototype.setAudioTrack=Z.prototype.ka;Z.prototype.setVideoTrack=Z.prototype.Na;Z.prototype.getTextTrack=Z.prototype.ia;Z.prototype.getAudioTrack=Z.prototype.ha;Z.prototype.getVideoTrack=Z.prototype.Aa;Z.prototype.getLoadingTextRendition=Z.prototype.Va;
55
- Z.prototype.getLoadingAudioRendition=Z.prototype.Ua;Z.prototype.getLoadingVideoRendition=Z.prototype.Ia;Z.prototype.getTextRendition=Z.prototype.za;Z.prototype.getAudioRendition=Z.prototype.xa;Z.prototype.getVideoRendition=Z.prototype.fa;Z.prototype.getTextTracks=Z.prototype.ea;Z.prototype.getAudioTracks=Z.prototype.getAudioTracks;Z.prototype.getVideoTracks=Z.prototype.getVideoTracks;var CI=class extends _.zn{constructor(){super();this.C=new _.O(zH);this.g=this.o=_.Wh();this.w=null;this.j=-1;this.D=new _.zl;this.f=this.m=this.h=this.a=this.A=null;this.B=!1}init(a,b){this.A=a;b&&(this.g=this.o=b);a=fI();a.setMessageInterceptor(cast.framework.messages.MessageType.MEDIA_STATUS,this.H.bind(this));a.setMediaPlaybackInfoHandler(this.F.bind(this));this.a=new AI(this);this.a.init();this.h=new Z;this.h.j(this);this.m=new BI(c=>this.trigger(c));this.m.init()}unload(){const a=fI();a.getPlayerState()!==
56
- cast.framework.messages.PlayerState.IDLE&&a.stop();this.h&&this.h.release();this.m&&this.m.release();this.f=null;return Promise.resolve()}release(){return this.unload().then(()=>{this.a&&this.a.release()})}destroy(){const a=this;return _.v(function*(){a.A=null;a.o=_.Wh();a.g=a.o;a.j=-1;a.w=null;a.a&&(yield a.a.destroy(),a.a=null);a.h&&(a.h.destroy(),a.h=null)})}play(){const a=fI();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot play during ads playout.");a.play();
57
- return Promise.resolve()}pause(){const a=fI();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot pause during ads playout.");a.pause();return Promise.resolve()}isPaused(){return fI().getPlayerState()===cast.framework.messages.PlayerState.PAUSED}isEnded(){return fI().getPlayerState()===cast.framework.messages.PlayerState.IDLE}seek(a){const b=fI();if(null!==b.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject(rH);b.seek(a);return Promise.resolve()}getPosition(){return fI().getCurrentTimeSec()}getDuration(){return fI().getDurationSec()}getPlaybackRate(){return fI().getPlaybackRate()}setPlaybackRate(a){if(0<
58
- a){const b=new cast.framework.messages.SetPlaybackRateRequestData;b.playbackRate=a;fI().sendLocalMediaRequest(b)}}getVolume(){return cast.framework.CastReceiverContext.getInstance().getSystemVolume().level||null}setVolume(a){0<=a&&1>=a&&cast.framework.CastReceiverContext.getInstance().setSystemVolumeLevel(a)}setMuted(a){cast.framework.CastReceiverContext.getInstance().setSystemVolumeMuted(a)}isMuted(){return cast.framework.CastReceiverContext.getInstance().getSystemVolume().muted||null}getLoadedSource(){const a=
59
- fI().getMediaInformation();if(a){var b=fI().getPlaybackConfig();b=!!b&&b.protectionSystem!==cast.framework.ContentProtection.NONE;var c=this.w&&-1!==this.j?this.w[this.j]:null;c=c?c.name:void 0;!c&&a.metadata&&(c=a.metadata.title);return{url:a.contentId,type:a.contentType,Of:b,name:c}}return null}getDrmInfo(){return null}getPresentationStartTime(){const a=fI().getMediaInformation();return a?a.startAbsoluteTime||0:0}getSeekRange(){let a={start:0,end:this.getDuration()};if(this.isLive()){const b=fI().getLiveSeekableRange();
60
- b&&typeof b.start===_.p&&typeof b.end===_.p&&(a={start:b.start,end:b.end})}return a}getState(){return this.a?this.a.getState():_.go}getStats(){var a=_.jk();if(this.f){a=fI().getStats();this.f.m=a.estimatedBandwidth||NaN;this.f.A=a.streamBandwidth||NaN;var b=this.f,c=a.height||NaN;b.j=a.width||NaN;b.f=c;b=this.f;c=typeof a.decodedFrames===_.p?a.decodedFrames:NaN;b.h=typeof a.droppedFrames===_.p?a.droppedFrames:NaN;b.g=c;a=this.f.getStats()}return a}isLive(){return-1===this.getDuration()}load(a){const b=
61
- this;return _.v(function*(){b.f=new _.eo;b.a.m=b.f.a;b.w=_.Fk(a);_.Zh(a)&&(b.g=_.Yh(b.o,a));if(b.B)b.B=!1;else{var c=b.w[b.j],d=new cast.framework.messages.LoadRequestData;d.autoplay=b.g.autoplay;typeof b.g.startTime===_.p&&(d.currentTime=b.g.startTime);c.type&&(d.media.contentType=c.type);d.media.contentId=c.url;d.media.customData={playerConfiguration:EH(b.g),local:!0};yield fI().load(d)}})}getBufferInfo(){this.C.warn(_.ka);return new _.yn}getTrackManager(){return this.h}getConfiguration(){return this.g}getSurface(){return this.A}setNetworkEngine(a){this.D=
62
- a}getNetworkEngine(){return this.D}getSourceIndex(){return this.j}setSourceIndex(a){this.j=a}getPeriods(){return[]}namespace(){return zH}getTimelineCues(){return this.m&&this.m.getTimelineCues()||[]}resetAbr(){this.C.warn(vH)}onError(a){a=new _.F(_.Oc,{detail:a});this.trigger(a)}canPlay(){return _.Eh()?2:0}H(a){a.customData||(a.customData={});a.customData.stats=EH(this.getStats());return a}F(a,b){let c=null;a.media.customData&&(c=FH(a.media.customData.playerConfiguration));(a=c?c.abr:null)&&typeof a.defaultBandwidthEstimate===
63
- _.p?b.initialBandwidth=a.defaultBandwidthEstimate:b.initialBandwidth=void 0;iI(c,b);return b}getTextDisplayer(){return null}setDrmCustomDataModifier(){}setCdnErrorCallback(){}};CI.prototype.getTextDisplayer=CI.prototype.getTextDisplayer;CI.prototype.getNetworkEngine=CI.prototype.getNetworkEngine;CI.prototype.setNetworkEngine=CI.prototype.setNetworkEngine;var X=class{constructor(a,b,c,d,e){this.a=a;this.f=b;this.h=typeof c===_.p?c:1;this.j=typeof d===_.p?d:1;this.g=typeof e===_.p?e:0}gb(){return"Google Cast Framework"}hb(){return cast.framework.VERSION}mb(){return 0}aa(){return""}getCreativeId(){return""}getApiFramework(){return null}getAdSystem(){return""}getAdvertiserName(){return""}getTitle(){return this.a.title||""}getDuration(){return this.a.duration||0}getSkipTimeOffset(){return this.a.whenSkippable||0}Rb(){return!1}xb(){return this.a.clickThroughUrl||
64
- null}getMediaUrl(){return this.a.contentUrl||this.a.contentId||null}jb(){return 0}ib(){return 0}Wa(){return 0}Ja(){switch(this.yb()){case 0:return 0;case -1:return 2;default:return 1}}getPodIndex(){return this.g}yb(){return this.f.position}zb(){return this.h}lb(){return this.j}getWrapperAdIds(){return[]}getWrapperAdSystems(){return[]}getWrapperCreativeIds(){return[]}};X.prototype.getWrapperCreativeIds=X.prototype.getWrapperCreativeIds;X.prototype.getWrapperAdSystems=X.prototype.getWrapperAdSystems;
65
- X.prototype.getWrapperAdIds=X.prototype.getWrapperAdIds;X.prototype.getSequenceLength=X.prototype.lb;X.prototype.getPositionInSequence=X.prototype.zb;X.prototype.getPodTimeOffset=X.prototype.yb;X.prototype.getPodIndex=X.prototype.getPodIndex;X.prototype.getPodType=X.prototype.Ja;X.prototype.getMediaBitrate=X.prototype.Wa;X.prototype.getMediaHeight=X.prototype.ib;X.prototype.getMediaWidth=X.prototype.jb;X.prototype.getMediaUrl=X.prototype.getMediaUrl;X.prototype.getClickThroughUrl=X.prototype.xb;
66
- X.prototype.isBumper=X.prototype.Rb;X.prototype.getSkipTimeOffset=X.prototype.getSkipTimeOffset;X.prototype.getDuration=X.prototype.getDuration;X.prototype.getTitle=X.prototype.getTitle;X.prototype.getAdvertiserName=X.prototype.getAdvertiserName;X.prototype.getAdSystem=X.prototype.getAdSystem;X.prototype.getApiFramework=X.prototype.getApiFramework;X.prototype.getCreativeId=X.prototype.getCreativeId;X.prototype.getId=X.prototype.aa;X.prototype.getTechnology=X.prototype.mb;
67
- X.prototype.getAdManagerVersion=X.prototype.hb;X.prototype.getAdManagerName=X.prototype.gb;var DI=class{constructor(a){this.a=a}getCuePoints(){return this.a.map(a=>a.position)}Ab(){return!!this.a.find(a=>0===a.position)}Xa(){return!!this.a.find(a=>-1===a.position)}};DI.prototype.hasPostroll=DI.prototype.Xa;DI.prototype.hasPreroll=DI.prototype.Ab;DI.prototype.getCuePoints=DI.prototype.getCuePoints;var EI=class{constructor(a){this.l=a;this.a=null;this.g=this.h.bind(this);this.f=[cast.framework.events.EventType.PLAYER_LOADING,cast.framework.events.EventType.BREAK_CLIP_LOADING,cast.framework.events.EventType.BREAK_STARTED,cast.framework.events.EventType.BREAK_ENDED,cast.framework.events.EventType.BREAK_CLIP_STARTED,cast.framework.events.EventType.BREAK_CLIP_ENDED,cast.framework.events.EventType.PLAYING,cast.framework.events.EventType.PAUSE,cast.framework.events.EventType.BUFFERING];nI().addEventListener(this.f,
68
- this.g)}load(){const a=this;return _.v(function*(){jI&&(jI=!1,mI(a,0))})}start(){return _.v(function*(){nI().play()})}resume(){-1!==this.getPosition()&&nI().play()}pause(){-1!==this.getPosition()&&nI().pause()}skip(){}getVolume(){return this.l.getVolume()||0}setVolume(a){this.l.setVolume(a)}getPosition(){const a=this.a&&this.a.getBreakClipCurrentTimeSec();return typeof a===_.p?a:-1}dispose(){const a=this;return _.v(function*(){nI().removeEventListener(a.f,a.g)})}h(a){const b=cast.framework.events.EndedReason;
69
- switch(a.type){case cast.framework.events.EventType.PLAYER_LOADING:this.a=nI().getBreakManager();this.a.setPlayWatchedBreak(!0);a=this.a.getBreaks();this.l.trigger(new _.F(_.Db,{adsTimeline:new DI(a)}));break;case cast.framework.events.EventType.BREAK_CLIP_LOADING:pI(this,_.tb,a);break;case cast.framework.events.EventType.BREAK_STARTED:pI(this,_.mb,a);break;case cast.framework.events.EventType.BREAK_ENDED:pI(this,_.nb,a);break;case cast.framework.events.EventType.BREAK_CLIP_STARTED:pI(this,_.zb,a);
70
- break;case cast.framework.events.EventType.BREAK_CLIP_ENDED:a.endedReason===b.SKIPPED?(pI(this,_.yb,a),pI(this,_.Ab,a)):a.endedReason===b.STOPPED?pI(this,_.Ab,a):a.endedReason===b.END_OF_STREAM?(pI(this,_.qb,a),pI(this,_.Ab,a)):a.endedReason===b.ERROR&&mI(this,1);break;case cast.framework.events.EventType.PLAYING:pI(this,_.xb,a);break;case cast.framework.events.EventType.PAUSE:pI(this,_.vb,a);break;case cast.framework.events.EventType.BUFFERING:a.isBuffering?pI(this,_.ob,a):pI(this,_.xb,a)}}};
71
- EI.prototype.getPosition=EI.prototype.getPosition;EI.prototype.setVolume=EI.prototype.setVolume;EI.prototype.getVolume=EI.prototype.getVolume;EI.prototype.skip=EI.prototype.skip;EI.prototype.pause=EI.prototype.pause;EI.prototype.resume=EI.prototype.resume;var jI=!1;var rI=class{constructor(){this.a=!1;this.h=new _.O(AH);this.f=this.l=null;this.g=new Set;this.A=this.F.bind(this);this.w=this.B.bind(this);this.j=null;this.o=new _.cn;this.m=null}init(a){a&&(this.f=new CI,_.Il(a,this.f),this.l=a,this.o.on(window,"unload",()=>{const b=this;return _.v(function*(){b.l&&b.l.getState()!==_.zk&&(yield DH(b.l))})}))}start(){if(!this.a&&window.cast&&cast.framework&&cast.framework.CastReceiverContext){this.a=!0;var a=cast.framework.CastReceiverContext.getInstance(),b=a.getPlayerManager(),
72
- c=new cast.framework.CastReceiverOptions;c.customNamespaces={};c.customNamespaces[BH]=cast.framework.system.MessageType.JSON;var d=new cast.framework.PlaybackConfig;d.manifestHandler=this.D.bind(this);d.shakaConfig={streaming:{ignoreTextStreamFailures:!0}};c.playbackConfig=d;if(d=this.l&&this.l.getSurface().getMedia())c.mediaElement=d;c.disableIdleTimeout=!0;c.maxInactivity=Infinity;b.setMessageInterceptor(cast.framework.messages.MessageType.LOAD,this.C.bind(this));b.addEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,
73
- this.A);a.start(c);a.addCustomMessageListener(BH,this.w)}}stop(){if(this.a){this.a=!1;this.o.release();const a=cast.framework.CastReceiverContext.getInstance();a.getPlayerManager().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.A);a.removeCustomMessageListener(BH,this.w);a.stop();this.l=this.f=null}}Ac(a){this.j=a}rf(a){this.m=a}on(a,b){cast.framework.CastReceiverContext.getInstance().addEventListener(a,b)}off(a,b){cast.framework.CastReceiverContext.getInstance().removeEventListener(a,
74
- b)}addMessageListener(a){typeof a===_.Qc&&this.g.add(a)}removeMessageListener(a){typeof a===_.Qc&&this.g.delete(a)}sendMessage(a,b){cast.framework.CastReceiverContext.getInstance().sendCustomMessage(BH,b,EH(a))}Pb(){return this.a}Ye(){let a=null;const b=cast.framework.CastReceiverContext.getInstance().getPlayerManager().getMediaInformation();b&&b.metadata&&(a=b.metadata);return _.bf(a)}D(a){a=a.trim();if(a.startsWith("#EXTM3U"))return uI(this,a);try{var b=(new DOMParser).parseFromString(a,_.le)}catch(k){return a}var c=
48
+ d.removeEventListener(c.PLAYING,a.I);d.removeEventListener(c.PAUSE,a.H);d.removeEventListener(c.MEDIA_FINISHED,a.A);d.removeEventListener(c.BUFFERING,a.w);d.removeEventListener(c.SEEKING,a.K);d.removeEventListener(c.SEEKED,a.J);d.removeEventListener(c.STALLED,a.L);d.removeEventListener(c.PLAYER_LOADING,a.F);d.removeEventListener(c.ERROR,a.D);d.removeEventListener(c.BITRATE_CHANGED,a.g);yield b().call(a)})}S(){this.f.trigger(new _.F(_.Jd));this.a(_.Ck)}R(){this.a(_.Bk)}aa(){this.a(_.rk)}W(a){a.isBuffering?
49
+ this.a(_.uk):(a=this.f.isPaused()?_.Bk:_.Ck,this.a(a))}V(){this.j=1;this.f.trigger(new _.F(_.ue))}T(){this.f.trigger(new _.F(_.te))}ga(){this.j=2}ca(){this.a(_.Ak)}N(a){const b=this.f.getStats();this.f.trigger(new _.F(_.Yb,{detail:{bandwidth:a.totalBitrate,width:b.width,height:b.height}}))}U(a){a=new _.H(_.G,7,7300,{detailedErrorCode:a.detailedErrorCode,error:a.error,reason:a.reason});this.f.trigger(new _.F(_.Oc,{detail:a}));this.a(_.yk)}};var XI=class{constructor(a){this.Ib=a;this.a=this.f.bind(this)}init(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().addEventListener(vI(),this.a)}release(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().removeEventListener(vI(),this.a)}getTimelineCues(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager().getTimedMetadata().map(a=>wI(a))}f(a){if(a instanceof cast.framework.events.TimedMetadataEvent){var b=null;switch(a.type){case cast.framework.events.EventType.TIMED_METADATA_CHANGED:b=
50
+ _.If;break;case cast.framework.events.EventType.TIMED_METADATA_ENTER:b=_.Kf;break;case cast.framework.events.EventType.TIMED_METADATA_EXIT:b=_.Lf}b&&this.Ib(new _.F(b,{detail:wI(a.timedMetadataInfo)}))}else for(b of this.getTimelineCues())this.Ib(new _.F(_.If,{detail:b}))}};var Z=class extends _.P{constructor(){super();this.g=new _.O("clpp.cast.TrackManager");this.l=null;this.w=1E9;this.h=[];this.m=[];this.o=this.A.bind(this);this.a=this.f=null}j(a){this.l=a;xI().addEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.o)}release(){this.h=[];this.m=[];this.a=this.f=null}load(){}destroy(){this.l=null;xI().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.o)}getVideoTracks(){return[]}getAudioTracks(){return this.h}ea(){return this.m}fa(){return null}xa(){const a=
51
+ this.ha();return a&&a.renditions[0]}za(){const a=this.ia();return a&&a.renditions[0]}Ia(){return null}Ua(){return null}Va(){return null}Aa(){return null}ha(){let a=null;if(this.f){let b=this.f.getActiveId();typeof b===_.p&&(b=b.toString(),a=this.getAudioTracks().find(c=>c.id===b)||null)}return a}ia(){let a=null;if(this.a){let b=this.a.getActiveIds()[0];typeof b===_.p&&(b=b.toString(),a=this.ea().find(c=>c.id===b)||null)}return a}Na(){this.g.warn("Video tracks unavailable on Cast")}la(a){a&&this.f&&
52
+ this.f.setActiveById(+a.id)}ta(a){this.a&&(a?this.a.setActiveByIds([+a.id]):this.a.setActiveByIds([]))}Ma(){this.g.warn("Video renditions unavailable on Cast")}bb(a){this.la(a&&a.track)}cb(a){this.ta(a&&a.track)}addTextTrack(a){const b=this;return _.v(function*(){var c=b.l.getConfiguration();if((c=yield bI(a,Object.values(cast.framework.messages.CaptionMimeType),b.l.getNetworkEngine(),c))&&b.a){const d=new cast.framework.messages.Track(b.w++,cast.framework.messages.TrackType.TEXT);d.isInBand=!1;d.language=
53
+ c.language;d.name=c.label;d.subtype=c.kind;d.trackContentId=c.url;d.trackContentType=c.mimeType;d.customData={mimeType:a.mimeType,url:a.url};try{b.a.addTracks([d]),zI(b)}catch(e){throw b.g.warn("failed on track",a),e;}}})}ja(){return!0}A(){this.f=xI().getAudioTracksManager();var a=this.f.getTracks();this.h=yI(_.J,a);zI(this);a=this.l.getConfiguration();AI(this,_.J,a.preferredAudioLanguage,a.preferredAudioRole);AI(this,_.I,a.preferredTextLanguage,a.preferredTextRole)}};Z.prototype.isAbrEnabled=Z.prototype.ja;
54
+ Z.prototype.addTextTrack=Z.prototype.addTextTrack;Z.prototype.setTextRendition=Z.prototype.cb;Z.prototype.setAudioRendition=Z.prototype.bb;Z.prototype.setVideoRendition=Z.prototype.Ma;Z.prototype.setTextTrack=Z.prototype.ta;Z.prototype.setAudioTrack=Z.prototype.la;Z.prototype.setVideoTrack=Z.prototype.Na;Z.prototype.getTextTrack=Z.prototype.ia;Z.prototype.getAudioTrack=Z.prototype.ha;Z.prototype.getVideoTrack=Z.prototype.Aa;Z.prototype.getLoadingTextRendition=Z.prototype.Va;
55
+ Z.prototype.getLoadingAudioRendition=Z.prototype.Ua;Z.prototype.getLoadingVideoRendition=Z.prototype.Ia;Z.prototype.getTextRendition=Z.prototype.za;Z.prototype.getAudioRendition=Z.prototype.xa;Z.prototype.getVideoRendition=Z.prototype.fa;Z.prototype.getTextTracks=Z.prototype.ea;Z.prototype.getAudioTracks=Z.prototype.getAudioTracks;Z.prototype.getVideoTracks=Z.prototype.getVideoTracks;var YI=class extends _.zn{constructor(){super();this.C=new _.O(VH);this.g=this.o=_.Wh();this.w=null;this.j=-1;this.D=new _.zl;this.f=this.m=this.h=this.a=this.A=null;this.B=!1}init(a,b){this.A=a;b&&(this.g=this.o=b);a=BI();a.setMessageInterceptor(cast.framework.messages.MessageType.MEDIA_STATUS,this.H.bind(this));a.setMediaPlaybackInfoHandler(this.F.bind(this));this.a=new WI(this);this.a.init();this.h=new Z;this.h.j(this);this.m=new XI(c=>this.trigger(c));this.m.init()}unload(){const a=BI();a.getPlayerState()!==
56
+ cast.framework.messages.PlayerState.IDLE&&a.stop();this.h&&this.h.release();this.m&&this.m.release();this.f=null;return Promise.resolve()}release(){return this.unload().then(()=>{this.a&&this.a.release()})}destroy(){const a=this;return _.v(function*(){a.A=null;a.o=_.Wh();a.g=a.o;a.j=-1;a.w=null;a.a&&(yield a.a.destroy(),a.a=null);a.h&&(a.h.destroy(),a.h=null)})}play(){const a=BI();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot play during ads playout.");a.play();
57
+ return Promise.resolve()}pause(){const a=BI();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot pause during ads playout.");a.pause();return Promise.resolve()}isPaused(){return BI().getPlayerState()===cast.framework.messages.PlayerState.PAUSED}isEnded(){return BI().getPlayerState()===cast.framework.messages.PlayerState.IDLE}seek(a){const b=BI();if(null!==b.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject(NH);b.seek(a);return Promise.resolve()}getPosition(){return BI().getCurrentTimeSec()}getDuration(){return BI().getDurationSec()}getPlaybackRate(){return BI().getPlaybackRate()}setPlaybackRate(a){if(0<
58
+ a){const b=new cast.framework.messages.SetPlaybackRateRequestData;b.playbackRate=a;BI().sendLocalMediaRequest(b)}}getVolume(){return cast.framework.CastReceiverContext.getInstance().getSystemVolume().level||null}setVolume(a){0<=a&&1>=a&&cast.framework.CastReceiverContext.getInstance().setSystemVolumeLevel(a)}setMuted(a){cast.framework.CastReceiverContext.getInstance().setSystemVolumeMuted(a)}isMuted(){return cast.framework.CastReceiverContext.getInstance().getSystemVolume().muted||null}getLoadedSource(){const a=
59
+ BI().getMediaInformation();if(a){var b=BI().getPlaybackConfig();b=!!b&&b.protectionSystem!==cast.framework.ContentProtection.NONE;var c=this.w&&-1!==this.j?this.w[this.j]:null;c=c?c.name:void 0;!c&&a.metadata&&(c=a.metadata.title);return{url:a.contentId,type:a.contentType,Tf:b,name:c}}return null}getDrmInfo(){return null}getPresentationStartTime(){const a=BI().getMediaInformation();return a?a.startAbsoluteTime||0:0}getSeekRange(){let a={start:0,end:this.getDuration()};if(this.isLive()){const b=BI().getLiveSeekableRange();
60
+ b&&typeof b.start===_.p&&typeof b.end===_.p&&(a={start:b.start,end:b.end})}return a}getState(){return this.a?this.a.getState():_.go}getStats(){var a=_.jk();if(this.f){a=BI().getStats();this.f.m=a.estimatedBandwidth||NaN;this.f.A=a.streamBandwidth||NaN;var b=this.f,c=a.height||NaN;b.j=a.width||NaN;b.f=c;b=this.f;c=typeof a.decodedFrames===_.p?a.decodedFrames:NaN;b.h=typeof a.droppedFrames===_.p?a.droppedFrames:NaN;b.g=c;a=this.f.getStats()}return a}isLive(){return-1===this.getDuration()}load(a){const b=
61
+ this;return _.v(function*(){b.f=new _.eo;b.a.m=b.f.a;b.w=_.Fk(a);_.Zh(a)&&(b.g=_.Yh(b.o,a));if(b.B)b.B=!1;else{var c=b.w[b.j],d=new cast.framework.messages.LoadRequestData;d.autoplay=b.g.autoplay;typeof b.g.startTime===_.p&&(d.currentTime=b.g.startTime);c.type&&(d.media.contentType=c.type);d.media.contentId=c.url;d.media.customData={playerConfiguration:$H(b.g),local:!0};yield BI().load(d)}})}getBufferInfo(){this.C.warn(_.ka);return new _.yn}getTrackManager(){return this.h}getConfiguration(){return this.g}getSurface(){return this.A}setNetworkEngine(a){this.D=
62
+ a}getNetworkEngine(){return this.D}getSourceIndex(){return this.j}setSourceIndex(a){this.j=a}getPeriods(){return[]}namespace(){return VH}getTimelineCues(){return this.m&&this.m.getTimelineCues()||[]}resetAbr(){this.C.warn(RH)}onError(a){a=new _.F(_.Oc,{detail:a});this.trigger(a)}canPlay(){return _.Eh()?2:0}H(a){a.customData||(a.customData={});a.customData.stats=$H(this.getStats());return a}F(a,b){let c=null;a.media.customData&&(c=aI(a.media.customData.playerConfiguration));(a=c?c.abr:null)&&typeof a.defaultBandwidthEstimate===
63
+ _.p?b.initialBandwidth=a.defaultBandwidthEstimate:b.initialBandwidth=void 0;EI(c,b);return b}getTextDisplayer(){return null}setDrmCustomDataModifier(){}setCdnErrorCallback(){}};YI.prototype.getTextDisplayer=YI.prototype.getTextDisplayer;YI.prototype.getNetworkEngine=YI.prototype.getNetworkEngine;YI.prototype.setNetworkEngine=YI.prototype.setNetworkEngine;var X=class{constructor(a,b,c,d,e){this.a=a;this.f=b;this.h=typeof c===_.p?c:1;this.j=typeof d===_.p?d:1;this.g=typeof e===_.p?e:0}gb(){return"Google Cast Framework"}hb(){return cast.framework.VERSION}mb(){return 0}ba(){return""}getCreativeId(){return""}getApiFramework(){return null}getAdSystem(){return""}getAdvertiserName(){return""}getTitle(){return this.a.title||""}getDuration(){return this.a.duration||0}getSkipTimeOffset(){return this.a.whenSkippable||0}Tb(){return!1}zb(){return this.a.clickThroughUrl||
64
+ null}getMediaUrl(){return this.a.contentUrl||this.a.contentId||null}jb(){return 0}ib(){return 0}Wa(){return 0}Ja(){switch(this.Ab()){case 0:return 0;case -1:return 2;default:return 1}}getPodIndex(){return this.g}Ab(){return this.f.position}Bb(){return this.h}lb(){return this.j}getWrapperAdIds(){return[]}getWrapperAdSystems(){return[]}getWrapperCreativeIds(){return[]}};X.prototype.getWrapperCreativeIds=X.prototype.getWrapperCreativeIds;X.prototype.getWrapperAdSystems=X.prototype.getWrapperAdSystems;
65
+ X.prototype.getWrapperAdIds=X.prototype.getWrapperAdIds;X.prototype.getSequenceLength=X.prototype.lb;X.prototype.getPositionInSequence=X.prototype.Bb;X.prototype.getPodTimeOffset=X.prototype.Ab;X.prototype.getPodIndex=X.prototype.getPodIndex;X.prototype.getPodType=X.prototype.Ja;X.prototype.getMediaBitrate=X.prototype.Wa;X.prototype.getMediaHeight=X.prototype.ib;X.prototype.getMediaWidth=X.prototype.jb;X.prototype.getMediaUrl=X.prototype.getMediaUrl;X.prototype.getClickThroughUrl=X.prototype.zb;
66
+ X.prototype.isBumper=X.prototype.Tb;X.prototype.getSkipTimeOffset=X.prototype.getSkipTimeOffset;X.prototype.getDuration=X.prototype.getDuration;X.prototype.getTitle=X.prototype.getTitle;X.prototype.getAdvertiserName=X.prototype.getAdvertiserName;X.prototype.getAdSystem=X.prototype.getAdSystem;X.prototype.getApiFramework=X.prototype.getApiFramework;X.prototype.getCreativeId=X.prototype.getCreativeId;X.prototype.getId=X.prototype.ba;X.prototype.getTechnology=X.prototype.mb;
67
+ X.prototype.getAdManagerVersion=X.prototype.hb;X.prototype.getAdManagerName=X.prototype.gb;var ZI=class{constructor(a){this.a=a}getCuePoints(){return this.a.map(a=>a.position)}Cb(){return!!this.a.find(a=>0===a.position)}Xa(){return!!this.a.find(a=>-1===a.position)}};ZI.prototype.hasPostroll=ZI.prototype.Xa;ZI.prototype.hasPreroll=ZI.prototype.Cb;ZI.prototype.getCuePoints=ZI.prototype.getCuePoints;var $I=class{constructor(a){this.l=a;this.a=null;this.g=this.h.bind(this);this.f=[cast.framework.events.EventType.PLAYER_LOADING,cast.framework.events.EventType.BREAK_CLIP_LOADING,cast.framework.events.EventType.BREAK_STARTED,cast.framework.events.EventType.BREAK_ENDED,cast.framework.events.EventType.BREAK_CLIP_STARTED,cast.framework.events.EventType.BREAK_CLIP_ENDED,cast.framework.events.EventType.PLAYING,cast.framework.events.EventType.PAUSE,cast.framework.events.EventType.BUFFERING];JI().addEventListener(this.f,
68
+ this.g)}load(){const a=this;return _.v(function*(){FI&&(FI=!1,II(a,0))})}start(){return _.v(function*(){JI().play()})}resume(){-1!==this.getPosition()&&JI().play()}pause(){-1!==this.getPosition()&&JI().pause()}skip(){}getVolume(){return this.l.getVolume()||0}setVolume(a){this.l.setVolume(a)}getPosition(){const a=this.a&&this.a.getBreakClipCurrentTimeSec();return typeof a===_.p?a:-1}dispose(){const a=this;return _.v(function*(){JI().removeEventListener(a.f,a.g)})}h(a){const b=cast.framework.events.EndedReason;
69
+ switch(a.type){case cast.framework.events.EventType.PLAYER_LOADING:this.a=JI().getBreakManager();this.a.setPlayWatchedBreak(!0);a=this.a.getBreaks();this.l.trigger(new _.F(_.Db,{adsTimeline:new ZI(a)}));break;case cast.framework.events.EventType.BREAK_CLIP_LOADING:LI(this,_.tb,a);break;case cast.framework.events.EventType.BREAK_STARTED:LI(this,_.mb,a);break;case cast.framework.events.EventType.BREAK_ENDED:LI(this,_.nb,a);break;case cast.framework.events.EventType.BREAK_CLIP_STARTED:LI(this,_.zb,a);
70
+ break;case cast.framework.events.EventType.BREAK_CLIP_ENDED:a.endedReason===b.SKIPPED?(LI(this,_.yb,a),LI(this,_.Ab,a)):a.endedReason===b.STOPPED?LI(this,_.Ab,a):a.endedReason===b.END_OF_STREAM?(LI(this,_.qb,a),LI(this,_.Ab,a)):a.endedReason===b.ERROR&&II(this,1);break;case cast.framework.events.EventType.PLAYING:LI(this,_.xb,a);break;case cast.framework.events.EventType.PAUSE:LI(this,_.vb,a);break;case cast.framework.events.EventType.BUFFERING:a.isBuffering?LI(this,_.ob,a):LI(this,_.xb,a)}}};
71
+ $I.prototype.getPosition=$I.prototype.getPosition;$I.prototype.setVolume=$I.prototype.setVolume;$I.prototype.getVolume=$I.prototype.getVolume;$I.prototype.skip=$I.prototype.skip;$I.prototype.pause=$I.prototype.pause;$I.prototype.resume=$I.prototype.resume;var FI=!1;var NI=class{constructor(){this.a=!1;this.h=new _.O(WH);this.f=this.l=null;this.g=new Set;this.A=this.F.bind(this);this.w=this.B.bind(this);this.j=null;this.o=new _.cn;this.m=null}init(a){a&&(this.f=new YI,_.Il(a,this.f),this.l=a,this.o.on(window,"unload",()=>{const b=this;return _.v(function*(){b.l&&b.l.getState()!==_.zk&&(yield ZH(b.l))})}))}start(){if(!this.a&&window.cast&&cast.framework&&cast.framework.CastReceiverContext){this.a=!0;var a=cast.framework.CastReceiverContext.getInstance(),b=a.getPlayerManager(),
72
+ c=new cast.framework.CastReceiverOptions;c.customNamespaces={};c.customNamespaces[XH]=cast.framework.system.MessageType.JSON;var d=new cast.framework.PlaybackConfig;d.manifestHandler=this.D.bind(this);d.shakaConfig={streaming:{ignoreTextStreamFailures:!0}};c.playbackConfig=d;if(d=this.l&&this.l.getSurface().getMedia())c.mediaElement=d;c.disableIdleTimeout=!0;c.maxInactivity=Infinity;b.setMessageInterceptor(cast.framework.messages.MessageType.LOAD,this.C.bind(this));b.addEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,
73
+ this.A);a.start(c);a.addCustomMessageListener(XH,this.w)}}stop(){if(this.a){this.a=!1;this.o.release();const a=cast.framework.CastReceiverContext.getInstance();a.getPlayerManager().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.A);a.removeCustomMessageListener(XH,this.w);a.stop();this.l=this.f=null}}Ac(a){this.j=a}yf(a){this.m=a}on(a,b){cast.framework.CastReceiverContext.getInstance().addEventListener(a,b)}off(a,b){cast.framework.CastReceiverContext.getInstance().removeEventListener(a,
74
+ b)}addMessageListener(a){typeof a===_.Qc&&this.g.add(a)}removeMessageListener(a){typeof a===_.Qc&&this.g.delete(a)}sendMessage(a,b){cast.framework.CastReceiverContext.getInstance().sendCustomMessage(XH,b,$H(a))}Rb(){return this.a}cf(){let a=null;const b=cast.framework.CastReceiverContext.getInstance().getPlayerManager().getMediaInformation();b&&b.metadata&&(a=b.metadata);return _.bf(a)}D(a){a=a.trim();if(a.startsWith("#EXTM3U"))return QI(this,a);try{var b=(new DOMParser).parseFromString(a,_.le)}catch(k){return a}var c=
75
75
  b.getElementsByTagName("MPD")[0];if(c){a=c;this.h.debug("Detected DASH, parsing");b=cast.framework.CastReceiverContext.getInstance();c=a.getElementsByTagName("Period");for(var d=c.length-1;0<=d;--d){var e=c[d].getElementsByTagName(_.ea);for(var f=e.length-1;0<=f;--f){var g=e[f].getAttribute("contentType");if(g===_.u||g===_.Rb){g=e[f].getAttribute(_.jd);var h=e[f].getElementsByTagName(_.Va);for(let k=h.length-1;0<=k;--k){const l=h[k].getAttribute(_.jd)||g,m=h[k].getAttribute(_.tc);let n=h[k].getAttribute(_.Oe)||
76
76
  void 0,q=h[k].getAttribute(_.Rc)||void 0;void 0!==n&&(n=+n);void 0!==q&&(q=+q);b.canDisplayType(l,m,n,q)||e[f].removeChild(h[k])}e[f].getElementsByTagName(_.Va).length||c[d].removeChild(e[f])}}c[d].getElementsByTagName(_.ea).length||a.removeChild(c[d])}return a=(new XMLSerializer).serializeToString(a)}if(c=b.getElementsByTagName(_.cb)[0]){a=c;this.h.debug("Detected Smooth, parsing");b=cast.framework.CastReceiverContext.getInstance();c=a.getElementsByTagName("StreamIndex");for(d=c.length-1;0<=d;--d)if(c[d].getAttribute("Type")===
77
- _.u){e=c[d].getElementsByTagName(_.Ta);for(f=e.length-1;0<=f;--f)g=e[f].getAttribute(_.Ja)||void 0,h=e[f].getAttribute(_.Ha)||void 0,void 0!==g&&(g=+g),void 0!==h&&(h=+h),b.canDisplayType(_.Be,void 0,g,h)||c[d].removeChild(e[f]);c[d].getElementsByTagName(_.Ta).length||a.removeChild(c[d])}a=(new XMLSerializer).serializeToString(a)}return a}C(a){const b=this;return _.v(function*(){var c;a.media.customData&&(c=FH(a.media.customData.playerConfiguration));b.l&&c&&(b.j&&(c=(yield Promise.resolve(b.j(c)))||
78
- c),c.ima&&(yield lI(a.media,c.ima,b.l.getNetworkEngine())),typeof c.startTime===_.p&&c.startTime!==a.currentTime&&(a.currentTime=c.startTime),a.media.customData.local||(b.f.B=!0,yield _.Pl(b.l,c),yield _.Ql(b.l),c=b.l.getLoadedSource(),a.media.contentId=c.url,a.media.contentType=c.type,c.tb&&(a.media.hlsVideoSegmentFormat=HH(c.tb,_.K)),c.audioMimeType&&(a.media.hlsSegmentFormat=HH(c.audioMimeType,_.J))),void 0===a.autoplay&&(a.autoplay=b.l.getConfiguration().autoplay));b.m&&(c=yield Promise.resolve(b.m(a)))&&
79
- (a=c);return a})}F(a){!this.l||a.media.customData&&a.media.customData.local||_.Sl(this.l)}B(a){if(0<this.g.size){const b=FH(a.data);this.g.forEach(c=>c(b))}}};_.x(AH,rI);rI.prototype.getContentMetadata=rI.prototype.Ye;rI.prototype.isApiReady=rI.prototype.Pb;rI.prototype.sendMessage=rI.prototype.sendMessage;rI.prototype.removeMessageListener=rI.prototype.removeMessageListener;rI.prototype.addMessageListener=rI.prototype.addMessageListener;rI.prototype.off=rI.prototype.off;rI.prototype.on=rI.prototype.on;
80
- rI.prototype.setLoadRequestDataInterceptor=rI.prototype.rf;rI.prototype.setPlayerConfigInterceptor=rI.prototype.Ac;rI.prototype.stop=rI.prototype.stop;rI.prototype.start=rI.prototype.start;rI.prototype.init=rI.prototype.init;rI.getInstance=sI;var qI=null;var FI=class{constructor(a){this.f=a;this.a=null;this.g=new _.cn;this.h=[cast.framework.RemotePlayerEventType.IS_PLAYING_BREAK_CHANGED,cast.framework.RemotePlayerEventType.CURRENT_BREAK_CLIP_NUMBER_CHANGED,cast.framework.RemotePlayerEventType.MEDIA_INFO_CHANGED,cast.framework.RemotePlayerEventType.IS_PAUSED_CHANGED]}load(){const a=this;return _.v(function*(){a.a=a.f.o;if(a.a){const b=a.a.controller,c=a.j.bind(a);for(const d of a.h)a.g.on(b,d,c)}})}start(){return _.v(function*(){})}resume(){this.a&&
81
- this.a.isPlayingBreak&&this.a.isPaused&&this.a.controller.playOrPause()}pause(){this.a&&this.a.isPlayingBreak&&!this.a.isPaused&&this.a.controller.playOrPause()}skip(){const a=this.f.a;a&&this.f.sendMessage(CH,{type:"SKIP_AD",requestId:Math.round(1E3*Math.random()),mediaSessionId:a.mediaSessionId})}getVolume(){return this.f.getVolume()||0}setVolume(a){this.f.setVolume(a)}getPosition(){let a=-1;var b=this.f.a;b&&(b=b.getEstimatedBreakClipTime(),typeof b===_.p&&(a=b));return a}dispose(){const a=this;
82
- return _.v(function*(){a.g.release()})}j(a){switch(a.field){case "mediaInfo":a.value&&(a=a.value,a.breaks&&this.f.trigger(new _.F(_.Db,{adsTimeline:new DI(a.breaks)})));break;case "isPlayingBreak":a.value?wI(this,_.mb):(wI(this,_.qb),wI(this,_.Ab),wI(this,_.nb));break;case "currentBreakClipNumber":0<=a.value&&(0<a.value&&(wI(this,_.qb),wI(this,_.Ab)),wI(this,_.zb));break;case "isPaused":this.a.isPlayingBreak&&(a.value?wI(this,_.vb):wI(this,_.xb))}}};FI.prototype.getPosition=FI.prototype.getPosition;
83
- FI.prototype.setVolume=FI.prototype.setVolume;FI.prototype.getVolume=FI.prototype.getVolume;FI.prototype.skip=FI.prototype.skip;FI.prototype.pause=FI.prototype.pause;FI.prototype.resume=FI.prototype.resume;var GI=class{name(){return"clpp.cast.ads.SenderAdsManagerFactory"}X(a,b){return a.namespace()!==_.pc?!1:!(!b||!b.ima)}create(a){return new FI(a.a)}};GI.prototype.create=GI.prototype.create;GI.prototype.isSupported=GI.prototype.X;GI.prototype.name=GI.prototype.name;_.Sk(new GI);var HI=class{name(){return"clpp.cast.ads.AdsManagerFactory"}X(a,b){return sI().Pb()?!(!b||!b.ima):!1}create(a){return new EI(a)}};HI.prototype.create=HI.prototype.create;HI.prototype.isSupported=HI.prototype.X;HI.prototype.name=HI.prototype.name;_.Sk(new HI);};f.call(g, window);
77
+ _.u){e=c[d].getElementsByTagName(_.Ta);for(f=e.length-1;0<=f;--f)g=e[f].getAttribute(_.Ja)||void 0,h=e[f].getAttribute(_.Ha)||void 0,void 0!==g&&(g=+g),void 0!==h&&(h=+h),b.canDisplayType(_.Be,void 0,g,h)||c[d].removeChild(e[f]);c[d].getElementsByTagName(_.Ta).length||a.removeChild(c[d])}a=(new XMLSerializer).serializeToString(a)}return a}C(a){const b=this;return _.v(function*(){var c;a.media.customData&&(c=aI(a.media.customData.playerConfiguration));b.l&&c&&(b.j&&(c=(yield Promise.resolve(b.j(c)))||
78
+ c),c.ima&&(yield HI(a.media,c.ima,b.l.getNetworkEngine())),typeof c.startTime===_.p&&c.startTime!==a.currentTime&&(a.currentTime=c.startTime),a.media.customData.local||(b.f.B=!0,yield _.Pl(b.l,c),yield _.Ql(b.l),c=b.l.getLoadedSource(),a.media.contentId=c.url,a.media.contentType=c.type,c.tb&&(a.media.hlsVideoSegmentFormat=cI(c.tb,_.K)),c.audioMimeType&&(a.media.hlsSegmentFormat=cI(c.audioMimeType,_.J))),void 0===a.autoplay&&(a.autoplay=b.l.getConfiguration().autoplay));b.m&&(c=yield Promise.resolve(b.m(a)))&&
79
+ (a=c);return a})}F(a){!this.l||a.media.customData&&a.media.customData.local||_.Sl(this.l)}B(a){if(0<this.g.size){const b=aI(a.data);this.g.forEach(c=>c(b))}}};_.x(WH,NI);NI.prototype.getContentMetadata=NI.prototype.cf;NI.prototype.isApiReady=NI.prototype.Rb;NI.prototype.sendMessage=NI.prototype.sendMessage;NI.prototype.removeMessageListener=NI.prototype.removeMessageListener;NI.prototype.addMessageListener=NI.prototype.addMessageListener;NI.prototype.off=NI.prototype.off;NI.prototype.on=NI.prototype.on;
80
+ NI.prototype.setLoadRequestDataInterceptor=NI.prototype.yf;NI.prototype.setPlayerConfigInterceptor=NI.prototype.Ac;NI.prototype.stop=NI.prototype.stop;NI.prototype.start=NI.prototype.start;NI.prototype.init=NI.prototype.init;NI.getInstance=OI;var MI=null;var aJ=class{constructor(a){this.f=a;this.a=null;this.g=new _.cn;this.h=[cast.framework.RemotePlayerEventType.IS_PLAYING_BREAK_CHANGED,cast.framework.RemotePlayerEventType.CURRENT_BREAK_CLIP_NUMBER_CHANGED,cast.framework.RemotePlayerEventType.MEDIA_INFO_CHANGED,cast.framework.RemotePlayerEventType.IS_PAUSED_CHANGED]}load(){const a=this;return _.v(function*(){a.a=a.f.o;if(a.a){const b=a.a.controller,c=a.j.bind(a);for(const d of a.h)a.g.on(b,d,c)}})}start(){return _.v(function*(){})}resume(){this.a&&
81
+ this.a.isPlayingBreak&&this.a.isPaused&&this.a.controller.playOrPause()}pause(){this.a&&this.a.isPlayingBreak&&!this.a.isPaused&&this.a.controller.playOrPause()}skip(){const a=this.f.a;a&&this.f.sendMessage(YH,{type:"SKIP_AD",requestId:Math.round(1E3*Math.random()),mediaSessionId:a.mediaSessionId})}getVolume(){return this.f.getVolume()||0}setVolume(a){this.f.setVolume(a)}getPosition(){let a=-1;var b=this.f.a;b&&(b=b.getEstimatedBreakClipTime(),typeof b===_.p&&(a=b));return a}dispose(){const a=this;
82
+ return _.v(function*(){a.g.release()})}j(a){switch(a.field){case "mediaInfo":a.value&&(a=a.value,a.breaks&&this.f.trigger(new _.F(_.Db,{adsTimeline:new ZI(a.breaks)})));break;case "isPlayingBreak":a.value?SI(this,_.mb):(SI(this,_.qb),SI(this,_.Ab),SI(this,_.nb));break;case "currentBreakClipNumber":0<=a.value&&(0<a.value&&(SI(this,_.qb),SI(this,_.Ab)),SI(this,_.zb));break;case "isPaused":this.a.isPlayingBreak&&(a.value?SI(this,_.vb):SI(this,_.xb))}}};aJ.prototype.getPosition=aJ.prototype.getPosition;
83
+ aJ.prototype.setVolume=aJ.prototype.setVolume;aJ.prototype.getVolume=aJ.prototype.getVolume;aJ.prototype.skip=aJ.prototype.skip;aJ.prototype.pause=aJ.prototype.pause;aJ.prototype.resume=aJ.prototype.resume;var bJ=class{name(){return"clpp.cast.ads.SenderAdsManagerFactory"}Y(a,b){return a.namespace()!==_.pc?!1:!(!b||!b.ima)}create(a){return new aJ(a.a)}};bJ.prototype.create=bJ.prototype.create;bJ.prototype.isSupported=bJ.prototype.Y;bJ.prototype.name=bJ.prototype.name;_.Sk(new bJ);var cJ=class{name(){return"clpp.cast.ads.AdsManagerFactory"}Y(a,b){return OI().Rb()?!(!b||!b.ima):!1}create(a){return new $I(a)}};cJ.prototype.create=cJ.prototype.create;cJ.prototype.isSupported=cJ.prototype.Y;cJ.prototype.name=cJ.prototype.name;_.Sk(new cJ);};f.call(g, window);
package/cl.conviva.js CHANGED
@@ -1,27 +1,27 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var RG="Ad Error",SG="onAdBreakStarted()",TG="onAdBreakStopped()",UG=function(a){var b=_.Th();let c=Conviva.Constants.DeviceType.DESKTOP,d=Conviva.Constants.DeviceCategory.WEB;const e=b.os;b=b.osVersion.name;let f="";_.Fh()&&(f="Apple");_.Eh()?(f="Google",c=Conviva.Constants.DeviceType.SETTOP,d=Conviva.Constants.DeviceCategory.CHROMECAST):_.Gh()?(c=Conviva.Constants.DeviceType.MOBILE,/(android)/i.test(navigator.userAgent)?d=Conviva.Constants.DeviceCategory.ANDROID_DEVICE:_.Fh()&&(d=Conviva.Constants.DeviceCategory.APPLE_DEVICE)):
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var mH="Ad Error",nH="onAdBreakStarted()",oH="onAdBreakStopped()",pH=function(a){var b=_.Th();let c=Conviva.Constants.DeviceType.DESKTOP,d=Conviva.Constants.DeviceCategory.WEB;const e=b.os;b=b.osVersion.name;let f="";_.Fh()&&(f="Apple");_.Eh()?(f="Google",c=Conviva.Constants.DeviceType.SETTOP,d=Conviva.Constants.DeviceCategory.CHROMECAST):_.Gh()?(c=Conviva.Constants.DeviceType.MOBILE,/(android)/i.test(navigator.userAgent)?d=Conviva.Constants.DeviceCategory.ANDROID_DEVICE:_.Fh()&&(d=Conviva.Constants.DeviceCategory.APPLE_DEVICE)):
2
2
  _.yh()||_.vh()||_.uh("Hisense")?(c=Conviva.Constants.DeviceType.SMARTTV,d=Conviva.Constants.DeviceCategory.SMART_TV,_.yh()?(b="",f="LG",d=Conviva.Constants.DeviceCategory.LG_TV):_.vh()?(f="Samsung",d=Conviva.Constants.DeviceCategory.SAMSUNG_TV):_.uh("Hisense")&&(b="",f="Hisense")):_.uh("Xbox One")&&(f="Microsoft",c=Conviva.Constants.DeviceType.CONSOLE,d=Conviva.Constants.DeviceCategory.XBOX);const g=a.deviceMetadata||{},h=(k,l)=>{k in g||!l||(g[k]=l)};h(Conviva.Constants.DeviceMetadata.TYPE,a.deviceType||
3
- c);h(Conviva.Constants.DeviceMetadata.OS_NAME,e);h(Conviva.Constants.DeviceMetadata.OS_VERSION,b);h(Conviva.Constants.DeviceMetadata.CATEGORY,a.deviceCategory||d);h(Conviva.Constants.DeviceMetadata.BRAND,a.deviceBrand||f);return g},VG=function(a){return a?Conviva.Constants.StreamType.LIVE:Conviva.Constants.StreamType.VOD},WG=function(a){return 0===a?"Pre-roll":-1===a?"Post-roll":"Mid-roll"},YG=function(a,b,c,d){const e={};e[Conviva.Constants.PLAYER_NAME]=c;e[Conviva.Constants.VIEWER_ID]=b;e[Conviva.Constants.IS_LIVE]=
4
- VG(!!d);e[Conviva.Constants.ASSET_NAME]=RG;a&&(e[Conviva.Constants.ASSET_NAME]=a.getTitle(),e[Conviva.Constants.STREAM_URL]=a.getMediaUrl(),e[Conviva.Constants.DURATION]=a.getDuration(),e["c3.ad.id"]=XG(a.aa()),e["c3.ad.creativeId"]=XG(a.getCreativeId()),e["c3.ad.system"]=XG(a.getAdSystem()),e["c3.ad.mediaFileApiFramework"]=XG(a.getApiFramework()),e["c3.ad.advertiser"]=XG(a.getAdvertiserName()),e["c3.ad.position"]=WG(a.getPodIndex()),e["c3.ad.technology"]=0===a.mb()?Conviva.Constants.AdType.CLIENT_SIDE:
5
- Conviva.Constants.AdType.SERVER_SIDE,e["c3.ad.adManagerName"]=XG(a.gb()),e["c3.ad.adManagerVersion"]=XG(a.hb()),e["c3.ad.advertiserCategory"]=XG(null),e["c3.ad.advertiserId"]=XG(null),e["c3.ad.breakId"]=XG(null),e["c3.ad.campaignName"]=XG(null),e["c3.ad.category"]=XG(null),e["c3.ad.classification"]=XG(null),e["c3.ad.creativeName"]=XG(null),e["c3.ad.sequence"]=XG(a.zb()),e["c3.ad.sessionStartEvent"]=XG(null),e["c3.ad.unitName"]=XG(null),e["c3.ad.dayPart"]=XG(null),b=a.getWrapperAdIds().slice(-1)[0]||
6
- a.aa(),c=a.getWrapperAdSystems().slice(-1)[0]||a.getAdSystem(),a=a.getWrapperCreativeIds().slice(-1)[0]||a.getCreativeId(),e["c3.ad.firstAdId"]=XG(b),e["c3.ad.firstAdSystem"]=XG(c),e["c3.ad.firstCreativeId"]=XG(a));return e},XG=function(a){return a?""+a:"NA"},bH=function(a){a.g.on(a.l,_.mb,a.C.bind(a));a.g.on(a.l,_.nb,a.D.bind(a));a.g.on(a.l,_.zb,a.L.bind(a));a.g.on(a.l,_.wb,a.m.bind(a));a.g.on(a.l,_.vb,a.m.bind(a));a.g.on(a.l,_.xb,a.m.bind(a));a.g.on(a.l,_.ob,a.m.bind(a));a.g.on(a.l,_.Ab,a.P.bind(a));
7
- a.g.on(a.l,_.yb,a.K.bind(a));a.g.on(a.l,_.pb,a.F.bind(a));a.g.on(a.l,_.sb,a.I.bind(a));a.g.on(a.l,_.tb,a.J.bind(a));a.g.on(a.l,_.rb,a.H.bind(a));a.g.on(a.l,_.ub,a.U.bind(a));a.g.on(a.l,_.Bb,a.R.bind(a));a.g.on(a.l,_.Oc,b=>{var c=b.detail;if(10003===c.code&&(a.f.debug("onAdError()"),!a.h)){b=Conviva.Constants.ErrorSeverity;switch(c.data.errorType){case 0:c="Ad Load Error";break;case 1:c="Ad Play Error";break;default:c=RG}null===a.a&&ZG(a,null);a.a.reportAdError(c,b.FATAL);a.h=!0;a.f.debug("Ad Playback Failure");
8
- $G(a,aH,c)}})},cH=function(a,b){a.f.debug("Initialize Ad Insights");a.w=!1;a.h=!1;a.B=b.viewerId;a.A=b.playerName||_.la;bH(a)},$G=function(a,b,c=RG){if(a.a){a.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED);switch(b){case aH:a.a.reportAdFailed(c,YG(null,a.B,a.A));break;case dH:a.a.reportAdSkipped();break;default:a.a.reportAdEnded()}a.a.release();a.a=null;a.j=!1}},ZG=function(a,b){if(!a.o){a.h=!1;try{if(a.a=Conviva.Analytics.buildAdAnalytics(a.S()),b){const c=
9
- YG(b,a.B,a.A,a.l.isLive()),d=String(b.hb()),e={};e[Conviva.Constants.FRAMEWORK_NAME]=b.gb();e[Conviva.Constants.FRAMEWORK_VERSION]=d;a.a.setAdPlayerInfo(e);a.a.reportAdStarted(c)}}catch(c){a.f.error("Could not create ad analytics session",c)}}},eH=function(a,b){const c={};c[Conviva.Constants.LOG_LEVEL]=Conviva.Constants.LogLevel.DEBUG;b.serviceUrl&&(a.a.warn("Touchstone URL is set. Do not set this in production!"),c[Conviva.Constants.GATEWAY_URL]=b.serviceUrl.replace(/\/$/,""));Conviva.Analytics.init(b.customerKey,
10
- null,c);Conviva.Analytics.setDeviceMetadata(UG(b));b.connectionType&&Conviva.Analytics.reportDeviceMetric(Conviva.Constants.Network.CONNECTION_TYPE,b.connectionType);a.f=Conviva.Analytics.buildVideoAnalytics();a.o=!1;b={};b[Conviva.Constants.FRAMEWORK_NAME]=_.la;b[Conviva.Constants.FRAMEWORK_VERSION]=_.da;a.f.setPlayerInfo(b)},fH=function(a){return a.l.getConfiguration().autoplay||!1},hH=function(a){if(!a.m)if(a.C)a.a.warn("Current session still active. No-op.");else{var b=a.l.getLoadedSource()||
3
+ c);h(Conviva.Constants.DeviceMetadata.OS_NAME,e);h(Conviva.Constants.DeviceMetadata.OS_VERSION,b);h(Conviva.Constants.DeviceMetadata.CATEGORY,a.deviceCategory||d);h(Conviva.Constants.DeviceMetadata.BRAND,a.deviceBrand||f);return g},qH=function(a){return a?Conviva.Constants.StreamType.LIVE:Conviva.Constants.StreamType.VOD},rH=function(a){return 0===a?"Pre-roll":-1===a?"Post-roll":"Mid-roll"},tH=function(a,b,c,d){const e={};e[Conviva.Constants.PLAYER_NAME]=c;e[Conviva.Constants.VIEWER_ID]=b;e[Conviva.Constants.IS_LIVE]=
4
+ qH(!!d);e[Conviva.Constants.ASSET_NAME]=mH;a&&(e[Conviva.Constants.ASSET_NAME]=a.getTitle(),e[Conviva.Constants.STREAM_URL]=a.getMediaUrl(),e[Conviva.Constants.DURATION]=a.getDuration(),e["c3.ad.id"]=sH(a.ba()),e["c3.ad.creativeId"]=sH(a.getCreativeId()),e["c3.ad.system"]=sH(a.getAdSystem()),e["c3.ad.mediaFileApiFramework"]=sH(a.getApiFramework()),e["c3.ad.advertiser"]=sH(a.getAdvertiserName()),e["c3.ad.position"]=rH(a.getPodIndex()),e["c3.ad.technology"]=0===a.mb()?Conviva.Constants.AdType.CLIENT_SIDE:
5
+ Conviva.Constants.AdType.SERVER_SIDE,e["c3.ad.adManagerName"]=sH(a.gb()),e["c3.ad.adManagerVersion"]=sH(a.hb()),e["c3.ad.advertiserCategory"]=sH(null),e["c3.ad.advertiserId"]=sH(null),e["c3.ad.breakId"]=sH(null),e["c3.ad.campaignName"]=sH(null),e["c3.ad.category"]=sH(null),e["c3.ad.classification"]=sH(null),e["c3.ad.creativeName"]=sH(null),e["c3.ad.sequence"]=sH(a.Bb()),e["c3.ad.sessionStartEvent"]=sH(null),e["c3.ad.unitName"]=sH(null),e["c3.ad.dayPart"]=sH(null),b=a.getWrapperAdIds().slice(-1)[0]||
6
+ a.ba(),c=a.getWrapperAdSystems().slice(-1)[0]||a.getAdSystem(),a=a.getWrapperCreativeIds().slice(-1)[0]||a.getCreativeId(),e["c3.ad.firstAdId"]=sH(b),e["c3.ad.firstAdSystem"]=sH(c),e["c3.ad.firstCreativeId"]=sH(a));return e},sH=function(a){return a?""+a:"NA"},xH=function(a){a.g.on(a.l,_.mb,a.C.bind(a));a.g.on(a.l,_.nb,a.D.bind(a));a.g.on(a.l,_.zb,a.L.bind(a));a.g.on(a.l,_.wb,a.m.bind(a));a.g.on(a.l,_.vb,a.m.bind(a));a.g.on(a.l,_.xb,a.m.bind(a));a.g.on(a.l,_.ob,a.m.bind(a));a.g.on(a.l,_.Ab,a.N.bind(a));
7
+ a.g.on(a.l,_.yb,a.K.bind(a));a.g.on(a.l,_.pb,a.F.bind(a));a.g.on(a.l,_.sb,a.I.bind(a));a.g.on(a.l,_.tb,a.J.bind(a));a.g.on(a.l,_.rb,a.H.bind(a));a.g.on(a.l,_.ub,a.T.bind(a));a.g.on(a.l,_.Bb,a.R.bind(a));a.g.on(a.l,_.Oc,b=>{var c=b.detail;if(10003===c.code&&(a.f.debug("onAdError()"),!a.h)){b=Conviva.Constants.ErrorSeverity;switch(c.data.errorType){case 0:c="Ad Load Error";break;case 1:c="Ad Play Error";break;default:c=mH}null===a.a&&uH(a,null);a.a.reportAdError(c,b.FATAL);a.h=!0;a.f.debug("Ad Playback Failure");
8
+ vH(a,wH,c)}})},yH=function(a,b){a.f.debug("Initialize Ad Insights");a.w=!1;a.h=!1;a.B=b.viewerId;a.A=b.playerName||_.la;xH(a)},vH=function(a,b,c=mH){if(a.a){a.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED);switch(b){case wH:a.a.reportAdFailed(c,tH(null,a.B,a.A));break;case zH:a.a.reportAdSkipped();break;default:a.a.reportAdEnded()}a.a.release();a.a=null;a.j=!1}},uH=function(a,b){if(!a.o){a.h=!1;try{if(a.a=Conviva.Analytics.buildAdAnalytics(a.S()),b){const c=
9
+ tH(b,a.B,a.A,a.l.isLive()),d=String(b.hb()),e={};e[Conviva.Constants.FRAMEWORK_NAME]=b.gb();e[Conviva.Constants.FRAMEWORK_VERSION]=d;a.a.setAdPlayerInfo(e);a.a.reportAdStarted(c)}}catch(c){a.f.error("Could not create ad analytics session",c)}}},AH=function(a,b){const c={};c[Conviva.Constants.LOG_LEVEL]=Conviva.Constants.LogLevel.DEBUG;b.serviceUrl&&(a.a.warn("Touchstone URL is set. Do not set this in production!"),c[Conviva.Constants.GATEWAY_URL]=b.serviceUrl.replace(/\/$/,""));Conviva.Analytics.init(b.customerKey,
10
+ null,c);Conviva.Analytics.setDeviceMetadata(pH(b));b.connectionType&&Conviva.Analytics.reportDeviceMetric(Conviva.Constants.Network.CONNECTION_TYPE,b.connectionType);a.f=Conviva.Analytics.buildVideoAnalytics();a.o=!1;b={};b[Conviva.Constants.FRAMEWORK_NAME]=_.la;b[Conviva.Constants.FRAMEWORK_VERSION]=_.da;a.f.setPlayerInfo(b)},BH=function(a){return a.l.getConfiguration().autoplay||!1},DH=function(a){if(!a.m)if(a.C)a.a.warn("Current session still active. No-op.");else{var b=a.l.getLoadedSource()||
11
11
  a.K,c=a.l.getConfiguration().conviva||null,d=c&&c.viewerId||"N/A",e=c&&c.defaultResource||"N/A";a.a.debug(a.l.getConfiguration().source);var f={},g=new _.Ji(b.url);b&&(f[Conviva.Constants.ASSET_NAME]=b.name||"N/A",f[Conviva.Constants.STREAM_URL]=_.Fi(g));f[Conviva.Constants.PLAYER_NAME]=c.playerName||_.la;f[Conviva.Constants.VIEWER_ID]=d;f[Conviva.Constants.DEFAULT_RESOURCE]=e;if(c&&!_.y(c.customTags))for(const h in c.customTags)f[h]=c.customTags[h];a.f.reportPlaybackRequested(f);a.f.setCallback(()=>
12
- {a.a.debug("reportMiscellaneousMetrics()");if(gH(a)){var h=1E3*a.l.getPosition();a.f.reportPlaybackMetric(Conviva.Constants.Playback.PLAY_HEAD_TIME,h);if(h=a.l.getStats()){h=h.decodedFrames;const k=h-a.H;a.H=h;isFinite(k)&&(a.a.debug("Current FPS",k),a.f.reportPlaybackMetric(Conviva.Constants.Playback.RENDERED_FRAMERATE,k))}}});a.C=!0;a.h=!0;a.I=!1;0<a.j.length&&(a.a.debug("Report deferred events"),a.j.forEach(h=>{h.de(h.Sd)}));a.j=[]}},iH=function(a,b,c,d){a.m||(a.a.debug("Initialize conviva"),a.F=
13
- !1,a.D=_.bf(c),a.K=d,a.l=b,eH(a,a.D),a.g.on(a.l,_.Jd,a.ma.bind(a)),a.g.on(a.l,_.be,a.ca.bind(a)),a.g.on(a.l,_.Yb,a.L.bind(a)),a.g.on(a.l,_.ve,a.Z.bind(a)),a.g.on(a.l,_.te,a.V.bind(a)),a.g.on(a.l,_.mb,a.S.bind(a)),a.g.on(a.l,_.nb,a.U.bind(a)),a.g.on(a.l,_.Db,a.da.bind(a)),a.g.on(a.l,_.Xb,a.ga.bind(a)),a.g.on(a.l,_.Oc,a.P.bind(a)),fH(a)&&(a.a.debug("Start a new session: A new video starts in autoplay."),hH(a)))},jH=function(a){if(!a.m&&a.f){const b=VG(a.l.isLive()),c={};c[Conviva.Constants.IS_LIVE]=
14
- b;c[Conviva.Constants.DURATION]=a.l.getDuration();a.f.setContentInfo(c)}},gH=function(a){return null!==a.f&&a.C},kH=function(a){a.a.debug("terminateSession()");a.f&&(a.f.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED),a.f.reportPlaybackEnded(),a.f.release(),Conviva.Analytics.release(),a.o=!0,a.C=!1,a.A=!1,a.h=!1,a.w=null,a.B=!1,a.R=0,a.J=!1,a.j=[],a.H=0)},lH=function(a,b){var c=b.getConfiguration();a.a=!_.y(c.conviva)&&typeof c.conviva===_.rd;a.a?
15
- "undefined"===typeof window.Conviva?(a.h.warn("Conviva SDK is not loaded. Will do nothing."),a.a=!1,c=new _.H(1,9,9E3),a.T(b,c)):b.namespace()===_.pc&&(a.a=!1,a.h.debug("Conviva does not report when casting.")):a.h.warn("Conviva plugin is loaded but not configured. Will do nothing.")},mH=function(a){const b=[];typeof a===_.rd&&(a.customerKey||b.push("customerKey"),a.viewerId||b.push("viewerId"));if(0<b.length)throw new _.H(1,9,9001,{missingKeys:b});};var oH=class{constructor(a,b){this.l=a;this.S=b;this.B="";this.A=_.la;this.f=new _.O("clpp.conviva.ad");this.g=new _.cn;this.a=null;this.h=this.o=this.w=this.j=!1}release(){this.f.debug("Release Ad Indights");this.w?this.f.debug(_.ha):(_.Df(this.g),this.a&&$G(this,nH),this.g.release(),this.w=!0,this.j=this.h=!1)}destroy(){this.f.debug(_.Cc);this.o?this.f.debug(_.fa):this.o=!0}C(){this.f.debug(SG)}D(){this.f.debug(TG)}L(a){this.f.debug("onAdStarted()");a=a.ad;this.j||(this.f.warn("Ad load event was not triggered. This will have incidence on VSF"),
16
- ZG(this,a));this.j=!1;this.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.PLAYING);this.a.reportAdMetric(Conviva.Constants.Playback.RESOLUTION,a.jb(),a.ib());this.a.reportAdMetric(Conviva.Constants.Playback.BITRATE,a.Wa())}m(a){this.f.debug("onAdStateChanged()");if(this.a){const b=c=>{this.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,c)};switch(a.type){case _.wb:case _.xb:b(Conviva.Constants.PlayerState.PLAYING);break;case _.vb:b(Conviva.Constants.PlayerState.PAUSED);
17
- break;case _.ob:b(Conviva.Constants.PlayerState.BUFFERING)}}}P(){this.f.debug("onAdStopped()");this.a&&!this.h&&$G(this,nH)}K(){this.f.debug("onAdSkipped()");this.a&&$G(this,dH)}F(){this.f.debug("onAdClicked()");this.a&&this.a.reportAdPlayerEvent("AdClicked")}I(){this.f.debug("onAdImpression()");if(this.a){const a=Conviva.Constants.Events;this.a.reportAdPlayerEvent(a.AD_IMPRESSION_START);this.a.reportAdPlayerEvent(a.AD_IMPRESSION_END)}}J(a){this.f.debug("onAdLoaded()");const b=a.ad,c=()=>{this.j=
18
- !0;ZG(this,b)};if(-1!==b.getPodIndex()||this.l.getPosition()>=this.l.getDuration()-5)c();else this.g.on(this.l,_.me,()=>{this.l.getPosition()>=this.l.getDuration()-5&&(this.g.off(this.l,_.me),c())})}H(){this.f.debug("onAdFirstQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_FIRST_QUARTILE)}U(){this.f.debug("onAdMidPoint()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_MID_QUARTILE)}R(){this.f.debug("onAdThirdQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_THIRD_QUARTILE)}},
19
- dH=0,nH=1,aH=2;var pH=class{constructor(a,b){this.l=a;this.g=new _.cn;this.f=null;this.o=!1;this.F=!0;this.B=this.h=this.A=this.C=this.m=!1;this.R=0;this.J=!1;this.w=null;this.I=!1;this.a=b;this.K=this.D=null;this.j=[];this.H=0}release(){this.a.debug("Release conviva");this.F?this.a.debug(_.ha):(_.Df(this.g),gH(this)||this.o||!fH(this)||this.f&&this.f.reportPlaybackFailed("Exit Before Video Start"),gH(this)&&kH(this),this.f=null,this.F=!0)}destroy(){this.a.debug(_.Cc);this.m?this.a.debug(_.fa):this.m=!0}reportAppEvent(a,
20
- b){let c=!1;try{Conviva.Analytics.reportAppEvent(a,b),c=!0}catch(d){this.a.debug("Report app event error",d),c=!1}return c}ma(){this.a.debug("onPlayRequest()");gH(this)||fH(this)?gH(this)&&this.A&&!this.h&&(this.a.debug("Resuming VST monitoring ..."),gH(this)&&!this.h&&(this.f.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_ENDED),this.h=!0),this.A=!1):(this.a.debug("Creating conviva session. On Play Requested / No autoplay"),hH(this))}ca(a){this.a.debug(_.xd);const b=c=>{if(this.o&&(this.a.debug("Creating conviva session (On Seek / Replay)"),
21
- eH(this,this.D),hH(this),jH(this),gH(this))){var d=this.l.getTrackManager();d=d.fa()||d.Ia();d.width&&d.height&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.RESOLUTION,d.width,d.height);d.bandwidth&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.BITRATE,d.bandwidth/1E3)}gH(this)&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,c)};switch(a.detail.currentState){case _.Ck:b(Conviva.Constants.PlayerState.PLAYING);break;case _.Bk:b(Conviva.Constants.PlayerState.PAUSED);
22
- break;case _.uk:b(Conviva.Constants.PlayerState.BUFFERING);break;case _.rk:this.a.debug("onVideoEnded()"),gH(this)&&(this.w&&this.w.Xa()?(this.a.debug("Waiting for postroll Ad before terminating session"),this.J=!0):kH(this))}}L(a){this.a.debug(_.sd);if(gH(this)){if(a=a.detail,typeof a.width===_.p&&typeof a.height===_.p&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.RESOLUTION,a.width,a.height),a.bandwidth&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.BITRATE,a.bandwidth/1E3),(a=
23
- a.rendition)&&a.track&&(a=a.track)&&a.frameRate){const b={};b[Conviva.Constants.ENCODED_FRAMERATE]=a.frameRate;this.f.setContentInfo(b)}}else this.j.push({de:this.L.bind(this),Sd:a})}Z(){this.a.debug("onSeeking()");gH(this)&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)}V(){this.a.debug("onSeeked()");gH(this)&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_ENDED)}da(a){this.a.debug("onAdsTimelineChanged()");if(a=a.adsTimeline)this.w=a}S(a){this.a.debug(SG);var b=
24
- a.ad;a=0===b.Ja();const c=WG(b.getPodIndex());gH(this)||fH(this)||!a||hH(this);if(gH(this)){a=0===b.mb()?Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE;let d=0;const e={};1===b.lb()&&(d=b.getDuration());e[Conviva.Constants.POD_DURATION]=d;e[Conviva.Constants.POD_INDEX]=++this.R;e[Conviva.Constants.POD_POSITION]=c;b=Conviva.Constants.AdPlayer;b=a!==Conviva.Constants.AdType.CLIENT_SIDE||_.Eh()?b.CONTENT:b.SEPARATE;this.f.reportAdBreakStarted(a,b,e);this.B=!0}else this.a.debug("Bug: should already have a valid session")}U(){this.a.debug(TG);
25
- gH(this)&&this.B&&(this.f.reportAdBreakEnded(),this.B=!1,this.J&&kH(this))}P(a){this.a.debug(_.ud);if(this.o&&this.I)this.a.debug("Session ended in VPF; ignoring subsequent errors");else{var b=a.detail||null,c=b&&b.message||"Player error",d=Conviva.Constants.ErrorSeverity.WARNING;b&&b.severity&&b.severity===_.G&&(d=Conviva.Constants.ErrorSeverity.FATAL,gH(this)||hH(this));gH(this)?(this.a.debug("Report error",c,d),this.f.reportPlaybackError(c,d),d===Conviva.Constants.ErrorSeverity.FATAL&&(this.a.debug("Video Playback Failure"),
26
- this.I=!0,kH(this))):this.j.push({de:this.P.bind(this),Sd:a})}}ga(){this.a.debug("onAutoPlayBlocked()");gH(this)&&(this.a.debug("Auto-play blocked. Pausing VST monitoring."),this.A=!0,gH(this)&&this.h&&(this.f.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_STARTED),this.h=!1))}};var qH=class{constructor(){this.g=this.f=null;this.a=!1;this.h=new _.O("clpp.conviva")}onPlayerCreated(a){this.f=new pH(a,this.h)}onContentWillLoad(a,b){lH(this,a);if(this.a){var c=a.getConfiguration();c=_.bf(c.conviva||{});try{mH(c);const d=c.enableAdInsights||!1;iH(this.f,a,c,b);d&&(this.g=new oH(a,()=>this.f.f),cH(this.g,c))}catch(d){d instanceof _.H?this.T(a,d):this.T(a,new _.H(1,9,9002,d,d))}}}onContentLoaded(){this.a&&jH(this.f)}onPlayerWillDestroy(){this.a&&(this.a=!1,this.f.destroy(),this.f=
27
- null,this.g&&(this.g.destroy(),this.g=null))}onPlayerWillRelease(){this.a&&(this.f.release(),this.g&&this.g.release())}id(){return"conviva"}T(a,b){a.trigger(new _.F(_.Oc,{detail:b}))}reportAppEvent(a,b){return this.f?this.f.reportAppEvent(a,b):!1}};_.x("clpp.conviva.ConvivaPlugin",qH);qH.prototype.reportAppEvent=qH.prototype.reportAppEvent;qH.Id="conviva";_.Cl(new class{create(){return new qH}});};f.call(g, window);
12
+ {a.a.debug("reportMiscellaneousMetrics()");if(CH(a)){var h=1E3*a.l.getPosition();a.f.reportPlaybackMetric(Conviva.Constants.Playback.PLAY_HEAD_TIME,h);if(h=a.l.getStats()){h=h.decodedFrames;const k=h-a.H;a.H=h;isFinite(k)&&(a.a.debug("Current FPS",k),a.f.reportPlaybackMetric(Conviva.Constants.Playback.RENDERED_FRAMERATE,k))}}});a.C=!0;a.h=!0;a.I=!1;0<a.j.length&&(a.a.debug("Report deferred events"),a.j.forEach(h=>{h.fe(h.Ud)}));a.j=[]}},EH=function(a,b,c,d){a.m||(a.a.debug("Initialize conviva"),a.F=
13
+ !1,a.D=_.bf(c),a.K=d,a.l=b,AH(a,a.D),a.g.on(a.l,_.Jd,a.na.bind(a)),a.g.on(a.l,_.be,a.aa.bind(a)),a.g.on(a.l,_.Yb,a.L.bind(a)),a.g.on(a.l,_.ue,a.W.bind(a)),a.g.on(a.l,_.te,a.V.bind(a)),a.g.on(a.l,_.mb,a.S.bind(a)),a.g.on(a.l,_.nb,a.T.bind(a)),a.g.on(a.l,_.Db,a.ca.bind(a)),a.g.on(a.l,_.Xb,a.ga.bind(a)),a.g.on(a.l,_.Oc,a.N.bind(a)),BH(a)&&(a.a.debug("Start a new session: A new video starts in autoplay."),DH(a)))},FH=function(a){if(!a.m&&a.f){const b=qH(a.l.isLive()),c={};c[Conviva.Constants.IS_LIVE]=
14
+ b;c[Conviva.Constants.DURATION]=a.l.getDuration();a.f.setContentInfo(c)}},CH=function(a){return null!==a.f&&a.C},GH=function(a){a.a.debug("terminateSession()");a.f&&(a.f.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED),a.f.reportPlaybackEnded(),a.f.release(),Conviva.Analytics.release(),a.o=!0,a.C=!1,a.A=!1,a.h=!1,a.w=null,a.B=!1,a.R=0,a.J=!1,a.j=[],a.H=0)},HH=function(a,b){var c=b.getConfiguration();a.a=!_.y(c.conviva)&&typeof c.conviva===_.rd;a.a?
15
+ "undefined"===typeof window.Conviva?(a.h.warn("Conviva SDK is not loaded. Will do nothing."),a.a=!1,c=new _.H(1,9,9E3),a.U(b,c)):b.namespace()===_.pc&&(a.a=!1,a.h.debug("Conviva does not report when casting.")):a.h.warn("Conviva plugin is loaded but not configured. Will do nothing.")},IH=function(a){const b=[];typeof a===_.rd&&(a.customerKey||b.push("customerKey"),a.viewerId||b.push("viewerId"));if(0<b.length)throw new _.H(1,9,9001,{missingKeys:b});};var KH=class{constructor(a,b){this.l=a;this.S=b;this.B="";this.A=_.la;this.f=new _.O("clpp.conviva.ad");this.g=new _.cn;this.a=null;this.h=this.o=this.w=this.j=!1}release(){this.f.debug("Release Ad Insights");this.w?this.f.debug(_.ha):(_.Df(this.g),this.a&&vH(this,JH),this.g.release(),this.w=!0,this.j=this.h=!1)}destroy(){this.f.debug(_.Cc);this.o?this.f.debug(_.fa):this.o=!0}C(){this.f.debug(nH)}D(){this.f.debug(oH)}L(a){this.f.debug("onAdStarted()");a=a.ad;this.j||(this.f.warn("Ad load event was not triggered. This will have incidence on VSF"),
16
+ uH(this,a));this.j=!1;this.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.PLAYING);this.a.reportAdMetric(Conviva.Constants.Playback.RESOLUTION,a.jb(),a.ib());this.a.reportAdMetric(Conviva.Constants.Playback.BITRATE,a.Wa())}m(a){this.f.debug("onAdStateChanged()");if(this.a){const b=c=>{this.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,c)};switch(a.type){case _.wb:case _.xb:b(Conviva.Constants.PlayerState.PLAYING);break;case _.vb:b(Conviva.Constants.PlayerState.PAUSED);
17
+ break;case _.ob:b(Conviva.Constants.PlayerState.BUFFERING)}}}N(){this.f.debug("onAdStopped()");this.a&&!this.h&&vH(this,JH)}K(){this.f.debug("onAdSkipped()");this.a&&vH(this,zH)}F(){this.f.debug("onAdClicked()");this.a&&this.a.reportAdPlayerEvent("AdClicked")}I(){this.f.debug("onAdImpression()");if(this.a){const a=Conviva.Constants.Events;this.a.reportAdPlayerEvent(a.AD_IMPRESSION_START);this.a.reportAdPlayerEvent(a.AD_IMPRESSION_END)}}J(a){this.f.debug("onAdLoaded()");const b=a.ad,c=()=>{this.j=
18
+ !0;uH(this,b)};if(-1!==b.getPodIndex()||this.l.getPosition()>=this.l.getDuration()-5)c();else this.g.on(this.l,_.me,()=>{this.l.getPosition()>=this.l.getDuration()-5&&(this.g.off(this.l,_.me),c())})}H(){this.f.debug("onAdFirstQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_FIRST_QUARTILE)}T(){this.f.debug("onAdMidPoint()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_MID_QUARTILE)}R(){this.f.debug("onAdThirdQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_THIRD_QUARTILE)}},
19
+ zH=0,JH=1,wH=2;var LH=class{constructor(a,b){this.l=a;this.g=new _.cn;this.f=null;this.o=!1;this.F=!0;this.B=this.h=this.A=this.C=this.m=!1;this.R=0;this.J=!1;this.w=null;this.I=!1;this.a=b;this.K=this.D=null;this.j=[];this.H=0}release(){this.a.debug("Release conviva");this.F?this.a.debug(_.ha):(_.Df(this.g),CH(this)||this.o||!BH(this)||this.f&&this.f.reportPlaybackFailed("Exit Before Video Start"),CH(this)&&GH(this),this.f=null,this.F=!0)}destroy(){this.a.debug(_.Cc);this.m?this.a.debug(_.fa):this.m=!0}reportAppEvent(a,
20
+ b){let c=!1;try{Conviva.Analytics.reportAppEvent(a,b),c=!0}catch(d){this.a.debug("Report app event error",d),c=!1}return c}na(){this.a.debug("onPlayRequest()");CH(this)||BH(this)?CH(this)&&this.A&&!this.h&&(this.a.debug("Resuming VST monitoring ..."),CH(this)&&!this.h&&(this.f.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_ENDED),this.h=!0),this.A=!1):(this.a.debug("Creating conviva session. On Play Requested / No autoplay"),DH(this))}aa(a){this.a.debug(_.xd);const b=c=>{if(this.o&&(this.a.debug("Creating conviva session (On Seek / Replay)"),
21
+ AH(this,this.D),DH(this),FH(this),CH(this))){var d=this.l.getTrackManager();d=d.fa()||d.Ia();d.width&&d.height&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.RESOLUTION,d.width,d.height);d.bandwidth&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.BITRATE,d.bandwidth/1E3)}CH(this)&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,c)};switch(a.detail.currentState){case _.Ck:b(Conviva.Constants.PlayerState.PLAYING);break;case _.Bk:b(Conviva.Constants.PlayerState.PAUSED);
22
+ break;case _.uk:b(Conviva.Constants.PlayerState.BUFFERING);break;case _.rk:this.a.debug("onVideoEnded()"),CH(this)&&(this.w&&this.w.Xa()?(this.a.debug("Waiting for postroll Ad before terminating session"),this.J=!0):GH(this))}}L(a){this.a.debug(_.sd);if(CH(this)){if(a=a.detail,typeof a.width===_.p&&typeof a.height===_.p&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.RESOLUTION,a.width,a.height),a.bandwidth&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.BITRATE,a.bandwidth/1E3),(a=
23
+ a.rendition)&&a.track&&(a=a.track)&&a.frameRate){const b={};b[Conviva.Constants.ENCODED_FRAMERATE]=a.frameRate;this.f.setContentInfo(b)}}else this.j.push({fe:this.L.bind(this),Ud:a})}W(){this.a.debug("onSeeking()");CH(this)&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)}V(){this.a.debug("onSeeked()");CH(this)&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_ENDED)}ca(a){this.a.debug("onAdsTimelineChanged()");if(a=a.adsTimeline)this.w=a}S(a){this.a.debug(nH);var b=
24
+ a.ad;a=0===b.Ja();const c=rH(b.getPodIndex());CH(this)||BH(this)||!a||DH(this);if(CH(this)){a=0===b.mb()?Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE;let d=0;const e={};1===b.lb()&&(d=b.getDuration());e[Conviva.Constants.POD_DURATION]=d;e[Conviva.Constants.POD_INDEX]=++this.R;e[Conviva.Constants.POD_POSITION]=c;b=Conviva.Constants.AdPlayer;b=a!==Conviva.Constants.AdType.CLIENT_SIDE||_.Eh()?b.CONTENT:b.SEPARATE;this.f.reportAdBreakStarted(a,b,e);this.B=!0}else this.a.debug("Bug: should already have a valid session")}T(){this.a.debug(oH);
25
+ CH(this)&&this.B&&(this.f.reportAdBreakEnded(),this.B=!1,this.J&&GH(this))}N(a){this.a.debug(_.ud);if(this.o&&this.I)this.a.debug("Session ended in VPF; ignoring subsequent errors");else{var b=a.detail||null,c=b&&b.message||"Player error",d=Conviva.Constants.ErrorSeverity.WARNING;b&&b.severity&&b.severity===_.G&&(d=Conviva.Constants.ErrorSeverity.FATAL,CH(this)||DH(this));CH(this)?(this.a.debug("Report error",c,d),this.f.reportPlaybackError(c,d),d===Conviva.Constants.ErrorSeverity.FATAL&&(this.a.debug("Video Playback Failure"),
26
+ this.I=!0,GH(this))):this.j.push({fe:this.N.bind(this),Ud:a})}}ga(){this.a.debug("onAutoPlayBlocked()");CH(this)&&(this.a.debug("Auto-play blocked. Pausing VST monitoring."),this.A=!0,CH(this)&&this.h&&(this.f.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_STARTED),this.h=!1))}};var MH=class{constructor(){this.g=this.f=null;this.a=!1;this.h=new _.O("clpp.conviva")}onPlayerCreated(a){this.f=new LH(a,this.h)}onContentWillLoad(a,b){HH(this,a);if(this.a){var c=a.getConfiguration();c=_.bf(c.conviva||{});try{IH(c);const d=c.enableAdInsights||!1;EH(this.f,a,c,b);d&&(this.g=new KH(a,()=>this.f.f),yH(this.g,c))}catch(d){d instanceof _.H?this.U(a,d):this.U(a,new _.H(1,9,9002,d,d))}}}onContentLoaded(){this.a&&FH(this.f)}onPlayerWillDestroy(){this.a&&(this.a=!1,this.f.destroy(),this.f=
27
+ null,this.g&&(this.g.destroy(),this.g=null))}onPlayerWillRelease(){this.a&&(this.f.release(),this.g&&this.g.release())}id(){return"conviva"}U(a,b){a.trigger(new _.F(_.Oc,{detail:b}))}reportAppEvent(a,b){return this.f?this.f.reportAppEvent(a,b):!1}};_.x("clpp.conviva.ConvivaPlugin",MH);MH.prototype.reportAppEvent=MH.prototype.reportAppEvent;MH.Id="conviva";_.Cl(new class{create(){return new MH}});};f.call(g, window);