@castlabs/prestoplay 6.12.0 → 6.13.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 (62) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +6 -6
  5. package/cjs/cl.cast.js +106 -106
  6. package/cjs/cl.conviva.js +33 -33
  7. package/cjs/cl.core.js +504 -505
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +72 -72
  10. package/cjs/cl.externs.js +53 -50
  11. package/cjs/cl.freewheel.js +22 -22
  12. package/cjs/cl.hls.js +66 -66
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +30 -30
  15. package/cjs/cl.ima.js +21 -21
  16. package/cjs/cl.mse.js +269 -267
  17. package/cjs/cl.muxdata.js +14 -14
  18. package/cjs/cl.onboard.js +3 -3
  19. package/cjs/cl.persistent.js +13 -13
  20. package/cjs/cl.playlist.js +6 -6
  21. package/cjs/cl.simid.js +15 -15
  22. package/cjs/cl.smooth.js +71 -71
  23. package/cjs/cl.thumbnails.js +26 -24
  24. package/cjs/cl.tizen.js +68 -68
  25. package/cjs/cl.ttml.js +28 -28
  26. package/cjs/cl.verimatrix.js +5 -5
  27. package/cjs/cl.vimond.js +13 -13
  28. package/cjs/cl.vr.js +19 -19
  29. package/cjs/cl.vtt.js +14 -14
  30. package/cjs/cl.youbora.js +16 -16
  31. package/cjs/polyfill.min.js +26 -23
  32. package/cl.adobe.js +3 -3
  33. package/cl.airplay.js +3 -3
  34. package/cl.broadpeak.js +5 -5
  35. package/cl.cast.js +83 -83
  36. package/cl.conviva.js +27 -27
  37. package/cl.core.js +416 -416
  38. package/cl.crypto.js +9 -9
  39. package/cl.dash.js +67 -67
  40. package/cl.externs.js +53 -50
  41. package/cl.freewheel.js +15 -15
  42. package/cl.hls.js +69 -69
  43. package/cl.hlssmpte.js +5 -5
  44. package/cl.htmlcue.js +26 -26
  45. package/cl.ima.js +15 -15
  46. package/cl.mse.js +232 -231
  47. package/cl.muxdata.js +12 -12
  48. package/cl.onboard.js +4 -4
  49. package/cl.persistent.js +10 -10
  50. package/cl.playlist.js +5 -5
  51. package/cl.simid.js +13 -13
  52. package/cl.smooth.js +59 -59
  53. package/cl.thumbnails.js +19 -17
  54. package/cl.tizen.js +57 -57
  55. package/cl.ttml.js +22 -22
  56. package/cl.verimatrix.js +4 -4
  57. package/cl.vimond.js +8 -8
  58. package/cl.vr.js +14 -14
  59. package/cl.vtt.js +12 -12
  60. package/cl.youbora.js +13 -13
  61. package/package.json +1 -1
  62. package/typings.d.ts +82 -13
