@castlabs/prestoplay 6.28.0 → 6.30.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.
- package/CHANGELOG.md +37 -0
- package/cjs/cl.adobe.js +3 -3
- package/cjs/cl.airplay.js +3 -3
- package/cjs/cl.broadpeak.js +7 -7
- package/cjs/cl.cast.js +128 -116
- package/cjs/cl.conviva.js +32 -32
- package/cjs/cl.core.js +619 -614
- package/cjs/cl.crypto.js +9 -9
- package/cjs/cl.dash.js +92 -89
- package/cjs/cl.externs.js +154 -60
- package/cjs/cl.freewheel.js +25 -25
- package/cjs/cl.hls.js +77 -77
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +30 -30
- package/cjs/cl.ima.js +25 -23
- package/cjs/cl.mediatailor.js +3 -3
- package/cjs/cl.mse.js +350 -349
- package/cjs/cl.muxdata.js +14 -14
- package/cjs/cl.onboard.js +4 -4
- package/cjs/cl.persistent.js +15 -15
- package/cjs/cl.playlist.js +6 -6
- package/cjs/cl.simid.js +16 -16
- package/cjs/cl.smooth.js +57 -58
- package/cjs/cl.thumbnails.js +26 -26
- package/cjs/cl.tizen.js +60 -60
- package/cjs/cl.ttml.js +29 -29
- package/cjs/cl.verimatrix.js +5 -5
- package/cjs/cl.vimond.js +12 -12
- package/cjs/cl.vr.js +19 -19
- package/cjs/cl.vtt.js +14 -14
- package/cjs/cl.yospace.js +4 -4
- package/cjs/cl.youbora.js +38 -38
- package/cjs/polyfill.min.js +2 -2
- package/cl.adobe.js +3 -3
- package/cl.airplay.js +3 -3
- package/cl.broadpeak.js +6 -6
- package/cl.cast.js +101 -92
- package/cl.conviva.js +27 -27
- package/cl.core.js +500 -496
- package/cl.crypto.js +9 -9
- package/cl.dash.js +84 -83
- package/cl.externs.js +150 -60
- package/cl.freewheel.js +19 -19
- package/cl.hls.js +82 -80
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +26 -26
- package/cl.ima.js +19 -17
- package/cl.mediatailor.js +2 -2
- package/cl.mse.js +304 -305
- package/cl.muxdata.js +13 -13
- package/cl.onboard.js +4 -4
- package/cl.persistent.js +11 -11
- package/cl.playlist.js +5 -5
- package/cl.simid.js +14 -14
- package/cl.smooth.js +60 -60
- package/cl.thumbnails.js +19 -19
- package/cl.tizen.js +56 -56
- package/cl.ttml.js +22 -22
- package/cl.verimatrix.js +4 -4
- package/cl.vimond.js +8 -8
- package/cl.vr.js +14 -14
- package/cl.vtt.js +12 -12
- package/cl.yospace.js +3 -3
- package/cl.youbora.js +31 -31
- package/package.json +1 -1
- package/typings.d.ts +198 -88
package/cl.cast.js
CHANGED
|
@@ -1,93 +1,102 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
{if("license"!==b&&typeof c!==_
|
|
3
|
-
return d},{})},
|
|
4
|
-
else if(window.cast&&cast.framework&&cast.framework.messages)c=cast.framework.messages.HlsSegmentFormat,d=cast.framework.messages.HlsVideoSegmentFormat;else return;switch(a){case _.
|
|
5
|
-
d=b.GenericMediaMetadata,e=b.MovieMediaMetadata,f=b.TvShowMediaMetadata,g=b.MusicTrackMediaMetadata,h=b.PhotoMediaMetadata;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}},
|
|
6
|
-
null},
|
|
7
|
-
b===_.
|
|
8
|
-
|
|
9
|
-
a
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
a
|
|
14
|
-
|
|
15
|
-
_.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
cast.framework.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
c=
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
this.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
a
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
this.a.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
(this.
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
this.
|
|
52
|
-
|
|
53
|
-
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var LU="Cannot seek during ads playout.",MU="Cannot switch track",NU="Media session does not exist.",OU="No receivers available",PU="QUEUE_ITEM_CHANGED",QU="Reset ABR functionality not available on cast.",RU="SDK not yet ready",SU="Sender is destroyed.",TU="clpp.cast.CastProxy",UU="clpp.cast.Player",VU="clpp.cast.Receiver",WU="urn:x-cast:castlabs",XU="urn:x-cast:castlabs:int",YU="urn:x-cast:com.google.cast.media",ZU="volume control is not supported",$U=function(a){return _.w(function*(){yield _.Vn(a,
|
|
2
|
+
_.Me);yield _.Vn(a,_.Le)})},aV=function(a){return JSON.stringify(a,(b,c)=>{if("license"!==b&&typeof c!==_.ae){if(c instanceof Event){b={};for(const d in c){const e=c[d];typeof e===_.He?"detail"===d&&(b[d]=e):d in Event||(b[d]=e)}return b}return typeof c===_.r?isNaN(c)?"NaN":isFinite(c)?c:0>c?"-Infinity":"Infinity":c}})},bV=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}},cV=function(a,b){const c=
|
|
3
|
+
new Set(b);return Object.keys(a).reduce((d,e)=>{c.has(e)&&(d[e]=a[e]);return d},{})},dV=function(a,b,c,d){return _.w(function*(){if(b.includes(a.mimeType))return a;var e=null;let f=null,g=null;for(var h=0;h<b.length&&!f;)g=b[h++],f=_.Kr(d,a.mimeType,g);f&&g&&(h=_.wk(a.url),(h=yield c.fetch(h).U)&&h.data&&(e=f.a(_.G(h.data)),e={url:URL.createObjectURL(new Blob([e])),kind:a.kind,language:a.language,label:a.label,mimeType:g}));return e})},eV=function(a,b){let c,d;if(window.chrome&&chrome.cast&&chrome.cast.media)c=
|
|
4
|
+
chrome.cast.media.HlsSegmentFormat,d=chrome.cast.media.HlsVideoSegmentFormat;else if(window.cast&&cast.framework&&cast.framework.messages)c=cast.framework.messages.HlsSegmentFormat,d=cast.framework.messages.HlsVideoSegmentFormat;else return;switch(a){case _.zg:return d.FMP4;case _.yg:return b===_.R?d.MPEG2_TS:c.TS;case _.Ec:return c.AAC;case _.Fc:return c.AC3;case _.Gc:return c.E_AC3;case "audio/mpeg":return c.MP3;case _.Hc:return c.FMP4}},gV=function(a){a=void 0===a?fV:a;var b=cast.framework.messages||
|
|
5
|
+
chrome.cast.media;if(!b)throw new _.I(1,8,8001);const c=b.MetadataType,d=b.GenericMediaMetadata,e=b.MovieMediaMetadata,f=b.TvShowMediaMetadata,g=b.MusicTrackMediaMetadata,h=b.PhotoMediaMetadata;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}},hV=function(){return Math.round(1E3*Math.random())},iV=function(a,b){return a.h.filter(c=>
|
|
6
|
+
c.type===b)},kV=function(a,b){const c=jV(a);return iV(a,b).find(d=>c.includes(d.id))||null},mV=function(a,b,c){const d=a.a.a;if(d)if(c){a.f[b]=c.renditions[0];c=[+c.id];if(b!==_.P){const e=a.va();e&&c.push(+e.id)}c=new chrome.cast.media.EditTracksInfoRequest(c);d.editTracksInfo(c,()=>{a.f[b]=null;lV(a,b)},e=>{a.f[b]=null;a.g.debug(MU,e)})}else b===_.P&&(c=new chrome.cast.media.EditTracksInfoRequest([]),d.editTracksInfo(c,()=>{lV(a,b)},e=>{a.g.debug(MU,e)}))},jV=function(a){a=a.a?a.a.a:null;return(a?
|
|
7
|
+
a.activeTrackIds||[]:[]).map(b=>b.toString())},lV=function(a,b){b===_.Q?a.a.trigger(new _.H(_.Kc)):b===_.P&&a.a.trigger(new _.H(_.ag))},pV=function(a){if(a)for(const b of nV)oV(b)},oV=function(a){if(!a.f&&window.chrome&&chrome.cast&&chrome.cast.isAvailable&&window.cast&&cast.framework&&cast.framework.CastContext&&a.T.length){a.o=new cast.framework.RemotePlayer;var b=new cast.framework.RemotePlayerController(a.o);a.F.on(b,cast.framework.RemotePlayerEventType.CURRENT_TIME_CHANGED,a.Aa.bind(a));a.F.on(b,
|
|
8
|
+
cast.framework.RemotePlayerEventType.MEDIA_INFO_CHANGED,a.Cb.bind(a));a.f=!0;a.L.resolve();a.w.yf();b=cast.framework.CastContext.getInstance();var c=new cast.framework.CastOptions;c.receiverApplicationId=a.T;c.autoJoinPolicy=chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED;b.setOptions(c);b.addEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.M);b.addEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.ga);qV&&a.w.la(.02)}},rV=function(a){return _.w(function*(){a.F.release();
|
|
9
|
+
nV.delete(a);if(a.f){a.f=!1;var b=cast.framework.CastContext.getInstance();b.removeEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.M);b.removeEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.ga)}b=[];a.h&&(b.push(a.h.destroy()),a.h=null);a.l&&(b.push(a.l.destroy()),a.l=null);yield Promise.all(b);a.A=!1;a.w&&(a.w.stop(),a.w=null);a.R=null;a.ba=null})},sV=function(a){return _.w(function*(){a.ya()||(yield cast.framework.CastContext.getInstance().requestSession())})},
|
|
10
|
+
uV=function(a,b,c){c=void 0===c?0:c;return _.w(function*(){var d=a.h.va();d&&d.language&&(a.j.preferredTextLanguage=d.language);(d=a.h.pa())&&d.language&&(a.j.preferredAudioLanguage=d.language);yield tV(a,{source:a.getLoadedSource(),currentTime:c,isLive:a.isLive(),ef:a.getPresentationStartTime(),autoplay:b,hb:a.j})})},tV=function(a,b){return _.w(function*(){if(a.f){var c=chrome.cast.media.StreamType;yield sV(a);if(b){var d=cast.framework.CastContext.getInstance().getCurrentSession(),e=new chrome.cast.media.MediaInfo(b.source.url,
|
|
11
|
+
b.source.type);e.streamType=b.isLive?c.LIVE:c.BUFFERED;c=b.ab;e.hlsVideoSegmentFormat=eV(b.ac,_.R);e.hlsSegmentFormat=eV(c,_.Q);b.hb&&(a.J&&(c=yield Promise.resolve(a.J(b.hb)))&&(b.hb=c),a.j=b.hb,a.C=_.fn(a.j),a.B=a.C.findIndex(k=>k.url===b.source.url),b.hb.remoteTextTracks&&(c=yield Promise.all(b.hb.remoteTextTracks.map(a.Ua.bind(a))),e.tracks=c.filter(k=>k),b.hb.remoteTextTracks=void 0),delete b.hb.autoplay,b.hb.startTime=null,e.customData={playerConfiguration:aV(b.hb)});c=a.Db()||{};var f=vV(c.metadataType),
|
|
12
|
+
g;typeof b.ef===_.r&&(g={metadataType:f,sectionStartAbsoluteTime:b.ef});var h;b.source.name&&(h={metadataType:f,title:b.source.name});c=wV(c);if(g=xV(Object.assign({},g,h,c)))e.metadata=g;e=new chrome.cast.media.LoadRequest(e);(g=b.queueData)&&g.items&&0<g.items.length&&(h=new chrome.cast.media.QueueData,h.items=g.items,h.startIndex=g.startIndex,e.queueData=h);typeof b.autoplay===_.Nc&&(e.autoplay=b.autoplay);typeof b.currentTime===_.r&&(e.currentTime=b.currentTime);yield d.loadMedia(e)}}})},xV=function(a){if(!a)return null;
|
|
13
|
+
a:{var b=a.metadataType;const c=Object.entries(yV);for(const d of c){const [e,f]=d;if(f===b){b=e;break a}}b=null}if(!b)return null;b=gV(yV[b]);return Object.assign(b,a)},vV=function(a){var b=void 0===b?fV:b;return Object.values(yV).includes(a)?a:b},wV=function(a){const b={};for(const c in a)void 0!==a[c]&&(b[c]=a[c]);return b},AV=function(a,b){zV(a,b.getMediaSession());b.addEventListener(cast.framework.SessionEventType.MEDIA_SESSION,a.Y);b.addMessageListener(WU,a.P);b.addMessageListener(XU,a.V)},
|
|
14
|
+
BV=function(a){const b=a.getPosition();a.a&&a.a.media?(a=a.a.media.startAbsoluteTime,a=typeof a!==_.r?null:a):a=null;a=null===a?null:a+b;return null===a?b:a},zV=function(a,b){a.a=b;a.a&&(a.l&&a.l.init(),a.trigger(new _.H(_.ue)))},EV=function(a){return new CV(a.h,()=>{a.trigger(new _.H(_.Tc))},(b,c)=>{{const d=a.f.getConfiguration();d.source=c.source;d.autoplay=!1;d.startTime=c.currentTime?Math.max(c.currentTime-1,0):null;d.ima&&d.startTime&&(d.ima.playAdsAfterTime=d.startTime);c.Pf&&(d.preferredAudioLanguage=
|
|
15
|
+
c.Pf);c.Yg&&(d.preferredTextLanguage=c.Yg);_.Xn(a.f,null);a.trigger(new _.H("castingended"));a.j(b,d)}},()=>DV(a))},DV=function(a){return _.w(function*(){a.trigger(new _.H(_.Sc));if(a.f.a!==a.a&&a.f&&a.a){var b=null!=a.f.getLoadedSource();yield a.f.release();_.Xn(a.f,a.a);b&&(_.go(a.f),(b=a.f.getAdsManager())&&(yield b.load()))}})},FV=function(a,b){0>b||b>=a.a.length||(a.f=b,a.trigger(new _.H(_.hf,{item:a.Eb()})))},GV=function(a){a.trigger(new _.H(_.kf))},IV=function(a){HV(a);const b=Math.min(a.a.nd().length-
|
|
16
|
+
1,a.a.getPosition()+1);FV(a.a,b)},HV=function(a){a.j||(a.a.on(_.hf,a.o),a.j=!0)},JV=function(a){return a.map(b=>{const c={};c.media={contentId:b.configuration.source};c.customData={skippable:!1!==b.skippable};return c})},NV=function(a,b,c){return _.w(function*(){var d=b.adTagUrl;if(d)try{KV=!1;const e=_.wk(d),f=yield c.fetch(e).U;if(f&&f.data){const g=_.ni(f.data),h=(new DOMParser).parseFromString(g,_.$f);if(h.getElementsByTagName("vmap:VMAP").length)LV.warn("VMAP detected."),a.vmapAdsRequest=MV(g);
|
|
17
|
+
else if(h.getElementsByTagName("VAST").length){LV.warn("VAST detected.");{d=g;const k=new cast.framework.messages.BreakClip("bc1");k.vastAdsRequest=MV(d);const l=new cast.framework.messages.Break("b1",[k.id],0);a.breakClips=[k];a.breaks=[l]}}else LV.warn("Unsupported schema."),KV=!0}}catch(e){LV.warn("Failed to fetch an ad",e),KV=!0}})},MV=function(a){const b=new cast.framework.messages.VastAdsRequest;b.adsResponse=a;return b},OV=function(a,b){b=new _.I(1,10,10003,{errorType:b});a.m.onError(b)},PV=
|
|
18
|
+
function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},RV=function(a,b,c){if(c instanceof cast.framework.events.BreaksEvent||-1!==a.getPosition()){var d=null;(c=QV(a,c))&&(d={ad:c});a.m.trigger(new _.H(b,d))}},QV=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===_.Tf&&(e=a.a.getBreakById(b.breakId),!e&&d&&(e=a.a.getBreaks().find(g=>
|
|
19
|
+
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 Y(d,e,b.index,b.total,f)}return c},SV=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]},TV=function(a){const b=a.dashTimedMetadata;let c=_.rg;b&&(c=b.schemeIdUri);return{type:c.startsWith(_.qg)?
|
|
20
|
+
_.Gf:_.lg,schemeIdUri:c,id:a.id||"",startTime:a.startTime,endTime:a.endTime,value:b&&b.value||"",eventElement:b?b.eventElement:null}},UV=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},WV=function(a){a.a=UV().getTextTracksManager();const b=a.a.getTracks();a.j=VV(_.P,b)},VV=function(a,b){const c=[];for(const d of b)b=new _.tr(d.trackId.toString(),a),b.roles=d.roles||[],b.kind=d.subtype||null,b.language=d.language||null,b.originalLanguage=d.language||null,b.label=
|
|
21
|
+
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 _.xr(b.id,b)),c.push(b);return c},XV=function(a,b,c,d){c=_.Zh(c).filter(g=>g);var e=!1;let f=[];b===_.Q?f=a.getAudioTracks():b===_.P&&(f=a.qa());if(c=c.find(g=>{const h=_.Hn(g);return f.some(k=>{k=_.Hn(k.language||"");return _.In(h,k)})})){const g=_.Hn(c);c=f.filter(h=>{h=_.Hn(h.language||"");return _.In(g,h)});
|
|
22
|
+
f=c.length?c:f;e=e||!!c.length}_.wi(d)&&(c=f.filter(g=>g.roles.includes(d)),f=c.length?c:f,e=e||!!c.length);e&&f[0]&&(e=f[0],a.g.info("Will select track",e),b===_.Q?a.za(e):b===_.P&&a.Ta(e))},YV=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},aW=function(a,b){var c=()=>{b.protectionSystem=cast.framework.ContentProtection.NONE;b.licenseUrl=void 0;b.licenseRequestHandler=void 0;b.licenseHandler=void 0};if(a&&a.drm){var d=a.drm,e=_.mn(d);if(e){var f=[_.ud];_.fn(a)[0].type!==
|
|
23
|
+
_.Cc&&f.unshift(_.wd);d.preferredDrmSystem===_.ud&&f.reverse();for(var g,h;f.length&&!h;)g=f.shift(),h=e.Ja[g];h?(c=g===_.wd?cast.framework.ContentProtection.WIDEVINE:g===_.ud?cast.framework.ContentProtection.PLAYREADY:void 0,b.protectionSystem=c,b.licenseUrl=h.licenseUrl,c={ldlDelay:0,customData:{}},ZV(b,h,a,c),$V(b,h,a,c)):c()}else c()}else c()},bW=function(a,b){b=Object.assign({},a.shakaConfig,b);return Object.assign({},a,{shakaConfig:b})},ZV=function(a,b,c,d){b.modifiers.licenseRequest?a.licenseRequestHandler=
|
|
24
|
+
e=>{const f=_.wk({method:_.eb,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},$V=function(a,b,c,d){b.modifiers.licenseResponse?a.licenseHandler=(e,f)=>_.w(function*(){const g=_.Ak(Object.assign({},f.headers),e.buffer,200,"");yield b.modifiers.licenseResponse(c,g,d);return _.G(g.data)}):
|
|
25
|
+
a.licenseHandler=void 0},eW=function(){return cW||(cW=new dW)},fW=function(){return cast.framework.CastReceiverContext.getInstance()},gW=function(){const a=fW().getPlayerManager().getMediaInformation();return a&&a.metadata?a.metadata:null},hW=function(a,b){const c=fW().getPlayerManager().getMediaInformation();c?(b?c.metadata=b:delete c.metadata,a=!0,a=void 0===a?!1:a,fW().getPlayerManager().setMediaInformation(c,a)):a.g.warn("No mediaInformation is present. Skipping metadata update.")},jW=function(a,
|
|
26
|
+
b){a.g.debug("Detected HLS, parsing");var c=cast.framework.messages.HlsVideoSegmentFormat;a=fW();var {hlsVideoSegmentFormat:d}=fW().getPlayerManager().getMediaInformation()||{};c=d===c.FMP4?_.zg:_.yg;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=iW(f,_.pa),h=iW(f,_.mb);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")},
|
|
27
|
+
iW=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},kW=function(a){for(const b of a)a={},b.customData&&_.fh(b.customData)&&(a=b.customData),b.roles&&(a.roles=b.roles),b.audioTrackInfo&&(a.audioTrackInfo=b.audioTrackInfo),_.fh(a)&&(b.customData=a)},lW=function(a){_.w(function*(){yield a.h.L;a.a=a.h.o;a.w.on(a.a.controller,cast.framework.RemotePlayerEventType.ANY_CHANGE,
|
|
28
|
+
a.B.bind(a))})},mW=function(a,b,c){let d=null;c&&(d={ad:c});a.h.trigger(new _.H(b,d))},nW=function(a){if(!a.a||!a.a.mediaInfo)return null;var b=a.a.mediaInfo.breaks;const c=a.a.mediaInfo.breakClips,d=a.a.isPlayingBreak,e=a.a.breakId,f=a.a.currentBreakClipNumber,g=a.a.numberBreakClips,h=a.a.breakClipId;if(!(b&&c&&null!=e&&null!=f&&null!=g&&null!=h&&d))return null;const k=b.find(l=>l.id===e)||null;a=0;k&&(a=0>=k.position?k.position:b.filter(l=>0<=l.position).sort((l,m)=>l.position-m.position).findIndex(l=>
|
|
29
|
+
l===k));b=c.find(l=>l.id===h)||null;return new Y(b,k,f,g,a)},oW=class{constructor(a,b){this.log=new _.T(b);this.player=a;this.l=null;this.h=_.zs;this.o=7;this.j=2;this.C=Date.now();this.B=-1}release(){this.a(_.zs)}destroy(){this.l=this.player=null;return Promise.resolve()}getState(){return this.h}onError(a){a.severity===_.D&&this.a(_.ps)}a(a){if(a!==this.h)if(this.h===_.ps&&a!==_.zs)this.log.debug("Player is in ERROR state and can not switch to",a);else{var b=Date.now();this.o=this.h;this.h=a;2===
|
|
30
|
+
this.h?(this.B=b,this.player.trigger(new _.H(_.Pc,{detail:{bufferedTimeMS:-1,reason:this.j}}))):2===this.o&&this.player.trigger(new _.H(_.Oc,{detail:{bufferedTimeMS:b-this.B,reason:this.j}}));a={currentState:this.h,previousState:this.o,timeSinceLastStateChangeMS:b-this.C};this.C=b;this.l&&_.is(this.l,this.h);this.player.trigger(new _.H(_.Qf,{detail:a}))}}},pW;_.x("clpp.cast.CastUtils",class{});
|
|
31
|
+
var fV=0,yV={GENERIC:fV,MOVIE:1,TV_SHOW:2,MUSIC_TRACK:3,PHOTO:4,AUDIOBOOK_CHAPTER:5},qW="addMissingTimelineCues alwaysStreamText bufferBehind bufferingGoal durationBackoff gapDetectionThreshold ignoreTextStreamFailures lowLatencyMode rebufferingGoal retryParameters safeSeekOffset stallEnabled stallSkip stallThreshold startAtSegmentBoundary".split(" "),rW="bandwidthDowngradeTarget bandwidthUpgradeTarget defaultBandwidthEstimate enabled initialRestrictions restrictions switchInterval".split(" ");var sW=class extends oW{constructor(a){super(a,"clpp.cast.SenderStateManager");this.w=this.f=null;this.A=this.Wb.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.o)}destroy(){const a=this,b=()=>Object.getPrototypeOf(Object.getPrototypeOf(this)).destroy;return _.w(function*(){a.f&&(a.f.removeUpdateListener(a.A),a.f=null);yield b().call(a)})}a(a){const b=this.player.o;b&&b.isPlayingBreak||super.a(a)}Wb(){if(this.f&&
|
|
32
|
+
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(5);break;case chrome.cast.media.IdleReason.ERROR:this.a(_.ps);break;default:this.a(_.zs)}break;case chrome.cast.media.PlayerState.PLAYING:this.a(3);break;case chrome.cast.media.PlayerState.PAUSED:this.a(4);break;case chrome.cast.media.PlayerState.BUFFERING:this.a(2)}}};var tW=class extends _.V{constructor(){super();this.g=new _.T("clpp.cast.SenderTrackManager");this.a=null;this.h=[];this.f={}}initialize(a){this.a=a}release(){this.h=[];this.f={}}load(){this.release();var a=this.a.a;a&&(a=a.media)&&(this.h=(a=a.tracks)?a.map(b=>{switch(b.type){case chrome.cast.media.TrackType.VIDEO:var c=_.R;break;case chrome.cast.media.TrackType.AUDIO:c=_.Q;break;case chrome.cast.media.TrackType.TEXT:c=_.P}c=new _.tr(b.trackId.toString(),c);c.kind=b.subtype;c.language=b.language;
|
|
33
|
+
c.label=b.name;c.src=b.trackContentId;c.mimeType=b.trackContentType;if(b.customData){c.src=b.customData.url||c.src;c.mimeType=b.customData.mimeType||c.mimeType;const d=b.customData.roles;d&&(c.roles=d);if(b=b.customData.audioTrackInfo)void 0!==b.numAudioChannels&&(c.channelsCount=b.numAudioChannels),void 0!==b.spatialAudio&&(c.spatialAudio=b.spatialAudio)}c.renditions.push(new _.xr(c.id,c));return c}):[],this.a.trigger(new _.H(_.gg)))}destroy(){this.a=null}getVideoTracks(){return iV(this,_.R)}getAudioTracks(){return iV(this,
|
|
34
|
+
_.Q)}qa(){return iV(this,_.P)}ra(){const a=this.Fa();return a?a.renditions[0]:null}Na(){const a=this.pa();return a?a.renditions[0]:null}Ra(){const a=this.va();return a?a.renditions[0]:null}qb(){return this.f[_.R]||null}Fb(){return this.f[_.Q]||null}Gb(){return this.f[_.P]||null}Fa(){return kV(this,_.R)}pa(){return kV(this,_.Q)}va(){return kV(this,_.P)}zb(a){mV(this,_.R,a)}za(a){mV(this,_.Q,a)}Ta(a){mV(this,_.P,a)}ib(a){this.zb(a&&a.track)}xb(a){this.za(a&&a.track)}yb(a){this.Ta(a&&a.track)}addTextTrack(){return _.w(function*(){})}wa(){return!0}};
|
|
35
|
+
tW.prototype.isAbrEnabled=tW.prototype.wa;tW.prototype.addTextTrack=tW.prototype.addTextTrack;tW.prototype.setTextRendition=tW.prototype.yb;tW.prototype.setAudioRendition=tW.prototype.xb;tW.prototype.setVideoRendition=tW.prototype.ib;tW.prototype.setTextTrack=tW.prototype.Ta;tW.prototype.setAudioTrack=tW.prototype.za;tW.prototype.setVideoTrack=tW.prototype.zb;tW.prototype.getTextTrack=tW.prototype.va;tW.prototype.getAudioTrack=tW.prototype.pa;tW.prototype.getVideoTrack=tW.prototype.Fa;
|
|
36
|
+
tW.prototype.getLoadingTextRendition=tW.prototype.Gb;tW.prototype.getLoadingAudioRendition=tW.prototype.Fb;tW.prototype.getLoadingVideoRendition=tW.prototype.qb;tW.prototype.getTextRendition=tW.prototype.Ra;tW.prototype.getAudioRendition=tW.prototype.Na;tW.prototype.getVideoRendition=tW.prototype.ra;tW.prototype.getTextTracks=tW.prototype.qa;tW.prototype.getAudioTracks=tW.prototype.getAudioTracks;tW.prototype.getVideoTracks=tW.prototype.getVideoTracks;var CV=class extends _.Nt{constructor(a,b,c,d){super();this.g=new _.T(_.hd);this.T=a;this.w=new _.Li(b);this.R=c;this.ba=d;this.j=this.G=_.$m();this.C=[];this.B=0;this.I=new _.En;this.a=null;this.f=!1;this.L=new _.Hl;this.A=!1;this.ca="";this.ia=1E6;this.h=new tW;this.h.initialize(this);this.l=new sW(this);this.F=new _.Kt;this.H=null;this.K=new Set;this.M=this.Va.bind(this);this.ga=this.Nb.bind(this);this.Y=this.Mb.bind(this);this.P=this.Bb.bind(this);this.V=this.$a.bind(this);this.o=this.J=null;
|
|
37
|
+
window.cast||Object.defineProperty(window,"cast",{get:()=>window.cast_,set:e=>{window.cast_=e;window.setTimeout(()=>{pV(!0)},0)}});oV(this);nV.add(this)}init(a,b){this.j=this.G=b}unload(){return this.f?new Promise((a,b)=>{this.h&&this.h.release();this.a&&!this.a.idleReason||a();this.a.stop(null,a,b)}):Promise.resolve()}release(){return this.f?this.unload().then(()=>{this.l&&this.l.release()}):Promise.resolve()}getTimeline(){return null}setupPlaylist(){return Promise.reject(_.$a)}appendLoad(){return Promise.reject(_.$a)}seekWith(){return Promise.reject(_.$a)}setSeekInterceptor(){}setPlaybackSessionId(){}getBandwidthEstimate(){return null}destroy(){return _.w(function*(){})}Jd(a){this.J=
|
|
38
|
+
a}Bc(){return this.f}ya(){return this.A}Pe(){return this.ca}sendMessage(a,b){const c=this;return _.w(function*(){if(c.f){var d=cast.framework.CastContext.getInstance().getCurrentSession();if(d)try{yield d.sendMessage(a,b)}catch(f){var e=new _.I(1,8,8E3,{detailedErrorCode:f})}else e=new _.I(1,8,8004,void 0);if(e)c.onError(e)}})}cast(){const a=this;return _.w(function*(){if(!a.Bc())throw a.g.warn(RU),new _.I(1,8,8001,void 0);if(!qV)throw a.g.warn(OU),new _.I(1,8,8002,void 0);if(a.ya())throw a.g.warn("Already casting"),
|
|
39
|
+
new _.I(1,8,8003,void 0);try{yield sV(a)}catch(b){const c={};b instanceof chrome.cast.Error?(c.detailedErrorCode=b.code,c.details=b.details,c.reason=b.description):c.detailedErrorCode=b;throw new _.I(1,8,8E3,c);}})}Zd(){this.f&&this.ya()&&cast.framework.CastContext.getInstance().endCurrentSession(!0)}addMessageListener(a){typeof a===_.ae&&this.K.add(a)}removeMessageListener(a){typeof a===_.ae&&this.K.delete(a)}play(){return this.f?this.isEnded()?uV(this,!0):new Promise((a,b)=>{if(!this.a)return b(NU);
|
|
40
|
+
this.a.play(null,a,b)}):Promise.resolve()}pause(){return this.f?new Promise((a,b)=>{this.isEnded()&&a();if(!this.a)return b(NU);this.a.pause(null,a,b)}):Promise.resolve()}isPaused(){return this.f?!!this.a&&this.a.playerState===chrome.cast.media.PlayerState.PAUSED:!1}isEnded(){return this.f?5===this.getState():!1}seek(a){return this.f?this.isEnded()?uV(this,!1,a):new Promise((b,c)=>{this.a||c(NU);this.o.isPlayingBreak&&c(LU);const d=new chrome.cast.media.SeekRequest;d.currentTime=a;this.trigger(new _.H(_.tg));
|
|
41
|
+
this.a.seek(d,()=>{this.trigger(new _.H(_.sg));b()},c)}):Promise.resolve()}getPosition(){return this.f?this.getMediaPosition():0}getMediaPosition(){return this.f?this.a&&this.a.getEstimatedTime()||0:0}getDuration(){return this.f?this.getMediaDuration():0}getMediaDuration(){if(!this.f)return 0;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.f?this.a&&
|
|
42
|
+
this.a.playbackRate||0:0}setPlaybackRate(a){this.f&&this.a&&0<a&&this.sendMessage(YU,{type:"SET_PLAYBACK_RATE",requestId:hV(),mediaSessionId:this.a.mediaSessionId,playbackRate:a})}getVolume(){return this.f?this.a&&this.a.volume.level:0}setVolume(a){this.f&&this.a&&0<=a&&1>=a&&(a=new chrome.cast.media.VolumeRequest(new chrome.cast.Volume(a)),this.a.setVolume(a))}isMuted(){return this.f?this.a&&this.a.volume.muted:!1}setMuted(a){this.f&&this.a&&(a=new chrome.cast.media.VolumeRequest(new chrome.cast.Volume(void 0,
|
|
43
|
+
a)),this.a.setVolume(a))}getPresentationStartTime(){if(!this.f)return 0;if(!this.a||!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(){if(!this.f)return{start:0,end:0};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.f?this.l?this.l.getState():
|
|
44
|
+
7:7}getStats(){return this.f?this.a&&this.a.customData&&this.a.customData.stats?bV(this.a.customData.stats):_.ms():_.ms()}isLive(){return this.f?Infinity===this.getDuration():!1}load(a){const b=this;return _.w(function*(){if(b.Bc())if(qV){b.C=_.fn(a);b.j=_.bn([b.G,a]);var c=b.C[b.B];yield tV(b,{source:c,isLive:c.isLive,autoplay:b.j.autoplay,hb:b.j,ac:c.ac,ab:c.ab})}else b.g.warn(OU);else b.g.warn(RU)})}getBufferInfo(){return new _.Ht}getTrackManager(){return this.h}getConfiguration(){return this.j}getSurface(){return null}setNetworkEngine(a){this.I=
|
|
45
|
+
a}getNetworkEngine(){return this.I}getSourceIndex(){return this.B}setSourceIndex(a){this.B=a}setCmsdManager(){}getLoadedSource(){return this.C[this.B]}getPeriods(){return[]}getDrmInfo(){return null}getTimelineCues(){return[]}getCueTimeline(){return null}resetAbr(){this.g.warn(QU)}onError(a){if(a&&(this.trigger(new _.H(_.Xd,{detail:a})),this.l))this.l.onError(a)}namespace(){return _.hd}canPlay(){return this.Bc()?2:0}Db(){return this.H}Zb(a){this.H=xV(a)}Je(){this.H=null}tf(a){if(this.f){var b=this.Db()||
|
|
46
|
+
{};a={metadataType:vV(b.metadataType),title:a};this.Zb(Object.assign({},b,a))}}qf(a){if(this.f){var b=this.Db()||{},c=vV(b.metadataType);a=new chrome.cast.Image(a);this.Zb(Object.assign({},b,{metadataType:c,images:[a]}))}}pf(a){if(this.f){var b=this.Db()||{};this.Zb(Object.assign({},b,{metadataType:3,artist:a}))}}rf(a){if(this.f){var b=this.Db()||{};a={metadataType:vV(b.metadataType),releaseDate:a};this.Zb(Object.assign({},b,a))}}Va(a){const b=cast.framework.CastContext.getInstance(),c=a.castState===
|
|
47
|
+
cast.framework.CastState.CONNECTED;qV=a.castState!==cast.framework.CastState.NO_DEVICES_AVAILABLE;this.ca=c?b.getCurrentSession().getCastDevice().friendlyName:"";this.w.yf()}Nb(a){this.g.debug(`state: ${a.sessionState}, details:`,a);switch(a.sessionState){case cast.framework.SessionState.SESSION_STARTED:this.A=!0;AV(this,a.session);break;case cast.framework.SessionState.SESSION_RESUMED:this.ya()||(this.A=!0,AV(this,a.session),this.ba());break;case cast.framework.SessionState.SESSION_ENDED:if(this.ya()&&
|
|
48
|
+
this.a){const d=this.a.media;var b=this.h.pa(),c=this.h.va();b=b&&b.language||void 0;c=c&&c.language||void 0;this.R(this.getState(),{source:{url:d.contentId,type:d.contentType,isLive:this.isLive()},currentTime:BV(this),Yg:c,Pf:b})}a.session.removeEventListener(cast.framework.SessionEventType.MEDIA_SESSION,this.Y);a.session.removeMessageListener(WU,this.P);a.session.removeMessageListener(XU,this.V);this.A=!1;this.a=null}}Mb(a){this.g.debug("New media session",a.mediaSession);zV(this,a.mediaSession)}Cb(a){a.value&&
|
|
49
|
+
a.value.tracks&&this.h&&this.h.load()}Bb(a,b){const c=bV(b);this.K.forEach(d=>d(c))}$a(a,b){a=bV(b);"event"===a.type&&a.name===_.Dg&&this.trigger(new _.H(_.Uc,{visible:!!a.visible}))}Aa(){this.trigger(new _.H(_.fg))}Ua(a){const b=this;return _.w(function*(){let c=null;const d=yield dV(a,[_.Zf,_.Bc],b.I,b.j);d&&(c=new chrome.cast.media.Track(b.ia++,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,
|
|
50
|
+
url:a.url});return c})}getTextDisplayer(){return null}},qV=!1,nV=new Set;window.__onGCastApiAvailable=pV;var Z=class extends _.Nt{constructor(a,b,c){super();this.f=a;this.h=b;this.j=typeof c===_.ae?c:this.l;this.a=EV(this);this.g=new _.T(TU);this.f&&this.forwardEventsTo(this.f)}destroy(){const a=this;return _.w(function*(){a.a&&(yield rV(a.a),a.a=null);a.f&&a.stopForwardingEventsTo(a.f)})}l(a,b){this.f&&5!==a&&a!==_.zs&&(delete b.license,this.f.load(b))}Ic(){return!!this.a&&this.a.Bc()&&qV}ya(){return!!this.a&&this.a.ya()}Pe(){return this.a?this.a.Pe():""}Jd(a){this.a&&this.a.Jd(a)}cast(a,b){const c=
|
|
51
|
+
this;return _.w(function*(){if(c.a)try{if(yield c.a.cast(),c.f&&c.a){{let e=null;const f=c.f.getLoadedSource();if(f){const g=c.f.getTrackManager(),h=g.getVideoTracks()[0];let k,l;h&&h.mimeType&&(k=h.mimeType);const m=c.f.getConfiguration(),n=g.pa();n&&(n.mimeType&&(l=n.mimeType),n.language&&(m.preferredAudioLanguage=n.language),n.roles.length&&(m.preferredAudioRole=n.roles[0]));const p=g.va();p&&(p.language&&(m.preferredTextLanguage=p.language),p.roles.length&&(m.preferredTextRole=p.roles[0]));const u=
|
|
52
|
+
f&&typeof f.isLive===_.Nc?f.isLive:c.f.isLive();e={source:f,isLive:u,autoplay:!c.f.isPaused(),currentTime:Math.max(c.f.getPosition()-1,0),ef:c.f.getPresentationStartTime(),ac:k,ab:l,hb:m}}var d=e}b&&d&&(d.queueData={items:b.items,startIndex:b.startIndex});yield DV(c);c.a&&(d&&(d.autoplay=!c.f.isPaused()),a?yield c.f.load(a):c.a.a||(yield tV(c.a,d)))}}catch(e){c.g.error("Error while trying to cast",e),d=new _.H(_.Xd,{detail:e}),c.trigger(d)}})}Zd(){this.a&&this.a.Zd()}Ch(a){const b=this;return _.w(function*(){a!==
|
|
53
|
+
b.h&&(b.h=a,b.a&&(yield rV(b.a)),b.a=EV(b))})}sendMessage(a){const b=this;return _.w(function*(){b.a?yield b.a.sendMessage(WU,a):b.g.warn(SU)})}Pg(){const a=this;return _.w(function*(){yield a.a.sendMessage(YU,{type:"QUEUE_NEXT",requestId:hV(),mediaSessionId:a.a.a.mediaSessionId})})}Qg(){const a=this;return _.w(function*(){yield a.a.sendMessage(YU,{type:"QUEUE_PREV",requestId:hV(),mediaSessionId:a.a.a.mediaSessionId})})}Og(a){const b=this;return _.w(function*(){yield b.a.sendMessage(YU,{type:"QUEUE_INSERT",
|
|
54
|
+
requestId:hV(),mediaSessionId:b.a.a.mediaSessionId,items:a})})}addMessageListener(a){this.a?this.a.addMessageListener(a):this.g.warn(SU)}removeMessageListener(a){this.a?this.a.removeMessageListener(a):this.g.warn(SU)}Db(){return this.a&&this.a.Db()}Zb(a){this.a&&this.a.Zb(a)}Je(){this.a&&this.a.Je()}tf(a){this.a&&this.a.tf(a)}qf(a){this.a&&this.a.qf(a)}pf(a){this.a&&this.a.pf(a)}rf(a){this.a&&this.a.rf(a)}};_.x(TU,Z);Z.prototype.setContentReleaseDate=Z.prototype.rf;Z.prototype.setContentArtist=Z.prototype.pf;
|
|
55
|
+
Z.prototype.setContentImage=Z.prototype.qf;Z.prototype.setContentTitle=Z.prototype.tf;Z.prototype.clearContentMetadata=Z.prototype.Je;Z.prototype.setContentMetadata=Z.prototype.Zb;Z.prototype.getContentMetadata=Z.prototype.Db;Z.prototype.removeMessageListener=Z.prototype.removeMessageListener;Z.prototype.addMessageListener=Z.prototype.addMessageListener;Z.prototype.queueAddItems=Z.prototype.Og;Z.prototype.queuePreviousItem=Z.prototype.Qg;Z.prototype.queueNextItem=Z.prototype.Pg;
|
|
56
|
+
Z.prototype.sendMessage=Z.prototype.sendMessage;Z.prototype.changeReceiverId=Z.prototype.Ch;Z.prototype.forceDisconnect=Z.prototype.Zd;Z.prototype.cast=Z.prototype.cast;Z.prototype.setPlayerConfigInterceptor=Z.prototype.Jd;Z.prototype.getReceiverName=Z.prototype.Pe;Z.prototype.isCasting=Z.prototype.ya;Z.prototype.canCast=Z.prototype.Ic;Z.prototype.destroy=Z.prototype.destroy;var uW=class extends oW{constructor(a){super(a,"clpp.cast.StateManager");this.I=this.T.bind(this);this.H=this.R.bind(this);this.A=this.ca.bind(this);this.w=this.ba.bind(this);this.K=this.Y.bind(this);this.J=this.V.bind(this);this.L=this.ia.bind(this);this.G=this.ga.bind(this);this.F=this.P.bind(this);this.f=this.M.bind(this)}init(){const a=cast.framework.events.EventType,b=cast.framework.CastReceiverContext.getInstance().getPlayerManager();b.addEventListener(a.PLAYING,this.I);b.addEventListener(a.PAUSE,
|
|
54
57
|
this.H);b.addEventListener(a.MEDIA_FINISHED,this.A);b.addEventListener(a.BUFFERING,this.w);b.addEventListener(a.SEEKING,this.K);b.addEventListener(a.SEEKED,this.J);b.addEventListener(a.STALLED,this.L);b.addEventListener(a.PLAYER_LOADING,this.G);b.addEventListener(a.ERROR,this.F);b.addEventListener(a.BITRATE_CHANGED,this.f)}destroy(){const a=this,b=()=>Object.getPrototypeOf(Object.getPrototypeOf(this)).destroy;return _.w(function*(){const c=cast.framework.events.EventType,d=cast.framework.CastReceiverContext.getInstance().getPlayerManager();
|
|
55
|
-
d.removeEventListener(c.PLAYING,a.I);d.removeEventListener(c.PAUSE,a.H);d.removeEventListener(c.MEDIA_FINISHED,a.A);d.removeEventListener(c.BUFFERING,a.w);d.removeEventListener(c.SEEKING,a.K);d.removeEventListener(c.SEEKED,a.J);d.removeEventListener(c.STALLED,a.L);d.removeEventListener(c.PLAYER_LOADING,a.G);d.removeEventListener(c.ERROR,a.F);d.removeEventListener(c.BITRATE_CHANGED,a.f);yield b().call(a)})}T(){this.player.trigger(new _.
|
|
56
|
-
this.a(2):(a=this.player.isPaused()?4:3,this.a(a))}Y(){this.j=1;this.player.trigger(new _.
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
this.
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
a
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
b
|
|
84
|
-
|
|
85
|
-
c
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
(
|
|
93
|
-
|
|
58
|
+
d.removeEventListener(c.PLAYING,a.I);d.removeEventListener(c.PAUSE,a.H);d.removeEventListener(c.MEDIA_FINISHED,a.A);d.removeEventListener(c.BUFFERING,a.w);d.removeEventListener(c.SEEKING,a.K);d.removeEventListener(c.SEEKED,a.J);d.removeEventListener(c.STALLED,a.L);d.removeEventListener(c.PLAYER_LOADING,a.G);d.removeEventListener(c.ERROR,a.F);d.removeEventListener(c.BITRATE_CHANGED,a.f);yield b().call(a)})}T(){this.player.trigger(new _.H(_.We));this.a(3)}R(){this.a(4)}ca(){this.a(5)}ba(a){a.isBuffering?
|
|
59
|
+
this.a(2):(a=this.player.isPaused()?4:3,this.a(a))}Y(){this.j=1;this.player.trigger(new _.H(_.tg))}V(){this.player.trigger(new _.H(_.sg))}ia(){this.j=2}ga(){this.a(1)}M(a){const b=this.player.getStats();this.player.trigger(new _.H(_.Mc,{detail:{bandwidth:a.totalBitrate,width:b.width,height:b.height}}))}P(a){a=new _.I(_.D,7,7300,{detailedErrorCode:a.detailedErrorCode,error:a.error,reason:a.reason});this.player.trigger(new _.H(_.Xd,{detail:a}));this.a(_.ps)}};var vW=class extends _.Nt{constructor(a=[],b=0){super();this.a=a.slice();this.f=b}nd(){return this.a}getPosition(){return this.f}Eb(){return this.a[this.f]||null}qg(){return this.a[this.f+1]||null}append(a){this.a.push(a);GV(this)}ug(a,b){0>b||b>this.a.length||(this.a.splice(b,0,a),GV(this))}remove(a){0>a||a>=this.a.length||a===this.f||(this.a.splice(a,1),this.f>a&&this.f--,GV(this))}clear(){this.a=[];this.f=0;GV(this)}};var wW=class extends _.Nt{constructor(a,b,c){c=void 0===c?()=>Promise.resolve():c;super();this.m=a;this.a=b;this.w=c;this.j=this.f=this.h=!1;this.o=()=>{const d=this;return _.w(function*(){if(!d.f){var e=d.a.Eb();if(e){d.f=!0;try{yield d.w(e),yield d.m.load(Object.assign({},e.configuration,{autoplay:!0}))}catch(f){throw f;}finally{d.f=!1}}}})};this.l=()=>{IV(this)}}start(){this.h||this.f||(this.h=!0,this.m.on(_.Wd,this.l),HV(this),FV(this.a,this.a.getPosition()))}next(){const a=this.a.Eb();a&&!1===
|
|
60
|
+
a.skippable||IV(this)}Fd(){var a=this.a.Eb();a&&!1===a.skippable||(HV(this),a=Math.max(0,this.a.getPosition()-1),FV(this.a,a))}Sc(a){const b=this;return _.w(function*(){FV(b.a,a)})}stop(){this.h=!1;this.m.off(_.Wd,this.l);this.a.off(_.hf,this.o);this.j=!1}};var xW=class{constructor(a,b,c){this.player=a;this.Kb=new vW(c);this.Zc=new wW({load:this.player.load.bind(this.player),off:this.player.off.bind(this.player),on:this.player.on.bind(this.player)},this.Kb,()=>_.w(function*(){}));this.a=new Z(this.player,b,(d,e)=>{const f=this;return _.w(function*(){const g=f.Kb.getPosition();f.Zc.Sc(g);e.autoplay=!0;delete e.license;yield f.player.load(e);typeof e.currentTime===_.r&&(yield f.player.seek(Math.max(e.currentTime-1,0)));f.player.play()})});this.f=d=>{d&&
|
|
61
|
+
d.type===PU&&typeof d.index===_.r&&FV(this.Kb,d.index)};this.a.addMessageListener(this.f)}wi(a){return this.Kb.on(_.hf,a)}xi(a){return this.Kb.on(_.kf,a)}si(a){return this.player.on(_.Tc,a)}Ic(){return this.a.Ic()}Zh(){return this.Kb.nd()}ya(){return this.a.ya()}append(a){const b=this;return _.w(function*(){b.Kb.append(a);b.a.ya()&&(yield b.a.Og(JV([a])))})}Th(){return this.Kb.getPosition()}start(){this.Zc.start()}play(){this.player.play()}pause(){this.player.pause()}destroy(){this.Zc.stop();this.a.removeMessageListener(this.f);
|
|
62
|
+
this.a.destroy();this.player.release()}aj(){const a=this;return _.w(function*(){if(a.a.ya())a.a.Zd();else{a.Zc.stop();var b=JV(a.Kb.nd()),c=a.Kb.getPosition();yield a.a.cast(void 0,{items:b,startIndex:c})}})}next(){const a=this;return _.w(function*(){a.a.ya()?yield a.a.Pg():yield a.Zc.next()})}Fd(){const a=this;return _.w(function*(){a.a.ya()?yield a.a.Qg():yield a.Zc.Fd()})}};_.x("clpp.cast.playlist.CastPlaylist",xW);xW.prototype.previous=xW.prototype.Fd;xW.prototype.next=xW.prototype.next;
|
|
63
|
+
xW.prototype.toggleCast=xW.prototype.aj;xW.prototype.destroy=xW.prototype.destroy;xW.prototype.pause=xW.prototype.pause;xW.prototype.play=xW.prototype.play;xW.prototype.start=xW.prototype.start;xW.prototype.getCurrentIndex=xW.prototype.Th;xW.prototype.append=xW.prototype.append;xW.prototype.isCasting=xW.prototype.ya;xW.prototype.getPlaylistItems=xW.prototype.Zh;xW.prototype.canCast=xW.prototype.Ic;xW.prototype.onCastStatusChanged=xW.prototype.si;xW.prototype.onPlaylistModified=xW.prototype.xi;
|
|
64
|
+
xW.prototype.onPlaylistItemChange=xW.prototype.wi;var Y=class{constructor(a,b,c,d,e){this.a=a;this.f=b;this.l=typeof c===_.r?c:1;this.h=typeof d===_.r?d:1;this.j=typeof e===_.r?e:0}nb(){return"Google Cast Framework"}ob(){return cast.framework.VERSION}ub(){return 0}getId(){return this.a.id}getCreativeId(){return""}Qb(){return""}getApiFramework(){return null}getAdSystem(){return""}getAdvertiserName(){return""}getTitle(){return this.a.title||""}getDuration(){return this.a.duration||0}getPosition(){return 0}getSkipTimeOffset(){return this.a.whenSkippable||
|
|
65
|
+
0}Ub(){return!1}pb(){return this.a.clickThroughUrl||null}getMediaUrl(){return this.a.contentUrl||this.a.contentId||null}eb(){return 0}cb(){return 0}Pa(){return 0}Qa(){switch(this.Hb()){case 0:return 0;case -1:return 2;default:return 1}}getPodIndex(){return this.j}Hb(){return this.f.position}rb(){return this.l}fb(){return this.h}getWrapperAdIds(){return[]}canSeek(){return!1}getWrapperAdSystems(){return[]}getWrapperCreativeIds(){return[]}Sb(){return null}};Y.prototype.getVideoElement=Y.prototype.Sb;
|
|
66
|
+
Y.prototype.getWrapperCreativeIds=Y.prototype.getWrapperCreativeIds;Y.prototype.getWrapperAdSystems=Y.prototype.getWrapperAdSystems;Y.prototype.canSeek=Y.prototype.canSeek;Y.prototype.getWrapperAdIds=Y.prototype.getWrapperAdIds;Y.prototype.getSequenceLength=Y.prototype.fb;Y.prototype.getPositionInSequence=Y.prototype.rb;Y.prototype.getPodTimeOffset=Y.prototype.Hb;Y.prototype.getPodIndex=Y.prototype.getPodIndex;Y.prototype.getPodType=Y.prototype.Qa;Y.prototype.getMediaBitrate=Y.prototype.Pa;
|
|
67
|
+
Y.prototype.getMediaHeight=Y.prototype.cb;Y.prototype.getMediaWidth=Y.prototype.eb;Y.prototype.getMediaUrl=Y.prototype.getMediaUrl;Y.prototype.getClickThroughUrl=Y.prototype.pb;Y.prototype.isBumper=Y.prototype.Ub;Y.prototype.getSkipTimeOffset=Y.prototype.getSkipTimeOffset;Y.prototype.getPosition=Y.prototype.getPosition;Y.prototype.getDuration=Y.prototype.getDuration;Y.prototype.getTitle=Y.prototype.getTitle;Y.prototype.getAdvertiserName=Y.prototype.getAdvertiserName;Y.prototype.getAdSystem=Y.prototype.getAdSystem;
|
|
68
|
+
Y.prototype.getApiFramework=Y.prototype.getApiFramework;Y.prototype.getSourceId=Y.prototype.Qb;Y.prototype.getCreativeId=Y.prototype.getCreativeId;Y.prototype.getId=Y.prototype.getId;Y.prototype.getTechnology=Y.prototype.ub;Y.prototype.getAdManagerVersion=Y.prototype.ob;Y.prototype.getAdManagerName=Y.prototype.nb;var yW=class{constructor(a){this.a=a}getCuePoints(){return this.a.map(a=>a.position)}Jb(){return!!this.a.find(a=>0===a.position)}Ib(){return!!this.a.find(a=>-1===a.position)}};yW.prototype.hasPostroll=yW.prototype.Ib;yW.prototype.hasPreroll=yW.prototype.Jb;yW.prototype.getCuePoints=yW.prototype.getCuePoints;var zW=class{constructor(a){this.m=a;this.a=null;this.h=this.w.bind(this);this.f=[cast.framework.events.EventType.PLAYER_LOADING,cast.framework.events.EventType.BREAK_CLIP_LOADING,cast.framework.events.EventType.BREAK_STARTED,cast.framework.events.EventType.BREAK_ENDED,cast.framework.events.EventType.BREAK_CLIP_STARTED,cast.framework.events.EventType.BREAK_CLIP_ENDED,cast.framework.events.EventType.PLAYING,cast.framework.events.EventType.PAUSE,cast.framework.events.EventType.BUFFERING];PV().addEventListener(this.f,
|
|
69
|
+
this.h)}load(){const a=this;return _.w(function*(){KV&&(KV=!1,OV(a,0))})}A(){return!0}o(){}resume(){-1!==this.getPosition()&&PV().play()}pause(){-1!==this.getPosition()&&PV().pause()}skip(){}getVolume(){LV.warn(ZU);return 0}setVolume(){LV.warn(ZU)}getPosition(){const a=this.a&&this.a.getBreakClipCurrentTimeSec();return typeof a===_.r?a:-1}l(){return!0}j(){const a=this;return _.w(function*(){PV().removeEventListener(a.f,a.h)})}w(a){const b=cast.framework.events.EndedReason;switch(a.type){case cast.framework.events.EventType.PLAYER_LOADING:this.a=
|
|
70
|
+
PV().getBreakManager();this.a.setPlayWatchedBreak(!0);a=this.a.getBreaks();this.m.trigger(new _.H(_.pc,{adsTimeline:new yW(a)}));break;case cast.framework.events.EventType.BREAK_CLIP_LOADING:RV(this,_.ec,a);break;case cast.framework.events.EventType.BREAK_STARTED:RV(this,_.Tb,a);break;case cast.framework.events.EventType.BREAK_ENDED:RV(this,_.Ub,a);break;case cast.framework.events.EventType.BREAK_CLIP_STARTED:RV(this,_.lc,a);break;case cast.framework.events.EventType.BREAK_CLIP_ENDED:a.endedReason===
|
|
71
|
+
b.SKIPPED?(RV(this,_.kc,a),RV(this,_.mc,a)):a.endedReason===b.STOPPED?RV(this,_.mc,a):a.endedReason===b.END_OF_STREAM?(RV(this,_.Xb,a),RV(this,_.mc,a)):a.endedReason===b.ERROR&&OV(this,1);break;case cast.framework.events.EventType.PLAYING:RV(this,_.jc,a);break;case cast.framework.events.EventType.PAUSE:RV(this,_.hc,a);break;case cast.framework.events.EventType.BUFFERING:a.isBuffering?RV(this,_.Vb,a):RV(this,_.jc,a)}}};zW.prototype.getPosition=zW.prototype.getPosition;zW.prototype.setVolume=zW.prototype.setVolume;
|
|
72
|
+
zW.prototype.getVolume=zW.prototype.getVolume;zW.prototype.skip=zW.prototype.skip;zW.prototype.pause=zW.prototype.pause;zW.prototype.resume=zW.prototype.resume;var KV=!1,LV=new _.T("clpp.cast.ads.AdsManager");var AW=class{constructor(a){this.a=a;this.f=this.h.bind(this)}init(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().addEventListener(SV(),this.f)}release(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().removeEventListener(SV(),this.f)}getTimelineCues(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager().getTimedMetadata().map(a=>TV(a))}h(a){if(a instanceof cast.framework.events.TimedMetadataEvent){var b=null;switch(a.type){case cast.framework.events.EventType.TIMED_METADATA_CHANGED:b=
|
|
73
|
+
_.bg;break;case cast.framework.events.EventType.TIMED_METADATA_ENTER:b=_.cg;break;case cast.framework.events.EventType.TIMED_METADATA_EXIT:b=_.dg}b&&this.a(new _.H(b,{detail:TV(a.timedMetadataInfo)}))}else for(b of this.getTimelineCues())this.a(new _.H(_.bg,{detail:b}))}};var BW=class extends _.V{constructor(){super();this.g=new _.T("clpp.cast.TrackManager");this.m=null;this.o=1E9;this.h=[];this.j=[];this.l=this.w.bind(this);this.a=this.f=null}initialize(a){this.m=a;UV().addEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.l)}release(){this.h=[];this.j=[];this.a=this.f=null}load(){}destroy(){this.m=null;UV().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.l)}getVideoTracks(){return[]}getAudioTracks(){return this.h}qa(){return this.j}ra(){return null}Na(){const a=
|
|
74
|
+
this.pa();return a&&a.renditions[0]}Ra(){const a=this.va();return a&&a.renditions[0]}qb(){return null}Fb(){return null}Gb(){return null}Fa(){return null}pa(){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}va(){let a=null;if(this.a){let b=this.a.getActiveIds()[0];typeof b===_.r&&(b=b.toString(),a=this.qa().find(c=>c.id===b)||null)}return a}zb(){this.g.warn("Video tracks unavailable on Cast")}za(a){a&&this.f&&
|
|
75
|
+
this.f.setActiveById(+a.id)}Ta(a){this.a&&(a?this.a.setActiveByIds([+a.id]):this.a.setActiveByIds([]))}ib(){this.g.warn("Video renditions unavailable on Cast")}xb(a){this.za(a&&a.track)}yb(a){this.Ta(a&&a.track)}addTextTrack(a){const b=this;return _.w(function*(){var c=b.m.getConfiguration();if((c=yield dV(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=
|
|
76
|
+
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]),WV(b)}catch(e){throw b.g.warn("failed on track",a),e;}}})}wa(){return!0}w(){this.f=UV().getAudioTracksManager();var a=this.f.getTracks();this.h=VV(_.Q,a);WV(this);a=this.m.getConfiguration();XV(this,_.Q,a.preferredAudioLanguage,a.preferredAudioRole);XV(this,_.P,a.preferredTextLanguage,a.preferredTextRole)}};BW.prototype.isAbrEnabled=BW.prototype.wa;
|
|
77
|
+
BW.prototype.addTextTrack=BW.prototype.addTextTrack;BW.prototype.setTextRendition=BW.prototype.yb;BW.prototype.setAudioRendition=BW.prototype.xb;BW.prototype.setVideoRendition=BW.prototype.ib;BW.prototype.setTextTrack=BW.prototype.Ta;BW.prototype.setAudioTrack=BW.prototype.za;BW.prototype.setVideoTrack=BW.prototype.zb;BW.prototype.getTextTrack=BW.prototype.va;BW.prototype.getAudioTrack=BW.prototype.pa;BW.prototype.getVideoTrack=BW.prototype.Fa;BW.prototype.getLoadingTextRendition=BW.prototype.Gb;
|
|
78
|
+
BW.prototype.getLoadingAudioRendition=BW.prototype.Fb;BW.prototype.getLoadingVideoRendition=BW.prototype.qb;BW.prototype.getTextRendition=BW.prototype.Ra;BW.prototype.getAudioRendition=BW.prototype.Na;BW.prototype.getVideoRendition=BW.prototype.ra;BW.prototype.getTextTracks=BW.prototype.qa;BW.prototype.getAudioTracks=BW.prototype.getAudioTracks;BW.prototype.getVideoTracks=BW.prototype.getVideoTracks;var CW=class extends _.Nt{constructor(){super();this.g=new _.T(UU);this.h=this.w=_.$m();this.A=null;this.l=-1;this.F=new _.En;this.f=this.o=this.j=this.a=this.B=null;this.C=!1}init(a,b){this.B=a;b&&(this.h=this.w=b);a=YV();a.setMessageInterceptor(cast.framework.messages.MessageType.MEDIA_STATUS,this.H.bind(this));a.setMediaPlaybackInfoHandler(this.G.bind(this));this.a=new uW(this);this.a.init();this.j=new BW;this.j.initialize(this);this.o=new AW(c=>this.trigger(c));this.o.init()}unload(){const a=
|
|
79
|
+
cast.framework.messages.PlayerState,b=YV();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 _.w(function*(){a.B=null;a.w=_.$m();a.h=a.w;a.l=-1;a.A=null;a.a&&(yield a.a.destroy(),a.a=null);a.j&&(a.j.destroy(),a.j=null)})}play(){const a=YV();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot play during ads playout.");
|
|
80
|
+
a.play();return Promise.resolve()}pause(){const a=YV();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot pause during ads playout.");a.pause();return Promise.resolve()}isPaused(){return YV().getPlayerState()===cast.framework.messages.PlayerState.PAUSED}isEnded(){return YV().getPlayerState()===cast.framework.messages.PlayerState.IDLE}seek(a){const b=YV();if(null!==b.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject(LU);b.seek(a);return Promise.resolve()}getPosition(){return this.getMediaPosition()}setSeekInterceptor(){}setPlaybackSessionId(){}getBandwidthEstimate(){return null}getMediaPosition(){return YV().getCurrentTimeSec()}getDuration(){return this.getMediaDuration()}getMediaDuration(){const a=
|
|
81
|
+
YV().getDurationSec();return typeof a===_.r?-1===a?Infinity:a:-1}getPlaybackRate(){return YV().getPlaybackRate()}setPlaybackRate(a){if(0<a){const b=new cast.framework.messages.SetPlaybackRateRequestData;b.playbackRate=a;YV().sendLocalMediaRequest(b)}}getVolume(){this.g.warn(ZU);return null}setVolume(){this.g.warn(ZU)}setMuted(){this.g.warn(ZU)}isMuted(){this.g.warn(ZU);return!1}getLoadedSource(){const a=YV().getMediaInformation();if(a){var b=YV().getPlaybackConfig();b=!!b&&b.protectionSystem!==cast.framework.ContentProtection.NONE;
|
|
82
|
+
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,uj:b,name:c}}return null}getDrmInfo(){return null}getPresentationStartTime(){return YV().getStartAbsoluteTime()}getSeekRange(){let a={start:0,end:this.getDuration()};if(this.isLive()){const b=YV().getLiveSeekableRange();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():7}getStats(){var a=
|
|
83
|
+
_.ms();if(this.f){a=YV().getStats();this.f.h=a.estimatedBandwidth||NaN;this.f.w=a.streamBandwidth||NaN;var b=this.f,c=a.height||NaN;b.A=a.width||NaN;b.j=c;b=this.f;c=typeof a.decodedFrames===_.r?a.decodedFrames:NaN;b.o=typeof a.droppedFrames===_.r?a.droppedFrames:NaN;b.l=c;a=this.f.getStats()}return a}isLive(){return Infinity===this.getDuration()}load(a){const b=this;return _.w(function*(){b.f=new _.nv;b.a.l=b.f.a;b.A=_.fn(a);b.h=_.bn([b.w,a]);if(b.C)b.C=!1;else{var c=b.A[b.l],d=new cast.framework.messages.LoadRequestData;
|
|
84
|
+
d.autoplay=b.h.autoplay;typeof b.h.startTime===_.r&&(d.currentTime=b.h.startTime);c.type&&(d.media.contentType=c.type);d.media.contentId=c.url;d.media.customData={playerConfiguration:aV(b.h),local:!0};yield YV().load(d)}})}getBufferInfo(){this.g.warn(_.qa);return new _.Ht}getTrackManager(){return this.j}getConfiguration(){return this.h}getSurface(){return this.B}getTimeline(){return null}setupPlaylist(){return Promise.reject(_.$a)}appendLoad(){return Promise.reject(_.$a)}seekWith(){return Promise.reject(_.$a)}setNetworkEngine(a){this.F=
|
|
85
|
+
a}setCmsdManager(){}getNetworkEngine(){return this.F}getSourceIndex(){return this.l}setSourceIndex(a){this.l=a}getPeriods(){return[]}namespace(){return UU}getTimelineCues(){return this.o&&this.o.getTimelineCues()||[]}getCueTimeline(){return null}resetAbr(){this.g.warn(QU)}onError(a){a=new _.H(_.Xd,{detail:a});this.trigger(a)}canPlay(){return _.Yi()?2:0}H(a){a=Object.assign({},a);a.customData||(a.customData={});a.customData.stats=aV(this.getStats());var b=YV(),c=a.media||b.getMediaInformation();b=
|
|
86
|
+
b.getStartAbsoluteTime();c&&typeof b===_.r&&c.startAbsoluteTime!==b&&(this.g.info("Syncing startAbsoluteTime."+`Old value: ${c.startAbsoluteTime}, `+`new value: ${b}`),c.startAbsoluteTime=b,a=Object.assign({},a,{media:c}));{c=cast.framework.messages.StreamType;b=a.media;var d=!!b;const e=this.isLive(),f=d&&!b.metadata,g=!!a.liveSeekableRange;if(d&&g&&(!e||e&&f)){d=YV().getStartAbsoluteTime();if(typeof d===_.r){b.startAbsoluteTime=d;let h;f?h=new cast.framework.messages.GenericMediaMetadata:h=b.metadata;
|
|
87
|
+
h.sectionStartAbsoluteTime=d;b.metadata=h}b.streamType=c.LIVE;a=Object.assign({},a,{media:b})}}return a}G(a,b){var c=null;a.media.customData&&(c=bV(a.media.customData.playerConfiguration));var d=null;var e=null;a.media.customData&&(d=bV(a.media.customData["com.castlabs.reactnative.PlayerConfiguration"]),e=bV(a.media.customData.playerConfiguration));a=(a=d&&d.LiveConfiguration)?0===a.liveEdgeLatencyMs:!1;d=!(!d||!d.lowLatencyMode);b=(e=null!=e&&e.lowLatencyMode||a||d)?bW(b,{streaming:{lowLatencyMode:!0}}):
|
|
88
|
+
b;if(!c)return b;e=c.chromecast||null;a=c.abr||null;d=b;a&&typeof a.defaultBandwidthEstimate===_.r?d.initialBandwidth=a.defaultBandwidthEstimate:d.initialBandwidth=void 0;aW(c,b);a={};d=c.streaming||null;e&&e.useSenderStreamingConfig&&d&&(a.streaming=cV(d,qW));c=c.abr||null;e&&e.useSenderAbrConfig&&c&&(a.abr=cV(c,rW));_.fh(a)&&(b=bW(b,a));return b}getTextDisplayer(){return null}setDrmCustomDataModifier(){}setCdnErrorCallback(){}detach(){}};var dW=class{constructor(){this.a=!1;this.g=new _.T(VU);this.f=this.m=null;this.w=new Set;this.C=this.K.bind(this);this.B=this.F.bind(this);this.o=null;this.l=new _.Kt;this.j=this.h=this.A=null}init(a){a&&(this.f=new CW,_.Xn(a,this.f),this.m=a,this.l.on(window,"unload",()=>{const b=this;return _.w(function*(){b.m&&b.m.getState()!==_.zs&&(yield $U(b.m))})}))}start(){if(!this.a&&window.cast&&cast.framework&&cast.framework.CastReceiverContext){this.a=!0;var a=fW(),b=fW().getPlayerManager(),c=new cast.framework.CastReceiverOptions;
|
|
89
|
+
c.customNamespaces={};c.customNamespaces[WU]=cast.framework.system.MessageType.JSON;c.customNamespaces[XU]=cast.framework.system.MessageType.JSON;var d=new cast.framework.PlaybackConfig;d.manifestHandler=this.I.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;this.h&&(c.queue=this.h);b.setMessageInterceptor(cast.framework.messages.MessageType.QUEUE_UPDATE,
|
|
90
|
+
e=>{this.g.info("QUEUE_UPDATE message received",e);var f=this.getQueueManager();if(!f)return e;f=f.getCurrentItem();return f?(f=f.customData)&&!1===f.skippable?null:e:e});b.setMessageInterceptor(cast.framework.messages.MessageType.LOAD,this.H.bind(this));b.setMessageInterceptor(cast.framework.messages.MessageType.MEDIA_STATUS,this.J.bind(this));b.addEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.C);b.addEventListener(cast.framework.events.EventType.MEDIA_STATUS,this.G.bind(this));
|
|
91
|
+
a.start(c);a.addCustomMessageListener(WU,this.B);this.l.on(document,_.Dg,()=>{var e={type:"event",name:_.Dg,visible:!document.hidden};fW().sendCustomMessage(XU,void 0,e)})}}stop(){if(this.a){this.a=!1;this.l.release();const a=fW();fW().getPlayerManager().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.C);a.removeCustomMessageListener(WU,this.B);a.stop();this.j=this.h=this.m=this.f=null}}Jd(a){this.o=a}Qi(a){this.A=a}on(a,b){fW().addEventListener(a,b)}off(a,b){fW().removeEventListener(a,
|
|
92
|
+
b)}addMessageListener(a){typeof a===_.ae&&this.w.add(a)}removeMessageListener(a){typeof a===_.ae&&this.w.delete(a)}sendMessage(a,b){fW().sendCustomMessage(WU,b,a)}Bc(){return this.a}Db(){return gW()}Zb(a){hW(this,a)}gj(a){const b=gW();let c=null;a?c=Object.assign({},b,a):c=b;hW(this,c)}Si(a){this.h=a;this.j=null}getQueueManager(){return fW().getPlayerManager().getQueueManager()}G(){var a=this.getQueueManager();a&&(a=a.getCurrentItemIndex(),this.j!==a&&(this.j=a,fW().sendCustomMessage(WU,void 0,{type:PU,
|
|
93
|
+
index:a})))}I(a){a=a.trim();if(a.startsWith("#EXTM3U"))return jW(this,a);try{var b=(new DOMParser).parseFromString(a,_.$f)}catch(k){return a}var c=b.getElementsByTagName("MPD")[0];if(c){a=c;this.g.debug("Detected DASH, parsing");b=fW();c=a.getElementsByTagName("Period");for(var d=c.length-1;0<=d;--d){var e=c[d].getElementsByTagName(_.fa);for(var f=e.length-1;0<=f;--f){var g=e[f].getAttribute("contentType");if(g===_.t||g===_.q){g=e[f].getAttribute(_.Be);var h=e[f].getElementsByTagName(_.nb);for(let k=
|
|
94
|
+
h.length-1;0<=k;--k){const l=h[k].getAttribute(_.Be)||g,m=h[k].getAttribute(_.pd);let n=h[k].getAttribute(_.Mg)||void 0,p=h[k].getAttribute(_.be)||void 0;void 0!==n&&(n=+n);void 0!==p&&(p=+p);b.canDisplayType(l,m,n,p)||e[f].removeChild(h[k])}e[f].getElementsByTagName(_.nb).length||c[d].removeChild(e[f])}}c[d].getElementsByTagName(_.fa).length||a.removeChild(c[d])}return a=(new XMLSerializer).serializeToString(a)}if(c=b.getElementsByTagName(_.sb)[0]){a=c;this.g.debug("Detected Smooth, parsing");b=
|
|
95
|
+
fW();c=a.getElementsByTagName("StreamIndex");for(d=c.length-1;0<=d;--d)if(c[d].getAttribute("Type")===_.t){e=c[d].getElementsByTagName(_.lb);for(f=e.length-1;0<=f;--f)g=e[f].getAttribute(_.Qa)||void 0,h=e[f].getAttribute(_.Pa)||void 0,void 0!==g&&(g=+g),void 0!==h&&(h=+h),b.canDisplayType(_.zg,void 0,g,h)||c[d].removeChild(e[f]);c[d].getElementsByTagName(_.lb).length||a.removeChild(c[d])}a=(new XMLSerializer).serializeToString(a)}return a}H(a){const b=this;return _.w(function*(){let c=a;var d;c.media.customData&&
|
|
96
|
+
(d=bV(c.media.customData.playerConfiguration));if(b.m&&d){b.o&&(d=(yield Promise.resolve(b.o(d)))||d);d.ima&&(yield NV(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 _.io(b.m,d),yield _.jo(b.m),d=b.m.getLoadedSource(),c.media.contentId=d.url,c.media.contentType=d.type,d.ac&&(c.media.hlsVideoSegmentFormat=eV(d.ac,_.R)),d.ab&&(c.media.hlsSegmentFormat=eV(d.ab,
|
|
97
|
+
_.Q)));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.A&&(d=yield Promise.resolve(b.A(c)))&&(c=d);return c})}J(a){var b=a.media;b&&b.tracks&&b.tracks.length&&kW(b.tracks);if((b=a.items)&&b.length)for(const c of b)(b=c&&c.media)&&b.tracks&&b.tracks.length&&kW(b.tracks);return a}K(a){if(this.m&&(!a.media.customData||!a.media.customData.local)){var b=
|
|
98
|
+
fW().getPlayerManager(),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))}_.lo(this.m)}}F(a){this.w.forEach(b=>b(a.data))}};_.x(VU,dW);dW.prototype.getQueueManager=dW.prototype.getQueueManager;dW.prototype.setQueue=dW.prototype.Si;dW.prototype.updateContentMetadata=dW.prototype.gj;dW.prototype.setContentMetadata=dW.prototype.Zb;
|
|
99
|
+
dW.prototype.getContentMetadata=dW.prototype.Db;dW.prototype.isApiReady=dW.prototype.Bc;dW.prototype.sendMessage=dW.prototype.sendMessage;dW.prototype.removeMessageListener=dW.prototype.removeMessageListener;dW.prototype.addMessageListener=dW.prototype.addMessageListener;dW.prototype.off=dW.prototype.off;dW.prototype.on=dW.prototype.on;dW.prototype.setLoadRequestDataInterceptor=dW.prototype.Qi;dW.prototype.setPlayerConfigInterceptor=dW.prototype.Jd;dW.prototype.stop=dW.prototype.stop;
|
|
100
|
+
dW.prototype.start=dW.prototype.start;dW.prototype.init=dW.prototype.init;dW.getInstance=eW;var cW=null;var DW=class{constructor(a){this.h=a;this.a=null;this.w=new _.Kt;this.f=null;lW(this)}load(){return _.w(function*(){})}A(){return!0}o(){}resume(){this.a&&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.h.a;a&&this.h.sendMessage(YU,{type:"SKIP_AD",requestId:hV(),mediaSessionId:a.mediaSessionId})}getVolume(){return this.h.getVolume()||0}setVolume(a){this.h.setVolume(a)}getPosition(){let a=
|
|
101
|
+
-1;var b=this.h.a;b&&(b=b.getEstimatedBreakClipTime(),typeof b===_.r&&(a=b));return a}l(){return!0}j(){const a=this;return _.w(function*(){a.w.release()})}B(a){switch(a.field){case "mediaInfo":a.value&&(a=a.value,a.breaks&&this.h.trigger(new _.H(_.pc,{adsTimeline:new yW(a.breaks)})));break;case "isPlayingBreak":a.value?mW(this,_.Tb):(mW(this,_.Xb,this.f),mW(this,_.mc,this.f),this.f=null,mW(this,_.Ub));break;case "isPaused":this.f&&(a.value?mW(this,_.hc):mW(this,_.jc));break;case "breakClipId":this.f&&
|
|
102
|
+
(a=this.a.breakClipId,this.f.getId()!==a&&null!=a&&(mW(this,_.Xb,this.f),mW(this,_.mc,this.f),this.f=nW(this),mW(this,_.lc,this.f)));break;default:this.f||(this.f=nW(this))&&mW(this,_.lc,this.f)}}};DW.prototype.getPosition=DW.prototype.getPosition;DW.prototype.setVolume=DW.prototype.setVolume;DW.prototype.getVolume=DW.prototype.getVolume;DW.prototype.skip=DW.prototype.skip;DW.prototype.pause=DW.prototype.pause;DW.prototype.resume=DW.prototype.resume;var EW=class{name(){return"clpp.cast.ads.SenderAdsManagerFactory"}a(a,b){return a.namespace()!==_.hd?!1:!(!b||!b.ima)}create(a){return new DW(a.a)}};var FW=class{name(){return"clpp.cast.ads.AdsManagerFactory"}a(a,b){return eW().Bc()?!(!b||!b.ima):!1}create(a){return new zW(a)}};_.x("clpp.cast.createCastQueue",function(){pW=class extends cast.framework.QueueBase{initialize(a){let b=a.queueData;b||(b=new cast.framework.messages.QueueData,b.name="queue",b.description="queue",b.items=[{media:a.media}],b.startTime=a.currentTime);return b}};return new pW});_.Fh(new EW);_.Fh(new FW);};f.call(g, window);
|