@castlabs/prestoplay 6.23.1 → 6.24.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 +14 -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 +113 -113
  6. package/cjs/cl.conviva.js +32 -32
  7. package/cjs/cl.core.js +608 -591
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +87 -86
  10. package/cjs/cl.externs.js +94 -30
  11. package/cjs/cl.freewheel.js +25 -24
  12. package/cjs/cl.hls.js +73 -71
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +30 -30
  15. package/cjs/cl.ima.js +23 -23
  16. package/cjs/cl.mse.js +344 -339
  17. package/cjs/cl.muxdata.js +15 -15
  18. package/cjs/cl.onboard.js +3 -3
  19. package/cjs/cl.persistent.js +14 -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 +71 -71
  26. package/cjs/cl.ttml.js +29 -29
  27. package/cjs/cl.verimatrix.js +5 -5
  28. package/cjs/cl.vimond.js +12 -12
  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 +492 -478
  39. package/cl.crypto.js +9 -9
  40. package/cl.dash.js +81 -80
  41. package/cl.externs.js +94 -30
  42. package/cl.freewheel.js +19 -19
  43. package/cl.hls.js +75 -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 +307 -305
  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 +14 -14
  61. package/cl.vtt.js +12 -12
  62. package/cl.yospace.js +3 -3
  63. package/cl.youbora.js +28 -28
  64. package/package.json +1 -1
  65. package/typings.d.ts +44 -10
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 uV="Cannot seek during ads playout.",vV="Cannot switch track",wV="Media session does not exist.",xV="No receivers available",yV="Reset ABR functionality not available on cast.",zV="SDK not yet ready",AV="Sender is destroyed.",BV="clpp.cast.CastProxy",CV="clpp.cast.Player",DV="clpp.cast.Receiver",EV="urn:x-cast:castlabs",FV="urn:x-cast:com.google.cast.media",GV=function(a){return _.x(function*(){yield _.zr(a,_.Pe);yield _.zr(a,_.Oe)})},HV=function(a){return JSON.stringify(a,(b,c)=>
2
- {if("license"!==b&&typeof c!==_.fe){if(c instanceof Event){b={};for(const d in c){const e=c[d];typeof e===_.Ke?"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}})},IV=function(a){if(typeof a!==_.Vf)return a;try{return JSON.parse(a,(b,c)=>"NaN"===c?NaN:"-Infinity"===c?-Infinity:"Infinity"===c?Infinity:c)}catch(b){return a}},JV=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=_.mk(d,a.mimeType,g);f&&g&&(h=_.xj(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})},KV=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 _.vg:return d.FMP4;case _.ug:return b===_.N?d.MPEG2_TS:c.TS;case _.Mc:return c.AAC;case _.Nc:return c.AC3;case _.Oc:return c.E_AC3;case "audio/mpeg":return c.MP3;case _.Pc:return c.FMP4}},MV=function(a){a=void 0===a?LV: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}},NV=function(a,b){return a.h.filter(c=>c.type===b)},PV=function(a,b){const c=OV(a);return NV(a,b).find(d=>c.includes(d.id))||null},RV=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;QV(a,b)},e=>{a.f[b]=null;a.g.debug(vV,e)})}else b===_.L&&(c=new chrome.cast.media.EditTracksInfoRequest([]),d.editTracksInfo(c,()=>{QV(a,b)},e=>{a.g.debug(vV,e)}))},OV=function(a){a=a.a?a.a.a:null;return(a?a.activeTrackIds||[]:[]).map(b=>b.toString())},QV=function(a,b){b===_.M?a.a.trigger(new _.E(_.sl)):b===_.L&&a.a.trigger(new _.E(_.tl))},UV=function(a){if(a)for(const b of SV)TV(b)},TV=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.$e();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);VV&&a.o.ga(.02)}},WV=function(a){return _.x(function*(){SV.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.W=null})},XV=function(a){return _.x(function*(){a.Hb()||(yield cast.framework.CastContext.getInstance().requestSession())})},ZV=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 YV(a,{source:a.getLoadedSource(),currentTime:c,isLive:a.isLive(),Le:a.getPresentationStartTime(),autoplay:b,fb:a.h})})},YV=function(a,b){return _.x(function*(){var c=chrome.cast.media.StreamType;yield XV(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=KV(b.Wb,_.N);e.hlsSegmentFormat=KV(c,_.M);b.fb&&(a.L&&(c=yield Promise.resolve(a.L(b.fb)))&&(b.fb=c),a.h=b.fb,a.C=_.dp(a.h),a.B=a.C.findIndex(k=>k.url===b.source.url),b.fb.remoteTextTracks&&(c=yield Promise.all(b.fb.remoteTextTracks.map(a.fa.bind(a))),e.tracks=c.filter(k=>k),b.fb.remoteTextTracks=void 0),delete b.fb.autoplay,b.fb.startTime=null,e.customData={playerConfiguration:HV(b.fb)});c=a.zb()||{};
11
- var f=$V(c.metadataType),g;typeof b.Le===_.t&&(g={metadataType:f,sectionStartAbsoluteTime:b.Le});var h;b.source.name&&(h={metadataType:f,title:b.source.name});c=aW(c);if(g=bW(Object.assign({},g,h,c)))e.metadata=g;e=new chrome.cast.media.LoadRequest(e);typeof b.autoplay===_.Uc&&(e.autoplay=b.autoplay);typeof b.currentTime===_.t&&(e.currentTime=b.currentTime);yield d.loadMedia(e)}})},bW=function(a){if(!a)return null;a:{var b=a.metadataType;const c=Object.entries(cW);for(const d of c){const [e,f]=d;
12
- if(f===b){b=e;break a}}b=null}if(!b)return null;b=MV(cW[b]);return Object.assign(b,a)},$V=function(a){var b=void 0===b?LV:b;return Object.values(cW).includes(a)?a:b},aW=function(a){const b={};for(const c in a)void 0!==a[c]&&(b[c]=a[c]);return b},eW=function(a,b){dW(a,b.getMediaSession());b.addEventListener(cast.framework.SessionEventType.MEDIA_SESSION,a.V);b.addMessageListener(EV,a.O)},fW=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},dW=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.aa.bind(a)),a.G.on(a.F,cast.framework.RemotePlayerEventType.MEDIA_INFO_CHANGED,a.Ga.bind(a)),a.j&&a.j.init(),a.trigger(new _.E(_.xe)))},iW=function(a){return new gW(a.h,()=>{a.trigger(new _.E(_.$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.qf&&(d.preferredAudioLanguage=c.qf);c.og&&(d.preferredTextLanguage=c.og);_.Br(a.f,null);a.trigger(new _.E("castingended"));a.j(b,d)}},()=>hW(a))},hW=function(a){return _.x(function*(){a.trigger(new _.E(_.Zc));a.f.a!==a.a&&a.f&&a.a&&(yield a.f.release(),_.Br(a.f,a.a))})},lW=function(a,b,c){return _.x(function*(){var d=b.adTagUrl;if(d)try{jW=!1;const e=
15
- _.xj(d),f=yield c.fetch(e).U;if(f&&f.data){const g=_.Ri(f.data),h=(new DOMParser).parseFromString(g,_.ag);if(h.getElementsByTagName("vmap:VMAP").length)_.C("VMAP detected."),a.vmapAdsRequest=kW(g);else if(h.getElementsByTagName("VAST").length){_.C("VAST detected.");{d=g;const k=new cast.framework.messages.BreakClip("bc1");k.vastAdsRequest=kW(d);const l=new cast.framework.messages.Break("b1",[k.id],0);a.breakClips=[k];a.breaks=[l]}}else _.C("Unsupported schema."),jW=!0}}catch(e){_.C("Failed to fetch an ad",
16
- e),jW=!0}})},kW=function(a){const b=new cast.framework.messages.VastAdsRequest;b.adsResponse=a;return b},mW=function(a,b){b=new _.H(1,10,10003,{errorType:b});a.m.onError(b)},nW=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},pW=function(a,b,c){if(c instanceof cast.framework.events.BreaksEvent||-1!==a.getPosition()){var d=null;(c=oW(a,c))&&(d={ad:c});a.m.trigger(new _.E(b,d))}},oW=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===_.Vf&&(d=a.a.getBreakClipById(b.breakClipId));typeof b.breakId===_.Vf&&(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},qW=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]},rW=function(a){const b=a.dashTimedMetadata;let c=_.jg;b&&(c=b.schemeIdUri);return{type:c.startsWith(_.ig)?_.Mh:_.gg,schemeIdUri:c,id:a.id||"",startTime:a.startTime,endTime:a.endTime,value:b&&b.value||"",eventElement:b?b.eventElement:null}},sW=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},uW=function(a){a.a=sW().getTextTracksManager();const b=a.a.getTracks();a.j=tW(_.L,b)},tW=function(a,b){const c=[];for(const d of b)b=
19
- new _.Rj(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 _.Zj(b.id,b)),c.push(b);return c},vW=function(a,b,c,d){c=_.ai(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
- _.Di(g);return f.some(k=>{k=_.Di(k.language||"");return _.Ei(h,k)})})){const g=_.Di(c);c=f.filter(h=>{h=_.Di(h.language||"");return _.Ei(g,h)});f=c.length?c:f;e=e||!!c.length}_.$i(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.xa(e):b===_.L&&a.Ta(e))},wW=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},zW=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=_.Zl(d);if(e){var f=[_.Ad];_.dp(a)[0].type!==_.Kc&&f.unshift(_.Cd);d.preferredDrmSystem===_.Ad&&f.reverse();for(var g,h;f.length&&!h;)g=f.shift(),h=e.La[g];h?(c=g===_.Cd?cast.framework.ContentProtection.WIDEVINE:g===_.Ad?cast.framework.ContentProtection.PLAYREADY:void 0,b.protectionSystem=c,b.licenseUrl=h.licenseUrl,c={ldlDelay:0,customData:{}},xW(b,h,a,c),yW(b,h,a,c)):c()}else c()}else c()},xW=
22
- function(a,b,c,d){b.modifiers.licenseRequest?a.licenseRequestHandler=e=>{const f=_.xj({method:_.rb,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},yW=function(a,b,c,d){b.modifiers.licenseResponse?a.licenseHandler=(e,f)=>_.x(function*(){const g=_.Bj(Object.assign({},f.headers),
23
- e.buffer,200,"");yield b.modifiers.licenseResponse(c,g,d);return _.K(g.data)}):a.licenseHandler=void 0},CW=function(){return AW||(AW=new BW)},DW=function(){return cast.framework.CastReceiverContext.getInstance()},EW=function(){const a=DW().getPlayerManager().getMediaInformation();return a&&a.metadata?a.metadata:null},FW=function(a,b){const c=DW().getPlayerManager().getMediaInformation();c?(b?c.metadata=b:delete c.metadata,a=!0,a=void 0===a?!1:a,DW().getPlayerManager().setMediaInformation(c,a)):a.g.warn("No mediaInformation is present. Skipping metadata update.")},
24
- HW=function(a,b){a.g.debug("Detected HLS, parsing");var c=cast.framework.messages.HlsVideoSegmentFormat;a=DW();var {hlsVideoSegmentFormat:d}=DW().getPlayerManager().getMediaInformation()||{};c=d===c.FMP4?_.vg:_.ug;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=GW(f,_.oa),h=GW(f,_.zb);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")},GW=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},JW=function(a,b){let c=null;const d=IW(a);d&&(c={ad:d});a.f.trigger(new _.E(b,c))},IW=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},KW=class{constructor(a,b){this.log=new _.S(b);this.player=a;this.l=null;this.h=_.Yo;this.o=_.Yu;this.j=2;this.C=Date.now();this.B=-1}release(){this.a(_.Yo)}destroy(){this.l=this.player=null;return Promise.resolve()}getState(){return this.h}onError(a){a.severity===
27
- _.F&&this.a(_.Ro)}a(a){if(a!==this.h)if(this.h===_.Ro&&a!==_.Yo)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===_.Uo?(this.B=b,this.player.trigger(new _.E(_.Wc,{detail:{bufferedTimeMS:-1,reason:this.j}}))):this.o===_.Uo&&this.player.trigger(new _.E(_.Vc,{detail:{bufferedTimeMS:b-this.B,reason:this.j}}));a={currentState:this.h,previousState:this.o,timeSinceLastStateChangeMS:b-this.C};this.C=b;this.l&&_.Jo(this.l,this.h);this.player.trigger(new _.E(_.Sf,
28
- {detail:a}))}}};_.z("clpp.cast.CastUtils",class{});var LV=0,cW={GENERIC:LV,MOVIE:1,TV_SHOW:2,MUSIC_TRACK:3,PHOTO:4,AUDIOBOOK_CHAPTER:5};var LW=class extends KW{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(_.Qo);break;case chrome.cast.media.IdleReason.ERROR:this.a(_.Ro);break;default:this.a(_.Yo)}break;case chrome.cast.media.PlayerState.PLAYING:this.a(_.ap);break;case chrome.cast.media.PlayerState.PAUSED:this.a(_.$o);break;case chrome.cast.media.PlayerState.BUFFERING:this.a(_.Uo)}}};var MW=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 _.Rj(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 _.Zj(c.id,c));return c}):[],this.a.trigger(new _.E(_.hu)))}destroy(){this.a=null}getVideoTracks(){return NV(this,_.N)}getAudioTracks(){return NV(this,_.M)}ka(){return NV(this,_.L)}la(){const a=this.Ha();return a?a.renditions[0]:null}Wa(){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}Ab(){return this.f[_.M]||null}Bb(){return this.f[_.L]||null}Ha(){return PV(this,_.N)}oa(){return PV(this,_.M)}wa(){return PV(this,_.L)}xb(a){RV(this,_.N,a)}xa(a){RV(this,_.M,a)}Ta(a){RV(this,_.L,a)}gb(a){this.xb(a&&a.track)}vb(a){this.xa(a&&a.track)}wb(a){this.Ta(a&&a.track)}addTextTrack(){return _.x(function*(){})}ta(){return!0}};MW.prototype.isAbrEnabled=MW.prototype.ta;MW.prototype.addTextTrack=MW.prototype.addTextTrack;MW.prototype.setTextRendition=MW.prototype.wb;
32
- MW.prototype.setAudioRendition=MW.prototype.vb;MW.prototype.setVideoRendition=MW.prototype.gb;MW.prototype.setTextTrack=MW.prototype.Ta;MW.prototype.setAudioTrack=MW.prototype.xa;MW.prototype.setVideoTrack=MW.prototype.xb;MW.prototype.getTextTrack=MW.prototype.wa;MW.prototype.getAudioTrack=MW.prototype.oa;MW.prototype.getVideoTrack=MW.prototype.Ha;MW.prototype.getLoadingTextRendition=MW.prototype.Bb;MW.prototype.getLoadingAudioRendition=MW.prototype.Ab;MW.prototype.getLoadingVideoRendition=MW.prototype.pb;
33
- MW.prototype.getTextRendition=MW.prototype.Sa;MW.prototype.getAudioRendition=MW.prototype.Wa;MW.prototype.getVideoRendition=MW.prototype.la;MW.prototype.getTextTracks=MW.prototype.ka;MW.prototype.getAudioTracks=MW.prototype.getAudioTracks;MW.prototype.getVideoTracks=MW.prototype.getVideoTracks;var gW=class extends _.ju{constructor(a,b,c,d){super();this.g=new _.S(_.md);this.S=a;this.o=new _.Ck(b);this.R=c;this.W=d;this.h=this.I=_.El();this.C=[];this.B=0;this.K=new _.lr;this.F=this.l=this.a=null;this.A=this.w=!1;this.X="";this.da=1E6;this.f=new MW;this.f.initialize(this);this.j=new LW(this);this.G=new _.xt;this.J=null;this.H=new Set;this.M=this.za.bind(this);this.Z=this.Ma.bind(this);this.V=this.Va.bind(this);this.O=this.Aa.bind(this);this.L=null;window.cast||Object.defineProperty(window,
34
- "cast",{get:()=>window.cast_,set:e=>{window.cast_=e;window.setTimeout(()=>{UV(!0)},0)}});TV(this);SV.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(_.nb)}appendLoad(){return Promise.reject(_.nb)}seekWith(){return Promise.reject(_.nb)}setSeekInterceptor(){}setPlaybackSessionId(){}destroy(){return _.x(function*(){})}sd(a){this.L=
35
- a}qc(){return this.w}Hb(){return this.A}se(){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,HV(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.qc())throw a.g.warn(zV),new _.H(1,8,8001,void 0);if(!VV)throw a.g.warn(xV),new _.H(1,8,8002,void 0);if(a.Hb())throw a.g.warn("Already casting"),
36
- new _.H(1,8,8003,void 0);try{yield XV(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);}})}re(){this.Hb()&&cast.framework.CastContext.getInstance().endCurrentSession(!0)}addMessageListener(a){typeof a===_.fe&&this.H.add(a)}removeMessageListener(a){typeof a===_.fe&&this.H.delete(a)}play(){return this.isEnded()?ZV(this,!0):new Promise((a,b)=>{if(!this.a)return b(wV);this.a.play(null,
37
- a,b)})}pause(){return new Promise((a,b)=>{this.isEnded()&&a();if(!this.a)return b(wV);this.a.pause(null,a,b)})}isPaused(){return!!this.a&&this.a.playerState===chrome.cast.media.PlayerState.PAUSED}isEnded(){return this.getState()===_.Qo}seek(a){return this.isEnded()?ZV(this,!1,a):new Promise((b,c)=>{this.a||c(wV);this.l.isPlayingBreak&&c(uV);const d=new chrome.cast.media.SeekRequest;d.currentTime=a;this.trigger(new _.E(_.lg));this.a.seek(d,()=>{this.trigger(new _.E(_.kg));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(FV,{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 mW="Cannot seek during ads playout.",nW="Cannot switch track",oW="Media session does not exist.",pW="No receivers available",qW="Reset ABR functionality not available on cast.",rW="SDK not yet ready",sW="Sender is destroyed.",tW="clpp.cast.CastProxy",uW="clpp.cast.Player",vW="clpp.cast.Receiver",wW="urn:x-cast:castlabs",xW="urn:x-cast:com.google.cast.media",yW=function(a){return _.x(function*(){yield _.Rr(a,_.We);yield _.Rr(a,_.Ve)})},zW=function(a){return JSON.stringify(a,(b,c)=>
2
+ {if("license"!==b&&typeof c!==_.me){if(c instanceof Event){b={};for(const d in c){const e=c[d];typeof e===_.Re?"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}})},AW=function(a){if(typeof a!==_.bg)return a;try{return JSON.parse(a,(b,c)=>"NaN"===c?NaN:"-Infinity"===c?-Infinity:"Infinity"===c?Infinity:c)}catch(b){return a}},BW=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=_.yk(d,a.mimeType,g);f&&g&&(h=_.Jj(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})},CW=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 _.Hg:return d.FMP4;case _.Gg:return b===_.N?d.MPEG2_TS:c.TS;case _.Qc:return c.AAC;case _.Rc:return c.AC3;case _.Sc:return c.E_AC3;case "audio/mpeg":return c.MP3;case _.Tc:return c.FMP4}},EW=function(a){a=void 0===a?DW: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}},FW=function(a,b){return a.h.filter(c=>c.type===b)},HW=function(a,b){const c=GW(a);return FW(a,b).find(d=>c.includes(d.id))||null},JW=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.xa();e&&c.push(+e.id)}c=new chrome.cast.media.EditTracksInfoRequest(c);
6
+ d.editTracksInfo(c,()=>{a.f[b]=null;IW(a,b)},e=>{a.f[b]=null;a.g.debug(nW,e)})}else b===_.L&&(c=new chrome.cast.media.EditTracksInfoRequest([]),d.editTracksInfo(c,()=>{IW(a,b)},e=>{a.g.debug(nW,e)}))},GW=function(a){a=a.a?a.a.a:null;return(a?a.activeTrackIds||[]:[]).map(b=>b.toString())},IW=function(a,b){b===_.M?a.a.trigger(new _.D(_.Wc)):b===_.L&&a.a.trigger(new _.D(_.ig))},MW=function(a){if(a)for(const b of KW)LW(b)},LW=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.ff();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.$);NW&&a.o.ia(.02)}},OW=function(a){return _.x(function*(){KW.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.$)}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})},PW=function(a){return _.x(function*(){a.Nb()||(yield cast.framework.CastContext.getInstance().requestSession())})},RW=function(a,b,c){c=
9
+ void 0===c?0:c;return _.x(function*(){var d=a.f.xa();d&&d.language&&(a.h.preferredTextLanguage=d.language);(d=a.f.ra())&&d.language&&(a.h.preferredAudioLanguage=d.language);yield QW(a,{source:a.getLoadedSource(),currentTime:c,isLive:a.isLive(),Qe:a.getPresentationStartTime(),autoplay:b,lb:a.h})})},QW=function(a,b){return _.x(function*(){var c=chrome.cast.media.StreamType;yield PW(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=CW(b.ac,_.N);e.hlsSegmentFormat=CW(c,_.M);b.lb&&(a.L&&(c=yield Promise.resolve(a.L(b.lb)))&&(b.lb=c),a.h=b.lb,a.C=_.mp(a.h),a.B=a.C.findIndex(k=>k.url===b.source.url),b.lb.remoteTextTracks&&(c=yield Promise.all(b.lb.remoteTextTracks.map(a.ha.bind(a))),e.tracks=c.filter(k=>k),b.lb.remoteTextTracks=void 0),delete b.lb.autoplay,b.lb.startTime=null,e.customData={playerConfiguration:zW(b.lb)});c=a.Fb()||{};
11
+ var f=SW(c.metadataType),g;typeof b.Qe===_.t&&(g={metadataType:f,sectionStartAbsoluteTime:b.Qe});var h;b.source.name&&(h={metadataType:f,title:b.source.name});c=TW(c);if(g=UW(Object.assign({},g,h,c)))e.metadata=g;e=new chrome.cast.media.LoadRequest(e);typeof b.autoplay===_.Zc&&(e.autoplay=b.autoplay);typeof b.currentTime===_.t&&(e.currentTime=b.currentTime);yield d.loadMedia(e)}})},UW=function(a){if(!a)return null;a:{var b=a.metadataType;const c=Object.entries(VW);for(const d of c){const [e,f]=d;
12
+ if(f===b){b=e;break a}}b=null}if(!b)return null;b=EW(VW[b]);return Object.assign(b,a)},SW=function(a){var b=void 0===b?DW:b;return Object.values(VW).includes(a)?a:b},TW=function(a){const b={};for(const c in a)void 0!==a[c]&&(b[c]=a[c]);return b},XW=function(a,b){WW(a,b.getMediaSession());b.addEventListener(cast.framework.SessionEventType.MEDIA_SESSION,a.V);b.addMessageListener(wW,a.O)},YW=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},WW=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.ba.bind(a)),a.G.on(a.F,cast.framework.RemotePlayerEventType.MEDIA_INFO_CHANGED,a.Ha.bind(a)),a.j&&a.j.init(),a.trigger(new _.D(_.Ee)))},aX=function(a){return new ZW(a.h,()=>{a.trigger(new _.D(_.hd))},(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.yf&&(d.preferredAudioLanguage=c.yf);c.wg&&(d.preferredTextLanguage=c.wg);_.Tr(a.f,null);a.trigger(new _.D("castingended"));a.j(b,d)}},()=>$W(a))},$W=function(a){return _.x(function*(){a.trigger(new _.D(_.ed));a.f.a!==a.a&&a.f&&a.a&&(yield a.f.release(),_.Tr(a.f,a.a))})},dX=function(a,b,c){return _.x(function*(){var d=b.adTagUrl;if(d)try{bX=!1;const e=
15
+ _.Jj(d),f=yield c.fetch(e).U;if(f&&f.data){const g=_.cj(f.data),h=(new DOMParser).parseFromString(g,_.hg);if(h.getElementsByTagName("vmap:VMAP").length)_.C("VMAP detected."),a.vmapAdsRequest=cX(g);else if(h.getElementsByTagName("VAST").length){_.C("VAST detected.");{d=g;const k=new cast.framework.messages.BreakClip("bc1");k.vastAdsRequest=cX(d);const l=new cast.framework.messages.Break("b1",[k.id],0);a.breakClips=[k];a.breaks=[l]}}else _.C("Unsupported schema."),bX=!0}}catch(e){_.C("Failed to fetch an ad",
16
+ e),bX=!0}})},cX=function(a){const b=new cast.framework.messages.VastAdsRequest;b.adsResponse=a;return b},eX=function(a,b){b=new _.I(1,10,10003,{errorType:b});a.m.onError(b)},fX=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},hX=function(a,b,c){if(c instanceof cast.framework.events.BreaksEvent||-1!==a.getPosition()){var d=null;(c=gX(a,c))&&(d={ad:c});a.m.trigger(new _.D(b,d))}},gX=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===_.bg&&(d=a.a.getBreakClipById(b.breakClipId));typeof b.breakId===_.bg&&(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},iX=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]},jX=function(a){const b=a.dashTimedMetadata;let c=_.zg;b&&(c=b.schemeIdUri);return{type:c.startsWith(_.vg)?_.fi:_.tg,schemeIdUri:c,id:a.id||"",startTime:a.startTime,endTime:a.endTime,value:b&&b.value||"",eventElement:b?b.eventElement:null}},kX=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},mX=function(a){a.a=kX().getTextTracksManager();const b=a.a.getTracks();a.j=lX(_.L,b)},lX=function(a,b){const c=[];for(const d of b)b=
19
+ new _.dk(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 _.lk(b.id,b)),c.push(b);return c},nX=function(a,b,c,d){c=_.oi(c).filter(g=>g);var e=!1;let f=[];b===_.M?f=a.getAudioTracks():b===_.L&&(f=a.na());if(c=c.find(g=>{const h=
20
+ _.Pi(g);return f.some(k=>{k=_.Pi(k.language||"");return _.Qi(h,k)})})){const g=_.Pi(c);c=f.filter(h=>{h=_.Pi(h.language||"");return _.Qi(g,h)});f=c.length?c:f;e=e||!!c.length}_.lj(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.Xa(e))},oX=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},rX=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=_.gm(d);if(e){var f=[_.Hd];_.mp(a)[0].type!==_.Oc&&f.unshift(_.Jd);d.preferredDrmSystem===_.Hd&&f.reverse();for(var g,h;f.length&&!h;)g=f.shift(),h=e.Na[g];h?(c=g===_.Jd?cast.framework.ContentProtection.WIDEVINE:g===_.Hd?cast.framework.ContentProtection.PLAYREADY:void 0,b.protectionSystem=c,b.licenseUrl=h.licenseUrl,c={ldlDelay:0,customData:{}},pX(b,h,a,c),qX(b,h,a,c)):c()}else c()}else c()},pX=
22
+ function(a,b,c,d){b.modifiers.licenseRequest?a.licenseRequestHandler=e=>{const f=_.Jj({method:_.rb,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},qX=function(a,b,c,d){b.modifiers.licenseResponse?a.licenseHandler=(e,f)=>_.x(function*(){const g=_.Nj(Object.assign({},f.headers),
23
+ e.buffer,200,"");yield b.modifiers.licenseResponse(c,g,d);return _.K(g.data)}):a.licenseHandler=void 0},uX=function(){return sX||(sX=new tX)},vX=function(){return cast.framework.CastReceiverContext.getInstance()},wX=function(){const a=vX().getPlayerManager().getMediaInformation();return a&&a.metadata?a.metadata:null},xX=function(a,b){const c=vX().getPlayerManager().getMediaInformation();c?(b?c.metadata=b:delete c.metadata,a=!0,a=void 0===a?!1:a,vX().getPlayerManager().setMediaInformation(c,a)):a.g.warn("No mediaInformation is present. Skipping metadata update.")},
24
+ zX=function(a,b){a.g.debug("Detected HLS, parsing");var c=cast.framework.messages.HlsVideoSegmentFormat;a=vX();var {hlsVideoSegmentFormat:d}=vX().getPlayerManager().getMediaInformation()||{};c=d===c.FMP4?_.Hg:_.Gg;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=yX(f,_.oa),h=yX(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")},yX=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},BX=function(a,b){let c=null;const d=AX(a);d&&(c={ad:d});a.f.trigger(new _.D(b,c))},AX=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},CX=class{constructor(a,b){this.log=new _.S(b);this.player=a;this.l=null;this.h=_.gp;this.o=_.pv;this.j=2;this.C=Date.now();this.B=-1}release(){this.a(_.gp)}destroy(){this.l=this.player=null;return Promise.resolve()}getState(){return this.h}onError(a){a.severity===
27
+ _.F&&this.a(_.$o)}a(a){if(a!==this.h)if(this.h===_.$o&&a!==_.gp)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===_.cp?(this.B=b,this.player.trigger(new _.D(_.ad,{detail:{bufferedTimeMS:-1,reason:this.j}}))):this.o===_.cp&&this.player.trigger(new _.D(_.$c,{detail:{bufferedTimeMS:b-this.B,reason:this.j}}));a={currentState:this.h,previousState:this.o,timeSinceLastStateChangeMS:b-this.C};this.C=b;this.l&&_.So(this.l,this.h);this.player.trigger(new _.D(_.Zf,
28
+ {detail:a}))}}};_.z("clpp.cast.CastUtils",class{});var DW=0,VW={GENERIC:DW,MOVIE:1,TV_SHOW:2,MUSIC_TRACK:3,PHOTO:4,AUDIOBOOK_CHAPTER:5};var DX=class extends CX{constructor(a){super(a,"clpp.cast.SenderStateManager");this.w=this.f=null;this.A=this.Xb.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)}Xb(){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(_.Zo);break;case chrome.cast.media.IdleReason.ERROR:this.a(_.$o);break;default:this.a(_.gp)}break;case chrome.cast.media.PlayerState.PLAYING:this.a(_.jp);break;case chrome.cast.media.PlayerState.PAUSED:this.a(_.ip);break;case chrome.cast.media.PlayerState.BUFFERING:this.a(_.cp)}}};var EX=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 _.dk(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 _.lk(c.id,c));return c}):[],this.a.trigger(new _.D(_.og)))}destroy(){this.a=null}getVideoTracks(){return FW(this,_.N)}getAudioTracks(){return FW(this,_.M)}na(){return FW(this,_.L)}oa(){const a=this.Ia();return a?a.renditions[0]:null}Ra(){const a=this.ra();return a?a.renditions[0]:null}Va(){const a=this.xa();return a?a.renditions[0]:
31
+ null}vb(){return this.f[_.N]||null}Gb(){return this.f[_.M]||null}Hb(){return this.f[_.L]||null}Ia(){return HW(this,_.N)}ra(){return HW(this,_.M)}xa(){return HW(this,_.L)}Db(a){JW(this,_.N,a)}ya(a){JW(this,_.M,a)}Xa(a){JW(this,_.L,a)}nb(a){this.Db(a&&a.track)}Bb(a){this.ya(a&&a.track)}Cb(a){this.Xa(a&&a.track)}addTextTrack(){return _.x(function*(){})}ua(){return!0}};EX.prototype.isAbrEnabled=EX.prototype.ua;EX.prototype.addTextTrack=EX.prototype.addTextTrack;EX.prototype.setTextRendition=EX.prototype.Cb;
32
+ EX.prototype.setAudioRendition=EX.prototype.Bb;EX.prototype.setVideoRendition=EX.prototype.nb;EX.prototype.setTextTrack=EX.prototype.Xa;EX.prototype.setAudioTrack=EX.prototype.ya;EX.prototype.setVideoTrack=EX.prototype.Db;EX.prototype.getTextTrack=EX.prototype.xa;EX.prototype.getAudioTrack=EX.prototype.ra;EX.prototype.getVideoTrack=EX.prototype.Ia;EX.prototype.getLoadingTextRendition=EX.prototype.Hb;EX.prototype.getLoadingAudioRendition=EX.prototype.Gb;EX.prototype.getLoadingVideoRendition=EX.prototype.vb;
33
+ EX.prototype.getTextRendition=EX.prototype.Va;EX.prototype.getAudioRendition=EX.prototype.Ra;EX.prototype.getVideoRendition=EX.prototype.oa;EX.prototype.getTextTracks=EX.prototype.na;EX.prototype.getAudioTracks=EX.prototype.getAudioTracks;EX.prototype.getVideoTracks=EX.prototype.getVideoTracks;var ZW=class extends _.Bu{constructor(a,b,c,d){super();this.g=new _.S(_.td);this.S=a;this.o=new _.Mk(b);this.R=c;this.W=d;this.h=this.I=_.Ml();this.C=[];this.B=0;this.K=new _.Dr;this.F=this.l=this.a=null;this.A=this.w=!1;this.Y="";this.da=1E6;this.f=new EX;this.f.initialize(this);this.j=new DX(this);this.G=new _.Rt;this.J=null;this.H=new Set;this.M=this.va.bind(this);this.$=this.Oa.bind(this);this.V=this.Za.bind(this);this.O=this.Aa.bind(this);this.L=null;window.cast||Object.defineProperty(window,
34
+ "cast",{get:()=>window.cast_,set:e=>{window.cast_=e;window.setTimeout(()=>{MW(!0)},0)}});LW(this);KW.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(_.nb)}appendLoad(){return Promise.reject(_.nb)}seekWith(){return Promise.reject(_.nb)}setSeekInterceptor(){}setPlaybackSessionId(){}getBandwidthEstimate(){return null}destroy(){return _.x(function*(){})}zd(a){this.L=
35
+ a}vc(){return this.w}Nb(){return this.A}ze(){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,zW(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.vc())throw a.g.warn(rW),new _.I(1,8,8001,void 0);if(!NW)throw a.g.warn(pW),new _.I(1,8,8002,void 0);if(a.Nb())throw a.g.warn("Already casting"),
36
+ new _.I(1,8,8003,void 0);try{yield PW(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);}})}ye(){this.Nb()&&cast.framework.CastContext.getInstance().endCurrentSession(!0)}addMessageListener(a){typeof a===_.me&&this.H.add(a)}removeMessageListener(a){typeof a===_.me&&this.H.delete(a)}play(){return this.isEnded()?RW(this,!0):new Promise((a,b)=>{if(!this.a)return b(oW);this.a.play(null,
37
+ a,b)})}pause(){return new Promise((a,b)=>{this.isEnded()&&a();if(!this.a)return b(oW);this.a.pause(null,a,b)})}isPaused(){return!!this.a&&this.a.playerState===chrome.cast.media.PlayerState.PAUSED}isEnded(){return this.getState()===_.Zo}seek(a){return this.isEnded()?RW(this,!1,a):new Promise((b,c)=>{this.a||c(oW);this.l.isPlayingBreak&&c(mW);const d=new chrome.cast.media.SeekRequest;d.currentTime=a;this.trigger(new _.D(_.Bg));this.a.seek(d,()=>{this.trigger(new _.D(_.Ag));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(xW,{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():_.Yu}getStats(){return this.a&&this.a.customData&&this.a.customData.stats?IV(this.a.customData.stats):_.No()}isLive(){return Infinity===this.getDuration()}load(a){const b=this;return _.x(function*(){if(b.qc())if(VV){b.C=_.dp(a);b.h=_.Gl(b.I,a);var c=b.C[b.B];yield YV(b,{source:c,
41
- isLive:c.isLive,autoplay:b.h.autoplay,fb:b.h,Wb:c.Wb,audioMimeType:c.audioMimeType})}else b.g.warn(xV);else b.g.warn(zV)})}getBufferInfo(){return new _.iu}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(yV)}onError(a){if(a&&
42
- (this.trigger(new _.E(_.r,{detail:a})),this.j))this.j.onError(a)}namespace(){return _.md}canPlay(){return this.qc()?2:0}zb(){return this.J}Vb(a){this.J=bW(a)}me(){this.J=null}Ve(a){const b=this.zb()||{};a={metadataType:$V(b.metadataType),title:a};this.Vb(Object.assign({},b,a))}Te(a){const b=this.zb()||{},c=$V(b.metadataType);a=new chrome.cast.Image(a);this.Vb(Object.assign({},b,{metadataType:c,images:[a]}))}Se(a){const b=this.zb()||{};this.Vb(Object.assign({},b,{metadataType:3,artist:a}))}Ue(a){const b=
43
- this.zb()||{};a={metadataType:$V(b.metadataType),releaseDate:a};this.Vb(Object.assign({},b,a))}za(a){const b=cast.framework.CastContext.getInstance(),c=a.castState===cast.framework.CastState.CONNECTED;VV=a.castState!==cast.framework.CastState.NO_DEVICES_AVAILABLE;this.X=c?b.getCurrentSession().getCastDevice().friendlyName:"";this.o.$e()}Ma(a){this.g.debug(`state: ${a.sessionState}, details:`,a);switch(a.sessionState){case cast.framework.SessionState.SESSION_STARTED:this.A=!0;eW(this,a.session);break;
44
- case cast.framework.SessionState.SESSION_RESUMED:this.Hb()||(this.A=!0,eW(this,a.session),this.W());break;case cast.framework.SessionState.SESSION_ENDED:if(this.Hb()&&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:fW(this),og:c,qf:b})}a.session.removeEventListener(cast.framework.SessionEventType.MEDIA_SESSION,this.V);a.session.removeMessageListener(EV,
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);dW(this,a.mediaSession)}Ga(a){a.value&&a.value.tracks&&this.f&&this.f.load()}Aa(a,b){if(a===EV&&0<this.H.size){const c=IV(b);this.H.forEach(d=>d(c))}}aa(){this.trigger(new _.E(_.bg))}fa(a){const b=this;return _.x(function*(){let c=null;const d=yield JV(a,[_.$f,_.Jc],b.K,b.h);d&&(c=new chrome.cast.media.Track(b.da++,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}},VV=!1,SV=new Set;window.__onGCastApiAvailable=UV;var NW=class extends _.ju{constructor(a,b,c){super();this.f=a;this.h=b;this.j=typeof c===_.fe?c:this.l;this.a=iW(this);this.g=new _.S(BV);this.f&&this.forwardEventsTo(this.f)}destroy(){const a=this;return _.x(function*(){a.a&&(yield WV(a.a),a.a=null);a.f&&a.stopForwardingEventsTo(a.f)})}l(a,b){this.f&&a!==_.Qo&&a!==_.Yo&&(delete b.license,this.f.load(b))}je(){return!!this.a&&this.a.qc()&&VV}Hb(){return!!this.a&&this.a.Hb()}se(){return this.a?this.a.se():""}sd(a){this.a&&this.a.sd(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===_.Uc?e.isLive:b.f.isLive();d={source:e,isLive:q,autoplay:!b.f.isPaused(),currentTime:Math.max(b.f.getPosition()-1,0),Le:b.f.getPresentationStartTime(),Wb:h,audioMimeType:k,fb:l}}var c=d}yield hW(b);b.a&&(c&&(c.autoplay=!b.f.isPaused()),a?yield b.f.load(a):b.a.a||(yield YV(b.a,c)))}}catch(d){b.g.error("Error while trying to cast",d),c=new _.E(_.r,{detail:d}),b.trigger(c)}})}re(){this.a&&this.a.re()}Pg(a){const b=this;return _.x(function*(){a!==b.h&&(b.h=a,b.a&&(yield WV(b.a)),
49
- b.a=iW(b))})}sendMessage(a){const b=this;return _.x(function*(){b.a?yield b.a.sendMessage(EV,a):b.g.warn(AV)})}addMessageListener(a){this.a?this.a.addMessageListener(a):this.g.warn(AV)}removeMessageListener(a){this.a?this.a.removeMessageListener(a):this.g.warn(AV)}zb(){return this.a&&this.a.zb()}Vb(a){this.a&&this.a.Vb(a)}me(){this.a&&this.a.me()}Ve(a){this.a&&this.a.Ve(a)}Te(a){this.a&&this.a.Te(a)}Se(a){this.a&&this.a.Se(a)}Ue(a){this.a&&this.a.Ue(a)}};_.z(BV,NW);
50
- NW.prototype.setContentReleaseDate=NW.prototype.Ue;NW.prototype.setContentArtist=NW.prototype.Se;NW.prototype.setContentImage=NW.prototype.Te;NW.prototype.setContentTitle=NW.prototype.Ve;NW.prototype.clearContentMetadata=NW.prototype.me;NW.prototype.setContentMetadata=NW.prototype.Vb;NW.prototype.getContentMetadata=NW.prototype.zb;NW.prototype.removeMessageListener=NW.prototype.removeMessageListener;NW.prototype.addMessageListener=NW.prototype.addMessageListener;NW.prototype.sendMessage=NW.prototype.sendMessage;
51
- NW.prototype.changeReceiverId=NW.prototype.Pg;NW.prototype.forceDisconnect=NW.prototype.re;NW.prototype.cast=NW.prototype.cast;NW.prototype.setPlayerConfigInterceptor=NW.prototype.sd;NW.prototype.getReceiverName=NW.prototype.se;NW.prototype.isCasting=NW.prototype.Hb;NW.prototype.canCast=NW.prototype.je;NW.prototype.destroy=NW.prototype.destroy;var OW=class extends KW{constructor(a){super(a,"clpp.cast.StateManager");this.I=this.S.bind(this);this.H=this.R.bind(this);this.A=this.Z.bind(this);this.w=this.X.bind(this);this.K=this.W.bind(this);this.J=this.V.bind(this);this.L=this.aa.bind(this);this.G=this.da.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,
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():_.pv}getStats(){return this.a&&this.a.customData&&this.a.customData.stats?AW(this.a.customData.stats):_.Wo()}isLive(){return Infinity===this.getDuration()}load(a){const b=this;return _.x(function*(){if(b.vc())if(NW){b.C=_.mp(a);b.h=_.Ol(b.I,a);var c=b.C[b.B];yield QW(b,{source:c,
41
+ isLive:c.isLive,autoplay:b.h.autoplay,lb:b.h,ac:c.ac,audioMimeType:c.audioMimeType})}else b.g.warn(pW);else b.g.warn(rW)})}getBufferInfo(){return new _.Au}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(qW)}onError(a){if(a&&
42
+ (this.trigger(new _.D(_.r,{detail:a})),this.j))this.j.onError(a)}namespace(){return _.td}canPlay(){return this.vc()?2:0}Fb(){return this.J}$b(a){this.J=UW(a)}te(){this.J=null}af(a){const b=this.Fb()||{};a={metadataType:SW(b.metadataType),title:a};this.$b(Object.assign({},b,a))}Ze(a){const b=this.Fb()||{},c=SW(b.metadataType);a=new chrome.cast.Image(a);this.$b(Object.assign({},b,{metadataType:c,images:[a]}))}Ye(a){const b=this.Fb()||{};this.$b(Object.assign({},b,{metadataType:3,artist:a}))}$e(a){const b=
43
+ this.Fb()||{};a={metadataType:SW(b.metadataType),releaseDate:a};this.$b(Object.assign({},b,a))}va(a){const b=cast.framework.CastContext.getInstance(),c=a.castState===cast.framework.CastState.CONNECTED;NW=a.castState!==cast.framework.CastState.NO_DEVICES_AVAILABLE;this.Y=c?b.getCurrentSession().getCastDevice().friendlyName:"";this.o.ff()}Oa(a){this.g.debug(`state: ${a.sessionState}, details:`,a);switch(a.sessionState){case cast.framework.SessionState.SESSION_STARTED:this.A=!0;XW(this,a.session);break;
44
+ case cast.framework.SessionState.SESSION_RESUMED:this.Nb()||(this.A=!0,XW(this,a.session),this.W());break;case cast.framework.SessionState.SESSION_ENDED:if(this.Nb()&&this.a){const d=this.a.media;var b=this.f.ra(),c=this.f.xa();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:YW(this),wg:c,yf:b})}a.session.removeEventListener(cast.framework.SessionEventType.MEDIA_SESSION,this.V);a.session.removeMessageListener(wW,
45
+ this.O);this.A=!1;this.a=null;this.G.release();this.l=this.F=null}}Za(a){this.g.debug("New media session",a.mediaSession);WW(this,a.mediaSession)}Ha(a){a.value&&a.value.tracks&&this.f&&this.f.load()}Aa(a,b){if(a===wW&&0<this.H.size){const c=AW(b);this.H.forEach(d=>d(c))}}ba(){this.trigger(new _.D(_.ng))}ha(a){const b=this;return _.x(function*(){let c=null;const d=yield BW(a,[_.gg,_.Nc],b.K,b.h);d&&(c=new chrome.cast.media.Track(b.da++,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}},NW=!1,KW=new Set;window.__onGCastApiAvailable=MW;var FX=class extends _.Bu{constructor(a,b,c){super();this.f=a;this.h=b;this.j=typeof c===_.me?c:this.l;this.a=aX(this);this.g=new _.S(tW);this.f&&this.forwardEventsTo(this.f)}destroy(){const a=this;return _.x(function*(){a.a&&(yield OW(a.a),a.a=null);a.f&&a.stopForwardingEventsTo(a.f)})}l(a,b){this.f&&a!==_.Zo&&a!==_.gp&&(delete b.license,this.f.load(b))}qe(){return!!this.a&&this.a.vc()&&NW}Nb(){return!!this.a&&this.a.Nb()}ze(){return this.a?this.a.ze():""}zd(a){this.a&&this.a.zd(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.ra();m&&(m.mimeType&&(k=m.mimeType),m.language&&(l.preferredAudioLanguage=m.language),m.roles.length&&(l.preferredAudioRole=m.roles[0]));const n=f.xa();n&&(n.language&&(l.preferredTextLanguage=n.language),n.roles.length&&(l.preferredTextRole=n.roles[0]));const q=
48
+ e&&typeof e.isLive===_.Zc?e.isLive:b.f.isLive();d={source:e,isLive:q,autoplay:!b.f.isPaused(),currentTime:Math.max(b.f.getPosition()-1,0),Qe:b.f.getPresentationStartTime(),ac:h,audioMimeType:k,lb:l}}var c=d}yield $W(b);b.a&&(c&&(c.autoplay=!b.f.isPaused()),a?yield b.f.load(a):b.a.a||(yield QW(b.a,c)))}}catch(d){b.g.error("Error while trying to cast",d),c=new _.D(_.r,{detail:d}),b.trigger(c)}})}ye(){this.a&&this.a.ye()}$g(a){const b=this;return _.x(function*(){a!==b.h&&(b.h=a,b.a&&(yield OW(b.a)),
49
+ b.a=aX(b))})}sendMessage(a){const b=this;return _.x(function*(){b.a?yield b.a.sendMessage(wW,a):b.g.warn(sW)})}addMessageListener(a){this.a?this.a.addMessageListener(a):this.g.warn(sW)}removeMessageListener(a){this.a?this.a.removeMessageListener(a):this.g.warn(sW)}Fb(){return this.a&&this.a.Fb()}$b(a){this.a&&this.a.$b(a)}te(){this.a&&this.a.te()}af(a){this.a&&this.a.af(a)}Ze(a){this.a&&this.a.Ze(a)}Ye(a){this.a&&this.a.Ye(a)}$e(a){this.a&&this.a.$e(a)}};_.z(tW,FX);
50
+ FX.prototype.setContentReleaseDate=FX.prototype.$e;FX.prototype.setContentArtist=FX.prototype.Ye;FX.prototype.setContentImage=FX.prototype.Ze;FX.prototype.setContentTitle=FX.prototype.af;FX.prototype.clearContentMetadata=FX.prototype.te;FX.prototype.setContentMetadata=FX.prototype.$b;FX.prototype.getContentMetadata=FX.prototype.Fb;FX.prototype.removeMessageListener=FX.prototype.removeMessageListener;FX.prototype.addMessageListener=FX.prototype.addMessageListener;FX.prototype.sendMessage=FX.prototype.sendMessage;
51
+ FX.prototype.changeReceiverId=FX.prototype.$g;FX.prototype.forceDisconnect=FX.prototype.ye;FX.prototype.cast=FX.prototype.cast;FX.prototype.setPlayerConfigInterceptor=FX.prototype.zd;FX.prototype.getReceiverName=FX.prototype.ze;FX.prototype.isCasting=FX.prototype.Nb;FX.prototype.canCast=FX.prototype.qe;FX.prototype.destroy=FX.prototype.destroy;var GX=class extends CX{constructor(a){super(a,"clpp.cast.StateManager");this.I=this.S.bind(this);this.H=this.R.bind(this);this.A=this.$.bind(this);this.w=this.Y.bind(this);this.K=this.W.bind(this);this.J=this.V.bind(this);this.L=this.ba.bind(this);this.G=this.da.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)})}S(){this.player.trigger(new _.E(_.Ze));this.a(_.ap)}R(){this.a(_.$o)}Z(){this.a(_.Qo)}X(a){a.isBuffering?
54
- this.a(_.Uo):(a=this.player.isPaused()?_.$o:_.ap,this.a(a))}W(){this.j=1;this.player.trigger(new _.E(_.lg))}V(){this.player.trigger(new _.E(_.kg))}aa(){this.j=2}da(){this.a(_.Zo)}M(a){const b=this.player.getStats();this.player.trigger(new _.E(_.Tc,{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 _.E(_.r,{detail:a}));this.a(_.Ro)}};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}bb(){return 0}ab(){return 0}Qa(){return 0}Ra(){switch(this.Cb()){case 0:return 0;case -1:return 2;default:return 1}}getPodIndex(){return this.j}Cb(){return this.f.position}Db(){return this.l}cb(){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.cb;Z.prototype.getPositionInSequence=Z.prototype.Db;Z.prototype.getPodTimeOffset=Z.prototype.Cb;Z.prototype.getPodIndex=Z.prototype.getPodIndex;Z.prototype.getPodType=Z.prototype.Ra;Z.prototype.getMediaBitrate=Z.prototype.Qa;Z.prototype.getMediaHeight=Z.prototype.ab;Z.prototype.getMediaWidth=Z.prototype.bb;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 PW=class{constructor(a){this.a=a}getCuePoints(){return this.a.map(a=>a.position)}Fb(){return!!this.a.find(a=>0===a.position)}Eb(){return!!this.a.find(a=>-1===a.position)}};PW.prototype.hasPostroll=PW.prototype.Eb;PW.prototype.hasPreroll=PW.prototype.Fb;PW.prototype.getCuePoints=PW.prototype.getCuePoints;var QW=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];nW().addEventListener(this.f,
59
- this.j)}load(){const a=this;return _.x(function*(){jW&&(jW=!1,mW(a,0))})}start(){return _.x(function*(){nW().play()})}o(){}resume(){-1!==this.getPosition()&&nW().play()}pause(){-1!==this.getPosition()&&nW().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*(){nW().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=nW().getBreakManager();this.a.setPlayWatchedBreak(!0);a=this.a.getBreaks();this.m.trigger(new _.E(_.Ac,{adsTimeline:new PW(a)}));break;case cast.framework.events.EventType.BREAK_CLIP_LOADING:pW(this,_.nc,a);break;case cast.framework.events.EventType.BREAK_STARTED:pW(this,_.cc,a);break;case cast.framework.events.EventType.BREAK_ENDED:pW(this,_.ec,a);break;case cast.framework.events.EventType.BREAK_CLIP_STARTED:pW(this,_.uc,a);
61
- break;case cast.framework.events.EventType.BREAK_CLIP_ENDED:a.endedReason===b.SKIPPED?(pW(this,_.tc,a),pW(this,_.xc,a)):a.endedReason===b.STOPPED?pW(this,_.xc,a):a.endedReason===b.END_OF_STREAM?(pW(this,_.hc,a),pW(this,_.xc,a)):a.endedReason===b.ERROR&&mW(this,1);break;case cast.framework.events.EventType.PLAYING:pW(this,_.rc,a);break;case cast.framework.events.EventType.PAUSE:pW(this,_.pc,a);break;case cast.framework.events.EventType.BUFFERING:a.isBuffering?pW(this,_.fc,a):pW(this,_.rc,a)}}};
62
- QW.prototype.getPosition=QW.prototype.getPosition;QW.prototype.setVolume=QW.prototype.setVolume;QW.prototype.getVolume=QW.prototype.getVolume;QW.prototype.skip=QW.prototype.skip;QW.prototype.pause=QW.prototype.pause;QW.prototype.resume=QW.prototype.resume;var jW=!1;var RW=class{constructor(a){this.Ua=a;this.a=this.f.bind(this)}init(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().addEventListener(qW(),this.a)}release(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().removeEventListener(qW(),this.a)}getTimelineCues(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager().getTimedMetadata().map(a=>rW(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
- _.$h;break;case cast.framework.events.EventType.TIMED_METADATA_ENTER:b=_.Th;break;case cast.framework.events.EventType.TIMED_METADATA_EXIT:b=_.Uh}b&&this.Ua(new _.E(b,{detail:rW(a.timedMetadataInfo)}))}else for(b of this.getTimelineCues())this.Ua(new _.E(_.$h,{detail:b}))}};var SW=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;sW().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;sW().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.l)}getVideoTracks(){return[]}getAudioTracks(){return this.h}ka(){return this.j}la(){return null}Wa(){const a=
64
- this.oa();return a&&a.renditions[0]}Sa(){const a=this.wa();return a&&a.renditions[0]}pb(){return null}Ab(){return null}Bb(){return null}Ha(){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}xb(){this.g.warn("Video tracks unavailable on Cast")}xa(a){a&&this.f&&
65
- this.f.setActiveById(+a.id)}Ta(a){this.a&&(a?this.a.setActiveByIds([+a.id]):this.a.setActiveByIds([]))}gb(){this.g.warn("Video renditions unavailable on Cast")}vb(a){this.xa(a&&a.track)}wb(a){this.Ta(a&&a.track)}addTextTrack(a){const b=this;return _.x(function*(){var c=b.m.getConfiguration();if((c=yield JV(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]),uW(b)}catch(e){throw b.g.warn("failed on track",a),e;}}})}ta(){return!0}w(){this.f=sW().getAudioTracksManager();var a=this.f.getTracks();this.h=tW(_.M,a);uW(this);a=this.m.getConfiguration();vW(this,_.M,a.preferredAudioLanguage,a.preferredAudioRole);vW(this,_.L,a.preferredTextLanguage,a.preferredTextRole)}};SW.prototype.isAbrEnabled=SW.prototype.ta;
67
- SW.prototype.addTextTrack=SW.prototype.addTextTrack;SW.prototype.setTextRendition=SW.prototype.wb;SW.prototype.setAudioRendition=SW.prototype.vb;SW.prototype.setVideoRendition=SW.prototype.gb;SW.prototype.setTextTrack=SW.prototype.Ta;SW.prototype.setAudioTrack=SW.prototype.xa;SW.prototype.setVideoTrack=SW.prototype.xb;SW.prototype.getTextTrack=SW.prototype.wa;SW.prototype.getAudioTrack=SW.prototype.oa;SW.prototype.getVideoTrack=SW.prototype.Ha;SW.prototype.getLoadingTextRendition=SW.prototype.Bb;
68
- SW.prototype.getLoadingAudioRendition=SW.prototype.Ab;SW.prototype.getLoadingVideoRendition=SW.prototype.pb;SW.prototype.getTextRendition=SW.prototype.Sa;SW.prototype.getAudioRendition=SW.prototype.Wa;SW.prototype.getVideoRendition=SW.prototype.la;SW.prototype.getTextTracks=SW.prototype.ka;SW.prototype.getAudioTracks=SW.prototype.getAudioTracks;SW.prototype.getVideoTracks=SW.prototype.getVideoTracks;var TW=class extends _.ju{constructor(){super();this.g=new _.S(CV);this.h=this.w=_.El();this.A=null;this.l=-1;this.F=new _.lr;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=wW();a.setMessageInterceptor(cast.framework.messages.MessageType.MEDIA_STATUS,this.H.bind(this));a.setMediaPlaybackInfoHandler(this.G.bind(this));this.a=new OW(this);this.a.init();this.j=new SW;this.j.initialize(this);this.o=new RW(c=>this.trigger(c));this.o.init()}unload(){const a=
69
- cast.framework.messages.PlayerState,b=wW();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=_.El();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=wW();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot play during ads playout.");
70
- a.play();return Promise.resolve()}pause(){const a=wW();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot pause during ads playout.");a.pause();return Promise.resolve()}isPaused(){return wW().getPlayerState()===cast.framework.messages.PlayerState.PAUSED}isEnded(){return wW().getPlayerState()===cast.framework.messages.PlayerState.IDLE}seek(a){const b=wW();if(null!==b.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject(uV);b.seek(a);return Promise.resolve()}getPosition(){return this.getMediaPosition()}setSeekInterceptor(){}setPlaybackSessionId(){}getMediaPosition(){return wW().getCurrentTimeSec()}getDuration(){return this.getMediaDuration()}getMediaDuration(){const a=
71
- wW().getDurationSec();return typeof a===_.t?-1===a?Infinity:a:-1}getPlaybackRate(){return wW().getPlaybackRate()}setPlaybackRate(a){if(0<a){const b=new cast.framework.messages.SetPlaybackRateRequestData;b.playbackRate=a;wW().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=wW().getMediaInformation();if(a){var b=wW().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,Ai:b,name:c}}return null}getDrmInfo(){return null}getPresentationStartTime(){return wW().getStartAbsoluteTime()}getSeekRange(){let a={start:0,end:this.getDuration()};if(this.isLive()){const b=wW().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():_.Yu}getStats(){var a=_.No();if(this.f){a=wW().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=_.dp(a);b.h=_.Gl(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:HV(b.h),local:!0};yield wW().load(d)}})}getBufferInfo(){this.g.warn(_.pa);return new _.iu}getTrackManager(){return this.j}getConfiguration(){return this.h}getSurface(){return this.B}getTimeline(){return null}setupPlaylist(){return Promise.reject(_.nb)}appendLoad(){return Promise.reject(_.nb)}seekWith(){return Promise.reject(_.nb)}setNetworkEngine(a){this.F=
75
- a}setCmsdManager(){}getNetworkEngine(){return this.F}getSourceIndex(){return this.l}setSourceIndex(a){this.l=a}getPeriods(){return[]}namespace(){return CV}getTimelineCues(){return this.o&&this.o.getTimelineCues()||[]}getCueTimeline(){return null}resetAbr(){this.g.warn(yV)}onError(a){a=new _.E(_.r,{detail:a});this.trigger(a)}canPlay(){return _.Pk()?2:0}H(a){a=Object.assign({},a);a.customData||(a.customData={});a.customData.stats=HV(this.getStats());var b=wW(),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=wW().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=IV(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;zW(c,b);d=null;a.media.customData&&(d=IV(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 BW=class{constructor(){this.a=!1;this.g=new _.S(DV);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 _.xt;this.l=null}init(a){a&&(this.f=new TW,_.Br(a,this.f),this.m=a,this.o.on(window,"unload",()=>{const b=this;return _.x(function*(){b.m&&b.m.getState()!==_.Yo&&(yield GV(b.m))})}))}start(){if(!this.a&&window.cast&&cast.framework&&cast.framework.CastReceiverContext){this.a=!0;var a=DW(),b=DW().getPlayerManager(),c=new cast.framework.CastReceiverOptions;
79
- c.customNamespaces={};c.customNamespaces[EV]=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(EV,this.w)}}stop(){if(this.a){this.a=!1;this.o.release();const a=DW();DW().getPlayerManager().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.A);a.removeCustomMessageListener(EV,this.w);a.stop();this.m=this.f=null}}sd(a){this.j=a}Yh(a){this.l=a}on(a,b){DW().addEventListener(a,b)}off(a,b){DW().removeEventListener(a,b)}addMessageListener(a){typeof a===_.fe&&this.h.add(a)}removeMessageListener(a){typeof a===_.fe&&this.h.delete(a)}sendMessage(a,
81
- b){DW().sendCustomMessage(EV,b,HV(a))}qc(){return this.a}zb(){return EW()}Vb(a){FW(this,a)}ki(a){const b=EW();let c=null;a?c=Object.assign({},b,a):c=b;FW(this,c)}F(a){a=a.trim();if(a.startsWith("#EXTM3U"))return HW(this,a);try{var b=(new DOMParser).parseFromString(a,_.ag)}catch(k){return a}var c=b.getElementsByTagName("MPD")[0];if(c){a=c;this.g.debug("Detected DASH, parsing");b=DW();c=a.getElementsByTagName("Period");for(var d=c.length-1;0<=d;--d){var e=c[d].getElementsByTagName(_.fa);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(_.Ee);var h=e[f].getElementsByTagName(_.Ab);for(let k=h.length-1;0<=k;--k){const l=h[k].getAttribute(_.Ee)||g,m=h[k].getAttribute(_.td);let n=h[k].getAttribute(_.Ig)||void 0,q=h[k].getAttribute(_.ge)||void 0;void 0!==n&&(n=+n);void 0!==q&&(q=+q);b.canDisplayType(l,m,n,q)||e[f].removeChild(h[k])}e[f].getElementsByTagName(_.Ab).length||c[d].removeChild(e[f])}}c[d].getElementsByTagName(_.fa).length||a.removeChild(c[d])}return a=
83
- (new XMLSerializer).serializeToString(a)}if(c=b.getElementsByTagName(_.Gb)[0]){a=c;this.g.debug("Detected Smooth, parsing");b=DW();c=a.getElementsByTagName("StreamIndex");for(d=c.length-1;0<=d;--d)if(c[d].getAttribute("Type")===_.w){e=c[d].getElementsByTagName(_.yb);for(f=e.length-1;0<=f;--f)g=e[f].getAttribute(_.eb)||void 0,h=e[f].getAttribute(_.db)||void 0,void 0!==g&&(g=+g),void 0!==h&&(h=+h),b.canDisplayType(_.vg,void 0,g,h)||c[d].removeChild(e[f]);c[d].getElementsByTagName(_.yb).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=IV(c.media.customData.playerConfiguration));if(b.m&&d){b.j&&(d=(yield Promise.resolve(b.j(d)))||d);d.ima&&(yield lW(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 _.Mr(b.m,d),yield _.Nr(b.m),d=b.m.getLoadedSource(),c.media.contentId=
85
- d.url,c.media.contentType=d.type,d.Wb&&(c.media.hlsVideoSegmentFormat=KV(d.Wb,_.N)),d.audioMimeType&&(c.media.hlsSegmentFormat=KV(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=DW().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))}_.Pr(this.m)}}B(a){if(0<this.h.size){const b=IV(a.data);this.h.forEach(c=>c(b))}}};_.z(DV,BW);BW.prototype.updateContentMetadata=BW.prototype.ki;BW.prototype.setContentMetadata=BW.prototype.Vb;BW.prototype.getContentMetadata=BW.prototype.zb;BW.prototype.isApiReady=BW.prototype.qc;
87
- BW.prototype.sendMessage=BW.prototype.sendMessage;BW.prototype.removeMessageListener=BW.prototype.removeMessageListener;BW.prototype.addMessageListener=BW.prototype.addMessageListener;BW.prototype.off=BW.prototype.off;BW.prototype.on=BW.prototype.on;BW.prototype.setLoadRequestDataInterceptor=BW.prototype.Yh;BW.prototype.setPlayerConfigInterceptor=BW.prototype.sd;BW.prototype.stop=BW.prototype.stop;BW.prototype.start=BW.prototype.start;BW.prototype.init=BW.prototype.init;BW.getInstance=CW;var AW=null;var UW=class{constructor(a){this.f=a;this.a=null;this.j=new _.xt;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(FV,{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(_.Ac,{adsTimeline:new PW(a.breaks)})));break;case "isPlayingBreak":a.value?JW(this,_.cc):(JW(this,_.hc),JW(this,_.xc),JW(this,_.ec));break;case "currentBreakClipNumber":0<=a.value&&(0<a.value&&(JW(this,_.hc),JW(this,_.xc)),JW(this,_.uc));break;case "isPaused":this.a.isPlayingBreak&&(a.value?JW(this,_.pc):JW(this,_.rc))}}};UW.prototype.getPosition=UW.prototype.getPosition;
90
- UW.prototype.setVolume=UW.prototype.setVolume;UW.prototype.getVolume=UW.prototype.getVolume;UW.prototype.skip=UW.prototype.skip;UW.prototype.pause=UW.prototype.pause;UW.prototype.resume=UW.prototype.resume;_.tp(new class{name(){return"clpp.cast.ads.SenderAdsManagerFactory"}a(a,b){return a.namespace()!==_.md?!1:!(!b||!b.ima)}create(a){return new UW(a.a)}});_.tp(new class{name(){return"clpp.cast.ads.AdsManagerFactory"}a(a,b){return CW().qc()?!(!b||!b.ima):!1}create(a){return new QW(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(_.ff));this.a(_.jp)}R(){this.a(_.ip)}$(){this.a(_.Zo)}Y(a){a.isBuffering?
54
+ this.a(_.cp):(a=this.player.isPaused()?_.ip:_.jp,this.a(a))}W(){this.j=1;this.player.trigger(new _.D(_.Bg))}V(){this.player.trigger(new _.D(_.Ag))}ba(){this.j=2}da(){this.a(_.hp)}M(a){const b=this.player.getStats();this.player.trigger(new _.D(_.Yc,{detail:{bandwidth:a.totalBitrate,width:b.width,height:b.height}}))}O(a){a=new _.I(_.F,7,7300,{detailedErrorCode:a.detailedErrorCode,error:a.error,reason:a.reason});this.player.trigger(new _.D(_.r,{detail:a}));this.a(_.$o)}};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}sb(){return"Google Cast Framework"}tb(){return cast.framework.VERSION}xb(){return 0}getId(){return""}getCreativeId(){return""}Sb(){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}Vb(){return!1}ub(){return this.a.clickThroughUrl||
55
+ null}getMediaUrl(){return this.a.contentUrl||this.a.contentId||null}ib(){return 0}hb(){return 0}Ta(){return 0}Ua(){switch(this.Ib()){case 0:return 0;case -1:return 2;default:return 1}}getPodIndex(){return this.j}Ib(){return this.f.position}wb(){return this.l}jb(){return this.h}getWrapperAdIds(){return[]}canSeek(){return!1}getWrapperAdSystems(){return[]}getWrapperCreativeIds(){return[]}Ub(){return null}};Z.prototype.getVideoElement=Z.prototype.Ub;Z.prototype.getWrapperCreativeIds=Z.prototype.getWrapperCreativeIds;
56
+ Z.prototype.getWrapperAdSystems=Z.prototype.getWrapperAdSystems;Z.prototype.canSeek=Z.prototype.canSeek;Z.prototype.getWrapperAdIds=Z.prototype.getWrapperAdIds;Z.prototype.getSequenceLength=Z.prototype.jb;Z.prototype.getPositionInSequence=Z.prototype.wb;Z.prototype.getPodTimeOffset=Z.prototype.Ib;Z.prototype.getPodIndex=Z.prototype.getPodIndex;Z.prototype.getPodType=Z.prototype.Ua;Z.prototype.getMediaBitrate=Z.prototype.Ta;Z.prototype.getMediaHeight=Z.prototype.hb;Z.prototype.getMediaWidth=Z.prototype.ib;
57
+ Z.prototype.getMediaUrl=Z.prototype.getMediaUrl;Z.prototype.getClickThroughUrl=Z.prototype.ub;Z.prototype.isBumper=Z.prototype.Vb;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;
58
+ Z.prototype.getSourceId=Z.prototype.Sb;Z.prototype.getCreativeId=Z.prototype.getCreativeId;Z.prototype.getId=Z.prototype.getId;Z.prototype.getTechnology=Z.prototype.xb;Z.prototype.getAdManagerVersion=Z.prototype.tb;Z.prototype.getAdManagerName=Z.prototype.sb;var HX=class{constructor(a){this.a=a}getCuePoints(){return this.a.map(a=>a.position)}Lb(){return!!this.a.find(a=>0===a.position)}Kb(){return!!this.a.find(a=>-1===a.position)}};HX.prototype.hasPostroll=HX.prototype.Kb;HX.prototype.hasPreroll=HX.prototype.Lb;HX.prototype.getCuePoints=HX.prototype.getCuePoints;var IX=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];fX().addEventListener(this.f,
59
+ this.j)}load(){const a=this;return _.x(function*(){bX&&(bX=!1,eX(a,0))})}start(){return _.x(function*(){fX().play()})}o(){}resume(){-1!==this.getPosition()&&fX().play()}pause(){-1!==this.getPosition()&&fX().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*(){fX().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=fX().getBreakManager();this.a.setPlayWatchedBreak(!0);a=this.a.getBreaks();this.m.trigger(new _.D(_.Ec,{adsTimeline:new HX(a)}));break;case cast.framework.events.EventType.BREAK_CLIP_LOADING:hX(this,_.rc,a);break;case cast.framework.events.EventType.BREAK_STARTED:hX(this,_.hc,a);break;case cast.framework.events.EventType.BREAK_ENDED:hX(this,_.ic,a);break;case cast.framework.events.EventType.BREAK_CLIP_STARTED:hX(this,_.yc,a);
61
+ break;case cast.framework.events.EventType.BREAK_CLIP_ENDED:a.endedReason===b.SKIPPED?(hX(this,_.xc,a),hX(this,_.Bc,a)):a.endedReason===b.STOPPED?hX(this,_.Bc,a):a.endedReason===b.END_OF_STREAM?(hX(this,_.lc,a),hX(this,_.Bc,a)):a.endedReason===b.ERROR&&eX(this,1);break;case cast.framework.events.EventType.PLAYING:hX(this,_.vc,a);break;case cast.framework.events.EventType.PAUSE:hX(this,_.tc,a);break;case cast.framework.events.EventType.BUFFERING:a.isBuffering?hX(this,_.jc,a):hX(this,_.vc,a)}}};
62
+ IX.prototype.getPosition=IX.prototype.getPosition;IX.prototype.setVolume=IX.prototype.setVolume;IX.prototype.getVolume=IX.prototype.getVolume;IX.prototype.skip=IX.prototype.skip;IX.prototype.pause=IX.prototype.pause;IX.prototype.resume=IX.prototype.resume;var bX=!1;var JX=class{constructor(a){this.Ya=a;this.a=this.f.bind(this)}init(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().addEventListener(iX(),this.a)}release(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().removeEventListener(iX(),this.a)}getTimelineCues(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager().getTimedMetadata().map(a=>jX(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
+ _.jg;break;case cast.framework.events.EventType.TIMED_METADATA_ENTER:b=_.kg;break;case cast.framework.events.EventType.TIMED_METADATA_EXIT:b=_.lg}b&&this.Ya(new _.D(b,{detail:jX(a.timedMetadataInfo)}))}else for(b of this.getTimelineCues())this.Ya(new _.D(_.jg,{detail:b}))}};var KX=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;kX().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;kX().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.l)}getVideoTracks(){return[]}getAudioTracks(){return this.h}na(){return this.j}oa(){return null}Ra(){const a=
64
+ this.ra();return a&&a.renditions[0]}Va(){const a=this.xa();return a&&a.renditions[0]}vb(){return null}Gb(){return null}Hb(){return null}Ia(){return null}ra(){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}xa(){let a=null;if(this.a){let b=this.a.getActiveIds()[0];typeof b===_.t&&(b=b.toString(),a=this.na().find(c=>c.id===b)||null)}return a}Db(){this.g.warn("Video tracks unavailable on Cast")}ya(a){a&&this.f&&
65
+ this.f.setActiveById(+a.id)}Xa(a){this.a&&(a?this.a.setActiveByIds([+a.id]):this.a.setActiveByIds([]))}nb(){this.g.warn("Video renditions unavailable on Cast")}Bb(a){this.ya(a&&a.track)}Cb(a){this.Xa(a&&a.track)}addTextTrack(a){const b=this;return _.x(function*(){var c=b.m.getConfiguration();if((c=yield BW(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]),mX(b)}catch(e){throw b.g.warn("failed on track",a),e;}}})}ua(){return!0}w(){this.f=kX().getAudioTracksManager();var a=this.f.getTracks();this.h=lX(_.M,a);mX(this);a=this.m.getConfiguration();nX(this,_.M,a.preferredAudioLanguage,a.preferredAudioRole);nX(this,_.L,a.preferredTextLanguage,a.preferredTextRole)}};KX.prototype.isAbrEnabled=KX.prototype.ua;
67
+ KX.prototype.addTextTrack=KX.prototype.addTextTrack;KX.prototype.setTextRendition=KX.prototype.Cb;KX.prototype.setAudioRendition=KX.prototype.Bb;KX.prototype.setVideoRendition=KX.prototype.nb;KX.prototype.setTextTrack=KX.prototype.Xa;KX.prototype.setAudioTrack=KX.prototype.ya;KX.prototype.setVideoTrack=KX.prototype.Db;KX.prototype.getTextTrack=KX.prototype.xa;KX.prototype.getAudioTrack=KX.prototype.ra;KX.prototype.getVideoTrack=KX.prototype.Ia;KX.prototype.getLoadingTextRendition=KX.prototype.Hb;
68
+ KX.prototype.getLoadingAudioRendition=KX.prototype.Gb;KX.prototype.getLoadingVideoRendition=KX.prototype.vb;KX.prototype.getTextRendition=KX.prototype.Va;KX.prototype.getAudioRendition=KX.prototype.Ra;KX.prototype.getVideoRendition=KX.prototype.oa;KX.prototype.getTextTracks=KX.prototype.na;KX.prototype.getAudioTracks=KX.prototype.getAudioTracks;KX.prototype.getVideoTracks=KX.prototype.getVideoTracks;var LX=class extends _.Bu{constructor(){super();this.g=new _.S(uW);this.h=this.w=_.Ml();this.A=null;this.l=-1;this.F=new _.Dr;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=oX();a.setMessageInterceptor(cast.framework.messages.MessageType.MEDIA_STATUS,this.H.bind(this));a.setMediaPlaybackInfoHandler(this.G.bind(this));this.a=new GX(this);this.a.init();this.j=new KX;this.j.initialize(this);this.o=new JX(c=>this.trigger(c));this.o.init()}unload(){const a=
69
+ cast.framework.messages.PlayerState,b=oX();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=_.Ml();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=oX();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot play during ads playout.");
70
+ a.play();return Promise.resolve()}pause(){const a=oX();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot pause during ads playout.");a.pause();return Promise.resolve()}isPaused(){return oX().getPlayerState()===cast.framework.messages.PlayerState.PAUSED}isEnded(){return oX().getPlayerState()===cast.framework.messages.PlayerState.IDLE}seek(a){const b=oX();if(null!==b.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject(mW);b.seek(a);return Promise.resolve()}getPosition(){return this.getMediaPosition()}setSeekInterceptor(){}setPlaybackSessionId(){}getBandwidthEstimate(){return null}getMediaPosition(){return oX().getCurrentTimeSec()}getDuration(){return this.getMediaDuration()}getMediaDuration(){const a=
71
+ oX().getDurationSec();return typeof a===_.t?-1===a?Infinity:a:-1}getPlaybackRate(){return oX().getPlaybackRate()}setPlaybackRate(a){if(0<a){const b=new cast.framework.messages.SetPlaybackRateRequestData;b.playbackRate=a;oX().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=oX().getMediaInformation();if(a){var b=oX().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,Oi:b,name:c}}return null}getDrmInfo(){return null}getPresentationStartTime(){return oX().getStartAbsoluteTime()}getSeekRange(){let a={start:0,end:this.getDuration()};if(this.isLive()){const b=oX().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():_.pv}getStats(){var a=_.Wo();if(this.f){a=oX().getStats();this.f.h=a.estimatedBandwidth||NaN;this.f.w=a.streamBandwidth||NaN;var b=this.f,c=a.height||NaN;b.A=a.width||NaN;b.j=c;b=this.f;c=typeof a.decodedFrames===_.t?a.decodedFrames:NaN;b.o=typeof a.droppedFrames===_.t?a.droppedFrames:NaN;b.l=c;a=this.f.getStats()}return a}isLive(){return Infinity===this.getDuration()}load(a){const b=
74
+ this;return _.x(function*(){b.f=new _.ov;b.a.l=b.f.a;b.A=_.mp(a);b.h=_.Ol(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:zW(b.h),local:!0};yield oX().load(d)}})}getBufferInfo(){this.g.warn(_.pa);return new _.Au}getTrackManager(){return this.j}getConfiguration(){return this.h}getSurface(){return this.B}getTimeline(){return null}setupPlaylist(){return Promise.reject(_.nb)}appendLoad(){return Promise.reject(_.nb)}seekWith(){return Promise.reject(_.nb)}setNetworkEngine(a){this.F=
75
+ a}setCmsdManager(){}getNetworkEngine(){return this.F}getSourceIndex(){return this.l}setSourceIndex(a){this.l=a}getPeriods(){return[]}namespace(){return uW}getTimelineCues(){return this.o&&this.o.getTimelineCues()||[]}getCueTimeline(){return null}resetAbr(){this.g.warn(qW)}onError(a){a=new _.D(_.r,{detail:a});this.trigger(a)}canPlay(){return _.Zk()?2:0}H(a){a=Object.assign({},a);a.customData||(a.customData={});a.customData.stats=zW(this.getStats());var b=oX(),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=oX().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=AW(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;rX(c,b);d=null;a.media.customData&&(d=AW(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 tX=class{constructor(){this.a=!1;this.g=new _.S(vW);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 _.Rt;this.l=null}init(a){a&&(this.f=new LX,_.Tr(a,this.f),this.m=a,this.o.on(window,"unload",()=>{const b=this;return _.x(function*(){b.m&&b.m.getState()!==_.gp&&(yield yW(b.m))})}))}start(){if(!this.a&&window.cast&&cast.framework&&cast.framework.CastReceiverContext){this.a=!0;var a=vX(),b=vX().getPlayerManager(),c=new cast.framework.CastReceiverOptions;
79
+ c.customNamespaces={};c.customNamespaces[wW]=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(wW,this.w)}}stop(){if(this.a){this.a=!1;this.o.release();const a=vX();vX().getPlayerManager().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.A);a.removeCustomMessageListener(wW,this.w);a.stop();this.m=this.f=null}}zd(a){this.j=a}ki(a){this.l=a}on(a,b){vX().addEventListener(a,b)}off(a,b){vX().removeEventListener(a,b)}addMessageListener(a){typeof a===_.me&&this.h.add(a)}removeMessageListener(a){typeof a===_.me&&this.h.delete(a)}sendMessage(a,
81
+ b){vX().sendCustomMessage(wW,b,zW(a))}vc(){return this.a}Fb(){return wX()}$b(a){xX(this,a)}Bi(a){const b=wX();let c=null;a?c=Object.assign({},b,a):c=b;xX(this,c)}F(a){a=a.trim();if(a.startsWith("#EXTM3U"))return zX(this,a);try{var b=(new DOMParser).parseFromString(a,_.hg)}catch(k){return a}var c=b.getElementsByTagName("MPD")[0];if(c){a=c;this.g.debug("Detected DASH, parsing");b=vX();c=a.getElementsByTagName("Period");for(var d=c.length-1;0<=d;--d){var e=c[d].getElementsByTagName(_.fa);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(_.Le);var h=e[f].getElementsByTagName(_.zb);for(let k=h.length-1;0<=k;--k){const l=h[k].getAttribute(_.Le)||g,m=h[k].getAttribute(_.Ad);let n=h[k].getAttribute(_.Ug)||void 0,q=h[k].getAttribute(_.ne)||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(_.zb).length||c[d].removeChild(e[f])}}c[d].getElementsByTagName(_.fa).length||a.removeChild(c[d])}return a=
83
+ (new XMLSerializer).serializeToString(a)}if(c=b.getElementsByTagName(_.Eb)[0]){a=c;this.g.debug("Detected Smooth, parsing");b=vX();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(_.eb)||void 0,h=e[f].getAttribute(_.db)||void 0,void 0!==g&&(g=+g),void 0!==h&&(h=+h),b.canDisplayType(_.Hg,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=AW(c.media.customData.playerConfiguration));if(b.m&&d){b.j&&(d=(yield Promise.resolve(b.j(d)))||d);d.ima&&(yield dX(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 _.ds(b.m,d),yield _.es(b.m),d=b.m.getLoadedSource(),c.media.contentId=
85
+ d.url,c.media.contentType=d.type,d.ac&&(c.media.hlsVideoSegmentFormat=CW(d.ac,_.N)),d.audioMimeType&&(c.media.hlsSegmentFormat=CW(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=vX().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))}_.gs(this.m)}}B(a){if(0<this.h.size){const b=AW(a.data);this.h.forEach(c=>c(b))}}};_.z(vW,tX);tX.prototype.updateContentMetadata=tX.prototype.Bi;tX.prototype.setContentMetadata=tX.prototype.$b;tX.prototype.getContentMetadata=tX.prototype.Fb;tX.prototype.isApiReady=tX.prototype.vc;
87
+ tX.prototype.sendMessage=tX.prototype.sendMessage;tX.prototype.removeMessageListener=tX.prototype.removeMessageListener;tX.prototype.addMessageListener=tX.prototype.addMessageListener;tX.prototype.off=tX.prototype.off;tX.prototype.on=tX.prototype.on;tX.prototype.setLoadRequestDataInterceptor=tX.prototype.ki;tX.prototype.setPlayerConfigInterceptor=tX.prototype.zd;tX.prototype.stop=tX.prototype.stop;tX.prototype.start=tX.prototype.start;tX.prototype.init=tX.prototype.init;tX.getInstance=uX;var sX=null;var MX=class{constructor(a){this.f=a;this.a=null;this.j=new _.Rt;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(xW,{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(_.Ec,{adsTimeline:new HX(a.breaks)})));break;case "isPlayingBreak":a.value?BX(this,_.hc):(BX(this,_.lc),BX(this,_.Bc),BX(this,_.ic));break;case "currentBreakClipNumber":0<=a.value&&(0<a.value&&(BX(this,_.lc),BX(this,_.Bc)),BX(this,_.yc));break;case "isPaused":this.a.isPlayingBreak&&(a.value?BX(this,_.tc):BX(this,_.vc))}}};MX.prototype.getPosition=MX.prototype.getPosition;
90
+ MX.prototype.setVolume=MX.prototype.setVolume;MX.prototype.getVolume=MX.prototype.getVolume;MX.prototype.skip=MX.prototype.skip;MX.prototype.pause=MX.prototype.pause;MX.prototype.resume=MX.prototype.resume;_.Ap(new class{name(){return"clpp.cast.ads.SenderAdsManagerFactory"}a(a,b){return a.namespace()!==_.td?!1:!(!b||!b.ima)}create(a){return new MX(a.a)}});_.Ap(new class{name(){return"clpp.cast.ads.AdsManagerFactory"}a(a,b){return uX().vc()?!(!b||!b.ima):!1}create(a){return new IX(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 VU="Ad Error",WU="onAdBreakStarted()",XU="onAdBreakStopped()",YU=function(a){var b=_.el();let c=Conviva.Constants.DeviceType.DESKTOP,d=Conviva.Constants.DeviceCategory.WEB;const e=b.os;b=b.osVersion.name;let f="";_.Qk()&&(f="Apple");_.Pk()?(f="Google",c=Conviva.Constants.DeviceType.SETTOP,d=Conviva.Constants.DeviceCategory.CHROMECAST):_.Rk()?(c=Conviva.Constants.DeviceType.MOBILE,/(android)/i.test(navigator.userAgent)?d=Conviva.Constants.DeviceCategory.ANDROID_DEVICE:_.Qk()&&(d=Conviva.Constants.DeviceCategory.APPLE_DEVICE)):
2
- _.Jk()||_.Gk()||_.Fk("Hisense")?(c=Conviva.Constants.DeviceType.SMARTTV,d=Conviva.Constants.DeviceCategory.SMART_TV,_.Jk()?(b="",f="LG",d=Conviva.Constants.DeviceCategory.LG_TV):_.Gk()?(f="Samsung",d=Conviva.Constants.DeviceCategory.SAMSUNG_TV):_.Fk("Hisense")&&(b="",f="Hisense")):_.Fk("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},ZU=function(a){return a?Conviva.Constants.StreamType.LIVE:Conviva.Constants.StreamType.VOD},$U=function(a){return 0===a?"Pre-roll":-1===a?"Post-roll":"Mid-roll"},bV=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
- ZU(!!d);e[Conviva.Constants.ASSET_NAME]=VU;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"]=aV(a.getId()),e["c3.ad.creativeId"]=aV(a.getCreativeId()),e["c3.ad.system"]=aV(a.getAdSystem()),e["c3.ad.mediaFileApiFramework"]=aV(a.getApiFramework()),e["c3.ad.advertiser"]=aV(a.getAdvertiserName()),e["c3.ad.position"]=$U(a.getPodIndex()),e["c3.ad.technology"]=0===a.qb()?Conviva.Constants.AdType.CLIENT_SIDE:
5
- Conviva.Constants.AdType.SERVER_SIDE,e["c3.ad.adManagerName"]=aV(a.lb()),e["c3.ad.adManagerVersion"]=aV(a.nb()),e["c3.ad.advertiserCategory"]=aV(null),e["c3.ad.advertiserId"]=aV(null),e["c3.ad.breakId"]=aV(null),e["c3.ad.campaignName"]=aV(null),e["c3.ad.category"]=aV(null),e["c3.ad.classification"]=aV(null),e["c3.ad.creativeName"]=aV(null),e["c3.ad.sequence"]=aV(a.Db()),e["c3.ad.sessionStartEvent"]=aV(null),e["c3.ad.unitName"]=aV(null),e["c3.ad.dayPart"]=aV(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"]=aV(b),e["c3.ad.firstAdSystem"]=aV(c),e["c3.ad.firstCreativeId"]=aV(a));return e},aV=function(a){return a?""+a:"NA"},fV=function(a){a.f.on(a.m,_.cc,a.C.bind(a));a.f.on(a.m,_.ec,a.F.bind(a));a.f.on(a.m,_.uc,a.L.bind(a));a.f.on(a.m,_.qc,a.l.bind(a));a.f.on(a.m,_.pc,a.l.bind(a));a.f.on(a.m,_.rc,a.l.bind(a));a.f.on(a.m,_.fc,a.l.bind(a));a.f.on(a.m,_.xc,a.M.bind(a));
7
- a.f.on(a.m,_.tc,a.K.bind(a));a.f.on(a.m,_.gc,a.G.bind(a));a.f.on(a.m,_.mc,a.I.bind(a));a.f.on(a.m,_.nc,a.J.bind(a));a.f.on(a.m,_.ic,a.H.bind(a));a.f.on(a.m,_.oc,a.S.bind(a));a.f.on(a.m,_.yc,a.O.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=VU}null===a.a&&cV(a,null);a.a.reportAdError(c,b.FATAL);a.h=!0;a.g.debug("Ad Playback Failure");
8
- dV(a,eV,c)}})},dV=function(a,b,c=VU){if(a.a){a.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED);switch(b){case eV:a.a.reportAdFailed(c,bV(null,a.B,a.A));break;case gV:a.a.reportAdSkipped();break;default:a.a.reportAdEnded()}a.a.release();a.a=null;a.j=!1}},cV=function(a,b){if(!a.o){a.h=!1;try{if(a.a=Conviva.Analytics.buildAdAnalytics(a.R()),b){const c=bV(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)}}},hV=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(YU(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]=_.qa;b[Conviva.Constants.FRAMEWORK_VERSION]=_.ea;a.a.setPlayerInfo(b)},iV=function(a){return a.m.getConfiguration().autoplay||!1},kV=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 _.sm(b.url);b&&(f[Conviva.Constants.ASSET_NAME]=b.name||"N/A",f[Conviva.Constants.STREAM_URL]=_.Tj(g));f[Conviva.Constants.PLAYER_NAME]=c.playerName||_.qa;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(jV(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.If(h.args)}));a.j=[]}},lV=function(a){if(!a.l&&a.a){const b=ZU(a.m.isLive()),c={};c[Conviva.Constants.IS_LIVE]=b;c[Conviva.Constants.DURATION]=a.m.getDuration();a.a.setContentInfo(c)}},jV=function(a){return null!==a.a&&a.C},mV=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)},oV=function(a,b){const c=b.getConfiguration();a.a=!_.B(c.conviva)&&typeof c.conviva===_.Ke;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),nV(b,a)):b.namespace()===_.md&&(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.")},pV=function(a){const b=[];typeof a===_.Ke&&(a.customerKey||b.push("customerKey"),a.viewerId||b.push("viewerId"));if(0<b.length)throw new _.H(1,9,9001,{missingKeys:b});},nV=function(a,b){a.trigger(new _.E(_.r,{detail:b}))};var rV=class{constructor(a,b){this.m=a;this.R=b;this.B="";this.A=_.qa;this.g=new _.S("clpp.conviva.ad");this.f=new _.xt;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||_.qa;fV(this)}release(){this.g.debug("Release Ad Insights");this.w?this.g.debug(_.ia):(_.Ah(this.f),this.a&&dV(this,qV),this.f.release(),this.w=!0,this.j=this.h=!1)}destroy(){this.g.debug(_.Jd);this.o?this.g.debug(_.ha):this.o=!0}C(){this.g.debug(WU)}F(){this.g.debug(XU)}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"),cV(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.bb(),a.ab());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 _.pc:b(Conviva.Constants.PlayerState.PAUSED);break;case _.fc:b(Conviva.Constants.PlayerState.BUFFERING)}}}M(){this.g.debug("onAdStopped()");this.a&&!this.h&&dV(this,qV)}K(){this.g.debug("onAdSkipped()");this.a&&dV(this,gV)}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;cV(this,b)};if(-1!==b.getPodIndex()||this.m.getPosition()>=this.m.getDuration()-5)c();else this.f.on(this.m,_.bg,()=>{this.m.getPosition()>=this.m.getDuration()-5&&(this.f.off(this.m,_.bg),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)}},gV=0,qV=1,eV=2;var sV=class{constructor(a,b){this.m=a;this.f=new _.xt;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=_.$g(b),this.K=c,this.m=a,hV(this,this.F),this.f.on(this.m,_.Ze,this.aa.bind(this)),this.f.on(this.m,_.Sf,this.X.bind(this)),this.f.on(this.m,_.Tc,this.L.bind(this)),this.f.on(this.m,_.lg,this.W.bind(this)),this.f.on(this.m,
19
- _.kg,this.V.bind(this)),this.f.on(this.m,_.cc,this.R.bind(this)),this.f.on(this.m,_.ec,this.S.bind(this)),this.f.on(this.m,_.Ac,this.Z.bind(this)),this.f.on(this.m,_.Sc,this.da.bind(this)),this.f.on(this.m,_.r,this.M.bind(this)),iV(this)&&(this.g.debug("Start a new session: A new video starts in autoplay."),kV(this)))}release(){this.g.debug("Release conviva");this.G?this.g.debug(_.ia):(_.Ah(this.f),jV(this)||this.o||!iV(this)||this.a&&this.a.reportPlaybackFailed("Exit Before Video Start"),jV(this)&&
20
- mV(this),this.a=null,this.G=!0)}destroy(){this.g.debug(_.Jd);this.l?this.g.debug(_.ha):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}aa(){this.g.debug("onPlayRequest()");jV(this)||iV(this)?jV(this)&&this.A&&!this.h&&(this.g.debug("Resuming VST monitoring ..."),jV(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
- kV(this))}X(a){this.g.debug(_.Qe);const b=c=>{if(this.o&&(this.g.debug("Creating conviva session (On Seek / Replay)"),hV(this,this.F),kV(this),lV(this),jV(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)}jV(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,c)};switch(a.detail.currentState){case _.ap:b(Conviva.Constants.PlayerState.PLAYING);
22
- break;case _.$o:b(Conviva.Constants.PlayerState.PAUSED);break;case _.Uo:b(Conviva.Constants.PlayerState.BUFFERING);break;case _.Qo:this.g.debug("onVideoEnded()"),jV(this)&&(this.w&&this.w.Eb()?(this.g.debug("Waiting for postroll Ad before terminating session"),this.J=!0):mV(this))}}L(a){this.g.debug(_.Le);if(jV(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({If:this.L.bind(this),args:a})}W(){this.g.debug("onSeeking()");jV(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)}V(){this.g.debug("onSeeked()");jV(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(WU);
24
- var b=a.ad;a=0===b.Ra();const c=$U(b.getPodIndex());jV(this)||iV(this)||!a||kV(this);if(jV(this)){a=0===b.qb()?Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE;let d=0;const e={};1===b.cb()&&(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||_.Pk()?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(XU);
25
- jV(this)&&this.B&&(this.a.reportAdBreakEnded(),this.B=!1,this.J&&mV(this))}M(a){this.g.debug(_.Ne);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,jV(this)||kV(this));jV(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,mV(this))):this.j.push({If:this.M.bind(this),args:a})}}da(){this.g.debug("onAutoPlayBlocked()");jV(this)&&(this.g.debug("Auto-play blocked. Pausing VST monitoring."),this.A=!0,jV(this)&&this.h&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_STARTED),this.h=!1))}};var tV=class{constructor(){this.h=this.f=null;this.a=!1;this.g=new _.S("clpp.conviva")}onPlayerCreated(a){this.f=new sV(a,this.g)}onContentWillLoad(a,b){oV(this,a);if(this.a){var c=a.getConfiguration();c=_.$g(c.conviva||{});try{pV(c);const d=c.enableAdInsights||!1;this.f.initialize(a,c,b);d&&(this.h=new rV(a,()=>this.f.a),this.h.initialize(c))}catch(d){d instanceof _.H?nV(a,d):nV(a,new _.H(1,9,9002,d,d))}}}onContentLoaded(){this.a&&lV(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}};_.z("clpp.conviva.ConvivaPlugin",tV);tV.prototype.reportAppEvent=tV.prototype.reportAppEvent;tV.Id="conviva";_.ur(new class{create(){return new tV}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var NV="Ad Error",OV="onAdBreakStarted()",PV="onAdBreakStopped()",QV=function(a){var b=_.ol();let c=Conviva.Constants.DeviceType.DESKTOP,d=Conviva.Constants.DeviceCategory.WEB;const e=b.os;b=b.osVersion.name;let f="";_.$k()&&(f="Apple");_.Zk()?(f="Google",c=Conviva.Constants.DeviceType.SETTOP,d=Conviva.Constants.DeviceCategory.CHROMECAST):_.al()?(c=Conviva.Constants.DeviceType.MOBILE,/(android)/i.test(navigator.userAgent)?d=Conviva.Constants.DeviceCategory.ANDROID_DEVICE:_.$k()&&(d=Conviva.Constants.DeviceCategory.APPLE_DEVICE)):
2
+ _.Tk()||_.Qk()||_.Pk("Hisense")?(c=Conviva.Constants.DeviceType.SMARTTV,d=Conviva.Constants.DeviceCategory.SMART_TV,_.Tk()?(b="",f="LG",d=Conviva.Constants.DeviceCategory.LG_TV):_.Qk()?(f="Samsung",d=Conviva.Constants.DeviceCategory.SAMSUNG_TV):_.Pk("Hisense")&&(b="",f="Hisense")):_.Pk("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},RV=function(a){return a?Conviva.Constants.StreamType.LIVE:Conviva.Constants.StreamType.VOD},SV=function(a){return 0===a?"Pre-roll":-1===a?"Post-roll":"Mid-roll"},UV=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
+ RV(!!d);e[Conviva.Constants.ASSET_NAME]=NV;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"]=TV(a.getId()),e["c3.ad.creativeId"]=TV(a.getCreativeId()),e["c3.ad.system"]=TV(a.getAdSystem()),e["c3.ad.mediaFileApiFramework"]=TV(a.getApiFramework()),e["c3.ad.advertiser"]=TV(a.getAdvertiserName()),e["c3.ad.position"]=SV(a.getPodIndex()),e["c3.ad.technology"]=0===a.xb()?Conviva.Constants.AdType.CLIENT_SIDE:
5
+ Conviva.Constants.AdType.SERVER_SIDE,e["c3.ad.adManagerName"]=TV(a.sb()),e["c3.ad.adManagerVersion"]=TV(a.tb()),e["c3.ad.advertiserCategory"]=TV(null),e["c3.ad.advertiserId"]=TV(null),e["c3.ad.breakId"]=TV(null),e["c3.ad.campaignName"]=TV(null),e["c3.ad.category"]=TV(null),e["c3.ad.classification"]=TV(null),e["c3.ad.creativeName"]=TV(null),e["c3.ad.sequence"]=TV(a.wb()),e["c3.ad.sessionStartEvent"]=TV(null),e["c3.ad.unitName"]=TV(null),e["c3.ad.dayPart"]=TV(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"]=TV(b),e["c3.ad.firstAdSystem"]=TV(c),e["c3.ad.firstCreativeId"]=TV(a));return e},TV=function(a){return a?""+a:"NA"},YV=function(a){a.f.on(a.m,_.hc,a.C.bind(a));a.f.on(a.m,_.ic,a.F.bind(a));a.f.on(a.m,_.yc,a.L.bind(a));a.f.on(a.m,_.uc,a.l.bind(a));a.f.on(a.m,_.tc,a.l.bind(a));a.f.on(a.m,_.vc,a.l.bind(a));a.f.on(a.m,_.jc,a.l.bind(a));a.f.on(a.m,_.Bc,a.M.bind(a));
7
+ a.f.on(a.m,_.xc,a.K.bind(a));a.f.on(a.m,_.kc,a.G.bind(a));a.f.on(a.m,_.qc,a.I.bind(a));a.f.on(a.m,_.rc,a.J.bind(a));a.f.on(a.m,_.mc,a.H.bind(a));a.f.on(a.m,_.sc,a.S.bind(a));a.f.on(a.m,_.Cc,a.O.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=NV}null===a.a&&VV(a,null);a.a.reportAdError(c,b.FATAL);a.h=!0;a.g.debug("Ad Playback Failure");
8
+ WV(a,XV,c)}})},WV=function(a,b,c=NV){if(a.a){a.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED);switch(b){case XV:a.a.reportAdFailed(c,UV(null,a.B,a.A));break;case ZV:a.a.reportAdSkipped();break;default:a.a.reportAdEnded()}a.a.release();a.a=null;a.j=!1}},VV=function(a,b){if(!a.o){a.h=!1;try{if(a.a=Conviva.Analytics.buildAdAnalytics(a.R()),b){const c=UV(b,a.B,a.A,a.m.isLive()),d=String(b.tb()),e={};e[Conviva.Constants.FRAMEWORK_NAME]=b.sb();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)}}},$V=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(QV(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]=_.qa;b[Conviva.Constants.FRAMEWORK_VERSION]=_.ea;a.a.setPlayerInfo(b)},aW=function(a){return a.m.getConfiguration().autoplay||!1},cW=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 _.Am(b.url);b&&(f[Conviva.Constants.ASSET_NAME]=b.name||"N/A",f[Conviva.Constants.STREAM_URL]=_.fk(g));f[Conviva.Constants.PLAYER_NAME]=c.playerName||_.qa;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(bW(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.Pf(h.args)}));a.j=[]}},dW=function(a){if(!a.l&&a.a){const b=RV(a.m.isLive()),c={};c[Conviva.Constants.IS_LIVE]=b;c[Conviva.Constants.DURATION]=a.m.getDuration();a.a.setContentInfo(c)}},bW=function(a){return null!==a.a&&a.C},eW=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)},gW=function(a,b){const c=b.getConfiguration();a.a=!_.B(c.conviva)&&typeof c.conviva===_.Re;a.a?"undefined"===typeof window.Conviva?(a.g.warn("Conviva SDK is not loaded. Will do nothing."),a.a=!1,a=new _.I(1,9,9E3),fW(b,a)):b.namespace()===_.td&&(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.")},hW=function(a){const b=[];typeof a===_.Re&&(a.customerKey||b.push("customerKey"),a.viewerId||b.push("viewerId"));if(0<b.length)throw new _.I(1,9,9001,{missingKeys:b});},fW=function(a,b){a.trigger(new _.D(_.r,{detail:b}))};var jW=class{constructor(a,b){this.m=a;this.R=b;this.B="";this.A=_.qa;this.g=new _.S("clpp.conviva.ad");this.f=new _.Rt;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||_.qa;YV(this)}release(){this.g.debug("Release Ad Insights");this.w?this.g.debug(_.ia):(_.Sh(this.f),this.a&&WV(this,iW),this.f.release(),this.w=!0,this.j=this.h=!1)}destroy(){this.g.debug(_.Qd);this.o?this.g.debug(_.ha):this.o=!0}C(){this.g.debug(OV)}F(){this.g.debug(PV)}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"),VV(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.ib(),a.hb());this.a.reportAdMetric(Conviva.Constants.Playback.BITRATE,a.Ta())}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 _.uc:case _.vc:b(Conviva.Constants.PlayerState.PLAYING);
16
+ break;case _.tc:b(Conviva.Constants.PlayerState.PAUSED);break;case _.jc:b(Conviva.Constants.PlayerState.BUFFERING)}}}M(){this.g.debug("onAdStopped()");this.a&&!this.h&&WV(this,iW)}K(){this.g.debug("onAdSkipped()");this.a&&WV(this,ZV)}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;VV(this,b)};if(-1!==b.getPodIndex()||this.m.getPosition()>=this.m.getDuration()-5)c();else this.f.on(this.m,_.ng,()=>{this.m.getPosition()>=this.m.getDuration()-5&&(this.f.off(this.m,_.ng),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)}},ZV=0,iW=1,XV=2;var kW=class{constructor(a,b){this.m=a;this.f=new _.Rt;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=_.lh(b),this.K=c,this.m=a,$V(this,this.F),this.f.on(this.m,_.ff,this.ba.bind(this)),this.f.on(this.m,_.Zf,this.Y.bind(this)),this.f.on(this.m,_.Yc,this.L.bind(this)),this.f.on(this.m,_.Bg,this.W.bind(this)),this.f.on(this.m,
19
+ _.Ag,this.V.bind(this)),this.f.on(this.m,_.hc,this.R.bind(this)),this.f.on(this.m,_.ic,this.S.bind(this)),this.f.on(this.m,_.Ec,this.$.bind(this)),this.f.on(this.m,_.Xc,this.da.bind(this)),this.f.on(this.m,_.r,this.M.bind(this)),aW(this)&&(this.g.debug("Start a new session: A new video starts in autoplay."),cW(this)))}release(){this.g.debug("Release conviva");this.G?this.g.debug(_.ia):(_.Sh(this.f),bW(this)||this.o||!aW(this)||this.a&&this.a.reportPlaybackFailed("Exit Before Video Start"),bW(this)&&
20
+ eW(this),this.a=null,this.G=!0)}destroy(){this.g.debug(_.Qd);this.l?this.g.debug(_.ha):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}ba(){this.g.debug("onPlayRequest()");bW(this)||aW(this)?bW(this)&&this.A&&!this.h&&(this.g.debug("Resuming VST monitoring ..."),bW(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
+ cW(this))}Y(a){this.g.debug(_.Xe);const b=c=>{if(this.o&&(this.g.debug("Creating conviva session (On Seek / Replay)"),$V(this,this.F),cW(this),dW(this),bW(this))){var d=this.m.getTrackManager();d=d.oa()||d.vb();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)}bW(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,c)};switch(a.detail.currentState){case _.jp:b(Conviva.Constants.PlayerState.PLAYING);
22
+ break;case _.ip:b(Conviva.Constants.PlayerState.PAUSED);break;case _.cp:b(Conviva.Constants.PlayerState.BUFFERING);break;case _.Zo:this.g.debug("onVideoEnded()"),bW(this)&&(this.w&&this.w.Kb()?(this.g.debug("Waiting for postroll Ad before terminating session"),this.J=!0):eW(this))}}L(a){this.g.debug(_.Se);if(bW(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({Pf:this.L.bind(this),args:a})}W(){this.g.debug("onSeeking()");bW(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)}V(){this.g.debug("onSeeked()");bW(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_ENDED)}$(a){this.g.debug("onAdsTimelineChanged()");if(a=a.adsTimeline)this.w=a}R(a){this.g.debug(OV);
24
+ var b=a.ad;a=0===b.Ua();const c=SV(b.getPodIndex());bW(this)||aW(this)||!a||cW(this);if(bW(this)){a=0===b.xb()?Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE;let d=0;const e={};1===b.jb()&&(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||_.Zk()?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(PV);
25
+ bW(this)&&this.B&&(this.a.reportAdBreakEnded(),this.B=!1,this.J&&eW(this))}M(a){this.g.debug(_.Ue);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,bW(this)||cW(this));bW(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,eW(this))):this.j.push({Pf:this.M.bind(this),args:a})}}da(){this.g.debug("onAutoPlayBlocked()");bW(this)&&(this.g.debug("Auto-play blocked. Pausing VST monitoring."),this.A=!0,bW(this)&&this.h&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_STARTED),this.h=!1))}};var lW=class{constructor(){this.h=this.f=null;this.a=!1;this.g=new _.S("clpp.conviva")}onPlayerCreated(a){this.f=new kW(a,this.g)}onContentWillLoad(a,b){gW(this,a);if(this.a){var c=a.getConfiguration();c=_.lh(c.conviva||{});try{hW(c);const d=c.enableAdInsights||!1;this.f.initialize(a,c,b);d&&(this.h=new jW(a,()=>this.f.a),this.h.initialize(c))}catch(d){d instanceof _.I?fW(a,d):fW(a,new _.I(1,9,9002,d,d))}}}onContentLoaded(){this.a&&dW(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}};_.z("clpp.conviva.ConvivaPlugin",lW);lW.prototype.reportAppEvent=lW.prototype.reportAppEvent;lW.Id="conviva";_.Mr(new class{create(){return new lW}});};f.call(g, window);