package/cl.cast.js CHANGED
@@ -1,88 +1,88 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var QO="Cannot seek during ads playout.",RO="Cannot switch track",SO="Media session does not exist.",TO="No receivers available",UO="Reset ABR functionality not available on cast.",VO="SDK not yet ready",WO="Sender is destroyed.",XO="clpp.cast.CastProxy",YO="clpp.cast.Player",ZO="clpp.cast.Receiver",$O="urn:x-cast:castlabs",bP="urn:x-cast:com.google.cast.media",cP=function(a){return _.x(function*(){yield _.so(a,_.xe);yield _.so(a,_.we)})},dP=function(a){return JSON.stringify(a,(b,c)=>
2
- {if("license"!==b&&typeof c!==_.Od){if(c instanceof Event){b={};for(const d in c){const e=c[d];typeof e===_.te?"detail"===d&&(b[d]=e):d in Event||(b[d]=e)}return b}return typeof c===_.r?isNaN(c)?"NaN":isFinite(c)?c:0>c?"-Infinity":"Infinity":c}})},eP=function(a){if(typeof a!==_.tf)return a;try{return JSON.parse(a,(b,c)=>"NaN"===c?NaN:"-Infinity"===c?-Infinity:"Infinity"===c?Infinity:c)}catch(b){return a}},fP=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=_.ej(d,a.mimeType,g);f&&g&&(h=_.si(a.url),(h=yield c.fetch(h).P)&&h.data&&(e=f.a(_.J(h.data)),e={url:URL.createObjectURL(new Blob([e])),kind:a.kind,language:a.language,label:a.label,mimeType:g}));return e})},gP=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 _.Of:return d.FMP4;case _.Nf:return b===_.M?d.MPEG2_TS:c.TS;case _.Dc:return c.AAC;case _.Ec:return c.AC3;case _.Fc:return c.E_AC3;case "audio/mpeg":return c.MP3;case _.Gc:return c.FMP4}},iP=function(a){a=void 0===a?hP: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}},jP=function(a,b){return a.g.filter(c=>c.type===b)},lP=function(a,b){const c=kP(a);return jP(a,b).find(d=>c.includes(d.id))||null},nP=function(a,b,c){const d=a.a.a;if(d)if(c){a.f[b]=c.renditions[0];c=[+c.id];if(b!==_.K){const e=a.pa();e&&c.push(+e.id)}c=new chrome.cast.media.EditTracksInfoRequest(c);
6
- d.editTracksInfo(c,()=>{a.f[b]=null;mP(a,b)},e=>{a.f[b]=null;a.h.debug(RO,e)})}else b===_.K&&(c=new chrome.cast.media.EditTracksInfoRequest([]),d.editTracksInfo(c,()=>{mP(a,b)},e=>{a.h.debug(RO,e)}))},kP=function(a){a=a.a?a.a.a:null;return(a?a.activeTrackIds||[]:[]).map(b=>b.toString())},mP=function(a,b){b===_.L?a.a.trigger(new _.F(_.ak)):b===_.K&&a.a.trigger(new _.F(_.bk))},qP=function(a){if(a)for(const b of oP)pP(b)},pP=function(a){if(!a.w&&window.chrome&&chrome.cast&&chrome.cast.isAvailable&&window.cast&&
7
- cast.framework&&cast.framework.CastContext&&a.V.length){a.w=!0;a.o.xe();var b=cast.framework.CastContext.getInstance(),c=new cast.framework.CastOptions;c.receiverApplicationId=a.V;c.autoJoinPolicy=chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED;b.setOptions(c);b.addEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.O);b.addEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.ba);rP&&a.o.ca(.02)}},sP=function(a){return _.x(function*(){oP.delete(a);if(a.w){a.w=!1;var b=
8
- cast.framework.CastContext.getInstance();b.removeEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.O);b.removeEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.ba)}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.T=null;a.Z=null})},tP=function(a){return _.x(function*(){a.kb()||(yield cast.framework.CastContext.getInstance().requestSession())})},vP=function(a,b,c){c=
9
- void 0===c?0:c;return _.x(function*(){var d=a.f.pa();d&&d.language&&(a.g.preferredTextLanguage=d.language);(d=a.f.oa())&&d.language&&(a.g.preferredAudioLanguage=d.language);yield uP(a,{source:a.getLoadedSource(),currentTime:c,isLive:a.isLive(),oe:a.getPresentationStartTime(),autoplay:b,Qa:a.g})})},uP=function(a,b){return _.x(function*(){var c=chrome.cast.media.StreamType;yield tP(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=gP(b.Eb,_.M);e.hlsSegmentFormat=gP(c,_.L);b.Qa&&(a.M&&(c=yield Promise.resolve(a.M(b.Qa)))&&(b.Qa=c),a.g=b.Qa,a.C=_.qn(a.g),a.B=a.C.findIndex(k=>k.url===b.source.url),b.Qa.remoteTextTracks&&(c=yield Promise.all(b.Qa.remoteTextTracks.map(a.Oa.bind(a))),e.tracks=c.filter(k=>k),b.Qa.remoteTextTracks=void 0),delete b.Qa.autoplay,b.Qa.startTime=null,e.customData={playerConfiguration:dP(b.Qa)});c=a.fb()||{};
11
- var f=wP(c.metadataType),g;typeof b.oe===_.r&&(g={metadataType:f,sectionStartAbsoluteTime:b.oe});var h;b.source.name&&(h={metadataType:f,title:b.source.name});c=xP(c);if(g=yP(Object.assign({},g,h,c)))e.metadata=g;e=new chrome.cast.media.LoadRequest(e);typeof b.autoplay===_.Kc&&(e.autoplay=b.autoplay);typeof b.currentTime===_.r&&(e.currentTime=b.currentTime);yield d.loadMedia(e)}})},yP=function(a){if(!a)return null;a:{var b=a.metadataType;const c=Object.entries(zP);for(const d of c){const [e,f]=d;
12
- if(f===b){b=e;break a}}b=null}if(!b)return null;b=iP(zP[b]);return Object.assign(b,a)},wP=function(a){var b=void 0===b?hP:b;return Object.values(zP).includes(a)?a:b},xP=function(a){const b={};for(const c in a)void 0!==a[c]&&(b[c]=a[c]);return b},BP=function(a,b){AP(a,b.getMediaSession());b.addEventListener(cast.framework.SessionEventType.MEDIA_SESSION,a.W);b.addMessageListener($O,a.R)},CP=function(a){const b=a.getPosition();a.a&&a.a.media?(a=a.a.media.startAbsoluteTime,a=typeof a!==_.r?null:a):a=
13
- null;a=null===a?null:a+b;return null===a?b:a},AP=function(a,b){a.a=b;a.a&&(a.H.release(),a.G=null,a.l=null,a.l=new cast.framework.RemotePlayer,a.G=new cast.framework.RemotePlayerController(a.l),a.H.on(a.G,cast.framework.RemotePlayerEventType.CURRENT_TIME_CHANGED,a.ja.bind(a)),a.f&&a.f.load(),a.j&&a.j.init(),a.trigger(new _.F(_.fe)))},FP=function(a){return new DP(a.g,()=>{a.trigger(new _.F(_.Qc))},(b,c)=>{{const d=a.f.getConfiguration();d.source=c.source;d.autoplay=!1;d.startTime=c.currentTime?Math.max(c.currentTime-
14
- 1,0):null;d.ima&&d.startTime&&(d.ima.playAdsAfterTime=d.startTime);c.He&&(d.preferredAudioLanguage=c.He);c.yf&&(d.preferredTextLanguage=c.yf);_.uo(a.f,null);a.trigger(new _.F("castingended"));a.j(b,d)}},()=>EP(a))},EP=function(a){return _.x(function*(){a.trigger(new _.F(_.Pc));a.f.a!==a.a&&a.f&&a.a&&(yield a.f.release(),_.uo(a.f,a.a))})},IP=function(a,b,c){return _.x(function*(){var d=b.adTagUrl;if(d)try{GP=!1;const e=_.si(d),f=yield c.fetch(e).P;if(f&&f.data){const g=_.Ph(f.data),h=(new DOMParser).parseFromString(g,
15
- _.zf);if(h.getElementsByTagName("vmap:VMAP").length)_.C("VMAP detected."),a.vmapAdsRequest=HP(g);else if(h.getElementsByTagName("VAST").length){_.C("VAST detected.");{d=g;const k=new cast.framework.messages.BreakClip("bc1");k.vastAdsRequest=HP(d);const l=new cast.framework.messages.Break("b1",[k.id],0);a.breakClips=[k];a.breaks=[l]}}else _.C("Unsupported schema."),GP=!0}}catch(e){_.C("Failed to fetch an ad",e),GP=!0}})},HP=function(a){const b=new cast.framework.messages.VastAdsRequest;b.adsResponse=
16
- a;return b},JP=function(a,b){b=new _.H(1,10,10003,{errorType:b});a.m.onError(b)},KP=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},MP=function(a,b,c){if(c instanceof cast.framework.events.BreaksEvent||-1!==a.getPosition()){var d=null;(c=LP(a,c))&&(d={ad:c});a.m.trigger(new _.F(b,d))}},LP=function(a,b){let c=null;if(a.a&&b instanceof cast.framework.events.BreaksEvent){let d=null,e=null,f;typeof b.breakClipId===_.tf&&(d=a.a.getBreakClipById(b.breakClipId));typeof b.breakId===
17
- _.tf&&(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},NP=function(){return[cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,cast.framework.events.EventType.TIMED_METADATA_CHANGED,cast.framework.events.EventType.TIMED_METADATA_ENTER,cast.framework.events.EventType.TIMED_METADATA_EXIT]},OP=function(a){const b=
18
- a.dashTimedMetadata;let c=_.Hf;b&&(c=b.schemeIdUri);return{type:c.startsWith(_.Gf)?_.Wg:_.Ug,schemeIdUri:c,id:a.id||"",startTime:a.startTime,endTime:a.endTime,value:b&&b.value||"",eventElement:b&&b.eventElement}},PP=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},RP=function(a){a.a=PP().getTextTracksManager();const b=a.a.getTracks();a.j=QP(_.K,b)},QP=function(a,b){const c=[];for(const d of b)b=new _.Ii(d.trackId.toString(),a),b.roles=d.roles||[],b.kind=d.subtype||
19
- 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 _.Si(b.id,b)),c.push(b);return c},SP=function(a,b,c,d){c=_.ch(c).filter(g=>g);var e=!1;let f=[];b===_.L?f=a.getAudioTracks():b===_.K&&(f=a.ka());if(c=c.find(g=>{const h=_.Ch(g);return f.some(k=>{k=_.Ch(k.language||"");return _.Dh(h,k)})})){const g=
20
- _.Ch(c);c=f.filter(h=>{h=_.Ch(h.language||"");return _.Dh(g,h)});f=c.length?c:f;e=e||!!c.length}_.Yh(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.h.info("Will select track",e),b===_.L?a.sa(e):b===_.K&&a.Fa(e))},TP=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},WP=function(a,b){var c=()=>{b.protectionSystem=cast.framework.ContentProtection.NONE;b.licenseUrl=void 0;b.licenseRequestHandler=void 0;b.licenseHandler=void 0};
21
- if(a&&a.drm){var d=a.drm,e=_.Hk(d);if(e){var f=[_.pd];_.qn(a)[0].type!==_.Bc&&f.unshift(_.sd);d.preferredDrmSystem===_.pd&&f.reverse();for(var g,h;f.length&&!h;)g=f.shift(),h=e.Ra[g];h?(c=g===_.sd?cast.framework.ContentProtection.WIDEVINE:g===_.pd?cast.framework.ContentProtection.PLAYREADY:void 0,b.protectionSystem=c,b.licenseUrl=h.licenseUrl,c={ldlDelay:0,customData:{}},UP(b,h,a,c),VP(b,h,a,c)):c()}else c()}else c()},UP=function(a,b,c,d){b.modifiers.licenseRequest?a.licenseRequestHandler=e=>{const f=
22
- _.si({method:"POST",uris:[e.url]});e.headers&&(f.headers=e.headers);f.body=e.content;f.allowCrossSiteCredentials=e.withCredentials;b.modifiers.licenseRequest(c,f,d);e.url=f.uris[0];e.headers=f.headers;e.content=f.body;e.withCredentials=f.allowCrossSiteCredentials}:a.licenseRequestHandler=void 0},VP=function(a,b,c,d){b.modifiers.licenseResponse?a.licenseHandler=(e,f)=>_.x(function*(){const g=_.ti(Object.assign({},f.headers),e.buffer,200,"");yield b.modifiers.licenseResponse(c,g,d);return _.J(g.data)}):
23
- a.licenseHandler=void 0},ZP=function(){return XP||(XP=new YP)},$P=function(){return cast.framework.CastReceiverContext.getInstance()},bQ=function(a,b){a.h.debug("Detected HLS, parsing");var c=cast.framework.messages.HlsVideoSegmentFormat;a=$P();var {hlsVideoSegmentFormat:d}=$P().getPlayerManager().getMediaInformation()||{};c=d===c.FMP4?_.Of:_.Nf;b=b.replace(/\r\n|\r(?=[^\n]|$)/gm,"\n");b=b.split(/\n+/m);d=[];let e=0;for(;e<b.length;){const f=b[e].trim();if(b[e].startsWith("#EXT-X-STREAM-INF")){const g=
24
- aQ(f,_.na),h=aQ(f,_.ub);let [k,l]=[];h&&([k,l]=h.split("x").map(m=>+m));if(!a.canDisplayType(c,g,k,l)){e+=2;continue}}d.push(f);++e}return d.join("\n")},aQ=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},dQ=function(a,b){let c=null;const d=cQ(a);d&&(c={ad:d});a.f.trigger(new _.F(b,c))},cQ=function(a){var b=null;if(a.a&&a.a.mediaInfo){b=a.a.mediaInfo;
25
- let c=null,d=null,e,f;const g=a.a.currentBreakClipNumber;b.breaks&&(c=b.breaks.find(h=>h.id===a.a.breakId)||null)&&(e=c.breakClipIds.length,f=0>=c.position?c.position:b.breaks.filter(h=>0<=h.position).sort((h,k)=>h.position-k.position).findIndex(h=>h===c));b.breakClips&&(d=b.breakClips.find(h=>h.id===a.a.breakClipId)||null);b=new Z(d,c,g,e,f)}return b},eQ=class{constructor(a,b){this.log=new _.R(b);this.player=a;this.l=null;this.g=_.kn;this.o=_.js;this.j=2;this.C=Date.now();this.B=-1}release(){this.a(_.kn)}destroy(){this.l=
26
- this.player=null;return Promise.resolve()}getState(){return this.g}onError(a){a.severity===_.G&&this.a(_.jn)}a(a){if(a!==this.g)if(this.g===_.jn&&a!==_.kn)this.log.debug("Player is in ERROR state and can not switch to",a);else{var b=Date.now();this.o=this.g;this.g=a;this.g===_.en?(this.B=b,this.player.trigger(new _.F(_.Mc,{detail:{bufferedTimeMS:-1,reason:this.j}}))):this.o===_.en&&this.player.trigger(new _.F(_.Lc,{detail:{bufferedTimeMS:b-this.B,reason:this.j}}));a={currentState:this.g,previousState:this.o,
27
- timeSinceLastStateChangeMS:b-this.C};this.C=b;this.l&&_.Tm(this.l,this.g);this.player.trigger(new _.F(_.qf,{detail:a}))}}};_.z("clpp.cast.CastUtils",class{});var hP=0,zP={GENERIC:hP,MOVIE:1,TV_SHOW:2,MUSIC_TRACK:3,PHOTO:4,AUDIOBOOK_CHAPTER:5};var fQ=class extends eQ{constructor(a){super(a,"clpp.cast.SenderStateManager");this.w=this.f=null;this.A=this.Bb.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)}Bb(){if(this.f&&
28
- 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(_.bn);break;case chrome.cast.media.IdleReason.ERROR:this.a(_.jn);break;default:this.a(_.kn)}break;case chrome.cast.media.PlayerState.PLAYING:this.a(_.nn);break;case chrome.cast.media.PlayerState.PAUSED:this.a(_.mn);break;case chrome.cast.media.PlayerState.BUFFERING:this.a(_.en)}}};var gQ=class extends _.S{constructor(){super();this.h=new _.R("clpp.cast.SenderTrackManager");this.a=null;this.g=[];this.f={}}initialize(a){this.a=a}release(){this.g=[];this.f={}}load(){this.release();var a=this.a.a;a&&(a=a.media)&&(this.g=(a=a.tracks)?a.map(b=>{switch(b.type){case chrome.cast.media.TrackType.VIDEO:var c=_.M;break;case chrome.cast.media.TrackType.AUDIO:c=_.L;break;case chrome.cast.media.TrackType.TEXT:c=_.K}c=new _.Ii(b.trackId.toString(),c);c.kind=b.subtype;c.language=b.language;
29
- c.label=b.name;c.src=b.trackContentId;c.mimeType=b.trackContentType;b.customData&&(c.src=b.customData.url||c.src,c.mimeType=b.customData.mimeType||c.mimeType);c.renditions.push(new _.Si(c.id,c));return c}):[],this.a.trigger(new _.F(_.Nr)))}destroy(){this.a=null}getVideoTracks(){return jP(this,_.M)}getAudioTracks(){return jP(this,_.L)}ka(){return jP(this,_.K)}ia(){const a=this.La();return a?a.renditions[0]:null}Ia(){const a=this.oa();return a?a.renditions[0]:null}Ja(){const a=this.pa();return a?a.renditions[0]:
30
- null}Ua(){return this.f[_.M]||null}gb(){return this.f[_.L]||null}hb(){return this.f[_.K]||null}La(){return lP(this,_.M)}oa(){return lP(this,_.L)}pa(){return lP(this,_.K)}Za(a){nP(this,_.M,a)}sa(a){nP(this,_.L,a)}Fa(a){nP(this,_.K,a)}Ya(a){this.Za(a&&a.track)}mb(a){this.sa(a&&a.track)}nb(a){this.Fa(a&&a.track)}addTextTrack(){return _.x(function*(){})}ma(){return!0}};gQ.prototype.isAbrEnabled=gQ.prototype.ma;gQ.prototype.addTextTrack=gQ.prototype.addTextTrack;gQ.prototype.setTextRendition=gQ.prototype.nb;
31
- gQ.prototype.setAudioRendition=gQ.prototype.mb;gQ.prototype.setVideoRendition=gQ.prototype.Ya;gQ.prototype.setTextTrack=gQ.prototype.Fa;gQ.prototype.setAudioTrack=gQ.prototype.sa;gQ.prototype.setVideoTrack=gQ.prototype.Za;gQ.prototype.getTextTrack=gQ.prototype.pa;gQ.prototype.getAudioTrack=gQ.prototype.oa;gQ.prototype.getVideoTrack=gQ.prototype.La;gQ.prototype.getLoadingTextRendition=gQ.prototype.hb;gQ.prototype.getLoadingAudioRendition=gQ.prototype.gb;gQ.prototype.getLoadingVideoRendition=gQ.prototype.Ua;
32
- gQ.prototype.getTextRendition=gQ.prototype.Ja;gQ.prototype.getAudioRendition=gQ.prototype.Ia;gQ.prototype.getVideoRendition=gQ.prototype.ia;gQ.prototype.getTextTracks=gQ.prototype.ka;gQ.prototype.getAudioTracks=gQ.prototype.getAudioTracks;gQ.prototype.getVideoTracks=gQ.prototype.getVideoTracks;var DP=class extends _.Pr{constructor(a,b,c,d){super();this.h=new _.R(_.dd);this.V=a;this.o=new _.kj(b);this.T=c;this.Z=d;this.g=this.I=_.lk();this.C=[];this.B=0;this.K=new _.lo;this.G=this.l=this.a=null;this.A=this.w=!1;this.aa="";this.fa=1E6;this.f=new gQ;this.f.initialize(this);this.j=new fQ(this);this.H=new _.br;this.J=null;this.F=new Set;this.O=this.ab.bind(this);this.ba=this.eb.bind(this);this.W=this.cb.bind(this);this.R=this.bb.bind(this);this.M=null;window.cast||Object.defineProperty(window,
33
- "cast",{get:()=>window.cast_,set:e=>{window.cast_=e;window.setTimeout(()=>{qP(!0)},0)}});pP(this);oP.add(this)}init(a,b){this.g=this.I=b}unload(){return new Promise((a,b)=>{this.f&&this.f.release();this.a&&!this.a.idleReason||a();this.a.stop(null,a,b)})}release(){return this.unload().then(()=>{this.j&&this.j.release()})}destroy(){return _.x(function*(){})}$c(a){this.M=a}cc(){return this.w}kb(){return this.A}Ud(){return this.aa}sendMessage(a,b){const c=this;return _.x(function*(){let d;const e=cast.framework.CastContext.getInstance().getCurrentSession();
34
- if(e)try{yield e.sendMessage(a,dP(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.cc())throw a.h.warn(VO),new _.H(1,8,8001,void 0);if(!rP)throw a.h.warn(TO),new _.H(1,8,8002,void 0);if(a.kb())throw a.h.warn("Already casting"),new _.H(1,8,8003,void 0);try{yield tP(a)}catch(b){const c={};b instanceof chrome.cast.Error?(c.detailedErrorCode=b.code,c.details=b.details,c.reason=b.description):c.detailedErrorCode=
35
- b;throw new _.H(1,8,8E3,c);}})}Qd(){this.kb()&&cast.framework.CastContext.getInstance().endCurrentSession(!0)}addMessageListener(a){typeof a===_.Od&&this.F.add(a)}removeMessageListener(a){typeof a===_.Od&&this.F.delete(a)}play(){return this.isEnded()?vP(this,!0):new Promise((a,b)=>{if(!this.a)return b(SO);this.a.play(null,a,b)})}pause(){return new Promise((a,b)=>{this.isEnded()&&a();if(!this.a)return b(SO);this.a.pause(null,a,b)})}isPaused(){return!!this.a&&this.a.playerState===chrome.cast.media.PlayerState.PAUSED}isEnded(){return this.getState()===
36
- _.bn}seek(a){return this.isEnded()?vP(this,!1,a):new Promise((b,c)=>{this.a||c(SO);this.l.isPlayingBreak&&c(QO);const d=new chrome.cast.media.SeekRequest;d.currentTime=a;this.trigger(new _.F(_.Jf));this.a.seek(d,()=>{this.trigger(new _.F(_.If));b()},c)})}getPosition(){return this.a&&this.a.getEstimatedTime()||0}getDuration(){if(!this.a||!this.a.media)return-1;const a=this.a.media.duration;return typeof a!==_.r?-1:-1===a?Infinity:a}setDrmCustomDataModifier(){}setCdnErrorCallback(){}detach(){}getPlaybackRate(){return this.a&&
37
- this.a.playbackRate||0}setPlaybackRate(a){this.a&&0<a&&this.sendMessage(bP,{type:"SET_PLAYBACK_RATE",requestId:Math.round(1E3*Math.random()),mediaSessionId:this.a.mediaSessionId,playbackRate:a})}getVolume(){return this.a&&this.a.volume.level}setVolume(a){this.a&&0<=a&&1>=a&&(a=new chrome.cast.media.VolumeRequest(new chrome.cast.Volume(a)),this.a.setVolume(a))}isMuted(){return this.a&&this.a.volume.muted}setMuted(a){this.a&&(a=new chrome.cast.media.VolumeRequest(new chrome.cast.Volume(void 0,a)),this.a.setVolume(a))}getPresentationStartTime(){if(!this.a||
38
- !this.a.media||!this.a.media.metadata)return null;const a=this.a.media.metadata.sectionStartAbsoluteTime;return typeof a!==_.r?null:1E-8===a?0:a}getSeekRange(){let a={start:0,end:this.getDuration()};if(this.isLive()){const b=this.a.getEstimatedLiveSeekableRange();b&&typeof b.start===_.r&&typeof b.end===_.r&&(a={start:b.start,end:b.end})}return a}getState(){return this.j?this.j.getState():_.js}getStats(){return this.a&&this.a.customData&&this.a.customData.stats?eP(this.a.customData.stats):_.Xm()}isLive(){return Infinity===
39
- this.getDuration()}load(a){const b=this;return _.x(function*(){if(b.cc())if(rP){b.C=_.qn(a);_.ok(a)&&(b.g=_.nk(b.I,a));var c=b.C[b.B];yield uP(b,{source:c,isLive:c.isLive,autoplay:b.g.autoplay,Qa:b.g,Eb:c.Eb,audioMimeType:c.audioMimeType})}else b.h.warn(TO);else b.h.warn(VO)})}getBufferInfo(){return new _.Or}getTrackManager(){return this.f}getConfiguration(){return this.g}getSurface(){return null}setNetworkEngine(a){this.K=a}getNetworkEngine(){return this.K}getSourceIndex(){return this.B}setSourceIndex(a){this.B=
40
- a}getLoadedSource(){return this.C[this.B]}getPeriods(){return[]}getDrmInfo(){return null}getTimelineCues(){return[]}resetAbr(){this.h.warn(UO)}onError(a){if(a&&(this.trigger(new _.F(_.Md,{detail:a})),this.j))this.j.onError(a)}namespace(){return _.dd}canPlay(){return this.cc()?2:0}fb(){return this.J}jc(a){this.J=yP(a)}Md(){this.J=null}te(a){const b=this.fb()||{};a={metadataType:wP(b.metadataType),title:a};this.jc(Object.assign({},b,a))}re(a){const b=this.fb()||{},c=wP(b.metadataType);a=new chrome.cast.Image(a);
41
- this.jc(Object.assign({},b,{metadataType:c,images:[a]}))}qe(a){const b=this.fb()||{};this.jc(Object.assign({},b,{metadataType:3,artist:a}))}se(a){const b=this.fb()||{};a={metadataType:wP(b.metadataType),releaseDate:a};this.jc(Object.assign({},b,a))}ab(a){const b=cast.framework.CastContext.getInstance(),c=a.castState===cast.framework.CastState.CONNECTED;rP=a.castState!==cast.framework.CastState.NO_DEVICES_AVAILABLE;this.aa=c?b.getCurrentSession().getCastDevice().friendlyName:"";this.o.xe()}eb(a){this.h.debug(`state: ${a.sessionState}, details:`,
42
- a);switch(a.sessionState){case cast.framework.SessionState.SESSION_STARTED:this.A=!0;BP(this,a.session);break;case cast.framework.SessionState.SESSION_RESUMED:this.kb()||(this.A=!0,BP(this,a.session),this.Z());break;case cast.framework.SessionState.SESSION_ENDED:if(this.kb()&&this.a){const d=this.a.media;var b=this.f.oa(),c=this.f.pa();b=b&&b.language||void 0;c=c&&c.language||void 0;this.T(this.getState(),{source:{url:d.contentId,type:d.contentType,isLive:this.isLive()},currentTime:CP(this),yf:c,
43
- He:b})}a.session.removeEventListener(cast.framework.SessionEventType.MEDIA_SESSION,this.W);a.session.removeMessageListener($O,this.R);this.A=!1;this.a=null;this.H.release();this.l=this.G=null}}cb(a){this.h.debug("New media session",a.mediaSession);AP(this,a.mediaSession)}bb(a,b){if(a===$O&&0<this.F.size){const c=eP(b);this.F.forEach(d=>d(c))}}ja(){this.trigger(new _.F(_.Af))}Oa(a){const b=this;return _.x(function*(){let c=null;const d=yield fP(a,[_.yf,_.Ac],b.K,b.g);d&&(c=new chrome.cast.media.Track(b.fa++,
44
- chrome.cast.media.TrackType.TEXT),c.language=d.language,c.name=d.label||null,c.trackContentId=d.url,c.trackContentType=d.mimeType,c.customData={mimeType:a.mimeType,url:a.url});return c})}getTextDisplayer(){return null}};DP.prototype.getTextDisplayer=DP.prototype.getTextDisplayer;DP.prototype.getNetworkEngine=DP.prototype.getNetworkEngine;DP.prototype.setNetworkEngine=DP.prototype.setNetworkEngine;var rP=!1,oP=new Set;window.__onGCastApiAvailable=qP;var hQ=class extends _.Pr{constructor(a,b,c){super();this.f=a;this.g=b;this.j=typeof c===_.Od?c:(d,e)=>{this.f&&d!==_.bn&&d!==_.kn&&this.f.load(e)};this.a=FP(this);this.h=new _.R(XO);this.addDelegate(this.f)}destroy(){const a=this;return _.x(function*(){a.a&&(yield sP(a.a),a.a=null);a.removeDelegate(a.f)})}Jd(){return!!this.a&&this.a.cc()&&rP}kb(){return!!this.a&&this.a.kb()}Ud(){return this.a?this.a.Ud():""}$c(a){this.a&&this.a.$c(a)}cast(a){const b=this;return _.x(function*(){if(b.a)try{if(yield b.a.cast(),
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var aP="Cannot seek during ads playout.",bP="Cannot switch track",cP="Media session does not exist.",dP="No receivers available",eP="Reset ABR functionality not available on cast.",fP="SDK not yet ready",gP="Sender is destroyed.",hP="clpp.cast.CastProxy",iP="clpp.cast.Player",jP="clpp.cast.Receiver",kP="urn:x-cast:castlabs",mP="urn:x-cast:com.google.cast.media",nP=function(a){return _.x(function*(){yield _.vo(a,_.ye);yield _.vo(a,_.xe)})},oP=function(a){return JSON.stringify(a,(b,c)=>
2
+ {if("license"!==b&&typeof c!==_.Pd){if(c instanceof Event){b={};for(const d in c){const e=c[d];typeof e===_.ue?"detail"===d&&(b[d]=e):d in Event||(b[d]=e)}return b}return typeof c===_.r?isNaN(c)?"NaN":isFinite(c)?c:0>c?"-Infinity":"Infinity":c}})},pP=function(a){if(typeof a!==_.uf)return a;try{return JSON.parse(a,(b,c)=>"NaN"===c?NaN:"-Infinity"===c?-Infinity:"Infinity"===c?Infinity:c)}catch(b){return a}},qP=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=_.fj(d,a.mimeType,g);f&&g&&(h=_.ti(a.url),(h=yield c.fetch(h).P)&&h.data&&(e=f.a(_.J(h.data)),e={url:URL.createObjectURL(new Blob([e])),kind:a.kind,language:a.language,label:a.label,mimeType:g}));return e})},rP=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 _.Pf:return d.FMP4;case _.Of:return b===_.M?d.MPEG2_TS:c.TS;case _.Dc:return c.AAC;case _.Ec:return c.AC3;case _.Fc:return c.E_AC3;case "audio/mpeg":return c.MP3;case _.Gc:return c.FMP4}},tP=function(a){a=void 0===a?sP: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}},uP=function(a,b){return a.g.filter(c=>c.type===b)},wP=function(a,b){const c=vP(a);return uP(a,b).find(d=>c.includes(d.id))||null},yP=function(a,b,c){const d=a.a.a;if(d)if(c){a.f[b]=c.renditions[0];c=[+c.id];if(b!==_.K){const e=a.pa();e&&c.push(+e.id)}c=new chrome.cast.media.EditTracksInfoRequest(c);
6
+ d.editTracksInfo(c,()=>{a.f[b]=null;xP(a,b)},e=>{a.f[b]=null;a.h.debug(bP,e)})}else b===_.K&&(c=new chrome.cast.media.EditTracksInfoRequest([]),d.editTracksInfo(c,()=>{xP(a,b)},e=>{a.h.debug(bP,e)}))},vP=function(a){a=a.a?a.a.a:null;return(a?a.activeTrackIds||[]:[]).map(b=>b.toString())},xP=function(a,b){b===_.L?a.a.trigger(new _.F(_.bk)):b===_.K&&a.a.trigger(new _.F(_.ck))},BP=function(a){if(a)for(const b of zP)AP(b)},AP=function(a){if(!a.w&&window.chrome&&chrome.cast&&chrome.cast.isAvailable&&window.cast&&
7
+ cast.framework&&cast.framework.CastContext&&a.V.length){a.w=!0;a.o.we();var b=cast.framework.CastContext.getInstance(),c=new cast.framework.CastOptions;c.receiverApplicationId=a.V;c.autoJoinPolicy=chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED;b.setOptions(c);b.addEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.N);b.addEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.ba);CP&&a.o.ca(.02)}},DP=function(a){return _.x(function*(){zP.delete(a);if(a.w){a.w=!1;var b=
8
+ cast.framework.CastContext.getInstance();b.removeEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.N);b.removeEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.ba)}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.T=null;a.Z=null})},EP=function(a){return _.x(function*(){a.kb()||(yield cast.framework.CastContext.getInstance().requestSession())})},GP=function(a,b,c){c=
9
+ void 0===c?0:c;return _.x(function*(){var d=a.f.pa();d&&d.language&&(a.g.preferredTextLanguage=d.language);(d=a.f.oa())&&d.language&&(a.g.preferredAudioLanguage=d.language);yield FP(a,{source:a.getLoadedSource(),currentTime:c,isLive:a.isLive(),ne:a.getPresentationStartTime(),autoplay:b,Qa:a.g})})},FP=function(a,b){return _.x(function*(){var c=chrome.cast.media.StreamType;yield EP(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=rP(b.Eb,_.M);e.hlsSegmentFormat=rP(c,_.L);b.Qa&&(a.M&&(c=yield Promise.resolve(a.M(b.Qa)))&&(b.Qa=c),a.g=b.Qa,a.C=_.tn(a.g),a.B=a.C.findIndex(k=>k.url===b.source.url),b.Qa.remoteTextTracks&&(c=yield Promise.all(b.Qa.remoteTextTracks.map(a.Ga.bind(a))),e.tracks=c.filter(k=>k),b.Qa.remoteTextTracks=void 0),delete b.Qa.autoplay,b.Qa.startTime=null,e.customData={playerConfiguration:oP(b.Qa)});c=a.fb()||{};
11
+ var f=HP(c.metadataType),g;typeof b.ne===_.r&&(g={metadataType:f,sectionStartAbsoluteTime:b.ne});var h;b.source.name&&(h={metadataType:f,title:b.source.name});c=IP(c);if(g=JP(Object.assign({},g,h,c)))e.metadata=g;e=new chrome.cast.media.LoadRequest(e);typeof b.autoplay===_.Kc&&(e.autoplay=b.autoplay);typeof b.currentTime===_.r&&(e.currentTime=b.currentTime);yield d.loadMedia(e)}})},JP=function(a){if(!a)return null;a:{var b=a.metadataType;const c=Object.entries(KP);for(const d of c){const [e,f]=d;
12
+ if(f===b){b=e;break a}}b=null}if(!b)return null;b=tP(KP[b]);return Object.assign(b,a)},HP=function(a){var b=void 0===b?sP:b;return Object.values(KP).includes(a)?a:b},IP=function(a){const b={};for(const c in a)void 0!==a[c]&&(b[c]=a[c]);return b},MP=function(a,b){LP(a,b.getMediaSession());b.addEventListener(cast.framework.SessionEventType.MEDIA_SESSION,a.W);b.addMessageListener(kP,a.R)},NP=function(a){const b=a.getPosition();a.a&&a.a.media?(a=a.a.media.startAbsoluteTime,a=typeof a!==_.r?null:a):a=
13
+ null;a=null===a?null:a+b;return null===a?b:a},LP=function(a,b){a.a=b;a.a&&(a.H.release(),a.G=null,a.l=null,a.l=new cast.framework.RemotePlayer,a.G=new cast.framework.RemotePlayerController(a.l),a.H.on(a.G,cast.framework.RemotePlayerEventType.CURRENT_TIME_CHANGED,a.ja.bind(a)),a.f&&a.f.load(),a.j&&a.j.init(),a.trigger(new _.F(_.ge)))},QP=function(a){return new OP(a.g,()=>{a.trigger(new _.F(_.Qc))},(b,c)=>{{const d=a.f.getConfiguration();d.source=c.source;d.autoplay=!1;d.startTime=c.currentTime?Math.max(c.currentTime-
14
+ 1,0):null;d.ima&&d.startTime&&(d.ima.playAdsAfterTime=d.startTime);c.Ge&&(d.preferredAudioLanguage=c.Ge);c.xf&&(d.preferredTextLanguage=c.xf);_.xo(a.f,null);a.trigger(new _.F("castingended"));a.j(b,d)}},()=>PP(a))},PP=function(a){return _.x(function*(){a.trigger(new _.F(_.Pc));a.f.a!==a.a&&a.f&&a.a&&(yield a.f.release(),_.xo(a.f,a.a))})},TP=function(a,b,c){return _.x(function*(){var d=b.adTagUrl;if(d)try{RP=!1;const e=_.ti(d),f=yield c.fetch(e).P;if(f&&f.data){const g=_.Qh(f.data),h=(new DOMParser).parseFromString(g,
15
+ _.Af);if(h.getElementsByTagName("vmap:VMAP").length)_.C("VMAP detected."),a.vmapAdsRequest=SP(g);else if(h.getElementsByTagName("VAST").length){_.C("VAST detected.");{d=g;const k=new cast.framework.messages.BreakClip("bc1");k.vastAdsRequest=SP(d);const l=new cast.framework.messages.Break("b1",[k.id],0);a.breakClips=[k];a.breaks=[l]}}else _.C("Unsupported schema."),RP=!0}}catch(e){_.C("Failed to fetch an ad",e),RP=!0}})},SP=function(a){const b=new cast.framework.messages.VastAdsRequest;b.adsResponse=
16
+ a;return b},UP=function(a,b){b=new _.H(1,10,10003,{errorType:b});a.m.onError(b)},VP=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},XP=function(a,b,c){if(c instanceof cast.framework.events.BreaksEvent||-1!==a.getPosition()){var d=null;(c=WP(a,c))&&(d={ad:c});a.m.trigger(new _.F(b,d))}},WP=function(a,b){let c=null;if(a.a&&b instanceof cast.framework.events.BreaksEvent){let d=null,e=null,f;typeof b.breakClipId===_.uf&&(d=a.a.getBreakClipById(b.breakClipId));typeof b.breakId===
17
+ _.uf&&(e=a.a.getBreakById(b.breakId),!e&&d&&(e=a.a.getBreaks().find(g=>g.breakClipIds.includes(d.id))||null),e&&(f=a.a.getBreaks().filter(g=>0<=g.position).sort((g,h)=>g.position-h.position).findIndex(g=>g===e)));c=new Z(d,e,b.index,b.total,f)}return c},YP=function(){return[cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,cast.framework.events.EventType.TIMED_METADATA_CHANGED,cast.framework.events.EventType.TIMED_METADATA_ENTER,cast.framework.events.EventType.TIMED_METADATA_EXIT]},ZP=function(a){const b=
18
+ a.dashTimedMetadata;let c=_.If;b&&(c=b.schemeIdUri);return{type:c.startsWith(_.Hf)?_.Xg:_.Vg,schemeIdUri:c,id:a.id||"",startTime:a.startTime,endTime:a.endTime,value:b&&b.value||"",eventElement:b&&b.eventElement}},$P=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},bQ=function(a){a.a=$P().getTextTracksManager();const b=a.a.getTracks();a.j=aQ(_.K,b)},aQ=function(a,b){const c=[];for(const d of b)b=new _.Ji(d.trackId.toString(),a),b.roles=d.roles||[],b.kind=d.subtype||
19
+ 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 _.Ti(b.id,b)),c.push(b);return c},cQ=function(a,b,c,d){c=_.dh(c).filter(g=>g);var e=!1;let f=[];b===_.L?f=a.getAudioTracks():b===_.K&&(f=a.ka());if(c=c.find(g=>{const h=_.Dh(g);return f.some(k=>{k=_.Dh(k.language||"");return _.Eh(h,k)})})){const g=
20
+ _.Dh(c);c=f.filter(h=>{h=_.Dh(h.language||"");return _.Eh(g,h)});f=c.length?c:f;e=e||!!c.length}_.Zh(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.h.info("Will select track",e),b===_.L?a.sa(e):b===_.K&&a.Fa(e))},dQ=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},gQ=function(a,b){var c=()=>{b.protectionSystem=cast.framework.ContentProtection.NONE;b.licenseUrl=void 0;b.licenseRequestHandler=void 0;b.licenseHandler=void 0};
21
+ if(a&&a.drm){var d=a.drm,e=_.Ik(d);if(e){var f=[_.pd];_.tn(a)[0].type!==_.Bc&&f.unshift(_.rd);d.preferredDrmSystem===_.pd&&f.reverse();for(var g,h;f.length&&!h;)g=f.shift(),h=e.Ra[g];h?(c=g===_.rd?cast.framework.ContentProtection.WIDEVINE:g===_.pd?cast.framework.ContentProtection.PLAYREADY:void 0,b.protectionSystem=c,b.licenseUrl=h.licenseUrl,c={ldlDelay:0,customData:{}},eQ(b,h,a,c),fQ(b,h,a,c)):c()}else c()}else c()},eQ=function(a,b,c,d){b.modifiers.licenseRequest?a.licenseRequestHandler=e=>{const f=
22
+ _.ti({method:"POST",uris:[e.url]});e.headers&&(f.headers=e.headers);f.body=e.content;f.allowCrossSiteCredentials=e.withCredentials;b.modifiers.licenseRequest(c,f,d);e.url=f.uris[0];e.headers=f.headers;e.content=f.body;e.withCredentials=f.allowCrossSiteCredentials}:a.licenseRequestHandler=void 0},fQ=function(a,b,c,d){b.modifiers.licenseResponse?a.licenseHandler=(e,f)=>_.x(function*(){const g=_.ui(Object.assign({},f.headers),e.buffer,200,"");yield b.modifiers.licenseResponse(c,g,d);return _.J(g.data)}):
23
+ a.licenseHandler=void 0},jQ=function(){return hQ||(hQ=new iQ)},kQ=function(){return cast.framework.CastReceiverContext.getInstance()},mQ=function(a,b){a.h.debug("Detected HLS, parsing");var c=cast.framework.messages.HlsVideoSegmentFormat;a=kQ();var {hlsVideoSegmentFormat:d}=kQ().getPlayerManager().getMediaInformation()||{};c=d===c.FMP4?_.Pf:_.Of;b=b.replace(/\r\n|\r(?=[^\n]|$)/gm,"\n");b=b.split(/\n+/m);d=[];let e=0;for(;e<b.length;){const f=b[e].trim();if(b[e].startsWith("#EXT-X-STREAM-INF")){const g=
24
+ lQ(f,_.na),h=lQ(f,_.ub);let [k,l]=[];h&&([k,l]=h.split("x").map(m=>+m));if(!a.canDisplayType(c,g,k,l)){e+=2;continue}}d.push(f);++e}return d.join("\n")},lQ=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},oQ=function(a,b){let c=null;const d=nQ(a);d&&(c={ad:d});a.f.trigger(new _.F(b,c))},nQ=function(a){var b=null;if(a.a&&a.a.mediaInfo){b=a.a.mediaInfo;
25
+ let c=null,d=null,e,f;const g=a.a.currentBreakClipNumber;b.breaks&&(c=b.breaks.find(h=>h.id===a.a.breakId)||null)&&(e=c.breakClipIds.length,f=0>=c.position?c.position:b.breaks.filter(h=>0<=h.position).sort((h,k)=>h.position-k.position).findIndex(h=>h===c));b.breakClips&&(d=b.breakClips.find(h=>h.id===a.a.breakClipId)||null);b=new Z(d,c,g,e,f)}return b},pQ=class{constructor(a,b){this.log=new _.R(b);this.player=a;this.l=null;this.g=_.nn;this.o=_.ps;this.j=2;this.C=Date.now();this.B=-1}release(){this.a(_.nn)}destroy(){this.l=
26
+ this.player=null;return Promise.resolve()}getState(){return this.g}onError(a){a.severity===_.G&&this.a(_.mn)}a(a){if(a!==this.g)if(this.g===_.mn&&a!==_.nn)this.log.debug("Player is in ERROR state and can not switch to",a);else{var b=Date.now();this.o=this.g;this.g=a;this.g===_.hn?(this.B=b,this.player.trigger(new _.F(_.Mc,{detail:{bufferedTimeMS:-1,reason:this.j}}))):this.o===_.hn&&this.player.trigger(new _.F(_.Lc,{detail:{bufferedTimeMS:b-this.B,reason:this.j}}));a={currentState:this.g,previousState:this.o,
27
+ timeSinceLastStateChangeMS:b-this.C};this.C=b;this.l&&_.Wm(this.l,this.g);this.player.trigger(new _.F(_.rf,{detail:a}))}}};_.z("clpp.cast.CastUtils",class{});var sP=0,KP={GENERIC:sP,MOVIE:1,TV_SHOW:2,MUSIC_TRACK:3,PHOTO:4,AUDIOBOOK_CHAPTER:5};var qQ=class extends pQ{constructor(a){super(a,"clpp.cast.SenderStateManager");this.w=this.f=null;this.A=this.Bb.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)}Bb(){if(this.f&&
28
+ 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(_.en);break;case chrome.cast.media.IdleReason.ERROR:this.a(_.mn);break;default:this.a(_.nn)}break;case chrome.cast.media.PlayerState.PLAYING:this.a(_.qn);break;case chrome.cast.media.PlayerState.PAUSED:this.a(_.pn);break;case chrome.cast.media.PlayerState.BUFFERING:this.a(_.hn)}}};var rQ=class extends _.S{constructor(){super();this.h=new _.R("clpp.cast.SenderTrackManager");this.a=null;this.g=[];this.f={}}initialize(a){this.a=a}release(){this.g=[];this.f={}}load(){this.release();var a=this.a.a;a&&(a=a.media)&&(this.g=(a=a.tracks)?a.map(b=>{switch(b.type){case chrome.cast.media.TrackType.VIDEO:var c=_.M;break;case chrome.cast.media.TrackType.AUDIO:c=_.L;break;case chrome.cast.media.TrackType.TEXT:c=_.K}c=new _.Ji(b.trackId.toString(),c);c.kind=b.subtype;c.language=b.language;
29
+ c.label=b.name;c.src=b.trackContentId;c.mimeType=b.trackContentType;b.customData&&(c.src=b.customData.url||c.src,c.mimeType=b.customData.mimeType||c.mimeType);c.renditions.push(new _.Ti(c.id,c));return c}):[],this.a.trigger(new _.F(_.Tr)))}destroy(){this.a=null}getVideoTracks(){return uP(this,_.M)}getAudioTracks(){return uP(this,_.L)}ka(){return uP(this,_.K)}ia(){const a=this.Ma();return a?a.renditions[0]:null}Ja(){const a=this.oa();return a?a.renditions[0]:null}Ka(){const a=this.pa();return a?a.renditions[0]:
30
+ null}Ua(){return this.f[_.M]||null}gb(){return this.f[_.L]||null}hb(){return this.f[_.K]||null}Ma(){return wP(this,_.M)}oa(){return wP(this,_.L)}pa(){return wP(this,_.K)}Za(a){yP(this,_.M,a)}sa(a){yP(this,_.L,a)}Fa(a){yP(this,_.K,a)}Ya(a){this.Za(a&&a.track)}mb(a){this.sa(a&&a.track)}nb(a){this.Fa(a&&a.track)}addTextTrack(){return _.x(function*(){})}ma(){return!0}};rQ.prototype.isAbrEnabled=rQ.prototype.ma;rQ.prototype.addTextTrack=rQ.prototype.addTextTrack;rQ.prototype.setTextRendition=rQ.prototype.nb;
31
+ rQ.prototype.setAudioRendition=rQ.prototype.mb;rQ.prototype.setVideoRendition=rQ.prototype.Ya;rQ.prototype.setTextTrack=rQ.prototype.Fa;rQ.prototype.setAudioTrack=rQ.prototype.sa;rQ.prototype.setVideoTrack=rQ.prototype.Za;rQ.prototype.getTextTrack=rQ.prototype.pa;rQ.prototype.getAudioTrack=rQ.prototype.oa;rQ.prototype.getVideoTrack=rQ.prototype.Ma;rQ.prototype.getLoadingTextRendition=rQ.prototype.hb;rQ.prototype.getLoadingAudioRendition=rQ.prototype.gb;rQ.prototype.getLoadingVideoRendition=rQ.prototype.Ua;
32
+ rQ.prototype.getTextRendition=rQ.prototype.Ka;rQ.prototype.getAudioRendition=rQ.prototype.Ja;rQ.prototype.getVideoRendition=rQ.prototype.ia;rQ.prototype.getTextTracks=rQ.prototype.ka;rQ.prototype.getAudioTracks=rQ.prototype.getAudioTracks;rQ.prototype.getVideoTracks=rQ.prototype.getVideoTracks;var OP=class extends _.Vr{constructor(a,b,c,d){super();this.h=new _.R(_.dd);this.V=a;this.o=new _.lj(b);this.T=c;this.Z=d;this.g=this.I=_.mk();this.C=[];this.B=0;this.K=new _.oo;this.G=this.l=this.a=null;this.A=this.w=!1;this.aa="";this.ea=1E6;this.f=new rQ;this.f.initialize(this);this.j=new qQ(this);this.H=new _.hr;this.J=null;this.F=new Set;this.N=this.ab.bind(this);this.ba=this.eb.bind(this);this.W=this.cb.bind(this);this.R=this.bb.bind(this);this.M=null;window.cast||Object.defineProperty(window,
33
+ "cast",{get:()=>window.cast_,set:e=>{window.cast_=e;window.setTimeout(()=>{BP(!0)},0)}});AP(this);zP.add(this)}init(a,b){this.g=this.I=b}unload(){return new Promise((a,b)=>{this.f&&this.f.release();this.a&&!this.a.idleReason||a();this.a.stop(null,a,b)})}release(){return this.unload().then(()=>{this.j&&this.j.release()})}destroy(){return _.x(function*(){})}$c(a){this.M=a}cc(){return this.w}kb(){return this.A}Td(){return this.aa}sendMessage(a,b){const c=this;return _.x(function*(){let d;const e=cast.framework.CastContext.getInstance().getCurrentSession();
34
+ if(e)try{yield e.sendMessage(a,oP(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.cc())throw a.h.warn(fP),new _.H(1,8,8001,void 0);if(!CP)throw a.h.warn(dP),new _.H(1,8,8002,void 0);if(a.kb())throw a.h.warn("Already casting"),new _.H(1,8,8003,void 0);try{yield EP(a)}catch(b){const c={};b instanceof chrome.cast.Error?(c.detailedErrorCode=b.code,c.details=b.details,c.reason=b.description):c.detailedErrorCode=
35
+ b;throw new _.H(1,8,8E3,c);}})}Qd(){this.kb()&&cast.framework.CastContext.getInstance().endCurrentSession(!0)}addMessageListener(a){typeof a===_.Pd&&this.F.add(a)}removeMessageListener(a){typeof a===_.Pd&&this.F.delete(a)}play(){return this.isEnded()?GP(this,!0):new Promise((a,b)=>{if(!this.a)return b(cP);this.a.play(null,a,b)})}pause(){return new Promise((a,b)=>{this.isEnded()&&a();if(!this.a)return b(cP);this.a.pause(null,a,b)})}isPaused(){return!!this.a&&this.a.playerState===chrome.cast.media.PlayerState.PAUSED}isEnded(){return this.getState()===
36
+ _.en}seek(a){return this.isEnded()?GP(this,!1,a):new Promise((b,c)=>{this.a||c(cP);this.l.isPlayingBreak&&c(aP);const d=new chrome.cast.media.SeekRequest;d.currentTime=a;this.trigger(new _.F(_.Kf));this.a.seek(d,()=>{this.trigger(new _.F(_.Jf));b()},c)})}getPosition(){return this.a&&this.a.getEstimatedTime()||0}getDuration(){if(!this.a||!this.a.media)return-1;const a=this.a.media.duration;return typeof a!==_.r?-1:-1===a?Infinity:a}setDrmCustomDataModifier(){}setCdnErrorCallback(){}detach(){}getPlaybackRate(){return this.a&&
37
+ this.a.playbackRate||0}setPlaybackRate(a){this.a&&0<a&&this.sendMessage(mP,{type:"SET_PLAYBACK_RATE",requestId:Math.round(1E3*Math.random()),mediaSessionId:this.a.mediaSessionId,playbackRate:a})}getVolume(){return this.a&&this.a.volume.level}setVolume(a){this.a&&0<=a&&1>=a&&(a=new chrome.cast.media.VolumeRequest(new chrome.cast.Volume(a)),this.a.setVolume(a))}isMuted(){return this.a&&this.a.volume.muted}setMuted(a){this.a&&(a=new chrome.cast.media.VolumeRequest(new chrome.cast.Volume(void 0,a)),this.a.setVolume(a))}getPresentationStartTime(){if(!this.a||
38
+ !this.a.media||!this.a.media.metadata)return null;const a=this.a.media.metadata.sectionStartAbsoluteTime;return typeof a!==_.r?null:1E-8===a?0:a}getSeekRange(){let a={start:0,end:this.getDuration()};if(this.isLive()){const b=this.a.getEstimatedLiveSeekableRange();b&&typeof b.start===_.r&&typeof b.end===_.r&&(a={start:b.start,end:b.end})}return a}getState(){return this.j?this.j.getState():_.ps}getStats(){return this.a&&this.a.customData&&this.a.customData.stats?pP(this.a.customData.stats):_.$m()}isLive(){return Infinity===
39
+ this.getDuration()}load(a){const b=this;return _.x(function*(){if(b.cc())if(CP){b.C=_.tn(a);_.pk(a)&&(b.g=_.ok(b.I,a));var c=b.C[b.B];yield FP(b,{source:c,isLive:c.isLive,autoplay:b.g.autoplay,Qa:b.g,Eb:c.Eb,audioMimeType:c.audioMimeType})}else b.h.warn(dP);else b.h.warn(fP)})}getBufferInfo(){return new _.Ur}getTrackManager(){return this.f}getConfiguration(){return this.g}getSurface(){return null}setNetworkEngine(a){this.K=a}getNetworkEngine(){return this.K}getSourceIndex(){return this.B}setSourceIndex(a){this.B=
40
+ a}getLoadedSource(){return this.C[this.B]}getPeriods(){return[]}getDrmInfo(){return null}getTimelineCues(){return[]}resetAbr(){this.h.warn(eP)}onError(a){if(a&&(this.trigger(new _.F(_.Nd,{detail:a})),this.j))this.j.onError(a)}namespace(){return _.dd}canPlay(){return this.cc()?2:0}fb(){return this.J}jc(a){this.J=JP(a)}Md(){this.J=null}se(a){const b=this.fb()||{};a={metadataType:HP(b.metadataType),title:a};this.jc(Object.assign({},b,a))}qe(a){const b=this.fb()||{},c=HP(b.metadataType);a=new chrome.cast.Image(a);
41
+ this.jc(Object.assign({},b,{metadataType:c,images:[a]}))}pe(a){const b=this.fb()||{};this.jc(Object.assign({},b,{metadataType:3,artist:a}))}re(a){const b=this.fb()||{};a={metadataType:HP(b.metadataType),releaseDate:a};this.jc(Object.assign({},b,a))}ab(a){const b=cast.framework.CastContext.getInstance(),c=a.castState===cast.framework.CastState.CONNECTED;CP=a.castState!==cast.framework.CastState.NO_DEVICES_AVAILABLE;this.aa=c?b.getCurrentSession().getCastDevice().friendlyName:"";this.o.we()}eb(a){this.h.debug(`state: ${a.sessionState}, details:`,
42
+ a);switch(a.sessionState){case cast.framework.SessionState.SESSION_STARTED:this.A=!0;MP(this,a.session);break;case cast.framework.SessionState.SESSION_RESUMED:this.kb()||(this.A=!0,MP(this,a.session),this.Z());break;case cast.framework.SessionState.SESSION_ENDED:if(this.kb()&&this.a){const d=this.a.media;var b=this.f.oa(),c=this.f.pa();b=b&&b.language||void 0;c=c&&c.language||void 0;this.T(this.getState(),{source:{url:d.contentId,type:d.contentType,isLive:this.isLive()},currentTime:NP(this),xf:c,
43
+ Ge:b})}a.session.removeEventListener(cast.framework.SessionEventType.MEDIA_SESSION,this.W);a.session.removeMessageListener(kP,this.R);this.A=!1;this.a=null;this.H.release();this.l=this.G=null}}cb(a){this.h.debug("New media session",a.mediaSession);LP(this,a.mediaSession)}bb(a,b){if(a===kP&&0<this.F.size){const c=pP(b);this.F.forEach(d=>d(c))}}ja(){this.trigger(new _.F(_.Bf))}Ga(a){const b=this;return _.x(function*(){let c=null;const d=yield qP(a,[_.zf,_.Ac],b.K,b.g);d&&(c=new chrome.cast.media.Track(b.ea++,
44
+ chrome.cast.media.TrackType.TEXT),c.language=d.language,c.name=d.label||null,c.trackContentId=d.url,c.trackContentType=d.mimeType,c.customData={mimeType:a.mimeType,url:a.url});return c})}getTextDisplayer(){return null}};OP.prototype.getTextDisplayer=OP.prototype.getTextDisplayer;OP.prototype.getNetworkEngine=OP.prototype.getNetworkEngine;OP.prototype.setNetworkEngine=OP.prototype.setNetworkEngine;var CP=!1,zP=new Set;window.__onGCastApiAvailable=BP;var sQ=class extends _.Vr{constructor(a,b,c){super();this.f=a;this.g=b;this.j=typeof c===_.Pd?c:(d,e)=>{this.f&&d!==_.en&&d!==_.nn&&this.f.load(e)};this.a=QP(this);this.h=new _.R(hP);this.addDelegate(this.f)}destroy(){const a=this;return _.x(function*(){a.a&&(yield DP(a.a),a.a=null);a.removeDelegate(a.f)})}Jd(){return!!this.a&&this.a.cc()&&CP}kb(){return!!this.a&&this.a.kb()}Td(){return this.a?this.a.Td():""}$c(a){this.a&&this.a.$c(a)}cast(a){const b=this;return _.x(function*(){if(b.a)try{if(yield b.a.cast(),
45
45
  b.f&&b.a){{let d=null;const e=b.f.getLoadedSource();if(e){const f=b.f.getTrackManager(),g=f.getVideoTracks()[0];let h,k;g&&g.mimeType&&(h=g.mimeType);const l=b.f.getConfiguration(),m=f.oa();m&&(m.mimeType&&(k=m.mimeType),m.language&&(l.preferredAudioLanguage=m.language),m.roles.length&&(l.preferredAudioRole=m.roles[0]));const n=f.pa();n&&(n.language&&(l.preferredTextLanguage=n.language),n.roles.length&&(l.preferredTextRole=n.roles[0]));const q=e&&typeof e.isLive===_.Kc?e.isLive:b.f.isLive();d={source:e,
46
- isLive:q,autoplay:!b.f.isPaused(),currentTime:Math.max(b.f.getPosition()-1,0),oe:b.f.getPresentationStartTime(),Eb:h,audioMimeType:k,Qa:l}}var c=d}yield EP(b);b.a&&(c&&(c.autoplay=!b.f.isPaused()),a?yield b.f.load(a):b.a.a||(yield uP(b.a,c)))}}catch(d){b.h.error("Error while trying to cast",d),c=new _.F(_.Md,{detail:d}),b.trigger(c)}})}Qd(){this.a&&this.a.Qd()}Xf(a){const b=this;return _.x(function*(){a!==b.g&&(b.g=a,b.a&&(yield sP(b.a)),b.a=FP(b))})}sendMessage(a){const b=this;return _.x(function*(){b.a?
47
- yield b.a.sendMessage($O,a):b.h.warn(WO)})}addMessageListener(a){this.a?this.a.addMessageListener(a):this.h.warn(WO)}removeMessageListener(a){this.a?this.a.removeMessageListener(a):this.h.warn(WO)}fb(){return this.a&&this.a.fb()}jc(a){this.a&&this.a.jc(a)}Md(){this.a&&this.a.Md()}te(a){this.a&&this.a.te(a)}re(a){this.a&&this.a.re(a)}qe(a){this.a&&this.a.qe(a)}se(a){this.a&&this.a.se(a)}};_.z(XO,hQ);hQ.prototype.setContentReleaseDate=hQ.prototype.se;hQ.prototype.setContentArtist=hQ.prototype.qe;
48
- hQ.prototype.setContentImage=hQ.prototype.re;hQ.prototype.setContentTitle=hQ.prototype.te;hQ.prototype.clearContentMetadata=hQ.prototype.Md;hQ.prototype.setContentMetadata=hQ.prototype.jc;hQ.prototype.getContentMetadata=hQ.prototype.fb;hQ.prototype.removeMessageListener=hQ.prototype.removeMessageListener;hQ.prototype.addMessageListener=hQ.prototype.addMessageListener;hQ.prototype.sendMessage=hQ.prototype.sendMessage;hQ.prototype.changeReceiverId=hQ.prototype.Xf;hQ.prototype.forceDisconnect=hQ.prototype.Qd;
49
- hQ.prototype.cast=hQ.prototype.cast;hQ.prototype.setPlayerConfigInterceptor=hQ.prototype.$c;hQ.prototype.getReceiverName=hQ.prototype.Ud;hQ.prototype.isCasting=hQ.prototype.kb;hQ.prototype.canCast=hQ.prototype.Jd;hQ.prototype.destroy=hQ.prototype.destroy;var iQ=class extends eQ{constructor(a){super(a,"clpp.cast.StateManager");this.I=this.T.bind(this);this.H=this.R.bind(this);this.A=this.aa.bind(this);this.w=this.Z.bind(this);this.K=this.W.bind(this);this.J=this.V.bind(this);this.M=this.fa.bind(this);this.G=this.ba.bind(this);this.F=this.U.bind(this);this.f=this.O.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,
46
+ isLive:q,autoplay:!b.f.isPaused(),currentTime:Math.max(b.f.getPosition()-1,0),ne:b.f.getPresentationStartTime(),Eb:h,audioMimeType:k,Qa:l}}var c=d}yield PP(b);b.a&&(c&&(c.autoplay=!b.f.isPaused()),a?yield b.f.load(a):b.a.a||(yield FP(b.a,c)))}}catch(d){b.h.error("Error while trying to cast",d),c=new _.F(_.Nd,{detail:d}),b.trigger(c)}})}Qd(){this.a&&this.a.Qd()}Wf(a){const b=this;return _.x(function*(){a!==b.g&&(b.g=a,b.a&&(yield DP(b.a)),b.a=QP(b))})}sendMessage(a){const b=this;return _.x(function*(){b.a?
47
+ yield b.a.sendMessage(kP,a):b.h.warn(gP)})}addMessageListener(a){this.a?this.a.addMessageListener(a):this.h.warn(gP)}removeMessageListener(a){this.a?this.a.removeMessageListener(a):this.h.warn(gP)}fb(){return this.a&&this.a.fb()}jc(a){this.a&&this.a.jc(a)}Md(){this.a&&this.a.Md()}se(a){this.a&&this.a.se(a)}qe(a){this.a&&this.a.qe(a)}pe(a){this.a&&this.a.pe(a)}re(a){this.a&&this.a.re(a)}};_.z(hP,sQ);sQ.prototype.setContentReleaseDate=sQ.prototype.re;sQ.prototype.setContentArtist=sQ.prototype.pe;
48
+ sQ.prototype.setContentImage=sQ.prototype.qe;sQ.prototype.setContentTitle=sQ.prototype.se;sQ.prototype.clearContentMetadata=sQ.prototype.Md;sQ.prototype.setContentMetadata=sQ.prototype.jc;sQ.prototype.getContentMetadata=sQ.prototype.fb;sQ.prototype.removeMessageListener=sQ.prototype.removeMessageListener;sQ.prototype.addMessageListener=sQ.prototype.addMessageListener;sQ.prototype.sendMessage=sQ.prototype.sendMessage;sQ.prototype.changeReceiverId=sQ.prototype.Wf;sQ.prototype.forceDisconnect=sQ.prototype.Qd;
49
+ sQ.prototype.cast=sQ.prototype.cast;sQ.prototype.setPlayerConfigInterceptor=sQ.prototype.$c;sQ.prototype.getReceiverName=sQ.prototype.Td;sQ.prototype.isCasting=sQ.prototype.kb;sQ.prototype.canCast=sQ.prototype.Jd;sQ.prototype.destroy=sQ.prototype.destroy;var tQ=class extends pQ{constructor(a){super(a,"clpp.cast.StateManager");this.I=this.T.bind(this);this.H=this.R.bind(this);this.A=this.aa.bind(this);this.w=this.Z.bind(this);this.K=this.W.bind(this);this.J=this.V.bind(this);this.M=this.ea.bind(this);this.G=this.ba.bind(this);this.F=this.U.bind(this);this.f=this.N.bind(this)}init(){const a=cast.framework.events.EventType,b=cast.framework.CastReceiverContext.getInstance().getPlayerManager();b.addEventListener(a.PLAYING,this.I);b.addEventListener(a.PAUSE,
50
50
  this.H);b.addEventListener(a.MEDIA_FINISHED,this.A);b.addEventListener(a.BUFFERING,this.w);b.addEventListener(a.SEEKING,this.K);b.addEventListener(a.SEEKED,this.J);b.addEventListener(a.STALLED,this.M);b.addEventListener(a.PLAYER_LOADING,this.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();
51
- d.removeEventListener(c.PLAYING,a.I);d.removeEventListener(c.PAUSE,a.H);d.removeEventListener(c.MEDIA_FINISHED,a.A);d.removeEventListener(c.BUFFERING,a.w);d.removeEventListener(c.SEEKING,a.K);d.removeEventListener(c.SEEKED,a.J);d.removeEventListener(c.STALLED,a.M);d.removeEventListener(c.PLAYER_LOADING,a.G);d.removeEventListener(c.ERROR,a.F);d.removeEventListener(c.BITRATE_CHANGED,a.f);yield b().call(a)})}T(){this.player.trigger(new _.F(_.He));this.a(_.nn)}R(){this.a(_.mn)}aa(){this.a(_.bn)}Z(a){a.isBuffering?
52
- this.a(_.en):(a=this.player.isPaused()?_.mn:_.nn,this.a(a))}W(){this.j=1;this.player.trigger(new _.F(_.Jf))}V(){this.player.trigger(new _.F(_.If))}fa(){this.j=2}ba(){this.a(_.ln)}O(a){const b=this.player.getStats();this.player.trigger(new _.F(_.Jc,{detail:{bandwidth:a.totalBitrate,width:b.width,height:b.height}}))}U(a){a=new _.H(_.G,7,7300,{detailedErrorCode:a.detailedErrorCode,error:a.error,reason:a.reason});this.player.trigger(new _.F(_.Md,{detail:a}));this.a(_.jn)}};var Z=class{constructor(a,b,c,d,e){this.a=a;this.f=b;this.j=typeof c===_.r?c:1;this.l=typeof d===_.r?d:1;this.g=typeof e===_.r?e:0}rb(){return"Google Cast Framework"}sb(){return cast.framework.VERSION}yb(){return 0}getId(){return""}getCreativeId(){return""}getApiFramework(){return null}getAdSystem(){return""}getAdvertiserName(){return""}getTitle(){return this.a.title||""}getDuration(){return this.a.duration||0}getSkipTimeOffset(){return this.a.whenSkippable||0}ec(){return!1}Lb(){return this.a.clickThroughUrl||
51
+ d.removeEventListener(c.PLAYING,a.I);d.removeEventListener(c.PAUSE,a.H);d.removeEventListener(c.MEDIA_FINISHED,a.A);d.removeEventListener(c.BUFFERING,a.w);d.removeEventListener(c.SEEKING,a.K);d.removeEventListener(c.SEEKED,a.J);d.removeEventListener(c.STALLED,a.M);d.removeEventListener(c.PLAYER_LOADING,a.G);d.removeEventListener(c.ERROR,a.F);d.removeEventListener(c.BITRATE_CHANGED,a.f);yield b().call(a)})}T(){this.player.trigger(new _.F(_.Ie));this.a(_.qn)}R(){this.a(_.pn)}aa(){this.a(_.en)}Z(a){a.isBuffering?
52
+ this.a(_.hn):(a=this.player.isPaused()?_.pn:_.qn,this.a(a))}W(){this.j=1;this.player.trigger(new _.F(_.Kf))}V(){this.player.trigger(new _.F(_.Jf))}ea(){this.j=2}ba(){this.a(_.on)}N(a){const b=this.player.getStats();this.player.trigger(new _.F(_.Jc,{detail:{bandwidth:a.totalBitrate,width:b.width,height:b.height}}))}U(a){a=new _.H(_.G,7,7300,{detailedErrorCode:a.detailedErrorCode,error:a.error,reason:a.reason});this.player.trigger(new _.F(_.Nd,{detail:a}));this.a(_.mn)}};var Z=class{constructor(a,b,c,d,e){this.a=a;this.f=b;this.j=typeof c===_.r?c:1;this.l=typeof d===_.r?d:1;this.g=typeof e===_.r?e:0}rb(){return"Google Cast Framework"}sb(){return cast.framework.VERSION}yb(){return 0}getId(){return""}getCreativeId(){return""}getApiFramework(){return null}getAdSystem(){return""}getAdvertiserName(){return""}getTitle(){return this.a.title||""}getDuration(){return this.a.duration||0}getSkipTimeOffset(){return this.a.whenSkippable||0}ec(){return!1}Lb(){return this.a.clickThroughUrl||
53
53
  null}getMediaUrl(){return this.a.contentUrl||this.a.contentId||null}vb(){return 0}ub(){return 0}ib(){return 0}Va(){switch(this.Mb()){case 0:return 0;case -1:return 2;default:return 1}}getPodIndex(){return this.g}Mb(){return this.f.position}Nb(){return this.j}xb(){return this.l}getWrapperAdIds(){return[]}getWrapperAdSystems(){return[]}getWrapperCreativeIds(){return[]}};Z.prototype.getWrapperCreativeIds=Z.prototype.getWrapperCreativeIds;Z.prototype.getWrapperAdSystems=Z.prototype.getWrapperAdSystems;
