@castlabs/prestoplay 6.4.0 → 6.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +6 -6
  5. package/cjs/cl.cast.js +103 -103
  6. package/cjs/cl.conviva.js +33 -33
  7. package/cjs/cl.core.js +414 -398
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +71 -71
  10. package/cjs/cl.externs.js +53 -132
  11. package/cjs/cl.freewheel.js +21 -21
  12. package/cjs/cl.hls.js +46 -48
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +31 -32
  15. package/cjs/cl.ima.js +21 -21
  16. package/cjs/cl.mse.js +250 -250
  17. package/cjs/cl.muxdata.js +12 -12
  18. package/cjs/cl.onboard.js +3 -3
  19. package/cjs/cl.persistent.js +13 -13
  20. package/cjs/cl.playlist.js +6 -6
  21. package/cjs/cl.smooth.js +69 -69
  22. package/cjs/cl.thumbnails.js +24 -24
  23. package/cjs/cl.tizen.js +69 -69
  24. package/cjs/cl.ttml.js +27 -27
  25. package/cjs/cl.verimatrix.js +5 -5
  26. package/cjs/cl.vimond.js +13 -13
  27. package/cjs/cl.vr.js +18 -18
  28. package/cjs/cl.vtt.js +14 -14
  29. package/cjs/cl.youbora.js +15 -15
  30. package/cl.adobe.js +3 -3
  31. package/cl.airplay.js +3 -3
  32. package/cl.broadpeak.js +5 -5
  33. package/cl.cast.js +85 -85
  34. package/cl.conviva.js +27 -27
  35. package/cl.core.js +360 -351
  36. package/cl.crypto.js +8 -8
  37. package/cl.dash.js +67 -67
  38. package/cl.externs.js +48 -131
  39. package/cl.freewheel.js +17 -17
  40. package/cl.hls.js +39 -40
  41. package/cl.hlssmpte.js +5 -5
  42. package/cl.htmlcue.js +25 -25
  43. package/cl.ima.js +15 -15
  44. package/cl.mse.js +228 -228
  45. package/cl.muxdata.js +8 -8
  46. package/cl.onboard.js +4 -4
  47. package/cl.persistent.js +9 -9
  48. package/cl.playlist.js +5 -5
  49. package/cl.smooth.js +58 -58
  50. package/cl.thumbnails.js +17 -17
  51. package/cl.tizen.js +57 -57
  52. package/cl.ttml.js +22 -22
  53. package/cl.verimatrix.js +4 -4
  54. package/cl.vimond.js +8 -8
  55. package/cl.vr.js +14 -14
  56. package/cl.vtt.js +12 -12
  57. package/cl.youbora.js +14 -14
  58. package/package.json +3 -1
