@castlabs/prestoplay 6.2.7 → 6.3.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 +64 -0
- package/cjs/cl.adobe.js +3 -3
- package/cjs/cl.airplay.js +3 -3
- package/cjs/cl.broadpeak.js +6 -6
- package/cjs/cl.cast.js +110 -106
- package/cjs/cl.conviva.js +33 -32
- package/cjs/cl.core.js +395 -383
- package/cjs/cl.crypto.js +9 -9
- package/cjs/cl.dash.js +69 -68
- package/cjs/cl.externs.js +98 -47
- package/cjs/cl.freewheel.js +24 -24
- package/cjs/cl.hls.js +44 -43
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +32 -30
- package/cjs/cl.ima.js +23 -23
- package/cjs/cl.mse.js +250 -255
- package/cjs/cl.muxdata.js +12 -11
- package/cjs/cl.onboard.js +3 -3
- package/cjs/cl.persistent.js +14 -14
- package/cjs/cl.playlist.js +6 -5
- package/cjs/cl.smooth.js +70 -70
- package/cjs/cl.thumbnails.js +22 -22
- package/cjs/cl.tizen.js +71 -71
- package/cjs/cl.ttml.js +26 -26
- package/cjs/cl.verimatrix.js +5 -5
- package/cjs/cl.vimond.js +13 -13
- package/cjs/cl.vr.js +18 -18
- package/cjs/cl.vtt.js +14 -14
- package/cjs/cl.youbora.js +19 -18
- package/cl.adobe.js +3 -3
- package/cl.airplay.js +3 -3
- package/cl.broadpeak.js +5 -5
- package/cl.cast.js +86 -82
- package/cl.conviva.js +27 -27
- package/cl.core.js +346 -334
- package/cl.crypto.js +8 -8
- package/cl.dash.js +63 -62
- package/cl.externs.js +98 -47
- package/cl.freewheel.js +19 -19
- package/cl.hls.js +37 -36
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +25 -24
- package/cl.ima.js +16 -16
- package/cl.mse.js +220 -224
- package/cl.muxdata.js +8 -9
- package/cl.onboard.js +4 -4
- package/cl.persistent.js +9 -9
- package/cl.playlist.js +5 -4
- package/cl.smooth.js +57 -57
- package/cl.thumbnails.js +17 -17
- package/cl.tizen.js +57 -57
- package/cl.ttml.js +21 -21
- 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.youbora.js +15 -15
- package/package.json +1 -1
package/cl.cast.js
CHANGED
|
@@ -1,83 +1,87 @@
|
|
|
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
|
-
null,g=null;for(var h=0;h<b.length&&!f;)g=b[h++],f=_.
|
|
4
|
-
d=cast.framework.messages.HlsVideoSegmentFormat;else return;switch(a){case _.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
c=
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
_.
|
|
37
|
-
|
|
38
|
-
this.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var dI="Cannot seek during ads playout.",eI="Cannot switch track",fI="Media session does not exist.",gI="No receivers available",hI="Reset ABR functionality not available on cast.",iI="SDK not yet ready",jI="Sender is destroyed.",kI="clpp.cast.CastProxy",lI="clpp.cast.Player",mI="clpp.cast.Receiver",nI="urn:x-cast:castlabs",oI="urn:x-cast:com.google.cast.media",pI=function(a){return _.v(function*(){yield _.gm(a,_.Ad);yield _.gm(a,_.zd)})},qI=function(a){return JSON.stringify(a,(b,c)=>
|
|
2
|
+
{if("license"!==b&&typeof c!==_.Vc){if(c instanceof Event){b={};for(const d in c){const e=c[d];typeof e===_.wd?"detail"===d&&(b[d]=e):d in Event||(b[d]=e)}return b}return typeof c===_.p?isNaN(c)?"NaN":isFinite(c)?c:0>c?"-Infinity":"Infinity":c}})},rI=function(a){if(typeof a!==_.je)return a;try{return JSON.parse(a,(b,c)=>"NaN"===c?NaN:"-Infinity"===c?-Infinity:"Infinity"===c?Infinity:c)}catch(b){return a}},sI=function(a,b,c,d){return _.v(function*(){if(b.includes(a.mimeType))return a;var e=null;let f=
|
|
3
|
+
null,g=null;for(var h=0;h<b.length&&!f;)g=b[h++],f=_.Jg(d,a.mimeType,g);f&&g&&(h=_.Cg(a.url),(h=yield c.fetch(h).O)&&h.data&&(e=f.a(_.K(h.data)),e={url:URL.createObjectURL(new Blob([e])),kind:a.kind,language:a.language,label:a.label,mimeType:g}));return e})},tI=function(a,b){let c,d;if(window.chrome&&chrome.cast&&chrome.cast.media)c=chrome.cast.media.HlsSegmentFormat,d=chrome.cast.media.HlsVideoSegmentFormat;else if(window.cast&&cast.framework&&cast.framework.messages)c=cast.framework.messages.HlsSegmentFormat,
|
|
4
|
+
d=cast.framework.messages.HlsVideoSegmentFormat;else return;switch(a){case _.Ge:return d.FMP4;case _.Fe:return b===_.J?d.MPEG2_TS:c.TS;case _.Wb:return c.AAC;case _.Xb:return c.AC3;case _.Yb:return c.E_AC3;case "audio/mpeg":return c.MP3;case _.Zb:return c.FMP4}},vI=function(a){a=void 0===a?uI:a;var b=cast.framework.messages||chrome.cast.media;if(!b)throw new _.G(1,8,8001);const c=b.MetadataType,d=b.GenericMediaMetadata,e=b.MovieMediaMetadata,f=b.TvShowMediaMetadata,g=b.MusicTrackMediaMetadata,h=b.PhotoMediaMetadata;
|
|
5
|
+
b=b.AudiobookChapterMediaMetadata;switch(a){case c.MOVIE:return new e;case c.TV_SHOW:return new f;case c.MUSIC_TRACK:return new g;case c.PHOTO:return new h;case c.AUDIOBOOK_CHAPTER:return new b;default:return new d}},wI=function(a,b){return a.g.filter(c=>c.type===b)},yI=function(a,b){const c=xI(a);return wI(a,b).find(d=>c.includes(d.id))||null},AI=function(a,b,c){const d=a.a.a;if(d)if(c){a.f[b]=c.renditions[0];c=[+c.id];if(b!==_.H){const e=a.ia();e&&c.push(+e.id)}c=new chrome.cast.media.EditTracksInfoRequest(c);
|
|
6
|
+
d.editTracksInfo(c,()=>{a.f[b]=null;zI(a,b)},e=>{a.f[b]=null;a.h.debug(eI,e)})}else b===_.H&&(c=new chrome.cast.media.EditTracksInfoRequest([]),d.editTracksInfo(c,()=>{zI(a,b)},e=>{a.h.debug(eI,e)}))},xI=function(a){return(a=a.a?a.a.a:null)?a.activeTrackIds.map(b=>b.toString()):[]},zI=function(a,b){b===_.I?a.a.trigger(new _.B(_.ah)):b===_.H&&a.a.trigger(new _.B(_.bh))},DI=function(a){if(a)for(const b of BI)CI(b)},CI=function(a){if(!a.w&&window.chrome&&chrome.cast&&chrome.cast.isAvailable&&window.cast&&
|
|
7
|
+
cast.framework&&cast.framework.CastContext&&a.T.length){a.w=!0;a.o.Qd();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.N);b.addEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.ca);EI&&a.o.$(.02)}},FI=function(a){return _.v(function*(){BI.delete(a);if(a.w){a.w=!1;var b=
|
|
8
|
+
cast.framework.CastContext.getInstance();b.removeEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.N);b.removeEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.ca)}b=[];a.f&&(b.push(a.f.destroy()),a.f=null);a.h&&(b.push(a.h.destroy()),a.h=null);yield Promise.all(b);a.A=!1;a.o&&(a.o.stop(),a.o=null);a.S=null;a.W=null})},GI=function(a){return _.v(function*(){a.$a()||(yield cast.framework.CastContext.getInstance().requestSession())})},II=function(a,b,c){c=
|
|
9
|
+
void 0===c?0:c;return _.v(function*(){var d=a.f.ia();d&&d.language&&(a.g.preferredTextLanguage=d.language);(d=a.f.ha())&&d.language&&(a.g.preferredAudioLanguage=d.language);yield HI(a,{source:a.getLoadedSource(),currentTime:c,isLive:a.isLive(),Gd:a.getPresentationStartTime(),autoplay:b,Ea:a.g})})},HI=function(a,b){return _.v(function*(){var c=chrome.cast.media.StreamType;yield GI(a);if(b){var d=cast.framework.CastContext.getInstance().getCurrentSession(),e=new chrome.cast.media.MediaInfo(b.source.url,
|
|
10
|
+
b.source.type);e.streamType=b.isLive?c.LIVE:c.BUFFERED;c=b.audioMimeType;e.hlsVideoSegmentFormat=tI(b.ub,_.J);e.hlsSegmentFormat=tI(c,_.I);b.Ea&&(a.L&&(c=yield Promise.resolve(a.L(b.Ea)))&&(b.Ea=c),a.g=b.Ea,a.C=_.gl(a.g),a.B=a.C.findIndex(k=>k.url===b.source.url),b.Ea.remoteTextTracks&&(c=yield Promise.all(b.Ea.remoteTextTracks.map(a.ua.bind(a))),e.tracks=c.filter(k=>k),b.Ea.remoteTextTracks=void 0),delete b.Ea.autoplay,b.Ea.startTime=null,e.customData={playerConfiguration:qI(b.Ea)});c=a.Va()||{};
|
|
11
|
+
var f=JI(c.metadataType),g;typeof b.Gd===_.p&&(g={metadataType:f,sectionStartAbsoluteTime:b.Gd});var h;b.source.name&&(h={metadataType:f,title:b.source.name});c=KI(c);if(g=LI(Object.assign({},g,h,c)))e.metadata=g;e=new chrome.cast.media.LoadRequest(e);typeof b.autoplay===_.cc&&(e.autoplay=b.autoplay);typeof b.currentTime===_.p&&(e.currentTime=b.currentTime);yield d.loadMedia(e)}})},LI=function(a){if(!a)return null;a:{var b=a.metadataType;const c=Object.entries(MI);for(const d of c){const [e,f]=d;
|
|
12
|
+
if(f===b){b=e;break a}}b=null}if(!b)return null;b=vI(MI[b]);return Object.assign(b,a)},JI=function(a){var b=void 0===b?uI:b;return Object.values(MI).includes(a)?a:b},KI=function(a){const b={};for(const c in a)void 0!==a[c]&&(b[c]=a[c]);return b},OI=function(a,b){NI(a,b.getMediaSession());b.addEventListener(cast.framework.SessionEventType.MEDIA_SESSION,a.V);b.addMessageListener(nI,a.R)},NI=function(a,b){b!==a.a&&(a.a=b,a.a&&(a.H.release(),a.F=null,a.m=null,a.m=new cast.framework.RemotePlayer,a.F=new cast.framework.RemotePlayerController(a.m),
|
|
13
|
+
a.H.on(a.F,cast.framework.RemotePlayerEventType.CURRENT_TIME_CHANGED,a.na.bind(a)),a.f&&a.f.load(),a.h&&a.h.init(),a.trigger(new _.B(_.id))))},RI=function(a){return new PI(a.h,()=>{a.trigger(new _.B(_.lc))},(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.Yd&&(d.preferredAudioLanguage=c.Yd);c.Ce&&(d.preferredTextLanguage=c.Ce);_.im(a.f,null);a.trigger(new _.B("castingended"));
|
|
14
|
+
a.j(b,d)}},()=>QI(a))},QI=function(a){return _.v(function*(){a.trigger(new _.B(_.kc));a.f.a!==a.a&&a.f&&a.a&&(yield a.f.release(),_.im(a.f,a.a))})},UI=function(a,b,c){return _.v(function*(){var d=b.adTagUrl;if(d)try{SI=!1;const e=_.Cg(d),f=yield c.fetch(e).O;if(f&&f.data){const g=_.mg(f.data),h=(new DOMParser).parseFromString(g,_.qe);if(h.getElementsByTagName("vmap:VMAP").length)_.z("VMAP detected."),a.vmapAdsRequest=TI(g);else if(h.getElementsByTagName("VAST").length){_.z("VAST detected.");{d=g;
|
|
15
|
+
const k=new cast.framework.messages.BreakClip("bc1");k.vastAdsRequest=TI(d);const l=new cast.framework.messages.Break("b1",[k.id],0);a.breakClips=[k];a.breaks=[l]}}else _.z("Unsupported schema."),SI=!0}}catch(e){_.z("Failed to fetch an ad",e),SI=!0}})},TI=function(a){const b=new cast.framework.messages.VastAdsRequest;b.adsResponse=a;return b},VI=function(a,b){b=new _.G(1,10,10003,{errorType:b});a.l.onError(b)},WI=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},
|
|
16
|
+
YI=function(a,b,c){if(c instanceof cast.framework.events.BreaksEvent||-1!==a.getPosition()){var d=null;(c=XI(a,c))&&(d={ad:c});a.l.trigger(new _.B(b,d))}},XI=function(a,b){let c=null;if(a.a&&b instanceof cast.framework.events.BreaksEvent){let d=null,e=null,f;typeof b.breakClipId===_.je&&(d=a.a.getBreakClipById(b.breakClipId));typeof b.breakId===_.je&&(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,
|
|
17
|
+
h)=>g.position-h.position).findIndex(g=>g===e)));c=new X(d,e,b.index,b.total,f)}return c},ZI=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]},$I=function(a){const b=a.dashTimedMetadata;let c=_.ye;b&&(c=b.schemeIdUri);return{type:c.startsWith(_.we)?_.Nf:_.Lf,schemeIdUri:c,id:a.id||"",startTime:a.startTime,endTime:a.endTime,
|
|
18
|
+
value:b&&b.value||"",eventElement:b&&b.eventElement}},aJ=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},cJ=function(a){a.a=aJ().getTextTracksManager();const b=a.a.getTracks();a.j=bJ(_.H,b)},bJ=function(a,b){const c=[];for(const d of b)b=new _.$f(d.trackId.toString(),a),b.roles=d.roles||[],b.kind=d.subtype||null,b.language=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||
|
|
19
|
+
b.mimeType,b.src=d.customData.url||b.src),b.renditions.push(new _.Un(b.id,b)),c.push(b);return c},dJ=function(a,b,c,d){c=_.Pg(c).filter(g=>g);var e=!1;let f=[];b===_.I?f=a.getAudioTracks():b===_.H&&(f=a.ea());if(c=c.find(g=>{const h=_.Mg(g);return f.some(k=>{k=_.Mg(k.language||"");return _.Ng(h,k)})})){const g=_.Mg(c);c=f.filter(h=>{h=_.Mg(h.language||"");return _.Ng(g,h)});f=c.length?c:f;e=e||!!c.length}_.vg(d)&&(c=f.filter(g=>g.roles.includes(d)),f=c.length?c:f,e=e||!!c.length);e&&f[0]&&(e=f[0],
|
|
20
|
+
a.g.info("Will select track",e),b===_.I?a.la(e):b===_.H&&a.ta(e))},eJ=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},hJ=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=_.Bi(d);if(e){var f=[_.Cc];_.gl(a)[0].type!==_.Sb&&f.unshift(_.Dc);d.preferredDrmSystem===_.Cc&&f.reverse();for(var g,h;f.length&&!h;)g=f.shift(),h=e.Ga[g];
|
|
21
|
+
h?(c=g===_.Dc?cast.framework.ContentProtection.WIDEVINE:g===_.Cc?cast.framework.ContentProtection.PLAYREADY:void 0,b.protectionSystem=c,b.licenseUrl=h.licenseUrl,c={ldlDelay:0,customData:{}},fJ(b,h,a,c),gJ(b,h,a,c)):c()}else c()}else c()},fJ=function(a,b,c,d){b.modifiers.licenseRequest?a.licenseRequestHandler=e=>{const f=_.Cg({method:"POST",uris:[e.url]});e.headers&&(f.headers=e.headers);f.body=e.content;f.allowCrossSiteCredentials=e.withCredentials;b.modifiers.licenseRequest(c,f,d);e.url=f.uris[0];
|
|
22
|
+
e.headers=f.headers;e.content=f.body;e.withCredentials=f.allowCrossSiteCredentials}:a.licenseRequestHandler=void 0},gJ=function(a,b,c,d){b.modifiers.licenseResponse?a.licenseHandler=(e,f)=>_.v(function*(){const g=_.Dg(Object.assign({},f.headers),e.buffer,200,"");yield b.modifiers.licenseResponse(c,g,d);return _.K(g.data)}):a.licenseHandler=void 0},kJ=function(){return iJ||(iJ=new jJ)},lJ=function(){return cast.framework.CastReceiverContext.getInstance()},nJ=function(a,b){a.h.debug("Detected HLS, parsing");
|
|
23
|
+
var c=cast.framework.messages.HlsVideoSegmentFormat;a=lJ();var {hlsVideoSegmentFormat:d}=lJ().getPlayerManager().getMediaInformation()||{};c=d===c.FMP4?_.Ge:_.Fe;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=mJ(f,_.ja),h=mJ(f,"RESOLUTION");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")},mJ=function(a,b){let c;
|
|
24
|
+
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},pJ=function(a,b){let c=null;const d=oJ(a);d&&(c={ad:d});a.f.trigger(new _.B(b,c))},oJ=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:
|
|
25
|
+
b.breaks.filter(h=>0<=h.position).sort((h,k)=>h.position-k.position).findIndex(h=>h===c));b.breakClips&&(d=b.breakClips.find(h=>h.id===a.a.breakClipId)||null);b=new X(d,c,g,e,f)}return b},qJ=class{constructor(a,b){this.log=new _.O(b);this.f=a;this.m=null;this.h=_.$k;this.o=_.Ho;this.j=2;this.C=Date.now();this.B=-1}release(){this.a(_.$k)}destroy(){this.m=this.f=null;return Promise.resolve()}getState(){return this.h}onError(a){a.severity===_.F&&this.a(_.Zk)}a(a){if(a!==this.h)if(this.h===_.Zk&&a!==
|
|
26
|
+
_.$k)this.log.debug("Player is in ERROR state and can not switch to",a);else{var b=Date.now();this.o=this.h;this.h=a;this.h===_.Vk?(this.B=b,this.f.trigger(new _.B(_.hc,{detail:{bufferedTimeMS:-1,reason:this.j}}))):this.o===_.Vk&&this.f.trigger(new _.B(_.gc,{detail:{bufferedTimeMS:b-this.B,reason:this.j}}));a={currentState:this.h,previousState:this.o,timeSinceLastStateChangeMS:b-this.C};this.C=b;this.m&&_.Jk(this.m,this.h);this.f.trigger(new _.B(_.ge,{detail:a}))}}};_.x("clpp.cast.CastUtils",class{});
|
|
27
|
+
var uI=0,MI={GENERIC:uI,MOVIE:1,TV_SHOW:2,MUSIC_TRACK:3,PHOTO:4,AUDIOBOOK_CHAPTER:5};var rJ=class extends qJ{constructor(a){super(a,"clpp.cast.SenderStateManager");this.w=this.g=null;this.A=this.D.bind(this)}init(){const a=this.f,b=a.a;b&&(this.g&&this.g.removeUpdateListener(this.A),this.g=b,this.g.addUpdateListener(this.A),this.w=a.m)}destroy(){const a=this,b=()=>Object.getPrototypeOf(Object.getPrototypeOf(this)).destroy;return _.v(function*(){a.g&&(a.g.removeUpdateListener(a.A),a.g=null);yield b().call(a)})}a(a){const b=this.f.m;b&&b.isPlayingBreak||super.a(a)}D(){if(this.g&&this.w&&
|
|
28
|
+
!this.w.isPlayingBreak)switch(this.g.playerState){case chrome.cast.media.PlayerState.IDLE:switch(this.g.idleReason){case chrome.cast.media.IdleReason.FINISHED:this.a(_.Sk);break;case chrome.cast.media.IdleReason.ERROR:this.a(_.Zk);break;default:this.a(_.$k)}break;case chrome.cast.media.PlayerState.PLAYING:this.a(_.dl);break;case chrome.cast.media.PlayerState.PAUSED:this.a(_.bl);break;case chrome.cast.media.PlayerState.BUFFERING:this.a(_.Vk)}}};var Y=class extends _.P{constructor(){super();this.h=new _.O("clpp.cast.SenderTrackManager");this.a=null;this.g=[];this.f={}}initialize(a){this.a=a}release(){this.g=[];this.f={}}load(){this.release();var a=this.a.a;a&&(a=a.media)&&(this.g=(a=a.tracks)?a.map(b=>{switch(b.type){case chrome.cast.media.TrackType.VIDEO:var c=_.J;break;case chrome.cast.media.TrackType.AUDIO:c=_.I;break;case chrome.cast.media.TrackType.TEXT:c=_.H}c=new _.$f(b.trackId.toString(),c);c.kind=b.subtype;c.language=b.language;
|
|
29
|
+
c.label=b.name;c.src=b.trackContentId;c.mimeType=b.trackContentType;b.customData&&(c.src=b.customData.url||c.src,c.mimeType=b.customData.mimeType||c.mimeType);c.renditions.push(new _.Un(c.id,c));return c}):[],this.a.trigger(new _.B(_.Zn)))}destroy(){this.a=null}getVideoTracks(){return wI(this,_.J)}getAudioTracks(){return wI(this,_.I)}ea(){return wI(this,_.H)}fa(){const a=this.Aa();return a?a.renditions[0]:null}xa(){const a=this.ha();return a?a.renditions[0]:null}za(){const a=this.ia();return a?a.renditions[0]:
|
|
30
|
+
null}Ja(){return this.f[_.J]||null}Wa(){return this.f[_.I]||null}Xa(){return this.f[_.H]||null}Aa(){return yI(this,_.J)}ha(){return yI(this,_.I)}ia(){return yI(this,_.H)}Pa(a){AI(this,_.J,a)}la(a){AI(this,_.I,a)}ta(a){AI(this,_.H,a)}Oa(a){this.Pa(a&&a.track)}cb(a){this.la(a&&a.track)}eb(a){this.ta(a&&a.track)}addTextTrack(){return _.v(function*(){})}ja(){return!0}};Y.prototype.isAbrEnabled=Y.prototype.ja;Y.prototype.addTextTrack=Y.prototype.addTextTrack;Y.prototype.setTextRendition=Y.prototype.eb;
|
|
31
|
+
Y.prototype.setAudioRendition=Y.prototype.cb;Y.prototype.setVideoRendition=Y.prototype.Oa;Y.prototype.setTextTrack=Y.prototype.ta;Y.prototype.setAudioTrack=Y.prototype.la;Y.prototype.setVideoTrack=Y.prototype.Pa;Y.prototype.getTextTrack=Y.prototype.ia;Y.prototype.getAudioTrack=Y.prototype.ha;Y.prototype.getVideoTrack=Y.prototype.Aa;Y.prototype.getLoadingTextRendition=Y.prototype.Xa;Y.prototype.getLoadingAudioRendition=Y.prototype.Wa;Y.prototype.getLoadingVideoRendition=Y.prototype.Ja;
|
|
32
|
+
Y.prototype.getTextRendition=Y.prototype.za;Y.prototype.getAudioRendition=Y.prototype.xa;Y.prototype.getVideoRendition=Y.prototype.fa;Y.prototype.getTextTracks=Y.prototype.ea;Y.prototype.getAudioTracks=Y.prototype.getAudioTracks;Y.prototype.getVideoTracks=Y.prototype.getVideoTracks;var PI=class extends _.ao{constructor(a,b,c,d){super();this.j=new _.O(_.tc);this.T=a;this.o=new _.zh(b);this.S=c;this.W=d;this.g=this.I=_.di();this.C=[];this.B=0;this.K=new _.$l;this.F=this.m=this.a=null;this.A=this.w=!1;this.aa="";this.ga=1E6;this.f=new Y;this.f.initialize(this);this.h=new rJ(this);this.H=new _.Fn;this.J=null;this.D=new Set;this.N=this.Ra.bind(this);this.ca=this.Ua.bind(this);this.V=this.Ta.bind(this);this.R=this.Sa.bind(this);this.L=null;window.cast||Object.defineProperty(window,
|
|
33
|
+
"cast",{get:()=>window.cast_,set:e=>{window.cast_=e;window.setTimeout(()=>{DI(!0)},0)}});CI(this);BI.add(this)}init(a,b){this.g=this.I=b}unload(){return new Promise((a,b)=>{this.f&&this.f.release();this.a&&!this.a.idleReason||a();this.a.stop(null,a,b)})}release(){return this.unload().then(()=>{this.h&&this.h.release()})}destroy(){return _.v(function*(){})}Cc(a){this.L=a}Sb(){return this.w}$a(){return this.A}kd(){return this.aa}sendMessage(a,b){const c=this;return _.v(function*(){let d;const e=cast.framework.CastContext.getInstance().getCurrentSession();
|
|
34
|
+
if(e)try{yield e.sendMessage(a,qI(b))}catch(f){d=new _.G(1,8,8E3,{detailedErrorCode:f})}else d=new _.G(1,8,8004,void 0);if(d)c.onError(d)})}cast(){const a=this;return _.v(function*(){if(!a.Sb())throw a.j.warn(iI),new _.G(1,8,8001,void 0);if(!EI)throw a.j.warn(gI),new _.G(1,8,8002,void 0);if(a.$a())throw a.j.warn("Already casting"),new _.G(1,8,8003,void 0);try{yield GI(a)}catch(b){const c={};b instanceof chrome.cast.Error?(c.detailedErrorCode=b.code,c.details=b.details,c.reason=b.description):c.detailedErrorCode=
|
|
35
|
+
b;throw new _.G(1,8,8E3,c);}})}ed(){this.$a()&&cast.framework.CastContext.getInstance().endCurrentSession(!0)}addMessageListener(a){typeof a===_.Vc&&this.D.add(a)}removeMessageListener(a){typeof a===_.Vc&&this.D.delete(a)}play(){return this.isEnded()?II(this,!0):new Promise((a,b)=>{if(!this.a)return b(fI);this.a.play(null,a,b)})}pause(){return new Promise((a,b)=>{this.isEnded()&&a();if(!this.a)return b(fI);this.a.pause(null,a,b)})}isPaused(){return!!this.a&&this.a.playerState===chrome.cast.media.PlayerState.PAUSED}isEnded(){return this.getState()===
|
|
36
|
+
_.Sk}seek(a){return this.isEnded()?II(this,!1,a):new Promise((b,c)=>{this.a||c(fI);this.m.isPlayingBreak&&c(dI);const d=new chrome.cast.media.SeekRequest;d.currentTime=a;this.trigger(new _.B(_.Be));this.a.seek(d,()=>{this.trigger(new _.B(_.Ae));b()},c)})}getPosition(){return this.a&&this.a.getEstimatedTime()||0}getDuration(){if(!this.a||!this.a.media)return-1;const a=this.a.media.duration;return typeof a!==_.p?-1:-1===a?Infinity:a}setDrmCustomDataModifier(){}setCdnErrorCallback(){}getPlaybackRate(){return this.a&&
|
|
37
|
+
this.a.playbackRate||0}setPlaybackRate(a){this.a&&0<a&&this.sendMessage(oI,{type:"SET_PLAYBACK_RATE",requestId:Math.round(1E3*Math.random()),mediaSessionId:this.a.mediaSessionId,playbackRate:a})}getVolume(){return this.a&&this.a.volume.level}setVolume(a){this.a&&0<=a&&1>=a&&(a=new chrome.cast.media.VolumeRequest(new chrome.cast.Volume(a)),this.a.setVolume(a))}isMuted(){return this.a&&this.a.volume.muted}setMuted(a){this.a&&(a=new chrome.cast.media.VolumeRequest(new chrome.cast.Volume(void 0,a)),this.a.setVolume(a))}getPresentationStartTime(){if(!this.a||
|
|
38
|
+
!this.a.media||!this.a.media.metadata)return null;const a=this.a.media.metadata.sectionStartAbsoluteTime;return typeof a!==_.p?null:1E-8===a?0:a}getSeekRange(){let a={start:0,end:this.getDuration()};if(this.isLive()){const b=this.a.getEstimatedLiveSeekableRange();b&&typeof b.start===_.p&&typeof b.end===_.p&&(a={start:b.start,end:b.end})}return a}getState(){return this.h?this.h.getState():_.Ho}getStats(){return this.a&&this.a.customData&&this.a.customData.stats?rI(this.a.customData.stats):_.Nk()}isLive(){return Infinity===
|
|
39
|
+
this.getDuration()}load(a){const b=this;return _.v(function*(){if(b.Sb())if(EI){b.C=_.gl(a);_.gi(a)&&(b.g=_.fi(b.I,a));var c=b.C[b.B];yield HI(b,{source:c,isLive:c.isLive,autoplay:b.g.autoplay,Ea:b.g,ub:c.ub,audioMimeType:c.audioMimeType})}else b.j.warn(gI);else b.j.warn(iI)})}getBufferInfo(){return new _.$n}getTrackManager(){return this.f}getConfiguration(){return this.g}getSurface(){return null}setNetworkEngine(a){this.K=a}getNetworkEngine(){return this.K}getSourceIndex(){return this.B}setSourceIndex(a){this.B=
|
|
40
|
+
a}getLoadedSource(){return this.C[this.B]}getPeriods(){return[]}getDrmInfo(){return null}getTimelineCues(){return[]}resetAbr(){this.j.warn(hI)}onError(a){if(a&&(this.trigger(new _.B(_.Tc,{detail:a})),this.h))this.h.onError(a)}namespace(){return _.tc}canPlay(){return this.Sb()?2:0}Va(){return this.J}$b(a){this.J=LI(a)}$c(){this.J=null}Nd(a){const b=this.Va()||{};a={metadataType:JI(b.metadataType),title:a};this.$b(Object.assign({},b,a))}Ld(a){const b=this.Va()||{},c=JI(b.metadataType);a=new chrome.cast.Image(a);
|
|
41
|
+
this.$b(Object.assign({},b,{metadataType:c,images:[a]}))}Kd(a){const b=this.Va()||{};this.$b(Object.assign({},b,{metadataType:3,artist:a}))}Md(a){const b=this.Va()||{};a={metadataType:JI(b.metadataType),releaseDate:a};this.$b(Object.assign({},b,a))}Ra(a){const b=cast.framework.CastContext.getInstance(),c=a.castState===cast.framework.CastState.CONNECTED;EI=a.castState!==cast.framework.CastState.NO_DEVICES_AVAILABLE;this.aa=c?b.getCurrentSession().getCastDevice().friendlyName:"";this.o.Qd()}Ua(a){this.j.debug(`state: ${a.sessionState}, details:`,
|
|
42
|
+
a);switch(a.sessionState){case cast.framework.SessionState.SESSION_STARTED:this.A=!0;OI(this,a.session);break;case cast.framework.SessionState.SESSION_RESUMED:this.$a()||(this.A=!0,OI(this,a.session),this.W());break;case cast.framework.SessionState.SESSION_ENDED:if(this.$a()&&this.a){const d=this.a.media;var b=this.f.ha(),c=this.f.ia();b=b&&b.language||void 0;c=c&&c.language||void 0;this.S(this.getState(),{source:{url:d.contentId,type:d.contentType,isLive:this.isLive()},currentTime:this.getPosition(),
|
|
43
|
+
Ce:c,Yd:b})}a.session.removeEventListener(cast.framework.SessionEventType.MEDIA_SESSION,this.V);a.session.removeMessageListener(nI,this.R);this.A=!1;this.a=null;this.H.release();this.m=this.F=null}}Ta(a){this.j.debug("New media session",a.mediaSession);NI(this,a.mediaSession)}Sa(a,b){if(a===nI&&0<this.D.size){const c=rI(b);this.D.forEach(d=>d(c))}}na(){this.trigger(new _.B(_.re))}ua(a){const b=this;return _.v(function*(){let c=null;const d=yield sI(a,[_.pe,_.Rb],b.K,b.g);d&&(c=new chrome.cast.media.Track(b.ga++,
|
|
44
|
+
chrome.cast.media.TrackType.TEXT),c.language=d.language,c.name=d.label||null,c.trackContentId=d.url,c.trackContentType=d.mimeType,c.customData={mimeType:a.mimeType,url:a.url});return c})}getTextDisplayer(){return null}};PI.prototype.getTextDisplayer=PI.prototype.getTextDisplayer;PI.prototype.getNetworkEngine=PI.prototype.getNetworkEngine;PI.prototype.setNetworkEngine=PI.prototype.setNetworkEngine;var EI=!1,BI=new Set;window.__onGCastApiAvailable=DI;var sJ=class extends _.ao{constructor(a,b,c){super();this.f=a;this.h=b;this.j=typeof c===_.Vc?c:(d,e)=>{this.f&&d!==_.Sk&&d!==_.$k&&this.f.load(e)};this.a=RI(this);this.g=new _.O(kI);this.addDelegate(this.f)}destroy(){const a=this;return _.v(function*(){a.a&&(yield FI(a.a),a.a=null);a.removeDelegate(a.f)})}Zc(){return!!this.a&&this.a.Sb()&&EI}$a(){return!!this.a&&this.a.$a()}kd(){return this.a?this.a.kd():""}Cc(a){this.a&&this.a.Cc(a)}cast(a){const b=this;return _.v(function*(){if(b.a){var c,d=null;
|
|
45
|
+
if(c=b.f.getLoadedSource()){var e=b.f.getTrackManager();d=e.getVideoTracks()[0];let f,g;d&&d.mimeType&&(f=d.mimeType);d=b.f.getConfiguration();const h=e.ha();h&&(h.mimeType&&(g=h.mimeType),h.language&&(d.preferredAudioLanguage=h.language),h.roles.length&&(d.preferredAudioRole=h.roles[0]));if(e=e.ia())e.language&&(d.preferredTextLanguage=e.language),e.roles.length&&(d.preferredTextRole=e.roles[0]);e=c&&typeof c.isLive===_.cc?c.isLive:b.f.isLive();d={source:c,isLive:e,autoplay:!b.f.isPaused(),currentTime:Math.max(b.f.getPosition()-
|
|
46
|
+
1,0),Gd:b.f.getPresentationStartTime(),ub:f,audioMimeType:g,Ea:d}}c=d;try{yield b.a.cast(),b.f&&b.a&&(yield QI(b),b.a&&(c&&(c.autoplay=!b.f.isPaused()),a?yield b.f.load(a):b.a.a||(yield HI(b.a,c))))}catch(f){b.g.error("Error while trying to cast",f),c=new _.B(_.Tc,{detail:f}),b.trigger(c)}}})}ed(){this.a&&this.a.ed()}Qe(a){const b=this;return _.v(function*(){a!==b.h&&(b.h=a,b.a&&(yield FI(b.a)),b.a=RI(b))})}sendMessage(a){const b=this;return _.v(function*(){b.a?yield b.a.sendMessage(nI,a):b.g.warn(jI)})}addMessageListener(a){this.a?
|
|
47
|
+
this.a.addMessageListener(a):this.g.warn(jI)}removeMessageListener(a){this.a?this.a.removeMessageListener(a):this.g.warn(jI)}Va(){return this.a&&this.a.Va()}$b(a){this.a&&this.a.$b(a)}$c(){this.a&&this.a.$c()}Nd(a){this.a&&this.a.Nd(a)}Ld(a){this.a&&this.a.Ld(a)}Kd(a){this.a&&this.a.Kd(a)}Md(a){this.a&&this.a.Md(a)}};_.x(kI,sJ);sJ.prototype.setContentReleaseDate=sJ.prototype.Md;sJ.prototype.setContentArtist=sJ.prototype.Kd;sJ.prototype.setContentImage=sJ.prototype.Ld;
|
|
48
|
+
sJ.prototype.setContentTitle=sJ.prototype.Nd;sJ.prototype.clearContentMetadata=sJ.prototype.$c;sJ.prototype.setContentMetadata=sJ.prototype.$b;sJ.prototype.getContentMetadata=sJ.prototype.Va;sJ.prototype.removeMessageListener=sJ.prototype.removeMessageListener;sJ.prototype.addMessageListener=sJ.prototype.addMessageListener;sJ.prototype.sendMessage=sJ.prototype.sendMessage;sJ.prototype.changeReceiverId=sJ.prototype.Qe;sJ.prototype.forceDisconnect=sJ.prototype.ed;sJ.prototype.cast=sJ.prototype.cast;
|
|
49
|
+
sJ.prototype.setPlayerConfigInterceptor=sJ.prototype.Cc;sJ.prototype.getReceiverName=sJ.prototype.kd;sJ.prototype.isCasting=sJ.prototype.$a;sJ.prototype.canCast=sJ.prototype.Zc;sJ.prototype.destroy=sJ.prototype.destroy;var tJ=class extends qJ{constructor(a){super(a,"clpp.cast.StateManager");this.I=this.S.bind(this);this.H=this.R.bind(this);this.A=this.aa.bind(this);this.w=this.W.bind(this);this.K=this.V.bind(this);this.J=this.T.bind(this);this.L=this.ga.bind(this);this.F=this.ca.bind(this);this.D=this.U.bind(this);this.g=this.N.bind(this)}init(){const a=cast.framework.events.EventType,b=cast.framework.CastReceiverContext.getInstance().getPlayerManager();b.addEventListener(a.PLAYING,this.I);b.addEventListener(a.PAUSE,
|
|
47
50
|
this.H);b.addEventListener(a.MEDIA_FINISHED,this.A);b.addEventListener(a.BUFFERING,this.w);b.addEventListener(a.SEEKING,this.K);b.addEventListener(a.SEEKED,this.J);b.addEventListener(a.STALLED,this.L);b.addEventListener(a.PLAYER_LOADING,this.F);b.addEventListener(a.ERROR,this.D);b.addEventListener(a.BITRATE_CHANGED,this.g)}destroy(){const a=this,b=()=>Object.getPrototypeOf(Object.getPrototypeOf(this)).destroy;return _.v(function*(){const c=cast.framework.events.EventType,d=cast.framework.CastReceiverContext.getInstance().getPlayerManager();
|
|
48
|
-
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.F);d.removeEventListener(c.ERROR,a.D);d.removeEventListener(c.BITRATE_CHANGED,a.g);yield b().call(a)})}S(){this.f.trigger(new _.
|
|
49
|
-
this.a(_.
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
cast.framework.
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
b.getElementsByTagName("MPD")[0];if(c){a=c;this.h.debug("Detected DASH, parsing");b=
|
|
76
|
-
void 0,q=h[k].getAttribute(_.
|
|
77
|
-
_.u){e=c[d].getElementsByTagName(_.
|
|
78
|
-
|
|
79
|
-
(
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
51
|
+
d.removeEventListener(c.PLAYING,a.I);d.removeEventListener(c.PAUSE,a.H);d.removeEventListener(c.MEDIA_FINISHED,a.A);d.removeEventListener(c.BUFFERING,a.w);d.removeEventListener(c.SEEKING,a.K);d.removeEventListener(c.SEEKED,a.J);d.removeEventListener(c.STALLED,a.L);d.removeEventListener(c.PLAYER_LOADING,a.F);d.removeEventListener(c.ERROR,a.D);d.removeEventListener(c.BITRATE_CHANGED,a.g);yield b().call(a)})}S(){this.f.trigger(new _.B(_.Nd));this.a(_.dl)}R(){this.a(_.bl)}aa(){this.a(_.Sk)}W(a){a.isBuffering?
|
|
52
|
+
this.a(_.Vk):(a=this.f.isPaused()?_.bl:_.dl,this.a(a))}V(){this.j=1;this.f.trigger(new _.B(_.Be))}T(){this.f.trigger(new _.B(_.Ae))}ga(){this.j=2}ca(){this.a(_.al)}N(a){const b=this.f.getStats();this.f.trigger(new _.B(_.bc,{detail:{bandwidth:a.totalBitrate,width:b.width,height:b.height}}))}U(a){a=new _.G(_.F,7,7300,{detailedErrorCode:a.detailedErrorCode,error:a.error,reason:a.reason});this.f.trigger(new _.B(_.Tc,{detail:a}));this.a(_.Zk)}};var X=class{constructor(a,b,c,d,e){this.a=a;this.f=b;this.h=typeof c===_.p?c:1;this.j=typeof d===_.p?d:1;this.g=typeof e===_.p?e:0}hb(){return"Google Cast Framework"}ib(){return cast.framework.VERSION}nb(){return 0}ba(){return""}getCreativeId(){return""}getApiFramework(){return null}getAdSystem(){return""}getAdvertiserName(){return""}getTitle(){return this.a.title||""}getDuration(){return this.a.duration||0}getSkipTimeOffset(){return this.a.whenSkippable||0}Ub(){return!1}Ab(){return this.a.clickThroughUrl||
|
|
53
|
+
null}getMediaUrl(){return this.a.contentUrl||this.a.contentId||null}kb(){return 0}jb(){return 0}Ya(){return 0}Ka(){switch(this.Bb()){case 0:return 0;case -1:return 2;default:return 1}}getPodIndex(){return this.g}Bb(){return this.f.position}Cb(){return this.h}mb(){return this.j}getWrapperAdIds(){return[]}getWrapperAdSystems(){return[]}getWrapperCreativeIds(){return[]}};X.prototype.getWrapperCreativeIds=X.prototype.getWrapperCreativeIds;X.prototype.getWrapperAdSystems=X.prototype.getWrapperAdSystems;
|
|
54
|
+
X.prototype.getWrapperAdIds=X.prototype.getWrapperAdIds;X.prototype.getSequenceLength=X.prototype.mb;X.prototype.getPositionInSequence=X.prototype.Cb;X.prototype.getPodTimeOffset=X.prototype.Bb;X.prototype.getPodIndex=X.prototype.getPodIndex;X.prototype.getPodType=X.prototype.Ka;X.prototype.getMediaBitrate=X.prototype.Ya;X.prototype.getMediaHeight=X.prototype.jb;X.prototype.getMediaWidth=X.prototype.kb;X.prototype.getMediaUrl=X.prototype.getMediaUrl;X.prototype.getClickThroughUrl=X.prototype.Ab;
|
|
55
|
+
X.prototype.isBumper=X.prototype.Ub;X.prototype.getSkipTimeOffset=X.prototype.getSkipTimeOffset;X.prototype.getDuration=X.prototype.getDuration;X.prototype.getTitle=X.prototype.getTitle;X.prototype.getAdvertiserName=X.prototype.getAdvertiserName;X.prototype.getAdSystem=X.prototype.getAdSystem;X.prototype.getApiFramework=X.prototype.getApiFramework;X.prototype.getCreativeId=X.prototype.getCreativeId;X.prototype.getId=X.prototype.ba;X.prototype.getTechnology=X.prototype.nb;
|
|
56
|
+
X.prototype.getAdManagerVersion=X.prototype.ib;X.prototype.getAdManagerName=X.prototype.hb;var uJ=class{constructor(a){this.a=a}getCuePoints(){return this.a.map(a=>a.position)}Db(){return!!this.a.find(a=>0===a.position)}Za(){return!!this.a.find(a=>-1===a.position)}};uJ.prototype.hasPostroll=uJ.prototype.Za;uJ.prototype.hasPreroll=uJ.prototype.Db;uJ.prototype.getCuePoints=uJ.prototype.getCuePoints;var vJ=class{constructor(a){this.l=a;this.a=null;this.g=this.h.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];WI().addEventListener(this.f,
|
|
57
|
+
this.g)}load(){const a=this;return _.v(function*(){SI&&(SI=!1,VI(a,0))})}start(){return _.v(function*(){WI().play()})}resume(){-1!==this.getPosition()&&WI().play()}pause(){-1!==this.getPosition()&&WI().pause()}skip(){}getVolume(){return this.l.getVolume()||0}setVolume(a){this.l.setVolume(a)}getPosition(){const a=this.a&&this.a.getBreakClipCurrentTimeSec();return typeof a===_.p?a:-1}dispose(){const a=this;return _.v(function*(){WI().removeEventListener(a.f,a.g)})}h(a){const b=cast.framework.events.EndedReason;
|
|
58
|
+
switch(a.type){case cast.framework.events.EventType.PLAYER_LOADING:this.a=WI().getBreakManager();this.a.setPlayWatchedBreak(!0);a=this.a.getBreaks();this.l.trigger(new _.B(_.Hb,{adsTimeline:new uJ(a)}));break;case cast.framework.events.EventType.BREAK_CLIP_LOADING:YI(this,_.xb,a);break;case cast.framework.events.EventType.BREAK_STARTED:YI(this,_.qb,a);break;case cast.framework.events.EventType.BREAK_ENDED:YI(this,_.rb,a);break;case cast.framework.events.EventType.BREAK_CLIP_STARTED:YI(this,_.Db,a);
|
|
59
|
+
break;case cast.framework.events.EventType.BREAK_CLIP_ENDED:a.endedReason===b.SKIPPED?(YI(this,_.Cb,a),YI(this,_.Eb,a)):a.endedReason===b.STOPPED?YI(this,_.Eb,a):a.endedReason===b.END_OF_STREAM?(YI(this,_.ub,a),YI(this,_.Eb,a)):a.endedReason===b.ERROR&&VI(this,1);break;case cast.framework.events.EventType.PLAYING:YI(this,_.Bb,a);break;case cast.framework.events.EventType.PAUSE:YI(this,_.zb,a);break;case cast.framework.events.EventType.BUFFERING:a.isBuffering?YI(this,_.sb,a):YI(this,_.Bb,a)}}};
|
|
60
|
+
vJ.prototype.getPosition=vJ.prototype.getPosition;vJ.prototype.setVolume=vJ.prototype.setVolume;vJ.prototype.getVolume=vJ.prototype.getVolume;vJ.prototype.skip=vJ.prototype.skip;vJ.prototype.pause=vJ.prototype.pause;vJ.prototype.resume=vJ.prototype.resume;var SI=!1;var wJ=class{constructor(a){this.Jb=a;this.a=this.f.bind(this)}init(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().addEventListener(ZI(),this.a)}release(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().removeEventListener(ZI(),this.a)}getTimelineCues(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager().getTimedMetadata().map(a=>$I(a))}f(a){if(a instanceof cast.framework.events.TimedMetadataEvent){var b=null;switch(a.type){case cast.framework.events.EventType.TIMED_METADATA_CHANGED:b=
|
|
61
|
+
_.Of;break;case cast.framework.events.EventType.TIMED_METADATA_ENTER:b=_.Qf;break;case cast.framework.events.EventType.TIMED_METADATA_EXIT:b=_.Rf}b&&this.Jb(new _.B(b,{detail:$I(a.timedMetadataInfo)}))}else for(b of this.getTimelineCues())this.Jb(new _.B(_.Of,{detail:b}))}};var Z=class extends _.P{constructor(){super();this.g=new _.O("clpp.cast.TrackManager");this.l=null;this.o=1E9;this.h=[];this.j=[];this.m=this.w.bind(this);this.a=this.f=null}initialize(a){this.l=a;aJ().addEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.m)}release(){this.h=[];this.j=[];this.a=this.f=null}load(){}destroy(){this.l=null;aJ().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.m)}getVideoTracks(){return[]}getAudioTracks(){return this.h}ea(){return this.j}fa(){return null}xa(){const a=
|
|
62
|
+
this.ha();return a&&a.renditions[0]}za(){const a=this.ia();return a&&a.renditions[0]}Ja(){return null}Wa(){return null}Xa(){return null}Aa(){return null}ha(){let a=null;if(this.f){let b=this.f.getActiveId();typeof b===_.p&&(b=b.toString(),a=this.getAudioTracks().find(c=>c.id===b)||null)}return a}ia(){let a=null;if(this.a){let b=this.a.getActiveIds()[0];typeof b===_.p&&(b=b.toString(),a=this.ea().find(c=>c.id===b)||null)}return a}Pa(){this.g.warn("Video tracks unavailable on Cast")}la(a){a&&this.f&&
|
|
63
|
+
this.f.setActiveById(+a.id)}ta(a){this.a&&(a?this.a.setActiveByIds([+a.id]):this.a.setActiveByIds([]))}Oa(){this.g.warn("Video renditions unavailable on Cast")}cb(a){this.la(a&&a.track)}eb(a){this.ta(a&&a.track)}addTextTrack(a){const b=this;return _.v(function*(){var c=b.l.getConfiguration();if((c=yield sI(a,Object.values(cast.framework.messages.CaptionMimeType),b.l.getNetworkEngine(),c))&&b.a){const d=new cast.framework.messages.Track(b.o++,cast.framework.messages.TrackType.TEXT);d.isInband=!1;d.language=
|
|
64
|
+
c.language;d.name=c.label;d.subtype=c.kind;d.trackContentId=c.url;d.trackContentType=c.mimeType;d.customData={mimeType:a.mimeType,url:a.url};try{b.a.addTracks([d]),cJ(b)}catch(e){throw b.g.warn("failed on track",a),e;}}})}ja(){return!0}w(){this.f=aJ().getAudioTracksManager();var a=this.f.getTracks();this.h=bJ(_.I,a);cJ(this);a=this.l.getConfiguration();dJ(this,_.I,a.preferredAudioLanguage,a.preferredAudioRole);dJ(this,_.H,a.preferredTextLanguage,a.preferredTextRole)}};Z.prototype.isAbrEnabled=Z.prototype.ja;
|
|
65
|
+
Z.prototype.addTextTrack=Z.prototype.addTextTrack;Z.prototype.setTextRendition=Z.prototype.eb;Z.prototype.setAudioRendition=Z.prototype.cb;Z.prototype.setVideoRendition=Z.prototype.Oa;Z.prototype.setTextTrack=Z.prototype.ta;Z.prototype.setAudioTrack=Z.prototype.la;Z.prototype.setVideoTrack=Z.prototype.Pa;Z.prototype.getTextTrack=Z.prototype.ia;Z.prototype.getAudioTrack=Z.prototype.ha;Z.prototype.getVideoTrack=Z.prototype.Aa;Z.prototype.getLoadingTextRendition=Z.prototype.Xa;
|
|
66
|
+
Z.prototype.getLoadingAudioRendition=Z.prototype.Wa;Z.prototype.getLoadingVideoRendition=Z.prototype.Ja;Z.prototype.getTextRendition=Z.prototype.za;Z.prototype.getAudioRendition=Z.prototype.xa;Z.prototype.getVideoRendition=Z.prototype.fa;Z.prototype.getTextTracks=Z.prototype.ea;Z.prototype.getAudioTracks=Z.prototype.getAudioTracks;Z.prototype.getVideoTracks=Z.prototype.getVideoTracks;var xJ=class extends _.ao{constructor(){super();this.C=new _.O(lI);this.g=this.o=_.di();this.w=null;this.j=-1;this.D=new _.$l;this.f=this.m=this.h=this.a=this.A=null;this.B=!1}init(a,b){this.A=a;b&&(this.g=this.o=b);a=eJ();a.setMessageInterceptor(cast.framework.messages.MessageType.MEDIA_STATUS,this.H.bind(this));a.setMediaPlaybackInfoHandler(this.F.bind(this));this.a=new tJ(this);this.a.init();this.h=new Z;this.h.initialize(this);this.m=new wJ(c=>this.trigger(c));this.m.init()}unload(){const a=cast.framework.messages.PlayerState,
|
|
67
|
+
b=eJ();b.getPlayerState()!==a.IDLE&&b.stop();this.h&&this.h.release();this.m&&this.m.release();this.f=null;return Promise.resolve()}release(){return this.unload().then(()=>{this.a&&this.a.release()})}destroy(){const a=this;return _.v(function*(){a.A=null;a.o=_.di();a.g=a.o;a.j=-1;a.w=null;a.a&&(yield a.a.destroy(),a.a=null);a.h&&(a.h.destroy(),a.h=null)})}play(){const a=eJ();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot play during ads playout.");a.play();
|
|
68
|
+
return Promise.resolve()}pause(){const a=eJ();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot pause during ads playout.");a.pause();return Promise.resolve()}isPaused(){return eJ().getPlayerState()===cast.framework.messages.PlayerState.PAUSED}isEnded(){return eJ().getPlayerState()===cast.framework.messages.PlayerState.IDLE}seek(a){const b=eJ();if(null!==b.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject(dI);b.seek(a);return Promise.resolve()}getPosition(){return eJ().getCurrentTimeSec()}getDuration(){const a=
|
|
69
|
+
eJ().getDurationSec();return typeof a===_.p?-1===a?Infinity:a:-1}getPlaybackRate(){return eJ().getPlaybackRate()}setPlaybackRate(a){if(0<a){const b=new cast.framework.messages.SetPlaybackRateRequestData;b.playbackRate=a;eJ().sendLocalMediaRequest(b)}}getVolume(){return cast.framework.CastReceiverContext.getInstance().getSystemVolume().level||null}setVolume(a){0<=a&&1>=a&&cast.framework.CastReceiverContext.getInstance().setSystemVolumeLevel(a)}setMuted(a){cast.framework.CastReceiverContext.getInstance().setSystemVolumeMuted(a)}isMuted(){return cast.framework.CastReceiverContext.getInstance().getSystemVolume().muted||
|
|
70
|
+
null}getLoadedSource(){const a=eJ().getMediaInformation();if(a){var b=eJ().getPlaybackConfig();b=!!b&&b.protectionSystem!==cast.framework.ContentProtection.NONE;var c=this.w&&-1!==this.j?this.w[this.j]:null;c=c?c.name:void 0;!c&&a.metadata&&(c=a.metadata.title);return{url:a.contentId,type:a.contentType,Uf:b,name:c}}return null}getDrmInfo(){return null}getPresentationStartTime(){return eJ().getStartAbsoluteTime()}getSeekRange(){let a={start:0,end:this.getDuration()};if(this.isLive()){const b=eJ().getLiveSeekableRange();
|
|
71
|
+
b&&typeof b.start===_.p&&typeof b.end===_.p&&(a={start:b.start,end:b.end})}return a}getState(){return this.a?this.a.getState():_.Ho}getStats(){var a=_.Nk();if(this.f){a=eJ().getStats();this.f.m=a.estimatedBandwidth||NaN;this.f.A=a.streamBandwidth||NaN;var b=this.f,c=a.height||NaN;b.j=a.width||NaN;b.f=c;b=this.f;c=typeof a.decodedFrames===_.p?a.decodedFrames:NaN;b.h=typeof a.droppedFrames===_.p?a.droppedFrames:NaN;b.g=c;a=this.f.getStats()}return a}isLive(){return Infinity===this.getDuration()}load(a){const b=
|
|
72
|
+
this;return _.v(function*(){b.f=new _.Fo;b.a.m=b.f.a;b.w=_.gl(a);_.gi(a)&&(b.g=_.fi(b.o,a));if(b.B)b.B=!1;else{var c=b.w[b.j],d=new cast.framework.messages.LoadRequestData;d.autoplay=b.g.autoplay;typeof b.g.startTime===_.p&&(d.currentTime=b.g.startTime);c.type&&(d.media.contentType=c.type);d.media.contentId=c.url;d.media.customData={playerConfiguration:qI(b.g),local:!0};yield eJ().load(d)}})}getBufferInfo(){this.C.warn(_.ka);return new _.$n}getTrackManager(){return this.h}getConfiguration(){return this.g}getSurface(){return this.A}setNetworkEngine(a){this.D=
|
|
73
|
+
a}getNetworkEngine(){return this.D}getSourceIndex(){return this.j}setSourceIndex(a){this.j=a}getPeriods(){return[]}namespace(){return lI}getTimelineCues(){return this.m&&this.m.getTimelineCues()||[]}resetAbr(){this.C.warn(hI)}onError(a){a=new _.B(_.Tc,{detail:a});this.trigger(a)}canPlay(){return _.Mh()?2:0}H(a){a=Object.assign({},a);a.customData||(a.customData={});a.customData.stats=qI(this.getStats());{const c=cast.framework.messages.StreamType,d=a.media;var b=!!d;const e=b&&d.streamType===c.LIVE,
|
|
74
|
+
f=b&&!d.metadata,g=!!a.liveSeekableRange;if(b&&g&&(!e||e&&f)){b=eJ().getStartAbsoluteTime();if(typeof b===_.p){d.startAbsoluteTime=b;let h;f?h=new cast.framework.messages.GenericMediaMetadata:h=d.metadata;h.sectionStartAbsoluteTime=b;d.metadata=h}d.streamType=c.LIVE}}return a}F(a,b){let c=null;a.media.customData&&(c=rI(a.media.customData.playerConfiguration));(a=c?c.abr:null)&&typeof a.defaultBandwidthEstimate===_.p?b.initialBandwidth=a.defaultBandwidthEstimate:b.initialBandwidth=void 0;hJ(c,b);return b}getTextDisplayer(){return null}setDrmCustomDataModifier(){}setCdnErrorCallback(){}};
|
|
75
|
+
xJ.prototype.getTextDisplayer=xJ.prototype.getTextDisplayer;xJ.prototype.getNetworkEngine=xJ.prototype.getNetworkEngine;xJ.prototype.setNetworkEngine=xJ.prototype.setNetworkEngine;var jJ=class{constructor(){this.a=!1;this.h=new _.O(mI);this.f=this.l=null;this.g=new Set;this.A=this.F.bind(this);this.w=this.B.bind(this);this.j=null;this.o=new _.Fn;this.m=null}init(a){a&&(this.f=new xJ,_.im(a,this.f),this.l=a,this.o.on(window,"unload",()=>{const b=this;return _.v(function*(){b.l&&b.l.getState()!==_.$k&&(yield pI(b.l))})}))}start(){if(!this.a&&window.cast&&cast.framework&&cast.framework.CastReceiverContext){this.a=!0;var a=lJ(),b=lJ().getPlayerManager(),c=new cast.framework.CastReceiverOptions;
|
|
76
|
+
c.customNamespaces={};c.customNamespaces[nI]=cast.framework.system.MessageType.JSON;c.shakaVersion="4.3.4";var d=new cast.framework.PlaybackConfig;d.manifestHandler=this.D.bind(this);d.shakaConfig={streaming:{ignoreTextStreamFailures:!0}};c.playbackConfig=d;if(d=this.l&&this.l.getSurface().getMedia())c.mediaElement=d;c.disableIdleTimeout=!0;c.maxInactivity=Infinity;b.setMessageInterceptor(cast.framework.messages.MessageType.LOAD,this.C.bind(this));b.addEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,
|
|
77
|
+
this.A);a.start(c);a.addCustomMessageListener(nI,this.w)}}stop(){if(this.a){this.a=!1;this.o.release();const a=lJ();lJ().getPlayerManager().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.A);a.removeCustomMessageListener(nI,this.w);a.stop();this.l=this.f=null}}Cc(a){this.j=a}zf(a){this.m=a}on(a,b){lJ().addEventListener(a,b)}off(a,b){lJ().removeEventListener(a,b)}addMessageListener(a){typeof a===_.Vc&&this.g.add(a)}removeMessageListener(a){typeof a===_.Vc&&this.g.delete(a)}sendMessage(a,
|
|
78
|
+
b){lJ().sendCustomMessage(nI,b,qI(a))}Sb(){return this.a}Va(){var a;return a=(a=lJ().getPlayerManager().getMediaInformation())&&a.metadata?a.metadata:null}D(a){a=a.trim();if(a.startsWith("#EXTM3U"))return nJ(this,a);try{var b=(new DOMParser).parseFromString(a,_.qe)}catch(k){return a}var c=b.getElementsByTagName("MPD")[0];if(c){a=c;this.h.debug("Detected DASH, parsing");b=lJ();c=a.getElementsByTagName("Period");for(var d=c.length-1;0<=d;--d){var e=c[d].getElementsByTagName(_.ea);for(var f=e.length-
|
|
79
|
+
1;0<=f;--f){var g=e[f].getAttribute("contentType");if(g===_.u||g===_.Vb){g=e[f].getAttribute(_.od);var h=e[f].getElementsByTagName(_.Xa);for(let k=h.length-1;0<=k;--k){const l=h[k].getAttribute(_.od)||g,m=h[k].getAttribute(_.yc);let n=h[k].getAttribute(_.Te)||void 0,q=h[k].getAttribute(_.Yc)||void 0;void 0!==n&&(n=+n);void 0!==q&&(q=+q);b.canDisplayType(l,m,n,q)||e[f].removeChild(h[k])}e[f].getElementsByTagName(_.Xa).length||c[d].removeChild(e[f])}}c[d].getElementsByTagName(_.ea).length||a.removeChild(c[d])}return a=
|
|
80
|
+
(new XMLSerializer).serializeToString(a)}if(c=b.getElementsByTagName(_.fb)[0]){a=c;this.h.debug("Detected Smooth, parsing");b=lJ();c=a.getElementsByTagName("StreamIndex");for(d=c.length-1;0<=d;--d)if(c[d].getAttribute("Type")===_.u){e=c[d].getElementsByTagName(_.Va);for(f=e.length-1;0<=f;--f)g=e[f].getAttribute(_.Ka)||void 0,h=e[f].getAttribute(_.Ia)||void 0,void 0!==g&&(g=+g),void 0!==h&&(h=+h),b.canDisplayType(_.Ge,void 0,g,h)||c[d].removeChild(e[f]);c[d].getElementsByTagName(_.Va).length||a.removeChild(c[d])}a=
|
|
81
|
+
(new XMLSerializer).serializeToString(a)}return a}C(a){const b=this;return _.v(function*(){let c=a;var d;c.media.customData&&(d=rI(c.media.customData.playerConfiguration));if(b.l&&d){b.j&&(d=(yield Promise.resolve(b.j(d)))||d);d.ima&&(yield UI(c.media,d.ima,b.l.getNetworkEngine()));typeof d.startTime===_.p&&d.startTime!==c.currentTime&&(c.currentTime=d.startTime);c.media.customData.local||(b.f.B=!0,yield _.pm(b.l,d),yield _.qm(b.l),d=b.l.getLoadedSource(),c.media.contentId=d.url,c.media.contentType=
|
|
82
|
+
d.type,d.ub&&(c.media.hlsVideoSegmentFormat=tI(d.ub,_.J)),d.audioMimeType&&(c.media.hlsSegmentFormat=tI(d.audioMimeType,_.I)));const e=c.media.metadata;e&&typeof e.sectionStartAbsoluteTime===_.p&&(d=e.sectionStartAbsoluteTime,e.sectionStartAbsoluteTime=0===d?1E-8:d);void 0===c.autoplay&&(c.autoplay=b.l.getConfiguration().autoplay)}b.m&&(d=yield Promise.resolve(b.m(c)))&&(c=d);return c})}F(a){!this.l||a.media.customData&&a.media.customData.local||_.sm(this.l)}B(a){if(0<this.g.size){const b=rI(a.data);
|
|
83
|
+
this.g.forEach(c=>c(b))}}};_.x(mI,jJ);jJ.prototype.getContentMetadata=jJ.prototype.Va;jJ.prototype.isApiReady=jJ.prototype.Sb;jJ.prototype.sendMessage=jJ.prototype.sendMessage;jJ.prototype.removeMessageListener=jJ.prototype.removeMessageListener;jJ.prototype.addMessageListener=jJ.prototype.addMessageListener;jJ.prototype.off=jJ.prototype.off;jJ.prototype.on=jJ.prototype.on;jJ.prototype.setLoadRequestDataInterceptor=jJ.prototype.zf;jJ.prototype.setPlayerConfigInterceptor=jJ.prototype.Cc;
|
|
84
|
+
jJ.prototype.stop=jJ.prototype.stop;jJ.prototype.start=jJ.prototype.start;jJ.prototype.init=jJ.prototype.init;jJ.getInstance=kJ;var iJ=null;var yJ=class{constructor(a){this.f=a;this.a=null;this.g=new _.Fn;this.h=[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 _.v(function*(){a.a=a.f.m;if(a.a){const b=a.a.controller,c=a.j.bind(a);for(const d of a.h)a.g.on(b,d,c)}})}start(){return _.v(function*(){})}resume(){this.a&&
|
|
85
|
+
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(oI,{type:"SKIP_AD",requestId:Math.round(1E3*Math.random()),mediaSessionId:a.mediaSessionId})}getVolume(){return this.f.getVolume()||0}setVolume(a){this.f.setVolume(a)}getPosition(){let a=-1;var b=this.f.a;b&&(b=b.getEstimatedBreakClipTime(),typeof b===_.p&&(a=b));return a}dispose(){const a=this;
|
|
86
|
+
return _.v(function*(){a.g.release()})}j(a){switch(a.field){case "mediaInfo":a.value&&(a=a.value,a.breaks&&this.f.trigger(new _.B(_.Hb,{adsTimeline:new uJ(a.breaks)})));break;case "isPlayingBreak":a.value?pJ(this,_.qb):(pJ(this,_.ub),pJ(this,_.Eb),pJ(this,_.rb));break;case "currentBreakClipNumber":0<=a.value&&(0<a.value&&(pJ(this,_.ub),pJ(this,_.Eb)),pJ(this,_.Db));break;case "isPaused":this.a.isPlayingBreak&&(a.value?pJ(this,_.zb):pJ(this,_.Bb))}}};yJ.prototype.getPosition=yJ.prototype.getPosition;
|
|
87
|
+
yJ.prototype.setVolume=yJ.prototype.setVolume;yJ.prototype.getVolume=yJ.prototype.getVolume;yJ.prototype.skip=yJ.prototype.skip;yJ.prototype.pause=yJ.prototype.pause;yJ.prototype.resume=yJ.prototype.resume;var zJ=class{name(){return"clpp.cast.ads.SenderAdsManagerFactory"}Y(a,b){return a.namespace()!==_.tc?!1:!(!b||!b.ima)}create(a){return new yJ(a.a)}};zJ.prototype.create=zJ.prototype.create;zJ.prototype.isSupported=zJ.prototype.Y;zJ.prototype.name=zJ.prototype.name;_.tl(new zJ);var AJ=class{name(){return"clpp.cast.ads.AdsManagerFactory"}Y(a,b){return kJ().Sb()?!(!b||!b.ima):!1}create(a){return new vJ(a)}};AJ.prototype.create=AJ.prototype.create;AJ.prototype.isSupported=AJ.prototype.Y;AJ.prototype.name=AJ.prototype.name;_.tl(new AJ);};f.call(g, window);
|