54
54
  Z.prototype.getWrapperAdIds=Z.prototype.getWrapperAdIds;Z.prototype.getSequenceLength=Z.prototype.xb;Z.prototype.getPositionInSequence=Z.prototype.Nb;Z.prototype.getPodTimeOffset=Z.prototype.Mb;Z.prototype.getPodIndex=Z.prototype.getPodIndex;Z.prototype.getPodType=Z.prototype.Va;Z.prototype.getMediaBitrate=Z.prototype.ib;Z.prototype.getMediaHeight=Z.prototype.ub;Z.prototype.getMediaWidth=Z.prototype.vb;Z.prototype.getMediaUrl=Z.prototype.getMediaUrl;Z.prototype.getClickThroughUrl=Z.prototype.Lb;
55
55
  Z.prototype.isBumper=Z.prototype.ec;Z.prototype.getSkipTimeOffset=Z.prototype.getSkipTimeOffset;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.getCreativeId=Z.prototype.getCreativeId;Z.prototype.getId=Z.prototype.getId;Z.prototype.getTechnology=Z.prototype.yb;
56
- Z.prototype.getAdManagerVersion=Z.prototype.sb;Z.prototype.getAdManagerName=Z.prototype.rb;var jQ=class{constructor(a){this.a=a}getCuePoints(){return this.a.map(a=>a.position)}Ob(){return!!this.a.find(a=>0===a.position)}jb(){return!!this.a.find(a=>-1===a.position)}};jQ.prototype.hasPostroll=jQ.prototype.jb;jQ.prototype.hasPreroll=jQ.prototype.Ob;jQ.prototype.getCuePoints=jQ.prototype.getCuePoints;var kQ=class{constructor(a){this.m=a;this.a=null;this.g=this.j.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];KP().addEventListener(this.f,
57
- this.g)}load(){const a=this;return _.x(function*(){GP&&(GP=!1,JP(a,0))})}start(){return _.x(function*(){KP().play()})}resume(){-1!==this.getPosition()&&KP().play()}pause(){-1!==this.getPosition()&&KP().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===_.r?a:-1}dispose(){const a=this;return _.x(function*(){KP().removeEventListener(a.f,a.g)})}j(a){const b=cast.framework.events.EndedReason;
58
- switch(a.type){case cast.framework.events.EventType.PLAYER_LOADING:this.a=KP().getBreakManager();this.a.setPlayWatchedBreak(!0);a=this.a.getBreaks();this.m.trigger(new _.F(_.nc,{adsTimeline:new jQ(a)}));break;case cast.framework.events.EventType.BREAK_CLIP_LOADING:MP(this,_.dc,a);break;case cast.framework.events.EventType.BREAK_STARTED:MP(this,_.Wb,a);break;case cast.framework.events.EventType.BREAK_ENDED:MP(this,_.Xb,a);break;case cast.framework.events.EventType.BREAK_CLIP_STARTED:MP(this,_.jc,a);
59
- break;case cast.framework.events.EventType.BREAK_CLIP_ENDED:a.endedReason===b.SKIPPED?(MP(this,_.ic,a),MP(this,_.kc,a)):a.endedReason===b.STOPPED?MP(this,_.kc,a):a.endedReason===b.END_OF_STREAM?(MP(this,_.ac,a),MP(this,_.kc,a)):a.endedReason===b.ERROR&&JP(this,1);break;case cast.framework.events.EventType.PLAYING:MP(this,_.hc,a);break;case cast.framework.events.EventType.PAUSE:MP(this,_.fc,a);break;case cast.framework.events.EventType.BUFFERING:a.isBuffering?MP(this,_.Yb,a):MP(this,_.hc,a)}}};
60
- kQ.prototype.getPosition=kQ.prototype.getPosition;kQ.prototype.setVolume=kQ.prototype.setVolume;kQ.prototype.getVolume=kQ.prototype.getVolume;kQ.prototype.skip=kQ.prototype.skip;kQ.prototype.pause=kQ.prototype.pause;kQ.prototype.resume=kQ.prototype.resume;var GP=!1;var lQ=class{constructor(a){this.Tb=a;this.a=this.f.bind(this)}init(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().addEventListener(NP(),this.a)}release(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().removeEventListener(NP(),this.a)}getTimelineCues(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager().getTimedMetadata().map(a=>OP(a))}f(a){if(a instanceof cast.framework.events.TimedMetadataEvent){var b=null;switch(a.type){case cast.framework.events.EventType.TIMED_METADATA_CHANGED:b=
61
- _.Xg;break;case cast.framework.events.EventType.TIMED_METADATA_ENTER:b=_.Zg;break;case cast.framework.events.EventType.TIMED_METADATA_EXIT:b=_.$g}b&&this.Tb(new _.F(b,{detail:OP(a.timedMetadataInfo)}))}else for(b of this.getTimelineCues())this.Tb(new _.F(_.Xg,{detail:b}))}};var mQ=class extends _.S{constructor(){super();this.h=new _.R("clpp.cast.TrackManager");this.m=null;this.o=1E9;this.g=[];this.j=[];this.l=this.w.bind(this);this.a=this.f=null}initialize(a){this.m=a;PP().addEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.l)}release(){this.g=[];this.j=[];this.a=this.f=null}load(){}destroy(){this.m=null;PP().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.l)}getVideoTracks(){return[]}getAudioTracks(){return this.g}ka(){return this.j}ia(){return null}Ia(){const a=
62
- this.oa();return a&&a.renditions[0]}Ja(){const a=this.pa();return a&&a.renditions[0]}Ua(){return null}gb(){return null}hb(){return null}La(){return null}oa(){let a=null;if(this.f){let b=this.f.getActiveId();typeof b===_.r&&(b=b.toString(),a=this.getAudioTracks().find(c=>c.id===b)||null)}return a}pa(){let a=null;if(this.a){let b=this.a.getActiveIds()[0];typeof b===_.r&&(b=b.toString(),a=this.ka().find(c=>c.id===b)||null)}return a}Za(){this.h.warn("Video tracks unavailable on Cast")}sa(a){a&&this.f&&
63
- this.f.setActiveById(+a.id)}Fa(a){this.a&&(a?this.a.setActiveByIds([+a.id]):this.a.setActiveByIds([]))}Ya(){this.h.warn("Video renditions unavailable on Cast")}mb(a){this.sa(a&&a.track)}nb(a){this.Fa(a&&a.track)}addTextTrack(a){const b=this;return _.x(function*(){var c=b.m.getConfiguration();if((c=yield fP(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=
64
- c.language;d.name=c.label;d.subtype=c.kind;d.trackContentId=c.url;d.trackContentType=c.mimeType;d.customData={mimeType:a.mimeType,url:a.url};try{b.a.addTracks([d]),RP(b)}catch(e){throw b.h.warn("failed on track",a),e;}}})}ma(){return!0}w(){this.f=PP().getAudioTracksManager();var a=this.f.getTracks();this.g=QP(_.L,a);RP(this);a=this.m.getConfiguration();SP(this,_.L,a.preferredAudioLanguage,a.preferredAudioRole);SP(this,_.K,a.preferredTextLanguage,a.preferredTextRole)}};mQ.prototype.isAbrEnabled=mQ.prototype.ma;
65
- mQ.prototype.addTextTrack=mQ.prototype.addTextTrack;mQ.prototype.setTextRendition=mQ.prototype.nb;mQ.prototype.setAudioRendition=mQ.prototype.mb;mQ.prototype.setVideoRendition=mQ.prototype.Ya;mQ.prototype.setTextTrack=mQ.prototype.Fa;mQ.prototype.setAudioTrack=mQ.prototype.sa;mQ.prototype.setVideoTrack=mQ.prototype.Za;mQ.prototype.getTextTrack=mQ.prototype.pa;mQ.prototype.getAudioTrack=mQ.prototype.oa;mQ.prototype.getVideoTrack=mQ.prototype.La;mQ.prototype.getLoadingTextRendition=mQ.prototype.hb;
66
- mQ.prototype.getLoadingAudioRendition=mQ.prototype.gb;mQ.prototype.getLoadingVideoRendition=mQ.prototype.Ua;mQ.prototype.getTextRendition=mQ.prototype.Ja;mQ.prototype.getAudioRendition=mQ.prototype.Ia;mQ.prototype.getVideoRendition=mQ.prototype.ia;mQ.prototype.getTextTracks=mQ.prototype.ka;mQ.prototype.getAudioTracks=mQ.prototype.getAudioTracks;mQ.prototype.getVideoTracks=mQ.prototype.getVideoTracks;var nQ=class extends _.Pr{constructor(){super();this.h=new _.R(YO);this.g=this.w=_.lk();this.A=null;this.l=-1;this.F=new _.lo;this.f=this.o=this.j=this.a=this.B=null;this.C=!1}init(a,b){this.B=a;b&&(this.g=this.w=b);a=TP();a.setMessageInterceptor(cast.framework.messages.MessageType.MEDIA_STATUS,this.H.bind(this));a.setMediaPlaybackInfoHandler(this.G.bind(this));this.a=new iQ(this);this.a.init();this.j=new mQ;this.j.initialize(this);this.o=new lQ(c=>this.trigger(c));this.o.init()}unload(){const a=
67
- cast.framework.messages.PlayerState,b=TP();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=_.lk();a.g=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=TP();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot play during ads playout.");
68
- a.play();return Promise.resolve()}pause(){const a=TP();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot pause during ads playout.");a.pause();return Promise.resolve()}isPaused(){return TP().getPlayerState()===cast.framework.messages.PlayerState.PAUSED}isEnded(){return TP().getPlayerState()===cast.framework.messages.PlayerState.IDLE}seek(a){const b=TP();if(null!==b.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject(QO);b.seek(a);return Promise.resolve()}getPosition(){return TP().getCurrentTimeSec()}getDuration(){const a=
69
- TP().getDurationSec();return typeof a===_.r?-1===a?Infinity:a:-1}getPlaybackRate(){return TP().getPlaybackRate()}setPlaybackRate(a){if(0<a){const b=new cast.framework.messages.SetPlaybackRateRequestData;b.playbackRate=a;TP().sendLocalMediaRequest(b)}}getVolume(){return cast.framework.CastReceiverContext.getInstance().getSystemVolume().level||null}setVolume(a){0<=a&&1>=a&&cast.framework.CastReceiverContext.getInstance().setSystemVolumeLevel(a)}setMuted(a){cast.framework.CastReceiverContext.getInstance().setSystemVolumeMuted(a)}isMuted(){return cast.framework.CastReceiverContext.getInstance().getSystemVolume().muted||
70
- null}getLoadedSource(){const a=TP().getMediaInformation();if(a){var b=TP().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,sh:b,name:c}}return null}getDrmInfo(){return null}getPresentationStartTime(){return TP().getStartAbsoluteTime()}getSeekRange(){let a={start:0,end:this.getDuration()};if(this.isLive()){const b=TP().getLiveSeekableRange();
71
- b&&typeof b.start===_.r&&typeof b.end===_.r&&(a={start:b.start,end:b.end})}return a}getState(){return this.a?this.a.getState():_.js}getStats(){var a=_.Xm();if(this.f){a=TP().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.g=c;b=this.f;c=typeof a.decodedFrames===_.r?a.decodedFrames:NaN;b.l=typeof a.droppedFrames===_.r?a.droppedFrames:NaN;b.j=c;a=this.f.getStats()}return a}isLive(){return Infinity===this.getDuration()}load(a){const b=
72
- this;return _.x(function*(){b.f=new _.hs;b.a.l=b.f.a;b.A=_.qn(a);_.ok(a)&&(b.g=_.nk(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.g.autoplay;typeof b.g.startTime===_.r&&(d.currentTime=b.g.startTime);c.type&&(d.media.contentType=c.type);d.media.contentId=c.url;d.media.customData={playerConfiguration:dP(b.g),local:!0};yield TP().load(d)}})}getBufferInfo(){this.h.warn(_.oa);return new _.Or}getTrackManager(){return this.j}getConfiguration(){return this.g}getSurface(){return this.B}setNetworkEngine(a){this.F=
73
- a}getNetworkEngine(){return this.F}getSourceIndex(){return this.l}setSourceIndex(a){this.l=a}getPeriods(){return[]}namespace(){return YO}getTimelineCues(){return this.o&&this.o.getTimelineCues()||[]}resetAbr(){this.h.warn(UO)}onError(a){a=new _.F(_.Md,{detail:a});this.trigger(a)}canPlay(){return _.xj()?2:0}H(a){a=Object.assign({},a);a.customData||(a.customData={});a.customData.stats=dP(this.getStats());var b=TP(),c=a.media||b.getMediaInformation();b=b.getStartAbsoluteTime();c&&typeof b===_.r&&c.startAbsoluteTime!==
74
- b&&(this.h.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=TP().getStartAbsoluteTime();if(typeof d===_.r){b.startAbsoluteTime=d;let h;f?h=new cast.framework.messages.GenericMediaMetadata:h=b.metadata;h.sectionStartAbsoluteTime=d;b.metadata=h}b.streamType=c.LIVE;
75
- a=Object.assign({},a,{media:b})}}return a}G(a,b){let c=null;a.media.customData&&(c=eP(a.media.customData.playerConfiguration));(a=c?c.abr:null)&&typeof a.defaultBandwidthEstimate===_.r?b.initialBandwidth=a.defaultBandwidthEstimate:b.initialBandwidth=void 0;WP(c,b);return b}getTextDisplayer(){return null}setDrmCustomDataModifier(){}setCdnErrorCallback(){}detach(){}};nQ.prototype.getTextDisplayer=nQ.prototype.getTextDisplayer;nQ.prototype.getNetworkEngine=nQ.prototype.getNetworkEngine;
76
- nQ.prototype.setNetworkEngine=nQ.prototype.setNetworkEngine;var YP=class{constructor(){this.a=!1;this.h=new _.R(ZO);this.f=this.m=null;this.g=new Set;this.A=this.G.bind(this);this.w=this.B.bind(this);this.j=null;this.o=new _.br;this.l=null}init(a){a&&(this.f=new nQ,_.uo(a,this.f),this.m=a,this.o.on(window,"unload",()=>{const b=this;return _.x(function*(){b.m&&b.m.getState()!==_.kn&&(yield cP(b.m))})}))}start(){if(!this.a&&window.cast&&cast.framework&&cast.framework.CastReceiverContext){this.a=!0;var a=$P(),b=$P().getPlayerManager(),c=new cast.framework.CastReceiverOptions;
77
- c.customNamespaces={};c.customNamespaces[$O]=cast.framework.system.MessageType.JSON;c.shakaVersion="4.3.4";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,
78
- this.A);a.start(c);a.addCustomMessageListener($O,this.w)}}stop(){if(this.a){this.a=!1;this.o.release();const a=$P();$P().getPlayerManager().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.A);a.removeCustomMessageListener($O,this.w);a.stop();this.m=this.f=null}}$c(a){this.j=a}Vg(a){this.l=a}on(a,b){$P().addEventListener(a,b)}off(a,b){$P().removeEventListener(a,b)}addMessageListener(a){typeof a===_.Od&&this.g.add(a)}removeMessageListener(a){typeof a===_.Od&&this.g.delete(a)}sendMessage(a,
79
- b){$P().sendCustomMessage($O,b,dP(a))}cc(){return this.a}fb(){var a;return a=(a=$P().getPlayerManager().getMediaInformation())&&a.metadata?a.metadata:null}F(a){a=a.trim();if(a.startsWith("#EXTM3U"))return bQ(this,a);try{var b=(new DOMParser).parseFromString(a,_.zf)}catch(k){return a}var c=b.getElementsByTagName("MPD")[0];if(c){a=c;this.h.debug("Detected DASH, parsing");b=$P();c=a.getElementsByTagName("Period");for(var d=c.length-1;0<=d;--d){var e=c[d].getElementsByTagName(_.fa);for(var f=e.length-
80
- 1;0<=f;--f){var g=e[f].getAttribute("contentType");if(g===_.w||g===_.p){g=e[f].getAttribute(_.me);var h=e[f].getElementsByTagName(_.wb);for(let k=h.length-1;0<=k;--k){const l=h[k].getAttribute(_.me)||g,m=h[k].getAttribute(_.kd);let n=h[k].getAttribute(_.fg)||void 0,q=h[k].getAttribute(_.Pd)||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(_.wb).length||c[d].removeChild(e[f])}}c[d].getElementsByTagName(_.fa).length||a.removeChild(c[d])}return a=
81
- (new XMLSerializer).serializeToString(a)}if(c=b.getElementsByTagName(_.Db)[0]){a=c;this.h.debug("Detected Smooth, parsing");b=$P();c=a.getElementsByTagName("StreamIndex");for(d=c.length-1;0<=d;--d)if(c[d].getAttribute("Type")===_.w){e=c[d].getElementsByTagName(_.sb);for(f=e.length-1;0<=f;--f)g=e[f].getAttribute(_.db)||void 0,h=e[f].getAttribute(_.cb)||void 0,void 0!==g&&(g=+g),void 0!==h&&(h=+h),b.canDisplayType(_.Of,void 0,g,h)||c[d].removeChild(e[f]);c[d].getElementsByTagName(_.sb).length||a.removeChild(c[d])}a=
82
- (new XMLSerializer).serializeToString(a)}return a}C(a){const b=this;return _.x(function*(){let c=a;var d;c.media.customData&&(d=eP(c.media.customData.playerConfiguration));if(b.m&&d){b.j&&(d=(yield Promise.resolve(b.j(d)))||d);d.ima&&(yield IP(c.media,d.ima,b.m.getNetworkEngine()));typeof d.startTime===_.r&&d.startTime!==c.currentTime?c.currentTime=d.startTime:d.startTime=c.currentTime||null;c.media.customData.local||(b.f.C=!0,yield _.Bo(b.m,d),yield _.Co(b.m),d=b.m.getLoadedSource(),c.media.contentId=
83
- d.url,c.media.contentType=d.type,d.Eb&&(c.media.hlsVideoSegmentFormat=gP(d.Eb,_.M)),d.audioMimeType&&(c.media.hlsSegmentFormat=gP(d.audioMimeType,_.L)));const e=c.media.metadata;e&&typeof e.sectionStartAbsoluteTime===_.r&&(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=$P().getPlayerManager(),
84
- c=b.getLiveSeekableRange();if(c){a=c.start;c=c.end;var d=this.m.getConfiguration().startTime;typeof a!==_.r||typeof c!==_.r||typeof d!==_.r||d>=a&&d<=c||(b=b.getMediaTimeForAbsoluteTime(d),typeof b===_.r&&b>=a&&b<=c&&this.m.seek(b))}_.Eo(this.m)}}B(a){if(0<this.g.size){const b=eP(a.data);this.g.forEach(c=>c(b))}}};_.z(ZO,YP);YP.prototype.getContentMetadata=YP.prototype.fb;YP.prototype.isApiReady=YP.prototype.cc;YP.prototype.sendMessage=YP.prototype.sendMessage;YP.prototype.removeMessageListener=YP.prototype.removeMessageListener;
85
- YP.prototype.addMessageListener=YP.prototype.addMessageListener;YP.prototype.off=YP.prototype.off;YP.prototype.on=YP.prototype.on;YP.prototype.setLoadRequestDataInterceptor=YP.prototype.Vg;YP.prototype.setPlayerConfigInterceptor=YP.prototype.$c;YP.prototype.stop=YP.prototype.stop;YP.prototype.start=YP.prototype.start;YP.prototype.init=YP.prototype.init;YP.getInstance=ZP;var XP=null;var oQ=class{constructor(a){this.f=a;this.a=null;this.g=new _.br;this.j=[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.l.bind(a);for(const d of a.j)a.g.on(b,d,c)}})}start(){return _.x(function*(){})}resume(){this.a&&
86
- this.a.isPlayingBreak&&this.a.isPaused&&this.a.controller.playOrPause()}pause(){this.a&&this.a.isPlayingBreak&&!this.a.isPaused&&this.a.controller.playOrPause()}skip(){const a=this.f.a;a&&this.f.sendMessage(bP,{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===_.r&&(a=b));return a}dispose(){const a=this;
87
- return _.x(function*(){a.g.release()})}l(a){switch(a.field){case "mediaInfo":a.value&&(a=a.value,a.breaks&&this.f.trigger(new _.F(_.nc,{adsTimeline:new jQ(a.breaks)})));break;case "isPlayingBreak":a.value?dQ(this,_.Wb):(dQ(this,_.ac),dQ(this,_.kc),dQ(this,_.Xb));break;case "currentBreakClipNumber":0<=a.value&&(0<a.value&&(dQ(this,_.ac),dQ(this,_.kc)),dQ(this,_.jc));break;case "isPaused":this.a.isPlayingBreak&&(a.value?dQ(this,_.fc):dQ(this,_.hc))}}};oQ.prototype.getPosition=oQ.prototype.getPosition;
88
- oQ.prototype.setVolume=oQ.prototype.setVolume;oQ.prototype.getVolume=oQ.prototype.getVolume;oQ.prototype.skip=oQ.prototype.skip;oQ.prototype.pause=oQ.prototype.pause;oQ.prototype.resume=oQ.prototype.resume;var pQ=class{name(){return"clpp.cast.ads.SenderAdsManagerFactory"}da(a,b){return a.namespace()!==_.dd?!1:!(!b||!b.ima)}create(a){return new oQ(a.a)}};pQ.prototype.create=pQ.prototype.create;pQ.prototype.isSupported=pQ.prototype.da;pQ.prototype.name=pQ.prototype.name;_.En(new pQ);var qQ=class{name(){return"clpp.cast.ads.AdsManagerFactory"}da(a,b){return ZP().cc()?!(!b||!b.ima):!1}create(a){return new kQ(a)}};qQ.prototype.create=qQ.prototype.create;qQ.prototype.isSupported=qQ.prototype.da;qQ.prototype.name=qQ.prototype.name;_.En(new qQ);};f.call(g, window);
56
+ Z.prototype.getAdManagerVersion=Z.prototype.sb;Z.prototype.getAdManagerName=Z.prototype.rb;var uQ=class{constructor(a){this.a=a}getCuePoints(){return this.a.map(a=>a.position)}Ob(){return!!this.a.find(a=>0===a.position)}jb(){return!!this.a.find(a=>-1===a.position)}};uQ.prototype.hasPostroll=uQ.prototype.jb;uQ.prototype.hasPreroll=uQ.prototype.Ob;uQ.prototype.getCuePoints=uQ.prototype.getCuePoints;var vQ=class{constructor(a){this.m=a;this.a=null;this.g=this.j.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];VP().addEventListener(this.f,
57
+ this.g)}load(){const a=this;return _.x(function*(){RP&&(RP=!1,UP(a,0))})}start(){return _.x(function*(){VP().play()})}resume(){-1!==this.getPosition()&&VP().play()}pause(){-1!==this.getPosition()&&VP().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===_.r?a:-1}dispose(){const a=this;return _.x(function*(){VP().removeEventListener(a.f,a.g)})}j(a){const b=cast.framework.events.EndedReason;
58
+ switch(a.type){case cast.framework.events.EventType.PLAYER_LOADING:this.a=VP().getBreakManager();this.a.setPlayWatchedBreak(!0);a=this.a.getBreaks();this.m.trigger(new _.F(_.nc,{adsTimeline:new uQ(a)}));break;case cast.framework.events.EventType.BREAK_CLIP_LOADING:XP(this,_.dc,a);break;case cast.framework.events.EventType.BREAK_STARTED:XP(this,_.Wb,a);break;case cast.framework.events.EventType.BREAK_ENDED:XP(this,_.Xb,a);break;case cast.framework.events.EventType.BREAK_CLIP_STARTED:XP(this,_.jc,a);
59
+ break;case cast.framework.events.EventType.BREAK_CLIP_ENDED:a.endedReason===b.SKIPPED?(XP(this,_.ic,a),XP(this,_.kc,a)):a.endedReason===b.STOPPED?XP(this,_.kc,a):a.endedReason===b.END_OF_STREAM?(XP(this,_.ac,a),XP(this,_.kc,a)):a.endedReason===b.ERROR&&UP(this,1);break;case cast.framework.events.EventType.PLAYING:XP(this,_.hc,a);break;case cast.framework.events.EventType.PAUSE:XP(this,_.fc,a);break;case cast.framework.events.EventType.BUFFERING:a.isBuffering?XP(this,_.Yb,a):XP(this,_.hc,a)}}};
60
+ vQ.prototype.getPosition=vQ.prototype.getPosition;vQ.prototype.setVolume=vQ.prototype.setVolume;vQ.prototype.getVolume=vQ.prototype.getVolume;vQ.prototype.skip=vQ.prototype.skip;vQ.prototype.pause=vQ.prototype.pause;vQ.prototype.resume=vQ.prototype.resume;var RP=!1;var wQ=class{constructor(a){this.Tb=a;this.a=this.f.bind(this)}init(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().addEventListener(YP(),this.a)}release(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().removeEventListener(YP(),this.a)}getTimelineCues(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager().getTimedMetadata().map(a=>ZP(a))}f(a){if(a instanceof cast.framework.events.TimedMetadataEvent){var b=null;switch(a.type){case cast.framework.events.EventType.TIMED_METADATA_CHANGED:b=
61
+ _.Yg;break;case cast.framework.events.EventType.TIMED_METADATA_ENTER:b=_.$g;break;case cast.framework.events.EventType.TIMED_METADATA_EXIT:b=_.ah}b&&this.Tb(new _.F(b,{detail:ZP(a.timedMetadataInfo)}))}else for(b of this.getTimelineCues())this.Tb(new _.F(_.Yg,{detail:b}))}};var xQ=class extends _.S{constructor(){super();this.h=new _.R("clpp.cast.TrackManager");this.m=null;this.o=1E9;this.g=[];this.j=[];this.l=this.w.bind(this);this.a=this.f=null}initialize(a){this.m=a;$P().addEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.l)}release(){this.g=[];this.j=[];this.a=this.f=null}load(){}destroy(){this.m=null;$P().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.l)}getVideoTracks(){return[]}getAudioTracks(){return this.g}ka(){return this.j}ia(){return null}Ja(){const a=
62
+ this.oa();return a&&a.renditions[0]}Ka(){const a=this.pa();return a&&a.renditions[0]}Ua(){return null}gb(){return null}hb(){return null}Ma(){return null}oa(){let a=null;if(this.f){let b=this.f.getActiveId();typeof b===_.r&&(b=b.toString(),a=this.getAudioTracks().find(c=>c.id===b)||null)}return a}pa(){let a=null;if(this.a){let b=this.a.getActiveIds()[0];typeof b===_.r&&(b=b.toString(),a=this.ka().find(c=>c.id===b)||null)}return a}Za(){this.h.warn("Video tracks unavailable on Cast")}sa(a){a&&this.f&&
63
+ this.f.setActiveById(+a.id)}Fa(a){this.a&&(a?this.a.setActiveByIds([+a.id]):this.a.setActiveByIds([]))}Ya(){this.h.warn("Video renditions unavailable on Cast")}mb(a){this.sa(a&&a.track)}nb(a){this.Fa(a&&a.track)}addTextTrack(a){const b=this;return _.x(function*(){var c=b.m.getConfiguration();if((c=yield qP(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=
64
+ c.language;d.name=c.label;d.subtype=c.kind;d.trackContentId=c.url;d.trackContentType=c.mimeType;d.customData={mimeType:a.mimeType,url:a.url};try{b.a.addTracks([d]),bQ(b)}catch(e){throw b.h.warn("failed on track",a),e;}}})}ma(){return!0}w(){this.f=$P().getAudioTracksManager();var a=this.f.getTracks();this.g=aQ(_.L,a);bQ(this);a=this.m.getConfiguration();cQ(this,_.L,a.preferredAudioLanguage,a.preferredAudioRole);cQ(this,_.K,a.preferredTextLanguage,a.preferredTextRole)}};xQ.prototype.isAbrEnabled=xQ.prototype.ma;
65
+ xQ.prototype.addTextTrack=xQ.prototype.addTextTrack;xQ.prototype.setTextRendition=xQ.prototype.nb;xQ.prototype.setAudioRendition=xQ.prototype.mb;xQ.prototype.setVideoRendition=xQ.prototype.Ya;xQ.prototype.setTextTrack=xQ.prototype.Fa;xQ.prototype.setAudioTrack=xQ.prototype.sa;xQ.prototype.setVideoTrack=xQ.prototype.Za;xQ.prototype.getTextTrack=xQ.prototype.pa;xQ.prototype.getAudioTrack=xQ.prototype.oa;xQ.prototype.getVideoTrack=xQ.prototype.Ma;xQ.prototype.getLoadingTextRendition=xQ.prototype.hb;
66
+ xQ.prototype.getLoadingAudioRendition=xQ.prototype.gb;xQ.prototype.getLoadingVideoRendition=xQ.prototype.Ua;xQ.prototype.getTextRendition=xQ.prototype.Ka;xQ.prototype.getAudioRendition=xQ.prototype.Ja;xQ.prototype.getVideoRendition=xQ.prototype.ia;xQ.prototype.getTextTracks=xQ.prototype.ka;xQ.prototype.getAudioTracks=xQ.prototype.getAudioTracks;xQ.prototype.getVideoTracks=xQ.prototype.getVideoTracks;var yQ=class extends _.Vr{constructor(){super();this.h=new _.R(iP);this.g=this.w=_.mk();this.A=null;this.l=-1;this.F=new _.oo;this.f=this.o=this.j=this.a=this.B=null;this.C=!1}init(a,b){this.B=a;b&&(this.g=this.w=b);a=dQ();a.setMessageInterceptor(cast.framework.messages.MessageType.MEDIA_STATUS,this.H.bind(this));a.setMediaPlaybackInfoHandler(this.G.bind(this));this.a=new tQ(this);this.a.init();this.j=new xQ;this.j.initialize(this);this.o=new wQ(c=>this.trigger(c));this.o.init()}unload(){const a=
67
+ cast.framework.messages.PlayerState,b=dQ();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=_.mk();a.g=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=dQ();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot play during ads playout.");
68
+ a.play();return Promise.resolve()}pause(){const a=dQ();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot pause during ads playout.");a.pause();return Promise.resolve()}isPaused(){return dQ().getPlayerState()===cast.framework.messages.PlayerState.PAUSED}isEnded(){return dQ().getPlayerState()===cast.framework.messages.PlayerState.IDLE}seek(a){const b=dQ();if(null!==b.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject(aP);b.seek(a);return Promise.resolve()}getPosition(){return dQ().getCurrentTimeSec()}getDuration(){const a=
69
+ dQ().getDurationSec();return typeof a===_.r?-1===a?Infinity:a:-1}getPlaybackRate(){return dQ().getPlaybackRate()}setPlaybackRate(a){if(0<a){const b=new cast.framework.messages.SetPlaybackRateRequestData;b.playbackRate=a;dQ().sendLocalMediaRequest(b)}}getVolume(){return cast.framework.CastReceiverContext.getInstance().getSystemVolume().level||null}setVolume(a){0<=a&&1>=a&&cast.framework.CastReceiverContext.getInstance().setSystemVolumeLevel(a)}setMuted(a){cast.framework.CastReceiverContext.getInstance().setSystemVolumeMuted(a)}isMuted(){return cast.framework.CastReceiverContext.getInstance().getSystemVolume().muted||
70
+ null}getLoadedSource(){const a=dQ().getMediaInformation();if(a){var b=dQ().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,th:b,name:c}}return null}getDrmInfo(){return null}getPresentationStartTime(){return dQ().getStartAbsoluteTime()}getSeekRange(){let a={start:0,end:this.getDuration()};if(this.isLive()){const b=dQ().getLiveSeekableRange();
71
+ b&&typeof b.start===_.r&&typeof b.end===_.r&&(a={start:b.start,end:b.end})}return a}getState(){return this.a?this.a.getState():_.ps}getStats(){var a=_.$m();if(this.f){a=dQ().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.g=c;b=this.f;c=typeof a.decodedFrames===_.r?a.decodedFrames:NaN;b.l=typeof a.droppedFrames===_.r?a.droppedFrames:NaN;b.j=c;a=this.f.getStats()}return a}isLive(){return Infinity===this.getDuration()}load(a){const b=
72
+ this;return _.x(function*(){b.f=new _.ns;b.a.l=b.f.a;b.A=_.tn(a);_.pk(a)&&(b.g=_.ok(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.g.autoplay;typeof b.g.startTime===_.r&&(d.currentTime=b.g.startTime);c.type&&(d.media.contentType=c.type);d.media.contentId=c.url;d.media.customData={playerConfiguration:oP(b.g),local:!0};yield dQ().load(d)}})}getBufferInfo(){this.h.warn(_.oa);return new _.Ur}getTrackManager(){return this.j}getConfiguration(){return this.g}getSurface(){return this.B}setNetworkEngine(a){this.F=
73
+ a}getNetworkEngine(){return this.F}getSourceIndex(){return this.l}setSourceIndex(a){this.l=a}getPeriods(){return[]}namespace(){return iP}getTimelineCues(){return this.o&&this.o.getTimelineCues()||[]}resetAbr(){this.h.warn(eP)}onError(a){a=new _.F(_.Nd,{detail:a});this.trigger(a)}canPlay(){return _.yj()?2:0}H(a){a=Object.assign({},a);a.customData||(a.customData={});a.customData.stats=oP(this.getStats());var b=dQ(),c=a.media||b.getMediaInformation();b=b.getStartAbsoluteTime();c&&typeof b===_.r&&c.startAbsoluteTime!==
74
+ b&&(this.h.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=dQ().getStartAbsoluteTime();if(typeof d===_.r){b.startAbsoluteTime=d;let h;f?h=new cast.framework.messages.GenericMediaMetadata:h=b.metadata;h.sectionStartAbsoluteTime=d;b.metadata=h}b.streamType=c.LIVE;
75
+ a=Object.assign({},a,{media:b})}}return a}G(a,b){let c=null;a.media.customData&&(c=pP(a.media.customData.playerConfiguration));(a=c?c.abr:null)&&typeof a.defaultBandwidthEstimate===_.r?b.initialBandwidth=a.defaultBandwidthEstimate:b.initialBandwidth=void 0;gQ(c,b);return b}getTextDisplayer(){return null}setDrmCustomDataModifier(){}setCdnErrorCallback(){}detach(){}};yQ.prototype.getTextDisplayer=yQ.prototype.getTextDisplayer;yQ.prototype.getNetworkEngine=yQ.prototype.getNetworkEngine;
76
+ yQ.prototype.setNetworkEngine=yQ.prototype.setNetworkEngine;var iQ=class{constructor(){this.a=!1;this.h=new _.R(jP);this.f=this.m=null;this.g=new Set;this.A=this.G.bind(this);this.w=this.B.bind(this);this.j=null;this.o=new _.hr;this.l=null}init(a){a&&(this.f=new yQ,_.xo(a,this.f),this.m=a,this.o.on(window,"unload",()=>{const b=this;return _.x(function*(){b.m&&b.m.getState()!==_.nn&&(yield nP(b.m))})}))}start(){if(!this.a&&window.cast&&cast.framework&&cast.framework.CastReceiverContext){this.a=!0;var a=kQ(),b=kQ().getPlayerManager(),c=new cast.framework.CastReceiverOptions;
77
+ c.customNamespaces={};c.customNamespaces[kP]=cast.framework.system.MessageType.JSON;c.shakaVersion="4.3.4";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,
78
+ this.A);a.start(c);a.addCustomMessageListener(kP,this.w)}}stop(){if(this.a){this.a=!1;this.o.release();const a=kQ();kQ().getPlayerManager().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.A);a.removeCustomMessageListener(kP,this.w);a.stop();this.m=this.f=null}}$c(a){this.j=a}Ug(a){this.l=a}on(a,b){kQ().addEventListener(a,b)}off(a,b){kQ().removeEventListener(a,b)}addMessageListener(a){typeof a===_.Pd&&this.g.add(a)}removeMessageListener(a){typeof a===_.Pd&&this.g.delete(a)}sendMessage(a,
79
+ b){kQ().sendCustomMessage(kP,b,oP(a))}cc(){return this.a}fb(){var a;return a=(a=kQ().getPlayerManager().getMediaInformation())&&a.metadata?a.metadata:null}F(a){a=a.trim();if(a.startsWith("#EXTM3U"))return mQ(this,a);try{var b=(new DOMParser).parseFromString(a,_.Af)}catch(k){return a}var c=b.getElementsByTagName("MPD")[0];if(c){a=c;this.h.debug("Detected DASH, parsing");b=kQ();c=a.getElementsByTagName("Period");for(var d=c.length-1;0<=d;--d){var e=c[d].getElementsByTagName(_.fa);for(var f=e.length-
80
+ 1;0<=f;--f){var g=e[f].getAttribute("contentType");if(g===_.w||g===_.p){g=e[f].getAttribute(_.ne);var h=e[f].getElementsByTagName(_.wb);for(let k=h.length-1;0<=k;--k){const l=h[k].getAttribute(_.ne)||g,m=h[k].getAttribute(_.kd);let n=h[k].getAttribute(_.gg)||void 0,q=h[k].getAttribute(_.Qd)||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(_.wb).length||c[d].removeChild(e[f])}}c[d].getElementsByTagName(_.fa).length||a.removeChild(c[d])}return a=
81
+ (new XMLSerializer).serializeToString(a)}if(c=b.getElementsByTagName(_.Db)[0]){a=c;this.h.debug("Detected Smooth, parsing");b=kQ();c=a.getElementsByTagName("StreamIndex");for(d=c.length-1;0<=d;--d)if(c[d].getAttribute("Type")===_.w){e=c[d].getElementsByTagName(_.sb);for(f=e.length-1;0<=f;--f)g=e[f].getAttribute(_.db)||void 0,h=e[f].getAttribute(_.cb)||void 0,void 0!==g&&(g=+g),void 0!==h&&(h=+h),b.canDisplayType(_.Pf,void 0,g,h)||c[d].removeChild(e[f]);c[d].getElementsByTagName(_.sb).length||a.removeChild(c[d])}a=
82
+ (new XMLSerializer).serializeToString(a)}return a}C(a){const b=this;return _.x(function*(){let c=a;var d;c.media.customData&&(d=pP(c.media.customData.playerConfiguration));if(b.m&&d){b.j&&(d=(yield Promise.resolve(b.j(d)))||d);d.ima&&(yield TP(c.media,d.ima,b.m.getNetworkEngine()));typeof d.startTime===_.r&&d.startTime!==c.currentTime?c.currentTime=d.startTime:d.startTime=c.currentTime||null;c.media.customData.local||(b.f.C=!0,yield _.Eo(b.m,d),yield _.Fo(b.m),d=b.m.getLoadedSource(),c.media.contentId=
83
+ d.url,c.media.contentType=d.type,d.Eb&&(c.media.hlsVideoSegmentFormat=rP(d.Eb,_.M)),d.audioMimeType&&(c.media.hlsSegmentFormat=rP(d.audioMimeType,_.L)));const e=c.media.metadata;e&&typeof e.sectionStartAbsoluteTime===_.r&&(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=kQ().getPlayerManager(),
84
+ c=b.getLiveSeekableRange();if(c){a=c.start;c=c.end;var d=this.m.getConfiguration().startTime;typeof a!==_.r||typeof c!==_.r||typeof d!==_.r||d>=a&&d<=c||(b=b.getMediaTimeForAbsoluteTime(d),typeof b===_.r&&b>=a&&b<=c&&this.m.seek(b))}_.Ho(this.m)}}B(a){if(0<this.g.size){const b=pP(a.data);this.g.forEach(c=>c(b))}}};_.z(jP,iQ);iQ.prototype.getContentMetadata=iQ.prototype.fb;iQ.prototype.isApiReady=iQ.prototype.cc;iQ.prototype.sendMessage=iQ.prototype.sendMessage;iQ.prototype.removeMessageListener=iQ.prototype.removeMessageListener;
85
+ iQ.prototype.addMessageListener=iQ.prototype.addMessageListener;iQ.prototype.off=iQ.prototype.off;iQ.prototype.on=iQ.prototype.on;iQ.prototype.setLoadRequestDataInterceptor=iQ.prototype.Ug;iQ.prototype.setPlayerConfigInterceptor=iQ.prototype.$c;iQ.prototype.stop=iQ.prototype.stop;iQ.prototype.start=iQ.prototype.start;iQ.prototype.init=iQ.prototype.init;iQ.getInstance=jQ;var hQ=null;var zQ=class{constructor(a){this.f=a;this.a=null;this.g=new _.hr;this.j=[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.l.bind(a);for(const d of a.j)a.g.on(b,d,c)}})}start(){return _.x(function*(){})}resume(){this.a&&
86
+ this.a.isPlayingBreak&&this.a.isPaused&&this.a.controller.playOrPause()}pause(){this.a&&this.a.isPlayingBreak&&!this.a.isPaused&&this.a.controller.playOrPause()}skip(){const a=this.f.a;a&&this.f.sendMessage(mP,{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===_.r&&(a=b));return a}dispose(){const a=this;
87
+ return _.x(function*(){a.g.release()})}l(a){switch(a.field){case "mediaInfo":a.value&&(a=a.value,a.breaks&&this.f.trigger(new _.F(_.nc,{adsTimeline:new uQ(a.breaks)})));break;case "isPlayingBreak":a.value?oQ(this,_.Wb):(oQ(this,_.ac),oQ(this,_.kc),oQ(this,_.Xb));break;case "currentBreakClipNumber":0<=a.value&&(0<a.value&&(oQ(this,_.ac),oQ(this,_.kc)),oQ(this,_.jc));break;case "isPaused":this.a.isPlayingBreak&&(a.value?oQ(this,_.fc):oQ(this,_.hc))}}};zQ.prototype.getPosition=zQ.prototype.getPosition;
88
+ zQ.prototype.setVolume=zQ.prototype.setVolume;zQ.prototype.getVolume=zQ.prototype.getVolume;zQ.prototype.skip=zQ.prototype.skip;zQ.prototype.pause=zQ.prototype.pause;zQ.prototype.resume=zQ.prototype.resume;var AQ=class{name(){return"clpp.cast.ads.SenderAdsManagerFactory"}da(a,b){return a.namespace()!==_.dd?!1:!(!b||!b.ima)}create(a){return new zQ(a.a)}};AQ.prototype.create=AQ.prototype.create;AQ.prototype.isSupported=AQ.prototype.da;AQ.prototype.name=AQ.prototype.name;_.Hn(new AQ);var BQ=class{name(){return"clpp.cast.ads.AdsManagerFactory"}da(a,b){return jQ().cc()?!(!b||!b.ima):!1}create(a){return new vQ(a)}};BQ.prototype.create=BQ.prototype.create;BQ.prototype.isSupported=BQ.prototype.da;BQ.prototype.name=BQ.prototype.name;_.Hn(new BQ);};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 rO="Ad Error",sO="onAdBreakStarted()",tO="onAdBreakStopped()",uO=function(a){var b=_.Mj();let c=Conviva.Constants.DeviceType.DESKTOP,d=Conviva.Constants.DeviceCategory.WEB;const e=b.os;b=b.osVersion.name;let f="";_.yj()&&(f="Apple");_.xj()?(f="Google",c=Conviva.Constants.DeviceType.SETTOP,d=Conviva.Constants.DeviceCategory.CHROMECAST):_.zj()?(c=Conviva.Constants.DeviceType.MOBILE,/(android)/i.test(navigator.userAgent)?d=Conviva.Constants.DeviceCategory.ANDROID_DEVICE:_.yj()&&(d=Conviva.Constants.DeviceCategory.APPLE_DEVICE)):
2
- _.rj()||_.oj()||_.nj("Hisense")?(c=Conviva.Constants.DeviceType.SMARTTV,d=Conviva.Constants.DeviceCategory.SMART_TV,_.rj()?(b="",f="LG",d=Conviva.Constants.DeviceCategory.LG_TV):_.oj()?(f="Samsung",d=Conviva.Constants.DeviceCategory.SAMSUNG_TV):_.nj("Hisense")&&(b="",f="Hisense")):_.nj("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},vO=function(a){return a?Conviva.Constants.StreamType.LIVE:Conviva.Constants.StreamType.VOD},wO=function(a){return 0===a?"Pre-roll":-1===a?"Post-roll":"Mid-roll"},yO=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
- vO(!!d);e[Conviva.Constants.ASSET_NAME]=rO;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"]=xO(a.getId()),e["c3.ad.creativeId"]=xO(a.getCreativeId()),e["c3.ad.system"]=xO(a.getAdSystem()),e["c3.ad.mediaFileApiFramework"]=xO(a.getApiFramework()),e["c3.ad.advertiser"]=xO(a.getAdvertiserName()),e["c3.ad.position"]=wO(a.getPodIndex()),e["c3.ad.technology"]=0===a.yb()?Conviva.Constants.AdType.CLIENT_SIDE:
5
- Conviva.Constants.AdType.SERVER_SIDE,e["c3.ad.adManagerName"]=xO(a.rb()),e["c3.ad.adManagerVersion"]=xO(a.sb()),e["c3.ad.advertiserCategory"]=xO(null),e["c3.ad.advertiserId"]=xO(null),e["c3.ad.breakId"]=xO(null),e["c3.ad.campaignName"]=xO(null),e["c3.ad.category"]=xO(null),e["c3.ad.classification"]=xO(null),e["c3.ad.creativeName"]=xO(null),e["c3.ad.sequence"]=xO(a.Nb()),e["c3.ad.sessionStartEvent"]=xO(null),e["c3.ad.unitName"]=xO(null),e["c3.ad.dayPart"]=xO(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"]=xO(b),e["c3.ad.firstAdSystem"]=xO(c),e["c3.ad.firstCreativeId"]=xO(a));return e},xO=function(a){return a?""+a:"NA"},CO=function(a){a.f.on(a.m,_.Wb,a.C.bind(a));a.f.on(a.m,_.Xb,a.F.bind(a));a.f.on(a.m,_.jc,a.M.bind(a));a.f.on(a.m,_.gc,a.l.bind(a));a.f.on(a.m,_.fc,a.l.bind(a));a.f.on(a.m,_.hc,a.l.bind(a));a.f.on(a.m,_.Yb,a.l.bind(a));a.f.on(a.m,_.kc,a.O.bind(a));
7
- a.f.on(a.m,_.ic,a.K.bind(a));a.f.on(a.m,_.$b,a.G.bind(a));a.f.on(a.m,_.cc,a.I.bind(a));a.f.on(a.m,_.dc,a.J.bind(a));a.f.on(a.m,_.bc,a.H.bind(a));a.f.on(a.m,_.ec,a.V.bind(a));a.f.on(a.m,_.lc,a.R.bind(a));a.f.on(a.m,_.Md,b=>{var c=b.detail;if(10003===c.code&&(a.h.debug("onAdError()"),!a.g)){b=Conviva.Constants.ErrorSeverity;switch(c.data.errorType){case 0:c="Ad Load Error";break;case 1:c="Ad Play Error";break;default:c=rO}null===a.a&&zO(a,null);a.a.reportAdError(c,b.FATAL);a.g=!0;a.h.debug("Ad Playback Failure");
8
- AO(a,BO,c)}})},AO=function(a,b,c=rO){if(a.a){a.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED);switch(b){case BO:a.a.reportAdFailed(c,yO(null,a.B,a.A));break;case DO:a.a.reportAdSkipped();break;default:a.a.reportAdEnded()}a.a.release();a.a=null;a.j=!1}},zO=function(a,b){if(!a.o){a.g=!1;try{if(a.a=Conviva.Analytics.buildAdAnalytics(a.T()),b){const c=yO(b,a.B,a.A,a.m.isLive()),d=String(b.sb()),e={};e[Conviva.Constants.FRAMEWORK_NAME]=b.rb();e[Conviva.Constants.FRAMEWORK_VERSION]=
9
- d;a.a.setAdPlayerInfo(e);a.a.reportAdStarted(c)}}catch(c){a.h.error("Could not create ad analytics session",c)}}},EO=function(a,b){const c={};c[Conviva.Constants.LOG_LEVEL]=Conviva.Constants.LogLevel.DEBUG;b.serviceUrl&&(a.h.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(uO(b));b.connectionType&&Conviva.Analytics.reportDeviceMetric(Conviva.Constants.Network.CONNECTION_TYPE,
10
- b.connectionType);a.a=Conviva.Analytics.buildVideoAnalytics();a.o=!1;b={};b[Conviva.Constants.FRAMEWORK_NAME]=_.pa;b[Conviva.Constants.FRAMEWORK_VERSION]=_.da;a.a.setPlayerInfo(b)},FO=function(a){return a.m.getConfiguration().autoplay||!1},HO=function(a){if(!a.l)if(a.C)a.h.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.h.debug(a.m.getConfiguration().source);var f={},g=
11
- new _.al(b.url);b&&(f[Conviva.Constants.ASSET_NAME]=b.name||"N/A",f[Conviva.Constants.STREAM_URL]=_.Ki(g));f[Conviva.Constants.PLAYER_NAME]=c.playerName||_.pa;f[Conviva.Constants.VIEWER_ID]=d;f[Conviva.Constants.DEFAULT_RESOURCE]=e;if(c&&!_.B(c.customTags))for(const h in c.customTags)f[h]=c.customTags[h];a.a.reportPlaybackRequested(f);a.a.setCallback(()=>{a.h.debug("reportMiscellaneousMetrics()");if(GO(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.h.debug("Current FPS",k),a.a.reportPlaybackMetric(Conviva.Constants.Playback.RENDERED_FRAMERATE,k))}}});a.C=!0;a.g=!0;a.I=!1;0<a.j.length&&(a.h.debug("Report deferred events"),a.j.forEach(h=>{h.Ve(h.args)}));a.j=[]}},IO=function(a){if(!a.l&&a.a){const b=vO(a.m.isLive()),c={};c[Conviva.Constants.IS_LIVE]=b;c[Conviva.Constants.DURATION]=a.m.getDuration();a.a.setContentInfo(c)}},GO=function(a){return null!==a.a&&a.C},JO=function(a){a.h.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.g=!1,a.w=null,a.B=!1,a.R=0,a.J=!1,a.j=[],a.H=0)},KO=function(a,b){var c=b.getConfiguration();a.a=!_.B(c.conviva)&&typeof c.conviva===_.te;a.a?"undefined"===typeof window.Conviva?(a.h.warn("Conviva SDK is not loaded. Will do nothing."),a.a=!1,c=new _.H(1,9,9E3),a.U(b,c)):b.namespace()===_.dd&&(a.a=!1,
14
- a.h.debug("Conviva does not report when casting.")):a.h.warn("Conviva plugin is loaded but not configured. Will do nothing.")},LO=function(a){const b=[];typeof a===_.te&&(a.customerKey||b.push("customerKey"),a.viewerId||b.push("viewerId"));if(0<b.length)throw new _.H(1,9,9001,{missingKeys:b});};var NO=class{constructor(a,b){this.m=a;this.T=b;this.B="";this.A=_.pa;this.h=new _.R("clpp.conviva.ad");this.f=new _.br;this.a=null;this.g=this.o=this.w=this.j=!1}initialize(a){this.h.debug("Initialize Ad Insights");this.g=this.w=!1;this.B=a.viewerId;this.A=a.playerName||_.pa;CO(this)}release(){this.h.debug("Release Ad Insights");this.w?this.h.debug(_.ia):(_.Sg(this.f),this.a&&AO(this,MO),this.f.release(),this.w=!0,this.j=this.g=!1)}destroy(){this.h.debug(_.wd);this.o?this.h.debug(_.ha):this.o=!0}C(){this.h.debug(sO)}F(){this.h.debug(tO)}M(a){this.h.debug("onAdStarted()");
15
- a=a.ad;this.j||(this.h.warn("Ad load event was not triggered. This will have incidence on VSF"),zO(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.vb(),a.ub());this.a.reportAdMetric(Conviva.Constants.Playback.BITRATE,a.ib())}l(a){this.h.debug("onAdStateChanged()");if(this.a){const b=c=>{this.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,c)};switch(a.type){case _.gc:case _.hc:b(Conviva.Constants.PlayerState.PLAYING);
16
- break;case _.fc:b(Conviva.Constants.PlayerState.PAUSED);break;case _.Yb:b(Conviva.Constants.PlayerState.BUFFERING)}}}O(){this.h.debug("onAdStopped()");this.a&&!this.g&&AO(this,MO)}K(){this.h.debug("onAdSkipped()");this.a&&AO(this,DO)}G(){this.h.debug("onAdClicked()");this.a&&this.a.reportAdPlayerEvent("AdClicked")}I(){this.h.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.h.debug("onAdLoaded()");
17
- const b=a.ad,c=()=>{this.j=!0;zO(this,b)};if(-1!==b.getPodIndex()||this.m.getPosition()>=this.m.getDuration()-5)c();else this.f.on(this.m,_.Af,()=>{this.m.getPosition()>=this.m.getDuration()-5&&(this.f.off(this.m,_.Af),c())})}H(){this.h.debug("onAdFirstQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_FIRST_QUARTILE)}V(){this.h.debug("onAdMidPoint()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_MID_QUARTILE)}R(){this.h.debug("onAdThirdQuartile()");this.a&&
18
- this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_THIRD_QUARTILE)}},DO=0,MO=1,BO=2;var OO=class{constructor(a,b){this.m=a;this.f=new _.br;this.a=null;this.o=!1;this.G=!0;this.B=this.g=this.A=this.C=this.l=!1;this.R=0;this.J=!1;this.w=null;this.I=!1;this.h=b;this.K=this.F=null;this.j=[];this.H=0}initialize(a,b,c){this.l||(this.h.debug("Initialize conviva"),this.G=!1,this.F=_.tg(b),this.K=c,this.m=a,EO(this,this.F),this.f.on(this.m,_.He,this.ja.bind(this)),this.f.on(this.m,_.qf,this.aa.bind(this)),this.f.on(this.m,_.Jc,this.M.bind(this)),this.f.on(this.m,_.Jf,this.Z.bind(this)),this.f.on(this.m,
19
- _.If,this.W.bind(this)),this.f.on(this.m,_.Wb,this.T.bind(this)),this.f.on(this.m,_.Xb,this.V.bind(this)),this.f.on(this.m,_.nc,this.ba.bind(this)),this.f.on(this.m,_.Ic,this.fa.bind(this)),this.f.on(this.m,_.Md,this.O.bind(this)),FO(this)&&(this.h.debug("Start a new session: A new video starts in autoplay."),HO(this)))}release(){this.h.debug("Release conviva");this.G?this.h.debug(_.ia):(_.Sg(this.f),GO(this)||this.o||!FO(this)||this.a&&this.a.reportPlaybackFailed("Exit Before Video Start"),GO(this)&&
20
- JO(this),this.a=null,this.G=!0)}destroy(){this.h.debug(_.wd);this.l?this.h.debug(_.ha):this.l=!0}reportAppEvent(a,b){let c=!1;try{Conviva.Analytics.reportAppEvent(a,b),c=!0}catch(d){this.h.debug("Report app event error",d),c=!1}return c}ja(){this.h.debug("onPlayRequest()");GO(this)||FO(this)?GO(this)&&this.A&&!this.g&&(this.h.debug("Resuming VST monitoring ..."),GO(this)&&!this.g&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_ENDED),this.g=!0),this.A=!1):(this.h.debug("Creating conviva session. On Play Requested / No autoplay"),
21
- HO(this))}aa(a){this.h.debug(_.ye);const b=c=>{if(this.o&&(this.h.debug("Creating conviva session (On Seek / Replay)"),EO(this,this.F),HO(this),IO(this),GO(this))){var d=this.m.getTrackManager();d=d.ia()||d.Ua();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)}GO(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,c)};switch(a.detail.currentState){case _.nn:b(Conviva.Constants.PlayerState.PLAYING);
22
- break;case _.mn:b(Conviva.Constants.PlayerState.PAUSED);break;case _.en:b(Conviva.Constants.PlayerState.BUFFERING);break;case _.bn:this.h.debug("onVideoEnded()"),GO(this)&&(this.w&&this.w.jb()?(this.h.debug("Waiting for postroll Ad before terminating session"),this.J=!0):JO(this))}}M(a){this.h.debug(_.ue);if(GO(this)){if(a=a.detail,typeof a.width===_.r&&typeof a.height===_.r&&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({Ve:this.M.bind(this),args:a})}Z(){this.h.debug("onSeeking()");GO(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)}W(){this.h.debug("onSeeked()");GO(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_ENDED)}ba(a){this.h.debug("onAdsTimelineChanged()");if(a=a.adsTimeline)this.w=a}T(a){this.h.debug(sO);
24
- var b=a.ad;a=0===b.Va();const c=wO(b.getPodIndex());GO(this)||FO(this)||!a||HO(this);if(GO(this)){a=0===b.yb()?Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE;let d=0;const e={};1===b.xb()&&(d=b.getDuration());e[Conviva.Constants.POD_DURATION]=d;e[Conviva.Constants.POD_INDEX]=++this.R;e[Conviva.Constants.POD_POSITION]=c;b=Conviva.Constants.AdPlayer;b=a!==Conviva.Constants.AdType.CLIENT_SIDE||_.xj()?b.CONTENT:b.SEPARATE;this.a.reportAdBreakStarted(a,b,e);this.B=!0}else this.h.debug("Bug: should already have a valid session")}V(){this.h.debug(tO);
25
- GO(this)&&this.B&&(this.a.reportAdBreakEnded(),this.B=!1,this.J&&JO(this))}O(a){this.h.debug(_.ve);if(this.o&&this.I)this.h.debug("Session ended in VPF; ignoring subsequent errors");else{var b=a.detail||null,c=b&&b.message||"Player error",d=Conviva.Constants.ErrorSeverity.WARNING;b&&b.severity&&b.severity===_.G&&(d=Conviva.Constants.ErrorSeverity.FATAL,GO(this)||HO(this));GO(this)?(this.h.debug("Report error",c,d),this.a.reportPlaybackError(c,d),d===Conviva.Constants.ErrorSeverity.FATAL&&(this.h.debug("Video Playback Failure"),
26
- this.I=!0,JO(this))):this.j.push({Ve:this.O.bind(this),args:a})}}fa(){this.h.debug("onAutoPlayBlocked()");GO(this)&&(this.h.debug("Auto-play blocked. Pausing VST monitoring."),this.A=!0,GO(this)&&this.g&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_STARTED),this.g=!1))}};var PO=class{constructor(){this.g=this.f=null;this.a=!1;this.h=new _.R("clpp.conviva")}onPlayerCreated(a){this.f=new OO(a,this.h)}onContentWillLoad(a,b){KO(this,a);if(this.a){var c=a.getConfiguration();c=_.tg(c.conviva||{});try{LO(c);const d=c.enableAdInsights||!1;this.f.initialize(a,c,b);d&&(this.g=new NO(a,()=>this.f.a),this.g.initialize(c))}catch(d){d instanceof _.H?this.U(a,d):this.U(a,new _.H(1,9,9002,d,d))}}}onContentLoaded(){this.a&&IO(this.f)}onPlayerWillDestroy(){this.a&&(this.a=!1,this.f.destroy(),
27
- this.f=null,this.g&&(this.g.destroy(),this.g=null))}onPlayerWillRelease(){this.a&&(this.f.release(),this.g&&this.g.release())}id(){return"conviva"}U(a,b){a.trigger(new _.F(_.Md,{detail:b}))}reportAppEvent(a,b){return this.f?this.f.reportAppEvent(a,b):!1}};_.z("clpp.conviva.ConvivaPlugin",PO);PO.prototype.reportAppEvent=PO.prototype.reportAppEvent;PO.Id="conviva";_.oo(new class{create(){return new PO}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var CO="Ad Error",DO="onAdBreakStarted()",EO="onAdBreakStopped()",FO=function(a){var b=_.Nj();let c=Conviva.Constants.DeviceType.DESKTOP,d=Conviva.Constants.DeviceCategory.WEB;const e=b.os;b=b.osVersion.name;let f="";_.zj()&&(f="Apple");_.yj()?(f="Google",c=Conviva.Constants.DeviceType.SETTOP,d=Conviva.Constants.DeviceCategory.CHROMECAST):_.Aj()?(c=Conviva.Constants.DeviceType.MOBILE,/(android)/i.test(navigator.userAgent)?d=Conviva.Constants.DeviceCategory.ANDROID_DEVICE:_.zj()&&(d=Conviva.Constants.DeviceCategory.APPLE_DEVICE)):
2
+ _.sj()||_.pj()||_.oj("Hisense")?(c=Conviva.Constants.DeviceType.SMARTTV,d=Conviva.Constants.DeviceCategory.SMART_TV,_.sj()?(b="",f="LG",d=Conviva.Constants.DeviceCategory.LG_TV):_.pj()?(f="Samsung",d=Conviva.Constants.DeviceCategory.SAMSUNG_TV):_.oj("Hisense")&&(b="",f="Hisense")):_.oj("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},GO=function(a){return a?Conviva.Constants.StreamType.LIVE:Conviva.Constants.StreamType.VOD},HO=function(a){return 0===a?"Pre-roll":-1===a?"Post-roll":"Mid-roll"},JO=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
+ GO(!!d);e[Conviva.Constants.ASSET_NAME]=CO;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"]=IO(a.getId()),e["c3.ad.creativeId"]=IO(a.getCreativeId()),e["c3.ad.system"]=IO(a.getAdSystem()),e["c3.ad.mediaFileApiFramework"]=IO(a.getApiFramework()),e["c3.ad.advertiser"]=IO(a.getAdvertiserName()),e["c3.ad.position"]=HO(a.getPodIndex()),e["c3.ad.technology"]=0===a.yb()?Conviva.Constants.AdType.CLIENT_SIDE:
5
+ Conviva.Constants.AdType.SERVER_SIDE,e["c3.ad.adManagerName"]=IO(a.rb()),e["c3.ad.adManagerVersion"]=IO(a.sb()),e["c3.ad.advertiserCategory"]=IO(null),e["c3.ad.advertiserId"]=IO(null),e["c3.ad.breakId"]=IO(null),e["c3.ad.campaignName"]=IO(null),e["c3.ad.category"]=IO(null),e["c3.ad.classification"]=IO(null),e["c3.ad.creativeName"]=IO(null),e["c3.ad.sequence"]=IO(a.Nb()),e["c3.ad.sessionStartEvent"]=IO(null),e["c3.ad.unitName"]=IO(null),e["c3.ad.dayPart"]=IO(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"]=IO(b),e["c3.ad.firstAdSystem"]=IO(c),e["c3.ad.firstCreativeId"]=IO(a));return e},IO=function(a){return a?""+a:"NA"},NO=function(a){a.f.on(a.m,_.Wb,a.C.bind(a));a.f.on(a.m,_.Xb,a.F.bind(a));a.f.on(a.m,_.jc,a.M.bind(a));a.f.on(a.m,_.gc,a.l.bind(a));a.f.on(a.m,_.fc,a.l.bind(a));a.f.on(a.m,_.hc,a.l.bind(a));a.f.on(a.m,_.Yb,a.l.bind(a));a.f.on(a.m,_.kc,a.N.bind(a));
7
+ a.f.on(a.m,_.ic,a.K.bind(a));a.f.on(a.m,_.$b,a.G.bind(a));a.f.on(a.m,_.cc,a.I.bind(a));a.f.on(a.m,_.dc,a.J.bind(a));a.f.on(a.m,_.bc,a.H.bind(a));a.f.on(a.m,_.ec,a.V.bind(a));a.f.on(a.m,_.lc,a.R.bind(a));a.f.on(a.m,_.Nd,b=>{var c=b.detail;if(10003===c.code&&(a.h.debug("onAdError()"),!a.g)){b=Conviva.Constants.ErrorSeverity;switch(c.data.errorType){case 0:c="Ad Load Error";break;case 1:c="Ad Play Error";break;default:c=CO}null===a.a&&KO(a,null);a.a.reportAdError(c,b.FATAL);a.g=!0;a.h.debug("Ad Playback Failure");
8
+ LO(a,MO,c)}})},LO=function(a,b,c=CO){if(a.a){a.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED);switch(b){case MO:a.a.reportAdFailed(c,JO(null,a.B,a.A));break;case OO:a.a.reportAdSkipped();break;default:a.a.reportAdEnded()}a.a.release();a.a=null;a.j=!1}},KO=function(a,b){if(!a.o){a.g=!1;try{if(a.a=Conviva.Analytics.buildAdAnalytics(a.T()),b){const c=JO(b,a.B,a.A,a.m.isLive()),d=String(b.sb()),e={};e[Conviva.Constants.FRAMEWORK_NAME]=b.rb();e[Conviva.Constants.FRAMEWORK_VERSION]=
9
+ d;a.a.setAdPlayerInfo(e);a.a.reportAdStarted(c)}}catch(c){a.h.error("Could not create ad analytics session",c)}}},PO=function(a,b){const c={};c[Conviva.Constants.LOG_LEVEL]=Conviva.Constants.LogLevel.DEBUG;b.serviceUrl&&(a.h.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(FO(b));b.connectionType&&Conviva.Analytics.reportDeviceMetric(Conviva.Constants.Network.CONNECTION_TYPE,
10
+ b.connectionType);a.a=Conviva.Analytics.buildVideoAnalytics();a.o=!1;b={};b[Conviva.Constants.FRAMEWORK_NAME]=_.pa;b[Conviva.Constants.FRAMEWORK_VERSION]=_.da;a.a.setPlayerInfo(b)},QO=function(a){return a.m.getConfiguration().autoplay||!1},SO=function(a){if(!a.l)if(a.C)a.h.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.h.debug(a.m.getConfiguration().source);var f={},g=
11
+ new _.bl(b.url);b&&(f[Conviva.Constants.ASSET_NAME]=b.name||"N/A",f[Conviva.Constants.STREAM_URL]=_.Li(g));f[Conviva.Constants.PLAYER_NAME]=c.playerName||_.pa;f[Conviva.Constants.VIEWER_ID]=d;f[Conviva.Constants.DEFAULT_RESOURCE]=e;if(c&&!_.B(c.customTags))for(const h in c.customTags)f[h]=c.customTags[h];a.a.reportPlaybackRequested(f);a.a.setCallback(()=>{a.h.debug("reportMiscellaneousMetrics()");if(RO(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.h.debug("Current FPS",k),a.a.reportPlaybackMetric(Conviva.Constants.Playback.RENDERED_FRAMERATE,k))}}});a.C=!0;a.g=!0;a.I=!1;0<a.j.length&&(a.h.debug("Report deferred events"),a.j.forEach(h=>{h.Ue(h.args)}));a.j=[]}},TO=function(a){if(!a.l&&a.a){const b=GO(a.m.isLive()),c={};c[Conviva.Constants.IS_LIVE]=b;c[Conviva.Constants.DURATION]=a.m.getDuration();a.a.setContentInfo(c)}},RO=function(a){return null!==a.a&&a.C},UO=function(a){a.h.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.g=!1,a.w=null,a.B=!1,a.R=0,a.J=!1,a.j=[],a.H=0)},VO=function(a,b){var c=b.getConfiguration();a.a=!_.B(c.conviva)&&typeof c.conviva===_.ue;a.a?"undefined"===typeof window.Conviva?(a.h.warn("Conviva SDK is not loaded. Will do nothing."),a.a=!1,c=new _.H(1,9,9E3),a.U(b,c)):b.namespace()===_.dd&&(a.a=!1,
14
+ a.h.debug("Conviva does not report when casting.")):a.h.warn("Conviva plugin is loaded but not configured. Will do nothing.")},WO=function(a){const b=[];typeof a===_.ue&&(a.customerKey||b.push("customerKey"),a.viewerId||b.push("viewerId"));if(0<b.length)throw new _.H(1,9,9001,{missingKeys:b});};var YO=class{constructor(a,b){this.m=a;this.T=b;this.B="";this.A=_.pa;this.h=new _.R("clpp.conviva.ad");this.f=new _.hr;this.a=null;this.g=this.o=this.w=this.j=!1}initialize(a){this.h.debug("Initialize Ad Insights");this.g=this.w=!1;this.B=a.viewerId;this.A=a.playerName||_.pa;NO(this)}release(){this.h.debug("Release Ad Insights");this.w?this.h.debug(_.ia):(_.Tg(this.f),this.a&&LO(this,XO),this.f.release(),this.w=!0,this.j=this.g=!1)}destroy(){this.h.debug(_.xd);this.o?this.h.debug(_.ha):this.o=!0}C(){this.h.debug(DO)}F(){this.h.debug(EO)}M(a){this.h.debug("onAdStarted()");
15
+ a=a.ad;this.j||(this.h.warn("Ad load event was not triggered. This will have incidence on VSF"),KO(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.vb(),a.ub());this.a.reportAdMetric(Conviva.Constants.Playback.BITRATE,a.ib())}l(a){this.h.debug("onAdStateChanged()");if(this.a){const b=c=>{this.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,c)};switch(a.type){case _.gc:case _.hc:b(Conviva.Constants.PlayerState.PLAYING);
16
+ break;case _.fc:b(Conviva.Constants.PlayerState.PAUSED);break;case _.Yb:b(Conviva.Constants.PlayerState.BUFFERING)}}}N(){this.h.debug("onAdStopped()");this.a&&!this.g&&LO(this,XO)}K(){this.h.debug("onAdSkipped()");this.a&&LO(this,OO)}G(){this.h.debug("onAdClicked()");this.a&&this.a.reportAdPlayerEvent("AdClicked")}I(){this.h.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.h.debug("onAdLoaded()");
17
+ const b=a.ad,c=()=>{this.j=!0;KO(this,b)};if(-1!==b.getPodIndex()||this.m.getPosition()>=this.m.getDuration()-5)c();else this.f.on(this.m,_.Bf,()=>{this.m.getPosition()>=this.m.getDuration()-5&&(this.f.off(this.m,_.Bf),c())})}H(){this.h.debug("onAdFirstQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_FIRST_QUARTILE)}V(){this.h.debug("onAdMidPoint()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_MID_QUARTILE)}R(){this.h.debug("onAdThirdQuartile()");this.a&&
18
+ this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_THIRD_QUARTILE)}},OO=0,XO=1,MO=2;var ZO=class{constructor(a,b){this.m=a;this.f=new _.hr;this.a=null;this.o=!1;this.G=!0;this.B=this.g=this.A=this.C=this.l=!1;this.R=0;this.J=!1;this.w=null;this.I=!1;this.h=b;this.K=this.F=null;this.j=[];this.H=0}initialize(a,b,c){this.l||(this.h.debug("Initialize conviva"),this.G=!1,this.F=_.ug(b),this.K=c,this.m=a,PO(this,this.F),this.f.on(this.m,_.Ie,this.ja.bind(this)),this.f.on(this.m,_.rf,this.aa.bind(this)),this.f.on(this.m,_.Jc,this.M.bind(this)),this.f.on(this.m,_.Kf,this.Z.bind(this)),this.f.on(this.m,
19
+ _.Jf,this.W.bind(this)),this.f.on(this.m,_.Wb,this.T.bind(this)),this.f.on(this.m,_.Xb,this.V.bind(this)),this.f.on(this.m,_.nc,this.ba.bind(this)),this.f.on(this.m,_.Ic,this.ea.bind(this)),this.f.on(this.m,_.Nd,this.N.bind(this)),QO(this)&&(this.h.debug("Start a new session: A new video starts in autoplay."),SO(this)))}release(){this.h.debug("Release conviva");this.G?this.h.debug(_.ia):(_.Tg(this.f),RO(this)||this.o||!QO(this)||this.a&&this.a.reportPlaybackFailed("Exit Before Video Start"),RO(this)&&
20
+ UO(this),this.a=null,this.G=!0)}destroy(){this.h.debug(_.xd);this.l?this.h.debug(_.ha):this.l=!0}reportAppEvent(a,b){let c=!1;try{Conviva.Analytics.reportAppEvent(a,b),c=!0}catch(d){this.h.debug("Report app event error",d),c=!1}return c}ja(){this.h.debug("onPlayRequest()");RO(this)||QO(this)?RO(this)&&this.A&&!this.g&&(this.h.debug("Resuming VST monitoring ..."),RO(this)&&!this.g&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_ENDED),this.g=!0),this.A=!1):(this.h.debug("Creating conviva session. On Play Requested / No autoplay"),
21
+ SO(this))}aa(a){this.h.debug(_.ze);const b=c=>{if(this.o&&(this.h.debug("Creating conviva session (On Seek / Replay)"),PO(this,this.F),SO(this),TO(this),RO(this))){var d=this.m.getTrackManager();d=d.ia()||d.Ua();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)}RO(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,c)};switch(a.detail.currentState){case _.qn:b(Conviva.Constants.PlayerState.PLAYING);
22
+ break;case _.pn:b(Conviva.Constants.PlayerState.PAUSED);break;case _.hn:b(Conviva.Constants.PlayerState.BUFFERING);break;case _.en:this.h.debug("onVideoEnded()"),RO(this)&&(this.w&&this.w.jb()?(this.h.debug("Waiting for postroll Ad before terminating session"),this.J=!0):UO(this))}}M(a){this.h.debug(_.ve);if(RO(this)){if(a=a.detail,typeof a.width===_.r&&typeof a.height===_.r&&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({Ue:this.M.bind(this),args:a})}Z(){this.h.debug("onSeeking()");RO(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)}W(){this.h.debug("onSeeked()");RO(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_ENDED)}ba(a){this.h.debug("onAdsTimelineChanged()");if(a=a.adsTimeline)this.w=a}T(a){this.h.debug(DO);
24
+ var b=a.ad;a=0===b.Va();const c=HO(b.getPodIndex());RO(this)||QO(this)||!a||SO(this);if(RO(this)){a=0===b.yb()?Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE;let d=0;const e={};1===b.xb()&&(d=b.getDuration());e[Conviva.Constants.POD_DURATION]=d;e[Conviva.Constants.POD_INDEX]=++this.R;e[Conviva.Constants.POD_POSITION]=c;b=Conviva.Constants.AdPlayer;b=a!==Conviva.Constants.AdType.CLIENT_SIDE||_.yj()?b.CONTENT:b.SEPARATE;this.a.reportAdBreakStarted(a,b,e);this.B=!0}else this.h.debug("Bug: should already have a valid session")}V(){this.h.debug(EO);
25
+ RO(this)&&this.B&&(this.a.reportAdBreakEnded(),this.B=!1,this.J&&UO(this))}N(a){this.h.debug(_.we);if(this.o&&this.I)this.h.debug("Session ended in VPF; ignoring subsequent errors");else{var b=a.detail||null,c=b&&b.message||"Player error",d=Conviva.Constants.ErrorSeverity.WARNING;b&&b.severity&&b.severity===_.G&&(d=Conviva.Constants.ErrorSeverity.FATAL,RO(this)||SO(this));RO(this)?(this.h.debug("Report error",c,d),this.a.reportPlaybackError(c,d),d===Conviva.Constants.ErrorSeverity.FATAL&&(this.h.debug("Video Playback Failure"),
26
+ this.I=!0,UO(this))):this.j.push({Ue:this.N.bind(this),args:a})}}ea(){this.h.debug("onAutoPlayBlocked()");RO(this)&&(this.h.debug("Auto-play blocked. Pausing VST monitoring."),this.A=!0,RO(this)&&this.g&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_STARTED),this.g=!1))}};var $O=class{constructor(){this.g=this.f=null;this.a=!1;this.h=new _.R("clpp.conviva")}onPlayerCreated(a){this.f=new ZO(a,this.h)}onContentWillLoad(a,b){VO(this,a);if(this.a){var c=a.getConfiguration();c=_.ug(c.conviva||{});try{WO(c);const d=c.enableAdInsights||!1;this.f.initialize(a,c,b);d&&(this.g=new YO(a,()=>this.f.a),this.g.initialize(c))}catch(d){d instanceof _.H?this.U(a,d):this.U(a,new _.H(1,9,9002,d,d))}}}onContentLoaded(){this.a&&TO(this.f)}onPlayerWillDestroy(){this.a&&(this.a=!1,this.f.destroy(),
27
+ this.f=null,this.g&&(this.g.destroy(),this.g=null))}onPlayerWillRelease(){this.a&&(this.f.release(),this.g&&this.g.release())}id(){return"conviva"}U(a,b){a.trigger(new _.F(_.Nd,{detail:b}))}reportAppEvent(a,b){return this.f?this.f.reportAppEvent(a,b):!1}};_.z("clpp.conviva.ConvivaPlugin",$O);$O.prototype.reportAppEvent=$O.prototype.reportAppEvent;$O.Id="conviva";_.ro(new class{create(){return new $O}});};f.call(g, window);