package/cl.cast.js CHANGED
@@ -1,88 +1,88 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var VI="Cannot seek during ads playout.",WI="Cannot switch track",XI="Media session does not exist.",YI="No receivers available",ZI="Reset ABR functionality not available on cast.",$I="SDK not yet ready",aJ="Sender is destroyed.",bJ="clpp.cast.CastProxy",cJ="clpp.cast.Player",dJ="clpp.cast.Receiver",eJ="urn:x-cast:castlabs",fJ="urn:x-cast:com.google.cast.media",gJ=function(a){return _.w(function*(){yield _.om(a,_.Bd);yield _.om(a,_.Ad)})},hJ=function(a){return JSON.stringify(a,(b,c)=>
2
- {if("license"!==b&&typeof c!==_.Vc){if(c instanceof Event){b={};for(const d in c){const e=c[d];typeof e===_.xd?"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}})},iJ=function(a){if(typeof a!==_.je)return a;try{return JSON.parse(a,(b,c)=>"NaN"===c?NaN:"-Infinity"===c?-Infinity:"Infinity"===c?Infinity:c)}catch(b){return a}},jJ=function(a,b,c,d){return _.w(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=_.Og(d,a.mimeType,g);f&&g&&(h=_.Hg(a.url),(h=yield c.fetch(h).P)&&h.data&&(e=f.a(_.K(h.data)),e={url:URL.createObjectURL(new Blob([e])),kind:a.kind,language:a.language,label:a.label,mimeType:g}));return e})},kJ=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 _.Fe:return d.FMP4;case _.Ee:return b===_.J?d.MPEG2_TS:c.TS;case _.Wb:return c.AAC;case _.Xb:return c.AC3;case _.Yb:return c.E_AC3;case "audio/mpeg":return c.MP3;case _.Zb:return c.FMP4}},mJ=function(a){a=void 0===a?lJ:a;var b=cast.framework.messages||chrome.cast.media;if(!b)throw new _.G(1,8,8001);const c=b.MetadataType,d=b.GenericMediaMetadata,e=b.MovieMediaMetadata,f=b.TvShowMediaMetadata,g=b.MusicTrackMediaMetadata,h=b.PhotoMediaMetadata;
5
- b=b.AudiobookChapterMediaMetadata;switch(a){case c.MOVIE:return new e;case c.TV_SHOW:return new f;case c.MUSIC_TRACK:return new g;case c.PHOTO:return new h;case c.AUDIOBOOK_CHAPTER:return new b;default:return new d}},nJ=function(a,b){return a.g.filter(c=>c.type===b)},pJ=function(a,b){const c=oJ(a);return nJ(a,b).find(d=>c.includes(d.id))||null},rJ=function(a,b,c){const d=a.a.a;if(d)if(c){a.f[b]=c.renditions[0];c=[+c.id];if(b!==_.H){const e=a.ja();e&&c.push(+e.id)}c=new chrome.cast.media.EditTracksInfoRequest(c);
6
- d.editTracksInfo(c,()=>{a.f[b]=null;qJ(a,b)},e=>{a.f[b]=null;a.h.debug(WI,e)})}else b===_.H&&(c=new chrome.cast.media.EditTracksInfoRequest([]),d.editTracksInfo(c,()=>{qJ(a,b)},e=>{a.h.debug(WI,e)}))},oJ=function(a){return(a=a.a?a.a.a:null)?a.activeTrackIds.map(b=>b.toString()):[]},qJ=function(a,b){b===_.I?a.a.trigger(new _.C(_.dh)):b===_.H&&a.a.trigger(new _.C(_.eh))},uJ=function(a){if(a)for(const b of sJ)tJ(b)},tJ=function(a){if(!a.w&&window.chrome&&chrome.cast&&chrome.cast.isAvailable&&window.cast&&
7
- cast.framework&&cast.framework.CastContext&&a.T.length){a.w=!0;a.o.Vd();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.aa);vJ&&a.o.ba(.02)}},wJ=function(a){return _.w(function*(){sJ.delete(a);if(a.w){a.w=!1;var b=
8
- cast.framework.CastContext.getInstance();b.removeEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.N);b.removeEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.aa)}b=[];a.f&&(b.push(a.f.destroy()),a.f=null);a.h&&(b.push(a.h.destroy()),a.h=null);yield Promise.all(b);a.A=!1;a.o&&(a.o.stop(),a.o=null);a.S=null;a.W=null})},xJ=function(a){return _.w(function*(){a.fb()||(yield cast.framework.CastContext.getInstance().requestSession())})},zJ=function(a,b,c){c=
9
- void 0===c?0:c;return _.w(function*(){var d=a.f.ja();d&&d.language&&(a.g.preferredTextLanguage=d.language);(d=a.f.ia())&&d.language&&(a.g.preferredAudioLanguage=d.language);yield yJ(a,{source:a.getLoadedSource(),currentTime:c,isLive:a.isLive(),Ld:a.getPresentationStartTime(),autoplay:b,Ja:a.g})})},yJ=function(a,b){return _.w(function*(){var c=chrome.cast.media.StreamType;yield xJ(a);if(b){var d=cast.framework.CastContext.getInstance().getCurrentSession(),e=new chrome.cast.media.MediaInfo(b.source.url,
10
- b.source.type);e.streamType=b.isLive?c.LIVE:c.BUFFERED;c=b.audioMimeType;e.hlsVideoSegmentFormat=kJ(b.wb,_.J);e.hlsSegmentFormat=kJ(c,_.I);b.Ja&&(a.M&&(c=yield Promise.resolve(a.M(b.Ja)))&&(b.Ja=c),a.g=b.Ja,a.C=_.ol(a.g),a.B=a.C.findIndex(k=>k.url===b.source.url),b.Ja.remoteTextTracks&&(c=yield Promise.all(b.Ja.remoteTextTracks.map(a.za.bind(a))),e.tracks=c.filter(k=>k),b.Ja.remoteTextTracks=void 0),delete b.Ja.autoplay,b.Ja.startTime=null,e.customData={playerConfiguration:hJ(b.Ja)});c=a.$a()||{};
11
- var f=AJ(c.metadataType),g;typeof b.Ld===_.p&&(g={metadataType:f,sectionStartAbsoluteTime:b.Ld});var h;b.source.name&&(h={metadataType:f,title:b.source.name});c=BJ(c);if(g=CJ(Object.assign({},g,h,c)))e.metadata=g;e=new chrome.cast.media.LoadRequest(e);typeof b.autoplay===_.cc&&(e.autoplay=b.autoplay);typeof b.currentTime===_.p&&(e.currentTime=b.currentTime);yield d.loadMedia(e)}})},CJ=function(a){if(!a)return null;a:{var b=a.metadataType;const c=Object.entries(DJ);for(const d of c){const [e,f]=d;
12
- if(f===b){b=e;break a}}b=null}if(!b)return null;b=mJ(DJ[b]);return Object.assign(b,a)},AJ=function(a){var b=void 0===b?lJ:b;return Object.values(DJ).includes(a)?a:b},BJ=function(a){const b={};for(const c in a)void 0!==a[c]&&(b[c]=a[c]);return b},FJ=function(a,b){EJ(a,b.getMediaSession());b.addEventListener(cast.framework.SessionEventType.MEDIA_SESSION,a.V);b.addMessageListener(eJ,a.R)},GJ=function(a){const b=a.getPosition();a.a&&a.a.media?(a=a.a.media.startAbsoluteTime,a=typeof a!==_.p?null:a):a=
13
- null;a=null===a?null:a+b;return null===a?b:a},EJ=function(a,b){b!==a.a&&(a.a=b,a.a&&(a.H.release(),a.F=null,a.m=null,a.m=new cast.framework.RemotePlayer,a.F=new cast.framework.RemotePlayerController(a.m),a.H.on(a.F,cast.framework.RemotePlayerEventType.CURRENT_TIME_CHANGED,a.sa.bind(a)),a.f&&a.f.load(),a.h&&a.h.init(),a.trigger(new _.C(_.jd))))},JJ=function(a){return new HJ(a.h,()=>{a.trigger(new _.C(_.lc))},(b,c)=>{{const d=a.f.getConfiguration();d.source=c.source;d.autoplay=!1;d.startTime=c.currentTime?
14
- Math.max(c.currentTime-1,0):null;d.ima&&d.startTime&&(d.ima.playAdsAfterTime=d.startTime);c.ce&&(d.preferredAudioLanguage=c.ce);c.Ie&&(d.preferredTextLanguage=c.Ie);_.qm(a.f,null);a.trigger(new _.C("castingended"));a.j(b,d)}},()=>IJ(a))},IJ=function(a){return _.w(function*(){a.trigger(new _.C(_.kc));a.f.a!==a.a&&a.f&&a.a&&(yield a.f.release(),_.qm(a.f,a.a))})},MJ=function(a,b,c){return _.w(function*(){var d=b.adTagUrl;if(d)try{KJ=!1;const e=_.Hg(d),f=yield c.fetch(e).P;if(f&&f.data){const g=_.pg(f.data),
15
- h=(new DOMParser).parseFromString(g,_.qe);if(h.getElementsByTagName("vmap:VMAP").length)_.B("VMAP detected."),a.vmapAdsRequest=LJ(g);else if(h.getElementsByTagName("VAST").length){_.B("VAST detected.");{d=g;const k=new cast.framework.messages.BreakClip("bc1");k.vastAdsRequest=LJ(d);const l=new cast.framework.messages.Break("b1",[k.id],0);a.breakClips=[k];a.breaks=[l]}}else _.B("Unsupported schema."),KJ=!0}}catch(e){_.B("Failed to fetch an ad",e),KJ=!0}})},LJ=function(a){const b=new cast.framework.messages.VastAdsRequest;
16
- b.adsResponse=a;return b},NJ=function(a,b){b=new _.G(1,10,10003,{errorType:b});a.l.onError(b)},OJ=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},QJ=function(a,b,c){if(c instanceof cast.framework.events.BreaksEvent||-1!==a.getPosition()){var d=null;(c=PJ(a,c))&&(d={ad:c});a.l.trigger(new _.C(b,d))}},PJ=function(a,b){let c=null;if(a.a&&b instanceof cast.framework.events.BreaksEvent){let d=null,e=null,f;typeof b.breakClipId===_.je&&(d=a.a.getBreakClipById(b.breakClipId));
17
- typeof b.breakId===_.je&&(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},RJ=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]},
18
- SJ=function(a){const b=a.dashTimedMetadata;let c=_.xe;b&&(c=b.schemeIdUri);return{type:c.startsWith(_.we)?_.Of:_.Mf,schemeIdUri:c,id:a.id||"",startTime:a.startTime,endTime:a.endTime,value:b&&b.value||"",eventElement:b&&b.eventElement}},TJ=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},VJ=function(a){a.a=TJ().getTextTracksManager();const b=a.a.getTracks();a.j=UJ(_.H,b)},UJ=function(a,b){const c=[];for(const d of b)b=new _.cg(d.trackId.toString(),a),b.roles=d.roles||
19
- [],b.kind=d.subtype||null,b.language=d.language||null,b.label=d.name||null,b.src=d.trackContentId||null,b.mimeType=d.trackContentType||null,d.customData&&(b.mimeType=d.customData.mimeType||b.mimeType,b.src=d.customData.url||b.src),b.renditions.push(new _.bo(b.id,b)),c.push(b);return c},WJ=function(a,b,c,d){c=_.Xf(c).filter(g=>g);var e=!1;let f=[];b===_.I?f=a.getAudioTracks():b===_.H&&(f=a.da());if(c=c.find(g=>{const h=_.Rg(g);return f.some(k=>{k=_.Rg(k.language||"");return _.Ug(h,k)})})){const g=
20
- _.Rg(c);c=f.filter(h=>{h=_.Rg(h.language||"");return _.Ug(g,h)});f=c.length?c:f;e=e||!!c.length}_.yg(d)&&(c=f.filter(g=>g.roles.includes(d)),f=c.length?c:f,e=e||!!c.length);e&&f[0]&&(e=f[0],a.g.info("Will select track",e),b===_.I?a.na(e):b===_.H&&a.ya(e))},XJ=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},$J=function(a,b){var c=()=>{b.protectionSystem=cast.framework.ContentProtection.NONE;b.licenseUrl=void 0;b.licenseRequestHandler=void 0;b.licenseHandler=void 0};
21
- if(a&&a.drm){var d=a.drm,e=_.Fi(d);if(e){var f=[_.Cc];_.ol(a)[0].type!==_.Sb&&f.unshift(_.Dc);d.preferredDrmSystem===_.Cc&&f.reverse();for(var g,h;f.length&&!h;)g=f.shift(),h=e.La[g];h?(c=g===_.Dc?cast.framework.ContentProtection.WIDEVINE:g===_.Cc?cast.framework.ContentProtection.PLAYREADY:void 0,b.protectionSystem=c,b.licenseUrl=h.licenseUrl,c={ldlDelay:0,customData:{}},YJ(b,h,a,c),ZJ(b,h,a,c)):c()}else c()}else c()},YJ=function(a,b,c,d){b.modifiers.licenseRequest?a.licenseRequestHandler=e=>{const f=
22
- _.Hg({method:"POST",uris:[e.url]});e.headers&&(f.headers=e.headers);f.body=e.content;f.allowCrossSiteCredentials=e.withCredentials;b.modifiers.licenseRequest(c,f,d);e.url=f.uris[0];e.headers=f.headers;e.content=f.body;e.withCredentials=f.allowCrossSiteCredentials}:a.licenseRequestHandler=void 0},ZJ=function(a,b,c,d){b.modifiers.licenseResponse?a.licenseHandler=(e,f)=>_.w(function*(){const g=_.Ig(Object.assign({},f.headers),e.buffer,200,"");yield b.modifiers.licenseResponse(c,g,d);return _.K(g.data)}):
23
- a.licenseHandler=void 0},cK=function(){return aK||(aK=new bK)},dK=function(){return cast.framework.CastReceiverContext.getInstance()},fK=function(a,b){a.h.debug("Detected HLS, parsing");var c=cast.framework.messages.HlsVideoSegmentFormat;a=dK();var {hlsVideoSegmentFormat:d}=dK().getPlayerManager().getMediaInformation()||{};c=d===c.FMP4?_.Fe:_.Ee;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=
24
- eK(f,_.la),h=eK(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")},eK=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(","),0<=d&&(c=c.substring(0,d))));return c},hK=function(a,b){let c=null;const d=gK(a);d&&(c={ad:d});a.f.trigger(new _.C(b,c))},gK=function(a){var b=null;if(a.a&&a.a.mediaInfo){b=
25
- 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)||null);b=new X(d,c,g,e,f)}return b},iK=class{constructor(a,b){this.log=new _.N(b);this.f=a;this.m=null;this.h=_.il;this.o=_.Po;this.j=2;this.C=Date.now();this.B=-1}release(){this.a(_.il)}destroy(){this.m=
26
- this.f=null;return Promise.resolve()}getState(){return this.h}onError(a){a.severity===_.F&&this.a(_.hl)}a(a){if(a!==this.h)if(this.h===_.hl&&a!==_.il)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===_.dl?(this.B=b,this.f.trigger(new _.C(_.ec,{detail:{bufferedTimeMS:-1,reason:this.j}}))):this.o===_.dl&&this.f.trigger(new _.C(_.dc,{detail:{bufferedTimeMS:b-this.B,reason:this.j}}));a={currentState:this.h,previousState:this.o,timeSinceLastStateChangeMS:b-
27
- this.C};this.C=b;this.m&&_.Rk(this.m,this.h);this.f.trigger(new _.C(_.ge,{detail:a}))}}};_.y("clpp.cast.CastUtils",class{});var lJ=0,DJ={GENERIC:lJ,MOVIE:1,TV_SHOW:2,MUSIC_TRACK:3,PHOTO:4,AUDIOBOOK_CHAPTER:5};var jK=class extends iK{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.m)}destroy(){const a=this,b=()=>Object.getPrototypeOf(Object.getPrototypeOf(this)).destroy;return _.w(function*(){a.g&&(a.g.removeUpdateListener(a.A),a.g=null);yield b().call(a)})}a(a){const b=this.f.m;b&&b.isPlayingBreak||super.a(a)}D(){if(this.g&&this.w&&
28
- !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(_.$k);break;case chrome.cast.media.IdleReason.ERROR:this.a(_.hl);break;default:this.a(_.il)}break;case chrome.cast.media.PlayerState.PLAYING:this.a(_.ll);break;case chrome.cast.media.PlayerState.PAUSED:this.a(_.kl);break;case chrome.cast.media.PlayerState.BUFFERING:this.a(_.dl)}}};var Y=class extends _.O{constructor(){super();this.h=new _.N("clpp.cast.SenderTrackManager");this.a=null;this.g=[];this.f={}}initialize(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=_.J;break;case chrome.cast.media.TrackType.AUDIO:c=_.I;break;case chrome.cast.media.TrackType.TEXT:c=_.H}c=new _.cg(b.trackId.toString(),c);c.kind=b.subtype;c.language=b.language;
29
- c.label=b.name;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 _.bo(c.id,c));return c}):[],this.a.trigger(new _.C(_.ho)))}destroy(){this.a=null}getVideoTracks(){return nJ(this,_.J)}getAudioTracks(){return nJ(this,_.I)}da(){return nJ(this,_.H)}ea(){const a=this.Fa();return a?a.renditions[0]:null}Ca(){const a=this.ia();return a?a.renditions[0]:null}Da(){const a=this.ja();return a?a.renditions[0]:
30
- null}Na(){return this.f[_.J]||null}ab(){return this.f[_.I]||null}bb(){return this.f[_.H]||null}Fa(){return pJ(this,_.J)}ia(){return pJ(this,_.I)}ja(){return pJ(this,_.H)}Ta(a){rJ(this,_.J,a)}na(a){rJ(this,_.I,a)}ya(a){rJ(this,_.H,a)}Sa(a){this.Ta(a&&a.track)}hb(a){this.na(a&&a.track)}ib(a){this.ya(a&&a.track)}addTextTrack(){return _.w(function*(){})}ga(){return!0}};Y.prototype.isAbrEnabled=Y.prototype.ga;Y.prototype.addTextTrack=Y.prototype.addTextTrack;Y.prototype.setTextRendition=Y.prototype.ib;
31
- Y.prototype.setAudioRendition=Y.prototype.hb;Y.prototype.setVideoRendition=Y.prototype.Sa;Y.prototype.setTextTrack=Y.prototype.ya;Y.prototype.setAudioTrack=Y.prototype.na;Y.prototype.setVideoTrack=Y.prototype.Ta;Y.prototype.getTextTrack=Y.prototype.ja;Y.prototype.getAudioTrack=Y.prototype.ia;Y.prototype.getVideoTrack=Y.prototype.Fa;Y.prototype.getLoadingTextRendition=Y.prototype.bb;Y.prototype.getLoadingAudioRendition=Y.prototype.ab;Y.prototype.getLoadingVideoRendition=Y.prototype.Na;
32
- Y.prototype.getTextRendition=Y.prototype.Da;Y.prototype.getAudioRendition=Y.prototype.Ca;Y.prototype.getVideoRendition=Y.prototype.ea;Y.prototype.getTextTracks=Y.prototype.da;Y.prototype.getAudioTracks=Y.prototype.getAudioTracks;Y.prototype.getVideoTracks=Y.prototype.getVideoTracks;var HJ=class extends _.jo{constructor(a,b,c,d){super();this.j=new _.N(_.tc);this.T=a;this.o=new _.Dh(b);this.S=c;this.W=d;this.g=this.I=_.hi();this.C=[];this.B=0;this.K=new _.hm;this.F=this.m=this.a=null;this.A=this.w=!1;this.$="";this.ha=1E6;this.f=new Y;this.f.initialize(this);this.h=new jK(this);this.H=new _.Nn;this.J=null;this.D=new Set;this.N=this.Va.bind(this);this.aa=this.Ya.bind(this);this.V=this.Xa.bind(this);this.R=this.Wa.bind(this);this.M=null;window.cast||Object.defineProperty(window,
33
- "cast",{get:()=>window.cast_,set:e=>{window.cast_=e;window.setTimeout(()=>{uJ(!0)},0)}});tJ(this);sJ.add(this)}init(a,b){this.g=this.I=b}unload(){return new Promise((a,b)=>{this.f&&this.f.release();this.a&&!this.a.idleReason||a();this.a.stop(null,a,b)})}release(){return this.unload().then(()=>{this.h&&this.h.release()})}destroy(){return _.w(function*(){})}Gc(a){this.M=a}Tb(){return this.w}fb(){return this.A}pd(){return this.$}sendMessage(a,b){const c=this;return _.w(function*(){let d;const e=cast.framework.CastContext.getInstance().getCurrentSession();
34
- if(e)try{yield e.sendMessage(a,hJ(b))}catch(f){d=new _.G(1,8,8E3,{detailedErrorCode:f})}else d=new _.G(1,8,8004,void 0);if(d)c.onError(d)})}cast(){const a=this;return _.w(function*(){if(!a.Tb())throw a.j.warn($I),new _.G(1,8,8001,void 0);if(!vJ)throw a.j.warn(YI),new _.G(1,8,8002,void 0);if(a.fb())throw a.j.warn("Already casting"),new _.G(1,8,8003,void 0);try{yield xJ(a)}catch(b){const c={};b instanceof chrome.cast.Error?(c.detailedErrorCode=b.code,c.details=b.details,c.reason=b.description):c.detailedErrorCode=
35
- b;throw new _.G(1,8,8E3,c);}})}ld(){this.fb()&&cast.framework.CastContext.getInstance().endCurrentSession(!0)}addMessageListener(a){typeof a===_.Vc&&this.D.add(a)}removeMessageListener(a){typeof a===_.Vc&&this.D.delete(a)}play(){return this.isEnded()?zJ(this,!0):new Promise((a,b)=>{if(!this.a)return b(XI);this.a.play(null,a,b)})}pause(){return new Promise((a,b)=>{this.isEnded()&&a();if(!this.a)return b(XI);this.a.pause(null,a,b)})}isPaused(){return!!this.a&&this.a.playerState===chrome.cast.media.PlayerState.PAUSED}isEnded(){return this.getState()===
36
- _.$k}seek(a){return this.isEnded()?zJ(this,!1,a):new Promise((b,c)=>{this.a||c(XI);this.m.isPlayingBreak&&c(VI);const d=new chrome.cast.media.SeekRequest;d.currentTime=a;this.trigger(new _.C(_.ze));this.a.seek(d,()=>{this.trigger(new _.C(_.ye));b()},c)})}getPosition(){return this.a&&this.a.getEstimatedTime()||0}getDuration(){if(!this.a||!this.a.media)return-1;const a=this.a.media.duration;return typeof a!==_.p?-1:-1===a?Infinity:a}setDrmCustomDataModifier(){}setCdnErrorCallback(){}getPlaybackRate(){return this.a&&
37
- this.a.playbackRate||0}setPlaybackRate(a){this.a&&0<a&&this.sendMessage(fJ,{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(){if(!this.a||
38
- !this.a.media||!this.a.media.metadata)return null;const a=this.a.media.metadata.sectionStartAbsoluteTime;return typeof a!==_.p?null:1E-8===a?0:a}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.h?this.h.getState():_.Po}getStats(){return this.a&&this.a.customData&&this.a.customData.stats?iJ(this.a.customData.stats):_.Vk()}isLive(){return Infinity===
39
- this.getDuration()}load(a){const b=this;return _.w(function*(){if(b.Tb())if(vJ){b.C=_.ol(a);_.ki(a)&&(b.g=_.ji(b.I,a));var c=b.C[b.B];yield yJ(b,{source:c,isLive:c.isLive,autoplay:b.g.autoplay,Ja:b.g,wb:c.wb,audioMimeType:c.audioMimeType})}else b.j.warn(YI);else b.j.warn($I)})}getBufferInfo(){return new _.io}getTrackManager(){return this.f}getConfiguration(){return this.g}getSurface(){return null}setNetworkEngine(a){this.K=a}getNetworkEngine(){return this.K}getSourceIndex(){return this.B}setSourceIndex(a){this.B=
40
- a}getLoadedSource(){return this.C[this.B]}getPeriods(){return[]}getDrmInfo(){return null}getTimelineCues(){return[]}resetAbr(){this.j.warn(ZI)}onError(a){if(a&&(this.trigger(new _.C(_.Tc,{detail:a})),this.h))this.h.onError(a)}namespace(){return _.tc}canPlay(){return this.Tb()?2:0}$a(){return this.J}$b(a){this.J=CJ(a)}gd(){this.J=null}Rd(a){const b=this.$a()||{};a={metadataType:AJ(b.metadataType),title:a};this.$b(Object.assign({},b,a))}Pd(a){const b=this.$a()||{},c=AJ(b.metadataType);a=new chrome.cast.Image(a);
41
- this.$b(Object.assign({},b,{metadataType:c,images:[a]}))}Od(a){const b=this.$a()||{};this.$b(Object.assign({},b,{metadataType:3,artist:a}))}Qd(a){const b=this.$a()||{};a={metadataType:AJ(b.metadataType),releaseDate:a};this.$b(Object.assign({},b,a))}Va(a){const b=cast.framework.CastContext.getInstance(),c=a.castState===cast.framework.CastState.CONNECTED;vJ=a.castState!==cast.framework.CastState.NO_DEVICES_AVAILABLE;this.$=c?b.getCurrentSession().getCastDevice().friendlyName:"";this.o.Vd()}Ya(a){this.j.debug(`state: ${a.sessionState}, details:`,
42
- a);switch(a.sessionState){case cast.framework.SessionState.SESSION_STARTED:this.A=!0;FJ(this,a.session);break;case cast.framework.SessionState.SESSION_RESUMED:this.fb()||(this.A=!0,FJ(this,a.session),this.W());break;case cast.framework.SessionState.SESSION_ENDED:if(this.fb()&&this.a){const d=this.a.media;var b=this.f.ia(),c=this.f.ja();b=b&&b.language||void 0;c=c&&c.language||void 0;this.S(this.getState(),{source:{url:d.contentId,type:d.contentType,isLive:this.isLive()},currentTime:GJ(this),Ie:c,
43
- ce:b})}a.session.removeEventListener(cast.framework.SessionEventType.MEDIA_SESSION,this.V);a.session.removeMessageListener(eJ,this.R);this.A=!1;this.a=null;this.H.release();this.m=this.F=null}}Xa(a){this.j.debug("New media session",a.mediaSession);EJ(this,a.mediaSession)}Wa(a,b){if(a===eJ&&0<this.D.size){const c=iJ(b);this.D.forEach(d=>d(c))}}sa(){this.trigger(new _.C(_.re))}za(a){const b=this;return _.w(function*(){let c=null;const d=yield jJ(a,[_.pe,_.Rb],b.K,b.g);d&&(c=new chrome.cast.media.Track(b.ha++,
44
- chrome.cast.media.TrackType.TEXT),c.language=d.language,c.name=d.label||null,c.trackContentId=d.url,c.trackContentType=d.mimeType,c.customData={mimeType:a.mimeType,url:a.url});return c})}getTextDisplayer(){return null}};HJ.prototype.getTextDisplayer=HJ.prototype.getTextDisplayer;HJ.prototype.getNetworkEngine=HJ.prototype.getNetworkEngine;HJ.prototype.setNetworkEngine=HJ.prototype.setNetworkEngine;var vJ=!1,sJ=new Set;window.__onGCastApiAvailable=uJ;var kK=class extends _.jo{constructor(a,b,c){super();this.f=a;this.h=b;this.j=typeof c===_.Vc?c:(d,e)=>{this.f&&d!==_.$k&&d!==_.il&&this.f.load(e)};this.a=JJ(this);this.g=new _.N(bJ);this.addDelegate(this.f)}destroy(){const a=this;return _.w(function*(){a.a&&(yield wJ(a.a),a.a=null);a.removeDelegate(a.f)})}ed(){return!!this.a&&this.a.Tb()&&vJ}fb(){return!!this.a&&this.a.fb()}pd(){return this.a?this.a.pd():""}Gc(a){this.a&&this.a.Gc(a)}cast(a){const b=this;return _.w(function*(){if(b.a)try{if(yield b.a.cast(),
45
- b.f&&b.a){{let d=null;const e=b.f.getLoadedSource();if(e){const f=b.f.getTrackManager(),g=f.getVideoTracks()[0];let h,k;g&&g.mimeType&&(h=g.mimeType);const l=b.f.getConfiguration(),m=f.ia();m&&(m.mimeType&&(k=m.mimeType),m.language&&(l.preferredAudioLanguage=m.language),m.roles.length&&(l.preferredAudioRole=m.roles[0]));const n=f.ja();n&&(n.language&&(l.preferredTextLanguage=n.language),n.roles.length&&(l.preferredTextRole=n.roles[0]));const q=e&&typeof e.isLive===_.cc?e.isLive:b.f.isLive();d={source:e,
46
- isLive:q,autoplay:!b.f.isPaused(),currentTime:Math.max(b.f.getPosition()-1,0),Ld:b.f.getPresentationStartTime(),wb:h,audioMimeType:k,Ja:l}}var c=d}yield IJ(b);b.a&&(c&&(c.autoplay=!b.f.isPaused()),a?yield b.f.load(a):b.a.a||(yield yJ(b.a,c)))}}catch(d){b.g.error("Error while trying to cast",d),c=new _.C(_.Tc,{detail:d}),b.trigger(c)}})}ld(){this.a&&this.a.ld()}We(a){const b=this;return _.w(function*(){a!==b.h&&(b.h=a,b.a&&(yield wJ(b.a)),b.a=JJ(b))})}sendMessage(a){const b=this;return _.w(function*(){b.a?
47
- yield b.a.sendMessage(eJ,a):b.g.warn(aJ)})}addMessageListener(a){this.a?this.a.addMessageListener(a):this.g.warn(aJ)}removeMessageListener(a){this.a?this.a.removeMessageListener(a):this.g.warn(aJ)}$a(){return this.a&&this.a.$a()}$b(a){this.a&&this.a.$b(a)}gd(){this.a&&this.a.gd()}Rd(a){this.a&&this.a.Rd(a)}Pd(a){this.a&&this.a.Pd(a)}Od(a){this.a&&this.a.Od(a)}Qd(a){this.a&&this.a.Qd(a)}};_.y(bJ,kK);kK.prototype.setContentReleaseDate=kK.prototype.Qd;kK.prototype.setContentArtist=kK.prototype.Od;
48
- kK.prototype.setContentImage=kK.prototype.Pd;kK.prototype.setContentTitle=kK.prototype.Rd;kK.prototype.clearContentMetadata=kK.prototype.gd;kK.prototype.setContentMetadata=kK.prototype.$b;kK.prototype.getContentMetadata=kK.prototype.$a;kK.prototype.removeMessageListener=kK.prototype.removeMessageListener;kK.prototype.addMessageListener=kK.prototype.addMessageListener;kK.prototype.sendMessage=kK.prototype.sendMessage;kK.prototype.changeReceiverId=kK.prototype.We;kK.prototype.forceDisconnect=kK.prototype.ld;
49
- kK.prototype.cast=kK.prototype.cast;kK.prototype.setPlayerConfigInterceptor=kK.prototype.Gc;kK.prototype.getReceiverName=kK.prototype.pd;kK.prototype.isCasting=kK.prototype.fb;kK.prototype.canCast=kK.prototype.ed;kK.prototype.destroy=kK.prototype.destroy;var lK=class extends iK{constructor(a){super(a,"clpp.cast.StateManager");this.I=this.S.bind(this);this.H=this.R.bind(this);this.A=this.$.bind(this);this.w=this.W.bind(this);this.K=this.V.bind(this);this.J=this.T.bind(this);this.M=this.ha.bind(this);this.F=this.aa.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,
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var kJ="Cannot seek during ads playout.",lJ="Cannot switch track",mJ="Media session does not exist.",nJ="No receivers available",oJ="Reset ABR functionality not available on cast.",pJ="SDK not yet ready",qJ="Sender is destroyed.",rJ="clpp.cast.CastProxy",sJ="clpp.cast.Player",tJ="clpp.cast.Receiver",uJ="urn:x-cast:castlabs",vJ="urn:x-cast:com.google.cast.media",wJ=function(a){return _.w(function*(){yield _.Om(a,_.Ed);yield _.Om(a,_.Dd)})},xJ=function(a){return JSON.stringify(a,(b,c)=>
2
+ {if("license"!==b&&typeof c!==_.Yc){if(c instanceof Event){b={};for(const d in c){const e=c[d];typeof e===_.Ad?"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}})},yJ=function(a){if(typeof a!==_.le)return a;try{return JSON.parse(a,(b,c)=>"NaN"===c?NaN:"-Infinity"===c?-Infinity:"Infinity"===c?Infinity:c)}catch(b){return a}},zJ=function(a,b,c,d){return _.w(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=_.Fh(d,a.mimeType,g);f&&g&&(h=_.Wg(a.url),(h=yield c.fetch(h).P)&&h.data&&(e=f.a(_.G(h.data)),e={url:URL.createObjectURL(new Blob([e])),kind:a.kind,language:a.language,label:a.label,mimeType:g}));return e})},AJ=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 _.He:return d.FMP4;case _.Ge:return b===_.K?d.MPEG2_TS:c.TS;case _.Zb:return c.AAC;case _.$b:return c.AC3;case _.ac:return c.E_AC3;case "audio/mpeg":return c.MP3;case _.bc:return c.FMP4}},CJ=function(a){a=void 0===a?BJ:a;var b=cast.framework.messages||chrome.cast.media;if(!b)throw new _.H(1,8,8001);const c=b.MetadataType,d=b.GenericMediaMetadata,e=b.MovieMediaMetadata,f=b.TvShowMediaMetadata,g=b.MusicTrackMediaMetadata,h=b.PhotoMediaMetadata;
5
+ b=b.AudiobookChapterMediaMetadata;switch(a){case c.MOVIE:return new e;case c.TV_SHOW:return new f;case c.MUSIC_TRACK:return new g;case c.PHOTO:return new h;case c.AUDIOBOOK_CHAPTER:return new b;default:return new d}},DJ=function(a,b){return a.g.filter(c=>c.type===b)},FJ=function(a,b){const c=EJ(a);return DJ(a,b).find(d=>c.includes(d.id))||null},HJ=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.ja();e&&c.push(+e.id)}c=new chrome.cast.media.EditTracksInfoRequest(c);
6
+ d.editTracksInfo(c,()=>{a.f[b]=null;GJ(a,b)},e=>{a.f[b]=null;a.h.debug(lJ,e)})}else b===_.I&&(c=new chrome.cast.media.EditTracksInfoRequest([]),d.editTracksInfo(c,()=>{GJ(a,b)},e=>{a.h.debug(lJ,e)}))},EJ=function(a){return(a=a.a?a.a.a:null)?a.activeTrackIds.map(b=>b.toString()):[]},GJ=function(a,b){b===_.J?a.a.trigger(new _.C(_.Ei)):b===_.I&&a.a.trigger(new _.C(_.Fi))},KJ=function(a){if(a)for(const b of IJ)JJ(b)},JJ=function(a){if(!a.w&&window.chrome&&chrome.cast&&chrome.cast.isAvailable&&window.cast&&
7
+ cast.framework&&cast.framework.CastContext&&a.U.length){a.w=!0;a.o.Xd();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.N);b.addEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.$);LJ&&a.o.aa(.02)}},MJ=function(a){return _.w(function*(){IJ.delete(a);if(a.w){a.w=!1;var b=
8
+ cast.framework.CastContext.getInstance();b.removeEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.N);b.removeEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.$)}b=[];a.f&&(b.push(a.f.destroy()),a.f=null);a.h&&(b.push(a.h.destroy()),a.h=null);yield Promise.all(b);a.A=!1;a.o&&(a.o.stop(),a.o=null);a.S=null;a.W=null})},NJ=function(a){return _.w(function*(){a.fb()||(yield cast.framework.CastContext.getInstance().requestSession())})},PJ=function(a,b,c){c=
9
+ void 0===c?0:c;return _.w(function*(){var d=a.f.ja();d&&d.language&&(a.g.preferredTextLanguage=d.language);(d=a.f.ia())&&d.language&&(a.g.preferredAudioLanguage=d.language);yield OJ(a,{source:a.getLoadedSource(),currentTime:c,isLive:a.isLive(),Nd:a.getPresentationStartTime(),autoplay:b,Ja:a.g})})},OJ=function(a,b){return _.w(function*(){var c=chrome.cast.media.StreamType;yield NJ(a);if(b){var d=cast.framework.CastContext.getInstance().getCurrentSession(),e=new chrome.cast.media.MediaInfo(b.source.url,
10
+ b.source.type);e.streamType=b.isLive?c.LIVE:c.BUFFERED;c=b.audioMimeType;e.hlsVideoSegmentFormat=AJ(b.wb,_.K);e.hlsSegmentFormat=AJ(c,_.J);b.Ja&&(a.M&&(c=yield Promise.resolve(a.M(b.Ja)))&&(b.Ja=c),a.g=b.Ja,a.C=_.Ol(a.g),a.B=a.C.findIndex(k=>k.url===b.source.url),b.Ja.remoteTextTracks&&(c=yield Promise.all(b.Ja.remoteTextTracks.map(a.za.bind(a))),e.tracks=c.filter(k=>k),b.Ja.remoteTextTracks=void 0),delete b.Ja.autoplay,b.Ja.startTime=null,e.customData={playerConfiguration:xJ(b.Ja)});c=a.$a()||{};
11
+ var f=QJ(c.metadataType),g;typeof b.Nd===_.p&&(g={metadataType:f,sectionStartAbsoluteTime:b.Nd});var h;b.source.name&&(h={metadataType:f,title:b.source.name});c=RJ(c);if(g=SJ(Object.assign({},g,h,c)))e.metadata=g;e=new chrome.cast.media.LoadRequest(e);typeof b.autoplay===_.fc&&(e.autoplay=b.autoplay);typeof b.currentTime===_.p&&(e.currentTime=b.currentTime);yield d.loadMedia(e)}})},SJ=function(a){if(!a)return null;a:{var b=a.metadataType;const c=Object.entries(TJ);for(const d of c){const [e,f]=d;
12
+ if(f===b){b=e;break a}}b=null}if(!b)return null;b=CJ(TJ[b]);return Object.assign(b,a)},QJ=function(a){var b=void 0===b?BJ:b;return Object.values(TJ).includes(a)?a:b},RJ=function(a){const b={};for(const c in a)void 0!==a[c]&&(b[c]=a[c]);return b},VJ=function(a,b){UJ(a,b.getMediaSession());b.addEventListener(cast.framework.SessionEventType.MEDIA_SESSION,a.V);b.addMessageListener(uJ,a.R)},WJ=function(a){const b=a.getPosition();a.a&&a.a.media?(a=a.a.media.startAbsoluteTime,a=typeof a!==_.p?null:a):a=
13
+ null;a=null===a?null:a+b;return null===a?b:a},UJ=function(a,b){b!==a.a&&(a.a=b,a.a&&(a.H.release(),a.F=null,a.m=null,a.m=new cast.framework.RemotePlayer,a.F=new cast.framework.RemotePlayerController(a.m),a.H.on(a.F,cast.framework.RemotePlayerEventType.CURRENT_TIME_CHANGED,a.sa.bind(a)),a.f&&a.f.load(),a.h&&a.h.init(),a.trigger(new _.C(_.nd))))},ZJ=function(a){return new XJ(a.h,()=>{a.trigger(new _.C(_.oc))},(b,c)=>{{const d=a.f.getConfiguration();d.source=c.source;d.autoplay=!1;d.startTime=c.currentTime?
14
+ Math.max(c.currentTime-1,0):null;d.ima&&d.startTime&&(d.ima.playAdsAfterTime=d.startTime);c.ee&&(d.preferredAudioLanguage=c.ee);c.Ke&&(d.preferredTextLanguage=c.Ke);_.Qm(a.f,null);a.trigger(new _.C("castingended"));a.j(b,d)}},()=>YJ(a))},YJ=function(a){return _.w(function*(){a.trigger(new _.C(_.nc));a.f.a!==a.a&&a.f&&a.a&&(yield a.f.release(),_.Qm(a.f,a.a))})},bK=function(a,b,c){return _.w(function*(){var d=b.adTagUrl;if(d)try{$J=!1;const e=_.Wg(d),f=yield c.fetch(e).P;if(f&&f.data){const g=_.yg(f.data),
15
+ h=(new DOMParser).parseFromString(g,_.se);if(h.getElementsByTagName("vmap:VMAP").length)_.B("VMAP detected."),a.vmapAdsRequest=aK(g);else if(h.getElementsByTagName("VAST").length){_.B("VAST detected.");{d=g;const k=new cast.framework.messages.BreakClip("bc1");k.vastAdsRequest=aK(d);const l=new cast.framework.messages.Break("b1",[k.id],0);a.breakClips=[k];a.breaks=[l]}}else _.B("Unsupported schema."),$J=!0}}catch(e){_.B("Failed to fetch an ad",e),$J=!0}})},aK=function(a){const b=new cast.framework.messages.VastAdsRequest;
16
+ b.adsResponse=a;return b},cK=function(a,b){b=new _.H(1,10,10003,{errorType:b});a.l.onError(b)},dK=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},fK=function(a,b,c){if(c instanceof cast.framework.events.BreaksEvent||-1!==a.getPosition()){var d=null;(c=eK(a,c))&&(d={ad:c});a.l.trigger(new _.C(b,d))}},eK=function(a,b){let c=null;if(a.a&&b instanceof cast.framework.events.BreaksEvent){let d=null,e=null,f;typeof b.breakClipId===_.le&&(d=a.a.getBreakClipById(b.breakClipId));
17
+ typeof b.breakId===_.le&&(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},gK=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]},
18
+ hK=function(a){const b=a.dashTimedMetadata;let c=_.ze;b&&(c=b.schemeIdUri);return{type:c.startsWith(_.ye)?_.Qf:_.Of,schemeIdUri:c,id:a.id||"",startTime:a.startTime,endTime:a.endTime,value:b&&b.value||"",eventElement:b&&b.eventElement}},iK=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},kK=function(a){a.a=iK().getTextTracksManager();const b=a.a.getTracks();a.j=jK(_.I,b)},jK=function(a,b){const c=[];for(const d of b)b=new _.lh(d.trackId.toString(),a),b.roles=d.roles||
19
+ [],b.kind=d.subtype||null,b.language=d.language||null,b.label=d.name||null,b.src=d.trackContentId||null,b.mimeType=d.trackContentType||null,d.customData&&(b.mimeType=d.customData.mimeType||b.mimeType,b.src=d.customData.url||b.src),b.renditions.push(new _.sh(b.id,b)),c.push(b);return c},lK=function(a,b,c,d){c=_.fh(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=_.Ih(g);return f.some(k=>{k=_.Ih(k.language||"");return _.Jh(h,k)})})){const g=
20
+ _.Ih(c);c=f.filter(h=>{h=_.Ih(h.language||"");return _.Jh(g,h)});f=c.length?c:f;e=e||!!c.length}_.Hg(d)&&(c=f.filter(g=>g.roles.includes(d)),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.oa(e):b===_.I&&a.ya(e))},mK=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},pK=function(a,b){var c=()=>{b.protectionSystem=cast.framework.ContentProtection.NONE;b.licenseUrl=void 0;b.licenseRequestHandler=void 0;b.licenseHandler=void 0};
21
+ if(a&&a.drm){var d=a.drm,e=_.jj(d);if(e){var f=[_.Fc];_.Ol(a)[0].type!==_.Wb&&f.unshift(_.Gc);d.preferredDrmSystem===_.Fc&&f.reverse();for(var g,h;f.length&&!h;)g=f.shift(),h=e.La[g];h?(c=g===_.Gc?cast.framework.ContentProtection.WIDEVINE:g===_.Fc?cast.framework.ContentProtection.PLAYREADY:void 0,b.protectionSystem=c,b.licenseUrl=h.licenseUrl,c={ldlDelay:0,customData:{}},nK(b,h,a,c),oK(b,h,a,c)):c()}else c()}else c()},nK=function(a,b,c,d){b.modifiers.licenseRequest?a.licenseRequestHandler=e=>{const f=
22
+ _.Wg({method:"POST",uris:[e.url]});e.headers&&(f.headers=e.headers);f.body=e.content;f.allowCrossSiteCredentials=e.withCredentials;b.modifiers.licenseRequest(c,f,d);e.url=f.uris[0];e.headers=f.headers;e.content=f.body;e.withCredentials=f.allowCrossSiteCredentials}:a.licenseRequestHandler=void 0},oK=function(a,b,c,d){b.modifiers.licenseResponse?a.licenseHandler=(e,f)=>_.w(function*(){const g=_.Xg(Object.assign({},f.headers),e.buffer,200,"");yield b.modifiers.licenseResponse(c,g,d);return _.G(g.data)}):
23
+ a.licenseHandler=void 0},sK=function(){return qK||(qK=new rK)},tK=function(){return cast.framework.CastReceiverContext.getInstance()},vK=function(a,b){a.h.debug("Detected HLS, parsing");var c=cast.framework.messages.HlsVideoSegmentFormat;a=tK();var {hlsVideoSegmentFormat:d}=tK().getPlayerManager().getMediaInformation()||{};c=d===c.FMP4?_.He:_.Ge;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=
24
+ uK(f,_.la),h=uK(f,_.Za);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")},uK=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(","),0<=d&&(c=c.substring(0,d))));return c},xK=function(a,b){let c=null;const d=wK(a);d&&(c={ad:d});a.f.trigger(new _.C(b,c))},wK=function(a){var b=null;if(a.a&&a.a.mediaInfo){b=a.a.mediaInfo;
25
+ 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)||null);b=new X(d,c,g,e,f)}return b},yK=class{constructor(a,b){this.log=new _.O(b);this.f=a;this.m=null;this.h=_.Il;this.o=_.op;this.j=2;this.C=Date.now();this.B=-1}release(){this.a(_.Il)}destroy(){this.m=
26
+ this.f=null;return Promise.resolve()}getState(){return this.h}onError(a){a.severity===_.F&&this.a(_.Hl)}a(a){if(a!==this.h)if(this.h===_.Hl&&a!==_.Il)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===_.Dl?(this.B=b,this.f.trigger(new _.C(_.hc,{detail:{bufferedTimeMS:-1,reason:this.j}}))):this.o===_.Dl&&this.f.trigger(new _.C(_.gc,{detail:{bufferedTimeMS:b-this.B,reason:this.j}}));a={currentState:this.h,previousState:this.o,timeSinceLastStateChangeMS:b-
27
+ this.C};this.C=b;this.m&&_.rl(this.m,this.h);this.f.trigger(new _.C(_.ie,{detail:a}))}}};_.x("clpp.cast.CastUtils",class{});var BJ=0,TJ={GENERIC:BJ,MOVIE:1,TV_SHOW:2,MUSIC_TRACK:3,PHOTO:4,AUDIOBOOK_CHAPTER:5};var zK=class extends yK{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.m)}destroy(){const a=this,b=()=>Object.getPrototypeOf(Object.getPrototypeOf(this)).destroy;return _.w(function*(){a.g&&(a.g.removeUpdateListener(a.A),a.g=null);yield b().call(a)})}a(a){const b=this.f.m;b&&b.isPlayingBreak||super.a(a)}D(){if(this.g&&this.w&&
28
+ !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(_.Al);break;case chrome.cast.media.IdleReason.ERROR:this.a(_.Hl);break;default:this.a(_.Il)}break;case chrome.cast.media.PlayerState.PLAYING:this.a(_.Ll);break;case chrome.cast.media.PlayerState.PAUSED:this.a(_.Kl);break;case chrome.cast.media.PlayerState.BUFFERING:this.a(_.Dl)}}};var Y=class extends _.P{constructor(){super();this.h=new _.O("clpp.cast.SenderTrackManager");this.a=null;this.g=[];this.f={}}initialize(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 _.lh(b.trackId.toString(),c);c.kind=b.subtype;c.language=b.language;
29
+ c.label=b.name;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 _.sh(c.id,c));return c}):[],this.a.trigger(new _.C(_.Po)))}destroy(){this.a=null}getVideoTracks(){return DJ(this,_.K)}getAudioTracks(){return DJ(this,_.J)}ea(){return DJ(this,_.I)}da(){const a=this.Fa();return a?a.renditions[0]:null}Ca(){const a=this.ia();return a?a.renditions[0]:null}Da(){const a=this.ja();return a?a.renditions[0]:
30
+ null}Na(){return this.f[_.K]||null}ab(){return this.f[_.J]||null}bb(){return this.f[_.I]||null}Fa(){return FJ(this,_.K)}ia(){return FJ(this,_.J)}ja(){return FJ(this,_.I)}Ta(a){HJ(this,_.K,a)}oa(a){HJ(this,_.J,a)}ya(a){HJ(this,_.I,a)}Sa(a){this.Ta(a&&a.track)}hb(a){this.oa(a&&a.track)}ib(a){this.ya(a&&a.track)}addTextTrack(){return _.w(function*(){})}ga(){return!0}};Y.prototype.isAbrEnabled=Y.prototype.ga;Y.prototype.addTextTrack=Y.prototype.addTextTrack;Y.prototype.setTextRendition=Y.prototype.ib;
31
+ Y.prototype.setAudioRendition=Y.prototype.hb;Y.prototype.setVideoRendition=Y.prototype.Sa;Y.prototype.setTextTrack=Y.prototype.ya;Y.prototype.setAudioTrack=Y.prototype.oa;Y.prototype.setVideoTrack=Y.prototype.Ta;Y.prototype.getTextTrack=Y.prototype.ja;Y.prototype.getAudioTrack=Y.prototype.ia;Y.prototype.getVideoTrack=Y.prototype.Fa;Y.prototype.getLoadingTextRendition=Y.prototype.bb;Y.prototype.getLoadingAudioRendition=Y.prototype.ab;Y.prototype.getLoadingVideoRendition=Y.prototype.Na;
32
+ Y.prototype.getTextRendition=Y.prototype.Da;Y.prototype.getAudioRendition=Y.prototype.Ca;Y.prototype.getVideoRendition=Y.prototype.da;Y.prototype.getTextTracks=Y.prototype.ea;Y.prototype.getAudioTracks=Y.prototype.getAudioTracks;Y.prototype.getVideoTracks=Y.prototype.getVideoTracks;var XJ=class extends _.Ro{constructor(a,b,c,d){super();this.j=new _.O(_.wc);this.U=a;this.o=new _.Oh(b);this.S=c;this.W=d;this.g=this.I=_.Oi();this.C=[];this.B=0;this.K=new _.Hm;this.F=this.m=this.a=null;this.A=this.w=!1;this.Z="";this.ha=1E6;this.f=new Y;this.f.initialize(this);this.h=new zK(this);this.H=new _.mo;this.J=null;this.D=new Set;this.N=this.Va.bind(this);this.$=this.Ya.bind(this);this.V=this.Xa.bind(this);this.R=this.Wa.bind(this);this.M=null;window.cast||Object.defineProperty(window,
33
+ "cast",{get:()=>window.cast_,set:e=>{window.cast_=e;window.setTimeout(()=>{KJ(!0)},0)}});JJ(this);IJ.add(this)}init(a,b){this.g=this.I=b}unload(){return new Promise((a,b)=>{this.f&&this.f.release();this.a&&!this.a.idleReason||a();this.a.stop(null,a,b)})}release(){return this.unload().then(()=>{this.h&&this.h.release()})}destroy(){return _.w(function*(){})}Hc(a){this.M=a}Ub(){return this.w}fb(){return this.A}rd(){return this.Z}sendMessage(a,b){const c=this;return _.w(function*(){let d;const e=cast.framework.CastContext.getInstance().getCurrentSession();
34
+ if(e)try{yield e.sendMessage(a,xJ(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 _.w(function*(){if(!a.Ub())throw a.j.warn(pJ),new _.H(1,8,8001,void 0);if(!LJ)throw a.j.warn(nJ),new _.H(1,8,8002,void 0);if(a.fb())throw a.j.warn("Already casting"),new _.H(1,8,8003,void 0);try{yield NJ(a)}catch(b){const c={};b instanceof chrome.cast.Error?(c.detailedErrorCode=b.code,c.details=b.details,c.reason=b.description):c.detailedErrorCode=
35
+ b;throw new _.H(1,8,8E3,c);}})}nd(){this.fb()&&cast.framework.CastContext.getInstance().endCurrentSession(!0)}addMessageListener(a){typeof a===_.Yc&&this.D.add(a)}removeMessageListener(a){typeof a===_.Yc&&this.D.delete(a)}play(){return this.isEnded()?PJ(this,!0):new Promise((a,b)=>{if(!this.a)return b(mJ);this.a.play(null,a,b)})}pause(){return new Promise((a,b)=>{this.isEnded()&&a();if(!this.a)return b(mJ);this.a.pause(null,a,b)})}isPaused(){return!!this.a&&this.a.playerState===chrome.cast.media.PlayerState.PAUSED}isEnded(){return this.getState()===
36
+ _.Al}seek(a){return this.isEnded()?PJ(this,!1,a):new Promise((b,c)=>{this.a||c(mJ);this.m.isPlayingBreak&&c(kJ);const d=new chrome.cast.media.SeekRequest;d.currentTime=a;this.trigger(new _.C(_.Be));this.a.seek(d,()=>{this.trigger(new _.C(_.Ae));b()},c)})}getPosition(){return this.a&&this.a.getEstimatedTime()||0}getDuration(){if(!this.a||!this.a.media)return-1;const a=this.a.media.duration;return typeof a!==_.p?-1:-1===a?Infinity:a}setDrmCustomDataModifier(){}setCdnErrorCallback(){}getPlaybackRate(){return this.a&&
37
+ this.a.playbackRate||0}setPlaybackRate(a){this.a&&0<a&&this.sendMessage(vJ,{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(){if(!this.a||
38
+ !this.a.media||!this.a.media.metadata)return null;const a=this.a.media.metadata.sectionStartAbsoluteTime;return typeof a!==_.p?null:1E-8===a?0:a}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.h?this.h.getState():_.op}getStats(){return this.a&&this.a.customData&&this.a.customData.stats?yJ(this.a.customData.stats):_.vl()}isLive(){return Infinity===
39
+ this.getDuration()}load(a){const b=this;return _.w(function*(){if(b.Ub())if(LJ){b.C=_.Ol(a);_.Ri(a)&&(b.g=_.Qi(b.I,a));var c=b.C[b.B];yield OJ(b,{source:c,isLive:c.isLive,autoplay:b.g.autoplay,Ja:b.g,wb:c.wb,audioMimeType:c.audioMimeType})}else b.j.warn(nJ);else b.j.warn(pJ)})}getBufferInfo(){return new _.Qo}getTrackManager(){return this.f}getConfiguration(){return this.g}getSurface(){return null}setNetworkEngine(a){this.K=a}getNetworkEngine(){return this.K}getSourceIndex(){return this.B}setSourceIndex(a){this.B=
40
+ a}getLoadedSource(){return this.C[this.B]}getPeriods(){return[]}getDrmInfo(){return null}getTimelineCues(){return[]}resetAbr(){this.j.warn(oJ)}onError(a){if(a&&(this.trigger(new _.C(_.Wc,{detail:a})),this.h))this.h.onError(a)}namespace(){return _.wc}canPlay(){return this.Ub()?2:0}$a(){return this.J}ac(a){this.J=SJ(a)}jd(){this.J=null}Td(a){const b=this.$a()||{};a={metadataType:QJ(b.metadataType),title:a};this.ac(Object.assign({},b,a))}Rd(a){const b=this.$a()||{},c=QJ(b.metadataType);a=new chrome.cast.Image(a);
41
+ this.ac(Object.assign({},b,{metadataType:c,images:[a]}))}Qd(a){const b=this.$a()||{};this.ac(Object.assign({},b,{metadataType:3,artist:a}))}Sd(a){const b=this.$a()||{};a={metadataType:QJ(b.metadataType),releaseDate:a};this.ac(Object.assign({},b,a))}Va(a){const b=cast.framework.CastContext.getInstance(),c=a.castState===cast.framework.CastState.CONNECTED;LJ=a.castState!==cast.framework.CastState.NO_DEVICES_AVAILABLE;this.Z=c?b.getCurrentSession().getCastDevice().friendlyName:"";this.o.Xd()}Ya(a){this.j.debug(`state: ${a.sessionState}, details:`,
42
+ a);switch(a.sessionState){case cast.framework.SessionState.SESSION_STARTED:this.A=!0;VJ(this,a.session);break;case cast.framework.SessionState.SESSION_RESUMED:this.fb()||(this.A=!0,VJ(this,a.session),this.W());break;case cast.framework.SessionState.SESSION_ENDED:if(this.fb()&&this.a){const d=this.a.media;var b=this.f.ia(),c=this.f.ja();b=b&&b.language||void 0;c=c&&c.language||void 0;this.S(this.getState(),{source:{url:d.contentId,type:d.contentType,isLive:this.isLive()},currentTime:WJ(this),Ke:c,
43
+ ee:b})}a.session.removeEventListener(cast.framework.SessionEventType.MEDIA_SESSION,this.V);a.session.removeMessageListener(uJ,this.R);this.A=!1;this.a=null;this.H.release();this.m=this.F=null}}Xa(a){this.j.debug("New media session",a.mediaSession);UJ(this,a.mediaSession)}Wa(a,b){if(a===uJ&&0<this.D.size){const c=yJ(b);this.D.forEach(d=>d(c))}}sa(){this.trigger(new _.C(_.te))}za(a){const b=this;return _.w(function*(){let c=null;const d=yield zJ(a,[_.re,_.Vb],b.K,b.g);d&&(c=new chrome.cast.media.Track(b.ha++,
44
+ chrome.cast.media.TrackType.TEXT),c.language=d.language,c.name=d.label||null,c.trackContentId=d.url,c.trackContentType=d.mimeType,c.customData={mimeType:a.mimeType,url:a.url});return c})}getTextDisplayer(){return null}};XJ.prototype.getTextDisplayer=XJ.prototype.getTextDisplayer;XJ.prototype.getNetworkEngine=XJ.prototype.getNetworkEngine;XJ.prototype.setNetworkEngine=XJ.prototype.setNetworkEngine;var LJ=!1,IJ=new Set;window.__onGCastApiAvailable=KJ;var AK=class extends _.Ro{constructor(a,b,c){super();this.f=a;this.h=b;this.j=typeof c===_.Yc?c:(d,e)=>{this.f&&d!==_.Al&&d!==_.Il&&this.f.load(e)};this.a=ZJ(this);this.g=new _.O(rJ);this.addDelegate(this.f)}destroy(){const a=this;return _.w(function*(){a.a&&(yield MJ(a.a),a.a=null);a.removeDelegate(a.f)})}fd(){return!!this.a&&this.a.Ub()&&LJ}fb(){return!!this.a&&this.a.fb()}rd(){return this.a?this.a.rd():""}Hc(a){this.a&&this.a.Hc(a)}cast(a){const b=this;return _.w(function*(){if(b.a)try{if(yield b.a.cast(),
45
+ b.f&&b.a){{let d=null;const e=b.f.getLoadedSource();if(e){const f=b.f.getTrackManager(),g=f.getVideoTracks()[0];let h,k;g&&g.mimeType&&(h=g.mimeType);const l=b.f.getConfiguration(),m=f.ia();m&&(m.mimeType&&(k=m.mimeType),m.language&&(l.preferredAudioLanguage=m.language),m.roles.length&&(l.preferredAudioRole=m.roles[0]));const n=f.ja();n&&(n.language&&(l.preferredTextLanguage=n.language),n.roles.length&&(l.preferredTextRole=n.roles[0]));const q=e&&typeof e.isLive===_.fc?e.isLive:b.f.isLive();d={source:e,
46
+ isLive:q,autoplay:!b.f.isPaused(),currentTime:Math.max(b.f.getPosition()-1,0),Nd:b.f.getPresentationStartTime(),wb:h,audioMimeType:k,Ja:l}}var c=d}yield YJ(b);b.a&&(c&&(c.autoplay=!b.f.isPaused()),a?yield b.f.load(a):b.a.a||(yield OJ(b.a,c)))}}catch(d){b.g.error("Error while trying to cast",d),c=new _.C(_.Wc,{detail:d}),b.trigger(c)}})}nd(){this.a&&this.a.nd()}Ye(a){const b=this;return _.w(function*(){a!==b.h&&(b.h=a,b.a&&(yield MJ(b.a)),b.a=ZJ(b))})}sendMessage(a){const b=this;return _.w(function*(){b.a?
47
+ yield b.a.sendMessage(uJ,a):b.g.warn(qJ)})}addMessageListener(a){this.a?this.a.addMessageListener(a):this.g.warn(qJ)}removeMessageListener(a){this.a?this.a.removeMessageListener(a):this.g.warn(qJ)}$a(){return this.a&&this.a.$a()}ac(a){this.a&&this.a.ac(a)}jd(){this.a&&this.a.jd()}Td(a){this.a&&this.a.Td(a)}Rd(a){this.a&&this.a.Rd(a)}Qd(a){this.a&&this.a.Qd(a)}Sd(a){this.a&&this.a.Sd(a)}};_.x(rJ,AK);AK.prototype.setContentReleaseDate=AK.prototype.Sd;AK.prototype.setContentArtist=AK.prototype.Qd;
48
+ AK.prototype.setContentImage=AK.prototype.Rd;AK.prototype.setContentTitle=AK.prototype.Td;AK.prototype.clearContentMetadata=AK.prototype.jd;AK.prototype.setContentMetadata=AK.prototype.ac;AK.prototype.getContentMetadata=AK.prototype.$a;AK.prototype.removeMessageListener=AK.prototype.removeMessageListener;AK.prototype.addMessageListener=AK.prototype.addMessageListener;AK.prototype.sendMessage=AK.prototype.sendMessage;AK.prototype.changeReceiverId=AK.prototype.Ye;AK.prototype.forceDisconnect=AK.prototype.nd;
49
+ AK.prototype.cast=AK.prototype.cast;AK.prototype.setPlayerConfigInterceptor=AK.prototype.Hc;AK.prototype.getReceiverName=AK.prototype.rd;AK.prototype.isCasting=AK.prototype.fb;AK.prototype.canCast=AK.prototype.fd;AK.prototype.destroy=AK.prototype.destroy;var BK=class extends yK{constructor(a){super(a,"clpp.cast.StateManager");this.I=this.S.bind(this);this.H=this.R.bind(this);this.A=this.Z.bind(this);this.w=this.W.bind(this);this.K=this.V.bind(this);this.J=this.U.bind(this);this.M=this.ha.bind(this);this.F=this.$.bind(this);this.D=this.T.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,
50
50
  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.M);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 _.w(function*(){const c=cast.framework.events.EventType,d=cast.framework.CastReceiverContext.getInstance().getPlayerManager();
51
- 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.M);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 _.C(_.Nd));this.a(_.ll)}R(){this.a(_.kl)}$(){this.a(_.$k)}W(a){a.isBuffering?
52
- this.a(_.dl):(a=this.f.isPaused()?_.kl:_.ll,this.a(a))}V(){this.j=1;this.f.trigger(new _.C(_.ze))}T(){this.f.trigger(new _.C(_.ye))}ha(){this.j=2}aa(){this.a(_.jl)}N(a){const b=this.f.getStats();this.f.trigger(new _.C(_.bc,{detail:{bandwidth:a.totalBitrate,width:b.width,height:b.height}}))}U(a){a=new _.G(_.F,7,7300,{detailedErrorCode:a.detailedErrorCode,error:a.error,reason:a.reason});this.f.trigger(new _.C(_.Tc,{detail:a}));this.a(_.hl)}};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}mb(){return"Google Cast Framework"}nb(){return cast.framework.VERSION}sb(){return 0}getId(){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}Vb(){return!1}Bb(){return this.a.clickThroughUrl||
51
+ 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.M);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 _.C(_.Qd));this.a(_.Ll)}R(){this.a(_.Kl)}Z(){this.a(_.Al)}W(a){a.isBuffering?
52
+ this.a(_.Dl):(a=this.f.isPaused()?_.Kl:_.Ll,this.a(a))}V(){this.j=1;this.f.trigger(new _.C(_.Be))}U(){this.f.trigger(new _.C(_.Ae))}ha(){this.j=2}$(){this.a(_.Jl)}N(a){const b=this.f.getStats();this.f.trigger(new _.C(_.ec,{detail:{bandwidth:a.totalBitrate,width:b.width,height:b.height}}))}T(a){a=new _.H(_.F,7,7300,{detailedErrorCode:a.detailedErrorCode,error:a.error,reason:a.reason});this.f.trigger(new _.C(_.Wc,{detail:a}));this.a(_.Hl)}};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}mb(){return"Google Cast Framework"}nb(){return cast.framework.VERSION}sb(){return 0}getId(){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}Wb(){return!1}Bb(){return this.a.clickThroughUrl||
53
53
  null}getMediaUrl(){return this.a.contentUrl||this.a.contentId||null}pb(){return 0}ob(){return 0}cb(){return 0}Oa(){switch(this.Cb()){case 0:return 0;case -1:return 2;default:return 1}}getPodIndex(){return this.g}Cb(){return this.f.position}Db(){return this.h}rb(){return this.j}getWrapperAdIds(){return[]}getWrapperAdSystems(){return[]}getWrapperCreativeIds(){return[]}};X.prototype.getWrapperCreativeIds=X.prototype.getWrapperCreativeIds;X.prototype.getWrapperAdSystems=X.prototype.getWrapperAdSystems;
