@castlabs/prestoplay 6.22.0 → 6.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +7 -7
  5. package/cjs/cl.cast.js +112 -112
  6. package/cjs/cl.conviva.js +32 -33
  7. package/cjs/cl.core.js +591 -586
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +81 -80
  10. package/cjs/cl.externs.js +43 -36
  11. package/cjs/cl.freewheel.js +24 -24
  12. package/cjs/cl.hls.js +69 -69
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +30 -29
  15. package/cjs/cl.ima.js +23 -23
  16. package/cjs/cl.mse.js +330 -325
  17. package/cjs/cl.muxdata.js +15 -15
  18. package/cjs/cl.onboard.js +3 -3
  19. package/cjs/cl.persistent.js +13 -13
  20. package/cjs/cl.playlist.js +6 -6
  21. package/cjs/cl.sessions.js +16 -16
  22. package/cjs/cl.simid.js +15 -15
  23. package/cjs/cl.smooth.js +72 -72
  24. package/cjs/cl.thumbnails.js +26 -26
  25. package/cjs/cl.tizen.js +72 -72
  26. package/cjs/cl.ttml.js +29 -29
  27. package/cjs/cl.verimatrix.js +5 -5
  28. package/cjs/cl.vimond.js +12 -13
  29. package/cjs/cl.vr.js +19 -19
  30. package/cjs/cl.vtt.js +14 -14
  31. package/cjs/cl.yospace.js +4 -4
  32. package/cjs/cl.youbora.js +37 -37
  33. package/cl.adobe.js +3 -3
  34. package/cl.airplay.js +3 -3
  35. package/cl.broadpeak.js +5 -5
  36. package/cl.cast.js +88 -88
  37. package/cl.conviva.js +27 -27
  38. package/cl.core.js +477 -474
  39. package/cl.crypto.js +9 -9
  40. package/cl.dash.js +76 -75
  41. package/cl.externs.js +43 -36
  42. package/cl.freewheel.js +19 -19
  43. package/cl.hls.js +74 -74
  44. package/cl.hlssmpte.js +5 -5
  45. package/cl.htmlcue.js +26 -26
  46. package/cl.ima.js +17 -17
  47. package/cl.mse.js +295 -291
  48. package/cl.muxdata.js +13 -13
  49. package/cl.onboard.js +4 -4
  50. package/cl.persistent.js +10 -10
  51. package/cl.playlist.js +5 -5
  52. package/cl.sessions.js +10 -10
  53. package/cl.simid.js +13 -13
  54. package/cl.smooth.js +59 -59
  55. package/cl.thumbnails.js +19 -19
  56. package/cl.tizen.js +57 -57
  57. package/cl.ttml.js +22 -22
  58. package/cl.verimatrix.js +4 -4
  59. package/cl.vimond.js +8 -8
  60. package/cl.vr.js +15 -15
  61. package/cl.vtt.js +12 -12
  62. package/cl.yospace.js +3 -3
  63. package/cl.youbora.js +28 -27
  64. package/package.json +1 -1
  65. package/typings.d.ts +53 -6
