@castlabs/prestoplay 6.28.0 → 6.29.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 +15 -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 +123 -113
- package/cjs/cl.conviva.js +28 -28
- package/cjs/cl.core.js +616 -609
- package/cjs/cl.crypto.js +7 -7
- package/cjs/cl.dash.js +89 -89
- package/cjs/cl.externs.js +127 -34
- package/cjs/cl.freewheel.js +25 -25
- package/cjs/cl.hls.js +79 -78
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +24 -24
- package/cjs/cl.ima.js +24 -23
- package/cjs/cl.mediatailor.js +3 -3
- package/cjs/cl.mse.js +350 -350
- package/cjs/cl.muxdata.js +14 -14
- package/cjs/cl.onboard.js +4 -4
- package/cjs/cl.persistent.js +14 -14
- package/cjs/cl.playlist.js +6 -6
- package/cjs/cl.simid.js +16 -16
- package/cjs/cl.smooth.js +71 -72
- package/cjs/cl.thumbnails.js +26 -26
- package/cjs/cl.tizen.js +70 -70
- 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 +37 -37
- package/cl.adobe.js +3 -3
- package/cl.airplay.js +3 -3
- package/cl.broadpeak.js +6 -6
- package/cl.cast.js +98 -91
- package/cl.conviva.js +27 -27
- package/cl.core.js +492 -488
- package/cl.crypto.js +8 -8
- package/cl.dash.js +82 -82
- package/cl.externs.js +123 -34
- 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 +16 -15
- package/cl.mediatailor.js +2 -2
- package/cl.mse.js +303 -304
- package/cl.muxdata.js +13 -13
- package/cl.onboard.js +4 -4
- package/cl.persistent.js +10 -10
- 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 +187 -87
package/cl.cast.js
CHANGED
|
@@ -1,93 +1,100 @@
|
|
|
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===_.O&&a.a.trigger(new _.G(_
|
|
8
|
-
b.addEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.
|
|
9
|
-
a.o=null);a.R=null;a.Y=null})},
|
|
10
|
-
chrome.cast.media.StreamType;yield
|
|
11
|
-
c.filter(k=>k),b.gb.remoteTextTracks=void 0),delete b.gb.autoplay,b.gb.startTime=null,e.customData={playerConfiguration:
|
|
12
|
-
yield d.loadMedia(e)}})},
|
|
13
|
-
a.P)},
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
a.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var VU="Cannot seek during ads playout.",WU="Cannot switch track",XU="Media session does not exist.",YU="No receivers available",ZU="QUEUE_ITEM_CHANGED",$U="Reset ABR functionality not available on cast.",aV="SDK not yet ready",bV="Sender is destroyed.",cV="clpp.cast.CastProxy",dV="clpp.cast.Player",eV="clpp.cast.Receiver",fV="urn:x-cast:castlabs",gV="urn:x-cast:com.google.cast.media",hV=function(a){return _.w(function*(){yield _.ao(a,_.Me);yield _.ao(a,_.Le)})},iV=function(a){return JSON.stringify(a,
|
|
2
|
+
(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}})},jV=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}},kV=function(a,b){const c=new Set(b);return Object.keys(a).reduce((d,e)=>{c.has(e)&&(d[e]=
|
|
3
|
+
a[e]);return d},{})},lV=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=_.Qr(d,a.mimeType,g);f&&g&&(h=_.yk(a.url),(h=yield c.fetch(h).U)&&h.data&&(e=f.a(_.F(h.data)),e={url:URL.createObjectURL(new Blob([e])),kind:a.kind,language:a.language,label:a.label,mimeType:g}));return e})},mV=function(a,b){let c,d;if(window.chrome&&chrome.cast&&chrome.cast.media)c=chrome.cast.media.HlsSegmentFormat,d=chrome.cast.media.HlsVideoSegmentFormat;
|
|
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 _.zg:return d.FMP4;case _.yg:return b===_.Q?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}},oV=function(a){a=void 0===a?nV:a;var b=cast.framework.messages||chrome.cast.media;if(!b)throw new _.H(1,8,8001);const c=b.MetadataType,
|
|
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}},pV=function(){return Math.round(1E3*Math.random())},qV=function(a,b){return a.h.filter(c=>c.type===b)},sV=function(a,b){const c=rV(a);return qV(a,b).find(d=>c.includes(d.id))||
|
|
6
|
+
null},uV=function(a,b,c){const d=a.a.a;if(d)if(c){a.f[b]=c.renditions[0];c=[+c.id];if(b!==_.O){const e=a.ua();e&&c.push(+e.id)}c=new chrome.cast.media.EditTracksInfoRequest(c);d.editTracksInfo(c,()=>{a.f[b]=null;tV(a,b)},e=>{a.f[b]=null;a.g.debug(WU,e)})}else b===_.O&&(c=new chrome.cast.media.EditTracksInfoRequest([]),d.editTracksInfo(c,()=>{tV(a,b)},e=>{a.g.debug(WU,e)}))},rV=function(a){a=a.a?a.a.a:null;return(a?a.activeTrackIds||[]:[]).map(b=>b.toString())},tV=function(a,b){b===_.P?a.a.trigger(new _.G(_.Jc)):
|
|
7
|
+
b===_.O&&a.a.trigger(new _.G(_.ag))},xV=function(a){if(a)for(const b of vV)wV(b)},wV=function(a){if(!a.w&&window.chrome&&chrome.cast&&chrome.cast.isAvailable&&window.cast&&cast.framework&&cast.framework.CastContext&&a.T.length){a.w=!0;a.o.pf();var b=cast.framework.CastContext.getInstance(),c=new cast.framework.CastOptions;c.receiverApplicationId=a.T;c.autoJoinPolicy=chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED;b.setOptions(c);b.addEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.M);
|
|
8
|
+
b.addEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.ca);yV&&a.o.la(.02)}},zV=function(a){return _.w(function*(){vV.delete(a);if(a.w){a.w=!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.ca)}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(),
|
|
9
|
+
a.o=null);a.R=null;a.Y=null})},AV=function(a){return _.w(function*(){a.xa()||(yield cast.framework.CastContext.getInstance().requestSession())})},CV=function(a,b,c){c=void 0===c?0:c;return _.w(function*(){var d=a.f.ua();d&&d.language&&(a.h.preferredTextLanguage=d.language);(d=a.f.pa())&&d.language&&(a.h.preferredAudioLanguage=d.language);yield BV(a,{source:a.getLoadedSource(),currentTime:c,isLive:a.isLive(),Ye:a.getPresentationStartTime(),autoplay:b,gb:a.h})})},BV=function(a,b){return _.w(function*(){var c=
|
|
10
|
+
chrome.cast.media.StreamType;yield AV(a);if(b){var d=cast.framework.CastContext.getInstance().getCurrentSession(),e=new chrome.cast.media.MediaInfo(b.source.url,b.source.type);e.streamType=b.isLive?c.LIVE:c.BUFFERED;c=b.$a;e.hlsVideoSegmentFormat=mV(b.Yb,_.Q);e.hlsSegmentFormat=mV(c,_.P);b.gb&&(a.L&&(c=yield Promise.resolve(a.L(b.gb)))&&(b.gb=c),a.h=b.gb,a.C=_.mn(a.h),a.B=a.C.findIndex(k=>k.url===b.source.url),b.gb.remoteTextTracks&&(c=yield Promise.all(b.gb.remoteTextTracks.map(a.za.bind(a))),e.tracks=
|
|
11
|
+
c.filter(k=>k),b.gb.remoteTextTracks=void 0),delete b.gb.autoplay,b.gb.startTime=null,e.customData={playerConfiguration:iV(b.gb)});c=a.Cb()||{};var f=DV(c.metadataType),g;typeof b.Ye===_.r&&(g={metadataType:f,sectionStartAbsoluteTime:b.Ye});var h;b.source.name&&(h={metadataType:f,title:b.source.name});c=EV(c);if(g=FV(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=
|
|
12
|
+
g.startIndex,e.queueData=h);typeof b.autoplay===_.Mc&&(e.autoplay=b.autoplay);typeof b.currentTime===_.r&&(e.currentTime=b.currentTime);yield d.loadMedia(e)}})},FV=function(a){if(!a)return null;a:{var b=a.metadataType;const c=Object.entries(GV);for(const d of c){const [e,f]=d;if(f===b){b=e;break a}}b=null}if(!b)return null;b=oV(GV[b]);return Object.assign(b,a)},DV=function(a){var b=void 0===b?nV:b;return Object.values(GV).includes(a)?a:b},EV=function(a){const b={};for(const c in a)void 0!==a[c]&&
|
|
13
|
+
(b[c]=a[c]);return b},IV=function(a,b){HV(a,b.getMediaSession());b.addEventListener(cast.framework.SessionEventType.MEDIA_SESSION,a.V);b.addMessageListener(fV,a.P)},JV=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},HV=function(a,b){a.a=b;a.a&&(a.G.release(),a.F=null,a.l=null,a.l=new cast.framework.RemotePlayer,a.F=new cast.framework.RemotePlayerController(a.l),a.G.on(a.F,cast.framework.RemotePlayerEventType.CURRENT_TIME_CHANGED,
|
|
14
|
+
a.ia.bind(a)),a.G.on(a.F,cast.framework.RemotePlayerEventType.MEDIA_INFO_CHANGED,a.Za.bind(a)),a.j&&a.j.init(),a.trigger(new _.G(_.ue)))},MV=function(a){return new KV(a.h,()=>{a.trigger(new _.G(_.Sc))},(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.Hf&&(d.preferredAudioLanguage=c.Hf);c.Rg&&(d.preferredTextLanguage=c.Rg);_.co(a.f,null);a.trigger(new _.G("castingended"));
|
|
15
|
+
a.j(b,d)}},()=>LV(a))},LV=function(a){return _.w(function*(){a.trigger(new _.G(_.Rc));a.f.a!==a.a&&a.f&&a.a&&(yield a.f.release(),_.co(a.f,a.a))})},NV=function(a,b){0>b||b>=a.a.length||(a.f=b,a.trigger(new _.G(_.hf,{item:a.Db()})))},OV=function(a){a.trigger(new _.G(_.jf))},QV=function(a){PV(a);const b=Math.min(a.a.kd().length-1,a.a.getPosition()+1);NV(a.a,b)},PV=function(a){a.j||(a.a.on(_.hf,a.o),a.j=!0)},RV=function(a){return a.map(b=>{const c={};c.media={contentId:b.configuration.source};c.customData=
|
|
16
|
+
{skippable:!1!==b.skippable};return c})},UV=function(a,b,c){return _.w(function*(){var d=b.adTagUrl;if(d)try{SV=!1;const e=_.yk(d),f=yield c.fetch(e).U;if(f&&f.data){const g=_.pi(f.data),h=(new DOMParser).parseFromString(g,_.$f);if(h.getElementsByTagName("vmap:VMAP").length)_.B("VMAP detected."),a.vmapAdsRequest=TV(g);else if(h.getElementsByTagName("VAST").length){_.B("VAST detected.");{d=g;const k=new cast.framework.messages.BreakClip("bc1");k.vastAdsRequest=TV(d);const l=new cast.framework.messages.Break("b1",
|
|
17
|
+
[k.id],0);a.breakClips=[k];a.breaks=[l]}}else _.B("Unsupported schema."),SV=!0}}catch(e){_.B("Failed to fetch an ad",e),SV=!0}})},TV=function(a){const b=new cast.framework.messages.VastAdsRequest;b.adsResponse=a;return b},VV=function(a,b){b=new _.H(1,10,10003,{errorType:b});a.m.onError(b)},WV=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},YV=function(a,b,c){if(c instanceof cast.framework.events.BreaksEvent||-1!==a.getPosition()){var d=null;(c=XV(a,c))&&(d={ad:c});
|
|
18
|
+
a.m.trigger(new _.G(b,d))}},XV=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=>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},ZV=function(){return[cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,
|
|
19
|
+
cast.framework.events.EventType.TIMED_METADATA_CHANGED,cast.framework.events.EventType.TIMED_METADATA_ENTER,cast.framework.events.EventType.TIMED_METADATA_EXIT]},$V=function(a){const b=a.dashTimedMetadata;let c=_.rg;b&&(c=b.schemeIdUri);return{type:c.startsWith(_.qg)?_.Gf:_.og,schemeIdUri:c,id:a.id||"",startTime:a.startTime,endTime:a.endTime,value:b&&b.value||"",eventElement:b?b.eventElement:null}},aW=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},cW=function(a){a.a=
|
|
20
|
+
aW().getTextTracksManager();const b=a.a.getTracks();a.j=bW(_.O,b)},bW=function(a,b){const c=[];for(const d of b)b=new _.zr(d.trackId.toString(),a),b.roles=d.roles||[],b.kind=d.subtype||null,b.language=d.language||null,b.originalLanguage=d.language||null,b.label=d.name||null,b.src=d.trackContentId||null,b.mimeType=d.trackContentType||null,d.customData&&(b.mimeType=d.customData.mimeType||b.mimeType,b.src=d.customData.url||b.src),b.renditions.push(new _.Dr(b.id,b)),c.push(b);return c},dW=function(a,
|
|
21
|
+
b,c,d){c=_.Zh(c).filter(g=>g);var e=!1;let f=[];b===_.P?f=a.getAudioTracks():b===_.O&&(f=a.qa());if(c=c.find(g=>{const h=_.Nn(g);return f.some(k=>{k=_.Nn(k.language||"");return _.On(h,k)})})){const g=_.Nn(c);c=f.filter(h=>{h=_.Nn(h.language||"");return _.On(g,h)});f=c.length?c:f;e=e||!!c.length}_.yi(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===_.P?a.ya(e):b===_.O&&a.Sa(e))},eW=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},
|
|
22
|
+
hW=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=_.sn(d);if(e){var f=[_.td];_.mn(a)[0].type!==_.Bc&&f.unshift(_.vd);d.preferredDrmSystem===_.td&&f.reverse();for(var g,h;f.length&&!h;)g=f.shift(),h=e.Ia[g];h?(c=g===_.vd?cast.framework.ContentProtection.WIDEVINE:g===_.td?cast.framework.ContentProtection.PLAYREADY:void 0,b.protectionSystem=c,b.licenseUrl=h.licenseUrl,
|
|
23
|
+
c={ldlDelay:0,customData:{}},fW(b,h,a,c),gW(b,h,a,c)):c()}else c()}else c()},iW=function(a,b){b=Object.assign({},a.shakaConfig,b);return Object.assign({},a,{shakaConfig:b})},fW=function(a,b,c,d){b.modifiers.licenseRequest?a.licenseRequestHandler=e=>{const f=_.yk({method:_.cb,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}:
|
|
24
|
+
a.licenseRequestHandler=void 0},gW=function(a,b,c,d){b.modifiers.licenseResponse?a.licenseHandler=(e,f)=>_.w(function*(){const g=_.Ck(Object.assign({},f.headers),e.buffer,200,"");yield b.modifiers.licenseResponse(c,g,d);return _.F(g.data)}):a.licenseHandler=void 0},lW=function(){return jW||(jW=new kW)},mW=function(){return cast.framework.CastReceiverContext.getInstance()},nW=function(){const a=mW().getPlayerManager().getMediaInformation();return a&&a.metadata?a.metadata:null},oW=function(a,b){const c=
|
|
25
|
+
mW().getPlayerManager().getMediaInformation();c?(b?c.metadata=b:delete c.metadata,a=!0,a=void 0===a?!1:a,mW().getPlayerManager().setMediaInformation(c,a)):a.g.warn("No mediaInformation is present. Skipping metadata update.")},qW=function(a,b){a.g.debug("Detected HLS, parsing");var c=cast.framework.messages.HlsVideoSegmentFormat;a=mW();var {hlsVideoSegmentFormat:d}=mW().getPlayerManager().getMediaInformation()||{};c=d===c.FMP4?_.zg:_.yg;b=b.replace(/\r\n|\r(?=[^\n]|$)/gm,"\n");b=b.split(/\n+/m);d=
|
|
26
|
+
[];let e=0;for(;e<b.length;){const f=b[e].trim();if(b[e].startsWith("#EXT-X-STREAM-INF")){const g=pW(f,_.pa),h=pW(f,_.kb);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")},pW=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},rW=function(a){for(const b of a)a={},b.customData&&
|
|
27
|
+
_.fh(b.customData)&&(a=b.customData),b.roles&&(a.roles=b.roles),b.audioTrackInfo&&(a.audioTrackInfo=b.audioTrackInfo),_.fh(a)&&(b.customData=a)},tW=function(a,b){let c=null;const d=sW(a);d&&(c={ad:d});a.f.trigger(new _.G(b,c))},sW=function(a){var b=null;if(a.a&&a.a.mediaInfo){b=a.a.mediaInfo;let c=null,d=null,e,f;const g=a.a.currentBreakClipNumber;b.breaks&&(c=b.breaks.find(h=>h.id===a.a.breakId)||null)&&(e=c.breakClipIds.length,f=0>=c.position?c.position:b.breaks.filter(h=>0<=h.position).sort((h,
|
|
28
|
+
k)=>h.position-k.position).findIndex(h=>h===c));b.breakClips&&(d=b.breakClips.find(h=>h.id===a.a.breakClipId)||null);b=new Y(d,c,g,e,f)}return b},uW=class{constructor(a,b){this.log=new _.S(b);this.player=a;this.l=null;this.h=_.Fs;this.o=7;this.j=2;this.C=Date.now();this.B=-1}release(){this.a(_.Fs)}destroy(){this.l=this.player=null;return Promise.resolve()}getState(){return this.h}onError(a){a.severity===_.C&&this.a(_.ys)}a(a){if(a!==this.h)if(this.h===_.ys&&a!==_.Fs)this.log.debug("Player is in ERROR state and can not switch to",
|
|
29
|
+
a);else{var b=Date.now();this.o=this.h;this.h=a;2===this.h?(this.B=b,this.player.trigger(new _.G(_.Oc,{detail:{bufferedTimeMS:-1,reason:this.j}}))):2===this.o&&this.player.trigger(new _.G(_.Nc,{detail:{bufferedTimeMS:b-this.B,reason:this.j}}));a={currentState:this.h,previousState:this.o,timeSinceLastStateChangeMS:b-this.C};this.C=b;this.l&&_.os(this.l,this.h);this.player.trigger(new _.G(_.Qf,{detail:a}))}}},vW;_.x("clpp.cast.CastUtils",class{});
|
|
30
|
+
var nV=0,GV={GENERIC:nV,MOVIE:1,TV_SHOW:2,MUSIC_TRACK:3,PHOTO:4,AUDIOBOOK_CHAPTER:5},wW="addMissingTimelineCues alwaysStreamText bufferBehind bufferingGoal durationBackoff gapDetectionThreshold ignoreTextStreamFailures lowLatencyMode rebufferingGoal retryParameters safeSeekOffset stallEnabled stallSkip stallThreshold startAtSegmentBoundary".split(" "),xW="bandwidthDowngradeTarget bandwidthUpgradeTarget defaultBandwidthEstimate enabled initialRestrictions restrictions switchInterval".split(" ");var yW=class extends uW{constructor(a){super(a,"clpp.cast.SenderStateManager");this.w=this.f=null;this.A=this.Tb.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 _.w(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)}Tb(){if(this.f&&
|
|
31
|
+
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(_.ys);break;default:this.a(_.Fs)}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 zW=class extends _.U{constructor(){super();this.g=new _.S("clpp.cast.SenderTrackManager");this.a=null;this.h=[];this.f={}}initialize(a){this.a=a}release(){this.h=[];this.f={}}load(){this.release();var a=this.a.a;a&&(a=a.media)&&(this.h=(a=a.tracks)?a.map(b=>{switch(b.type){case chrome.cast.media.TrackType.VIDEO:var c=_.Q;break;case chrome.cast.media.TrackType.AUDIO:c=_.P;break;case chrome.cast.media.TrackType.TEXT:c=_.O}c=new _.zr(b.trackId.toString(),c);c.kind=b.subtype;c.language=b.language;
|
|
32
|
+
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 _.Dr(c.id,c));return c}):[],this.a.trigger(new _.G(_.gg)))}destroy(){this.a=null}getVideoTracks(){return qV(this,_.Q)}getAudioTracks(){return qV(this,
|
|
33
|
+
_.P)}qa(){return qV(this,_.O)}ra(){const a=this.Fa();return a?a.renditions[0]:null}Ma(){const a=this.pa();return a?a.renditions[0]:null}Qa(){const a=this.ua();return a?a.renditions[0]:null}pb(){return this.f[_.Q]||null}Eb(){return this.f[_.P]||null}Fb(){return this.f[_.O]||null}Fa(){return sV(this,_.Q)}pa(){return sV(this,_.P)}ua(){return sV(this,_.O)}yb(a){uV(this,_.Q,a)}ya(a){uV(this,_.P,a)}Sa(a){uV(this,_.O,a)}hb(a){this.yb(a&&a.track)}wb(a){this.ya(a&&a.track)}xb(a){this.Sa(a&&a.track)}addTextTrack(){return _.w(function*(){})}va(){return!0}};
|
|
34
|
+
zW.prototype.isAbrEnabled=zW.prototype.va;zW.prototype.addTextTrack=zW.prototype.addTextTrack;zW.prototype.setTextRendition=zW.prototype.xb;zW.prototype.setAudioRendition=zW.prototype.wb;zW.prototype.setVideoRendition=zW.prototype.hb;zW.prototype.setTextTrack=zW.prototype.Sa;zW.prototype.setAudioTrack=zW.prototype.ya;zW.prototype.setVideoTrack=zW.prototype.yb;zW.prototype.getTextTrack=zW.prototype.ua;zW.prototype.getAudioTrack=zW.prototype.pa;zW.prototype.getVideoTrack=zW.prototype.Fa;
|
|
35
|
+
zW.prototype.getLoadingTextRendition=zW.prototype.Fb;zW.prototype.getLoadingAudioRendition=zW.prototype.Eb;zW.prototype.getLoadingVideoRendition=zW.prototype.pb;zW.prototype.getTextRendition=zW.prototype.Qa;zW.prototype.getAudioRendition=zW.prototype.Ma;zW.prototype.getVideoRendition=zW.prototype.ra;zW.prototype.getTextTracks=zW.prototype.qa;zW.prototype.getAudioTracks=zW.prototype.getAudioTracks;zW.prototype.getVideoTracks=zW.prototype.getVideoTracks;var KV=class extends _.Tt{constructor(a,b,c,d){super();this.g=new _.S(_.gd);this.T=a;this.o=new _.Ni(b);this.R=c;this.Y=d;this.h=this.I=_.fn();this.C=[];this.B=0;this.K=new _.Kn;this.F=this.l=this.a=null;this.A=this.w=!1;this.ba="";this.ha=1E6;this.f=new zW;this.f.initialize(this);this.j=new yW(this);this.G=new _.Qt;this.J=null;this.H=new Set;this.M=this.Ta.bind(this);this.ca=this.Bb.bind(this);this.V=this.Ab.bind(this);this.P=this.Ua.bind(this);this.L=null;window.cast||Object.defineProperty(window,
|
|
36
|
+
"cast",{get:()=>window.cast_,set:e=>{window.cast_=e;window.setTimeout(()=>{xV(!0)},0)}});wV(this);vV.add(this)}init(a,b){this.h=this.I=b}unload(){return new Promise((a,b)=>{this.f&&this.f.release();this.a&&!this.a.idleReason||a();this.a.stop(null,a,b)})}release(){return this.unload().then(()=>{this.j&&this.j.release()})}getTimeline(){return null}setupPlaylist(){return Promise.reject(_.Za)}appendLoad(){return Promise.reject(_.Za)}seekWith(){return Promise.reject(_.Za)}setSeekInterceptor(){}setPlaybackSessionId(){}getBandwidthEstimate(){return null}destroy(){return _.w(function*(){})}Gd(a){this.L=
|
|
37
|
+
a}xc(){return this.w}xa(){return this.A}Je(){return this.ba}sendMessage(a,b){const c=this;return _.w(function*(){let d;const e=cast.framework.CastContext.getInstance().getCurrentSession();if(e)try{yield e.sendMessage(a,iV(b))}catch(f){d=new _.H(1,8,8E3,{detailedErrorCode:f})}else d=new _.H(1,8,8004,void 0);if(d)c.onError(d)})}cast(){const a=this;return _.w(function*(){if(!a.xc())throw a.g.warn(aV),new _.H(1,8,8001,void 0);if(!yV)throw a.g.warn(YU),new _.H(1,8,8002,void 0);if(a.xa())throw a.g.warn("Already casting"),
|
|
38
|
+
new _.H(1,8,8003,void 0);try{yield AV(a)}catch(b){const c={};b instanceof chrome.cast.Error?(c.detailedErrorCode=b.code,c.details=b.details,c.reason=b.description):c.detailedErrorCode=b;throw new _.H(1,8,8E3,c);}})}Xd(){this.xa()&&cast.framework.CastContext.getInstance().endCurrentSession(!0)}addMessageListener(a){typeof a===_.ae&&this.H.add(a)}removeMessageListener(a){typeof a===_.ae&&this.H.delete(a)}play(){return this.isEnded()?CV(this,!0):new Promise((a,b)=>{if(!this.a)return b(XU);this.a.play(null,
|
|
39
|
+
a,b)})}pause(){return new Promise((a,b)=>{this.isEnded()&&a();if(!this.a)return b(XU);this.a.pause(null,a,b)})}isPaused(){return!!this.a&&this.a.playerState===chrome.cast.media.PlayerState.PAUSED}isEnded(){return 5===this.getState()}seek(a){return this.isEnded()?CV(this,!1,a):new Promise((b,c)=>{this.a||c(XU);this.l.isPlayingBreak&&c(VU);const d=new chrome.cast.media.SeekRequest;d.currentTime=a;this.trigger(new _.G(_.tg));this.a.seek(d,()=>{this.trigger(new _.G(_.sg));b()},c)})}getPosition(){return this.getMediaPosition()}getMediaPosition(){return this.a&&
|
|
40
|
+
this.a.getEstimatedTime()||0}getDuration(){return this.getMediaDuration()}getMediaDuration(){if(!this.a||!this.a.media)return-1;const a=this.a.media.duration;return typeof a!==_.r?-1:-1===a?Infinity:a}setDrmCustomDataModifier(){}setCdnErrorCallback(){}detach(){}getPlaybackRate(){return this.a&&this.a.playbackRate||0}setPlaybackRate(a){this.a&&0<a&&this.sendMessage(gV,{type:"SET_PLAYBACK_RATE",requestId:pV(),mediaSessionId:this.a.mediaSessionId,playbackRate:a})}getVolume(){return this.a&&this.a.volume.level}setVolume(a){this.a&&
|
|
40
41
|
0<=a&&1>=a&&(a=new chrome.cast.media.VolumeRequest(new chrome.cast.Volume(a)),this.a.setVolume(a))}isMuted(){return this.a&&this.a.volume.muted}setMuted(a){this.a&&(a=new chrome.cast.media.VolumeRequest(new chrome.cast.Volume(void 0,a)),this.a.setVolume(a))}getPresentationStartTime(){if(!this.a||!this.a.media||!this.a.media.metadata)return null;const a=this.a.media.metadata.sectionStartAbsoluteTime;return typeof a!==_.r?null:1E-8===a?0:a}getSeekRange(){let a={start:0,end:this.getDuration()};if(this.isLive()){const b=
|
|
41
|
-
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():7}getStats(){return this.a&&this.a.customData&&this.a.customData.stats?
|
|
42
|
-
else b.g.warn(
|
|
43
|
-
this.j))this.j.onError(a)}namespace(){return _.
|
|
44
|
-
releaseDate:a};this.
|
|
45
|
-
(this.A=!0,
|
|
46
|
-
this.l=this.F=null}}Ab(a){this.g.debug("New media session",a.mediaSession);
|
|
47
|
-
d.mimeType,c.customData={mimeType:a.mimeType,url:a.url});return c})}getTextDisplayer(){return null}},
|
|
48
|
-
return _.w(function*(){if(
|
|
49
|
-
|
|
50
|
-
this;return _.w(function*(){b.a?yield b.a.sendMessage(
|
|
51
|
-
this.a.addMessageListener(a):this.g.warn(
|
|
52
|
-
Z.prototype.
|
|
53
|
-
Z.prototype.forceDisconnect=Z.prototype.
|
|
42
|
+
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():7}getStats(){return this.a&&this.a.customData&&this.a.customData.stats?jV(this.a.customData.stats):_.ss()}isLive(){return Infinity===this.getDuration()}load(a){const b=this;return _.w(function*(){if(b.xc())if(yV){b.C=_.mn(a);b.h=_.hn([b.I,a]);var c=b.C[b.B];yield BV(b,{source:c,isLive:c.isLive,autoplay:b.h.autoplay,gb:b.h,Yb:c.Yb,$a:c.$a})}else b.g.warn(YU);
|
|
43
|
+
else b.g.warn(aV)})}getBufferInfo(){return new _.Nt}getTrackManager(){return this.f}getConfiguration(){return this.h}getSurface(){return null}setNetworkEngine(a){this.K=a}getNetworkEngine(){return this.K}getSourceIndex(){return this.B}setSourceIndex(a){this.B=a}setCmsdManager(){}getLoadedSource(){return this.C[this.B]}getPeriods(){return[]}getDrmInfo(){return null}getTimelineCues(){return[]}getCueTimeline(){return null}resetAbr(){this.g.warn($U)}onError(a){if(a&&(this.trigger(new _.G(_.Xd,{detail:a})),
|
|
44
|
+
this.j))this.j.onError(a)}namespace(){return _.gd}canPlay(){return this.xc()?2:0}Cb(){return this.J}Wb(a){this.J=FV(a)}Fe(){this.J=null}jf(a){const b=this.Cb()||{};a={metadataType:DV(b.metadataType),title:a};this.Wb(Object.assign({},b,a))}gf(a){const b=this.Cb()||{},c=DV(b.metadataType);a=new chrome.cast.Image(a);this.Wb(Object.assign({},b,{metadataType:c,images:[a]}))}ff(a){const b=this.Cb()||{};this.Wb(Object.assign({},b,{metadataType:3,artist:a}))}hf(a){const b=this.Cb()||{};a={metadataType:DV(b.metadataType),
|
|
45
|
+
releaseDate:a};this.Wb(Object.assign({},b,a))}Ta(a){const b=cast.framework.CastContext.getInstance(),c=a.castState===cast.framework.CastState.CONNECTED;yV=a.castState!==cast.framework.CastState.NO_DEVICES_AVAILABLE;this.ba=c?b.getCurrentSession().getCastDevice().friendlyName:"";this.o.pf()}Bb(a){this.g.debug(`state: ${a.sessionState}, details:`,a);switch(a.sessionState){case cast.framework.SessionState.SESSION_STARTED:this.A=!0;IV(this,a.session);break;case cast.framework.SessionState.SESSION_RESUMED:this.xa()||
|
|
46
|
+
(this.A=!0,IV(this,a.session),this.Y());break;case cast.framework.SessionState.SESSION_ENDED:if(this.xa()&&this.a){const d=this.a.media;var b=this.f.pa(),c=this.f.ua();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:JV(this),Rg:c,Hf:b})}a.session.removeEventListener(cast.framework.SessionEventType.MEDIA_SESSION,this.V);a.session.removeMessageListener(fV,this.P);this.A=!1;this.a=null;this.G.release();
|
|
47
|
+
this.l=this.F=null}}Ab(a){this.g.debug("New media session",a.mediaSession);HV(this,a.mediaSession)}Za(a){a.value&&a.value.tracks&&this.f&&this.f.load()}Ua(a,b){if(a===fV&&0<this.H.size){const c=jV(b);this.H.forEach(d=>d(c))}}ia(){this.trigger(new _.G(_.fg))}za(a){const b=this;return _.w(function*(){let c=null;const d=yield lV(a,[_.Zf,_.Ac],b.K,b.h);d&&(c=new chrome.cast.media.Track(b.ha++,chrome.cast.media.TrackType.TEXT),c.language=d.language,c.name=d.label||null,c.trackContentId=d.url,c.trackContentType=
|
|
48
|
+
d.mimeType,c.customData={mimeType:a.mimeType,url:a.url});return c})}getTextDisplayer(){return null}},yV=!1,vV=new Set;window.__onGCastApiAvailable=xV;var Z=class extends _.Tt{constructor(a,b,c){super();this.f=a;this.h=b;this.j=typeof c===_.ae?c:this.l;this.a=MV(this);this.g=new _.S(cV);this.f&&this.forwardEventsTo(this.f)}destroy(){const a=this;return _.w(function*(){a.a&&(yield zV(a.a),a.a=null);a.f&&a.stopForwardingEventsTo(a.f)})}l(a,b){this.f&&5!==a&&a!==_.Fs&&(delete b.license,this.f.load(b))}Fc(){return!!this.a&&this.a.xc()&&yV}xa(){return!!this.a&&this.a.xa()}Je(){return this.a?this.a.Je():""}Gd(a){this.a&&this.a.Gd(a)}cast(a,b){const c=
|
|
49
|
+
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.ua();p&&(p.language&&(m.preferredTextLanguage=p.language),p.roles.length&&(m.preferredTextRole=p.roles[0]));const u=
|
|
50
|
+
f&&typeof f.isLive===_.Mc?f.isLive:c.f.isLive();e={source:f,isLive:u,autoplay:!c.f.isPaused(),currentTime:Math.max(c.f.getPosition()-1,0),Ye:c.f.getPresentationStartTime(),Yb:k,$a:l,gb:m}}var d=e}b&&d&&(d.queueData={items:b.items,startIndex:b.startIndex});yield LV(c);c.a&&(d&&(d.autoplay=!c.f.isPaused()),a?yield c.f.load(a):c.a.a||(yield BV(c.a,d)))}}catch(e){c.g.error("Error while trying to cast",e),d=new _.G(_.Xd,{detail:e}),c.trigger(d)}})}Xd(){this.a&&this.a.Xd()}vh(a){const b=this;return _.w(function*(){a!==
|
|
51
|
+
b.h&&(b.h=a,b.a&&(yield zV(b.a)),b.a=MV(b))})}sendMessage(a){const b=this;return _.w(function*(){b.a?yield b.a.sendMessage(fV,a):b.g.warn(bV)})}Ig(){const a=this;return _.w(function*(){yield a.a.sendMessage(gV,{type:"QUEUE_NEXT",requestId:pV(),mediaSessionId:a.a.a.mediaSessionId})})}Jg(){const a=this;return _.w(function*(){yield a.a.sendMessage(gV,{type:"QUEUE_PREV",requestId:pV(),mediaSessionId:a.a.a.mediaSessionId})})}Hg(a){const b=this;return _.w(function*(){yield b.a.sendMessage(gV,{type:"QUEUE_INSERT",
|
|
52
|
+
requestId:pV(),mediaSessionId:b.a.a.mediaSessionId,items:a})})}addMessageListener(a){this.a?this.a.addMessageListener(a):this.g.warn(bV)}removeMessageListener(a){this.a?this.a.removeMessageListener(a):this.g.warn(bV)}Cb(){return this.a&&this.a.Cb()}Wb(a){this.a&&this.a.Wb(a)}Fe(){this.a&&this.a.Fe()}jf(a){this.a&&this.a.jf(a)}gf(a){this.a&&this.a.gf(a)}ff(a){this.a&&this.a.ff(a)}hf(a){this.a&&this.a.hf(a)}};_.x(cV,Z);Z.prototype.setContentReleaseDate=Z.prototype.hf;Z.prototype.setContentArtist=Z.prototype.ff;
|
|
53
|
+
Z.prototype.setContentImage=Z.prototype.gf;Z.prototype.setContentTitle=Z.prototype.jf;Z.prototype.clearContentMetadata=Z.prototype.Fe;Z.prototype.setContentMetadata=Z.prototype.Wb;Z.prototype.getContentMetadata=Z.prototype.Cb;Z.prototype.removeMessageListener=Z.prototype.removeMessageListener;Z.prototype.addMessageListener=Z.prototype.addMessageListener;Z.prototype.queueAddItems=Z.prototype.Hg;Z.prototype.queuePreviousItem=Z.prototype.Jg;Z.prototype.queueNextItem=Z.prototype.Ig;
|
|
54
|
+
Z.prototype.sendMessage=Z.prototype.sendMessage;Z.prototype.changeReceiverId=Z.prototype.vh;Z.prototype.forceDisconnect=Z.prototype.Xd;Z.prototype.cast=Z.prototype.cast;Z.prototype.setPlayerConfigInterceptor=Z.prototype.Gd;Z.prototype.getReceiverName=Z.prototype.Je;Z.prototype.isCasting=Z.prototype.xa;Z.prototype.canCast=Z.prototype.Fc;Z.prototype.destroy=Z.prototype.destroy;var AW=class extends uW{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.ha.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
55
|
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 _.G(_.
|
|
56
|
-
this.a(2):(a=this.player.isPaused()?4:3,this.a(a))}Y(){this.j=1;this.player.trigger(new _.G(_.
|
|
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
|
-
b
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
b
|
|
84
|
-
|
|
85
|
-
c
|
|
86
|
-
|
|
87
|
-
(
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
56
|
+
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 _.G(_.We));this.a(3)}R(){this.a(4)}ca(){this.a(5)}ba(a){a.isBuffering?
|
|
57
|
+
this.a(2):(a=this.player.isPaused()?4:3,this.a(a))}Y(){this.j=1;this.player.trigger(new _.G(_.tg))}V(){this.player.trigger(new _.G(_.sg))}ia(){this.j=2}ha(){this.a(1)}M(a){const b=this.player.getStats();this.player.trigger(new _.G(_.Lc,{detail:{bandwidth:a.totalBitrate,width:b.width,height:b.height}}))}P(a){a=new _.H(_.C,7,7300,{detailedErrorCode:a.detailedErrorCode,error:a.error,reason:a.reason});this.player.trigger(new _.G(_.Xd,{detail:a}));this.a(_.ys)}};var BW=class extends _.Tt{constructor(a=[],b=0){super();this.a=a.slice();this.f=b}kd(){return this.a}getPosition(){return this.f}Db(){return this.a[this.f]||null}ig(){return this.a[this.f+1]||null}append(a){this.a.push(a);OV(this)}ng(a,b){0>b||b>this.a.length||(this.a.splice(b,0,a),OV(this))}remove(a){0>a||a>=this.a.length||a===this.f||(this.a.splice(a,1),this.f>a&&this.f--,OV(this))}clear(){this.a=[];this.f=0;OV(this)}};var CW=class extends _.Tt{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.Db();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=()=>{QV(this)}}start(){this.h||this.f||(this.h=!0,this.m.on(_.Wd,this.l),PV(this),NV(this.a,this.a.getPosition()))}next(){const a=this.a.Db();a&&!1===
|
|
58
|
+
a.skippable||QV(this)}Dd(){var a=this.a.Db();a&&!1===a.skippable||(PV(this),a=Math.max(0,this.a.getPosition()-1),NV(this.a,a))}Pc(a){const b=this;return _.w(function*(){NV(b.a,a)})}stop(){this.h=!1;this.m.off(_.Wd,this.l);this.a.off(_.hf,this.o);this.j=!1}};var DW=class{constructor(a,b,c){this.player=a;this.Jb=new BW(c);this.Wc=new CW({load:this.player.load.bind(this.player),off:this.player.off.bind(this.player),on:this.player.on.bind(this.player)},this.Jb,()=>_.w(function*(){}));this.a=new Z(this.player,b,(d,e)=>{const f=this;return _.w(function*(){const g=f.Jb.getPosition();f.Wc.Pc(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&&
|
|
59
|
+
d.type===ZU&&typeof d.index===_.r&&NV(this.Jb,d.index)};this.a.addMessageListener(this.f)}mi(a){return this.Jb.on(_.hf,a)}ni(a){return this.Jb.on(_.jf,a)}ki(a){return this.player.on(_.Sc,a)}Fc(){return this.a.Fc()}Sh(){return this.Jb.kd()}xa(){return this.a.xa()}append(a){const b=this;return _.w(function*(){b.Jb.append(a);b.a.xa()&&(yield b.a.Hg(RV([a])))})}Mh(){return this.Jb.getPosition()}start(){this.Wc.start()}play(){this.player.play()}pause(){this.player.pause()}destroy(){this.Wc.stop();this.a.removeMessageListener(this.f);
|
|
60
|
+
this.a.destroy();this.player.release()}Vi(){const a=this;return _.w(function*(){if(a.a.xa())a.a.Xd();else{a.Wc.stop();var b=RV(a.Jb.kd()),c=a.Jb.getPosition();yield a.a.cast(void 0,{items:b,startIndex:c})}})}next(){const a=this;return _.w(function*(){a.a.xa()?yield a.a.Ig():yield a.Wc.next()})}Dd(){const a=this;return _.w(function*(){a.a.xa()?yield a.a.Jg():yield a.Wc.Dd()})}};_.x("clpp.cast.playlist.CastPlaylist",DW);DW.prototype.previous=DW.prototype.Dd;DW.prototype.next=DW.prototype.next;
|
|
61
|
+
DW.prototype.toggleCast=DW.prototype.Vi;DW.prototype.destroy=DW.prototype.destroy;DW.prototype.pause=DW.prototype.pause;DW.prototype.play=DW.prototype.play;DW.prototype.start=DW.prototype.start;DW.prototype.getCurrentIndex=DW.prototype.Mh;DW.prototype.append=DW.prototype.append;DW.prototype.isCasting=DW.prototype.xa;DW.prototype.getPlaylistItems=DW.prototype.Sh;DW.prototype.canCast=DW.prototype.Fc;DW.prototype.onCastStatusChanged=DW.prototype.ki;DW.prototype.onPlaylistModified=DW.prototype.ni;
|
|
62
|
+
DW.prototype.onPlaylistItemChange=DW.prototype.mi;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}lb(){return"Google Cast Framework"}nb(){return cast.framework.VERSION}sb(){return 0}getId(){return""}getCreativeId(){return""}Nb(){return""}getApiFramework(){return null}getAdSystem(){return""}getAdvertiserName(){return""}getTitle(){return this.a.title||""}getDuration(){return this.a.duration||0}getPosition(){return 0}getSkipTimeOffset(){return this.a.whenSkippable||0}Rb(){return!1}ob(){return this.a.clickThroughUrl||
|
|
63
|
+
null}getMediaUrl(){return this.a.contentUrl||this.a.contentId||null}cb(){return 0}bb(){return 0}Oa(){return 0}Pa(){switch(this.Gb()){case 0:return 0;case -1:return 2;default:return 1}}getPodIndex(){return this.j}Gb(){return this.f.position}qb(){return this.l}eb(){return this.h}getWrapperAdIds(){return[]}canSeek(){return!1}getWrapperAdSystems(){return[]}getWrapperCreativeIds(){return[]}Pb(){return null}};Y.prototype.getVideoElement=Y.prototype.Pb;Y.prototype.getWrapperCreativeIds=Y.prototype.getWrapperCreativeIds;
|
|
64
|
+
Y.prototype.getWrapperAdSystems=Y.prototype.getWrapperAdSystems;Y.prototype.canSeek=Y.prototype.canSeek;Y.prototype.getWrapperAdIds=Y.prototype.getWrapperAdIds;Y.prototype.getSequenceLength=Y.prototype.eb;Y.prototype.getPositionInSequence=Y.prototype.qb;Y.prototype.getPodTimeOffset=Y.prototype.Gb;Y.prototype.getPodIndex=Y.prototype.getPodIndex;Y.prototype.getPodType=Y.prototype.Pa;Y.prototype.getMediaBitrate=Y.prototype.Oa;Y.prototype.getMediaHeight=Y.prototype.bb;Y.prototype.getMediaWidth=Y.prototype.cb;
|
|
65
|
+
Y.prototype.getMediaUrl=Y.prototype.getMediaUrl;Y.prototype.getClickThroughUrl=Y.prototype.ob;Y.prototype.isBumper=Y.prototype.Rb;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;Y.prototype.getApiFramework=Y.prototype.getApiFramework;
|
|
66
|
+
Y.prototype.getSourceId=Y.prototype.Nb;Y.prototype.getCreativeId=Y.prototype.getCreativeId;Y.prototype.getId=Y.prototype.getId;Y.prototype.getTechnology=Y.prototype.sb;Y.prototype.getAdManagerVersion=Y.prototype.nb;Y.prototype.getAdManagerName=Y.prototype.lb;var EW=class{constructor(a){this.a=a}getCuePoints(){return this.a.map(a=>a.position)}Ib(){return!!this.a.find(a=>0===a.position)}Hb(){return!!this.a.find(a=>-1===a.position)}};EW.prototype.hasPostroll=EW.prototype.Hb;EW.prototype.hasPreroll=EW.prototype.Ib;EW.prototype.getCuePoints=EW.prototype.getCuePoints;var FW=class{constructor(a){this.m=a;this.a=null;this.j=this.w.bind(this);this.f=[cast.framework.events.EventType.PLAYER_LOADING,cast.framework.events.EventType.BREAK_CLIP_LOADING,cast.framework.events.EventType.BREAK_STARTED,cast.framework.events.EventType.BREAK_ENDED,cast.framework.events.EventType.BREAK_CLIP_STARTED,cast.framework.events.EventType.BREAK_CLIP_ENDED,cast.framework.events.EventType.PLAYING,cast.framework.events.EventType.PAUSE,cast.framework.events.EventType.BUFFERING];WV().addEventListener(this.f,
|
|
67
|
+
this.j)}load(){const a=this;return _.w(function*(){SV&&(SV=!1,VV(a,0))})}start(){return _.w(function*(){WV().play()})}o(){}resume(){-1!==this.getPosition()&&WV().play()}pause(){-1!==this.getPosition()&&WV().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}l(){return!0}h(){const a=this;return _.w(function*(){WV().removeEventListener(a.f,a.j)})}w(a){const b=cast.framework.events.EndedReason;
|
|
68
|
+
switch(a.type){case cast.framework.events.EventType.PLAYER_LOADING:this.a=WV().getBreakManager();this.a.setPlayWatchedBreak(!0);a=this.a.getBreaks();this.m.trigger(new _.G(_.pc,{adsTimeline:new EW(a)}));break;case cast.framework.events.EventType.BREAK_CLIP_LOADING:YV(this,_.fc,a);break;case cast.framework.events.EventType.BREAK_STARTED:YV(this,_.Sb,a);break;case cast.framework.events.EventType.BREAK_ENDED:YV(this,_.Tb,a);break;case cast.framework.events.EventType.BREAK_CLIP_STARTED:YV(this,_.lc,a);
|
|
69
|
+
break;case cast.framework.events.EventType.BREAK_CLIP_ENDED:a.endedReason===b.SKIPPED?(YV(this,_.kc,a),YV(this,_.mc,a)):a.endedReason===b.STOPPED?YV(this,_.mc,a):a.endedReason===b.END_OF_STREAM?(YV(this,_.Wb,a),YV(this,_.mc,a)):a.endedReason===b.ERROR&&VV(this,1);break;case cast.framework.events.EventType.PLAYING:YV(this,_.jc,a);break;case cast.framework.events.EventType.PAUSE:YV(this,_.hc,a);break;case cast.framework.events.EventType.BUFFERING:a.isBuffering?YV(this,_.Ub,a):YV(this,_.jc,a)}}};
|
|
70
|
+
FW.prototype.getPosition=FW.prototype.getPosition;FW.prototype.setVolume=FW.prototype.setVolume;FW.prototype.getVolume=FW.prototype.getVolume;FW.prototype.skip=FW.prototype.skip;FW.prototype.pause=FW.prototype.pause;FW.prototype.resume=FW.prototype.resume;var SV=!1;var GW=class{constructor(a){this.a=a;this.f=this.h.bind(this)}init(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().addEventListener(ZV(),this.f)}release(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().removeEventListener(ZV(),this.f)}getTimelineCues(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager().getTimedMetadata().map(a=>$V(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=
|
|
71
|
+
_.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 _.G(b,{detail:$V(a.timedMetadataInfo)}))}else for(b of this.getTimelineCues())this.a(new _.G(_.bg,{detail:b}))}};var HW=class extends _.U{constructor(){super();this.g=new _.S("clpp.cast.TrackManager");this.m=null;this.o=1E9;this.h=[];this.j=[];this.l=this.w.bind(this);this.a=this.f=null}initialize(a){this.m=a;aW().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;aW().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.l)}getVideoTracks(){return[]}getAudioTracks(){return this.h}qa(){return this.j}ra(){return null}Ma(){const a=
|
|
72
|
+
this.pa();return a&&a.renditions[0]}Qa(){const a=this.ua();return a&&a.renditions[0]}pb(){return null}Eb(){return null}Fb(){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}ua(){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}yb(){this.g.warn("Video tracks unavailable on Cast")}ya(a){a&&this.f&&
|
|
73
|
+
this.f.setActiveById(+a.id)}Sa(a){this.a&&(a?this.a.setActiveByIds([+a.id]):this.a.setActiveByIds([]))}hb(){this.g.warn("Video renditions unavailable on Cast")}wb(a){this.ya(a&&a.track)}xb(a){this.Sa(a&&a.track)}addTextTrack(a){const b=this;return _.w(function*(){var c=b.m.getConfiguration();if((c=yield lV(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=
|
|
74
|
+
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]),cW(b)}catch(e){throw b.g.warn("failed on track",a),e;}}})}va(){return!0}w(){this.f=aW().getAudioTracksManager();var a=this.f.getTracks();this.h=bW(_.P,a);cW(this);a=this.m.getConfiguration();dW(this,_.P,a.preferredAudioLanguage,a.preferredAudioRole);dW(this,_.O,a.preferredTextLanguage,a.preferredTextRole)}};HW.prototype.isAbrEnabled=HW.prototype.va;
|
|
75
|
+
HW.prototype.addTextTrack=HW.prototype.addTextTrack;HW.prototype.setTextRendition=HW.prototype.xb;HW.prototype.setAudioRendition=HW.prototype.wb;HW.prototype.setVideoRendition=HW.prototype.hb;HW.prototype.setTextTrack=HW.prototype.Sa;HW.prototype.setAudioTrack=HW.prototype.ya;HW.prototype.setVideoTrack=HW.prototype.yb;HW.prototype.getTextTrack=HW.prototype.ua;HW.prototype.getAudioTrack=HW.prototype.pa;HW.prototype.getVideoTrack=HW.prototype.Fa;HW.prototype.getLoadingTextRendition=HW.prototype.Fb;
|
|
76
|
+
HW.prototype.getLoadingAudioRendition=HW.prototype.Eb;HW.prototype.getLoadingVideoRendition=HW.prototype.pb;HW.prototype.getTextRendition=HW.prototype.Qa;HW.prototype.getAudioRendition=HW.prototype.Ma;HW.prototype.getVideoRendition=HW.prototype.ra;HW.prototype.getTextTracks=HW.prototype.qa;HW.prototype.getAudioTracks=HW.prototype.getAudioTracks;HW.prototype.getVideoTracks=HW.prototype.getVideoTracks;var IW=class extends _.Tt{constructor(){super();this.g=new _.S(dV);this.h=this.w=_.fn();this.A=null;this.l=-1;this.F=new _.Kn;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=eW();a.setMessageInterceptor(cast.framework.messages.MessageType.MEDIA_STATUS,this.H.bind(this));a.setMediaPlaybackInfoHandler(this.G.bind(this));this.a=new AW(this);this.a.init();this.j=new HW;this.j.initialize(this);this.o=new GW(c=>this.trigger(c));this.o.init()}unload(){const a=
|
|
77
|
+
cast.framework.messages.PlayerState,b=eW();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=_.fn();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=eW();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot play during ads playout.");
|
|
78
|
+
a.play();return Promise.resolve()}pause(){const a=eW();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot pause during ads playout.");a.pause();return Promise.resolve()}isPaused(){return eW().getPlayerState()===cast.framework.messages.PlayerState.PAUSED}isEnded(){return eW().getPlayerState()===cast.framework.messages.PlayerState.IDLE}seek(a){const b=eW();if(null!==b.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject(VU);b.seek(a);return Promise.resolve()}getPosition(){return this.getMediaPosition()}setSeekInterceptor(){}setPlaybackSessionId(){}getBandwidthEstimate(){return null}getMediaPosition(){return eW().getCurrentTimeSec()}getDuration(){return this.getMediaDuration()}getMediaDuration(){const a=
|
|
79
|
+
eW().getDurationSec();return typeof a===_.r?-1===a?Infinity:a:-1}getPlaybackRate(){return eW().getPlaybackRate()}setPlaybackRate(a){if(0<a){const b=new cast.framework.messages.SetPlaybackRateRequestData;b.playbackRate=a;eW().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||
|
|
80
|
+
null}getLoadedSource(){const a=eW().getMediaInformation();if(a){var b=eW().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,nj:b,name:c}}return null}getDrmInfo(){return null}getPresentationStartTime(){return eW().getStartAbsoluteTime()}getSeekRange(){let a={start:0,end:this.getDuration()};if(this.isLive()){const b=eW().getLiveSeekableRange();
|
|
81
|
+
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=_.ss();if(this.f){a=eW().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=
|
|
82
|
+
this;return _.w(function*(){b.f=new _.uv;b.a.l=b.f.a;b.A=_.mn(a);b.h=_.hn([b.w,a]);if(b.C)b.C=!1;else{var c=b.A[b.l],d=new cast.framework.messages.LoadRequestData;d.autoplay=b.h.autoplay;typeof b.h.startTime===_.r&&(d.currentTime=b.h.startTime);c.type&&(d.media.contentType=c.type);d.media.contentId=c.url;d.media.customData={playerConfiguration:iV(b.h),local:!0};yield eW().load(d)}})}getBufferInfo(){this.g.warn(_.qa);return new _.Nt}getTrackManager(){return this.j}getConfiguration(){return this.h}getSurface(){return this.B}getTimeline(){return null}setupPlaylist(){return Promise.reject(_.Za)}appendLoad(){return Promise.reject(_.Za)}seekWith(){return Promise.reject(_.Za)}setNetworkEngine(a){this.F=
|
|
83
|
+
a}setCmsdManager(){}getNetworkEngine(){return this.F}getSourceIndex(){return this.l}setSourceIndex(a){this.l=a}getPeriods(){return[]}namespace(){return dV}getTimelineCues(){return this.o&&this.o.getTimelineCues()||[]}getCueTimeline(){return null}resetAbr(){this.g.warn($U)}onError(a){a=new _.G(_.Xd,{detail:a});this.trigger(a)}canPlay(){return _.$i()?2:0}H(a){a=Object.assign({},a);a.customData||(a.customData={});a.customData.stats=iV(this.getStats());var b=eW(),c=a.media||b.getMediaInformation();b=
|
|
84
|
+
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=eW().getStartAbsoluteTime();if(typeof d===_.r){b.startAbsoluteTime=d;let h;f?h=new cast.framework.messages.GenericMediaMetadata:h=b.metadata;
|
|
85
|
+
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=jV(a.media.customData.playerConfiguration));var d=null;var e=null;a.media.customData&&(d=jV(a.media.customData["com.castlabs.reactnative.PlayerConfiguration"]),e=jV(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)?iW(b,{streaming:{lowLatencyMode:!0}}):
|
|
86
|
+
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;hW(c,b);a={};d=c.streaming||null;e&&e.useSenderStreamingConfig&&d&&(a.streaming=kV(d,wW));c=c.abr||null;e&&e.useSenderAbrConfig&&c&&(a.abr=kV(c,xW));_.fh(a)&&(b=iW(b,a));return b}getTextDisplayer(){return null}setDrmCustomDataModifier(){}setCdnErrorCallback(){}detach(){}};var kW=class{constructor(){this.a=!1;this.g=new _.S(eV);this.f=this.m=null;this.j=new Set;this.C=this.K.bind(this);this.B=this.F.bind(this);this.o=null;this.A=new _.Qt;this.l=this.h=this.w=null}init(a){a&&(this.f=new IW,_.co(a,this.f),this.m=a,this.A.on(window,"unload",()=>{const b=this;return _.w(function*(){b.m&&b.m.getState()!==_.Fs&&(yield hV(b.m))})}))}start(){if(!this.a&&window.cast&&cast.framework&&cast.framework.CastReceiverContext){this.a=!0;var a=mW(),b=mW().getPlayerManager(),c=new cast.framework.CastReceiverOptions;
|
|
87
|
+
c.customNamespaces={};c.customNamespaces[fV]=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,e=>{this.g.info("QUEUE_UPDATE message received",
|
|
88
|
+
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));a.start(c);a.addCustomMessageListener(fV,
|
|
89
|
+
this.B)}}stop(){if(this.a){this.a=!1;this.A.release();const a=mW();mW().getPlayerManager().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.C);a.removeCustomMessageListener(fV,this.B);a.stop();this.l=this.h=this.m=this.f=null}}Gd(a){this.o=a}Ki(a){this.w=a}on(a,b){mW().addEventListener(a,b)}off(a,b){mW().removeEventListener(a,b)}addMessageListener(a){typeof a===_.ae&&this.j.add(a)}removeMessageListener(a){typeof a===_.ae&&this.j.delete(a)}sendMessage(a,b){mW().sendCustomMessage(fV,
|
|
90
|
+
b,iV(a))}xc(){return this.a}Cb(){return nW()}Wb(a){oW(this,a)}$i(a){const b=nW();let c=null;a?c=Object.assign({},b,a):c=b;oW(this,c)}Mi(a){this.h=a;this.l=null}getQueueManager(){return mW().getPlayerManager().getQueueManager()}G(){var a=this.getQueueManager();a&&(a=a.getCurrentItemIndex(),this.l!==a&&(this.l=a,mW().sendCustomMessage(fV,void 0,{type:ZU,index:a})))}I(a){a=a.trim();if(a.startsWith("#EXTM3U"))return qW(this,a);try{var b=(new DOMParser).parseFromString(a,_.$f)}catch(k){return a}var c=
|
|
91
|
+
b.getElementsByTagName("MPD")[0];if(c){a=c;this.g.debug("Detected DASH, parsing");b=mW();c=a.getElementsByTagName("Period");for(var d=c.length-1;0<=d;--d){var e=c[d].getElementsByTagName(_.ha);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(_.lb);for(let k=h.length-1;0<=k;--k){const l=h[k].getAttribute(_.Be)||g,m=h[k].getAttribute(_.od);let n=h[k].getAttribute(_.Mg)||void 0,p=h[k].getAttribute(_.be)||
|
|
92
|
+
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(_.lb).length||c[d].removeChild(e[f])}}c[d].getElementsByTagName(_.ha).length||a.removeChild(c[d])}return a=(new XMLSerializer).serializeToString(a)}if(c=b.getElementsByTagName(_.qb)[0]){a=c;this.g.debug("Detected Smooth, parsing");b=mW();c=a.getElementsByTagName("StreamIndex");for(d=c.length-1;0<=d;--d)if(c[d].getAttribute("Type")===_.t){e=c[d].getElementsByTagName(_.jb);for(f=
|
|
93
|
+
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(_.jb).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&&(d=jV(c.media.customData.playerConfiguration));if(b.m&&d){b.o&&(d=(yield Promise.resolve(b.o(d)))||d);d.ima&&(yield UV(c.media,d.ima,
|
|
94
|
+
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 _.oo(b.m,d),yield _.po(b.m),d=b.m.getLoadedSource(),c.media.contentId=d.url,c.media.contentType=d.type,d.Yb&&(c.media.hlsVideoSegmentFormat=mV(d.Yb,_.Q)),d.$a&&(c.media.hlsSegmentFormat=mV(d.$a,_.P)));const e=c.media.metadata;e&&typeof e.sectionStartAbsoluteTime===_.r&&(d=e.sectionStartAbsoluteTime,e.sectionStartAbsoluteTime=
|
|
95
|
+
0===d?1E-8:d);void 0===c.autoplay&&(c.autoplay=b.m.getConfiguration().autoplay)}b.w&&(d=yield Promise.resolve(b.w(c)))&&(c=d);return c})}J(a){var b=a.media;b&&b.tracks&&b.tracks.length&&rW(b.tracks);if((b=a.items)&&b.length)for(const c of b)(b=c&&c.media)&&b.tracks&&b.tracks.length&&rW(b.tracks);return a}K(a){if(this.m&&(!a.media.customData||!a.media.customData.local)){var b=mW().getPlayerManager(),c=b.getLiveSeekableRange();if(c){a=c.start;c=c.end;var d=this.m.getConfiguration().startTime;typeof a!==
|
|
96
|
+
_.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))}_.ro(this.m)}}F(a){if(0<this.j.size){const b=jV(a.data);this.j.forEach(c=>c(b))}}};_.x(eV,kW);kW.prototype.getQueueManager=kW.prototype.getQueueManager;kW.prototype.setQueue=kW.prototype.Mi;kW.prototype.updateContentMetadata=kW.prototype.$i;kW.prototype.setContentMetadata=kW.prototype.Wb;kW.prototype.getContentMetadata=kW.prototype.Cb;kW.prototype.isApiReady=kW.prototype.xc;
|
|
97
|
+
kW.prototype.sendMessage=kW.prototype.sendMessage;kW.prototype.removeMessageListener=kW.prototype.removeMessageListener;kW.prototype.addMessageListener=kW.prototype.addMessageListener;kW.prototype.off=kW.prototype.off;kW.prototype.on=kW.prototype.on;kW.prototype.setLoadRequestDataInterceptor=kW.prototype.Ki;kW.prototype.setPlayerConfigInterceptor=kW.prototype.Gd;kW.prototype.stop=kW.prototype.stop;kW.prototype.start=kW.prototype.start;kW.prototype.init=kW.prototype.init;kW.getInstance=lW;var jW=null;var JW=class{constructor(a){this.f=a;this.a=null;this.j=new _.Qt;this.w=[cast.framework.RemotePlayerEventType.IS_PLAYING_BREAK_CHANGED,cast.framework.RemotePlayerEventType.CURRENT_BREAK_CLIP_NUMBER_CHANGED,cast.framework.RemotePlayerEventType.MEDIA_INFO_CHANGED,cast.framework.RemotePlayerEventType.IS_PAUSED_CHANGED]}load(){const a=this;return _.w(function*(){a.a=a.f.l;if(a.a){const b=a.a.controller,c=a.A.bind(a);for(const d of a.w)a.j.on(b,d,c)}})}start(){return _.w(function*(){})}o(){}resume(){this.a&&
|
|
98
|
+
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(gV,{type:"SKIP_AD",requestId:pV(),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}l(){return!0}h(){const a=this;return _.w(function*(){a.j.release()})}A(a){switch(a.field){case "mediaInfo":a.value&&
|
|
99
|
+
(a=a.value,a.breaks&&this.f.trigger(new _.G(_.pc,{adsTimeline:new EW(a.breaks)})));break;case "isPlayingBreak":a.value?tW(this,_.Sb):(tW(this,_.Wb),tW(this,_.mc),tW(this,_.Tb));break;case "currentBreakClipNumber":0<=a.value&&(0<a.value&&(tW(this,_.Wb),tW(this,_.mc)),tW(this,_.lc));break;case "isPaused":this.a.isPlayingBreak&&(a.value?tW(this,_.hc):tW(this,_.jc))}}};JW.prototype.getPosition=JW.prototype.getPosition;JW.prototype.setVolume=JW.prototype.setVolume;JW.prototype.getVolume=JW.prototype.getVolume;
|
|
100
|
+
JW.prototype.skip=JW.prototype.skip;JW.prototype.pause=JW.prototype.pause;JW.prototype.resume=JW.prototype.resume;var KW=class{name(){return"clpp.cast.ads.SenderAdsManagerFactory"}a(a,b){return a.namespace()!==_.gd?!1:!(!b||!b.ima)}create(a){return new JW(a.a)}};var LW=class{name(){return"clpp.cast.ads.AdsManagerFactory"}a(a,b){return lW().xc()?!(!b||!b.ima):!1}create(a){return new FW(a)}};_.x("clpp.cast.createCastQueue",function(){vW=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 vW});_.Fh(new KW);_.Fh(new LW);};f.call(g, window);
|