54
54
  X.prototype.getWrapperAdIds=X.prototype.getWrapperAdIds;X.prototype.getSequenceLength=X.prototype.rb;X.prototype.getPositionInSequence=X.prototype.Db;X.prototype.getPodTimeOffset=X.prototype.Cb;X.prototype.getPodIndex=X.prototype.getPodIndex;X.prototype.getPodType=X.prototype.Oa;X.prototype.getMediaBitrate=X.prototype.cb;X.prototype.getMediaHeight=X.prototype.ob;X.prototype.getMediaWidth=X.prototype.pb;X.prototype.getMediaUrl=X.prototype.getMediaUrl;X.prototype.getClickThroughUrl=X.prototype.Bb;
55
- X.prototype.isBumper=X.prototype.Vb;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.getId;X.prototype.getTechnology=X.prototype.sb;
56
- X.prototype.getAdManagerVersion=X.prototype.nb;X.prototype.getAdManagerName=X.prototype.mb;var mK=class{constructor(a){this.a=a}getCuePoints(){return this.a.map(a=>a.position)}Eb(){return!!this.a.find(a=>0===a.position)}eb(){return!!this.a.find(a=>-1===a.position)}};mK.prototype.hasPostroll=mK.prototype.eb;mK.prototype.hasPreroll=mK.prototype.Eb;mK.prototype.getCuePoints=mK.prototype.getCuePoints;var nK=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];OJ().addEventListener(this.f,
57
- this.g)}load(){const a=this;return _.w(function*(){KJ&&(KJ=!1,NJ(a,0))})}start(){return _.w(function*(){OJ().play()})}resume(){-1!==this.getPosition()&&OJ().play()}pause(){-1!==this.getPosition()&&OJ().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 _.w(function*(){OJ().removeEventListener(a.f,a.g)})}h(a){const b=cast.framework.events.EndedReason;
58
- switch(a.type){case cast.framework.events.EventType.PLAYER_LOADING:this.a=OJ().getBreakManager();this.a.setPlayWatchedBreak(!0);a=this.a.getBreaks();this.l.trigger(new _.C(_.Hb,{adsTimeline:new mK(a)}));break;case cast.framework.events.EventType.BREAK_CLIP_LOADING:QJ(this,_.xb,a);break;case cast.framework.events.EventType.BREAK_STARTED:QJ(this,_.qb,a);break;case cast.framework.events.EventType.BREAK_ENDED:QJ(this,_.rb,a);break;case cast.framework.events.EventType.BREAK_CLIP_STARTED:QJ(this,_.Db,a);
59
- break;case cast.framework.events.EventType.BREAK_CLIP_ENDED:a.endedReason===b.SKIPPED?(QJ(this,_.Cb,a),QJ(this,_.Eb,a)):a.endedReason===b.STOPPED?QJ(this,_.Eb,a):a.endedReason===b.END_OF_STREAM?(QJ(this,_.ub,a),QJ(this,_.Eb,a)):a.endedReason===b.ERROR&&NJ(this,1);break;case cast.framework.events.EventType.PLAYING:QJ(this,_.Bb,a);break;case cast.framework.events.EventType.PAUSE:QJ(this,_.zb,a);break;case cast.framework.events.EventType.BUFFERING:a.isBuffering?QJ(this,_.sb,a):QJ(this,_.Bb,a)}}};
60
- nK.prototype.getPosition=nK.prototype.getPosition;nK.prototype.setVolume=nK.prototype.setVolume;nK.prototype.getVolume=nK.prototype.getVolume;nK.prototype.skip=nK.prototype.skip;nK.prototype.pause=nK.prototype.pause;nK.prototype.resume=nK.prototype.resume;var KJ=!1;var oK=class{constructor(a){this.Kb=a;this.a=this.f.bind(this)}init(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().addEventListener(RJ(),this.a)}release(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().removeEventListener(RJ(),this.a)}getTimelineCues(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager().getTimedMetadata().map(a=>SJ(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=
61
- _.Pf;break;case cast.framework.events.EventType.TIMED_METADATA_ENTER:b=_.Rf;break;case cast.framework.events.EventType.TIMED_METADATA_EXIT:b=_.Sf}b&&this.Kb(new _.C(b,{detail:SJ(a.timedMetadataInfo)}))}else for(b of this.getTimelineCues())this.Kb(new _.C(_.Pf,{detail:b}))}};var Z=class extends _.O{constructor(){super();this.g=new _.N("clpp.cast.TrackManager");this.l=null;this.o=1E9;this.h=[];this.j=[];this.m=this.w.bind(this);this.a=this.f=null}initialize(a){this.l=a;TJ().addEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.m)}release(){this.h=[];this.j=[];this.a=this.f=null}load(){}destroy(){this.l=null;TJ().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.m)}getVideoTracks(){return[]}getAudioTracks(){return this.h}da(){return this.j}ea(){return null}Ca(){const a=
62
- this.ia();return a&&a.renditions[0]}Da(){const a=this.ja();return a&&a.renditions[0]}Na(){return null}ab(){return null}bb(){return null}Fa(){return null}ia(){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}ja(){let a=null;if(this.a){let b=this.a.getActiveIds()[0];typeof b===_.p&&(b=b.toString(),a=this.da().find(c=>c.id===b)||null)}return a}Ta(){this.g.warn("Video tracks unavailable on Cast")}na(a){a&&this.f&&
63
- this.f.setActiveById(+a.id)}ya(a){this.a&&(a?this.a.setActiveByIds([+a.id]):this.a.setActiveByIds([]))}Sa(){this.g.warn("Video renditions unavailable on Cast")}hb(a){this.na(a&&a.track)}ib(a){this.ya(a&&a.track)}addTextTrack(a){const b=this;return _.w(function*(){var c=b.l.getConfiguration();if((c=yield jJ(a,Object.values(cast.framework.messages.CaptionMimeType),b.l.getNetworkEngine(),c))&&b.a){const d=new cast.framework.messages.Track(b.o++,cast.framework.messages.TrackType.TEXT);d.isInband=!1;d.language=
64
- 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]),VJ(b)}catch(e){throw b.g.warn("failed on track",a),e;}}})}ga(){return!0}w(){this.f=TJ().getAudioTracksManager();var a=this.f.getTracks();this.h=UJ(_.I,a);VJ(this);a=this.l.getConfiguration();WJ(this,_.I,a.preferredAudioLanguage,a.preferredAudioRole);WJ(this,_.H,a.preferredTextLanguage,a.preferredTextRole)}};Z.prototype.isAbrEnabled=Z.prototype.ga;
65
- Z.prototype.addTextTrack=Z.prototype.addTextTrack;Z.prototype.setTextRendition=Z.prototype.ib;Z.prototype.setAudioRendition=Z.prototype.hb;Z.prototype.setVideoRendition=Z.prototype.Sa;Z.prototype.setTextTrack=Z.prototype.ya;Z.prototype.setAudioTrack=Z.prototype.na;Z.prototype.setVideoTrack=Z.prototype.Ta;Z.prototype.getTextTrack=Z.prototype.ja;Z.prototype.getAudioTrack=Z.prototype.ia;Z.prototype.getVideoTrack=Z.prototype.Fa;Z.prototype.getLoadingTextRendition=Z.prototype.bb;
66
- Z.prototype.getLoadingAudioRendition=Z.prototype.ab;Z.prototype.getLoadingVideoRendition=Z.prototype.Na;Z.prototype.getTextRendition=Z.prototype.Da;Z.prototype.getAudioRendition=Z.prototype.Ca;Z.prototype.getVideoRendition=Z.prototype.ea;Z.prototype.getTextTracks=Z.prototype.da;Z.prototype.getAudioTracks=Z.prototype.getAudioTracks;Z.prototype.getVideoTracks=Z.prototype.getVideoTracks;var pK=class extends _.jo{constructor(){super();this.A=new _.N(cJ);this.g=this.o=_.hi();this.w=null;this.j=-1;this.D=new _.hm;this.f=this.m=this.h=this.a=this.B=null;this.C=!1}init(a,b){this.B=a;b&&(this.g=this.o=b);a=XJ();a.setMessageInterceptor(cast.framework.messages.MessageType.MEDIA_STATUS,this.H.bind(this));a.setMediaPlaybackInfoHandler(this.F.bind(this));this.a=new lK(this);this.a.init();this.h=new Z;this.h.initialize(this);this.m=new oK(c=>this.trigger(c));this.m.init()}unload(){const a=cast.framework.messages.PlayerState,
67
- b=XJ();b.getPlayerState()!==a.IDLE&&b.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 _.w(function*(){a.B=null;a.o=_.hi();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=XJ();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot play during ads playout.");a.play();
68
- return Promise.resolve()}pause(){const a=XJ();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot pause during ads playout.");a.pause();return Promise.resolve()}isPaused(){return XJ().getPlayerState()===cast.framework.messages.PlayerState.PAUSED}isEnded(){return XJ().getPlayerState()===cast.framework.messages.PlayerState.IDLE}seek(a){const b=XJ();if(null!==b.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject(VI);b.seek(a);return Promise.resolve()}getPosition(){return XJ().getCurrentTimeSec()}getDuration(){const a=
69
- XJ().getDurationSec();return typeof a===_.p?-1===a?Infinity:a:-1}getPlaybackRate(){return XJ().getPlaybackRate()}setPlaybackRate(a){if(0<a){const b=new cast.framework.messages.SetPlaybackRateRequestData;b.playbackRate=a;XJ().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||
70
- null}getLoadedSource(){const a=XJ().getMediaInformation();if(a){var b=XJ().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,gg:b,name:c}}return null}getDrmInfo(){return null}getPresentationStartTime(){return XJ().getStartAbsoluteTime()}getSeekRange(){let a={start:0,end:this.getDuration()};if(this.isLive()){const b=XJ().getLiveSeekableRange();
71
- 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():_.Po}getStats(){var a=_.Vk();if(this.f){a=XJ().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 Infinity===this.getDuration()}load(a){const b=
72
- this;return _.w(function*(){b.f=new _.No;b.a.m=b.f.a;b.w=_.ol(a);_.ki(a)&&(b.g=_.ji(b.o,a));if(b.C)b.C=!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:hJ(b.g),local:!0};yield XJ().load(d)}})}getBufferInfo(){this.A.warn(_.ma);return new _.io}getTrackManager(){return this.h}getConfiguration(){return this.g}getSurface(){return this.B}setNetworkEngine(a){this.D=
73
- a}getNetworkEngine(){return this.D}getSourceIndex(){return this.j}setSourceIndex(a){this.j=a}getPeriods(){return[]}namespace(){return cJ}getTimelineCues(){return this.m&&this.m.getTimelineCues()||[]}resetAbr(){this.A.warn(ZI)}onError(a){a=new _.C(_.Tc,{detail:a});this.trigger(a)}canPlay(){return _.Qh()?2:0}H(a){a=Object.assign({},a);a.customData||(a.customData={});a.customData.stats=hJ(this.getStats());var b=XJ(),c=a.media||b.getMediaInformation();b=b.getStartAbsoluteTime();c&&typeof b===_.p&&c.startAbsoluteTime!==
74
- b&&(this.A.info("Syncing startAbsoluteTime."+`Old value: ${c.startAbsoluteTime}, `+`new value: ${b}`),c.startAbsoluteTime=b,a=Object.assign({},a,{media:c}));{c=cast.framework.messages.StreamType;b=a.media;var d=!!b;const e=this.isLive(),f=d&&!b.metadata,g=!!a.liveSeekableRange;if(d&&g&&(!e||e&&f)){d=XJ().getStartAbsoluteTime();if(typeof d===_.p){b.startAbsoluteTime=d;let h;f?h=new cast.framework.messages.GenericMediaMetadata:h=b.metadata;h.sectionStartAbsoluteTime=d;b.metadata=h}b.streamType=c.LIVE;
75
- a=Object.assign({},a,{media:b})}}return a}F(a,b){let c=null;a.media.customData&&(c=iJ(a.media.customData.playerConfiguration));(a=c?c.abr:null)&&typeof a.defaultBandwidthEstimate===_.p?b.initialBandwidth=a.defaultBandwidthEstimate:b.initialBandwidth=void 0;$J(c,b);return b}getTextDisplayer(){return null}setDrmCustomDataModifier(){}setCdnErrorCallback(){}};pK.prototype.getTextDisplayer=pK.prototype.getTextDisplayer;pK.prototype.getNetworkEngine=pK.prototype.getNetworkEngine;
76
- pK.prototype.setNetworkEngine=pK.prototype.setNetworkEngine;var bK=class{constructor(){this.a=!1;this.h=new _.N(dJ);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 _.Nn;this.m=null}init(a){a&&(this.f=new pK,_.qm(a,this.f),this.l=a,this.o.on(window,"unload",()=>{const b=this;return _.w(function*(){b.l&&b.l.getState()!==_.il&&(yield gJ(b.l))})}))}start(){if(!this.a&&window.cast&&cast.framework&&cast.framework.CastReceiverContext){this.a=!0;var a=dK(),b=dK().getPlayerManager(),c=new cast.framework.CastReceiverOptions;
77
- c.customNamespaces={};c.customNamespaces[eJ]=cast.framework.system.MessageType.JSON;c.shakaVersion="4.3.4";var d=new cast.framework.PlaybackConfig;d.manifestHandler=this.D.bind(this);d.shakaConfig={streaming:{ignoreTextStreamFailures:!0}};d.enableSmoothLiveRefresh=!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,
78
- this.A);a.start(c);a.addCustomMessageListener(eJ,this.w)}}stop(){if(this.a){this.a=!1;this.o.release();const a=dK();dK().getPlayerManager().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.A);a.removeCustomMessageListener(eJ,this.w);a.stop();this.l=this.f=null}}Gc(a){this.j=a}Mf(a){this.m=a}on(a,b){dK().addEventListener(a,b)}off(a,b){dK().removeEventListener(a,b)}addMessageListener(a){typeof a===_.Vc&&this.g.add(a)}removeMessageListener(a){typeof a===_.Vc&&this.g.delete(a)}sendMessage(a,
79
- b){dK().sendCustomMessage(eJ,b,hJ(a))}Tb(){return this.a}$a(){var a;return a=(a=dK().getPlayerManager().getMediaInformation())&&a.metadata?a.metadata:null}D(a){a=a.trim();if(a.startsWith("#EXTM3U"))return fK(this,a);try{var b=(new DOMParser).parseFromString(a,_.qe)}catch(k){return a}var c=b.getElementsByTagName("MPD")[0];if(c){a=c;this.h.debug("Detected DASH, parsing");b=dK();c=a.getElementsByTagName("Period");for(var d=c.length-1;0<=d;--d){var e=c[d].getElementsByTagName(_.ea);for(var f=e.length-
80
- 1;0<=f;--f){var g=e[f].getAttribute("contentType");if(g===_.v||g===_.Vb){g=e[f].getAttribute(_.pd);var h=e[f].getElementsByTagName(_.Ya);for(let k=h.length-1;0<=k;--k){const l=h[k].getAttribute(_.pd)||g,m=h[k].getAttribute(_.yc);let n=h[k].getAttribute(_.Se)||void 0,q=h[k].getAttribute(_.Wc)||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(_.Ya).length||c[d].removeChild(e[f])}}c[d].getElementsByTagName(_.ea).length||a.removeChild(c[d])}return a=
81
- (new XMLSerializer).serializeToString(a)}if(c=b.getElementsByTagName(_.fb)[0]){a=c;this.h.debug("Detected Smooth, parsing");b=dK();c=a.getElementsByTagName("StreamIndex");for(d=c.length-1;0<=d;--d)if(c[d].getAttribute("Type")===_.v){e=c[d].getElementsByTagName(_.Wa);for(f=e.length-1;0<=f;--f)g=e[f].getAttribute(_.Ja)||void 0,h=e[f].getAttribute(_.Ia)||void 0,void 0!==g&&(g=+g),void 0!==h&&(h=+h),b.canDisplayType(_.Fe,void 0,g,h)||c[d].removeChild(e[f]);c[d].getElementsByTagName(_.Wa).length||a.removeChild(c[d])}a=
82
- (new XMLSerializer).serializeToString(a)}return a}C(a){const b=this;return _.w(function*(){let c=a;var d;c.media.customData&&(d=iJ(c.media.customData.playerConfiguration));if(b.l&&d){b.j&&(d=(yield Promise.resolve(b.j(d)))||d);d.ima&&(yield MJ(c.media,d.ima,b.l.getNetworkEngine()));typeof d.startTime===_.p&&d.startTime!==c.currentTime?c.currentTime=d.startTime:d.startTime=c.currentTime||null;c.media.customData.local||(b.f.C=!0,yield _.xm(b.l,d),yield _.ym(b.l),d=b.l.getLoadedSource(),c.media.contentId=
83
- d.url,c.media.contentType=d.type,d.wb&&(c.media.hlsVideoSegmentFormat=kJ(d.wb,_.J)),d.audioMimeType&&(c.media.hlsSegmentFormat=kJ(d.audioMimeType,_.I)));const e=c.media.metadata;e&&typeof e.sectionStartAbsoluteTime===_.p&&(d=e.sectionStartAbsoluteTime,e.sectionStartAbsoluteTime=0===d?1E-8:d);void 0===c.autoplay&&(c.autoplay=b.l.getConfiguration().autoplay)}b.m&&(d=yield Promise.resolve(b.m(c)))&&(c=d);return c})}F(a){if(this.l&&(!a.media.customData||!a.media.customData.local)){var b=dK().getPlayerManager(),
84
- c=b.getLiveSeekableRange();if(c){a=c.start;c=c.end;var d=this.l.getConfiguration().startTime;typeof a!==_.p||typeof c!==_.p||typeof d!==_.p||d>=a&&d<=c||(b=b.getMediaTimeForAbsoluteTime(d),typeof b===_.p&&b>=a&&b<=c&&this.l.seek(b))}_.Am(this.l)}}B(a){if(0<this.g.size){const b=iJ(a.data);this.g.forEach(c=>c(b))}}};_.y(dJ,bK);bK.prototype.getContentMetadata=bK.prototype.$a;bK.prototype.isApiReady=bK.prototype.Tb;bK.prototype.sendMessage=bK.prototype.sendMessage;bK.prototype.removeMessageListener=bK.prototype.removeMessageListener;
85
- bK.prototype.addMessageListener=bK.prototype.addMessageListener;bK.prototype.off=bK.prototype.off;bK.prototype.on=bK.prototype.on;bK.prototype.setLoadRequestDataInterceptor=bK.prototype.Mf;bK.prototype.setPlayerConfigInterceptor=bK.prototype.Gc;bK.prototype.stop=bK.prototype.stop;bK.prototype.start=bK.prototype.start;bK.prototype.init=bK.prototype.init;bK.getInstance=cK;var aK=null;var qK=class{constructor(a){this.f=a;this.a=null;this.g=new _.Nn;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 _.w(function*(){a.a=a.f.m;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 _.w(function*(){})}resume(){this.a&&
86
- 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(fJ,{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;
87
- return _.w(function*(){a.g.release()})}j(a){switch(a.field){case "mediaInfo":a.value&&(a=a.value,a.breaks&&this.f.trigger(new _.C(_.Hb,{adsTimeline:new mK(a.breaks)})));break;case "isPlayingBreak":a.value?hK(this,_.qb):(hK(this,_.ub),hK(this,_.Eb),hK(this,_.rb));break;case "currentBreakClipNumber":0<=a.value&&(0<a.value&&(hK(this,_.ub),hK(this,_.Eb)),hK(this,_.Db));break;case "isPaused":this.a.isPlayingBreak&&(a.value?hK(this,_.zb):hK(this,_.Bb))}}};qK.prototype.getPosition=qK.prototype.getPosition;
88
- qK.prototype.setVolume=qK.prototype.setVolume;qK.prototype.getVolume=qK.prototype.getVolume;qK.prototype.skip=qK.prototype.skip;qK.prototype.pause=qK.prototype.pause;qK.prototype.resume=qK.prototype.resume;var rK=class{name(){return"clpp.cast.ads.SenderAdsManagerFactory"}Y(a,b){return a.namespace()!==_.tc?!1:!(!b||!b.ima)}create(a){return new qK(a.a)}};rK.prototype.create=rK.prototype.create;rK.prototype.isSupported=rK.prototype.Y;rK.prototype.name=rK.prototype.name;_.Bl(new rK);var sK=class{name(){return"clpp.cast.ads.AdsManagerFactory"}Y(a,b){return cK().Tb()?!(!b||!b.ima):!1}create(a){return new nK(a)}};sK.prototype.create=sK.prototype.create;sK.prototype.isSupported=sK.prototype.Y;sK.prototype.name=sK.prototype.name;_.Bl(new sK);};f.call(g, window);
55
+ X.prototype.isBumper=X.prototype.Wb;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.getId;X.prototype.getTechnology=X.prototype.sb;
56
+ X.prototype.getAdManagerVersion=X.prototype.nb;X.prototype.getAdManagerName=X.prototype.mb;var CK=class{constructor(a){this.a=a}getCuePoints(){return this.a.map(a=>a.position)}Eb(){return!!this.a.find(a=>0===a.position)}eb(){return!!this.a.find(a=>-1===a.position)}};CK.prototype.hasPostroll=CK.prototype.eb;CK.prototype.hasPreroll=CK.prototype.Eb;CK.prototype.getCuePoints=CK.prototype.getCuePoints;var DK=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];dK().addEventListener(this.f,
57
+ this.g)}load(){const a=this;return _.w(function*(){$J&&($J=!1,cK(a,0))})}start(){return _.w(function*(){dK().play()})}resume(){-1!==this.getPosition()&&dK().play()}pause(){-1!==this.getPosition()&&dK().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 _.w(function*(){dK().removeEventListener(a.f,a.g)})}h(a){const b=cast.framework.events.EndedReason;
58
+ switch(a.type){case cast.framework.events.EventType.PLAYER_LOADING:this.a=dK().getBreakManager();this.a.setPlayWatchedBreak(!0);a=this.a.getBreaks();this.l.trigger(new _.C(_.Lb,{adsTimeline:new CK(a)}));break;case cast.framework.events.EventType.BREAK_CLIP_LOADING:fK(this,_.Bb,a);break;case cast.framework.events.EventType.BREAK_STARTED:fK(this,_.ub,a);break;case cast.framework.events.EventType.BREAK_ENDED:fK(this,_.vb,a);break;case cast.framework.events.EventType.BREAK_CLIP_STARTED:fK(this,_.Hb,a);
59
+ break;case cast.framework.events.EventType.BREAK_CLIP_ENDED:a.endedReason===b.SKIPPED?(fK(this,_.Gb,a),fK(this,_.Ib,a)):a.endedReason===b.STOPPED?fK(this,_.Ib,a):a.endedReason===b.END_OF_STREAM?(fK(this,_.yb,a),fK(this,_.Ib,a)):a.endedReason===b.ERROR&&cK(this,1);break;case cast.framework.events.EventType.PLAYING:fK(this,_.Fb,a);break;case cast.framework.events.EventType.PAUSE:fK(this,_.Db,a);break;case cast.framework.events.EventType.BUFFERING:a.isBuffering?fK(this,_.wb,a):fK(this,_.Fb,a)}}};
60
+ DK.prototype.getPosition=DK.prototype.getPosition;DK.prototype.setVolume=DK.prototype.setVolume;DK.prototype.getVolume=DK.prototype.getVolume;DK.prototype.skip=DK.prototype.skip;DK.prototype.pause=DK.prototype.pause;DK.prototype.resume=DK.prototype.resume;var $J=!1;var EK=class{constructor(a){this.Kb=a;this.a=this.f.bind(this)}init(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().addEventListener(gK(),this.a)}release(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().removeEventListener(gK(),this.a)}getTimelineCues(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager().getTimedMetadata().map(a=>hK(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=
61
+ _.Rf;break;case cast.framework.events.EventType.TIMED_METADATA_ENTER:b=_.Tf;break;case cast.framework.events.EventType.TIMED_METADATA_EXIT:b=_.Uf}b&&this.Kb(new _.C(b,{detail:hK(a.timedMetadataInfo)}))}else for(b of this.getTimelineCues())this.Kb(new _.C(_.Rf,{detail:b}))}};var Z=class extends _.P{constructor(){super();this.g=new _.O("clpp.cast.TrackManager");this.l=null;this.o=1E9;this.h=[];this.j=[];this.m=this.w.bind(this);this.a=this.f=null}initialize(a){this.l=a;iK().addEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.m)}release(){this.h=[];this.j=[];this.a=this.f=null}load(){}destroy(){this.l=null;iK().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.m)}getVideoTracks(){return[]}getAudioTracks(){return this.h}ea(){return this.j}da(){return null}Ca(){const a=
62
+ this.ia();return a&&a.renditions[0]}Da(){const a=this.ja();return a&&a.renditions[0]}Na(){return null}ab(){return null}bb(){return null}Fa(){return null}ia(){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}ja(){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}Ta(){this.g.warn("Video tracks unavailable on Cast")}oa(a){a&&this.f&&
63
+ this.f.setActiveById(+a.id)}ya(a){this.a&&(a?this.a.setActiveByIds([+a.id]):this.a.setActiveByIds([]))}Sa(){this.g.warn("Video renditions unavailable on Cast")}hb(a){this.oa(a&&a.track)}ib(a){this.ya(a&&a.track)}addTextTrack(a){const b=this;return _.w(function*(){var c=b.l.getConfiguration();if((c=yield zJ(a,Object.values(cast.framework.messages.CaptionMimeType),b.l.getNetworkEngine(),c))&&b.a){const d=new cast.framework.messages.Track(b.o++,cast.framework.messages.TrackType.TEXT);d.isInband=!1;d.language=
64
+ 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]),kK(b)}catch(e){throw b.g.warn("failed on track",a),e;}}})}ga(){return!0}w(){this.f=iK().getAudioTracksManager();var a=this.f.getTracks();this.h=jK(_.J,a);kK(this);a=this.l.getConfiguration();lK(this,_.J,a.preferredAudioLanguage,a.preferredAudioRole);lK(this,_.I,a.preferredTextLanguage,a.preferredTextRole)}};Z.prototype.isAbrEnabled=Z.prototype.ga;
65
+ Z.prototype.addTextTrack=Z.prototype.addTextTrack;Z.prototype.setTextRendition=Z.prototype.ib;Z.prototype.setAudioRendition=Z.prototype.hb;Z.prototype.setVideoRendition=Z.prototype.Sa;Z.prototype.setTextTrack=Z.prototype.ya;Z.prototype.setAudioTrack=Z.prototype.oa;Z.prototype.setVideoTrack=Z.prototype.Ta;Z.prototype.getTextTrack=Z.prototype.ja;Z.prototype.getAudioTrack=Z.prototype.ia;Z.prototype.getVideoTrack=Z.prototype.Fa;Z.prototype.getLoadingTextRendition=Z.prototype.bb;
66
+ Z.prototype.getLoadingAudioRendition=Z.prototype.ab;Z.prototype.getLoadingVideoRendition=Z.prototype.Na;Z.prototype.getTextRendition=Z.prototype.Da;Z.prototype.getAudioRendition=Z.prototype.Ca;Z.prototype.getVideoRendition=Z.prototype.da;Z.prototype.getTextTracks=Z.prototype.ea;Z.prototype.getAudioTracks=Z.prototype.getAudioTracks;Z.prototype.getVideoTracks=Z.prototype.getVideoTracks;var FK=class extends _.Ro{constructor(){super();this.A=new _.O(sJ);this.g=this.o=_.Oi();this.w=null;this.j=-1;this.D=new _.Hm;this.f=this.m=this.h=this.a=this.B=null;this.C=!1}init(a,b){this.B=a;b&&(this.g=this.o=b);a=mK();a.setMessageInterceptor(cast.framework.messages.MessageType.MEDIA_STATUS,this.H.bind(this));a.setMediaPlaybackInfoHandler(this.F.bind(this));this.a=new BK(this);this.a.init();this.h=new Z;this.h.initialize(this);this.m=new EK(c=>this.trigger(c));this.m.init()}unload(){const a=cast.framework.messages.PlayerState,
67
+ b=mK();b.getPlayerState()!==a.IDLE&&b.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 _.w(function*(){a.B=null;a.o=_.Oi();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=mK();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot play during ads playout.");a.play();
68
+ return Promise.resolve()}pause(){const a=mK();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot pause during ads playout.");a.pause();return Promise.resolve()}isPaused(){return mK().getPlayerState()===cast.framework.messages.PlayerState.PAUSED}isEnded(){return mK().getPlayerState()===cast.framework.messages.PlayerState.IDLE}seek(a){const b=mK();if(null!==b.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject(kJ);b.seek(a);return Promise.resolve()}getPosition(){return mK().getCurrentTimeSec()}getDuration(){const a=
69
+ mK().getDurationSec();return typeof a===_.p?-1===a?Infinity:a:-1}getPlaybackRate(){return mK().getPlaybackRate()}setPlaybackRate(a){if(0<a){const b=new cast.framework.messages.SetPlaybackRateRequestData;b.playbackRate=a;mK().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||
70
+ null}getLoadedSource(){const a=mK().getMediaInformation();if(a){var b=mK().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,ig:b,name:c}}return null}getDrmInfo(){return null}getPresentationStartTime(){return mK().getStartAbsoluteTime()}getSeekRange(){let a={start:0,end:this.getDuration()};if(this.isLive()){const b=mK().getLiveSeekableRange();
71
+ 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():_.op}getStats(){var a=_.vl();if(this.f){a=mK().getStats();this.f.f=a.estimatedBandwidth||NaN;this.f.m=a.streamBandwidth||NaN;var b=this.f,c=a.height||NaN;b.o=a.width||NaN;b.g=c;b=this.f;c=typeof a.decodedFrames===_.p?a.decodedFrames:NaN;b.j=typeof a.droppedFrames===_.p?a.droppedFrames:NaN;b.h=c;a=this.f.getStats()}return a}isLive(){return Infinity===this.getDuration()}load(a){const b=
72
+ this;return _.w(function*(){b.f=new _.kp;b.a.m=b.f.a;b.w=_.Ol(a);_.Ri(a)&&(b.g=_.Qi(b.o,a));if(b.C)b.C=!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:xJ(b.g),local:!0};yield mK().load(d)}})}getBufferInfo(){this.A.warn(_.oa);return new _.Qo}getTrackManager(){return this.h}getConfiguration(){return this.g}getSurface(){return this.B}setNetworkEngine(a){this.D=
73
+ a}getNetworkEngine(){return this.D}getSourceIndex(){return this.j}setSourceIndex(a){this.j=a}getPeriods(){return[]}namespace(){return sJ}getTimelineCues(){return this.m&&this.m.getTimelineCues()||[]}resetAbr(){this.A.warn(oJ)}onError(a){a=new _.C(_.Wc,{detail:a});this.trigger(a)}canPlay(){return _.ai()?2:0}H(a){a=Object.assign({},a);a.customData||(a.customData={});a.customData.stats=xJ(this.getStats());var b=mK(),c=a.media||b.getMediaInformation();b=b.getStartAbsoluteTime();c&&typeof b===_.p&&c.startAbsoluteTime!==
74
+ b&&(this.A.info("Syncing startAbsoluteTime."+`Old value: ${c.startAbsoluteTime}, `+`new value: ${b}`),c.startAbsoluteTime=b,a=Object.assign({},a,{media:c}));{c=cast.framework.messages.StreamType;b=a.media;var d=!!b;const e=this.isLive(),f=d&&!b.metadata,g=!!a.liveSeekableRange;if(d&&g&&(!e||e&&f)){d=mK().getStartAbsoluteTime();if(typeof d===_.p){b.startAbsoluteTime=d;let h;f?h=new cast.framework.messages.GenericMediaMetadata:h=b.metadata;h.sectionStartAbsoluteTime=d;b.metadata=h}b.streamType=c.LIVE;
75
+ a=Object.assign({},a,{media:b})}}return a}F(a,b){let c=null;a.media.customData&&(c=yJ(a.media.customData.playerConfiguration));(a=c?c.abr:null)&&typeof a.defaultBandwidthEstimate===_.p?b.initialBandwidth=a.defaultBandwidthEstimate:b.initialBandwidth=void 0;pK(c,b);return b}getTextDisplayer(){return null}setDrmCustomDataModifier(){}setCdnErrorCallback(){}};FK.prototype.getTextDisplayer=FK.prototype.getTextDisplayer;FK.prototype.getNetworkEngine=FK.prototype.getNetworkEngine;
76
+ FK.prototype.setNetworkEngine=FK.prototype.setNetworkEngine;var rK=class{constructor(){this.a=!1;this.h=new _.O(tJ);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 _.mo;this.m=null}init(a){a&&(this.f=new FK,_.Qm(a,this.f),this.l=a,this.o.on(window,"unload",()=>{const b=this;return _.w(function*(){b.l&&b.l.getState()!==_.Il&&(yield wJ(b.l))})}))}start(){if(!this.a&&window.cast&&cast.framework&&cast.framework.CastReceiverContext){this.a=!0;var a=tK(),b=tK().getPlayerManager(),c=new cast.framework.CastReceiverOptions;
77
+ c.customNamespaces={};c.customNamespaces[uJ]=cast.framework.system.MessageType.JSON;c.shakaVersion="4.3.4";var d=new cast.framework.PlaybackConfig;d.manifestHandler=this.D.bind(this);d.shakaConfig={streaming:{ignoreTextStreamFailures:!0}};d.enableSmoothLiveRefresh=!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,
78
+ this.A);a.start(c);a.addCustomMessageListener(uJ,this.w)}}stop(){if(this.a){this.a=!1;this.o.release();const a=tK();tK().getPlayerManager().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.A);a.removeCustomMessageListener(uJ,this.w);a.stop();this.l=this.f=null}}Hc(a){this.j=a}Of(a){this.m=a}on(a,b){tK().addEventListener(a,b)}off(a,b){tK().removeEventListener(a,b)}addMessageListener(a){typeof a===_.Yc&&this.g.add(a)}removeMessageListener(a){typeof a===_.Yc&&this.g.delete(a)}sendMessage(a,
79
+ b){tK().sendCustomMessage(uJ,b,xJ(a))}Ub(){return this.a}$a(){var a;return a=(a=tK().getPlayerManager().getMediaInformation())&&a.metadata?a.metadata:null}D(a){a=a.trim();if(a.startsWith("#EXTM3U"))return vK(this,a);try{var b=(new DOMParser).parseFromString(a,_.se)}catch(k){return a}var c=b.getElementsByTagName("MPD")[0];if(c){a=c;this.h.debug("Detected DASH, parsing");b=tK();c=a.getElementsByTagName("Period");for(var d=c.length-1;0<=d;--d){var e=c[d].getElementsByTagName(_.ea);for(var f=e.length-
80
+ 1;0<=f;--f){var g=e[f].getAttribute("contentType");if(g===_.v||g===_.Yb){g=e[f].getAttribute(_.td);var h=e[f].getElementsByTagName(_.ab);for(let k=h.length-1;0<=k;--k){const l=h[k].getAttribute(_.td)||g,m=h[k].getAttribute(_.Bc);let n=h[k].getAttribute(_.Ue)||void 0,q=h[k].getAttribute(_.Zc)||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(_.ab).length||c[d].removeChild(e[f])}}c[d].getElementsByTagName(_.ea).length||a.removeChild(c[d])}return a=
81
+ (new XMLSerializer).serializeToString(a)}if(c=b.getElementsByTagName(_.jb)[0]){a=c;this.h.debug("Detected Smooth, parsing");b=tK();c=a.getElementsByTagName("StreamIndex");for(d=c.length-1;0<=d;--d)if(c[d].getAttribute("Type")===_.v){e=c[d].getElementsByTagName(_.Ya);for(f=e.length-1;0<=f;--f)g=e[f].getAttribute(_.La)||void 0,h=e[f].getAttribute(_.Ka)||void 0,void 0!==g&&(g=+g),void 0!==h&&(h=+h),b.canDisplayType(_.He,void 0,g,h)||c[d].removeChild(e[f]);c[d].getElementsByTagName(_.Ya).length||a.removeChild(c[d])}a=
82
+ (new XMLSerializer).serializeToString(a)}return a}C(a){const b=this;return _.w(function*(){let c=a;var d;c.media.customData&&(d=yJ(c.media.customData.playerConfiguration));if(b.l&&d){b.j&&(d=(yield Promise.resolve(b.j(d)))||d);d.ima&&(yield bK(c.media,d.ima,b.l.getNetworkEngine()));typeof d.startTime===_.p&&d.startTime!==c.currentTime?c.currentTime=d.startTime:d.startTime=c.currentTime||null;c.media.customData.local||(b.f.C=!0,yield _.Xm(b.l,d),yield _.Ym(b.l),d=b.l.getLoadedSource(),c.media.contentId=
83
+ d.url,c.media.contentType=d.type,d.wb&&(c.media.hlsVideoSegmentFormat=AJ(d.wb,_.K)),d.audioMimeType&&(c.media.hlsSegmentFormat=AJ(d.audioMimeType,_.J)));const e=c.media.metadata;e&&typeof e.sectionStartAbsoluteTime===_.p&&(d=e.sectionStartAbsoluteTime,e.sectionStartAbsoluteTime=0===d?1E-8:d);void 0===c.autoplay&&(c.autoplay=b.l.getConfiguration().autoplay)}b.m&&(d=yield Promise.resolve(b.m(c)))&&(c=d);return c})}F(a){if(this.l&&(!a.media.customData||!a.media.customData.local)){var b=tK().getPlayerManager(),
84
+ c=b.getLiveSeekableRange();if(c){a=c.start;c=c.end;var d=this.l.getConfiguration().startTime;typeof a!==_.p||typeof c!==_.p||typeof d!==_.p||d>=a&&d<=c||(b=b.getMediaTimeForAbsoluteTime(d),typeof b===_.p&&b>=a&&b<=c&&this.l.seek(b))}_.$m(this.l)}}B(a){if(0<this.g.size){const b=yJ(a.data);this.g.forEach(c=>c(b))}}};_.x(tJ,rK);rK.prototype.getContentMetadata=rK.prototype.$a;rK.prototype.isApiReady=rK.prototype.Ub;rK.prototype.sendMessage=rK.prototype.sendMessage;rK.prototype.removeMessageListener=rK.prototype.removeMessageListener;
85
+ rK.prototype.addMessageListener=rK.prototype.addMessageListener;rK.prototype.off=rK.prototype.off;rK.prototype.on=rK.prototype.on;rK.prototype.setLoadRequestDataInterceptor=rK.prototype.Of;rK.prototype.setPlayerConfigInterceptor=rK.prototype.Hc;rK.prototype.stop=rK.prototype.stop;rK.prototype.start=rK.prototype.start;rK.prototype.init=rK.prototype.init;rK.getInstance=sK;var qK=null;var GK=class{constructor(a){this.f=a;this.a=null;this.g=new _.mo;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 _.w(function*(){a.a=a.f.m;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 _.w(function*(){})}resume(){this.a&&
86
+ 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(vJ,{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;
87
+ return _.w(function*(){a.g.release()})}j(a){switch(a.field){case "mediaInfo":a.value&&(a=a.value,a.breaks&&this.f.trigger(new _.C(_.Lb,{adsTimeline:new CK(a.breaks)})));break;case "isPlayingBreak":a.value?xK(this,_.ub):(xK(this,_.yb),xK(this,_.Ib),xK(this,_.vb));break;case "currentBreakClipNumber":0<=a.value&&(0<a.value&&(xK(this,_.yb),xK(this,_.Ib)),xK(this,_.Hb));break;case "isPaused":this.a.isPlayingBreak&&(a.value?xK(this,_.Db):xK(this,_.Fb))}}};GK.prototype.getPosition=GK.prototype.getPosition;
88
+ GK.prototype.setVolume=GK.prototype.setVolume;GK.prototype.getVolume=GK.prototype.getVolume;GK.prototype.skip=GK.prototype.skip;GK.prototype.pause=GK.prototype.pause;GK.prototype.resume=GK.prototype.resume;var HK=class{name(){return"clpp.cast.ads.SenderAdsManagerFactory"}ba(a,b){return a.namespace()!==_.wc?!1:!(!b||!b.ima)}create(a){return new GK(a.a)}};HK.prototype.create=HK.prototype.create;HK.prototype.isSupported=HK.prototype.ba;HK.prototype.name=HK.prototype.name;_.am(new HK);var IK=class{name(){return"clpp.cast.ads.AdsManagerFactory"}ba(a,b){return sK().Ub()?!(!b||!b.ima):!1}create(a){return new DK(a)}};IK.prototype.create=IK.prototype.create;IK.prototype.isSupported=IK.prototype.ba;IK.prototype.name=IK.prototype.name;_.am(new IK);};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 wI="Ad Error",xI="onAdBreakStarted()",yI="onAdBreakStopped()",zI=function(a){var b=_.ei();let c=Conviva.Constants.DeviceType.DESKTOP,d=Conviva.Constants.DeviceCategory.WEB;const e=b.os;b=b.osVersion.name;let f="";_.Rh()&&(f="Apple");_.Qh()?(f="Google",c=Conviva.Constants.DeviceType.SETTOP,d=Conviva.Constants.DeviceCategory.CHROMECAST):_.Sh()?(c=Conviva.Constants.DeviceType.MOBILE,/(android)/i.test(navigator.userAgent)?d=Conviva.Constants.DeviceCategory.ANDROID_DEVICE:_.Rh()&&(d=Conviva.Constants.DeviceCategory.APPLE_DEVICE)):
2
- _.Kh()||_.Hh()||_.Gh("Hisense")?(c=Conviva.Constants.DeviceType.SMARTTV,d=Conviva.Constants.DeviceCategory.SMART_TV,_.Kh()?(b="",f="LG",d=Conviva.Constants.DeviceCategory.LG_TV):_.Hh()?(f="Samsung",d=Conviva.Constants.DeviceCategory.SAMSUNG_TV):_.Gh("Hisense")&&(b="",f="Hisense")):_.Gh("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},AI=function(a){return a?Conviva.Constants.StreamType.LIVE:Conviva.Constants.StreamType.VOD},BI=function(a){return 0===a?"Pre-roll":-1===a?"Post-roll":"Mid-roll"},DI=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
- AI(!!d);e[Conviva.Constants.ASSET_NAME]=wI;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"]=CI(a.getId()),e["c3.ad.creativeId"]=CI(a.getCreativeId()),e["c3.ad.system"]=CI(a.getAdSystem()),e["c3.ad.mediaFileApiFramework"]=CI(a.getApiFramework()),e["c3.ad.advertiser"]=CI(a.getAdvertiserName()),e["c3.ad.position"]=BI(a.getPodIndex()),e["c3.ad.technology"]=0===a.sb()?Conviva.Constants.AdType.CLIENT_SIDE:
5
- Conviva.Constants.AdType.SERVER_SIDE,e["c3.ad.adManagerName"]=CI(a.mb()),e["c3.ad.adManagerVersion"]=CI(a.nb()),e["c3.ad.advertiserCategory"]=CI(null),e["c3.ad.advertiserId"]=CI(null),e["c3.ad.breakId"]=CI(null),e["c3.ad.campaignName"]=CI(null),e["c3.ad.category"]=CI(null),e["c3.ad.classification"]=CI(null),e["c3.ad.creativeName"]=CI(null),e["c3.ad.sequence"]=CI(a.Db()),e["c3.ad.sessionStartEvent"]=CI(null),e["c3.ad.unitName"]=CI(null),e["c3.ad.dayPart"]=CI(null),b=a.getWrapperAdIds().slice(-1)[0]||
6
- a.getId(),c=a.getWrapperAdSystems().slice(-1)[0]||a.getAdSystem(),a=a.getWrapperCreativeIds().slice(-1)[0]||a.getCreativeId(),e["c3.ad.firstAdId"]=CI(b),e["c3.ad.firstAdSystem"]=CI(c),e["c3.ad.firstCreativeId"]=CI(a));return e},CI=function(a){return a?""+a:"NA"},HI=function(a){a.g.on(a.l,_.qb,a.C.bind(a));a.g.on(a.l,_.rb,a.D.bind(a));a.g.on(a.l,_.Db,a.M.bind(a));a.g.on(a.l,_.Ab,a.m.bind(a));a.g.on(a.l,_.zb,a.m.bind(a));a.g.on(a.l,_.Bb,a.m.bind(a));a.g.on(a.l,_.sb,a.m.bind(a));a.g.on(a.l,_.Eb,a.N.bind(a));
7
- a.g.on(a.l,_.Cb,a.K.bind(a));a.g.on(a.l,_.tb,a.F.bind(a));a.g.on(a.l,_.wb,a.I.bind(a));a.g.on(a.l,_.xb,a.J.bind(a));a.g.on(a.l,_.vb,a.H.bind(a));a.g.on(a.l,_.yb,a.T.bind(a));a.g.on(a.l,_.Fb,a.R.bind(a));a.g.on(a.l,_.Tc,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=wI}null===a.a&&EI(a,null);a.a.reportAdError(c,b.FATAL);a.h=!0;a.f.debug("Ad Playback Failure");
8
- FI(a,GI,c)}})},FI=function(a,b,c=wI){if(a.a){a.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED);switch(b){case GI:a.a.reportAdFailed(c,DI(null,a.B,a.A));break;case II:a.a.reportAdSkipped();break;default:a.a.reportAdEnded()}a.a.release();a.a=null;a.j=!1}},EI=function(a,b){if(!a.o){a.h=!1;try{if(a.a=Conviva.Analytics.buildAdAnalytics(a.S()),b){const c=DI(b,a.B,a.A,a.l.isLive()),d=String(b.nb()),e={};e[Conviva.Constants.FRAMEWORK_NAME]=b.mb();e[Conviva.Constants.FRAMEWORK_VERSION]=
9
- d;a.a.setAdPlayerInfo(e);a.a.reportAdStarted(c)}}catch(c){a.f.error("Could not create ad analytics session",c)}}},JI=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,null,c);Conviva.Analytics.setDeviceMetadata(zI(b));b.connectionType&&Conviva.Analytics.reportDeviceMetric(Conviva.Constants.Network.CONNECTION_TYPE,
10
- b.connectionType);a.f=Conviva.Analytics.buildVideoAnalytics();a.o=!1;b={};b[Conviva.Constants.FRAMEWORK_NAME]=_.na;b[Conviva.Constants.FRAMEWORK_VERSION]=_.da;a.f.setPlayerInfo(b)},KI=function(a){return a.l.getConfiguration().autoplay||!1},MI=function(a){if(!a.m)if(a.C)a.a.warn("Current session still active. No-op.");else{var b=a.l.getLoadedSource()||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=
11
- new _.cj(b.url);b&&(f[Conviva.Constants.ASSET_NAME]=b.name||"N/A",f[Conviva.Constants.STREAM_URL]=_.Zi(g));f[Conviva.Constants.PLAYER_NAME]=c.playerName||_.na;f[Conviva.Constants.VIEWER_ID]=d;f[Conviva.Constants.DEFAULT_RESOURCE]=e;if(c&&!_.z(c.customTags))for(const h in c.customTags)f[h]=c.customTags[h];a.f.reportPlaybackRequested(f);a.f.setCallback(()=>{a.a.debug("reportMiscellaneousMetrics()");if(LI(a)){var h=1E3*a.l.getPosition();a.f.reportPlaybackMetric(Conviva.Constants.Playback.PLAY_HEAD_TIME,
12
- 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.me(h.ae)}));a.j=[]}},NI=function(a){if(!a.m&&a.f){const b=AI(a.l.isLive()),c={};c[Conviva.Constants.IS_LIVE]=b;c[Conviva.Constants.DURATION]=a.l.getDuration();a.f.setContentInfo(c)}},LI=function(a){return null!==a.f&&a.C},OI=function(a){a.a.debug("terminateSession()");
13
- 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)},PI=function(a,b){var c=b.getConfiguration();a.a=!_.z(c.conviva)&&typeof c.conviva===_.xd;a.a?"undefined"===typeof window.Conviva?(a.h.warn("Conviva SDK is not loaded. Will do nothing."),a.a=!1,c=new _.G(1,9,9E3),a.U(b,c)):b.namespace()===_.tc&&(a.a=!1,
14
- a.h.debug("Conviva does not report when casting.")):a.h.warn("Conviva plugin is loaded but not configured. Will do nothing.")},QI=function(a){const b=[];typeof a===_.xd&&(a.customerKey||b.push("customerKey"),a.viewerId||b.push("viewerId"));if(0<b.length)throw new _.G(1,9,9001,{missingKeys:b});};var SI=class{constructor(a,b){this.l=a;this.S=b;this.B="";this.A=_.na;this.f=new _.N("clpp.conviva.ad");this.g=new _.Nn;this.a=null;this.h=this.o=this.w=this.j=!1}initialize(a){this.f.debug("Initialize Ad Insights");this.h=this.w=!1;this.B=a.viewerId;this.A=a.playerName||_.na;HI(this)}release(){this.f.debug("Release Ad Insights");this.w?this.f.debug(_.ha):(_.Kf(this.g),this.a&&FI(this,RI),this.g.release(),this.w=!0,this.j=this.h=!1)}destroy(){this.f.debug(_.Hc);this.o?this.f.debug(_.fa):this.o=!0}C(){this.f.debug(xI)}D(){this.f.debug(yI)}M(a){this.f.debug("onAdStarted()");
15
- a=a.ad;this.j||(this.f.warn("Ad load event was not triggered. This will have incidence on VSF"),EI(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.pb(),a.ob());this.a.reportAdMetric(Conviva.Constants.Playback.BITRATE,a.cb())}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 _.Ab:case _.Bb:b(Conviva.Constants.PlayerState.PLAYING);
16
- break;case _.zb:b(Conviva.Constants.PlayerState.PAUSED);break;case _.sb:b(Conviva.Constants.PlayerState.BUFFERING)}}}N(){this.f.debug("onAdStopped()");this.a&&!this.h&&FI(this,RI)}K(){this.f.debug("onAdSkipped()");this.a&&FI(this,II)}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()");
17
- const b=a.ad,c=()=>{this.j=!0;EI(this,b)};if(-1!==b.getPodIndex()||this.l.getPosition()>=this.l.getDuration()-5)c();else this.g.on(this.l,_.re,()=>{this.l.getPosition()>=this.l.getDuration()-5&&(this.g.off(this.l,_.re),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&&
18
- this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_THIRD_QUARTILE)}},II=0,RI=1,GI=2;var TI=class{constructor(a,b){this.l=a;this.g=new _.Nn;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}initialize(a,b,c){this.m||(this.a.debug("Initialize conviva"),this.F=!1,this.D=_.ff(b),this.K=c,this.l=a,JI(this,this.D),this.g.on(this.l,_.Nd,this.sa.bind(this)),this.g.on(this.l,_.ge,this.$.bind(this)),this.g.on(this.l,_.bc,this.M.bind(this)),this.g.on(this.l,_.ze,this.W.bind(this)),this.g.on(this.l,
19
- _.ye,this.V.bind(this)),this.g.on(this.l,_.qb,this.S.bind(this)),this.g.on(this.l,_.rb,this.T.bind(this)),this.g.on(this.l,_.Hb,this.aa.bind(this)),this.g.on(this.l,_.ac,this.ha.bind(this)),this.g.on(this.l,_.Tc,this.N.bind(this)),KI(this)&&(this.a.debug("Start a new session: A new video starts in autoplay."),MI(this)))}release(){this.a.debug("Release conviva");this.F?this.a.debug(_.ha):(_.Kf(this.g),LI(this)||this.o||!KI(this)||this.f&&this.f.reportPlaybackFailed("Exit Before Video Start"),LI(this)&&
20
- OI(this),this.f=null,this.F=!0)}destroy(){this.a.debug(_.Hc);this.m?this.a.debug(_.fa):this.m=!0}reportAppEvent(a,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}sa(){this.a.debug("onPlayRequest()");LI(this)||KI(this)?LI(this)&&this.A&&!this.h&&(this.a.debug("Resuming VST monitoring ..."),LI(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"),
21
- MI(this))}$(a){this.a.debug(_.Cd);const b=c=>{if(this.o&&(this.a.debug("Creating conviva session (On Seek / Replay)"),JI(this,this.D),MI(this),NI(this),LI(this))){var d=this.l.getTrackManager();d=d.ea()||d.Na();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)}LI(this)&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,c)};switch(a.detail.currentState){case _.ll:b(Conviva.Constants.PlayerState.PLAYING);
22
- break;case _.kl:b(Conviva.Constants.PlayerState.PAUSED);break;case _.dl:b(Conviva.Constants.PlayerState.BUFFERING);break;case _.$k:this.a.debug("onVideoEnded()"),LI(this)&&(this.w&&this.w.eb()?(this.a.debug("Waiting for postroll Ad before terminating session"),this.J=!0):OI(this))}}M(a){this.a.debug(_.yd);if(LI(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,
23
- a.bandwidth/1E3),(a=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({me:this.M.bind(this),ae:a})}W(){this.a.debug("onSeeking()");LI(this)&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)}V(){this.a.debug("onSeeked()");LI(this)&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_ENDED)}aa(a){this.a.debug("onAdsTimelineChanged()");if(a=a.adsTimeline)this.w=a}S(a){this.a.debug(xI);
24
- var b=a.ad;a=0===b.Oa();const c=BI(b.getPodIndex());LI(this)||KI(this)||!a||MI(this);if(LI(this)){a=0===b.sb()?Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE;let d=0;const e={};1===b.rb()&&(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||_.Qh()?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(yI);
25
- LI(this)&&this.B&&(this.f.reportAdBreakEnded(),this.B=!1,this.J&&OI(this))}N(a){this.a.debug(_.zd);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===_.F&&(d=Conviva.Constants.ErrorSeverity.FATAL,LI(this)||MI(this));LI(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,OI(this))):this.j.push({me:this.N.bind(this),ae:a})}}ha(){this.a.debug("onAutoPlayBlocked()");LI(this)&&(this.a.debug("Auto-play blocked. Pausing VST monitoring."),this.A=!0,LI(this)&&this.h&&(this.f.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_STARTED),this.h=!1))}};var UI=class{constructor(){this.g=this.f=null;this.a=!1;this.h=new _.N("clpp.conviva")}onPlayerCreated(a){this.f=new TI(a,this.h)}onContentWillLoad(a,b){PI(this,a);if(this.a){var c=a.getConfiguration();c=_.ff(c.conviva||{});try{QI(c);const d=c.enableAdInsights||!1;this.f.initialize(a,c,b);d&&(this.g=new SI(a,()=>this.f.f),this.g.initialize(c))}catch(d){d instanceof _.G?this.U(a,d):this.U(a,new _.G(1,9,9002,d,d))}}}onContentLoaded(){this.a&&NI(this.f)}onPlayerWillDestroy(){this.a&&(this.a=!1,this.f.destroy(),
27
- this.f=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 _.C(_.Tc,{detail:b}))}reportAppEvent(a,b){return this.f?this.f.reportAppEvent(a,b):!1}};_.y("clpp.conviva.ConvivaPlugin",UI);UI.prototype.reportAppEvent=UI.prototype.reportAppEvent;UI.Id="conviva";_.km(new class{create(){return new UI}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var MI="Ad Error",NI="onAdBreakStarted()",OI="onAdBreakStopped()",PI=function(a){var b=_.ri();let c=Conviva.Constants.DeviceType.DESKTOP,d=Conviva.Constants.DeviceCategory.WEB;const e=b.os;b=b.osVersion.name;let f="";_.bi()&&(f="Apple");_.ai()?(f="Google",c=Conviva.Constants.DeviceType.SETTOP,d=Conviva.Constants.DeviceCategory.CHROMECAST):_.ci()?(c=Conviva.Constants.DeviceType.MOBILE,/(android)/i.test(navigator.userAgent)?d=Conviva.Constants.DeviceCategory.ANDROID_DEVICE:_.bi()&&(d=Conviva.Constants.DeviceCategory.APPLE_DEVICE)):
2
+ _.Vh()||_.Sh()||_.Rh("Hisense")?(c=Conviva.Constants.DeviceType.SMARTTV,d=Conviva.Constants.DeviceCategory.SMART_TV,_.Vh()?(b="",f="LG",d=Conviva.Constants.DeviceCategory.LG_TV):_.Sh()?(f="Samsung",d=Conviva.Constants.DeviceCategory.SAMSUNG_TV):_.Rh("Hisense")&&(b="",f="Hisense")):_.Rh("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},QI=function(a){return a?Conviva.Constants.StreamType.LIVE:Conviva.Constants.StreamType.VOD},RI=function(a){return 0===a?"Pre-roll":-1===a?"Post-roll":"Mid-roll"},TI=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
+ QI(!!d);e[Conviva.Constants.ASSET_NAME]=MI;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"]=SI(a.getId()),e["c3.ad.creativeId"]=SI(a.getCreativeId()),e["c3.ad.system"]=SI(a.getAdSystem()),e["c3.ad.mediaFileApiFramework"]=SI(a.getApiFramework()),e["c3.ad.advertiser"]=SI(a.getAdvertiserName()),e["c3.ad.position"]=RI(a.getPodIndex()),e["c3.ad.technology"]=0===a.sb()?Conviva.Constants.AdType.CLIENT_SIDE:
5
+ Conviva.Constants.AdType.SERVER_SIDE,e["c3.ad.adManagerName"]=SI(a.mb()),e["c3.ad.adManagerVersion"]=SI(a.nb()),e["c3.ad.advertiserCategory"]=SI(null),e["c3.ad.advertiserId"]=SI(null),e["c3.ad.breakId"]=SI(null),e["c3.ad.campaignName"]=SI(null),e["c3.ad.category"]=SI(null),e["c3.ad.classification"]=SI(null),e["c3.ad.creativeName"]=SI(null),e["c3.ad.sequence"]=SI(a.Db()),e["c3.ad.sessionStartEvent"]=SI(null),e["c3.ad.unitName"]=SI(null),e["c3.ad.dayPart"]=SI(null),b=a.getWrapperAdIds().slice(-1)[0]||
6
+ a.getId(),c=a.getWrapperAdSystems().slice(-1)[0]||a.getAdSystem(),a=a.getWrapperCreativeIds().slice(-1)[0]||a.getCreativeId(),e["c3.ad.firstAdId"]=SI(b),e["c3.ad.firstAdSystem"]=SI(c),e["c3.ad.firstCreativeId"]=SI(a));return e},SI=function(a){return a?""+a:"NA"},XI=function(a){a.g.on(a.l,_.ub,a.C.bind(a));a.g.on(a.l,_.vb,a.D.bind(a));a.g.on(a.l,_.Hb,a.M.bind(a));a.g.on(a.l,_.Eb,a.m.bind(a));a.g.on(a.l,_.Db,a.m.bind(a));a.g.on(a.l,_.Fb,a.m.bind(a));a.g.on(a.l,_.wb,a.m.bind(a));a.g.on(a.l,_.Ib,a.N.bind(a));
7
+ a.g.on(a.l,_.Gb,a.K.bind(a));a.g.on(a.l,_.xb,a.F.bind(a));a.g.on(a.l,_.Ab,a.I.bind(a));a.g.on(a.l,_.Bb,a.J.bind(a));a.g.on(a.l,_.zb,a.H.bind(a));a.g.on(a.l,_.Cb,a.U.bind(a));a.g.on(a.l,_.Jb,a.R.bind(a));a.g.on(a.l,_.Wc,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=MI}null===a.a&&UI(a,null);a.a.reportAdError(c,b.FATAL);a.h=!0;a.f.debug("Ad Playback Failure");
8
+ VI(a,WI,c)}})},VI=function(a,b,c=MI){if(a.a){a.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED);switch(b){case WI:a.a.reportAdFailed(c,TI(null,a.B,a.A));break;case YI:a.a.reportAdSkipped();break;default:a.a.reportAdEnded()}a.a.release();a.a=null;a.j=!1}},UI=function(a,b){if(!a.o){a.h=!1;try{if(a.a=Conviva.Analytics.buildAdAnalytics(a.S()),b){const c=TI(b,a.B,a.A,a.l.isLive()),d=String(b.nb()),e={};e[Conviva.Constants.FRAMEWORK_NAME]=b.mb();e[Conviva.Constants.FRAMEWORK_VERSION]=
9
+ d;a.a.setAdPlayerInfo(e);a.a.reportAdStarted(c)}}catch(c){a.f.error("Could not create ad analytics session",c)}}},ZI=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,null,c);Conviva.Analytics.setDeviceMetadata(PI(b));b.connectionType&&Conviva.Analytics.reportDeviceMetric(Conviva.Constants.Network.CONNECTION_TYPE,
10
+ b.connectionType);a.f=Conviva.Analytics.buildVideoAnalytics();a.o=!1;b={};b[Conviva.Constants.FRAMEWORK_NAME]=_.pa;b[Conviva.Constants.FRAMEWORK_VERSION]=_.da;a.f.setPlayerInfo(b)},$I=function(a){return a.l.getConfiguration().autoplay||!1},bJ=function(a){if(!a.m)if(a.C)a.a.warn("Current session still active. No-op.");else{var b=a.l.getLoadedSource()||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=
11
+ new _.Dj(b.url);b&&(f[Conviva.Constants.ASSET_NAME]=b.name||"N/A",f[Conviva.Constants.STREAM_URL]=_.nh(g));f[Conviva.Constants.PLAYER_NAME]=c.playerName||_.pa;f[Conviva.Constants.VIEWER_ID]=d;f[Conviva.Constants.DEFAULT_RESOURCE]=e;if(c&&!_.z(c.customTags))for(const h in c.customTags)f[h]=c.customTags[h];a.f.reportPlaybackRequested(f);a.f.setCallback(()=>{a.a.debug("reportMiscellaneousMetrics()");if(aJ(a)){var h=1E3*a.l.getPosition();a.f.reportPlaybackMetric(Conviva.Constants.Playback.PLAY_HEAD_TIME,
12
+ 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.oe(h.ce)}));a.j=[]}},cJ=function(a){if(!a.m&&a.f){const b=QI(a.l.isLive()),c={};c[Conviva.Constants.IS_LIVE]=b;c[Conviva.Constants.DURATION]=a.l.getDuration();a.f.setContentInfo(c)}},aJ=function(a){return null!==a.f&&a.C},dJ=function(a){a.a.debug("terminateSession()");
13
+ 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)},eJ=function(a,b){var c=b.getConfiguration();a.a=!_.z(c.conviva)&&typeof c.conviva===_.Ad;a.a?"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()===_.wc&&(a.a=!1,
14
+ a.h.debug("Conviva does not report when casting.")):a.h.warn("Conviva plugin is loaded but not configured. Will do nothing.")},fJ=function(a){const b=[];typeof a===_.Ad&&(a.customerKey||b.push("customerKey"),a.viewerId||b.push("viewerId"));if(0<b.length)throw new _.H(1,9,9001,{missingKeys:b});};var hJ=class{constructor(a,b){this.l=a;this.S=b;this.B="";this.A=_.pa;this.f=new _.O("clpp.conviva.ad");this.g=new _.mo;this.a=null;this.h=this.o=this.w=this.j=!1}initialize(a){this.f.debug("Initialize Ad Insights");this.h=this.w=!1;this.B=a.viewerId;this.A=a.playerName||_.pa;XI(this)}release(){this.f.debug("Release Ad Insights");this.w?this.f.debug(_.ha):(_.Mf(this.g),this.a&&VI(this,gJ),this.g.release(),this.w=!0,this.j=this.h=!1)}destroy(){this.f.debug(_.Kc);this.o?this.f.debug(_.fa):this.o=!0}C(){this.f.debug(NI)}D(){this.f.debug(OI)}M(a){this.f.debug("onAdStarted()");
15
+ a=a.ad;this.j||(this.f.warn("Ad load event was not triggered. This will have incidence on VSF"),UI(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.pb(),a.ob());this.a.reportAdMetric(Conviva.Constants.Playback.BITRATE,a.cb())}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 _.Eb:case _.Fb:b(Conviva.Constants.PlayerState.PLAYING);
16
+ break;case _.Db:b(Conviva.Constants.PlayerState.PAUSED);break;case _.wb:b(Conviva.Constants.PlayerState.BUFFERING)}}}N(){this.f.debug("onAdStopped()");this.a&&!this.h&&VI(this,gJ)}K(){this.f.debug("onAdSkipped()");this.a&&VI(this,YI)}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()");
17
+ const b=a.ad,c=()=>{this.j=!0;UI(this,b)};if(-1!==b.getPodIndex()||this.l.getPosition()>=this.l.getDuration()-5)c();else this.g.on(this.l,_.te,()=>{this.l.getPosition()>=this.l.getDuration()-5&&(this.g.off(this.l,_.te),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&&
18
+ this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_THIRD_QUARTILE)}},YI=0,gJ=1,WI=2;var iJ=class{constructor(a,b){this.l=a;this.g=new _.mo;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}initialize(a,b,c){this.m||(this.a.debug("Initialize conviva"),this.F=!1,this.D=_.hf(b),this.K=c,this.l=a,ZI(this,this.D),this.g.on(this.l,_.Qd,this.sa.bind(this)),this.g.on(this.l,_.ie,this.Z.bind(this)),this.g.on(this.l,_.ec,this.M.bind(this)),this.g.on(this.l,_.Be,this.W.bind(this)),this.g.on(this.l,
19
+ _.Ae,this.V.bind(this)),this.g.on(this.l,_.ub,this.S.bind(this)),this.g.on(this.l,_.vb,this.U.bind(this)),this.g.on(this.l,_.Lb,this.$.bind(this)),this.g.on(this.l,_.dc,this.ha.bind(this)),this.g.on(this.l,_.Wc,this.N.bind(this)),$I(this)&&(this.a.debug("Start a new session: A new video starts in autoplay."),bJ(this)))}release(){this.a.debug("Release conviva");this.F?this.a.debug(_.ha):(_.Mf(this.g),aJ(this)||this.o||!$I(this)||this.f&&this.f.reportPlaybackFailed("Exit Before Video Start"),aJ(this)&&
20
+ dJ(this),this.f=null,this.F=!0)}destroy(){this.a.debug(_.Kc);this.m?this.a.debug(_.fa):this.m=!0}reportAppEvent(a,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}sa(){this.a.debug("onPlayRequest()");aJ(this)||$I(this)?aJ(this)&&this.A&&!this.h&&(this.a.debug("Resuming VST monitoring ..."),aJ(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"),
21
+ bJ(this))}Z(a){this.a.debug(_.Fd);const b=c=>{if(this.o&&(this.a.debug("Creating conviva session (On Seek / Replay)"),ZI(this,this.D),bJ(this),cJ(this),aJ(this))){var d=this.l.getTrackManager();d=d.da()||d.Na();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)}aJ(this)&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,c)};switch(a.detail.currentState){case _.Ll:b(Conviva.Constants.PlayerState.PLAYING);
22
+ break;case _.Kl:b(Conviva.Constants.PlayerState.PAUSED);break;case _.Dl:b(Conviva.Constants.PlayerState.BUFFERING);break;case _.Al:this.a.debug("onVideoEnded()"),aJ(this)&&(this.w&&this.w.eb()?(this.a.debug("Waiting for postroll Ad before terminating session"),this.J=!0):dJ(this))}}M(a){this.a.debug(_.Bd);if(aJ(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,
23
+ a.bandwidth/1E3),(a=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({oe:this.M.bind(this),ce:a})}W(){this.a.debug("onSeeking()");aJ(this)&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)}V(){this.a.debug("onSeeked()");aJ(this)&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_ENDED)}$(a){this.a.debug("onAdsTimelineChanged()");if(a=a.adsTimeline)this.w=a}S(a){this.a.debug(NI);
24
+ var b=a.ad;a=0===b.Oa();const c=RI(b.getPodIndex());aJ(this)||$I(this)||!a||bJ(this);if(aJ(this)){a=0===b.sb()?Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE;let d=0;const e={};1===b.rb()&&(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||_.ai()?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(OI);
25
+ aJ(this)&&this.B&&(this.f.reportAdBreakEnded(),this.B=!1,this.J&&dJ(this))}N(a){this.a.debug(_.Cd);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===_.F&&(d=Conviva.Constants.ErrorSeverity.FATAL,aJ(this)||bJ(this));aJ(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,dJ(this))):this.j.push({oe:this.N.bind(this),ce:a})}}ha(){this.a.debug("onAutoPlayBlocked()");aJ(this)&&(this.a.debug("Auto-play blocked. Pausing VST monitoring."),this.A=!0,aJ(this)&&this.h&&(this.f.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_STARTED),this.h=!1))}};var jJ=class{constructor(){this.g=this.f=null;this.a=!1;this.h=new _.O("clpp.conviva")}onPlayerCreated(a){this.f=new iJ(a,this.h)}onContentWillLoad(a,b){eJ(this,a);if(this.a){var c=a.getConfiguration();c=_.hf(c.conviva||{});try{fJ(c);const d=c.enableAdInsights||!1;this.f.initialize(a,c,b);d&&(this.g=new hJ(a,()=>this.f.f),this.g.initialize(c))}catch(d){d instanceof _.H?this.T(a,d):this.T(a,new _.H(1,9,9002,d,d))}}}onContentLoaded(){this.a&&cJ(this.f)}onPlayerWillDestroy(){this.a&&(this.a=!1,this.f.destroy(),
27
+ this.f=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 _.C(_.Wc,{detail:b}))}reportAppEvent(a,b){return this.f?this.f.reportAppEvent(a,b):!1}};_.x("clpp.conviva.ConvivaPlugin",jJ);jJ.prototype.reportAppEvent=jJ.prototype.reportAppEvent;jJ.Id="conviva";_.Km(new class{create(){return new jJ}});};f.call(g, window);