package/cl.cast.js CHANGED
@@ -1,90 +1,90 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var QU="Cannot seek during ads playout.",RU="Cannot switch track",SU="Media session does not exist.",TU="No receivers available",UU="Reset ABR functionality not available on cast.",VU="SDK not yet ready",WU="Sender is destroyed.",XU="clpp.cast.CastProxy",YU="clpp.cast.Player",ZU="clpp.cast.Receiver",$U="urn:x-cast:castlabs",aV="urn:x-cast:com.google.cast.media",bV=function(a){return _.x(function*(){yield _.cr(a,_.Ke);yield _.cr(a,_.Je)})},cV=function(a){return JSON.stringify(a,(b,c)=>
2
- {if("license"!==b&&typeof c!==_.ae){if(c instanceof Event){b={};for(const d in c){const e=c[d];typeof e===_.Ge?"detail"===d&&(b[d]=e):d in Event||(b[d]=e)}return b}return typeof c===_.t?isNaN(c)?"NaN":isFinite(c)?c:0>c?"-Infinity":"Infinity":c}})},dV=function(a){if(typeof a!==_.Sf)return a;try{return JSON.parse(a,(b,c)=>"NaN"===c?NaN:"-Infinity"===c?-Infinity:"Infinity"===c?Infinity:c)}catch(b){return a}},eV=function(a,b,c,d){return _.x(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=_.gk(d,a.mimeType,g);f&&g&&(h=_.pj(a.url),(h=yield c.fetch(h).W)&&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})},fV=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 _.rg:return d.FMP4;case _.ng:return b===_.N?d.MPEG2_TS:c.TS;case _.Jc:return c.AAC;case _.Kc:return c.AC3;case _.Lc:return c.E_AC3;case "audio/mpeg":return c.MP3;case _.Mc:return c.FMP4}},hV=function(a){a=void 0===a?gV:a;var b=cast.framework.messages||chrome.cast.media;if(!b)throw new _.I(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}},iV=function(a,b){return a.h.filter(c=>c.type===b)},kV=function(a,b){const c=jV(a);return iV(a,b).find(d=>c.includes(d.id))||null},mV=function(a,b,c){const d=a.a.a;if(d)if(c){a.f[b]=c.renditions[0];c=[+c.id];if(b!==_.L){const e=a.wa();e&&c.push(+e.id)}c=new chrome.cast.media.EditTracksInfoRequest(c);
6
- d.editTracksInfo(c,()=>{a.f[b]=null;lV(a,b)},e=>{a.f[b]=null;a.g.debug(RU,e)})}else b===_.L&&(c=new chrome.cast.media.EditTracksInfoRequest([]),d.editTracksInfo(c,()=>{lV(a,b)},e=>{a.g.debug(RU,e)}))},jV=function(a){a=a.a?a.a.a:null;return(a?a.activeTrackIds||[]:[]).map(b=>b.toString())},lV=function(a,b){b===_.M?a.a.trigger(new _.E(_.ll)):b===_.L&&a.a.trigger(new _.E(_.ml))},pV=function(a){if(a)for(const b of nV)oV(b)},oV=function(a){if(!a.w&&window.chrome&&chrome.cast&&chrome.cast.isAvailable&&window.cast&&
7
- cast.framework&&cast.framework.CastContext&&a.S.length){a.w=!0;a.o.Se();var b=cast.framework.CastContext.getInstance(),c=new cast.framework.CastOptions;c.receiverApplicationId=a.S;c.autoJoinPolicy=chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED;b.setOptions(c);b.addEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.M);b.addEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.Z);qV&&a.o.fa(.02)}},rV=function(a){return _.x(function*(){nV.delete(a);if(a.w){a.w=!1;var b=
8
- cast.framework.CastContext.getInstance();b.removeEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.M);b.removeEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.Z)}b=[];a.f&&(b.push(a.f.destroy()),a.f=null);a.j&&(b.push(a.j.destroy()),a.j=null);yield Promise.all(b);a.A=!1;a.o&&(a.o.stop(),a.o=null);a.R=null;a.X=null})},sV=function(a){return _.x(function*(){a.Ib()||(yield cast.framework.CastContext.getInstance().requestSession())})},uV=function(a,b,c){c=
9
- void 0===c?0:c;return _.x(function*(){var d=a.f.wa();d&&d.language&&(a.h.preferredTextLanguage=d.language);(d=a.f.oa())&&d.language&&(a.h.preferredAudioLanguage=d.language);yield tV(a,{source:a.getLoadedSource(),currentTime:c,isLive:a.isLive(),Ce:a.getPresentationStartTime(),autoplay:b,gb:a.h})})},tV=function(a,b){return _.x(function*(){var c=chrome.cast.media.StreamType;yield sV(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=fV(b.Wb,_.N);e.hlsSegmentFormat=fV(c,_.M);b.gb&&(a.L&&(c=yield Promise.resolve(a.L(b.gb)))&&(b.gb=c),a.h=b.gb,a.C=_.Io(a.h),a.B=a.C.findIndex(k=>k.url===b.source.url),b.gb.remoteTextTracks&&(c=yield Promise.all(b.gb.remoteTextTracks.map(a.ha.bind(a))),e.tracks=c.filter(k=>k),b.gb.remoteTextTracks=void 0),delete b.gb.autoplay,b.gb.startTime=null,e.customData={playerConfiguration:cV(b.gb)});c=a.Ab()||{};
11
- var f=vV(c.metadataType),g;typeof b.Ce===_.t&&(g={metadataType:f,sectionStartAbsoluteTime:b.Ce});var h;b.source.name&&(h={metadataType:f,title:b.source.name});c=wV(c);if(g=xV(Object.assign({},g,h,c)))e.metadata=g;e=new chrome.cast.media.LoadRequest(e);typeof b.autoplay===_.Rc&&(e.autoplay=b.autoplay);typeof b.currentTime===_.t&&(e.currentTime=b.currentTime);yield d.loadMedia(e)}})},xV=function(a){if(!a)return null;a:{var b=a.metadataType;const c=Object.entries(yV);for(const d of c){const [e,f]=d;
12
- if(f===b){b=e;break a}}b=null}if(!b)return null;b=hV(yV[b]);return Object.assign(b,a)},vV=function(a){var b=void 0===b?gV:b;return Object.values(yV).includes(a)?a:b},wV=function(a){const b={};for(const c in a)void 0!==a[c]&&(b[c]=a[c]);return b},AV=function(a,b){zV(a,b.getMediaSession());b.addEventListener(cast.framework.SessionEventType.MEDIA_SESSION,a.V);b.addMessageListener($U,a.P)},BV=function(a){const b=a.getPosition();a.a&&a.a.media?(a=a.a.media.startAbsoluteTime,a=typeof a!==_.t?null:a):a=
13
- null;a=null===a?null:a+b;return null===a?b:a},zV=function(a,b){a.a=b;a.a&&(a.G.release(),a.F=null,a.l=null,a.l=new cast.framework.RemotePlayer,a.F=new cast.framework.RemotePlayerController(a.l),a.G.on(a.F,cast.framework.RemotePlayerEventType.CURRENT_TIME_CHANGED,a.ca.bind(a)),a.G.on(a.F,cast.framework.RemotePlayerEventType.MEDIA_INFO_CHANGED,a.Xa.bind(a)),a.j&&a.j.init(),a.trigger(new _.E(_.qe)))},EV=function(a){return new CV(a.h,()=>{a.trigger(new _.E(_.ad))},(b,c)=>{{const d=a.f.getConfiguration();
14
- d.source=c.source;d.autoplay=!1;d.startTime=c.currentTime?Math.max(c.currentTime-1,0):null;d.ima&&d.startTime&&(d.ima.playAdsAfterTime=d.startTime);c.gf&&(d.preferredAudioLanguage=c.gf);c.gg&&(d.preferredTextLanguage=c.gg);_.er(a.f,null);a.trigger(new _.E("castingended"));a.j(b,d)}},()=>DV(a))},DV=function(a){return _.x(function*(){a.trigger(new _.E(_.$c));a.f.a!==a.a&&a.f&&a.a&&(yield a.f.release(),_.er(a.f,a.a))})},HV=function(a,b,c){return _.x(function*(){var d=b.adTagUrl;if(d)try{FV=!1;const e=
15
- _.pj(d),f=yield c.fetch(e).W;if(f&&f.data){const g=_.Li(f.data),h=(new DOMParser).parseFromString(g,_.Yf);if(h.getElementsByTagName("vmap:VMAP").length)_.C("VMAP detected."),a.vmapAdsRequest=GV(g);else if(h.getElementsByTagName("VAST").length){_.C("VAST detected.");{d=g;const k=new cast.framework.messages.BreakClip("bc1");k.vastAdsRequest=GV(d);const l=new cast.framework.messages.Break("b1",[k.id],0);a.breakClips=[k];a.breaks=[l]}}else _.C("Unsupported schema."),FV=!0}}catch(e){_.C("Failed to fetch an ad",
16
- e),FV=!0}})},GV=function(a){const b=new cast.framework.messages.VastAdsRequest;b.adsResponse=a;return b},IV=function(a,b){b=new _.I(1,10,10003,{errorType:b});a.m.onError(b)},JV=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},LV=function(a,b,c){if(c instanceof cast.framework.events.BreaksEvent||-1!==a.getPosition()){var d=null;(c=KV(a,c))&&(d={ad:c});a.m.trigger(new _.E(b,d))}},KV=function(a,b){let c=null;if(a.a&&b instanceof cast.framework.events.BreaksEvent){let d=
17
- null,e=null,f;typeof b.breakClipId===_.Sf&&(d=a.a.getBreakClipById(b.breakClipId));typeof b.breakId===_.Sf&&(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 Z(d,e,b.index,b.total,f)}return c},MV=function(){return[cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,cast.framework.events.EventType.TIMED_METADATA_CHANGED,cast.framework.events.EventType.TIMED_METADATA_ENTER,
18
- cast.framework.events.EventType.TIMED_METADATA_EXIT]},NV=function(a){const b=a.dashTimedMetadata;let c=_.gg;b&&(c=b.schemeIdUri);return{type:c.startsWith(_.fg)?_.Gh:_.dg,schemeIdUri:c,id:a.id||"",startTime:a.startTime,endTime:a.endTime,value:b&&b.value||"",eventElement:b?b.eventElement:null}},OV=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},QV=function(a){a.a=OV().getTextTracksManager();const b=a.a.getTracks();a.j=PV(_.L,b)},PV=function(a,b){const c=[];for(const d of b)b=
19
- new _.Lj(d.trackId.toString(),a),b.roles=d.roles||[],b.kind=d.subtype||null,b.language=d.language||null,b.originalLanguage=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 _.Tj(b.id,b)),c.push(b);return c},RV=function(a,b,c,d){c=_.Vh(c).filter(g=>g);var e=!1;let f=[];b===_.M?f=a.getAudioTracks():b===_.L&&(f=a.ka());if(c=c.find(g=>{const h=
20
- _.xi(g);return f.some(k=>{k=_.xi(k.language||"");return _.yi(h,k)})})){const g=_.xi(c);c=f.filter(h=>{h=_.xi(h.language||"");return _.yi(g,h)});f=c.length?c:f;e=e||!!c.length}_.Ui(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===_.M?a.ya(e):b===_.L&&a.Ua(e))},SV=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},VV=function(a,b){var c=()=>{b.protectionSystem=cast.framework.ContentProtection.NONE;
21
- b.licenseUrl=void 0;b.licenseRequestHandler=void 0;b.licenseHandler=void 0};if(a&&a.drm){var d=a.drm,e=_.Sl(d);if(e){var f=[_.xd];_.Io(a)[0].type!==_.Hc&&f.unshift(_.zd);d.preferredDrmSystem===_.xd&&f.reverse();for(var g,h;f.length&&!h;)g=f.shift(),h=e.Ka[g];h?(c=g===_.zd?cast.framework.ContentProtection.WIDEVINE:g===_.xd?cast.framework.ContentProtection.PLAYREADY:void 0,b.protectionSystem=c,b.licenseUrl=h.licenseUrl,c={ldlDelay:0,customData:{}},TV(b,h,a,c),UV(b,h,a,c)):c()}else c()}else c()},TV=
22
- function(a,b,c,d){b.modifiers.licenseRequest?a.licenseRequestHandler=e=>{const f=_.pj({method:_.tb,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},UV=function(a,b,c,d){b.modifiers.licenseResponse?a.licenseHandler=(e,f)=>_.x(function*(){const g=_.tj(Object.assign({},f.headers),
23
- e.buffer,200,"");yield b.modifiers.licenseResponse(c,g,d);return _.K(g.data)}):a.licenseHandler=void 0},YV=function(){return WV||(WV=new XV)},ZV=function(){return cast.framework.CastReceiverContext.getInstance()},$V=function(){const a=ZV().getPlayerManager().getMediaInformation();return a&&a.metadata?a.metadata:null},aW=function(a,b){const c=ZV().getPlayerManager().getMediaInformation();c?(b?c.metadata=b:delete c.metadata,a=!0,a=void 0===a?!1:a,ZV().getPlayerManager().setMediaInformation(c,a)):a.g.warn("No mediaInformation is present. Skipping metadata update.")},
24
- cW=function(a,b){a.g.debug("Detected HLS, parsing");var c=cast.framework.messages.HlsVideoSegmentFormat;a=ZV();var {hlsVideoSegmentFormat:d}=ZV().getPlayerManager().getMediaInformation()||{};c=d===c.FMP4?_.rg:_.ng;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=bW(f,_.na),h=bW(f,_.Bb);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);
25
- ++e}return d.join("\n")},bW=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},eW=function(a,b){let c=null;const d=dW(a);d&&(c={ad:d});a.f.trigger(new _.E(b,c))},dW=function(a){var b=null;if(a.a&&a.a.mediaInfo){b=a.a.mediaInfo;let c=null,d=null,e,f;const g=a.a.currentBreakClipNumber;b.breaks&&(c=b.breaks.find(h=>h.id===a.a.breakId)||null)&&(e=
26
- 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 Z(d,c,g,e,f)}return b},fW=class{constructor(a,b){this.log=new _.S(b);this.player=a;this.l=null;this.h=_.Co;this.o=_.qu;this.j=2;this.C=Date.now();this.B=-1}release(){this.a(_.Co)}destroy(){this.l=this.player=null;return Promise.resolve()}getState(){return this.h}onError(a){a.severity===
27
- _.F&&this.a(_.Bo)}a(a){if(a!==this.h)if(this.h===_.Bo&&a!==_.Co)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===_.xo?(this.B=b,this.player.trigger(new _.E(_.Uc,{detail:{bufferedTimeMS:-1,reason:this.j}}))):this.o===_.xo&&this.player.trigger(new _.E(_.Sc,{detail:{bufferedTimeMS:b-this.B,reason:this.j}}));a={currentState:this.h,previousState:this.o,timeSinceLastStateChangeMS:b-this.C};this.C=b;this.l&&_.lo(this.l,this.h);this.player.trigger(new _.E(_.Pf,
28
- {detail:a}))}}};_.z("clpp.cast.CastUtils",class{});var gV=0,yV={GENERIC:gV,MOVIE:1,TV_SHOW:2,MUSIC_TRACK:3,PHOTO:4,AUDIOBOOK_CHAPTER:5};var gW=class extends fW{constructor(a){super(a,"clpp.cast.SenderStateManager");this.w=this.f=null;this.A=this.Sb.bind(this)}init(){const a=this.player,b=a.a;b&&(this.f&&this.f.removeUpdateListener(this.A),this.f=b,this.f.addUpdateListener(this.A),this.w=a.l)}destroy(){const a=this,b=()=>Object.getPrototypeOf(Object.getPrototypeOf(this)).destroy;return _.x(function*(){a.f&&(a.f.removeUpdateListener(a.A),a.f=null);yield b().call(a)})}a(a){const b=this.player.l;b&&b.isPlayingBreak||super.a(a)}Sb(){if(this.f&&
29
- this.w&&!this.w.isPlayingBreak)switch(this.f.playerState){case chrome.cast.media.PlayerState.IDLE:switch(this.f.idleReason){case chrome.cast.media.IdleReason.FINISHED:this.a(_.uo);break;case chrome.cast.media.IdleReason.ERROR:this.a(_.Bo);break;default:this.a(_.Co)}break;case chrome.cast.media.PlayerState.PLAYING:this.a(_.Fo);break;case chrome.cast.media.PlayerState.PAUSED:this.a(_.Eo);break;case chrome.cast.media.PlayerState.BUFFERING:this.a(_.xo)}}};var hW=class extends _.T{constructor(){super();this.g=new _.S("clpp.cast.SenderTrackManager");this.a=null;this.h=[];this.f={}}initialize(a){this.a=a}release(){this.h=[];this.f={}}load(){this.release();var a=this.a.a;a&&(a=a.media)&&(this.h=(a=a.tracks)?a.map(b=>{switch(b.type){case chrome.cast.media.TrackType.VIDEO:var c=_.N;break;case chrome.cast.media.TrackType.AUDIO:c=_.M;break;case chrome.cast.media.TrackType.TEXT:c=_.L}c=new _.Lj(b.trackId.toString(),c);c.kind=b.subtype;c.language=b.language;
30
- 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 _.Tj(c.id,c));return c}):[],this.a.trigger(new _.E(_.Ut)))}destroy(){this.a=null}getVideoTracks(){return iV(this,_.N)}getAudioTracks(){return iV(this,_.M)}ka(){return iV(this,_.L)}la(){const a=this.Ga();return a?a.renditions[0]:null}Za(){const a=this.oa();return a?a.renditions[0]:null}Sa(){const a=this.wa();return a?a.renditions[0]:
31
- null}pb(){return this.f[_.N]||null}Bb(){return this.f[_.M]||null}Cb(){return this.f[_.L]||null}Ga(){return kV(this,_.N)}oa(){return kV(this,_.M)}wa(){return kV(this,_.L)}wb(a){mV(this,_.N,a)}ya(a){mV(this,_.M,a)}Ua(a){mV(this,_.L,a)}hb(a){this.wb(a&&a.track)}ub(a){this.ya(a&&a.track)}vb(a){this.Ua(a&&a.track)}addTextTrack(){return _.x(function*(){})}ta(){return!0}};hW.prototype.isAbrEnabled=hW.prototype.ta;hW.prototype.addTextTrack=hW.prototype.addTextTrack;hW.prototype.setTextRendition=hW.prototype.vb;
32
- hW.prototype.setAudioRendition=hW.prototype.ub;hW.prototype.setVideoRendition=hW.prototype.hb;hW.prototype.setTextTrack=hW.prototype.Ua;hW.prototype.setAudioTrack=hW.prototype.ya;hW.prototype.setVideoTrack=hW.prototype.wb;hW.prototype.getTextTrack=hW.prototype.wa;hW.prototype.getAudioTrack=hW.prototype.oa;hW.prototype.getVideoTrack=hW.prototype.Ga;hW.prototype.getLoadingTextRendition=hW.prototype.Cb;hW.prototype.getLoadingAudioRendition=hW.prototype.Bb;hW.prototype.getLoadingVideoRendition=hW.prototype.pb;
33
- hW.prototype.getTextRendition=hW.prototype.Sa;hW.prototype.getAudioRendition=hW.prototype.Za;hW.prototype.getVideoRendition=hW.prototype.la;hW.prototype.getTextTracks=hW.prototype.ka;hW.prototype.getAudioTracks=hW.prototype.getAudioTracks;hW.prototype.getVideoTracks=hW.prototype.getVideoTracks;var CV=class extends _.Wt{constructor(a,b,c,d){super();this.g=new _.S(_.ld);this.S=a;this.o=new _.vk(b);this.R=c;this.X=d;this.h=this.I=_.wl();this.C=[];this.B=0;this.K=new _.Pq;this.F=this.l=this.a=null;this.A=this.w=!1;this.Y="";this.ba=1E6;this.f=new hW;this.f.initialize(this);this.j=new gW(this);this.G=new _.jt;this.J=null;this.H=new Set;this.M=this.La.bind(this);this.Z=this.Ma.bind(this);this.V=this.Ya.bind(this);this.P=this.Wa.bind(this);this.L=null;window.cast||Object.defineProperty(window,
34
- "cast",{get:()=>window.cast_,set:e=>{window.cast_=e;window.setTimeout(()=>{pV(!0)},0)}});oV(this);nV.add(this)}init(a,b){this.h=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.j&&this.j.release()})}getTimeline(){return null}setupPlaylist(){return Promise.reject(_.pb)}appendLoad(){return Promise.reject(_.pb)}seekWith(){return Promise.reject(_.pb)}setSeekInterceptor(){}setPlaybackSessionId(){}destroy(){return _.x(function*(){})}od(a){this.L=
35
- a}pc(){return this.w}Ib(){return this.A}je(){return this.Y}sendMessage(a,b){const c=this;return _.x(function*(){let d;const e=cast.framework.CastContext.getInstance().getCurrentSession();if(e)try{yield e.sendMessage(a,cV(b))}catch(f){d=new _.I(1,8,8E3,{detailedErrorCode:f})}else d=new _.I(1,8,8004,void 0);if(d)c.onError(d)})}cast(){const a=this;return _.x(function*(){if(!a.pc())throw a.g.warn(VU),new _.I(1,8,8001,void 0);if(!qV)throw a.g.warn(TU),new _.I(1,8,8002,void 0);if(a.Ib())throw a.g.warn("Already casting"),
36
- new _.I(1,8,8003,void 0);try{yield sV(a)}catch(b){const c={};b instanceof chrome.cast.Error?(c.detailedErrorCode=b.code,c.details=b.details,c.reason=b.description):c.detailedErrorCode=b;throw new _.I(1,8,8E3,c);}})}he(){this.Ib()&&cast.framework.CastContext.getInstance().endCurrentSession(!0)}addMessageListener(a){typeof a===_.ae&&this.H.add(a)}removeMessageListener(a){typeof a===_.ae&&this.H.delete(a)}play(){return this.isEnded()?uV(this,!0):new Promise((a,b)=>{if(!this.a)return b(SU);this.a.play(null,
37
- a,b)})}pause(){return new Promise((a,b)=>{this.isEnded()&&a();if(!this.a)return b(SU);this.a.pause(null,a,b)})}isPaused(){return!!this.a&&this.a.playerState===chrome.cast.media.PlayerState.PAUSED}isEnded(){return this.getState()===_.uo}seek(a){return this.isEnded()?uV(this,!1,a):new Promise((b,c)=>{this.a||c(SU);this.l.isPlayingBreak&&c(QU);const d=new chrome.cast.media.SeekRequest;d.currentTime=a;this.trigger(new _.E(_.ig));this.a.seek(d,()=>{this.trigger(new _.E(_.hg));b()},c)})}getPosition(){return this.getMediaPosition()}getMediaPosition(){return this.a&&
38
- this.a.getEstimatedTime()||0}getDuration(){return this.getMediaDuration()}getMediaDuration(){if(!this.a||!this.a.media)return-1;const a=this.a.media.duration;return typeof a!==_.t?-1:-1===a?Infinity:a}setDrmCustomDataModifier(){}setCdnErrorCallback(){}detach(){}getPlaybackRate(){return this.a&&this.a.playbackRate||0}setPlaybackRate(a){this.a&&0<a&&this.sendMessage(aV,{type:"SET_PLAYBACK_RATE",requestId:Math.round(1E3*Math.random()),mediaSessionId:this.a.mediaSessionId,playbackRate:a})}getVolume(){return this.a&&
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var iV="Cannot seek during ads playout.",jV="Cannot switch track",kV="Media session does not exist.",lV="No receivers available",mV="Reset ABR functionality not available on cast.",nV="SDK not yet ready",oV="Sender is destroyed.",pV="clpp.cast.CastProxy",qV="clpp.cast.Player",rV="clpp.cast.Receiver",sV="urn:x-cast:castlabs",tV="urn:x-cast:com.google.cast.media",uV=function(a){return _.x(function*(){yield _.lr(a,_.Me);yield _.lr(a,_.Le)})},vV=function(a){return JSON.stringify(a,(b,c)=>
2
+ {if("license"!==b&&typeof c!==_.be){if(c instanceof Event){b={};for(const d in c){const e=c[d];typeof e===_.He?"detail"===d&&(b[d]=e):d in Event||(b[d]=e)}return b}return typeof c===_.t?isNaN(c)?"NaN":isFinite(c)?c:0>c?"-Infinity":"Infinity":c}})},wV=function(a){if(typeof a!==_.Uf)return a;try{return JSON.parse(a,(b,c)=>"NaN"===c?NaN:"-Infinity"===c?-Infinity:"Infinity"===c?Infinity:c)}catch(b){return a}},xV=function(a,b,c,d){return _.x(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=_.ik(d,a.mimeType,g);f&&g&&(h=_.rj(a.url),(h=yield c.fetch(h).U)&&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})},yV=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 _.tg:return d.FMP4;case _.sg:return b===_.N?d.MPEG2_TS:c.TS;case _.Ic:return c.AAC;case _.Jc:return c.AC3;case _.Kc:return c.E_AC3;case "audio/mpeg":return c.MP3;case _.Lc:return c.FMP4}},AV=function(a){a=void 0===a?zV: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}},BV=function(a,b){return a.h.filter(c=>c.type===b)},DV=function(a,b){const c=CV(a);return BV(a,b).find(d=>c.includes(d.id))||null},FV=function(a,b,c){const d=a.a.a;if(d)if(c){a.f[b]=c.renditions[0];c=[+c.id];if(b!==_.L){const e=a.va();e&&c.push(+e.id)}c=new chrome.cast.media.EditTracksInfoRequest(c);
6
+ d.editTracksInfo(c,()=>{a.f[b]=null;EV(a,b)},e=>{a.f[b]=null;a.g.debug(jV,e)})}else b===_.L&&(c=new chrome.cast.media.EditTracksInfoRequest([]),d.editTracksInfo(c,()=>{EV(a,b)},e=>{a.g.debug(jV,e)}))},CV=function(a){a=a.a?a.a.a:null;return(a?a.activeTrackIds||[]:[]).map(b=>b.toString())},EV=function(a,b){b===_.M?a.a.trigger(new _.D(_.ol)):b===_.L&&a.a.trigger(new _.D(_.pl))},IV=function(a){if(a)for(const b of GV)HV(b)},HV=function(a){if(!a.w&&window.chrome&&chrome.cast&&chrome.cast.isAvailable&&window.cast&&
7
+ cast.framework&&cast.framework.CastContext&&a.S.length){a.w=!0;a.o.Qe();var b=cast.framework.CastContext.getInstance(),c=new cast.framework.CastOptions;c.receiverApplicationId=a.S;c.autoJoinPolicy=chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED;b.setOptions(c);b.addEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.M);b.addEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.Y);JV&&a.o.fa(.02)}},KV=function(a){return _.x(function*(){GV.delete(a);if(a.w){a.w=!1;var b=
8
+ cast.framework.CastContext.getInstance();b.removeEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.M);b.removeEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.Y)}b=[];a.f&&(b.push(a.f.destroy()),a.f=null);a.j&&(b.push(a.j.destroy()),a.j=null);yield Promise.all(b);a.A=!1;a.o&&(a.o.stop(),a.o=null);a.R=null;a.W=null})},LV=function(a){return _.x(function*(){a.Gb()||(yield cast.framework.CastContext.getInstance().requestSession())})},NV=function(a,b,c){c=
9
+ void 0===c?0:c;return _.x(function*(){var d=a.f.va();d&&d.language&&(a.h.preferredTextLanguage=d.language);(d=a.f.na())&&d.language&&(a.h.preferredAudioLanguage=d.language);yield MV(a,{source:a.getLoadedSource(),currentTime:c,isLive:a.isLive(),Ae:a.getPresentationStartTime(),autoplay:b,eb:a.h})})},MV=function(a,b){return _.x(function*(){var c=chrome.cast.media.StreamType;yield LV(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=yV(b.Ub,_.N);e.hlsSegmentFormat=yV(c,_.M);b.eb&&(a.L&&(c=yield Promise.resolve(a.L(b.eb)))&&(b.eb=c),a.h=b.eb,a.C=_.Ro(a.h),a.B=a.C.findIndex(k=>k.url===b.source.url),b.eb.remoteTextTracks&&(c=yield Promise.all(b.eb.remoteTextTracks.map(a.ea.bind(a))),e.tracks=c.filter(k=>k),b.eb.remoteTextTracks=void 0),delete b.eb.autoplay,b.eb.startTime=null,e.customData={playerConfiguration:vV(b.eb)});c=a.yb()||{};
11
+ var f=OV(c.metadataType),g;typeof b.Ae===_.t&&(g={metadataType:f,sectionStartAbsoluteTime:b.Ae});var h;b.source.name&&(h={metadataType:f,title:b.source.name});c=PV(c);if(g=QV(Object.assign({},g,h,c)))e.metadata=g;e=new chrome.cast.media.LoadRequest(e);typeof b.autoplay===_.Qc&&(e.autoplay=b.autoplay);typeof b.currentTime===_.t&&(e.currentTime=b.currentTime);yield d.loadMedia(e)}})},QV=function(a){if(!a)return null;a:{var b=a.metadataType;const c=Object.entries(RV);for(const d of c){const [e,f]=d;
12
+ if(f===b){b=e;break a}}b=null}if(!b)return null;b=AV(RV[b]);return Object.assign(b,a)},OV=function(a){var b=void 0===b?zV:b;return Object.values(RV).includes(a)?a:b},PV=function(a){const b={};for(const c in a)void 0!==a[c]&&(b[c]=a[c]);return b},TV=function(a,b){SV(a,b.getMediaSession());b.addEventListener(cast.framework.SessionEventType.MEDIA_SESSION,a.V);b.addMessageListener(sV,a.O)},UV=function(a){const b=a.getPosition();a.a&&a.a.media?(a=a.a.media.startAbsoluteTime,a=typeof a!==_.t?null:a):a=
13
+ null;a=null===a?null:a+b;return null===a?b:a},SV=function(a,b){a.a=b;a.a&&(a.G.release(),a.F=null,a.l=null,a.l=new cast.framework.RemotePlayer,a.F=new cast.framework.RemotePlayerController(a.l),a.G.on(a.F,cast.framework.RemotePlayerEventType.CURRENT_TIME_CHANGED,a.$.bind(a)),a.G.on(a.F,cast.framework.RemotePlayerEventType.MEDIA_INFO_CHANGED,a.Ua.bind(a)),a.j&&a.j.init(),a.trigger(new _.D(_.ue)))},XV=function(a){return new VV(a.h,()=>{a.trigger(new _.D(_.$c))},(b,c)=>{{const d=a.f.getConfiguration();
14
+ d.source=c.source;d.autoplay=!1;d.startTime=c.currentTime?Math.max(c.currentTime-1,0):null;d.ima&&d.startTime&&(d.ima.playAdsAfterTime=d.startTime);c.ef&&(d.preferredAudioLanguage=c.ef);c.eg&&(d.preferredTextLanguage=c.eg);_.nr(a.f,null);a.trigger(new _.D("castingended"));a.j(b,d)}},()=>WV(a))},WV=function(a){return _.x(function*(){a.trigger(new _.D(_.Zc));a.f.a!==a.a&&a.f&&a.a&&(yield a.f.release(),_.nr(a.f,a.a))})},$V=function(a,b,c){return _.x(function*(){var d=b.adTagUrl;if(d)try{YV=!1;const e=
15
+ _.rj(d),f=yield c.fetch(e).U;if(f&&f.data){const g=_.Ni(f.data),h=(new DOMParser).parseFromString(g,_.$f);if(h.getElementsByTagName("vmap:VMAP").length)_.C("VMAP detected."),a.vmapAdsRequest=ZV(g);else if(h.getElementsByTagName("VAST").length){_.C("VAST detected.");{d=g;const k=new cast.framework.messages.BreakClip("bc1");k.vastAdsRequest=ZV(d);const l=new cast.framework.messages.Break("b1",[k.id],0);a.breakClips=[k];a.breaks=[l]}}else _.C("Unsupported schema."),YV=!0}}catch(e){_.C("Failed to fetch an ad",
16
+ e),YV=!0}})},ZV=function(a){const b=new cast.framework.messages.VastAdsRequest;b.adsResponse=a;return b},aW=function(a,b){b=new _.H(1,10,10003,{errorType:b});a.m.onError(b)},bW=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},dW=function(a,b,c){if(c instanceof cast.framework.events.BreaksEvent||-1!==a.getPosition()){var d=null;(c=cW(a,c))&&(d={ad:c});a.m.trigger(new _.D(b,d))}},cW=function(a,b){let c=null;if(a.a&&b instanceof cast.framework.events.BreaksEvent){let d=
17
+ null,e=null,f;typeof b.breakClipId===_.Uf&&(d=a.a.getBreakClipById(b.breakClipId));typeof b.breakId===_.Uf&&(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 Z(d,e,b.index,b.total,f)}return c},eW=function(){return[cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,cast.framework.events.EventType.TIMED_METADATA_CHANGED,cast.framework.events.EventType.TIMED_METADATA_ENTER,
18
+ cast.framework.events.EventType.TIMED_METADATA_EXIT]},fW=function(a){const b=a.dashTimedMetadata;let c=_.ig;b&&(c=b.schemeIdUri);return{type:c.startsWith(_.hg)?_.Ih:_.fg,schemeIdUri:c,id:a.id||"",startTime:a.startTime,endTime:a.endTime,value:b&&b.value||"",eventElement:b?b.eventElement:null}},gW=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},iW=function(a){a.a=gW().getTextTracksManager();const b=a.a.getTracks();a.j=hW(_.L,b)},hW=function(a,b){const c=[];for(const d of b)b=
19
+ new _.Nj(d.trackId.toString(),a),b.roles=d.roles||[],b.kind=d.subtype||null,b.language=d.language||null,b.originalLanguage=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 _.Vj(b.id,b)),c.push(b);return c},jW=function(a,b,c,d){c=_.Xh(c).filter(g=>g);var e=!1;let f=[];b===_.M?f=a.getAudioTracks():b===_.L&&(f=a.ja());if(c=c.find(g=>{const h=
20
+ _.zi(g);return f.some(k=>{k=_.zi(k.language||"");return _.Ai(h,k)})})){const g=_.zi(c);c=f.filter(h=>{h=_.zi(h.language||"");return _.Ai(g,h)});f=c.length?c:f;e=e||!!c.length}_.Wi(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===_.M?a.wa(e):b===_.L&&a.Sa(e))},kW=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},nW=function(a,b){var c=()=>{b.protectionSystem=cast.framework.ContentProtection.NONE;
21
+ b.licenseUrl=void 0;b.licenseRequestHandler=void 0;b.licenseHandler=void 0};if(a&&a.drm){var d=a.drm,e=_.Ul(d);if(e){var f=[_.wd];_.Ro(a)[0].type!==_.Gc&&f.unshift(_.yd);d.preferredDrmSystem===_.wd&&f.reverse();for(var g,h;f.length&&!h;)g=f.shift(),h=e.Ka[g];h?(c=g===_.yd?cast.framework.ContentProtection.WIDEVINE:g===_.wd?cast.framework.ContentProtection.PLAYREADY:void 0,b.protectionSystem=c,b.licenseUrl=h.licenseUrl,c={ldlDelay:0,customData:{}},lW(b,h,a,c),mW(b,h,a,c)):c()}else c()}else c()},lW=
22
+ function(a,b,c,d){b.modifiers.licenseRequest?a.licenseRequestHandler=e=>{const f=_.rj({method:_.qb,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},mW=function(a,b,c,d){b.modifiers.licenseResponse?a.licenseHandler=(e,f)=>_.x(function*(){const g=_.xj(Object.assign({},f.headers),
23
+ e.buffer,200,"");yield b.modifiers.licenseResponse(c,g,d);return _.K(g.data)}):a.licenseHandler=void 0},qW=function(){return oW||(oW=new pW)},rW=function(){return cast.framework.CastReceiverContext.getInstance()},sW=function(){const a=rW().getPlayerManager().getMediaInformation();return a&&a.metadata?a.metadata:null},tW=function(a,b){const c=rW().getPlayerManager().getMediaInformation();c?(b?c.metadata=b:delete c.metadata,a=!0,a=void 0===a?!1:a,rW().getPlayerManager().setMediaInformation(c,a)):a.g.warn("No mediaInformation is present. Skipping metadata update.")},
24
+ vW=function(a,b){a.g.debug("Detected HLS, parsing");var c=cast.framework.messages.HlsVideoSegmentFormat;a=rW();var {hlsVideoSegmentFormat:d}=rW().getPlayerManager().getMediaInformation()||{};c=d===c.FMP4?_.tg:_.sg;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=uW(f,_.na),h=uW(f,_.yb);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);
25
+ ++e}return d.join("\n")},uW=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},xW=function(a,b){let c=null;const d=wW(a);d&&(c={ad:d});a.f.trigger(new _.D(b,c))},wW=function(a){var b=null;if(a.a&&a.a.mediaInfo){b=a.a.mediaInfo;let c=null,d=null,e,f;const g=a.a.currentBreakClipNumber;b.breaks&&(c=b.breaks.find(h=>h.id===a.a.breakId)||null)&&(e=
26
+ 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 Z(d,c,g,e,f)}return b},yW=class{constructor(a,b){this.log=new _.S(b);this.player=a;this.l=null;this.h=_.Lo;this.o=_.zu;this.j=2;this.C=Date.now();this.B=-1}release(){this.a(_.Lo)}destroy(){this.l=this.player=null;return Promise.resolve()}getState(){return this.h}onError(a){a.severity===
27
+ _.F&&this.a(_.Eo)}a(a){if(a!==this.h)if(this.h===_.Eo&&a!==_.Lo)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===_.Ho?(this.B=b,this.player.trigger(new _.D(_.Sc,{detail:{bufferedTimeMS:-1,reason:this.j}}))):this.o===_.Ho&&this.player.trigger(new _.D(_.Rc,{detail:{bufferedTimeMS:b-this.B,reason:this.j}}));a={currentState:this.h,previousState:this.o,timeSinceLastStateChangeMS:b-this.C};this.C=b;this.l&&_.uo(this.l,this.h);this.player.trigger(new _.D(_.Rf,
28
+ {detail:a}))}}};_.y("clpp.cast.CastUtils",class{});var zV=0,RV={GENERIC:zV,MOVIE:1,TV_SHOW:2,MUSIC_TRACK:3,PHOTO:4,AUDIOBOOK_CHAPTER:5};var zW=class extends yW{constructor(a){super(a,"clpp.cast.SenderStateManager");this.w=this.f=null;this.A=this.Qb.bind(this)}init(){const a=this.player,b=a.a;b&&(this.f&&this.f.removeUpdateListener(this.A),this.f=b,this.f.addUpdateListener(this.A),this.w=a.l)}destroy(){const a=this,b=()=>Object.getPrototypeOf(Object.getPrototypeOf(this)).destroy;return _.x(function*(){a.f&&(a.f.removeUpdateListener(a.A),a.f=null);yield b().call(a)})}a(a){const b=this.player.l;b&&b.isPlayingBreak||super.a(a)}Qb(){if(this.f&&
29
+ this.w&&!this.w.isPlayingBreak)switch(this.f.playerState){case chrome.cast.media.PlayerState.IDLE:switch(this.f.idleReason){case chrome.cast.media.IdleReason.FINISHED:this.a(_.Do);break;case chrome.cast.media.IdleReason.ERROR:this.a(_.Eo);break;default:this.a(_.Lo)}break;case chrome.cast.media.PlayerState.PLAYING:this.a(_.Oo);break;case chrome.cast.media.PlayerState.PAUSED:this.a(_.No);break;case chrome.cast.media.PlayerState.BUFFERING:this.a(_.Ho)}}};var AW=class extends _.T{constructor(){super();this.g=new _.S("clpp.cast.SenderTrackManager");this.a=null;this.h=[];this.f={}}initialize(a){this.a=a}release(){this.h=[];this.f={}}load(){this.release();var a=this.a.a;a&&(a=a.media)&&(this.h=(a=a.tracks)?a.map(b=>{switch(b.type){case chrome.cast.media.TrackType.VIDEO:var c=_.N;break;case chrome.cast.media.TrackType.AUDIO:c=_.M;break;case chrome.cast.media.TrackType.TEXT:c=_.L}c=new _.Nj(b.trackId.toString(),c);c.kind=b.subtype;c.language=b.language;
30
+ 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 _.Vj(c.id,c));return c}):[],this.a.trigger(new _.D(_.cu)))}destroy(){this.a=null}getVideoTracks(){return BV(this,_.N)}getAudioTracks(){return BV(this,_.M)}ja(){return BV(this,_.L)}ka(){const a=this.Ga();return a?a.renditions[0]:null}Wa(){const a=this.na();return a?a.renditions[0]:null}Ra(){const a=this.va();return a?a.renditions[0]:
31
+ null}ob(){return this.f[_.N]||null}zb(){return this.f[_.M]||null}Ab(){return this.f[_.L]||null}Ga(){return DV(this,_.N)}na(){return DV(this,_.M)}va(){return DV(this,_.L)}wb(a){FV(this,_.N,a)}wa(a){FV(this,_.M,a)}Sa(a){FV(this,_.L,a)}fb(a){this.wb(a&&a.track)}ub(a){this.wa(a&&a.track)}vb(a){this.Sa(a&&a.track)}addTextTrack(){return _.x(function*(){})}sa(){return!0}};AW.prototype.isAbrEnabled=AW.prototype.sa;AW.prototype.addTextTrack=AW.prototype.addTextTrack;AW.prototype.setTextRendition=AW.prototype.vb;
32
+ AW.prototype.setAudioRendition=AW.prototype.ub;AW.prototype.setVideoRendition=AW.prototype.fb;AW.prototype.setTextTrack=AW.prototype.Sa;AW.prototype.setAudioTrack=AW.prototype.wa;AW.prototype.setVideoTrack=AW.prototype.wb;AW.prototype.getTextTrack=AW.prototype.va;AW.prototype.getAudioTrack=AW.prototype.na;AW.prototype.getVideoTrack=AW.prototype.Ga;AW.prototype.getLoadingTextRendition=AW.prototype.Ab;AW.prototype.getLoadingAudioRendition=AW.prototype.zb;AW.prototype.getLoadingVideoRendition=AW.prototype.ob;
33
+ AW.prototype.getTextRendition=AW.prototype.Ra;AW.prototype.getAudioRendition=AW.prototype.Wa;AW.prototype.getVideoRendition=AW.prototype.ka;AW.prototype.getTextTracks=AW.prototype.ja;AW.prototype.getAudioTracks=AW.prototype.getAudioTracks;AW.prototype.getVideoTracks=AW.prototype.getVideoTracks;var VV=class extends _.eu{constructor(a,b,c,d){super();this.g=new _.S(_.kd);this.S=a;this.o=new _.yk(b);this.R=c;this.W=d;this.h=this.I=_.zl();this.C=[];this.B=0;this.K=new _.Yq;this.F=this.l=this.a=null;this.A=this.w=!1;this.X="";this.ca=1E6;this.f=new AW;this.f.initialize(this);this.j=new zW(this);this.G=new _.st;this.J=null;this.H=new Set;this.M=this.ya.bind(this);this.Y=this.La.bind(this);this.V=this.Va.bind(this);this.O=this.za.bind(this);this.L=null;window.cast||Object.defineProperty(window,
34
+ "cast",{get:()=>window.cast_,set:e=>{window.cast_=e;window.setTimeout(()=>{IV(!0)},0)}});HV(this);GV.add(this)}init(a,b){this.h=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.j&&this.j.release()})}getTimeline(){return null}setupPlaylist(){return Promise.reject(_.mb)}appendLoad(){return Promise.reject(_.mb)}seekWith(){return Promise.reject(_.mb)}setSeekInterceptor(){}setPlaybackSessionId(){}destroy(){return _.x(function*(){})}md(a){this.L=
35
+ a}nc(){return this.w}Gb(){return this.A}ge(){return this.X}sendMessage(a,b){const c=this;return _.x(function*(){let d;const e=cast.framework.CastContext.getInstance().getCurrentSession();if(e)try{yield e.sendMessage(a,vV(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 _.x(function*(){if(!a.nc())throw a.g.warn(nV),new _.H(1,8,8001,void 0);if(!JV)throw a.g.warn(lV),new _.H(1,8,8002,void 0);if(a.Gb())throw a.g.warn("Already casting"),
36
+ new _.H(1,8,8003,void 0);try{yield LV(a)}catch(b){const c={};b instanceof chrome.cast.Error?(c.detailedErrorCode=b.code,c.details=b.details,c.reason=b.description):c.detailedErrorCode=b;throw new _.H(1,8,8E3,c);}})}fe(){this.Gb()&&cast.framework.CastContext.getInstance().endCurrentSession(!0)}addMessageListener(a){typeof a===_.be&&this.H.add(a)}removeMessageListener(a){typeof a===_.be&&this.H.delete(a)}play(){return this.isEnded()?NV(this,!0):new Promise((a,b)=>{if(!this.a)return b(kV);this.a.play(null,
37
+ a,b)})}pause(){return new Promise((a,b)=>{this.isEnded()&&a();if(!this.a)return b(kV);this.a.pause(null,a,b)})}isPaused(){return!!this.a&&this.a.playerState===chrome.cast.media.PlayerState.PAUSED}isEnded(){return this.getState()===_.Do}seek(a){return this.isEnded()?NV(this,!1,a):new Promise((b,c)=>{this.a||c(kV);this.l.isPlayingBreak&&c(iV);const d=new chrome.cast.media.SeekRequest;d.currentTime=a;this.trigger(new _.D(_.kg));this.a.seek(d,()=>{this.trigger(new _.D(_.jg));b()},c)})}getPosition(){return this.getMediaPosition()}getMediaPosition(){return this.a&&
38
+ this.a.getEstimatedTime()||0}getDuration(){return this.getMediaDuration()}getMediaDuration(){if(!this.a||!this.a.media)return-1;const a=this.a.media.duration;return typeof a!==_.t?-1:-1===a?Infinity:a}setDrmCustomDataModifier(){}setCdnErrorCallback(){}detach(){}getPlaybackRate(){return this.a&&this.a.playbackRate||0}setPlaybackRate(a){this.a&&0<a&&this.sendMessage(tV,{type:"SET_PLAYBACK_RATE",requestId:Math.round(1E3*Math.random()),mediaSessionId:this.a.mediaSessionId,playbackRate:a})}getVolume(){return this.a&&
39
39
  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||!this.a.media||!this.a.media.metadata)return null;const a=this.a.media.metadata.sectionStartAbsoluteTime;return typeof a!==_.t?null:1E-8===a?0:a}getSeekRange(){let a=
40
- {start:0,end:this.getDuration()};if(this.isLive()){const b=this.a.getEstimatedLiveSeekableRange();b&&typeof b.start===_.t&&typeof b.end===_.t&&(a={start:b.start,end:b.end})}return a}getState(){return this.j?this.j.getState():_.qu}getStats(){return this.a&&this.a.customData&&this.a.customData.stats?dV(this.a.customData.stats):_.po()}isLive(){return Infinity===this.getDuration()}load(a){const b=this;return _.x(function*(){if(b.pc())if(qV){b.C=_.Io(a);b.h=_.yl(b.I,a);var c=b.C[b.B];yield tV(b,{source:c,
41
- isLive:c.isLive,autoplay:b.h.autoplay,gb:b.h,Wb:c.Wb,audioMimeType:c.audioMimeType})}else b.g.warn(TU);else b.g.warn(VU)})}getBufferInfo(){return new _.Vt}getTrackManager(){return this.f}getConfiguration(){return this.h}getSurface(){return null}setNetworkEngine(a){this.K=a}getNetworkEngine(){return this.K}getSourceIndex(){return this.B}setSourceIndex(a){this.B=a}setCmsdManager(){}getLoadedSource(){return this.C[this.B]}getPeriods(){return[]}getDrmInfo(){return null}getTimelineCues(){return[]}getCueTimeline(){return null}resetAbr(){this.g.warn(UU)}onError(a){if(a&&
42
- (this.trigger(new _.E(_.r,{detail:a})),this.j))this.j.onError(a)}namespace(){return _.ld}canPlay(){return this.pc()?2:0}Ab(){return this.J}Vb(a){this.J=xV(a)}ce(){this.J=null}Me(a){const b=this.Ab()||{};a={metadataType:vV(b.metadataType),title:a};this.Vb(Object.assign({},b,a))}Ke(a){const b=this.Ab()||{},c=vV(b.metadataType);a=new chrome.cast.Image(a);this.Vb(Object.assign({},b,{metadataType:c,images:[a]}))}Je(a){const b=this.Ab()||{};this.Vb(Object.assign({},b,{metadataType:3,artist:a}))}Le(a){const b=
43
- this.Ab()||{};a={metadataType:vV(b.metadataType),releaseDate:a};this.Vb(Object.assign({},b,a))}La(a){const b=cast.framework.CastContext.getInstance(),c=a.castState===cast.framework.CastState.CONNECTED;qV=a.castState!==cast.framework.CastState.NO_DEVICES_AVAILABLE;this.Y=c?b.getCurrentSession().getCastDevice().friendlyName:"";this.o.Se()}Ma(a){this.g.debug(`state: ${a.sessionState}, details:`,a);switch(a.sessionState){case cast.framework.SessionState.SESSION_STARTED:this.A=!0;AV(this,a.session);break;
44
- case cast.framework.SessionState.SESSION_RESUMED:this.Ib()||(this.A=!0,AV(this,a.session),this.X());break;case cast.framework.SessionState.SESSION_ENDED:if(this.Ib()&&this.a){const d=this.a.media;var b=this.f.oa(),c=this.f.wa();b=b&&b.language||void 0;c=c&&c.language||void 0;this.R(this.getState(),{source:{url:d.contentId,type:d.contentType,isLive:this.isLive()},currentTime:BV(this),gg:c,gf:b})}a.session.removeEventListener(cast.framework.SessionEventType.MEDIA_SESSION,this.V);a.session.removeMessageListener($U,
45
- this.P);this.A=!1;this.a=null;this.G.release();this.l=this.F=null}}Ya(a){this.g.debug("New media session",a.mediaSession);zV(this,a.mediaSession)}Xa(a){a.value&&a.value.tracks&&this.f&&this.f.load()}Wa(a,b){if(a===$U&&0<this.H.size){const c=dV(b);this.H.forEach(d=>d(c))}}ca(){this.trigger(new _.E(_.Zf))}ha(a){const b=this;return _.x(function*(){let c=null;const d=yield eV(a,[_.Xf,_.Gc],b.K,b.h);d&&(c=new chrome.cast.media.Track(b.ba++,chrome.cast.media.TrackType.TEXT),c.language=d.language,c.name=
46
- d.label||null,c.trackContentId=d.url,c.trackContentType=d.mimeType,c.customData={mimeType:a.mimeType,url:a.url});return c})}getTextDisplayer(){return null}},qV=!1,nV=new Set;window.__onGCastApiAvailable=pV;var iW=class extends _.Wt{constructor(a,b,c){super();this.f=a;this.h=b;this.j=typeof c===_.ae?c:this.l;this.a=EV(this);this.g=new _.S(XU);this.f&&this.forwardEventsTo(this.f)}destroy(){const a=this;return _.x(function*(){a.a&&(yield rV(a.a),a.a=null);a.f&&a.stopForwardingEventsTo(a.f)})}l(a,b){this.f&&a!==_.uo&&a!==_.Co&&(delete b.license,this.f.load(b))}$d(){return!!this.a&&this.a.pc()&&qV}Ib(){return!!this.a&&this.a.Ib()}je(){return this.a?this.a.je():""}od(a){this.a&&this.a.od(a)}cast(a){const b=
47
- this;return _.x(function*(){if(b.a)try{if(yield b.a.cast(),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.oa();m&&(m.mimeType&&(k=m.mimeType),m.language&&(l.preferredAudioLanguage=m.language),m.roles.length&&(l.preferredAudioRole=m.roles[0]));const n=f.wa();n&&(n.language&&(l.preferredTextLanguage=n.language),n.roles.length&&(l.preferredTextRole=n.roles[0]));const q=
48
- e&&typeof e.isLive===_.Rc?e.isLive:b.f.isLive();d={source:e,isLive:q,autoplay:!b.f.isPaused(),currentTime:Math.max(b.f.getPosition()-1,0),Ce:b.f.getPresentationStartTime(),Wb:h,audioMimeType:k,gb:l}}var c=d}yield DV(b);b.a&&(c&&(c.autoplay=!b.f.isPaused()),a?yield b.f.load(a):b.a.a||(yield tV(b.a,c)))}}catch(d){b.g.error("Error while trying to cast",d),c=new _.E(_.r,{detail:d}),b.trigger(c)}})}he(){this.a&&this.a.he()}Gg(a){const b=this;return _.x(function*(){a!==b.h&&(b.h=a,b.a&&(yield rV(b.a)),
49
- b.a=EV(b))})}sendMessage(a){const b=this;return _.x(function*(){b.a?yield b.a.sendMessage($U,a):b.g.warn(WU)})}addMessageListener(a){this.a?this.a.addMessageListener(a):this.g.warn(WU)}removeMessageListener(a){this.a?this.a.removeMessageListener(a):this.g.warn(WU)}Ab(){return this.a&&this.a.Ab()}Vb(a){this.a&&this.a.Vb(a)}ce(){this.a&&this.a.ce()}Me(a){this.a&&this.a.Me(a)}Ke(a){this.a&&this.a.Ke(a)}Je(a){this.a&&this.a.Je(a)}Le(a){this.a&&this.a.Le(a)}};_.z(XU,iW);
50
- iW.prototype.setContentReleaseDate=iW.prototype.Le;iW.prototype.setContentArtist=iW.prototype.Je;iW.prototype.setContentImage=iW.prototype.Ke;iW.prototype.setContentTitle=iW.prototype.Me;iW.prototype.clearContentMetadata=iW.prototype.ce;iW.prototype.setContentMetadata=iW.prototype.Vb;iW.prototype.getContentMetadata=iW.prototype.Ab;iW.prototype.removeMessageListener=iW.prototype.removeMessageListener;iW.prototype.addMessageListener=iW.prototype.addMessageListener;iW.prototype.sendMessage=iW.prototype.sendMessage;
51
- iW.prototype.changeReceiverId=iW.prototype.Gg;iW.prototype.forceDisconnect=iW.prototype.he;iW.prototype.cast=iW.prototype.cast;iW.prototype.setPlayerConfigInterceptor=iW.prototype.od;iW.prototype.getReceiverName=iW.prototype.je;iW.prototype.isCasting=iW.prototype.Ib;iW.prototype.canCast=iW.prototype.$d;iW.prototype.destroy=iW.prototype.destroy;var jW=class extends fW{constructor(a){super(a,"clpp.cast.StateManager");this.I=this.R.bind(this);this.H=this.P.bind(this);this.A=this.Y.bind(this);this.w=this.X.bind(this);this.K=this.V.bind(this);this.J=this.S.bind(this);this.L=this.ba.bind(this);this.G=this.Z.bind(this);this.F=this.T.bind(this);this.f=this.M.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,
40
+ {start:0,end:this.getDuration()};if(this.isLive()){const b=this.a.getEstimatedLiveSeekableRange();b&&typeof b.start===_.t&&typeof b.end===_.t&&(a={start:b.start,end:b.end})}return a}getState(){return this.j?this.j.getState():_.zu}getStats(){return this.a&&this.a.customData&&this.a.customData.stats?wV(this.a.customData.stats):_.yo()}isLive(){return Infinity===this.getDuration()}load(a){const b=this;return _.x(function*(){if(b.nc())if(JV){b.C=_.Ro(a);b.h=_.Bl(b.I,a);var c=b.C[b.B];yield MV(b,{source:c,
41
+ isLive:c.isLive,autoplay:b.h.autoplay,eb:b.h,Ub:c.Ub,audioMimeType:c.audioMimeType})}else b.g.warn(lV);else b.g.warn(nV)})}getBufferInfo(){return new _.du}getTrackManager(){return this.f}getConfiguration(){return this.h}getSurface(){return null}setNetworkEngine(a){this.K=a}getNetworkEngine(){return this.K}getSourceIndex(){return this.B}setSourceIndex(a){this.B=a}setCmsdManager(){}getLoadedSource(){return this.C[this.B]}getPeriods(){return[]}getDrmInfo(){return null}getTimelineCues(){return[]}getCueTimeline(){return null}resetAbr(){this.g.warn(mV)}onError(a){if(a&&
42
+ (this.trigger(new _.D(_.q,{detail:a})),this.j))this.j.onError(a)}namespace(){return _.kd}canPlay(){return this.nc()?2:0}yb(){return this.J}Tb(a){this.J=QV(a)}ae(){this.J=null}Ke(a){const b=this.yb()||{};a={metadataType:OV(b.metadataType),title:a};this.Tb(Object.assign({},b,a))}Ie(a){const b=this.yb()||{},c=OV(b.metadataType);a=new chrome.cast.Image(a);this.Tb(Object.assign({},b,{metadataType:c,images:[a]}))}He(a){const b=this.yb()||{};this.Tb(Object.assign({},b,{metadataType:3,artist:a}))}Je(a){const b=
43
+ this.yb()||{};a={metadataType:OV(b.metadataType),releaseDate:a};this.Tb(Object.assign({},b,a))}ya(a){const b=cast.framework.CastContext.getInstance(),c=a.castState===cast.framework.CastState.CONNECTED;JV=a.castState!==cast.framework.CastState.NO_DEVICES_AVAILABLE;this.X=c?b.getCurrentSession().getCastDevice().friendlyName:"";this.o.Qe()}La(a){this.g.debug(`state: ${a.sessionState}, details:`,a);switch(a.sessionState){case cast.framework.SessionState.SESSION_STARTED:this.A=!0;TV(this,a.session);break;
44
+ case cast.framework.SessionState.SESSION_RESUMED:this.Gb()||(this.A=!0,TV(this,a.session),this.W());break;case cast.framework.SessionState.SESSION_ENDED:if(this.Gb()&&this.a){const d=this.a.media;var b=this.f.na(),c=this.f.va();b=b&&b.language||void 0;c=c&&c.language||void 0;this.R(this.getState(),{source:{url:d.contentId,type:d.contentType,isLive:this.isLive()},currentTime:UV(this),eg:c,ef:b})}a.session.removeEventListener(cast.framework.SessionEventType.MEDIA_SESSION,this.V);a.session.removeMessageListener(sV,
45
+ this.O);this.A=!1;this.a=null;this.G.release();this.l=this.F=null}}Va(a){this.g.debug("New media session",a.mediaSession);SV(this,a.mediaSession)}Ua(a){a.value&&a.value.tracks&&this.f&&this.f.load()}za(a,b){if(a===sV&&0<this.H.size){const c=wV(b);this.H.forEach(d=>d(c))}}$(){this.trigger(new _.D(_.ag))}ea(a){const b=this;return _.x(function*(){let c=null;const d=yield xV(a,[_.Zf,_.Fc],b.K,b.h);d&&(c=new chrome.cast.media.Track(b.ca++,chrome.cast.media.TrackType.TEXT),c.language=d.language,c.name=
46
+ d.label||null,c.trackContentId=d.url,c.trackContentType=d.mimeType,c.customData={mimeType:a.mimeType,url:a.url});return c})}getTextDisplayer(){return null}},JV=!1,GV=new Set;window.__onGCastApiAvailable=IV;var BW=class extends _.eu{constructor(a,b,c){super();this.f=a;this.h=b;this.j=typeof c===_.be?c:this.l;this.a=XV(this);this.g=new _.S(pV);this.f&&this.forwardEventsTo(this.f)}destroy(){const a=this;return _.x(function*(){a.a&&(yield KV(a.a),a.a=null);a.f&&a.stopForwardingEventsTo(a.f)})}l(a,b){this.f&&a!==_.Do&&a!==_.Lo&&(delete b.license,this.f.load(b))}Yd(){return!!this.a&&this.a.nc()&&JV}Gb(){return!!this.a&&this.a.Gb()}ge(){return this.a?this.a.ge():""}md(a){this.a&&this.a.md(a)}cast(a){const b=
47
+ this;return _.x(function*(){if(b.a)try{if(yield b.a.cast(),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.na();m&&(m.mimeType&&(k=m.mimeType),m.language&&(l.preferredAudioLanguage=m.language),m.roles.length&&(l.preferredAudioRole=m.roles[0]));const n=f.va();n&&(n.language&&(l.preferredTextLanguage=n.language),n.roles.length&&(l.preferredTextRole=n.roles[0]));const r=
48
+ e&&typeof e.isLive===_.Qc?e.isLive:b.f.isLive();d={source:e,isLive:r,autoplay:!b.f.isPaused(),currentTime:Math.max(b.f.getPosition()-1,0),Ae:b.f.getPresentationStartTime(),Ub:h,audioMimeType:k,eb:l}}var c=d}yield WV(b);b.a&&(c&&(c.autoplay=!b.f.isPaused()),a?yield b.f.load(a):b.a.a||(yield MV(b.a,c)))}}catch(d){b.g.error("Error while trying to cast",d),c=new _.D(_.q,{detail:d}),b.trigger(c)}})}fe(){this.a&&this.a.fe()}Eg(a){const b=this;return _.x(function*(){a!==b.h&&(b.h=a,b.a&&(yield KV(b.a)),
49
+ b.a=XV(b))})}sendMessage(a){const b=this;return _.x(function*(){b.a?yield b.a.sendMessage(sV,a):b.g.warn(oV)})}addMessageListener(a){this.a?this.a.addMessageListener(a):this.g.warn(oV)}removeMessageListener(a){this.a?this.a.removeMessageListener(a):this.g.warn(oV)}yb(){return this.a&&this.a.yb()}Tb(a){this.a&&this.a.Tb(a)}ae(){this.a&&this.a.ae()}Ke(a){this.a&&this.a.Ke(a)}Ie(a){this.a&&this.a.Ie(a)}He(a){this.a&&this.a.He(a)}Je(a){this.a&&this.a.Je(a)}};_.y(pV,BW);
50
+ BW.prototype.setContentReleaseDate=BW.prototype.Je;BW.prototype.setContentArtist=BW.prototype.He;BW.prototype.setContentImage=BW.prototype.Ie;BW.prototype.setContentTitle=BW.prototype.Ke;BW.prototype.clearContentMetadata=BW.prototype.ae;BW.prototype.setContentMetadata=BW.prototype.Tb;BW.prototype.getContentMetadata=BW.prototype.yb;BW.prototype.removeMessageListener=BW.prototype.removeMessageListener;BW.prototype.addMessageListener=BW.prototype.addMessageListener;BW.prototype.sendMessage=BW.prototype.sendMessage;
51
+ BW.prototype.changeReceiverId=BW.prototype.Eg;BW.prototype.forceDisconnect=BW.prototype.fe;BW.prototype.cast=BW.prototype.cast;BW.prototype.setPlayerConfigInterceptor=BW.prototype.md;BW.prototype.getReceiverName=BW.prototype.ge;BW.prototype.isCasting=BW.prototype.Gb;BW.prototype.canCast=BW.prototype.Yd;BW.prototype.destroy=BW.prototype.destroy;var CW=class extends yW{constructor(a){super(a,"clpp.cast.StateManager");this.I=this.S.bind(this);this.H=this.R.bind(this);this.A=this.Y.bind(this);this.w=this.X.bind(this);this.K=this.W.bind(this);this.J=this.V.bind(this);this.L=this.$.bind(this);this.G=this.ca.bind(this);this.F=this.O.bind(this);this.f=this.M.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,
52
52
  this.H);b.addEventListener(a.MEDIA_FINISHED,this.A);b.addEventListener(a.BUFFERING,this.w);b.addEventListener(a.SEEKING,this.K);b.addEventListener(a.SEEKED,this.J);b.addEventListener(a.STALLED,this.L);b.addEventListener(a.PLAYER_LOADING,this.G);b.addEventListener(a.ERROR,this.F);b.addEventListener(a.BITRATE_CHANGED,this.f)}destroy(){const a=this,b=()=>Object.getPrototypeOf(Object.getPrototypeOf(this)).destroy;return _.x(function*(){const c=cast.framework.events.EventType,d=cast.framework.CastReceiverContext.getInstance().getPlayerManager();
53
- d.removeEventListener(c.PLAYING,a.I);d.removeEventListener(c.PAUSE,a.H);d.removeEventListener(c.MEDIA_FINISHED,a.A);d.removeEventListener(c.BUFFERING,a.w);d.removeEventListener(c.SEEKING,a.K);d.removeEventListener(c.SEEKED,a.J);d.removeEventListener(c.STALLED,a.L);d.removeEventListener(c.PLAYER_LOADING,a.G);d.removeEventListener(c.ERROR,a.F);d.removeEventListener(c.BITRATE_CHANGED,a.f);yield b().call(a)})}R(){this.player.trigger(new _.E(_.Ue));this.a(_.Fo)}P(){this.a(_.Eo)}Y(){this.a(_.uo)}X(a){a.isBuffering?
54
- this.a(_.xo):(a=this.player.isPaused()?_.Eo:_.Fo,this.a(a))}V(){this.j=1;this.player.trigger(new _.E(_.ig))}S(){this.player.trigger(new _.E(_.hg))}ba(){this.j=2}Z(){this.a(_.Do)}M(a){const b=this.player.getStats();this.player.trigger(new _.E(_.Qc,{detail:{bandwidth:a.totalBitrate,width:b.width,height:b.height}}))}T(a){a=new _.I(_.F,7,7300,{detailedErrorCode:a.detailedErrorCode,error:a.error,reason:a.reason});this.player.trigger(new _.E(_.r,{detail:a}));this.a(_.Bo)}};var Z=class{constructor(a,b,c,d,e){this.a=a;this.f=b;this.l=typeof c===_.t?c:1;this.h=typeof d===_.t?d:1;this.j=typeof e===_.t?e:0}lb(){return"Google Cast Framework"}nb(){return cast.framework.VERSION}qb(){return 0}getId(){return""}getCreativeId(){return""}Nb(){return""}getApiFramework(){return null}getAdSystem(){return""}getAdvertiserName(){return""}getTitle(){return this.a.title||""}getDuration(){return this.a.duration||0}getPosition(){return 0}getSkipTimeOffset(){return this.a.whenSkippable||0}Qb(){return!1}ob(){return this.a.clickThroughUrl||
55
- null}getMediaUrl(){return this.a.contentUrl||this.a.contentId||null}eb(){return 0}cb(){return 0}Qa(){return 0}Ra(){switch(this.Db()){case 0:return 0;case -1:return 2;default:return 1}}getPodIndex(){return this.j}Db(){return this.f.position}Eb(){return this.l}fb(){return this.h}getWrapperAdIds(){return[]}getWrapperAdSystems(){return[]}getWrapperCreativeIds(){return[]}Pb(){return null}};Z.prototype.getVideoElement=Z.prototype.Pb;Z.prototype.getWrapperCreativeIds=Z.prototype.getWrapperCreativeIds;
56
- Z.prototype.getWrapperAdSystems=Z.prototype.getWrapperAdSystems;Z.prototype.getWrapperAdIds=Z.prototype.getWrapperAdIds;Z.prototype.getSequenceLength=Z.prototype.fb;Z.prototype.getPositionInSequence=Z.prototype.Eb;Z.prototype.getPodTimeOffset=Z.prototype.Db;Z.prototype.getPodIndex=Z.prototype.getPodIndex;Z.prototype.getPodType=Z.prototype.Ra;Z.prototype.getMediaBitrate=Z.prototype.Qa;Z.prototype.getMediaHeight=Z.prototype.cb;Z.prototype.getMediaWidth=Z.prototype.eb;Z.prototype.getMediaUrl=Z.prototype.getMediaUrl;
57
- Z.prototype.getClickThroughUrl=Z.prototype.ob;Z.prototype.isBumper=Z.prototype.Qb;Z.prototype.getSkipTimeOffset=Z.prototype.getSkipTimeOffset;Z.prototype.getPosition=Z.prototype.getPosition;Z.prototype.getDuration=Z.prototype.getDuration;Z.prototype.getTitle=Z.prototype.getTitle;Z.prototype.getAdvertiserName=Z.prototype.getAdvertiserName;Z.prototype.getAdSystem=Z.prototype.getAdSystem;Z.prototype.getApiFramework=Z.prototype.getApiFramework;Z.prototype.getSourceId=Z.prototype.Nb;
58
- Z.prototype.getCreativeId=Z.prototype.getCreativeId;Z.prototype.getId=Z.prototype.getId;Z.prototype.getTechnology=Z.prototype.qb;Z.prototype.getAdManagerVersion=Z.prototype.nb;Z.prototype.getAdManagerName=Z.prototype.lb;var kW=class{constructor(a){this.a=a}getCuePoints(){return this.a.map(a=>a.position)}Gb(){return!!this.a.find(a=>0===a.position)}Fb(){return!!this.a.find(a=>-1===a.position)}};kW.prototype.hasPostroll=kW.prototype.Fb;kW.prototype.hasPreroll=kW.prototype.Gb;kW.prototype.getCuePoints=kW.prototype.getCuePoints;var lW=class{constructor(a){this.m=a;this.a=null;this.j=this.w.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];JV().addEventListener(this.f,
59
- this.j)}load(){const a=this;return _.x(function*(){FV&&(FV=!1,IV(a,0))})}start(){return _.x(function*(){JV().play()})}o(){}resume(){-1!==this.getPosition()&&JV().play()}pause(){-1!==this.getPosition()&&JV().pause()}skip(){}getVolume(){return this.m.getVolume()||0}setVolume(a){this.m.setVolume(a)}getPosition(){const a=this.a&&this.a.getBreakClipCurrentTimeSec();return typeof a===_.t?a:-1}l(){return!0}h(){const a=this;return _.x(function*(){JV().removeEventListener(a.f,a.j)})}w(a){const b=cast.framework.events.EndedReason;
60
- switch(a.type){case cast.framework.events.EventType.PLAYER_LOADING:this.a=JV().getBreakManager();this.a.setPlayWatchedBreak(!0);a=this.a.getBreaks();this.m.trigger(new _.E(_.xc,{adsTimeline:new kW(a)}));break;case cast.framework.events.EventType.BREAK_CLIP_LOADING:LV(this,_.mc,a);break;case cast.framework.events.EventType.BREAK_STARTED:LV(this,_.cc,a);break;case cast.framework.events.EventType.BREAK_ENDED:LV(this,_.dc,a);break;case cast.framework.events.EventType.BREAK_CLIP_STARTED:LV(this,_.tc,a);
61
- break;case cast.framework.events.EventType.BREAK_CLIP_ENDED:a.endedReason===b.SKIPPED?(LV(this,_.sc,a),LV(this,_.uc,a)):a.endedReason===b.STOPPED?LV(this,_.uc,a):a.endedReason===b.END_OF_STREAM?(LV(this,_.gc,a),LV(this,_.uc,a)):a.endedReason===b.ERROR&&IV(this,1);break;case cast.framework.events.EventType.PLAYING:LV(this,_.rc,a);break;case cast.framework.events.EventType.PAUSE:LV(this,_.oc,a);break;case cast.framework.events.EventType.BUFFERING:a.isBuffering?LV(this,_.ec,a):LV(this,_.rc,a)}}};
62
- lW.prototype.getPosition=lW.prototype.getPosition;lW.prototype.setVolume=lW.prototype.setVolume;lW.prototype.getVolume=lW.prototype.getVolume;lW.prototype.skip=lW.prototype.skip;lW.prototype.pause=lW.prototype.pause;lW.prototype.resume=lW.prototype.resume;var FV=!1;var mW=class{constructor(a){this.Va=a;this.a=this.f.bind(this)}init(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().addEventListener(MV(),this.a)}release(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().removeEventListener(MV(),this.a)}getTimelineCues(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager().getTimedMetadata().map(a=>NV(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=
63
- _.Uh;break;case cast.framework.events.EventType.TIMED_METADATA_ENTER:b=_.Lh;break;case cast.framework.events.EventType.TIMED_METADATA_EXIT:b=_.Oh}b&&this.Va(new _.E(b,{detail:NV(a.timedMetadataInfo)}))}else for(b of this.getTimelineCues())this.Va(new _.E(_.Uh,{detail:b}))}};var nW=class extends _.T{constructor(){super();this.g=new _.S("clpp.cast.TrackManager");this.m=null;this.o=1E9;this.h=[];this.j=[];this.l=this.w.bind(this);this.a=this.f=null}initialize(a){this.m=a;OV().addEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.l)}release(){this.h=[];this.j=[];this.a=this.f=null}load(){}destroy(){this.m=null;OV().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.l)}getVideoTracks(){return[]}getAudioTracks(){return this.h}ka(){return this.j}la(){return null}Za(){const a=
64
- this.oa();return a&&a.renditions[0]}Sa(){const a=this.wa();return a&&a.renditions[0]}pb(){return null}Bb(){return null}Cb(){return null}Ga(){return null}oa(){let a=null;if(this.f){let b=this.f.getActiveId();typeof b===_.t&&(b=b.toString(),a=this.getAudioTracks().find(c=>c.id===b)||null)}return a}wa(){let a=null;if(this.a){let b=this.a.getActiveIds()[0];typeof b===_.t&&(b=b.toString(),a=this.ka().find(c=>c.id===b)||null)}return a}wb(){this.g.warn("Video tracks unavailable on Cast")}ya(a){a&&this.f&&
65
- this.f.setActiveById(+a.id)}Ua(a){this.a&&(a?this.a.setActiveByIds([+a.id]):this.a.setActiveByIds([]))}hb(){this.g.warn("Video renditions unavailable on Cast")}ub(a){this.ya(a&&a.track)}vb(a){this.Ua(a&&a.track)}addTextTrack(a){const b=this;return _.x(function*(){var c=b.m.getConfiguration();if((c=yield eV(a,Object.values(cast.framework.messages.CaptionMimeType),b.m.getNetworkEngine(),c))&&b.a){const d=new cast.framework.messages.Track(b.o++,cast.framework.messages.TrackType.TEXT);d.isInband=!1;d.language=
66
- 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]),QV(b)}catch(e){throw b.g.warn("failed on track",a),e;}}})}ta(){return!0}w(){this.f=OV().getAudioTracksManager();var a=this.f.getTracks();this.h=PV(_.M,a);QV(this);a=this.m.getConfiguration();RV(this,_.M,a.preferredAudioLanguage,a.preferredAudioRole);RV(this,_.L,a.preferredTextLanguage,a.preferredTextRole)}};nW.prototype.isAbrEnabled=nW.prototype.ta;
67
- nW.prototype.addTextTrack=nW.prototype.addTextTrack;nW.prototype.setTextRendition=nW.prototype.vb;nW.prototype.setAudioRendition=nW.prototype.ub;nW.prototype.setVideoRendition=nW.prototype.hb;nW.prototype.setTextTrack=nW.prototype.Ua;nW.prototype.setAudioTrack=nW.prototype.ya;nW.prototype.setVideoTrack=nW.prototype.wb;nW.prototype.getTextTrack=nW.prototype.wa;nW.prototype.getAudioTrack=nW.prototype.oa;nW.prototype.getVideoTrack=nW.prototype.Ga;nW.prototype.getLoadingTextRendition=nW.prototype.Cb;
68
- nW.prototype.getLoadingAudioRendition=nW.prototype.Bb;nW.prototype.getLoadingVideoRendition=nW.prototype.pb;nW.prototype.getTextRendition=nW.prototype.Sa;nW.prototype.getAudioRendition=nW.prototype.Za;nW.prototype.getVideoRendition=nW.prototype.la;nW.prototype.getTextTracks=nW.prototype.ka;nW.prototype.getAudioTracks=nW.prototype.getAudioTracks;nW.prototype.getVideoTracks=nW.prototype.getVideoTracks;var oW=class extends _.Wt{constructor(){super();this.g=new _.S(YU);this.h=this.w=_.wl();this.A=null;this.l=-1;this.F=new _.Pq;this.f=this.o=this.j=this.a=this.B=null;this.C=!1}init(a,b){this.B=a;b&&(this.h=this.w=b);a=SV();a.setMessageInterceptor(cast.framework.messages.MessageType.MEDIA_STATUS,this.H.bind(this));a.setMediaPlaybackInfoHandler(this.G.bind(this));this.a=new jW(this);this.a.init();this.j=new nW;this.j.initialize(this);this.o=new mW(c=>this.trigger(c));this.o.init()}unload(){const a=
69
- cast.framework.messages.PlayerState,b=SV();b.getPlayerState()!==a.IDLE&&b.stop();this.j&&this.j.release();this.o&&this.o.release();this.f=null;return Promise.resolve()}release(){return this.unload().then(()=>{this.a&&this.a.release()})}destroy(){const a=this;return _.x(function*(){a.B=null;a.w=_.wl();a.h=a.w;a.l=-1;a.A=null;a.a&&(yield a.a.destroy(),a.a=null);a.j&&(a.j.destroy(),a.j=null)})}play(){const a=SV();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot play during ads playout.");
70
- a.play();return Promise.resolve()}pause(){const a=SV();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot pause during ads playout.");a.pause();return Promise.resolve()}isPaused(){return SV().getPlayerState()===cast.framework.messages.PlayerState.PAUSED}isEnded(){return SV().getPlayerState()===cast.framework.messages.PlayerState.IDLE}seek(a){const b=SV();if(null!==b.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject(QU);b.seek(a);return Promise.resolve()}getPosition(){return this.getMediaPosition()}setSeekInterceptor(){}setPlaybackSessionId(){}getMediaPosition(){return SV().getCurrentTimeSec()}getDuration(){return this.getMediaDuration()}getMediaDuration(){const a=
71
- SV().getDurationSec();return typeof a===_.t?-1===a?Infinity:a:-1}getPlaybackRate(){return SV().getPlaybackRate()}setPlaybackRate(a){if(0<a){const b=new cast.framework.messages.SetPlaybackRateRequestData;b.playbackRate=a;SV().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||
72
- null}getLoadedSource(){const a=SV().getMediaInformation();if(a){var b=SV().getPlaybackConfig();b=!!b&&b.protectionSystem!==cast.framework.ContentProtection.NONE;var c=this.A&&-1!==this.l?this.A[this.l]:null;c=c?c.name:void 0;!c&&a.metadata&&(c=a.metadata.title);return{url:a.contentId,type:a.contentType,mi:b,name:c}}return null}getDrmInfo(){return null}getPresentationStartTime(){return SV().getStartAbsoluteTime()}getSeekRange(){let a={start:0,end:this.getDuration()};if(this.isLive()){const b=SV().getLiveSeekableRange();
73
- b&&typeof b.start===_.t&&typeof b.end===_.t&&(a={start:b.start,end:b.end})}return a}getState(){return this.a?this.a.getState():_.qu}getStats(){var a=_.po();if(this.f){a=SV().getStats();this.f.f=a.estimatedBandwidth||NaN;this.f.o=a.streamBandwidth||NaN;var b=this.f,c=a.height||NaN;b.w=a.width||NaN;b.h=c;b=this.f;c=typeof a.decodedFrames===_.t?a.decodedFrames:NaN;b.l=typeof a.droppedFrames===_.t?a.droppedFrames:NaN;b.j=c;a=this.f.getStats()}return a}isLive(){return Infinity===this.getDuration()}load(a){const b=
74
- this;return _.x(function*(){b.f=new _.ou;b.a.l=b.f.a;b.A=_.Io(a);b.h=_.yl(b.w,a);if(b.C)b.C=!1;else{var c=b.A[b.l],d=new cast.framework.messages.LoadRequestData;d.autoplay=b.h.autoplay;typeof b.h.startTime===_.t&&(d.currentTime=b.h.startTime);c.type&&(d.media.contentType=c.type);d.media.contentId=c.url;d.media.customData={playerConfiguration:cV(b.h),local:!0};yield SV().load(d)}})}getBufferInfo(){this.g.warn(_.oa);return new _.Vt}getTrackManager(){return this.j}getConfiguration(){return this.h}getSurface(){return this.B}getTimeline(){return null}setupPlaylist(){return Promise.reject(_.pb)}appendLoad(){return Promise.reject(_.pb)}seekWith(){return Promise.reject(_.pb)}setNetworkEngine(a){this.F=
75
- a}setCmsdManager(){}getNetworkEngine(){return this.F}getSourceIndex(){return this.l}setSourceIndex(a){this.l=a}getPeriods(){return[]}namespace(){return YU}getTimelineCues(){return this.o&&this.o.getTimelineCues()||[]}getCueTimeline(){return null}resetAbr(){this.g.warn(UU)}onError(a){a=new _.E(_.r,{detail:a});this.trigger(a)}canPlay(){return _.Ik()?2:0}H(a){a=Object.assign({},a);a.customData||(a.customData={});a.customData.stats=cV(this.getStats());var b=SV(),c=a.media||b.getMediaInformation();b=b.getStartAbsoluteTime();
76
- c&&typeof b===_.t&&c.startAbsoluteTime!==b&&(this.g.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=SV().getStartAbsoluteTime();if(typeof d===_.t){b.startAbsoluteTime=d;let h;f?h=new cast.framework.messages.GenericMediaMetadata:h=b.metadata;h.sectionStartAbsoluteTime=
77
- d;b.metadata=h}b.streamType=c.LIVE;a=Object.assign({},a,{media:b})}}return a}G(a,b){var c=null;a.media.customData&&(c=dV(a.media.customData.playerConfiguration));var d=c?c.abr||null:null,e=b;d&&typeof d.defaultBandwidthEstimate===_.t?e.initialBandwidth=d.defaultBandwidthEstimate:e.initialBandwidth=void 0;VV(c,b);d=null;a.media.customData&&(d=dV(a.media.customData["com.castlabs.reactnative.PlayerConfiguration"]));a=(a=d&&d.LiveConfiguration)?0===a.liveEdgeLatencyMs:!1;if(a=null!=c&&c.lowLatencyMode||
78
- a)a=Object.assign({},b.shakaConfig,{streaming:{lowLatencyMode:!0}}),b=Object.assign({},b,{shakaConfig:a});return b}getTextDisplayer(){return null}setDrmCustomDataModifier(){}setCdnErrorCallback(){}detach(){}};var XV=class{constructor(){this.a=!1;this.g=new _.S(ZU);this.f=this.m=null;this.h=new Set;this.A=this.G.bind(this);this.w=this.B.bind(this);this.j=null;this.o=new _.jt;this.l=null}init(a){a&&(this.f=new oW,_.er(a,this.f),this.m=a,this.o.on(window,"unload",()=>{const b=this;return _.x(function*(){b.m&&b.m.getState()!==_.Co&&(yield bV(b.m))})}))}start(){if(!this.a&&window.cast&&cast.framework&&cast.framework.CastReceiverContext){this.a=!0;var a=ZV(),b=ZV().getPlayerManager(),c=new cast.framework.CastReceiverOptions;
79
- c.customNamespaces={};c.customNamespaces[$U]=cast.framework.system.MessageType.JSON;var d=new cast.framework.PlaybackConfig;d.manifestHandler=this.F.bind(this);d.shakaConfig={streaming:{ignoreTextStreamFailures:!0}};d.enableSmoothLiveRefresh=!0;c.playbackConfig=d;if(d=this.m&&this.m.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,
80
- this.A);a.start(c);a.addCustomMessageListener($U,this.w)}}stop(){if(this.a){this.a=!1;this.o.release();const a=ZV();ZV().getPlayerManager().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.A);a.removeCustomMessageListener($U,this.w);a.stop();this.m=this.f=null}}od(a){this.j=a}Nh(a){this.l=a}on(a,b){ZV().addEventListener(a,b)}off(a,b){ZV().removeEventListener(a,b)}addMessageListener(a){typeof a===_.ae&&this.h.add(a)}removeMessageListener(a){typeof a===_.ae&&this.h.delete(a)}sendMessage(a,
81
- b){ZV().sendCustomMessage($U,b,cV(a))}pc(){return this.a}Ab(){return $V()}Vb(a){aW(this,a)}$h(a){const b=$V();let c=null;a?c=Object.assign({},b,a):c=b;aW(this,c)}F(a){a=a.trim();if(a.startsWith("#EXTM3U"))return cW(this,a);try{var b=(new DOMParser).parseFromString(a,_.Yf)}catch(k){return a}var c=b.getElementsByTagName("MPD")[0];if(c){a=c;this.g.debug("Detected DASH, parsing");b=ZV();c=a.getElementsByTagName("Period");for(var d=c.length-1;0<=d;--d){var e=c[d].getElementsByTagName(_.ea);for(var f=e.length-
82
- 1;0<=f;--f){var g=e[f].getAttribute("contentType");if(g===_.w||g===_.p){g=e[f].getAttribute(_.Ae);var h=e[f].getElementsByTagName(_.Cb);for(let k=h.length-1;0<=k;--k){const l=h[k].getAttribute(_.Ae)||g,m=h[k].getAttribute(_.rd);let n=h[k].getAttribute(_.Eg)||void 0,q=h[k].getAttribute(_.be)||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(_.Cb).length||c[d].removeChild(e[f])}}c[d].getElementsByTagName(_.ea).length||a.removeChild(c[d])}return a=
83
- (new XMLSerializer).serializeToString(a)}if(c=b.getElementsByTagName(_.Jb)[0]){a=c;this.g.debug("Detected Smooth, parsing");b=ZV();c=a.getElementsByTagName("StreamIndex");for(d=c.length-1;0<=d;--d)if(c[d].getAttribute("Type")===_.w){e=c[d].getElementsByTagName(_.Ab);for(f=e.length-1;0<=f;--f)g=e[f].getAttribute(_.fb)||void 0,h=e[f].getAttribute(_.eb)||void 0,void 0!==g&&(g=+g),void 0!==h&&(h=+h),b.canDisplayType(_.rg,void 0,g,h)||c[d].removeChild(e[f]);c[d].getElementsByTagName(_.Ab).length||a.removeChild(c[d])}a=
84
- (new XMLSerializer).serializeToString(a)}return a}C(a){const b=this;return _.x(function*(){let c=a;var d;c.media.customData&&(d=dV(c.media.customData.playerConfiguration));if(b.m&&d){b.j&&(d=(yield Promise.resolve(b.j(d)))||d);d.ima&&(yield HV(c.media,d.ima,b.m.getNetworkEngine()));typeof d.startTime===_.t&&d.startTime!==c.currentTime?c.currentTime=d.startTime:d.startTime=c.currentTime||null;c.media.customData.local||(b.f.C=!0,yield _.pr(b.m,d),yield _.qr(b.m),d=b.m.getLoadedSource(),c.media.contentId=
85
- d.url,c.media.contentType=d.type,d.Wb&&(c.media.hlsVideoSegmentFormat=fV(d.Wb,_.N)),d.audioMimeType&&(c.media.hlsSegmentFormat=fV(d.audioMimeType,_.M)));const e=c.media.metadata;e&&typeof e.sectionStartAbsoluteTime===_.t&&(d=e.sectionStartAbsoluteTime,e.sectionStartAbsoluteTime=0===d?1E-8:d);void 0===c.autoplay&&(c.autoplay=b.m.getConfiguration().autoplay)}b.l&&(d=yield Promise.resolve(b.l(c)))&&(c=d);return c})}G(a){if(this.m&&(!a.media.customData||!a.media.customData.local)){var b=ZV().getPlayerManager(),
86
- c=b.getLiveSeekableRange();if(c){a=c.start;c=c.end;var d=this.m.getConfiguration().startTime;typeof a!==_.t||typeof c!==_.t||typeof d!==_.t||d>=a&&d<=c||(b=b.getMediaTimeForAbsoluteTime(d),typeof b===_.t&&b>=a&&b<=c&&this.m.seek(b))}_.sr(this.m)}}B(a){if(0<this.h.size){const b=dV(a.data);this.h.forEach(c=>c(b))}}};_.z(ZU,XV);XV.prototype.updateContentMetadata=XV.prototype.$h;XV.prototype.setContentMetadata=XV.prototype.Vb;XV.prototype.getContentMetadata=XV.prototype.Ab;XV.prototype.isApiReady=XV.prototype.pc;
87
- XV.prototype.sendMessage=XV.prototype.sendMessage;XV.prototype.removeMessageListener=XV.prototype.removeMessageListener;XV.prototype.addMessageListener=XV.prototype.addMessageListener;XV.prototype.off=XV.prototype.off;XV.prototype.on=XV.prototype.on;XV.prototype.setLoadRequestDataInterceptor=XV.prototype.Nh;XV.prototype.setPlayerConfigInterceptor=XV.prototype.od;XV.prototype.stop=XV.prototype.stop;XV.prototype.start=XV.prototype.start;XV.prototype.init=XV.prototype.init;XV.getInstance=YV;var WV=null;var pW=class{constructor(a){this.f=a;this.a=null;this.j=new _.jt;this.w=[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 _.x(function*(){a.a=a.f.l;if(a.a){const b=a.a.controller,c=a.A.bind(a);for(const d of a.w)a.j.on(b,d,c)}})}start(){return _.x(function*(){})}o(){}resume(){this.a&&
88
- 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(aV,{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===_.t&&(a=b));return a}l(){return!0}h(){const a=
89
- this;return _.x(function*(){a.j.release()})}A(a){switch(a.field){case "mediaInfo":a.value&&(a=a.value,a.breaks&&this.f.trigger(new _.E(_.xc,{adsTimeline:new kW(a.breaks)})));break;case "isPlayingBreak":a.value?eW(this,_.cc):(eW(this,_.gc),eW(this,_.uc),eW(this,_.dc));break;case "currentBreakClipNumber":0<=a.value&&(0<a.value&&(eW(this,_.gc),eW(this,_.uc)),eW(this,_.tc));break;case "isPaused":this.a.isPlayingBreak&&(a.value?eW(this,_.oc):eW(this,_.rc))}}};pW.prototype.getPosition=pW.prototype.getPosition;
90
- pW.prototype.setVolume=pW.prototype.setVolume;pW.prototype.getVolume=pW.prototype.getVolume;pW.prototype.skip=pW.prototype.skip;pW.prototype.pause=pW.prototype.pause;pW.prototype.resume=pW.prototype.resume;_.Xo(new class{name(){return"clpp.cast.ads.SenderAdsManagerFactory"}a(a,b){return a.namespace()!==_.ld?!1:!(!b||!b.ima)}create(a){return new pW(a.a)}});_.Xo(new class{name(){return"clpp.cast.ads.AdsManagerFactory"}a(a,b){return YV().pc()?!(!b||!b.ima):!1}create(a){return new lW(a)}});};f.call(g, window);
53
+ d.removeEventListener(c.PLAYING,a.I);d.removeEventListener(c.PAUSE,a.H);d.removeEventListener(c.MEDIA_FINISHED,a.A);d.removeEventListener(c.BUFFERING,a.w);d.removeEventListener(c.SEEKING,a.K);d.removeEventListener(c.SEEKED,a.J);d.removeEventListener(c.STALLED,a.L);d.removeEventListener(c.PLAYER_LOADING,a.G);d.removeEventListener(c.ERROR,a.F);d.removeEventListener(c.BITRATE_CHANGED,a.f);yield b().call(a)})}S(){this.player.trigger(new _.D(_.We));this.a(_.Oo)}R(){this.a(_.No)}Y(){this.a(_.Do)}X(a){a.isBuffering?
54
+ this.a(_.Ho):(a=this.player.isPaused()?_.No:_.Oo,this.a(a))}W(){this.j=1;this.player.trigger(new _.D(_.kg))}V(){this.player.trigger(new _.D(_.jg))}$(){this.j=2}ca(){this.a(_.Mo)}M(a){const b=this.player.getStats();this.player.trigger(new _.D(_.Pc,{detail:{bandwidth:a.totalBitrate,width:b.width,height:b.height}}))}O(a){a=new _.H(_.F,7,7300,{detailedErrorCode:a.detailedErrorCode,error:a.error,reason:a.reason});this.player.trigger(new _.D(_.q,{detail:a}));this.a(_.Eo)}};var Z=class{constructor(a,b,c,d,e){this.a=a;this.f=b;this.l=typeof c===_.t?c:1;this.h=typeof d===_.t?d:1;this.j=typeof e===_.t?e:0}kb(){return"Google Cast Framework"}lb(){return cast.framework.VERSION}pb(){return 0}getId(){return""}getCreativeId(){return""}Lb(){return""}getApiFramework(){return null}getAdSystem(){return""}getAdvertiserName(){return""}getTitle(){return this.a.title||""}getDuration(){return this.a.duration||0}getPosition(){return 0}getSkipTimeOffset(){return this.a.whenSkippable||0}Ob(){return!1}nb(){return this.a.clickThroughUrl||
55
+ null}getMediaUrl(){return this.a.contentUrl||this.a.contentId||null}ab(){return 0}$a(){return 0}Pa(){return 0}Qa(){switch(this.Bb()){case 0:return 0;case -1:return 2;default:return 1}}getPodIndex(){return this.j}Bb(){return this.f.position}Cb(){return this.l}bb(){return this.h}getWrapperAdIds(){return[]}getWrapperAdSystems(){return[]}getWrapperCreativeIds(){return[]}Nb(){return null}};Z.prototype.getVideoElement=Z.prototype.Nb;Z.prototype.getWrapperCreativeIds=Z.prototype.getWrapperCreativeIds;
56
+ Z.prototype.getWrapperAdSystems=Z.prototype.getWrapperAdSystems;Z.prototype.getWrapperAdIds=Z.prototype.getWrapperAdIds;Z.prototype.getSequenceLength=Z.prototype.bb;Z.prototype.getPositionInSequence=Z.prototype.Cb;Z.prototype.getPodTimeOffset=Z.prototype.Bb;Z.prototype.getPodIndex=Z.prototype.getPodIndex;Z.prototype.getPodType=Z.prototype.Qa;Z.prototype.getMediaBitrate=Z.prototype.Pa;Z.prototype.getMediaHeight=Z.prototype.$a;Z.prototype.getMediaWidth=Z.prototype.ab;Z.prototype.getMediaUrl=Z.prototype.getMediaUrl;
57
+ Z.prototype.getClickThroughUrl=Z.prototype.nb;Z.prototype.isBumper=Z.prototype.Ob;Z.prototype.getSkipTimeOffset=Z.prototype.getSkipTimeOffset;Z.prototype.getPosition=Z.prototype.getPosition;Z.prototype.getDuration=Z.prototype.getDuration;Z.prototype.getTitle=Z.prototype.getTitle;Z.prototype.getAdvertiserName=Z.prototype.getAdvertiserName;Z.prototype.getAdSystem=Z.prototype.getAdSystem;Z.prototype.getApiFramework=Z.prototype.getApiFramework;Z.prototype.getSourceId=Z.prototype.Lb;
58
+ Z.prototype.getCreativeId=Z.prototype.getCreativeId;Z.prototype.getId=Z.prototype.getId;Z.prototype.getTechnology=Z.prototype.pb;Z.prototype.getAdManagerVersion=Z.prototype.lb;Z.prototype.getAdManagerName=Z.prototype.kb;var DW=class{constructor(a){this.a=a}getCuePoints(){return this.a.map(a=>a.position)}Eb(){return!!this.a.find(a=>0===a.position)}Db(){return!!this.a.find(a=>-1===a.position)}};DW.prototype.hasPostroll=DW.prototype.Db;DW.prototype.hasPreroll=DW.prototype.Eb;DW.prototype.getCuePoints=DW.prototype.getCuePoints;var EW=class{constructor(a){this.m=a;this.a=null;this.j=this.w.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];bW().addEventListener(this.f,
59
+ this.j)}load(){const a=this;return _.x(function*(){YV&&(YV=!1,aW(a,0))})}start(){return _.x(function*(){bW().play()})}o(){}resume(){-1!==this.getPosition()&&bW().play()}pause(){-1!==this.getPosition()&&bW().pause()}skip(){}getVolume(){return this.m.getVolume()||0}setVolume(a){this.m.setVolume(a)}getPosition(){const a=this.a&&this.a.getBreakClipCurrentTimeSec();return typeof a===_.t?a:-1}l(){return!0}h(){const a=this;return _.x(function*(){bW().removeEventListener(a.f,a.j)})}w(a){const b=cast.framework.events.EndedReason;
60
+ switch(a.type){case cast.framework.events.EventType.PLAYER_LOADING:this.a=bW().getBreakManager();this.a.setPlayWatchedBreak(!0);a=this.a.getBreaks();this.m.trigger(new _.D(_.wc,{adsTimeline:new DW(a)}));break;case cast.framework.events.EventType.BREAK_CLIP_LOADING:dW(this,_.lc,a);break;case cast.framework.events.EventType.BREAK_STARTED:dW(this,_.bc,a);break;case cast.framework.events.EventType.BREAK_ENDED:dW(this,_.cc,a);break;case cast.framework.events.EventType.BREAK_CLIP_STARTED:dW(this,_.sc,a);
61
+ break;case cast.framework.events.EventType.BREAK_CLIP_ENDED:a.endedReason===b.SKIPPED?(dW(this,_.rc,a),dW(this,_.tc,a)):a.endedReason===b.STOPPED?dW(this,_.tc,a):a.endedReason===b.END_OF_STREAM?(dW(this,_.fc,a),dW(this,_.tc,a)):a.endedReason===b.ERROR&&aW(this,1);break;case cast.framework.events.EventType.PLAYING:dW(this,_.pc,a);break;case cast.framework.events.EventType.PAUSE:dW(this,_.nc,a);break;case cast.framework.events.EventType.BUFFERING:a.isBuffering?dW(this,_.dc,a):dW(this,_.pc,a)}}};
62
+ EW.prototype.getPosition=EW.prototype.getPosition;EW.prototype.setVolume=EW.prototype.setVolume;EW.prototype.getVolume=EW.prototype.getVolume;EW.prototype.skip=EW.prototype.skip;EW.prototype.pause=EW.prototype.pause;EW.prototype.resume=EW.prototype.resume;var YV=!1;var FW=class{constructor(a){this.Ta=a;this.a=this.f.bind(this)}init(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().addEventListener(eW(),this.a)}release(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().removeEventListener(eW(),this.a)}getTimelineCues(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager().getTimedMetadata().map(a=>fW(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=
63
+ _.Wh;break;case cast.framework.events.EventType.TIMED_METADATA_ENTER:b=_.Ph;break;case cast.framework.events.EventType.TIMED_METADATA_EXIT:b=_.Qh}b&&this.Ta(new _.D(b,{detail:fW(a.timedMetadataInfo)}))}else for(b of this.getTimelineCues())this.Ta(new _.D(_.Wh,{detail:b}))}};var GW=class extends _.T{constructor(){super();this.g=new _.S("clpp.cast.TrackManager");this.m=null;this.o=1E9;this.h=[];this.j=[];this.l=this.w.bind(this);this.a=this.f=null}initialize(a){this.m=a;gW().addEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.l)}release(){this.h=[];this.j=[];this.a=this.f=null}load(){}destroy(){this.m=null;gW().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.l)}getVideoTracks(){return[]}getAudioTracks(){return this.h}ja(){return this.j}ka(){return null}Wa(){const a=
64
+ this.na();return a&&a.renditions[0]}Ra(){const a=this.va();return a&&a.renditions[0]}ob(){return null}zb(){return null}Ab(){return null}Ga(){return null}na(){let a=null;if(this.f){let b=this.f.getActiveId();typeof b===_.t&&(b=b.toString(),a=this.getAudioTracks().find(c=>c.id===b)||null)}return a}va(){let a=null;if(this.a){let b=this.a.getActiveIds()[0];typeof b===_.t&&(b=b.toString(),a=this.ja().find(c=>c.id===b)||null)}return a}wb(){this.g.warn("Video tracks unavailable on Cast")}wa(a){a&&this.f&&
65
+ this.f.setActiveById(+a.id)}Sa(a){this.a&&(a?this.a.setActiveByIds([+a.id]):this.a.setActiveByIds([]))}fb(){this.g.warn("Video renditions unavailable on Cast")}ub(a){this.wa(a&&a.track)}vb(a){this.Sa(a&&a.track)}addTextTrack(a){const b=this;return _.x(function*(){var c=b.m.getConfiguration();if((c=yield xV(a,Object.values(cast.framework.messages.CaptionMimeType),b.m.getNetworkEngine(),c))&&b.a){const d=new cast.framework.messages.Track(b.o++,cast.framework.messages.TrackType.TEXT);d.isInband=!1;d.language=
66
+ 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]),iW(b)}catch(e){throw b.g.warn("failed on track",a),e;}}})}sa(){return!0}w(){this.f=gW().getAudioTracksManager();var a=this.f.getTracks();this.h=hW(_.M,a);iW(this);a=this.m.getConfiguration();jW(this,_.M,a.preferredAudioLanguage,a.preferredAudioRole);jW(this,_.L,a.preferredTextLanguage,a.preferredTextRole)}};GW.prototype.isAbrEnabled=GW.prototype.sa;
67
+ GW.prototype.addTextTrack=GW.prototype.addTextTrack;GW.prototype.setTextRendition=GW.prototype.vb;GW.prototype.setAudioRendition=GW.prototype.ub;GW.prototype.setVideoRendition=GW.prototype.fb;GW.prototype.setTextTrack=GW.prototype.Sa;GW.prototype.setAudioTrack=GW.prototype.wa;GW.prototype.setVideoTrack=GW.prototype.wb;GW.prototype.getTextTrack=GW.prototype.va;GW.prototype.getAudioTrack=GW.prototype.na;GW.prototype.getVideoTrack=GW.prototype.Ga;GW.prototype.getLoadingTextRendition=GW.prototype.Ab;
68
+ GW.prototype.getLoadingAudioRendition=GW.prototype.zb;GW.prototype.getLoadingVideoRendition=GW.prototype.ob;GW.prototype.getTextRendition=GW.prototype.Ra;GW.prototype.getAudioRendition=GW.prototype.Wa;GW.prototype.getVideoRendition=GW.prototype.ka;GW.prototype.getTextTracks=GW.prototype.ja;GW.prototype.getAudioTracks=GW.prototype.getAudioTracks;GW.prototype.getVideoTracks=GW.prototype.getVideoTracks;var HW=class extends _.eu{constructor(){super();this.g=new _.S(qV);this.h=this.w=_.zl();this.A=null;this.l=-1;this.F=new _.Yq;this.f=this.o=this.j=this.a=this.B=null;this.C=!1}init(a,b){this.B=a;b&&(this.h=this.w=b);a=kW();a.setMessageInterceptor(cast.framework.messages.MessageType.MEDIA_STATUS,this.H.bind(this));a.setMediaPlaybackInfoHandler(this.G.bind(this));this.a=new CW(this);this.a.init();this.j=new GW;this.j.initialize(this);this.o=new FW(c=>this.trigger(c));this.o.init()}unload(){const a=
69
+ cast.framework.messages.PlayerState,b=kW();b.getPlayerState()!==a.IDLE&&b.stop();this.j&&this.j.release();this.o&&this.o.release();this.f=null;return Promise.resolve()}release(){return this.unload().then(()=>{this.a&&this.a.release()})}destroy(){const a=this;return _.x(function*(){a.B=null;a.w=_.zl();a.h=a.w;a.l=-1;a.A=null;a.a&&(yield a.a.destroy(),a.a=null);a.j&&(a.j.destroy(),a.j=null)})}play(){const a=kW();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot play during ads playout.");
70
+ a.play();return Promise.resolve()}pause(){const a=kW();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot pause during ads playout.");a.pause();return Promise.resolve()}isPaused(){return kW().getPlayerState()===cast.framework.messages.PlayerState.PAUSED}isEnded(){return kW().getPlayerState()===cast.framework.messages.PlayerState.IDLE}seek(a){const b=kW();if(null!==b.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject(iV);b.seek(a);return Promise.resolve()}getPosition(){return this.getMediaPosition()}setSeekInterceptor(){}setPlaybackSessionId(){}getMediaPosition(){return kW().getCurrentTimeSec()}getDuration(){return this.getMediaDuration()}getMediaDuration(){const a=
71
+ kW().getDurationSec();return typeof a===_.t?-1===a?Infinity:a:-1}getPlaybackRate(){return kW().getPlaybackRate()}setPlaybackRate(a){if(0<a){const b=new cast.framework.messages.SetPlaybackRateRequestData;b.playbackRate=a;kW().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||
72
+ null}getLoadedSource(){const a=kW().getMediaInformation();if(a){var b=kW().getPlaybackConfig();b=!!b&&b.protectionSystem!==cast.framework.ContentProtection.NONE;var c=this.A&&-1!==this.l?this.A[this.l]:null;c=c?c.name:void 0;!c&&a.metadata&&(c=a.metadata.title);return{url:a.contentId,type:a.contentType,li:b,name:c}}return null}getDrmInfo(){return null}getPresentationStartTime(){return kW().getStartAbsoluteTime()}getSeekRange(){let a={start:0,end:this.getDuration()};if(this.isLive()){const b=kW().getLiveSeekableRange();
73
+ b&&typeof b.start===_.t&&typeof b.end===_.t&&(a={start:b.start,end:b.end})}return a}getState(){return this.a?this.a.getState():_.zu}getStats(){var a=_.yo();if(this.f){a=kW().getStats();this.f.f=a.estimatedBandwidth||NaN;this.f.o=a.streamBandwidth||NaN;var b=this.f,c=a.height||NaN;b.w=a.width||NaN;b.h=c;b=this.f;c=typeof a.decodedFrames===_.t?a.decodedFrames:NaN;b.l=typeof a.droppedFrames===_.t?a.droppedFrames:NaN;b.j=c;a=this.f.getStats()}return a}isLive(){return Infinity===this.getDuration()}load(a){const b=
74
+ this;return _.x(function*(){b.f=new _.xu;b.a.l=b.f.a;b.A=_.Ro(a);b.h=_.Bl(b.w,a);if(b.C)b.C=!1;else{var c=b.A[b.l],d=new cast.framework.messages.LoadRequestData;d.autoplay=b.h.autoplay;typeof b.h.startTime===_.t&&(d.currentTime=b.h.startTime);c.type&&(d.media.contentType=c.type);d.media.contentId=c.url;d.media.customData={playerConfiguration:vV(b.h),local:!0};yield kW().load(d)}})}getBufferInfo(){this.g.warn(_.oa);return new _.du}getTrackManager(){return this.j}getConfiguration(){return this.h}getSurface(){return this.B}getTimeline(){return null}setupPlaylist(){return Promise.reject(_.mb)}appendLoad(){return Promise.reject(_.mb)}seekWith(){return Promise.reject(_.mb)}setNetworkEngine(a){this.F=
75
+ a}setCmsdManager(){}getNetworkEngine(){return this.F}getSourceIndex(){return this.l}setSourceIndex(a){this.l=a}getPeriods(){return[]}namespace(){return qV}getTimelineCues(){return this.o&&this.o.getTimelineCues()||[]}getCueTimeline(){return null}resetAbr(){this.g.warn(mV)}onError(a){a=new _.D(_.q,{detail:a});this.trigger(a)}canPlay(){return _.Lk()?2:0}H(a){a=Object.assign({},a);a.customData||(a.customData={});a.customData.stats=vV(this.getStats());var b=kW(),c=a.media||b.getMediaInformation();b=b.getStartAbsoluteTime();
76
+ c&&typeof b===_.t&&c.startAbsoluteTime!==b&&(this.g.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=kW().getStartAbsoluteTime();if(typeof d===_.t){b.startAbsoluteTime=d;let h;f?h=new cast.framework.messages.GenericMediaMetadata:h=b.metadata;h.sectionStartAbsoluteTime=
77
+ d;b.metadata=h}b.streamType=c.LIVE;a=Object.assign({},a,{media:b})}}return a}G(a,b){var c=null;a.media.customData&&(c=wV(a.media.customData.playerConfiguration));var d=c?c.abr||null:null,e=b;d&&typeof d.defaultBandwidthEstimate===_.t?e.initialBandwidth=d.defaultBandwidthEstimate:e.initialBandwidth=void 0;nW(c,b);d=null;a.media.customData&&(d=wV(a.media.customData["com.castlabs.reactnative.PlayerConfiguration"]));a=(a=d&&d.LiveConfiguration)?0===a.liveEdgeLatencyMs:!1;if(a=null!=c&&c.lowLatencyMode||
78
+ a)a=Object.assign({},b.shakaConfig,{streaming:{lowLatencyMode:!0}}),b=Object.assign({},b,{shakaConfig:a});return b}getTextDisplayer(){return null}setDrmCustomDataModifier(){}setCdnErrorCallback(){}detach(){}};var pW=class{constructor(){this.a=!1;this.g=new _.S(rV);this.f=this.m=null;this.h=new Set;this.A=this.G.bind(this);this.w=this.B.bind(this);this.j=null;this.o=new _.st;this.l=null}init(a){a&&(this.f=new HW,_.nr(a,this.f),this.m=a,this.o.on(window,"unload",()=>{const b=this;return _.x(function*(){b.m&&b.m.getState()!==_.Lo&&(yield uV(b.m))})}))}start(){if(!this.a&&window.cast&&cast.framework&&cast.framework.CastReceiverContext){this.a=!0;var a=rW(),b=rW().getPlayerManager(),c=new cast.framework.CastReceiverOptions;
79
+ c.customNamespaces={};c.customNamespaces[sV]=cast.framework.system.MessageType.JSON;var d=new cast.framework.PlaybackConfig;d.manifestHandler=this.F.bind(this);d.shakaConfig={streaming:{ignoreTextStreamFailures:!0}};d.enableSmoothLiveRefresh=!0;c.playbackConfig=d;if(d=this.m&&this.m.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,
80
+ this.A);a.start(c);a.addCustomMessageListener(sV,this.w)}}stop(){if(this.a){this.a=!1;this.o.release();const a=rW();rW().getPlayerManager().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.A);a.removeCustomMessageListener(sV,this.w);a.stop();this.m=this.f=null}}md(a){this.j=a}Mh(a){this.l=a}on(a,b){rW().addEventListener(a,b)}off(a,b){rW().removeEventListener(a,b)}addMessageListener(a){typeof a===_.be&&this.h.add(a)}removeMessageListener(a){typeof a===_.be&&this.h.delete(a)}sendMessage(a,
81
+ b){rW().sendCustomMessage(sV,b,vV(a))}nc(){return this.a}yb(){return sW()}Tb(a){tW(this,a)}Zh(a){const b=sW();let c=null;a?c=Object.assign({},b,a):c=b;tW(this,c)}F(a){a=a.trim();if(a.startsWith("#EXTM3U"))return vW(this,a);try{var b=(new DOMParser).parseFromString(a,_.$f)}catch(k){return a}var c=b.getElementsByTagName("MPD")[0];if(c){a=c;this.g.debug("Detected DASH, parsing");b=rW();c=a.getElementsByTagName("Period");for(var d=c.length-1;0<=d;--d){var e=c[d].getElementsByTagName(_.ea);for(var f=e.length-
82
+ 1;0<=f;--f){var g=e[f].getAttribute("contentType");if(g===_.w||g===_.p){g=e[f].getAttribute(_.Be);var h=e[f].getElementsByTagName(_.zb);for(let k=h.length-1;0<=k;--k){const l=h[k].getAttribute(_.Be)||g,m=h[k].getAttribute(_.qd);let n=h[k].getAttribute(_.Gg)||void 0,r=h[k].getAttribute(_.ce)||void 0;void 0!==n&&(n=+n);void 0!==r&&(r=+r);b.canDisplayType(l,m,n,r)||e[f].removeChild(h[k])}e[f].getElementsByTagName(_.zb).length||c[d].removeChild(e[f])}}c[d].getElementsByTagName(_.ea).length||a.removeChild(c[d])}return a=
83
+ (new XMLSerializer).serializeToString(a)}if(c=b.getElementsByTagName(_.Hb)[0]){a=c;this.g.debug("Detected Smooth, parsing");b=rW();c=a.getElementsByTagName("StreamIndex");for(d=c.length-1;0<=d;--d)if(c[d].getAttribute("Type")===_.w){e=c[d].getElementsByTagName(_.xb);for(f=e.length-1;0<=f;--f)g=e[f].getAttribute(_.db)||void 0,h=e[f].getAttribute(_.cb)||void 0,void 0!==g&&(g=+g),void 0!==h&&(h=+h),b.canDisplayType(_.tg,void 0,g,h)||c[d].removeChild(e[f]);c[d].getElementsByTagName(_.xb).length||a.removeChild(c[d])}a=
84
+ (new XMLSerializer).serializeToString(a)}return a}C(a){const b=this;return _.x(function*(){let c=a;var d;c.media.customData&&(d=wV(c.media.customData.playerConfiguration));if(b.m&&d){b.j&&(d=(yield Promise.resolve(b.j(d)))||d);d.ima&&(yield $V(c.media,d.ima,b.m.getNetworkEngine()));typeof d.startTime===_.t&&d.startTime!==c.currentTime?c.currentTime=d.startTime:d.startTime=c.currentTime||null;c.media.customData.local||(b.f.C=!0,yield _.yr(b.m,d),yield _.zr(b.m),d=b.m.getLoadedSource(),c.media.contentId=
85
+ d.url,c.media.contentType=d.type,d.Ub&&(c.media.hlsVideoSegmentFormat=yV(d.Ub,_.N)),d.audioMimeType&&(c.media.hlsSegmentFormat=yV(d.audioMimeType,_.M)));const e=c.media.metadata;e&&typeof e.sectionStartAbsoluteTime===_.t&&(d=e.sectionStartAbsoluteTime,e.sectionStartAbsoluteTime=0===d?1E-8:d);void 0===c.autoplay&&(c.autoplay=b.m.getConfiguration().autoplay)}b.l&&(d=yield Promise.resolve(b.l(c)))&&(c=d);return c})}G(a){if(this.m&&(!a.media.customData||!a.media.customData.local)){var b=rW().getPlayerManager(),
86
+ c=b.getLiveSeekableRange();if(c){a=c.start;c=c.end;var d=this.m.getConfiguration().startTime;typeof a!==_.t||typeof c!==_.t||typeof d!==_.t||d>=a&&d<=c||(b=b.getMediaTimeForAbsoluteTime(d),typeof b===_.t&&b>=a&&b<=c&&this.m.seek(b))}_.Br(this.m)}}B(a){if(0<this.h.size){const b=wV(a.data);this.h.forEach(c=>c(b))}}};_.y(rV,pW);pW.prototype.updateContentMetadata=pW.prototype.Zh;pW.prototype.setContentMetadata=pW.prototype.Tb;pW.prototype.getContentMetadata=pW.prototype.yb;pW.prototype.isApiReady=pW.prototype.nc;
87
+ pW.prototype.sendMessage=pW.prototype.sendMessage;pW.prototype.removeMessageListener=pW.prototype.removeMessageListener;pW.prototype.addMessageListener=pW.prototype.addMessageListener;pW.prototype.off=pW.prototype.off;pW.prototype.on=pW.prototype.on;pW.prototype.setLoadRequestDataInterceptor=pW.prototype.Mh;pW.prototype.setPlayerConfigInterceptor=pW.prototype.md;pW.prototype.stop=pW.prototype.stop;pW.prototype.start=pW.prototype.start;pW.prototype.init=pW.prototype.init;pW.getInstance=qW;var oW=null;var IW=class{constructor(a){this.f=a;this.a=null;this.j=new _.st;this.w=[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 _.x(function*(){a.a=a.f.l;if(a.a){const b=a.a.controller,c=a.A.bind(a);for(const d of a.w)a.j.on(b,d,c)}})}start(){return _.x(function*(){})}o(){}resume(){this.a&&
88
+ 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(tV,{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===_.t&&(a=b));return a}l(){return!0}h(){const a=
89
+ this;return _.x(function*(){a.j.release()})}A(a){switch(a.field){case "mediaInfo":a.value&&(a=a.value,a.breaks&&this.f.trigger(new _.D(_.wc,{adsTimeline:new DW(a.breaks)})));break;case "isPlayingBreak":a.value?xW(this,_.bc):(xW(this,_.fc),xW(this,_.tc),xW(this,_.cc));break;case "currentBreakClipNumber":0<=a.value&&(0<a.value&&(xW(this,_.fc),xW(this,_.tc)),xW(this,_.sc));break;case "isPaused":this.a.isPlayingBreak&&(a.value?xW(this,_.nc):xW(this,_.pc))}}};IW.prototype.getPosition=IW.prototype.getPosition;
90
+ IW.prototype.setVolume=IW.prototype.setVolume;IW.prototype.getVolume=IW.prototype.getVolume;IW.prototype.skip=IW.prototype.skip;IW.prototype.pause=IW.prototype.pause;IW.prototype.resume=IW.prototype.resume;_.fp(new class{name(){return"clpp.cast.ads.SenderAdsManagerFactory"}a(a,b){return a.namespace()!==_.kd?!1:!(!b||!b.ima)}create(a){return new IW(a.a)}});_.fp(new class{name(){return"clpp.cast.ads.AdsManagerFactory"}a(a,b){return qW().nc()?!(!b||!b.ima):!1}create(a){return new EW(a)}});};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 rU="Ad Error",sU="onAdBreakStarted()",tU="onAdBreakStopped()",uU=function(a){var b=_.Xk();let c=Conviva.Constants.DeviceType.DESKTOP,d=Conviva.Constants.DeviceCategory.WEB;const e=b.os;b=b.osVersion.name;let f="";_.Jk()&&(f="Apple");_.Ik()?(f="Google",c=Conviva.Constants.DeviceType.SETTOP,d=Conviva.Constants.DeviceCategory.CHROMECAST):_.Kk()?(c=Conviva.Constants.DeviceType.MOBILE,/(android)/i.test(navigator.userAgent)?d=Conviva.Constants.DeviceCategory.ANDROID_DEVICE:_.Jk()&&(d=Conviva.Constants.DeviceCategory.APPLE_DEVICE)):
2
- _.Ck()||_.zk()||_.yk("Hisense")?(c=Conviva.Constants.DeviceType.SMARTTV,d=Conviva.Constants.DeviceCategory.SMART_TV,_.Ck()?(b="",f="LG",d=Conviva.Constants.DeviceCategory.LG_TV):_.zk()?(f="Samsung",d=Conviva.Constants.DeviceCategory.SAMSUNG_TV):_.yk("Hisense")&&(b="",f="Hisense")):_.yk("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},vU=function(a){return a?Conviva.Constants.StreamType.LIVE:Conviva.Constants.StreamType.VOD},wU=function(a){return 0===a?"Pre-roll":-1===a?"Post-roll":"Mid-roll"},yU=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
- vU(!!d);e[Conviva.Constants.ASSET_NAME]=rU;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"]=xU(a.getId()),e["c3.ad.creativeId"]=xU(a.getCreativeId()),e["c3.ad.system"]=xU(a.getAdSystem()),e["c3.ad.mediaFileApiFramework"]=xU(a.getApiFramework()),e["c3.ad.advertiser"]=xU(a.getAdvertiserName()),e["c3.ad.position"]=wU(a.getPodIndex()),e["c3.ad.technology"]=0===a.qb()?Conviva.Constants.AdType.CLIENT_SIDE:
5
- Conviva.Constants.AdType.SERVER_SIDE,e["c3.ad.adManagerName"]=xU(a.lb()),e["c3.ad.adManagerVersion"]=xU(a.nb()),e["c3.ad.advertiserCategory"]=xU(null),e["c3.ad.advertiserId"]=xU(null),e["c3.ad.breakId"]=xU(null),e["c3.ad.campaignName"]=xU(null),e["c3.ad.category"]=xU(null),e["c3.ad.classification"]=xU(null),e["c3.ad.creativeName"]=xU(null),e["c3.ad.sequence"]=xU(a.Eb()),e["c3.ad.sessionStartEvent"]=xU(null),e["c3.ad.unitName"]=xU(null),e["c3.ad.dayPart"]=xU(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"]=xU(b),e["c3.ad.firstAdSystem"]=xU(c),e["c3.ad.firstCreativeId"]=xU(a));return e},xU=function(a){return a?""+a:"NA"},CU=function(a){a.f.on(a.m,_.cc,a.C.bind(a));a.f.on(a.m,_.dc,a.F.bind(a));a.f.on(a.m,_.tc,a.L.bind(a));a.f.on(a.m,_.qc,a.l.bind(a));a.f.on(a.m,_.oc,a.l.bind(a));a.f.on(a.m,_.rc,a.l.bind(a));a.f.on(a.m,_.ec,a.l.bind(a));a.f.on(a.m,_.uc,a.M.bind(a));
7
- a.f.on(a.m,_.sc,a.K.bind(a));a.f.on(a.m,_.fc,a.G.bind(a));a.f.on(a.m,_.lc,a.I.bind(a));a.f.on(a.m,_.mc,a.J.bind(a));a.f.on(a.m,_.hc,a.H.bind(a));a.f.on(a.m,_.nc,a.S.bind(a));a.f.on(a.m,_.vc,a.P.bind(a));a.f.on(a.m,_.r,b=>{var c=b.detail;if(10003===c.code&&(a.g.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=rU}null===a.a&&zU(a,null);a.a.reportAdError(c,b.FATAL);a.h=!0;a.g.debug("Ad Playback Failure");
8
- AU(a,BU,c)}})},AU=function(a,b,c=rU){if(a.a){a.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED);switch(b){case BU:a.a.reportAdFailed(c,yU(null,a.B,a.A));break;case DU:a.a.reportAdSkipped();break;default:a.a.reportAdEnded()}a.a.release();a.a=null;a.j=!1}},zU=function(a,b){if(!a.o){a.h=!1;try{if(a.a=Conviva.Analytics.buildAdAnalytics(a.R()),b){const c=yU(b,a.B,a.A,a.m.isLive()),d=String(b.nb()),e={};e[Conviva.Constants.FRAMEWORK_NAME]=b.lb();e[Conviva.Constants.FRAMEWORK_VERSION]=
9
- d;a.a.setAdPlayerInfo(e);a.a.reportAdStarted(c)}}catch(c){a.g.error("Could not create ad analytics session",c)}}},EU=function(a,b){const c={};c[Conviva.Constants.LOG_LEVEL]=Conviva.Constants.LogLevel.DEBUG;b.serviceUrl&&(a.g.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(uU(b));b.connectionType&&Conviva.Analytics.reportDeviceMetric(Conviva.Constants.Network.CONNECTION_TYPE,
10
- b.connectionType);a.a=Conviva.Analytics.buildVideoAnalytics();a.o=!1;b={};b[Conviva.Constants.FRAMEWORK_NAME]=_.pa;b[Conviva.Constants.FRAMEWORK_VERSION]=_.da;a.a.setPlayerInfo(b)},FU=function(a){return a.m.getConfiguration().autoplay||!1},HU=function(a){if(!a.l)if(a.C)a.g.warn("Current session still active. No-op.");else{var b=a.m.getLoadedSource()||a.K,c=a.m.getConfiguration().conviva||null,d=c&&c.viewerId||"N/A",e=c&&c.defaultResource||"N/A";a.g.debug(a.m.getConfiguration().source);var f={},g=
11
- new _.lm(b.url);b&&(f[Conviva.Constants.ASSET_NAME]=b.name||"N/A",f[Conviva.Constants.STREAM_URL]=_.Nj(g));f[Conviva.Constants.PLAYER_NAME]=c.playerName||_.pa;f[Conviva.Constants.VIEWER_ID]=d;f[Conviva.Constants.DEFAULT_RESOURCE]=e;if(c&&!_.B(c.customTags))for(const h in c.customTags)f[h]=c.customTags[h];a.a.reportPlaybackRequested(f);a.a.setCallback(()=>{a.g.debug("reportMiscellaneousMetrics()");if(GU(a)){var h=1E3*a.m.getPosition();a.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAY_HEAD_TIME,
12
- h);if(h=a.m.getStats()){h=h.decodedFrames;const k=h-a.H;a.H=h;isFinite(k)&&(a.g.debug("Current FPS",k),a.a.reportPlaybackMetric(Conviva.Constants.Playback.RENDERED_FRAMERATE,k))}}});a.C=!0;a.h=!0;a.I=!1;0<a.j.length&&(a.g.debug("Report deferred events"),a.j.forEach(h=>{h.Af(h.args)}));a.j=[]}},IU=function(a){if(!a.l&&a.a){const b=vU(a.m.isLive()),c={};c[Conviva.Constants.IS_LIVE]=b;c[Conviva.Constants.DURATION]=a.m.getDuration();a.a.setContentInfo(c)}},GU=function(a){return null!==a.a&&a.C},JU=function(a){a.g.debug("terminateSession()");
13
- a.a&&(a.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED),a.a.reportPlaybackEnded(),a.a.release(),Conviva.Analytics.release(),a.o=!0,a.C=!1,a.A=!1,a.h=!1,a.w=null,a.B=!1,a.P=0,a.J=!1,a.j=[],a.H=0)},KU=function(a,b){var c=b.getConfiguration();a.a=!_.B(c.conviva)&&typeof c.conviva===_.Ge;a.a?"undefined"===typeof window.Conviva?(a.g.warn("Conviva SDK is not loaded. Will do nothing."),a.a=!1,c=new _.I(1,9,9E3),a.T(b,c)):b.namespace()===_.ld&&(a.a=!1,
14
- a.g.debug("Conviva does not report when casting.")):a.g.debug("Conviva plugin is loaded but not configured. Will do nothing.")},LU=function(a){const b=[];typeof a===_.Ge&&(a.customerKey||b.push("customerKey"),a.viewerId||b.push("viewerId"));if(0<b.length)throw new _.I(1,9,9001,{missingKeys:b});};var NU=class{constructor(a,b){this.m=a;this.R=b;this.B="";this.A=_.pa;this.g=new _.S("clpp.conviva.ad");this.f=new _.jt;this.a=null;this.h=this.o=this.w=this.j=!1}initialize(a){this.g.debug("Initialize Ad Insights");this.h=this.w=!1;this.B=a.viewerId;this.A=a.playerName||_.pa;CU(this)}release(){this.g.debug("Release Ad Insights");this.w?this.g.debug(_.ha):(_.uh(this.f),this.a&&AU(this,MU),this.f.release(),this.w=!0,this.j=this.h=!1)}destroy(){this.g.debug(_.Gd);this.o?this.g.debug(_.fa):this.o=!0}C(){this.g.debug(sU)}F(){this.g.debug(tU)}L(a){this.g.debug("onAdStarted()");
15
- a=a.ad;this.j||(this.g.warn("Ad load event was not triggered. This will have incidence on VSF"),zU(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.eb(),a.cb());this.a.reportAdMetric(Conviva.Constants.Playback.BITRATE,a.Qa())}l(a){this.g.debug("onAdStateChanged()");if(this.a){const b=c=>{this.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,c)};switch(a.type){case _.qc:case _.rc:b(Conviva.Constants.PlayerState.PLAYING);
16
- break;case _.oc:b(Conviva.Constants.PlayerState.PAUSED);break;case _.ec:b(Conviva.Constants.PlayerState.BUFFERING)}}}M(){this.g.debug("onAdStopped()");this.a&&!this.h&&AU(this,MU)}K(){this.g.debug("onAdSkipped()");this.a&&AU(this,DU)}G(){this.g.debug("onAdClicked()");this.a&&this.a.reportAdPlayerEvent("AdClicked")}I(){this.g.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.g.debug("onAdLoaded()");
17
- const b=a.ad,c=()=>{this.j=!0;zU(this,b)};if(-1!==b.getPodIndex()||this.m.getPosition()>=this.m.getDuration()-5)c();else this.f.on(this.m,_.Zf,()=>{this.m.getPosition()>=this.m.getDuration()-5&&(this.f.off(this.m,_.Zf),c())})}H(){this.g.debug("onAdFirstQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_FIRST_QUARTILE)}S(){this.g.debug("onAdMidPoint()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_MID_QUARTILE)}P(){this.g.debug("onAdThirdQuartile()");this.a&&
18
- this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_THIRD_QUARTILE)}},DU=0,MU=1,BU=2;var OU=class{constructor(a,b){this.m=a;this.f=new _.jt;this.a=null;this.o=!1;this.G=!0;this.B=this.h=this.A=this.C=this.l=!1;this.P=0;this.J=!1;this.w=null;this.I=!1;this.g=b;this.K=this.F=null;this.j=[];this.H=0}initialize(a,b,c){this.l||(this.g.debug("Initialize conviva"),this.G=!1,this.F=_.Ug(b),this.K=c,this.m=a,EU(this,this.F),this.f.on(this.m,_.Ue,this.ca.bind(this)),this.f.on(this.m,_.Pf,this.Y.bind(this)),this.f.on(this.m,_.Qc,this.L.bind(this)),this.f.on(this.m,_.ig,this.X.bind(this)),this.f.on(this.m,
19
- _.hg,this.V.bind(this)),this.f.on(this.m,_.cc,this.R.bind(this)),this.f.on(this.m,_.dc,this.S.bind(this)),this.f.on(this.m,_.xc,this.Z.bind(this)),this.f.on(this.m,_.Pc,this.ba.bind(this)),this.f.on(this.m,_.r,this.M.bind(this)),FU(this)&&(this.g.debug("Start a new session: A new video starts in autoplay."),HU(this)))}release(){this.g.debug("Release conviva");this.G?this.g.debug(_.ha):(_.uh(this.f),GU(this)||this.o||!FU(this)||this.a&&this.a.reportPlaybackFailed("Exit Before Video Start"),GU(this)&&
20
- JU(this),this.a=null,this.G=!0)}destroy(){this.g.debug(_.Gd);this.l?this.g.debug(_.fa):this.l=!0}reportAppEvent(a,b){let c=!1;try{Conviva.Analytics.reportAppEvent(a,b),c=!0}catch(d){this.g.debug("Report app event error",d),c=!1}return c}ca(){this.g.debug("onPlayRequest()");GU(this)||FU(this)?GU(this)&&this.A&&!this.h&&(this.g.debug("Resuming VST monitoring ..."),GU(this)&&!this.h&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_ENDED),this.h=!0),this.A=!1):(this.g.debug("Creating conviva session. On Play Requested / No autoplay"),
21
- HU(this))}Y(a){this.g.debug(_.Le);const b=c=>{if(this.o&&(this.g.debug("Creating conviva session (On Seek / Replay)"),EU(this,this.F),HU(this),IU(this),GU(this))){var d=this.m.getTrackManager();d=d.la()||d.pb();d.width&&d.height&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.RESOLUTION,d.width,d.height);d.bandwidth&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.BITRATE,d.bandwidth/1E3)}GU(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,c)};switch(a.detail.currentState){case _.Fo:b(Conviva.Constants.PlayerState.PLAYING);
22
- break;case _.Eo:b(Conviva.Constants.PlayerState.PAUSED);break;case _.xo:b(Conviva.Constants.PlayerState.BUFFERING);break;case _.uo:this.g.debug("onVideoEnded()"),GU(this)&&(this.w&&this.w.Fb()?(this.g.debug("Waiting for postroll Ad before terminating session"),this.J=!0):JU(this))}}L(a){this.g.debug(_.He);if(GU(this)){if(a=a.detail,typeof a.width===_.t&&typeof a.height===_.t&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.RESOLUTION,a.width,a.height),a.bandwidth&&this.a.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.a.setContentInfo(b)}}else this.j.push({Af:this.L.bind(this),args:a})}X(){this.g.debug("onSeeking()");GU(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)}V(){this.g.debug("onSeeked()");GU(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_ENDED)}Z(a){this.g.debug("onAdsTimelineChanged()");if(a=a.adsTimeline)this.w=a}R(a){this.g.debug(sU);
24
- var b=a.ad;a=0===b.Ra();const c=wU(b.getPodIndex());GU(this)||FU(this)||!a||HU(this);if(GU(this)){a=0===b.qb()?Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE;let d=0;const e={};1===b.fb()&&(d=b.getDuration());e[Conviva.Constants.POD_DURATION]=d;e[Conviva.Constants.POD_INDEX]=++this.P;e[Conviva.Constants.POD_POSITION]=c;b=Conviva.Constants.AdPlayer;b=a!==Conviva.Constants.AdType.CLIENT_SIDE||_.Ik()?b.CONTENT:b.SEPARATE;this.a.reportAdBreakStarted(a,b,e);this.B=!0}else this.g.debug("Bug: should already have a valid session")}S(){this.g.debug(tU);
25
- GU(this)&&this.B&&(this.a.reportAdBreakEnded(),this.B=!1,this.J&&JU(this))}M(a){this.g.debug(_.Ie);if(this.o&&this.I)this.g.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,GU(this)||HU(this));GU(this)?(this.g.debug("Report error",c,d),this.a.reportPlaybackError(c,d),d===Conviva.Constants.ErrorSeverity.FATAL&&(this.g.debug("Video Playback Failure"),
26
- this.I=!0,JU(this))):this.j.push({Af:this.M.bind(this),args:a})}}ba(){this.g.debug("onAutoPlayBlocked()");GU(this)&&(this.g.debug("Auto-play blocked. Pausing VST monitoring."),this.A=!0,GU(this)&&this.h&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_STARTED),this.h=!1))}};var PU=class{constructor(){this.h=this.f=null;this.a=!1;this.g=new _.S("clpp.conviva")}onPlayerCreated(a){this.f=new OU(a,this.g)}onContentWillLoad(a,b){KU(this,a);if(this.a){var c=a.getConfiguration();c=_.Ug(c.conviva||{});try{LU(c);const d=c.enableAdInsights||!1;this.f.initialize(a,c,b);d&&(this.h=new NU(a,()=>this.f.a),this.h.initialize(c))}catch(d){d instanceof _.I?this.T(a,d):this.T(a,new _.I(1,9,9002,d,d))}}}onContentLoaded(){this.a&&IU(this.f)}onPlayerWillDestroy(){this.a&&(this.a=!1,this.f.destroy(),
27
- this.f=null,this.h&&(this.h.destroy(),this.h=null))}onPlayerWillRelease(){this.a&&(this.f.release(),this.h&&this.h.release())}id(){return"conviva"}T(a,b){a.trigger(new _.E(_.r,{detail:b}))}reportAppEvent(a,b){return this.f?this.f.reportAppEvent(a,b):!1}};_.z("clpp.conviva.ConvivaPlugin",PU);PU.prototype.reportAppEvent=PU.prototype.reportAppEvent;PU.Id="conviva";_.Yq(new class{create(){return new PU}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var JU="Ad Error",KU="onAdBreakStarted()",LU="onAdBreakStopped()",MU=function(a){var b=_.$k();let c=Conviva.Constants.DeviceType.DESKTOP,d=Conviva.Constants.DeviceCategory.WEB;const e=b.os;b=b.osVersion.name;let f="";_.Mk()&&(f="Apple");_.Lk()?(f="Google",c=Conviva.Constants.DeviceType.SETTOP,d=Conviva.Constants.DeviceCategory.CHROMECAST):_.Nk()?(c=Conviva.Constants.DeviceType.MOBILE,/(android)/i.test(navigator.userAgent)?d=Conviva.Constants.DeviceCategory.ANDROID_DEVICE:_.Mk()&&(d=Conviva.Constants.DeviceCategory.APPLE_DEVICE)):
2
+ _.Fk()||_.Ck()||_.Bk("Hisense")?(c=Conviva.Constants.DeviceType.SMARTTV,d=Conviva.Constants.DeviceCategory.SMART_TV,_.Fk()?(b="",f="LG",d=Conviva.Constants.DeviceCategory.LG_TV):_.Ck()?(f="Samsung",d=Conviva.Constants.DeviceCategory.SAMSUNG_TV):_.Bk("Hisense")&&(b="",f="Hisense")):_.Bk("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},NU=function(a){return a?Conviva.Constants.StreamType.LIVE:Conviva.Constants.StreamType.VOD},OU=function(a){return 0===a?"Pre-roll":-1===a?"Post-roll":"Mid-roll"},QU=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
+ NU(!!d);e[Conviva.Constants.ASSET_NAME]=JU;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"]=PU(a.getId()),e["c3.ad.creativeId"]=PU(a.getCreativeId()),e["c3.ad.system"]=PU(a.getAdSystem()),e["c3.ad.mediaFileApiFramework"]=PU(a.getApiFramework()),e["c3.ad.advertiser"]=PU(a.getAdvertiserName()),e["c3.ad.position"]=OU(a.getPodIndex()),e["c3.ad.technology"]=0===a.pb()?Conviva.Constants.AdType.CLIENT_SIDE:
5
+ Conviva.Constants.AdType.SERVER_SIDE,e["c3.ad.adManagerName"]=PU(a.kb()),e["c3.ad.adManagerVersion"]=PU(a.lb()),e["c3.ad.advertiserCategory"]=PU(null),e["c3.ad.advertiserId"]=PU(null),e["c3.ad.breakId"]=PU(null),e["c3.ad.campaignName"]=PU(null),e["c3.ad.category"]=PU(null),e["c3.ad.classification"]=PU(null),e["c3.ad.creativeName"]=PU(null),e["c3.ad.sequence"]=PU(a.Cb()),e["c3.ad.sessionStartEvent"]=PU(null),e["c3.ad.unitName"]=PU(null),e["c3.ad.dayPart"]=PU(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"]=PU(b),e["c3.ad.firstAdSystem"]=PU(c),e["c3.ad.firstCreativeId"]=PU(a));return e},PU=function(a){return a?""+a:"NA"},UU=function(a){a.f.on(a.m,_.bc,a.C.bind(a));a.f.on(a.m,_.cc,a.F.bind(a));a.f.on(a.m,_.sc,a.L.bind(a));a.f.on(a.m,_.oc,a.l.bind(a));a.f.on(a.m,_.nc,a.l.bind(a));a.f.on(a.m,_.pc,a.l.bind(a));a.f.on(a.m,_.dc,a.l.bind(a));a.f.on(a.m,_.tc,a.M.bind(a));
7
+ a.f.on(a.m,_.rc,a.K.bind(a));a.f.on(a.m,_.ec,a.G.bind(a));a.f.on(a.m,_.kc,a.I.bind(a));a.f.on(a.m,_.lc,a.J.bind(a));a.f.on(a.m,_.gc,a.H.bind(a));a.f.on(a.m,_.mc,a.S.bind(a));a.f.on(a.m,_.uc,a.O.bind(a));a.f.on(a.m,_.q,b=>{var c=b.detail;if(10003===c.code&&(a.g.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=JU}null===a.a&&RU(a,null);a.a.reportAdError(c,b.FATAL);a.h=!0;a.g.debug("Ad Playback Failure");
8
+ SU(a,TU,c)}})},SU=function(a,b,c=JU){if(a.a){a.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED);switch(b){case TU:a.a.reportAdFailed(c,QU(null,a.B,a.A));break;case VU:a.a.reportAdSkipped();break;default:a.a.reportAdEnded()}a.a.release();a.a=null;a.j=!1}},RU=function(a,b){if(!a.o){a.h=!1;try{if(a.a=Conviva.Analytics.buildAdAnalytics(a.R()),b){const c=QU(b,a.B,a.A,a.m.isLive()),d=String(b.lb()),e={};e[Conviva.Constants.FRAMEWORK_NAME]=b.kb();e[Conviva.Constants.FRAMEWORK_VERSION]=
9
+ d;a.a.setAdPlayerInfo(e);a.a.reportAdStarted(c)}}catch(c){a.g.error("Could not create ad analytics session",c)}}},WU=function(a,b){const c={};c[Conviva.Constants.LOG_LEVEL]=Conviva.Constants.LogLevel.DEBUG;b.serviceUrl&&(a.g.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(MU(b));b.connectionType&&Conviva.Analytics.reportDeviceMetric(Conviva.Constants.Network.CONNECTION_TYPE,
10
+ b.connectionType);a.a=Conviva.Analytics.buildVideoAnalytics();a.o=!1;b={};b[Conviva.Constants.FRAMEWORK_NAME]=_.pa;b[Conviva.Constants.FRAMEWORK_VERSION]=_.da;a.a.setPlayerInfo(b)},XU=function(a){return a.m.getConfiguration().autoplay||!1},ZU=function(a){if(!a.l)if(a.C)a.g.warn("Current session still active. No-op.");else{var b=a.m.getLoadedSource()||a.K,c=a.m.getConfiguration().conviva||null,d=c&&c.viewerId||"N/A",e=c&&c.defaultResource||"N/A";a.g.debug(a.m.getConfiguration().source);var f={},g=
11
+ new _.nm(b.url);b&&(f[Conviva.Constants.ASSET_NAME]=b.name||"N/A",f[Conviva.Constants.STREAM_URL]=_.Pj(g));f[Conviva.Constants.PLAYER_NAME]=c.playerName||_.pa;f[Conviva.Constants.VIEWER_ID]=d;f[Conviva.Constants.DEFAULT_RESOURCE]=e;if(c&&!_.B(c.customTags))for(const h in c.customTags)f[h]=c.customTags[h];a.a.reportPlaybackRequested(f);a.a.setCallback(()=>{a.g.debug("reportMiscellaneousMetrics()");if(YU(a)){var h=1E3*a.m.getPosition();a.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAY_HEAD_TIME,
12
+ h);if(h=a.m.getStats()){h=h.decodedFrames;const k=h-a.H;a.H=h;isFinite(k)&&(a.g.debug("Current FPS",k),a.a.reportPlaybackMetric(Conviva.Constants.Playback.RENDERED_FRAMERATE,k))}}});a.C=!0;a.h=!0;a.I=!1;0<a.j.length&&(a.g.debug("Report deferred events"),a.j.forEach(h=>{h.yf(h.args)}));a.j=[]}},$U=function(a){if(!a.l&&a.a){const b=NU(a.m.isLive()),c={};c[Conviva.Constants.IS_LIVE]=b;c[Conviva.Constants.DURATION]=a.m.getDuration();a.a.setContentInfo(c)}},YU=function(a){return null!==a.a&&a.C},aV=function(a){a.g.debug("terminateSession()");
13
+ a.a&&(a.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED),a.a.reportPlaybackEnded(),a.a.release(),Conviva.Analytics.release(),a.o=!0,a.C=!1,a.A=!1,a.h=!1,a.w=null,a.B=!1,a.O=0,a.J=!1,a.j=[],a.H=0)},cV=function(a,b){const c=b.getConfiguration();a.a=!_.B(c.conviva)&&typeof c.conviva===_.He;a.a?"undefined"===typeof window.Conviva?(a.g.warn("Conviva SDK is not loaded. Will do nothing."),a.a=!1,a=new _.H(1,9,9E3),bV(b,a)):b.namespace()===_.kd&&(a.a=!1,
14
+ a.g.debug("Conviva does not report when casting.")):a.g.debug("Conviva plugin is loaded but not configured. Will do nothing.")},dV=function(a){const b=[];typeof a===_.He&&(a.customerKey||b.push("customerKey"),a.viewerId||b.push("viewerId"));if(0<b.length)throw new _.H(1,9,9001,{missingKeys:b});},bV=function(a,b){a.trigger(new _.D(_.q,{detail:b}))};var fV=class{constructor(a,b){this.m=a;this.R=b;this.B="";this.A=_.pa;this.g=new _.S("clpp.conviva.ad");this.f=new _.st;this.a=null;this.h=this.o=this.w=this.j=!1}initialize(a){this.g.debug("Initialize Ad Insights");this.h=this.w=!1;this.B=a.viewerId;this.A=a.playerName||_.pa;UU(this)}release(){this.g.debug("Release Ad Insights");this.w?this.g.debug(_.ha):(_.wh(this.f),this.a&&SU(this,eV),this.f.release(),this.w=!0,this.j=this.h=!1)}destroy(){this.g.debug(_.Fd);this.o?this.g.debug(_.fa):this.o=!0}C(){this.g.debug(KU)}F(){this.g.debug(LU)}L(a){this.g.debug("onAdStarted()");
15
+ a=a.ad;this.j||(this.g.warn("Ad load event was not triggered. This will have incidence on VSF"),RU(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.ab(),a.$a());this.a.reportAdMetric(Conviva.Constants.Playback.BITRATE,a.Pa())}l(a){this.g.debug("onAdStateChanged()");if(this.a){const b=c=>{this.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,c)};switch(a.type){case _.oc:case _.pc:b(Conviva.Constants.PlayerState.PLAYING);
16
+ break;case _.nc:b(Conviva.Constants.PlayerState.PAUSED);break;case _.dc:b(Conviva.Constants.PlayerState.BUFFERING)}}}M(){this.g.debug("onAdStopped()");this.a&&!this.h&&SU(this,eV)}K(){this.g.debug("onAdSkipped()");this.a&&SU(this,VU)}G(){this.g.debug("onAdClicked()");this.a&&this.a.reportAdPlayerEvent("AdClicked")}I(){this.g.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.g.debug("onAdLoaded()");
17
+ const b=a.ad,c=()=>{this.j=!0;RU(this,b)};if(-1!==b.getPodIndex()||this.m.getPosition()>=this.m.getDuration()-5)c();else this.f.on(this.m,_.ag,()=>{this.m.getPosition()>=this.m.getDuration()-5&&(this.f.off(this.m,_.ag),c())})}H(){this.g.debug("onAdFirstQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_FIRST_QUARTILE)}S(){this.g.debug("onAdMidPoint()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_MID_QUARTILE)}O(){this.g.debug("onAdThirdQuartile()");this.a&&
18
+ this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_THIRD_QUARTILE)}},VU=0,eV=1,TU=2;var gV=class{constructor(a,b){this.m=a;this.f=new _.st;this.a=null;this.o=!1;this.G=!0;this.B=this.h=this.A=this.C=this.l=!1;this.O=0;this.J=!1;this.w=null;this.I=!1;this.g=b;this.K=this.F=null;this.j=[];this.H=0}initialize(a,b,c){this.l||(this.g.debug("Initialize conviva"),this.G=!1,this.F=_.Wg(b),this.K=c,this.m=a,WU(this,this.F),this.f.on(this.m,_.We,this.$.bind(this)),this.f.on(this.m,_.Rf,this.X.bind(this)),this.f.on(this.m,_.Pc,this.L.bind(this)),this.f.on(this.m,_.kg,this.W.bind(this)),this.f.on(this.m,
19
+ _.jg,this.V.bind(this)),this.f.on(this.m,_.bc,this.R.bind(this)),this.f.on(this.m,_.cc,this.S.bind(this)),this.f.on(this.m,_.wc,this.Y.bind(this)),this.f.on(this.m,_.Oc,this.ca.bind(this)),this.f.on(this.m,_.q,this.M.bind(this)),XU(this)&&(this.g.debug("Start a new session: A new video starts in autoplay."),ZU(this)))}release(){this.g.debug("Release conviva");this.G?this.g.debug(_.ha):(_.wh(this.f),YU(this)||this.o||!XU(this)||this.a&&this.a.reportPlaybackFailed("Exit Before Video Start"),YU(this)&&
20
+ aV(this),this.a=null,this.G=!0)}destroy(){this.g.debug(_.Fd);this.l?this.g.debug(_.fa):this.l=!0}reportAppEvent(a,b){let c=!1;try{Conviva.Analytics.reportAppEvent(a,b),c=!0}catch(d){this.g.debug("Report app event error",d),c=!1}return c}$(){this.g.debug("onPlayRequest()");YU(this)||XU(this)?YU(this)&&this.A&&!this.h&&(this.g.debug("Resuming VST monitoring ..."),YU(this)&&!this.h&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_ENDED),this.h=!0),this.A=!1):(this.g.debug("Creating conviva session. On Play Requested / No autoplay"),
21
+ ZU(this))}X(a){this.g.debug(_.Ne);const b=c=>{if(this.o&&(this.g.debug("Creating conviva session (On Seek / Replay)"),WU(this,this.F),ZU(this),$U(this),YU(this))){var d=this.m.getTrackManager();d=d.ka()||d.ob();d.width&&d.height&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.RESOLUTION,d.width,d.height);d.bandwidth&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.BITRATE,d.bandwidth/1E3)}YU(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,c)};switch(a.detail.currentState){case _.Oo:b(Conviva.Constants.PlayerState.PLAYING);
22
+ break;case _.No:b(Conviva.Constants.PlayerState.PAUSED);break;case _.Ho:b(Conviva.Constants.PlayerState.BUFFERING);break;case _.Do:this.g.debug("onVideoEnded()"),YU(this)&&(this.w&&this.w.Db()?(this.g.debug("Waiting for postroll Ad before terminating session"),this.J=!0):aV(this))}}L(a){this.g.debug(_.Ie);if(YU(this)){if(a=a.detail,typeof a.width===_.t&&typeof a.height===_.t&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.RESOLUTION,a.width,a.height),a.bandwidth&&this.a.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.a.setContentInfo(b)}}else this.j.push({yf:this.L.bind(this),args:a})}W(){this.g.debug("onSeeking()");YU(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)}V(){this.g.debug("onSeeked()");YU(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_ENDED)}Y(a){this.g.debug("onAdsTimelineChanged()");if(a=a.adsTimeline)this.w=a}R(a){this.g.debug(KU);
24
+ var b=a.ad;a=0===b.Qa();const c=OU(b.getPodIndex());YU(this)||XU(this)||!a||ZU(this);if(YU(this)){a=0===b.pb()?Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE;let d=0;const e={};1===b.bb()&&(d=b.getDuration());e[Conviva.Constants.POD_DURATION]=d;e[Conviva.Constants.POD_INDEX]=++this.O;e[Conviva.Constants.POD_POSITION]=c;b=Conviva.Constants.AdPlayer;b=a!==Conviva.Constants.AdType.CLIENT_SIDE||_.Lk()?b.CONTENT:b.SEPARATE;this.a.reportAdBreakStarted(a,b,e);this.B=!0}else this.g.debug("Bug: should already have a valid session")}S(){this.g.debug(LU);
25
+ YU(this)&&this.B&&(this.a.reportAdBreakEnded(),this.B=!1,this.J&&aV(this))}M(a){this.g.debug(_.Ke);if(this.o&&this.I)this.g.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,YU(this)||ZU(this));YU(this)?(this.g.debug("Report error",c,d),this.a.reportPlaybackError(c,d),d===Conviva.Constants.ErrorSeverity.FATAL&&(this.g.debug("Video Playback Failure"),
26
+ this.I=!0,aV(this))):this.j.push({yf:this.M.bind(this),args:a})}}ca(){this.g.debug("onAutoPlayBlocked()");YU(this)&&(this.g.debug("Auto-play blocked. Pausing VST monitoring."),this.A=!0,YU(this)&&this.h&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_STARTED),this.h=!1))}};var hV=class{constructor(){this.h=this.f=null;this.a=!1;this.g=new _.S("clpp.conviva")}onPlayerCreated(a){this.f=new gV(a,this.g)}onContentWillLoad(a,b){cV(this,a);if(this.a){var c=a.getConfiguration();c=_.Wg(c.conviva||{});try{dV(c);const d=c.enableAdInsights||!1;this.f.initialize(a,c,b);d&&(this.h=new fV(a,()=>this.f.a),this.h.initialize(c))}catch(d){d instanceof _.H?bV(a,d):bV(a,new _.H(1,9,9002,d,d))}}}onContentLoaded(){this.a&&$U(this.f)}onPlayerWillDestroy(){this.a&&(this.a=!1,this.f.destroy(),
27
+ this.f=null,this.h&&(this.h.destroy(),this.h=null))}onPlayerWillRelease(){this.a&&(this.f.release(),this.h&&this.h.release())}id(){return"conviva"}reportAppEvent(a,b){return this.f?this.f.reportAppEvent(a,b):!1}};_.y("clpp.conviva.ConvivaPlugin",hV);hV.prototype.reportAppEvent=hV.prototype.reportAppEvent;hV.Id="conviva";_.gr(new class{create(){return new hV}});};f.call(g, window);