@castlabs/prestoplay 6.7.0 → 6.8.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 +23 -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 -110
- package/cjs/cl.conviva.js +33 -33
- package/cjs/cl.core.js +416 -417
- package/cjs/cl.crypto.js +9 -9
- package/cjs/cl.dash.js +72 -72
- package/cjs/cl.externs.js +26 -26
- package/cjs/cl.freewheel.js +23 -23
- package/cjs/cl.hls.js +67 -67
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +31 -31
- package/cjs/cl.ima.js +23 -23
- package/cjs/cl.mse.js +270 -259
- package/cjs/cl.muxdata.js +15 -11
- package/cjs/cl.onboard.js +3 -3
- package/cjs/cl.persistent.js +13 -13
- package/cjs/cl.playlist.js +6 -6
- package/cjs/cl.smooth.js +70 -70
- package/cjs/cl.thumbnails.js +24 -24
- package/cjs/cl.tizen.js +69 -69
- package/cjs/cl.ttml.js +27 -27
- package/cjs/cl.verimatrix.js +5 -5
- package/cjs/cl.vimond.js +13 -13
- package/cjs/cl.vr.js +19 -19
- package/cjs/cl.vtt.js +14 -14
- package/cjs/cl.youbora.js +18 -18
- package/cl.adobe.js +3 -3
- package/cl.airplay.js +3 -3
- package/cl.broadpeak.js +5 -5
- package/cl.cast.js +86 -86
- package/cl.conviva.js +27 -27
- package/cl.core.js +355 -360
- package/cl.crypto.js +8 -8
- package/cl.dash.js +66 -66
- package/cl.externs.js +26 -26
- package/cl.freewheel.js +19 -19
- package/cl.hls.js +58 -57
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +25 -25
- package/cl.ima.js +17 -17
- package/cl.mse.js +237 -227
- package/cl.muxdata.js +12 -9
- package/cl.onboard.js +4 -4
- package/cl.persistent.js +9 -9
- package/cl.playlist.js +5 -5
- package/cl.smooth.js +58 -58
- package/cl.thumbnails.js +17 -17
- package/cl.tizen.js +57 -57
- package/cl.ttml.js +22 -22
- package/cl.verimatrix.js +4 -4
- package/cl.vimond.js +8 -8
- package/cl.vr.js +15 -15
- package/cl.vtt.js +12 -12
- package/cl.youbora.js +14 -14
- package/package.json +1 -1
- package/typings.d.ts +47 -20
package/cl.cast.js
CHANGED
|
@@ -1,88 +1,88 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
{if("license"!==b&&typeof c!==_.bd){if(c instanceof Event){b={};for(const d in c){const e=c[d];typeof e===_.Bd?"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}})},
|
|
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
|
-
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
|
-
d.editTracksInfo(c,()=>{a.f[b]=null;
|
|
7
|
-
cast.framework&&cast.framework.CastContext&&a.U.length){a.w=!0;a.o.$d();var b=cast.framework.CastContext.getInstance(),c=new cast.framework.CastOptions;c.receiverApplicationId=a.U;c.autoJoinPolicy=chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED;b.setOptions(c);b.addEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.
|
|
8
|
-
cast.framework.CastContext.getInstance();b.removeEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.
|
|
9
|
-
void 0===c?0:c;return _.y(function*(){var d=a.f.oa();d&&d.language&&(a.g.preferredTextLanguage=d.language);(d=a.f.na())&&d.language&&(a.g.preferredAudioLanguage=d.language);yield
|
|
10
|
-
b.source.type);e.streamType=b.isLive?c.LIVE:c.BUFFERED;c=b.audioMimeType;e.hlsVideoSegmentFormat
|
|
11
|
-
var f=
|
|
12
|
-
if(f===b){b=e;break a}}b=null}if(!b)return null;b=
|
|
13
|
-
null;a=null===a?null:a+b;return null===a?b:a},
|
|
14
|
-
1,0):null;d.ima&&d.startTime&&(d.ima.playAdsAfterTime=d.startTime);c.
|
|
15
|
-
_.
|
|
16
|
-
a;return b},
|
|
17
|
-
_.
|
|
18
|
-
a.dashTimedMetadata;let c=_.
|
|
19
|
-
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||b.mimeType,b.src=d.customData.url||b.src),b.renditions.push(new _.
|
|
20
|
-
{h=_.
|
|
21
|
-
a.drm,e=_.
|
|
22
|
-
uris:[e.url]});e.headers&&(f.headers=e.headers);f.body=e.content;f.allowCrossSiteCredentials=e.withCredentials;b.modifiers.licenseRequest(c,f,d);e.url=f.uris[0];e.headers=f.headers;e.content=f.body;e.withCredentials=f.allowCrossSiteCredentials}:a.licenseRequestHandler=void 0},
|
|
23
|
-
void 0},
|
|
24
|
-
h=
|
|
25
|
-
let c=null,d=null,e,f;const g=a.a.currentBreakClipNumber;b.breaks&&(c=b.breaks.find(h=>h.id===a.a.breakId)||null)&&(e=c.breakClipIds.length,f=0>=c.position?c.position:b.breaks.filter(h=>0<=h.position).sort((h,k)=>h.position-k.position).findIndex(h=>h===c));b.breakClips&&(d=b.breakClips.find(h=>h.id===a.a.breakClipId)||null);b=new Y(d,c,g,e,f)}return b},
|
|
26
|
-
this.f=null;return Promise.resolve()}getState(){return this.h}onError(a){a.severity===_.G&&this.a(_.
|
|
27
|
-
this.C};this.C=b;this.m&&_.
|
|
28
|
-
this.w&&!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(_.
|
|
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 _.
|
|
30
|
-
null}Pa(){return this.f[_.L]||null}bb(){return this.f[_.K]||null}cb(){return this.f[_.J]||null}Ga(){return
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var YK="Cannot seek during ads playout.",ZK="Cannot switch track",$K="Media session does not exist.",aL="No receivers available",bL="Reset ABR functionality not available on cast.",cL="SDK not yet ready",dL="Sender is destroyed.",eL="clpp.cast.CastProxy",fL="clpp.cast.Player",gL="clpp.cast.Receiver",hL="urn:x-cast:castlabs",iL="urn:x-cast:com.google.cast.media",jL=function(a){return _.y(function*(){yield _.Lm(a,_.Fd);yield _.Lm(a,_.Ed)})},kL=function(a){return JSON.stringify(a,(b,c)=>
|
|
2
|
+
{if("license"!==b&&typeof c!==_.bd){if(c instanceof Event){b={};for(const d in c){const e=c[d];typeof e===_.Bd?"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}})},lL=function(a){if(typeof a!==_.me)return a;try{return JSON.parse(a,(b,c)=>"NaN"===c?NaN:"-Infinity"===c?-Infinity:"Infinity"===c?Infinity:c)}catch(b){return a}},mL=function(a,b,c,d){return _.y(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=_.Sh(d,a.mimeType,g);f&&g&&(h=_.jh(a.url),(h=yield c.fetch(h).P)&&h.data&&(e=f.a(_.I(h.data)),e={url:URL.createObjectURL(new Blob([e])),kind:a.kind,language:a.language,label:a.label,mimeType:g}));return e})},nL=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 _.Je:return d.FMP4;case _.He:return b===_.L?d.MPEG2_TS:c.TS;case _.ac:return c.AAC;case _.bc:return c.AC3;case _.cc:return c.E_AC3;case "audio/mpeg":return c.MP3;case _.dc:return c.FMP4}},pL=function(a){a=void 0===a?oL:a;var b=cast.framework.messages||chrome.cast.media;if(!b)throw new _.H(1,8,8001);const c=b.MetadataType,d=b.GenericMediaMetadata,e=b.MovieMediaMetadata,f=b.TvShowMediaMetadata,g=b.MusicTrackMediaMetadata,h=b.PhotoMediaMetadata;
|
|
5
|
+
b=b.AudiobookChapterMediaMetadata;switch(a){case c.MOVIE:return new e;case c.TV_SHOW:return new f;case c.MUSIC_TRACK:return new g;case c.PHOTO:return new h;case c.AUDIOBOOK_CHAPTER:return new b;default:return new d}},qL=function(a,b){return a.g.filter(c=>c.type===b)},sL=function(a,b){const c=rL(a);return qL(a,b).find(d=>c.includes(d.id))||null},uL=function(a,b,c){const d=a.a.a;if(d)if(c){a.f[b]=c.renditions[0];c=[+c.id];if(b!==_.J){const e=a.oa();e&&c.push(+e.id)}c=new chrome.cast.media.EditTracksInfoRequest(c);
|
|
6
|
+
d.editTracksInfo(c,()=>{a.f[b]=null;tL(a,b)},e=>{a.f[b]=null;a.h.debug(ZK,e)})}else b===_.J&&(c=new chrome.cast.media.EditTracksInfoRequest([]),d.editTracksInfo(c,()=>{tL(a,b)},e=>{a.h.debug(ZK,e)}))},rL=function(a){return(a=a.a?a.a.a:null)?a.activeTrackIds.map(b=>b.toString()):[]},tL=function(a,b){b===_.K?a.a.trigger(new _.F(_.Pi)):b===_.J&&a.a.trigger(new _.F(_.Qi))},xL=function(a){if(a)for(const b of vL)wL(b)},wL=function(a){if(!a.w&&window.chrome&&chrome.cast&&chrome.cast.isAvailable&&window.cast&&
|
|
7
|
+
cast.framework&&cast.framework.CastContext&&a.U.length){a.w=!0;a.o.$d();var b=cast.framework.CastContext.getInstance(),c=new cast.framework.CastOptions;c.receiverApplicationId=a.U;c.autoJoinPolicy=chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED;b.setOptions(c);b.addEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.N);b.addEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.ba);yL&&a.o.ca(.02)}},zL=function(a){return _.y(function*(){vL.delete(a);if(a.w){a.w=!1;var b=
|
|
8
|
+
cast.framework.CastContext.getInstance();b.removeEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.N);b.removeEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.ba)}b=[];a.f&&(b.push(a.f.destroy()),a.f=null);a.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.Y=null})},AL=function(a){return _.y(function*(){a.gb()||(yield cast.framework.CastContext.getInstance().requestSession())})},CL=function(a,b,c){c=
|
|
9
|
+
void 0===c?0:c;return _.y(function*(){var d=a.f.oa();d&&d.language&&(a.g.preferredTextLanguage=d.language);(d=a.f.na())&&d.language&&(a.g.preferredAudioLanguage=d.language);yield BL(a,{source:a.getLoadedSource(),currentTime:c,isLive:a.isLive(),Rd:a.getPresentationStartTime(),autoplay:b,Ma:a.g})})},BL=function(a,b){return _.y(function*(){var c=chrome.cast.media.StreamType;yield AL(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=nL(b.zb,_.L);e.hlsSegmentFormat=nL(c,_.K);b.Ma&&(a.L&&(c=yield Promise.resolve(a.L(b.Ma)))&&(b.Ma=c),a.g=b.Ma,a.C=_.Kl(a.g),a.B=a.C.findIndex(k=>k.url===b.source.url),b.Ma.remoteTextTracks&&(c=yield Promise.all(b.Ma.remoteTextTracks.map(a.Ka.bind(a))),e.tracks=c.filter(k=>k),b.Ma.remoteTextTracks=void 0),delete b.Ma.autoplay,b.Ma.startTime=null,e.customData={playerConfiguration:kL(b.Ma)});c=a.ab()||{};
|
|
11
|
+
var f=DL(c.metadataType),g;typeof b.Rd===_.r&&(g={metadataType:f,sectionStartAbsoluteTime:b.Rd});var h;b.source.name&&(h={metadataType:f,title:b.source.name});c=EL(c);if(g=FL(Object.assign({},g,h,c)))e.metadata=g;e=new chrome.cast.media.LoadRequest(e);typeof b.autoplay===_.hc&&(e.autoplay=b.autoplay);typeof b.currentTime===_.r&&(e.currentTime=b.currentTime);yield d.loadMedia(e)}})},FL=function(a){if(!a)return null;a:{var b=a.metadataType;const c=Object.entries(GL);for(const d of c){const [e,f]=d;
|
|
12
|
+
if(f===b){b=e;break a}}b=null}if(!b)return null;b=pL(GL[b]);return Object.assign(b,a)},DL=function(a){var b=void 0===b?oL:b;return Object.values(GL).includes(a)?a:b},EL=function(a){const b={};for(const c in a)void 0!==a[c]&&(b[c]=a[c]);return b},IL=function(a,b){HL(a,b.getMediaSession());b.addEventListener(cast.framework.SessionEventType.MEDIA_SESSION,a.W);b.addMessageListener(hL,a.R)},JL=function(a){const b=a.getPosition();a.a&&a.a.media?(a=a.a.media.startAbsoluteTime,a=typeof a!==_.r?null:a):a=
|
|
13
|
+
null;a=null===a?null:a+b;return null===a?b:a},HL=function(a,b){a.a=b;a.a&&(a.H.release(),a.G=null,a.m=null,a.m=new cast.framework.RemotePlayer,a.G=new cast.framework.RemotePlayerController(a.m),a.H.on(a.G,cast.framework.RemotePlayerEventType.CURRENT_TIME_CHANGED,a.ma.bind(a)),a.f&&a.f.load(),a.h&&a.h.init(),a.trigger(new _.F(_.od)))},ML=function(a){return new KL(a.h,()=>{a.trigger(new _.F(_.qc))},(b,c)=>{{const d=a.f.getConfiguration();d.source=c.source;d.autoplay=!1;d.startTime=c.currentTime?Math.max(c.currentTime-
|
|
14
|
+
1,0):null;d.ima&&d.startTime&&(d.ima.playAdsAfterTime=d.startTime);c.ke&&(d.preferredAudioLanguage=c.ke);c.Ue&&(d.preferredTextLanguage=c.Ue);_.Nm(a.f,null);a.trigger(new _.F("castingended"));a.j(b,d)}},()=>LL(a))},LL=function(a){return _.y(function*(){a.trigger(new _.F(_.pc));a.f.a!==a.a&&a.f&&a.a&&(yield a.f.release(),_.Nm(a.f,a.a))})},PL=function(a,b,c){return _.y(function*(){var d=b.adTagUrl;if(d)try{NL=!1;const e=_.jh(d),f=yield c.fetch(e).P;if(f&&f.data){const g=_.Eg(f.data),h=(new DOMParser).parseFromString(g,
|
|
15
|
+
_.te);if(h.getElementsByTagName("vmap:VMAP").length)_.C("VMAP detected."),a.vmapAdsRequest=OL(g);else if(h.getElementsByTagName("VAST").length){_.C("VAST detected.");{d=g;const k=new cast.framework.messages.BreakClip("bc1");k.vastAdsRequest=OL(d);const l=new cast.framework.messages.Break("b1",[k.id],0);a.breakClips=[k];a.breaks=[l]}}else _.C("Unsupported schema."),NL=!0}}catch(e){_.C("Failed to fetch an ad",e),NL=!0}})},OL=function(a){const b=new cast.framework.messages.VastAdsRequest;b.adsResponse=
|
|
16
|
+
a;return b},QL=function(a,b){b=new _.H(1,10,10003,{errorType:b});a.l.onError(b)},RL=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},TL=function(a,b,c){if(c instanceof cast.framework.events.BreaksEvent||-1!==a.getPosition()){var d=null;(c=SL(a,c))&&(d={ad:c});a.l.trigger(new _.F(b,d))}},SL=function(a,b){let c=null;if(a.a&&b instanceof cast.framework.events.BreaksEvent){let d=null,e=null,f;typeof b.breakClipId===_.me&&(d=a.a.getBreakClipById(b.breakClipId));typeof b.breakId===
|
|
17
|
+
_.me&&(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},UL=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]},VL=function(a){const b=
|
|
18
|
+
a.dashTimedMetadata;let c=_.Ae;b&&(c=b.schemeIdUri);return{type:c.startsWith(_.ze)?_.Qf:_.Of,schemeIdUri:c,id:a.id||"",startTime:a.startTime,endTime:a.endTime,value:b&&b.value||"",eventElement:b&&b.eventElement}},WL=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},YL=function(a){a.a=WL().getTextTracksManager();const b=a.a.getTracks();a.j=XL(_.J,b)},XL=function(a,b){const c=[];for(const d of b)b=new _.xh(d.trackId.toString(),a),b.roles=d.roles||[],b.kind=d.subtype||
|
|
19
|
+
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||b.mimeType,b.src=d.customData.url||b.src),b.renditions.push(new _.Fh(b.id,b)),c.push(b);return c},ZL=function(a,b,c,d){c=_.Yf(c).filter(g=>g);var e=!1;let f=[];b===_.K?f=a.getAudioTracks():b===_.J&&(f=a.ja());if(c=c.find(g=>{const h=_.rg(g);return f.some(k=>{k=_.rg(k.language||"");return _.sg(h,k)})})){const g=_.rg(c);c=f.filter(h=>
|
|
20
|
+
{h=_.rg(h.language||"");return _.sg(g,h)});f=c.length?c:f;e=e||!!c.length}_.Ng(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===_.K?a.sa(e):b===_.J&&a.Ba(e))},$L=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},cM=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=
|
|
21
|
+
a.drm,e=_.oj(d);if(e){var f=[_.Ic];_.Kl(a)[0].type!==_.Zb&&f.unshift(_.Jc);d.preferredDrmSystem===_.Ic&&f.reverse();for(var g,h;f.length&&!h;)g=f.shift(),h=e.Na[g];h?(c=g===_.Jc?cast.framework.ContentProtection.WIDEVINE:g===_.Ic?cast.framework.ContentProtection.PLAYREADY:void 0,b.protectionSystem=c,b.licenseUrl=h.licenseUrl,c={ldlDelay:0,customData:{}},aM(b,h,a,c),bM(b,h,a,c)):c()}else c()}else c()},aM=function(a,b,c,d){b.modifiers.licenseRequest?a.licenseRequestHandler=e=>{const f=_.jh({method:"POST",
|
|
22
|
+
uris:[e.url]});e.headers&&(f.headers=e.headers);f.body=e.content;f.allowCrossSiteCredentials=e.withCredentials;b.modifiers.licenseRequest(c,f,d);e.url=f.uris[0];e.headers=f.headers;e.content=f.body;e.withCredentials=f.allowCrossSiteCredentials}:a.licenseRequestHandler=void 0},bM=function(a,b,c,d){b.modifiers.licenseResponse?a.licenseHandler=(e,f)=>_.y(function*(){const g=_.kh(Object.assign({},f.headers),e.buffer,200,"");yield b.modifiers.licenseResponse(c,g,d);return _.I(g.data)}):a.licenseHandler=
|
|
23
|
+
void 0},fM=function(){return dM||(dM=new eM)},gM=function(){return cast.framework.CastReceiverContext.getInstance()},iM=function(a,b){a.h.debug("Detected HLS, parsing");var c=cast.framework.messages.HlsVideoSegmentFormat;a=gM();var {hlsVideoSegmentFormat:d}=gM().getPlayerManager().getMediaInformation()||{};c=d===c.FMP4?_.Je:_.He;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=hM(f,_.ka),
|
|
24
|
+
h=hM(f,_.Ya);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")},hM=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},kM=function(a,b){let c=null;const d=jM(a);d&&(c={ad:d});a.f.trigger(new _.F(b,c))},jM=function(a){var b=null;if(a.a&&a.a.mediaInfo){b=a.a.mediaInfo;
|
|
25
|
+
let c=null,d=null,e,f;const g=a.a.currentBreakClipNumber;b.breaks&&(c=b.breaks.find(h=>h.id===a.a.breakId)||null)&&(e=c.breakClipIds.length,f=0>=c.position?c.position:b.breaks.filter(h=>0<=h.position).sort((h,k)=>h.position-k.position).findIndex(h=>h===c));b.breakClips&&(d=b.breakClips.find(h=>h.id===a.a.breakClipId)||null);b=new Y(d,c,g,e,f)}return b},lM=class{constructor(a,b){this.log=new _.P(b);this.f=a;this.m=null;this.h=_.El;this.o=_.np;this.j=2;this.C=Date.now();this.B=-1}release(){this.a(_.El)}destroy(){this.m=
|
|
26
|
+
this.f=null;return Promise.resolve()}getState(){return this.h}onError(a){a.severity===_.G&&this.a(_.Dl)}a(a){if(a!==this.h)if(this.h===_.Dl&&a!==_.El)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===_.zl?(this.B=b,this.f.trigger(new _.F(_.jc,{detail:{bufferedTimeMS:-1,reason:this.j}}))):this.o===_.zl&&this.f.trigger(new _.F(_.ic,{detail:{bufferedTimeMS:b-this.B,reason:this.j}}));a={currentState:this.h,previousState:this.o,timeSinceLastStateChangeMS:b-
|
|
27
|
+
this.C};this.C=b;this.m&&_.nl(this.m,this.h);this.f.trigger(new _.F(_.je,{detail:a}))}}};_.A("clpp.cast.CastUtils",class{});var oL=0,GL={GENERIC:oL,MOVIE:1,TV_SHOW:2,MUSIC_TRACK:3,PHOTO:4,AUDIOBOOK_CHAPTER:5};var mM=class extends lM{constructor(a){super(a,"clpp.cast.SenderStateManager");this.w=this.g=null;this.A=this.wb.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 _.y(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)}wb(){if(this.g&&
|
|
28
|
+
this.w&&!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(_.wl);break;case chrome.cast.media.IdleReason.ERROR:this.a(_.Dl);break;default:this.a(_.El)}break;case chrome.cast.media.PlayerState.PLAYING:this.a(_.Hl);break;case chrome.cast.media.PlayerState.PAUSED:this.a(_.Gl);break;case chrome.cast.media.PlayerState.BUFFERING:this.a(_.zl)}}};var Z=class extends _.Q{constructor(){super();this.h=new _.P("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=_.L;break;case chrome.cast.media.TrackType.AUDIO:c=_.K;break;case chrome.cast.media.TrackType.TEXT:c=_.J}c=new _.xh(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 _.Fh(c.id,c));return c}):[],this.a.trigger(new _.F(_.Ro)))}destroy(){this.a=null}getVideoTracks(){return qL(this,_.L)}getAudioTracks(){return qL(this,_.K)}ja(){return qL(this,_.J)}ia(){const a=this.Ga();return a?a.renditions[0]:null}Da(){const a=this.na();return a?a.renditions[0]:null}Ea(){const a=this.oa();return a?a.renditions[0]:
|
|
30
|
+
null}Pa(){return this.f[_.L]||null}bb(){return this.f[_.K]||null}cb(){return this.f[_.J]||null}Ga(){return sL(this,_.L)}na(){return sL(this,_.K)}oa(){return sL(this,_.J)}Ua(a){uL(this,_.L,a)}sa(a){uL(this,_.K,a)}Ba(a){uL(this,_.J,a)}Ta(a){this.Ua(a&&a.track)}ib(a){this.sa(a&&a.track)}jb(a){this.Ba(a&&a.track)}addTextTrack(){return _.y(function*(){})}la(){return!0}};Z.prototype.isAbrEnabled=Z.prototype.la;Z.prototype.addTextTrack=Z.prototype.addTextTrack;Z.prototype.setTextRendition=Z.prototype.jb;
|
|
31
31
|
Z.prototype.setAudioRendition=Z.prototype.ib;Z.prototype.setVideoRendition=Z.prototype.Ta;Z.prototype.setTextTrack=Z.prototype.Ba;Z.prototype.setAudioTrack=Z.prototype.sa;Z.prototype.setVideoTrack=Z.prototype.Ua;Z.prototype.getTextTrack=Z.prototype.oa;Z.prototype.getAudioTrack=Z.prototype.na;Z.prototype.getVideoTrack=Z.prototype.Ga;Z.prototype.getLoadingTextRendition=Z.prototype.cb;Z.prototype.getLoadingAudioRendition=Z.prototype.bb;Z.prototype.getLoadingVideoRendition=Z.prototype.Pa;
|
|
32
|
-
Z.prototype.getTextRendition=Z.prototype.Ea;Z.prototype.getAudioRendition=Z.prototype.Da;Z.prototype.getVideoRendition=Z.prototype.ia;Z.prototype.getTextTracks=Z.prototype.ja;Z.prototype.getAudioTracks=Z.prototype.getAudioTracks;Z.prototype.getVideoTracks=Z.prototype.getVideoTracks;var
|
|
33
|
-
"cast",{get:()=>window.cast_,set:e=>{window.cast_=e;window.setTimeout(()=>{
|
|
34
|
-
if(e)try{yield e.sendMessage(a,
|
|
35
|
-
b;throw new _.H(1,8,8E3,c);}})}
|
|
36
|
-
_.
|
|
37
|
-
this.a.playbackRate||0}setPlaybackRate(a){this.a&&0<a&&this.sendMessage(
|
|
38
|
-
!this.a.media||!this.a.media.metadata)return null;const a=this.a.media.metadata.sectionStartAbsoluteTime;return typeof a!==_.r?null:1E-8===a?0:a}getSeekRange(){let a={start:0,end:this.getDuration()};if(this.isLive()){const b=this.a.getEstimatedLiveSeekableRange();b&&typeof b.start===_.r&&typeof b.end===_.r&&(a={start:b.start,end:b.end})}return a}getState(){return this.h?this.h.getState():_.
|
|
39
|
-
this.getDuration()}load(a){const b=this;return _.y(function*(){if(b.
|
|
40
|
-
a}getLoadedSource(){return this.C[this.B]}getPeriods(){return[]}getDrmInfo(){return null}getTimelineCues(){return[]}resetAbr(){this.j.warn(
|
|
41
|
-
this.bc(Object.assign({},b,{metadataType:c,images:[a]}))}Td(a){const b=this.ab()||{};this.bc(Object.assign({},b,{metadataType:3,artist:a}))}Vd(a){const b=this.ab()||{};a={metadataType:
|
|
42
|
-
a);switch(a.sessionState){case cast.framework.SessionState.SESSION_STARTED:this.A=!0;
|
|
43
|
-
|
|
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}};
|
|
45
|
-
b.f&&b.a){{let d=null;const e=b.f.getLoadedSource();if(e){const f=b.f.getTrackManager(),g=f.getVideoTracks()[0];let h,k;g&&g.mimeType&&(h=g.mimeType);const l=b.f.getConfiguration(),m=f.na();m&&(m.mimeType&&(k=m.mimeType),m.language&&(l.preferredAudioLanguage=m.language),m.roles.length&&(l.preferredAudioRole=m.roles[0]));const n=f.oa();n&&(n.language&&(l.preferredTextLanguage=n.language),n.roles.length&&(l.preferredTextRole=n.roles[0]));const q=e&&typeof e.isLive===_.
|
|
46
|
-
isLive:q,autoplay:!b.f.isPaused(),currentTime:Math.max(b.f.getPosition()-1,0),
|
|
47
|
-
yield b.a.sendMessage(
|
|
48
|
-
|
|
49
|
-
|
|
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.
|
|
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.
|
|
52
|
-
this.a(_.
|
|
53
|
-
null}getMediaUrl(){return this.a.contentUrl||this.a.contentId||null}qb(){return 0}pb(){return 0}eb(){return 0}Qa(){switch(this.
|
|
54
|
-
Y.prototype.getWrapperAdIds=Y.prototype.getWrapperAdIds;Y.prototype.getSequenceLength=Y.prototype.sb;Y.prototype.getPositionInSequence=Y.prototype.
|
|
55
|
-
Y.prototype.isBumper=Y.prototype.
|
|
56
|
-
Y.prototype.getAdManagerVersion=Y.prototype.ob;Y.prototype.getAdManagerName=Y.prototype.nb;var
|
|
57
|
-
this.g)}load(){const a=this;return _.y(function*(){
|
|
58
|
-
switch(a.type){case cast.framework.events.EventType.PLAYER_LOADING:this.a=
|
|
59
|
-
break;case cast.framework.events.EventType.BREAK_CLIP_ENDED:a.endedReason===b.SKIPPED?(
|
|
60
|
-
|
|
61
|
-
_.
|
|
32
|
+
Z.prototype.getTextRendition=Z.prototype.Ea;Z.prototype.getAudioRendition=Z.prototype.Da;Z.prototype.getVideoRendition=Z.prototype.ia;Z.prototype.getTextTracks=Z.prototype.ja;Z.prototype.getAudioTracks=Z.prototype.getAudioTracks;Z.prototype.getVideoTracks=Z.prototype.getVideoTracks;var KL=class extends _.To{constructor(a,b,c,d){super();this.j=new _.P(_.zc);this.U=a;this.o=new _.Yh(b);this.S=c;this.Y=d;this.g=this.I=_.$i();this.C=[];this.B=0;this.K=new _.Em;this.G=this.m=this.a=null;this.A=this.w=!1;this.aa="";this.ga=1E6;this.f=new Z;this.f.initialize(this);this.h=new mM(this);this.H=new _.jo;this.J=null;this.F=new Set;this.N=this.Wa.bind(this);this.ba=this.Za.bind(this);this.W=this.Ya.bind(this);this.R=this.Xa.bind(this);this.L=null;window.cast||Object.defineProperty(window,
|
|
33
|
+
"cast",{get:()=>window.cast_,set:e=>{window.cast_=e;window.setTimeout(()=>{xL(!0)},0)}});wL(this);vL.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 _.y(function*(){})}Nc(a){this.L=a}Wb(){return this.w}gb(){return this.A}xd(){return this.aa}sendMessage(a,b){const c=this;return _.y(function*(){let d;const e=cast.framework.CastContext.getInstance().getCurrentSession();
|
|
34
|
+
if(e)try{yield e.sendMessage(a,kL(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 _.y(function*(){if(!a.Wb())throw a.j.warn(cL),new _.H(1,8,8001,void 0);if(!yL)throw a.j.warn(aL),new _.H(1,8,8002,void 0);if(a.gb())throw a.j.warn("Already casting"),new _.H(1,8,8003,void 0);try{yield AL(a)}catch(b){const c={};b instanceof chrome.cast.Error?(c.detailedErrorCode=b.code,c.details=b.details,c.reason=b.description):c.detailedErrorCode=
|
|
35
|
+
b;throw new _.H(1,8,8E3,c);}})}td(){this.gb()&&cast.framework.CastContext.getInstance().endCurrentSession(!0)}addMessageListener(a){typeof a===_.bd&&this.F.add(a)}removeMessageListener(a){typeof a===_.bd&&this.F.delete(a)}play(){return this.isEnded()?CL(this,!0):new Promise((a,b)=>{if(!this.a)return b($K);this.a.play(null,a,b)})}pause(){return new Promise((a,b)=>{this.isEnded()&&a();if(!this.a)return b($K);this.a.pause(null,a,b)})}isPaused(){return!!this.a&&this.a.playerState===chrome.cast.media.PlayerState.PAUSED}isEnded(){return this.getState()===
|
|
36
|
+
_.wl}seek(a){return this.isEnded()?CL(this,!1,a):new Promise((b,c)=>{this.a||c($K);this.m.isPlayingBreak&&c(YK);const d=new chrome.cast.media.SeekRequest;d.currentTime=a;this.trigger(new _.F(_.Ce));this.a.seek(d,()=>{this.trigger(new _.F(_.Be));b()},c)})}getPosition(){return this.a&&this.a.getEstimatedTime()||0}getDuration(){if(!this.a||!this.a.media)return-1;const a=this.a.media.duration;return typeof a!==_.r?-1:-1===a?Infinity:a}setDrmCustomDataModifier(){}setCdnErrorCallback(){}detach(){}getPlaybackRate(){return this.a&&
|
|
37
|
+
this.a.playbackRate||0}setPlaybackRate(a){this.a&&0<a&&this.sendMessage(iL,{type:"SET_PLAYBACK_RATE",requestId:Math.round(1E3*Math.random()),mediaSessionId:this.a.mediaSessionId,playbackRate:a})}getVolume(){return this.a&&this.a.volume.level}setVolume(a){this.a&&0<=a&&1>=a&&(a=new chrome.cast.media.VolumeRequest(new chrome.cast.Volume(a)),this.a.setVolume(a))}isMuted(){return this.a&&this.a.volume.muted}setMuted(a){this.a&&(a=new chrome.cast.media.VolumeRequest(new chrome.cast.Volume(void 0,a)),this.a.setVolume(a))}getPresentationStartTime(){if(!this.a||
|
|
38
|
+
!this.a.media||!this.a.media.metadata)return null;const a=this.a.media.metadata.sectionStartAbsoluteTime;return typeof a!==_.r?null:1E-8===a?0:a}getSeekRange(){let a={start:0,end:this.getDuration()};if(this.isLive()){const b=this.a.getEstimatedLiveSeekableRange();b&&typeof b.start===_.r&&typeof b.end===_.r&&(a={start:b.start,end:b.end})}return a}getState(){return this.h?this.h.getState():_.np}getStats(){return this.a&&this.a.customData&&this.a.customData.stats?lL(this.a.customData.stats):_.rl()}isLive(){return Infinity===
|
|
39
|
+
this.getDuration()}load(a){const b=this;return _.y(function*(){if(b.Wb())if(yL){b.C=_.Kl(a);_.cj(a)&&(b.g=_.bj(b.I,a));var c=b.C[b.B];yield BL(b,{source:c,isLive:c.isLive,autoplay:b.g.autoplay,Ma:b.g,zb:c.zb,audioMimeType:c.audioMimeType})}else b.j.warn(aL);else b.j.warn(cL)})}getBufferInfo(){return new _.So}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(bL)}onError(a){if(a&&(this.trigger(new _.F(_.$c,{detail:a})),this.h))this.h.onError(a)}namespace(){return _.zc}canPlay(){return this.Wb()?2:0}ab(){return this.J}bc(a){this.J=FL(a)}pd(){this.J=null}Wd(a){const b=this.ab()||{};a={metadataType:DL(b.metadataType),title:a};this.bc(Object.assign({},b,a))}Ud(a){const b=this.ab()||{},c=DL(b.metadataType);a=new chrome.cast.Image(a);
|
|
41
|
+
this.bc(Object.assign({},b,{metadataType:c,images:[a]}))}Td(a){const b=this.ab()||{};this.bc(Object.assign({},b,{metadataType:3,artist:a}))}Vd(a){const b=this.ab()||{};a={metadataType:DL(b.metadataType),releaseDate:a};this.bc(Object.assign({},b,a))}Wa(a){const b=cast.framework.CastContext.getInstance(),c=a.castState===cast.framework.CastState.CONNECTED;yL=a.castState!==cast.framework.CastState.NO_DEVICES_AVAILABLE;this.aa=c?b.getCurrentSession().getCastDevice().friendlyName:"";this.o.$d()}Za(a){this.j.debug(`state: ${a.sessionState}, details:`,
|
|
42
|
+
a);switch(a.sessionState){case cast.framework.SessionState.SESSION_STARTED:this.A=!0;IL(this,a.session);break;case cast.framework.SessionState.SESSION_RESUMED:this.gb()||(this.A=!0,IL(this,a.session),this.Y());break;case cast.framework.SessionState.SESSION_ENDED:if(this.gb()&&this.a){const d=this.a.media;var b=this.f.na(),c=this.f.oa();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:JL(this),Ue:c,
|
|
43
|
+
ke:b})}a.session.removeEventListener(cast.framework.SessionEventType.MEDIA_SESSION,this.W);a.session.removeMessageListener(hL,this.R);this.A=!1;this.a=null;this.H.release();this.m=this.G=null}}Ya(a){this.j.debug("New media session",a.mediaSession);HL(this,a.mediaSession)}Xa(a,b){if(a===hL&&0<this.F.size){const c=lL(b);this.F.forEach(d=>d(c))}}ma(){this.trigger(new _.F(_.ue))}Ka(a){const b=this;return _.y(function*(){let c=null;const d=yield mL(a,[_.se,_.Yb],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}};KL.prototype.getTextDisplayer=KL.prototype.getTextDisplayer;KL.prototype.getNetworkEngine=KL.prototype.getNetworkEngine;KL.prototype.setNetworkEngine=KL.prototype.setNetworkEngine;var yL=!1,vL=new Set;window.__onGCastApiAvailable=xL;var nM=class extends _.To{constructor(a,b,c){super();this.f=a;this.h=b;this.j=typeof c===_.bd?c:(d,e)=>{this.f&&d!==_.wl&&d!==_.El&&this.f.load(e)};this.a=ML(this);this.g=new _.P(eL);this.addDelegate(this.f)}destroy(){const a=this;return _.y(function*(){a.a&&(yield zL(a.a),a.a=null);a.removeDelegate(a.f)})}md(){return!!this.a&&this.a.Wb()&&yL}gb(){return!!this.a&&this.a.gb()}xd(){return this.a?this.a.xd():""}Nc(a){this.a&&this.a.Nc(a)}cast(a){const b=this;return _.y(function*(){if(b.a)try{if(yield b.a.cast(),
|
|
45
|
+
b.f&&b.a){{let d=null;const e=b.f.getLoadedSource();if(e){const f=b.f.getTrackManager(),g=f.getVideoTracks()[0];let h,k;g&&g.mimeType&&(h=g.mimeType);const l=b.f.getConfiguration(),m=f.na();m&&(m.mimeType&&(k=m.mimeType),m.language&&(l.preferredAudioLanguage=m.language),m.roles.length&&(l.preferredAudioRole=m.roles[0]));const n=f.oa();n&&(n.language&&(l.preferredTextLanguage=n.language),n.roles.length&&(l.preferredTextRole=n.roles[0]));const q=e&&typeof e.isLive===_.hc?e.isLive:b.f.isLive();d={source:e,
|
|
46
|
+
isLive:q,autoplay:!b.f.isPaused(),currentTime:Math.max(b.f.getPosition()-1,0),Rd:b.f.getPresentationStartTime(),zb:h,audioMimeType:k,Ma:l}}var c=d}yield LL(b);b.a&&(c&&(c.autoplay=!b.f.isPaused()),a?yield b.f.load(a):b.a.a||(yield BL(b.a,c)))}}catch(d){b.g.error("Error while trying to cast",d),c=new _.F(_.$c,{detail:d}),b.trigger(c)}})}td(){this.a&&this.a.td()}nf(a){const b=this;return _.y(function*(){a!==b.h&&(b.h=a,b.a&&(yield zL(b.a)),b.a=ML(b))})}sendMessage(a){const b=this;return _.y(function*(){b.a?
|
|
47
|
+
yield b.a.sendMessage(hL,a):b.g.warn(dL)})}addMessageListener(a){this.a?this.a.addMessageListener(a):this.g.warn(dL)}removeMessageListener(a){this.a?this.a.removeMessageListener(a):this.g.warn(dL)}ab(){return this.a&&this.a.ab()}bc(a){this.a&&this.a.bc(a)}pd(){this.a&&this.a.pd()}Wd(a){this.a&&this.a.Wd(a)}Ud(a){this.a&&this.a.Ud(a)}Td(a){this.a&&this.a.Td(a)}Vd(a){this.a&&this.a.Vd(a)}};_.A(eL,nM);nM.prototype.setContentReleaseDate=nM.prototype.Vd;nM.prototype.setContentArtist=nM.prototype.Td;
|
|
48
|
+
nM.prototype.setContentImage=nM.prototype.Ud;nM.prototype.setContentTitle=nM.prototype.Wd;nM.prototype.clearContentMetadata=nM.prototype.pd;nM.prototype.setContentMetadata=nM.prototype.bc;nM.prototype.getContentMetadata=nM.prototype.ab;nM.prototype.removeMessageListener=nM.prototype.removeMessageListener;nM.prototype.addMessageListener=nM.prototype.addMessageListener;nM.prototype.sendMessage=nM.prototype.sendMessage;nM.prototype.changeReceiverId=nM.prototype.nf;nM.prototype.forceDisconnect=nM.prototype.td;
|
|
49
|
+
nM.prototype.cast=nM.prototype.cast;nM.prototype.setPlayerConfigInterceptor=nM.prototype.Nc;nM.prototype.getReceiverName=nM.prototype.xd;nM.prototype.isCasting=nM.prototype.gb;nM.prototype.canCast=nM.prototype.md;nM.prototype.destroy=nM.prototype.destroy;var oM=class extends lM{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.Y.bind(this);this.K=this.W.bind(this);this.J=this.U.bind(this);this.L=this.ga.bind(this);this.G=this.ba.bind(this);this.F=this.T.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,
|
|
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.G);b.addEventListener(a.ERROR,this.F);b.addEventListener(a.BITRATE_CHANGED,this.g)}destroy(){const a=this,b=()=>Object.getPrototypeOf(Object.getPrototypeOf(this)).destroy;return _.y(function*(){const c=cast.framework.events.EventType,d=cast.framework.CastReceiverContext.getInstance().getPlayerManager();
|
|
51
|
+
d.removeEventListener(c.PLAYING,a.I);d.removeEventListener(c.PAUSE,a.H);d.removeEventListener(c.MEDIA_FINISHED,a.A);d.removeEventListener(c.BUFFERING,a.w);d.removeEventListener(c.SEEKING,a.K);d.removeEventListener(c.SEEKED,a.J);d.removeEventListener(c.STALLED,a.L);d.removeEventListener(c.PLAYER_LOADING,a.G);d.removeEventListener(c.ERROR,a.F);d.removeEventListener(c.BITRATE_CHANGED,a.g);yield b().call(a)})}S(){this.f.trigger(new _.F(_.Rd));this.a(_.Hl)}R(){this.a(_.Gl)}aa(){this.a(_.wl)}Y(a){a.isBuffering?
|
|
52
|
+
this.a(_.zl):(a=this.f.isPaused()?_.Gl:_.Hl,this.a(a))}W(){this.j=1;this.f.trigger(new _.F(_.Ce))}U(){this.f.trigger(new _.F(_.Be))}ga(){this.j=2}ba(){this.a(_.Fl)}N(a){const b=this.f.getStats();this.f.trigger(new _.F(_.gc,{detail:{bandwidth:a.totalBitrate,width:b.width,height:b.height}}))}T(a){a=new _.H(_.G,7,7300,{detailedErrorCode:a.detailedErrorCode,error:a.error,reason:a.reason});this.f.trigger(new _.F(_.$c,{detail:a}));this.a(_.Dl)}};var Y=class{constructor(a,b,c,d,e){this.a=a;this.f=b;this.h=typeof c===_.r?c:1;this.j=typeof d===_.r?d:1;this.g=typeof e===_.r?e:0}nb(){return"Google Cast Framework"}ob(){return cast.framework.VERSION}tb(){return 0}getId(){return""}getCreativeId(){return""}getApiFramework(){return null}getAdSystem(){return""}getAdvertiserName(){return""}getTitle(){return this.a.title||""}getDuration(){return this.a.duration||0}getSkipTimeOffset(){return this.a.whenSkippable||0}Yb(){return!1}Fb(){return this.a.clickThroughUrl||
|
|
53
|
+
null}getMediaUrl(){return this.a.contentUrl||this.a.contentId||null}qb(){return 0}pb(){return 0}eb(){return 0}Qa(){switch(this.Gb()){case 0:return 0;case -1:return 2;default:return 1}}getPodIndex(){return this.g}Gb(){return this.f.position}Hb(){return this.h}sb(){return this.j}getWrapperAdIds(){return[]}getWrapperAdSystems(){return[]}getWrapperCreativeIds(){return[]}};Y.prototype.getWrapperCreativeIds=Y.prototype.getWrapperCreativeIds;Y.prototype.getWrapperAdSystems=Y.prototype.getWrapperAdSystems;
|
|
54
|
+
Y.prototype.getWrapperAdIds=Y.prototype.getWrapperAdIds;Y.prototype.getSequenceLength=Y.prototype.sb;Y.prototype.getPositionInSequence=Y.prototype.Hb;Y.prototype.getPodTimeOffset=Y.prototype.Gb;Y.prototype.getPodIndex=Y.prototype.getPodIndex;Y.prototype.getPodType=Y.prototype.Qa;Y.prototype.getMediaBitrate=Y.prototype.eb;Y.prototype.getMediaHeight=Y.prototype.pb;Y.prototype.getMediaWidth=Y.prototype.qb;Y.prototype.getMediaUrl=Y.prototype.getMediaUrl;Y.prototype.getClickThroughUrl=Y.prototype.Fb;
|
|
55
|
+
Y.prototype.isBumper=Y.prototype.Yb;Y.prototype.getSkipTimeOffset=Y.prototype.getSkipTimeOffset;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;Y.prototype.getCreativeId=Y.prototype.getCreativeId;Y.prototype.getId=Y.prototype.getId;Y.prototype.getTechnology=Y.prototype.tb;
|
|
56
|
+
Y.prototype.getAdManagerVersion=Y.prototype.ob;Y.prototype.getAdManagerName=Y.prototype.nb;var pM=class{constructor(a){this.a=a}getCuePoints(){return this.a.map(a=>a.position)}Ib(){return!!this.a.find(a=>0===a.position)}fb(){return!!this.a.find(a=>-1===a.position)}};pM.prototype.hasPostroll=pM.prototype.fb;pM.prototype.hasPreroll=pM.prototype.Ib;pM.prototype.getCuePoints=pM.prototype.getCuePoints;var qM=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];RL().addEventListener(this.f,
|
|
57
|
+
this.g)}load(){const a=this;return _.y(function*(){NL&&(NL=!1,QL(a,0))})}start(){return _.y(function*(){RL().play()})}resume(){-1!==this.getPosition()&&RL().play()}pause(){-1!==this.getPosition()&&RL().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===_.r?a:-1}dispose(){const a=this;return _.y(function*(){RL().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=RL().getBreakManager();this.a.setPlayWatchedBreak(!0);a=this.a.getBreaks();this.l.trigger(new _.F(_.Nb,{adsTimeline:new pM(a)}));break;case cast.framework.events.EventType.BREAK_CLIP_LOADING:TL(this,_.Db,a);break;case cast.framework.events.EventType.BREAK_STARTED:TL(this,_.wb,a);break;case cast.framework.events.EventType.BREAK_ENDED:TL(this,_.xb,a);break;case cast.framework.events.EventType.BREAK_CLIP_STARTED:TL(this,_.Jb,a);
|
|
59
|
+
break;case cast.framework.events.EventType.BREAK_CLIP_ENDED:a.endedReason===b.SKIPPED?(TL(this,_.Ib,a),TL(this,_.Kb,a)):a.endedReason===b.STOPPED?TL(this,_.Kb,a):a.endedReason===b.END_OF_STREAM?(TL(this,_.Ab,a),TL(this,_.Kb,a)):a.endedReason===b.ERROR&&QL(this,1);break;case cast.framework.events.EventType.PLAYING:TL(this,_.Hb,a);break;case cast.framework.events.EventType.PAUSE:TL(this,_.Fb,a);break;case cast.framework.events.EventType.BUFFERING:a.isBuffering?TL(this,_.yb,a):TL(this,_.Hb,a)}}};
|
|
60
|
+
qM.prototype.getPosition=qM.prototype.getPosition;qM.prototype.setVolume=qM.prototype.setVolume;qM.prototype.getVolume=qM.prototype.getVolume;qM.prototype.skip=qM.prototype.skip;qM.prototype.pause=qM.prototype.pause;qM.prototype.resume=qM.prototype.resume;var NL=!1;var rM=class{constructor(a){this.Nb=a;this.a=this.f.bind(this)}init(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().addEventListener(UL(),this.a)}release(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().removeEventListener(UL(),this.a)}getTimelineCues(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager().getTimedMetadata().map(a=>VL(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
|
+
_.Rf;break;case cast.framework.events.EventType.TIMED_METADATA_ENTER:b=_.Tf;break;case cast.framework.events.EventType.TIMED_METADATA_EXIT:b=_.Uf}b&&this.Nb(new _.F(b,{detail:VL(a.timedMetadataInfo)}))}else for(b of this.getTimelineCues())this.Nb(new _.F(_.Rf,{detail:b}))}};var sM=class extends _.Q{constructor(){super();this.g=new _.P("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;WL().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;WL().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.m)}getVideoTracks(){return[]}getAudioTracks(){return this.h}ja(){return this.j}ia(){return null}Da(){const a=
|
|
62
62
|
this.na();return a&&a.renditions[0]}Ea(){const a=this.oa();return a&&a.renditions[0]}Pa(){return null}bb(){return null}cb(){return null}Ga(){return null}na(){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}oa(){let a=null;if(this.a){let b=this.a.getActiveIds()[0];typeof b===_.r&&(b=b.toString(),a=this.ja().find(c=>c.id===b)||null)}return a}Ua(){this.g.warn("Video tracks unavailable on Cast")}sa(a){a&&this.f&&
|
|
63
|
-
this.f.setActiveById(+a.id)}Ba(a){this.a&&(a?this.a.setActiveByIds([+a.id]):this.a.setActiveByIds([]))}Ta(){this.g.warn("Video renditions unavailable on Cast")}ib(a){this.sa(a&&a.track)}jb(a){this.Ba(a&&a.track)}addTextTrack(a){const b=this;return _.y(function*(){var c=b.l.getConfiguration();if((c=yield
|
|
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]),
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
cast.framework.messages.PlayerState,b
|
|
68
|
-
a.play();return Promise.resolve()}pause(){const a
|
|
69
|
-
|
|
70
|
-
null}getLoadedSource(){const a
|
|
71
|
-
b&&typeof b.start===_.r&&typeof b.end===_.r&&(a={start:b.start,end:b.end})}return a}getState(){return this.a?this.a.getState():_.
|
|
72
|
-
this;return _.y(function*(){b.f=new _.
|
|
73
|
-
a}getNetworkEngine(){return this.F}getSourceIndex(){return this.j}setSourceIndex(a){this.j=a}getPeriods(){return[]}namespace(){return
|
|
74
|
-
b&&(this.A.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
|
|
75
|
-
a=Object.assign({},a,{media:b})}}return a}G(a,b){let c=null;a.media.customData&&(c=
|
|
76
|
-
|
|
77
|
-
c.customNamespaces={};c.customNamespaces[
|
|
78
|
-
this.A);a.start(c);a.addCustomMessageListener(
|
|
79
|
-
b){
|
|
80
|
-
1;0<=f;--f){var g=e[f].getAttribute("contentType");if(g===_.w||g===_.p){g=e[f].getAttribute(_.ud);var h=e[f].getElementsByTagName(_
|
|
81
|
-
(new XMLSerializer).serializeToString(a)}if(c=b.getElementsByTagName(_.
|
|
82
|
-
(new XMLSerializer).serializeToString(a)}return a}C(a){const b=this;return _.y(function*(){let c=a;var d;c.media.customData&&(d=
|
|
83
|
-
d.url,c.media.contentType=d.type,d.
|
|
84
|
-
c=b.getLiveSeekableRange();if(c){a=c.start;c=c.end;var d=this.l.getConfiguration().startTime;typeof a!==_.r||typeof c!==_.r||typeof d!==_.r||d>=a&&d<=c||(b=b.getMediaTimeForAbsoluteTime(d),typeof b===_.r&&b>=a&&b<=c&&this.l.seek(b))}_.
|
|
85
|
-
|
|
86
|
-
this.a.isPlayingBreak&&this.a.isPaused&&this.a.controller.playOrPause()}pause(){this.a&&this.a.isPlayingBreak&&!this.a.isPaused&&this.a.controller.playOrPause()}skip(){const a=this.f.a;a&&this.f.sendMessage(
|
|
87
|
-
return _.y(function*(){a.g.release()})}j(a){switch(a.field){case "mediaInfo":a.value&&(a=a.value,a.breaks&&this.f.trigger(new _.F(_.
|
|
88
|
-
|
|
63
|
+
this.f.setActiveById(+a.id)}Ba(a){this.a&&(a?this.a.setActiveByIds([+a.id]):this.a.setActiveByIds([]))}Ta(){this.g.warn("Video renditions unavailable on Cast")}ib(a){this.sa(a&&a.track)}jb(a){this.Ba(a&&a.track)}addTextTrack(a){const b=this;return _.y(function*(){var c=b.l.getConfiguration();if((c=yield mL(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]),YL(b)}catch(e){throw b.g.warn("failed on track",a),e;}}})}la(){return!0}w(){this.f=WL().getAudioTracksManager();var a=this.f.getTracks();this.h=XL(_.K,a);YL(this);a=this.l.getConfiguration();ZL(this,_.K,a.preferredAudioLanguage,a.preferredAudioRole);ZL(this,_.J,a.preferredTextLanguage,a.preferredTextRole)}};sM.prototype.isAbrEnabled=sM.prototype.la;
|
|
65
|
+
sM.prototype.addTextTrack=sM.prototype.addTextTrack;sM.prototype.setTextRendition=sM.prototype.jb;sM.prototype.setAudioRendition=sM.prototype.ib;sM.prototype.setVideoRendition=sM.prototype.Ta;sM.prototype.setTextTrack=sM.prototype.Ba;sM.prototype.setAudioTrack=sM.prototype.sa;sM.prototype.setVideoTrack=sM.prototype.Ua;sM.prototype.getTextTrack=sM.prototype.oa;sM.prototype.getAudioTrack=sM.prototype.na;sM.prototype.getVideoTrack=sM.prototype.Ga;sM.prototype.getLoadingTextRendition=sM.prototype.cb;
|
|
66
|
+
sM.prototype.getLoadingAudioRendition=sM.prototype.bb;sM.prototype.getLoadingVideoRendition=sM.prototype.Pa;sM.prototype.getTextRendition=sM.prototype.Ea;sM.prototype.getAudioRendition=sM.prototype.Da;sM.prototype.getVideoRendition=sM.prototype.ia;sM.prototype.getTextTracks=sM.prototype.ja;sM.prototype.getAudioTracks=sM.prototype.getAudioTracks;sM.prototype.getVideoTracks=sM.prototype.getVideoTracks;var tM=class extends _.To{constructor(){super();this.A=new _.P(fL);this.g=this.o=_.$i();this.w=null;this.j=-1;this.F=new _.Em;this.f=this.m=this.h=this.a=this.B=null;this.C=!1}init(a,b){this.B=a;b&&(this.g=this.o=b);a=$L();a.setMessageInterceptor(cast.framework.messages.MessageType.MEDIA_STATUS,this.H.bind(this));a.setMediaPlaybackInfoHandler(this.G.bind(this));this.a=new oM(this);this.a.init();this.h=new sM;this.h.initialize(this);this.m=new rM(c=>this.trigger(c));this.m.init()}unload(){const a=
|
|
67
|
+
cast.framework.messages.PlayerState,b=$L();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 _.y(function*(){a.B=null;a.o=_.$i();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=$L();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot play during ads playout.");
|
|
68
|
+
a.play();return Promise.resolve()}pause(){const a=$L();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot pause during ads playout.");a.pause();return Promise.resolve()}isPaused(){return $L().getPlayerState()===cast.framework.messages.PlayerState.PAUSED}isEnded(){return $L().getPlayerState()===cast.framework.messages.PlayerState.IDLE}seek(a){const b=$L();if(null!==b.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject(YK);b.seek(a);return Promise.resolve()}getPosition(){return $L().getCurrentTimeSec()}getDuration(){const a=
|
|
69
|
+
$L().getDurationSec();return typeof a===_.r?-1===a?Infinity:a:-1}getPlaybackRate(){return $L().getPlaybackRate()}setPlaybackRate(a){if(0<a){const b=new cast.framework.messages.SetPlaybackRateRequestData;b.playbackRate=a;$L().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=$L().getMediaInformation();if(a){var b=$L().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,Dg:b,name:c}}return null}getDrmInfo(){return null}getPresentationStartTime(){return $L().getStartAbsoluteTime()}getSeekRange(){let a={start:0,end:this.getDuration()};if(this.isLive()){const b=$L().getLiveSeekableRange();
|
|
71
|
+
b&&typeof b.start===_.r&&typeof b.end===_.r&&(a={start:b.start,end:b.end})}return a}getState(){return this.a?this.a.getState():_.np}getStats(){var a=_.rl();if(this.f){a=$L().getStats();this.f.f=a.estimatedBandwidth||NaN;this.f.m=a.streamBandwidth||NaN;var b=this.f,c=a.height||NaN;b.o=a.width||NaN;b.g=c;b=this.f;c=typeof a.decodedFrames===_.r?a.decodedFrames:NaN;b.j=typeof a.droppedFrames===_.r?a.droppedFrames:NaN;b.h=c;a=this.f.getStats()}return a}isLive(){return Infinity===this.getDuration()}load(a){const b=
|
|
72
|
+
this;return _.y(function*(){b.f=new _.lp;b.a.m=b.f.a;b.w=_.Kl(a);_.cj(a)&&(b.g=_.bj(b.o,a));if(b.C)b.C=!1;else{var c=b.w[b.j],d=new cast.framework.messages.LoadRequestData;d.autoplay=b.g.autoplay;typeof b.g.startTime===_.r&&(d.currentTime=b.g.startTime);c.type&&(d.media.contentType=c.type);d.media.contentId=c.url;d.media.customData={playerConfiguration:kL(b.g),local:!0};yield $L().load(d)}})}getBufferInfo(){this.A.warn(_.la);return new _.So}getTrackManager(){return this.h}getConfiguration(){return this.g}getSurface(){return this.B}setNetworkEngine(a){this.F=
|
|
73
|
+
a}getNetworkEngine(){return this.F}getSourceIndex(){return this.j}setSourceIndex(a){this.j=a}getPeriods(){return[]}namespace(){return fL}getTimelineCues(){return this.m&&this.m.getTimelineCues()||[]}resetAbr(){this.A.warn(bL)}onError(a){a=new _.F(_.$c,{detail:a});this.trigger(a)}canPlay(){return _.ki()?2:0}H(a){a=Object.assign({},a);a.customData||(a.customData={});a.customData.stats=kL(this.getStats());var b=$L(),c=a.media||b.getMediaInformation();b=b.getStartAbsoluteTime();c&&typeof b===_.r&&c.startAbsoluteTime!==
|
|
74
|
+
b&&(this.A.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=$L().getStartAbsoluteTime();if(typeof d===_.r){b.startAbsoluteTime=d;let h;f?h=new cast.framework.messages.GenericMediaMetadata:h=b.metadata;h.sectionStartAbsoluteTime=d;b.metadata=h}b.streamType=c.LIVE;
|
|
75
|
+
a=Object.assign({},a,{media:b})}}return a}G(a,b){let c=null;a.media.customData&&(c=lL(a.media.customData.playerConfiguration));(a=c?c.abr:null)&&typeof a.defaultBandwidthEstimate===_.r?b.initialBandwidth=a.defaultBandwidthEstimate:b.initialBandwidth=void 0;cM(c,b);return b}getTextDisplayer(){return null}setDrmCustomDataModifier(){}setCdnErrorCallback(){}detach(){}};tM.prototype.getTextDisplayer=tM.prototype.getTextDisplayer;tM.prototype.getNetworkEngine=tM.prototype.getNetworkEngine;
|
|
76
|
+
tM.prototype.setNetworkEngine=tM.prototype.setNetworkEngine;var eM=class{constructor(){this.a=!1;this.h=new _.P(gL);this.f=this.l=null;this.g=new Set;this.A=this.G.bind(this);this.w=this.B.bind(this);this.j=null;this.o=new _.jo;this.m=null}init(a){a&&(this.f=new tM,_.Nm(a,this.f),this.l=a,this.o.on(window,"unload",()=>{const b=this;return _.y(function*(){b.l&&b.l.getState()!==_.El&&(yield jL(b.l))})}))}start(){if(!this.a&&window.cast&&cast.framework&&cast.framework.CastReceiverContext){this.a=!0;var a=gM(),b=gM().getPlayerManager(),c=new cast.framework.CastReceiverOptions;
|
|
77
|
+
c.customNamespaces={};c.customNamespaces[hL]=cast.framework.system.MessageType.JSON;c.shakaVersion="4.3.4";var d=new cast.framework.PlaybackConfig;d.manifestHandler=this.F.bind(this);d.shakaConfig={streaming:{ignoreTextStreamFailures:!0}};d.enableSmoothLiveRefresh=!0;c.playbackConfig=d;if(d=this.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,
|
|
78
|
+
this.A);a.start(c);a.addCustomMessageListener(hL,this.w)}}stop(){if(this.a){this.a=!1;this.o.release();const a=gM();gM().getPlayerManager().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.A);a.removeCustomMessageListener(hL,this.w);a.stop();this.l=this.f=null}}Nc(a){this.j=a}gg(a){this.m=a}on(a,b){gM().addEventListener(a,b)}off(a,b){gM().removeEventListener(a,b)}addMessageListener(a){typeof a===_.bd&&this.g.add(a)}removeMessageListener(a){typeof a===_.bd&&this.g.delete(a)}sendMessage(a,
|
|
79
|
+
b){gM().sendCustomMessage(hL,b,kL(a))}Wb(){return this.a}ab(){var a;return a=(a=gM().getPlayerManager().getMediaInformation())&&a.metadata?a.metadata:null}F(a){a=a.trim();if(a.startsWith("#EXTM3U"))return iM(this,a);try{var b=(new DOMParser).parseFromString(a,_.te)}catch(k){return a}var c=b.getElementsByTagName("MPD")[0];if(c){a=c;this.h.debug("Detected DASH, parsing");b=gM();c=a.getElementsByTagName("Period");for(var d=c.length-1;0<=d;--d){var e=c[d].getElementsByTagName(_.ea);for(var f=e.length-
|
|
80
|
+
1;0<=f;--f){var g=e[f].getAttribute("contentType");if(g===_.w||g===_.p){g=e[f].getAttribute(_.ud);var h=e[f].getElementsByTagName(_.$a);for(let k=h.length-1;0<=k;--k){const l=h[k].getAttribute(_.ud)||g,m=h[k].getAttribute(_.Ec);let n=h[k].getAttribute(_.We)||void 0,q=h[k].getAttribute(_.cd)||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(_.$a).length||c[d].removeChild(e[f])}}c[d].getElementsByTagName(_.ea).length||a.removeChild(c[d])}return a=
|
|
81
|
+
(new XMLSerializer).serializeToString(a)}if(c=b.getElementsByTagName(_.ib)[0]){a=c;this.h.debug("Detected Smooth, parsing");b=gM();c=a.getElementsByTagName("StreamIndex");for(d=c.length-1;0<=d;--d)if(c[d].getAttribute("Type")===_.w){e=c[d].getElementsByTagName(_.Xa);for(f=e.length-1;0<=f;--f)g=e[f].getAttribute(_.Ka)||void 0,h=e[f].getAttribute(_.Ja)||void 0,void 0!==g&&(g=+g),void 0!==h&&(h=+h),b.canDisplayType(_.Je,void 0,g,h)||c[d].removeChild(e[f]);c[d].getElementsByTagName(_.Xa).length||a.removeChild(c[d])}a=
|
|
82
|
+
(new XMLSerializer).serializeToString(a)}return a}C(a){const b=this;return _.y(function*(){let c=a;var d;c.media.customData&&(d=lL(c.media.customData.playerConfiguration));if(b.l&&d){b.j&&(d=(yield Promise.resolve(b.j(d)))||d);d.ima&&(yield PL(c.media,d.ima,b.l.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 _.Um(b.l,d),yield _.Vm(b.l),d=b.l.getLoadedSource(),c.media.contentId=
|
|
83
|
+
d.url,c.media.contentType=d.type,d.zb&&(c.media.hlsVideoSegmentFormat=nL(d.zb,_.L)),d.audioMimeType&&(c.media.hlsSegmentFormat=nL(d.audioMimeType,_.K)));const e=c.media.metadata;e&&typeof e.sectionStartAbsoluteTime===_.r&&(d=e.sectionStartAbsoluteTime,e.sectionStartAbsoluteTime=0===d?1E-8:d);void 0===c.autoplay&&(c.autoplay=b.l.getConfiguration().autoplay)}b.m&&(d=yield Promise.resolve(b.m(c)))&&(c=d);return c})}G(a){if(this.l&&(!a.media.customData||!a.media.customData.local)){var b=gM().getPlayerManager(),
|
|
84
|
+
c=b.getLiveSeekableRange();if(c){a=c.start;c=c.end;var d=this.l.getConfiguration().startTime;typeof a!==_.r||typeof c!==_.r||typeof d!==_.r||d>=a&&d<=c||(b=b.getMediaTimeForAbsoluteTime(d),typeof b===_.r&&b>=a&&b<=c&&this.l.seek(b))}_.Xm(this.l)}}B(a){if(0<this.g.size){const b=lL(a.data);this.g.forEach(c=>c(b))}}};_.A(gL,eM);eM.prototype.getContentMetadata=eM.prototype.ab;eM.prototype.isApiReady=eM.prototype.Wb;eM.prototype.sendMessage=eM.prototype.sendMessage;eM.prototype.removeMessageListener=eM.prototype.removeMessageListener;
|
|
85
|
+
eM.prototype.addMessageListener=eM.prototype.addMessageListener;eM.prototype.off=eM.prototype.off;eM.prototype.on=eM.prototype.on;eM.prototype.setLoadRequestDataInterceptor=eM.prototype.gg;eM.prototype.setPlayerConfigInterceptor=eM.prototype.Nc;eM.prototype.stop=eM.prototype.stop;eM.prototype.start=eM.prototype.start;eM.prototype.init=eM.prototype.init;eM.getInstance=fM;var dM=null;var uM=class{constructor(a){this.f=a;this.a=null;this.g=new _.jo;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 _.y(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 _.y(function*(){})}resume(){this.a&&
|
|
86
|
+
this.a.isPlayingBreak&&this.a.isPaused&&this.a.controller.playOrPause()}pause(){this.a&&this.a.isPlayingBreak&&!this.a.isPaused&&this.a.controller.playOrPause()}skip(){const a=this.f.a;a&&this.f.sendMessage(iL,{type:"SKIP_AD",requestId:Math.round(1E3*Math.random()),mediaSessionId:a.mediaSessionId})}getVolume(){return this.f.getVolume()||0}setVolume(a){this.f.setVolume(a)}getPosition(){let a=-1;var b=this.f.a;b&&(b=b.getEstimatedBreakClipTime(),typeof b===_.r&&(a=b));return a}dispose(){const a=this;
|
|
87
|
+
return _.y(function*(){a.g.release()})}j(a){switch(a.field){case "mediaInfo":a.value&&(a=a.value,a.breaks&&this.f.trigger(new _.F(_.Nb,{adsTimeline:new pM(a.breaks)})));break;case "isPlayingBreak":a.value?kM(this,_.wb):(kM(this,_.Ab),kM(this,_.Kb),kM(this,_.xb));break;case "currentBreakClipNumber":0<=a.value&&(0<a.value&&(kM(this,_.Ab),kM(this,_.Kb)),kM(this,_.Jb));break;case "isPaused":this.a.isPlayingBreak&&(a.value?kM(this,_.Fb):kM(this,_.Hb))}}};uM.prototype.getPosition=uM.prototype.getPosition;
|
|
88
|
+
uM.prototype.setVolume=uM.prototype.setVolume;uM.prototype.getVolume=uM.prototype.getVolume;uM.prototype.skip=uM.prototype.skip;uM.prototype.pause=uM.prototype.pause;uM.prototype.resume=uM.prototype.resume;var vM=class{name(){return"clpp.cast.ads.SenderAdsManagerFactory"}da(a,b){return a.namespace()!==_.zc?!1:!(!b||!b.ima)}create(a){return new uM(a.a)}};vM.prototype.create=vM.prototype.create;vM.prototype.isSupported=vM.prototype.da;vM.prototype.name=vM.prototype.name;_.Yl(new vM);var wM=class{name(){return"clpp.cast.ads.AdsManagerFactory"}da(a,b){return fM().Wb()?!(!b||!b.ima):!1}create(a){return new qM(a)}};wM.prototype.create=wM.prototype.create;wM.prototype.isSupported=wM.prototype.da;wM.prototype.name=wM.prototype.name;_.Yl(new wM);};f.call(g, window);
|
package/cl.conviva.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
_.
|
|
3
|
-
c);h(Conviva.Constants.DeviceMetadata.OS_NAME,e);h(Conviva.Constants.DeviceMetadata.OS_VERSION,b);h(Conviva.Constants.DeviceMetadata.CATEGORY,a.deviceCategory||d);h(Conviva.Constants.DeviceMetadata.BRAND,a.deviceBrand||f);return g},
|
|
4
|
-
|
|
5
|
-
Conviva.Constants.AdType.SERVER_SIDE,e["c3.ad.adManagerName"]=
|
|
6
|
-
a.getId(),c=a.getWrapperAdSystems().slice(-1)[0]||a.getAdSystem(),a=a.getWrapperCreativeIds().slice(-1)[0]||a.getCreativeId(),e["c3.ad.firstAdId"]=
|
|
7
|
-
a.g.on(a.l,_.
|
|
8
|
-
|
|
9
|
-
d;a.a.setAdPlayerInfo(e);a.a.reportAdStarted(c)}}catch(c){a.f.error("Could not create ad analytics session",c)}}},
|
|
10
|
-
b.connectionType);a.f=Conviva.Analytics.buildVideoAnalytics();a.o=!1;b={};b[Conviva.Constants.FRAMEWORK_NAME]=_.
|
|
11
|
-
new _.
|
|
12
|
-
h);if(h=a.l.getStats()){h=h.decodedFrames;const k=h-a.H;a.H=h;isFinite(k)&&(a.a.debug("Current FPS",k),a.f.reportPlaybackMetric(Conviva.Constants.Playback.RENDERED_FRAMERATE,k))}}});a.C=!0;a.h=!0;a.I=!1;0<a.j.length&&(a.a.debug("Report deferred events"),a.j.forEach(h=>{h.
|
|
13
|
-
a.f&&(a.f.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED),a.f.reportPlaybackEnded(),a.f.release(),Conviva.Analytics.release(),a.o=!0,a.C=!1,a.A=!1,a.h=!1,a.w=null,a.B=!1,a.R=0,a.J=!1,a.j=[],a.H=0)},
|
|
14
|
-
a.h.debug("Conviva does not report when casting.")):a.h.warn("Conviva plugin is loaded but not configured. Will do nothing.")},
|
|
15
|
-
a=a.ad;this.j||(this.f.warn("Ad load event was not triggered. This will have incidence on VSF"),
|
|
16
|
-
break;case _.
|
|
17
|
-
const b=a.ad,c=()=>{this.j=!0;
|
|
18
|
-
this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_THIRD_QUARTILE)}},
|
|
19
|
-
_.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
break;case _.
|
|
23
|
-
a.bandwidth/1E3),(a=a.rendition)&&a.track&&(a=a.track)&&a.frameRate){const b={};b[Conviva.Constants.ENCODED_FRAMERATE]=a.frameRate;this.f.setContentInfo(b)}}else this.j.push({
|
|
24
|
-
var b=a.ad;a=0===b.Qa();const c=
|
|
25
|
-
|
|
26
|
-
this.I=!0,
|
|
27
|
-
this.f=null,this.g&&(this.g.destroy(),this.g=null))}onPlayerWillRelease(){this.a&&(this.f.release(),this.g&&this.g.release())}id(){return"conviva"}T(a,b){a.trigger(new _.F(_.$c,{detail:b}))}reportAppEvent(a,b){return this.f?this.f.reportAppEvent(a,b):!1}};_.
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var zK="Ad Error",AK="onAdBreakStarted()",BK="onAdBreakStopped()",CK=function(a){var b=_.Bi();let c=Conviva.Constants.DeviceType.DESKTOP,d=Conviva.Constants.DeviceCategory.WEB;const e=b.os;b=b.osVersion.name;let f="";_.li()&&(f="Apple");_.ki()?(f="Google",c=Conviva.Constants.DeviceType.SETTOP,d=Conviva.Constants.DeviceCategory.CHROMECAST):_.mi()?(c=Conviva.Constants.DeviceType.MOBILE,/(android)/i.test(navigator.userAgent)?d=Conviva.Constants.DeviceCategory.ANDROID_DEVICE:_.li()&&(d=Conviva.Constants.DeviceCategory.APPLE_DEVICE)):
|
|
2
|
+
_.ei()||_.bi()||_.ai("Hisense")?(c=Conviva.Constants.DeviceType.SMARTTV,d=Conviva.Constants.DeviceCategory.SMART_TV,_.ei()?(b="",f="LG",d=Conviva.Constants.DeviceCategory.LG_TV):_.bi()?(f="Samsung",d=Conviva.Constants.DeviceCategory.SAMSUNG_TV):_.ai("Hisense")&&(b="",f="Hisense")):_.ai("Xbox One")&&(f="Microsoft",c=Conviva.Constants.DeviceType.CONSOLE,d=Conviva.Constants.DeviceCategory.XBOX);const g=a.deviceMetadata||{},h=(k,l)=>{k in g||!l||(g[k]=l)};h(Conviva.Constants.DeviceMetadata.TYPE,a.deviceType||
|
|
3
|
+
c);h(Conviva.Constants.DeviceMetadata.OS_NAME,e);h(Conviva.Constants.DeviceMetadata.OS_VERSION,b);h(Conviva.Constants.DeviceMetadata.CATEGORY,a.deviceCategory||d);h(Conviva.Constants.DeviceMetadata.BRAND,a.deviceBrand||f);return g},DK=function(a){return a?Conviva.Constants.StreamType.LIVE:Conviva.Constants.StreamType.VOD},EK=function(a){return 0===a?"Pre-roll":-1===a?"Post-roll":"Mid-roll"},GK=function(a,b,c,d){const e={};e[Conviva.Constants.PLAYER_NAME]=c;e[Conviva.Constants.VIEWER_ID]=b;e[Conviva.Constants.IS_LIVE]=
|
|
4
|
+
DK(!!d);e[Conviva.Constants.ASSET_NAME]=zK;a&&(e[Conviva.Constants.ASSET_NAME]=a.getTitle(),e[Conviva.Constants.STREAM_URL]=a.getMediaUrl(),e[Conviva.Constants.DURATION]=a.getDuration(),e["c3.ad.id"]=FK(a.getId()),e["c3.ad.creativeId"]=FK(a.getCreativeId()),e["c3.ad.system"]=FK(a.getAdSystem()),e["c3.ad.mediaFileApiFramework"]=FK(a.getApiFramework()),e["c3.ad.advertiser"]=FK(a.getAdvertiserName()),e["c3.ad.position"]=EK(a.getPodIndex()),e["c3.ad.technology"]=0===a.tb()?Conviva.Constants.AdType.CLIENT_SIDE:
|
|
5
|
+
Conviva.Constants.AdType.SERVER_SIDE,e["c3.ad.adManagerName"]=FK(a.nb()),e["c3.ad.adManagerVersion"]=FK(a.ob()),e["c3.ad.advertiserCategory"]=FK(null),e["c3.ad.advertiserId"]=FK(null),e["c3.ad.breakId"]=FK(null),e["c3.ad.campaignName"]=FK(null),e["c3.ad.category"]=FK(null),e["c3.ad.classification"]=FK(null),e["c3.ad.creativeName"]=FK(null),e["c3.ad.sequence"]=FK(a.Hb()),e["c3.ad.sessionStartEvent"]=FK(null),e["c3.ad.unitName"]=FK(null),e["c3.ad.dayPart"]=FK(null),b=a.getWrapperAdIds().slice(-1)[0]||
|
|
6
|
+
a.getId(),c=a.getWrapperAdSystems().slice(-1)[0]||a.getAdSystem(),a=a.getWrapperCreativeIds().slice(-1)[0]||a.getCreativeId(),e["c3.ad.firstAdId"]=FK(b),e["c3.ad.firstAdSystem"]=FK(c),e["c3.ad.firstCreativeId"]=FK(a));return e},FK=function(a){return a?""+a:"NA"},KK=function(a){a.g.on(a.l,_.wb,a.C.bind(a));a.g.on(a.l,_.xb,a.F.bind(a));a.g.on(a.l,_.Jb,a.L.bind(a));a.g.on(a.l,_.Gb,a.m.bind(a));a.g.on(a.l,_.Fb,a.m.bind(a));a.g.on(a.l,_.Hb,a.m.bind(a));a.g.on(a.l,_.yb,a.m.bind(a));a.g.on(a.l,_.Kb,a.N.bind(a));
|
|
7
|
+
a.g.on(a.l,_.Ib,a.K.bind(a));a.g.on(a.l,_.zb,a.G.bind(a));a.g.on(a.l,_.Cb,a.I.bind(a));a.g.on(a.l,_.Db,a.J.bind(a));a.g.on(a.l,_.Bb,a.H.bind(a));a.g.on(a.l,_.Eb,a.U.bind(a));a.g.on(a.l,_.Lb,a.R.bind(a));a.g.on(a.l,_.$c,b=>{var c=b.detail;if(10003===c.code&&(a.f.debug("onAdError()"),!a.h)){b=Conviva.Constants.ErrorSeverity;switch(c.data.errorType){case 0:c="Ad Load Error";break;case 1:c="Ad Play Error";break;default:c=zK}null===a.a&&HK(a,null);a.a.reportAdError(c,b.FATAL);a.h=!0;a.f.debug("Ad Playback Failure");
|
|
8
|
+
IK(a,JK,c)}})},IK=function(a,b,c=zK){if(a.a){a.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED);switch(b){case JK:a.a.reportAdFailed(c,GK(null,a.B,a.A));break;case LK:a.a.reportAdSkipped();break;default:a.a.reportAdEnded()}a.a.release();a.a=null;a.j=!1}},HK=function(a,b){if(!a.o){a.h=!1;try{if(a.a=Conviva.Analytics.buildAdAnalytics(a.S()),b){const c=GK(b,a.B,a.A,a.l.isLive()),d=String(b.ob()),e={};e[Conviva.Constants.FRAMEWORK_NAME]=b.nb();e[Conviva.Constants.FRAMEWORK_VERSION]=
|
|
9
|
+
d;a.a.setAdPlayerInfo(e);a.a.reportAdStarted(c)}}catch(c){a.f.error("Could not create ad analytics session",c)}}},MK=function(a,b){const c={};c[Conviva.Constants.LOG_LEVEL]=Conviva.Constants.LogLevel.DEBUG;b.serviceUrl&&(a.a.warn("Touchstone URL is set. Do not set this in production!"),c[Conviva.Constants.GATEWAY_URL]=b.serviceUrl.replace(/\/$/,""));Conviva.Analytics.init(b.customerKey,null,c);Conviva.Analytics.setDeviceMetadata(CK(b));b.connectionType&&Conviva.Analytics.reportDeviceMetric(Conviva.Constants.Network.CONNECTION_TYPE,
|
|
10
|
+
b.connectionType);a.f=Conviva.Analytics.buildVideoAnalytics();a.o=!1;b={};b[Conviva.Constants.FRAMEWORK_NAME]=_.ma;b[Conviva.Constants.FRAMEWORK_VERSION]=_.da;a.f.setPlayerInfo(b)},NK=function(a){return a.l.getConfiguration().autoplay||!1},PK=function(a){if(!a.m)if(a.C)a.a.warn("Current session still active. No-op.");else{var b=a.l.getLoadedSource()||a.K,c=a.l.getConfiguration().conviva||null,d=c&&c.viewerId||"N/A",e=c&&c.defaultResource||"N/A";a.a.debug(a.l.getConfiguration().source);var f={},g=
|
|
11
|
+
new _.Jj(b.url);b&&(f[Conviva.Constants.ASSET_NAME]=b.name||"N/A",f[Conviva.Constants.STREAM_URL]=_.zh(g));f[Conviva.Constants.PLAYER_NAME]=c.playerName||_.ma;f[Conviva.Constants.VIEWER_ID]=d;f[Conviva.Constants.DEFAULT_RESOURCE]=e;if(c&&!_.B(c.customTags))for(const h in c.customTags)f[h]=c.customTags[h];a.f.reportPlaybackRequested(f);a.f.setCallback(()=>{a.a.debug("reportMiscellaneousMetrics()");if(OK(a)){var h=1E3*a.l.getPosition();a.f.reportPlaybackMetric(Conviva.Constants.Playback.PLAY_HEAD_TIME,
|
|
12
|
+
h);if(h=a.l.getStats()){h=h.decodedFrames;const k=h-a.H;a.H=h;isFinite(k)&&(a.a.debug("Current FPS",k),a.f.reportPlaybackMetric(Conviva.Constants.Playback.RENDERED_FRAMERATE,k))}}});a.C=!0;a.h=!0;a.I=!1;0<a.j.length&&(a.a.debug("Report deferred events"),a.j.forEach(h=>{h.ve(h.he)}));a.j=[]}},QK=function(a){if(!a.m&&a.f){const b=DK(a.l.isLive()),c={};c[Conviva.Constants.IS_LIVE]=b;c[Conviva.Constants.DURATION]=a.l.getDuration();a.f.setContentInfo(c)}},OK=function(a){return null!==a.f&&a.C},RK=function(a){a.a.debug("terminateSession()");
|
|
13
|
+
a.f&&(a.f.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED),a.f.reportPlaybackEnded(),a.f.release(),Conviva.Analytics.release(),a.o=!0,a.C=!1,a.A=!1,a.h=!1,a.w=null,a.B=!1,a.R=0,a.J=!1,a.j=[],a.H=0)},SK=function(a,b){var c=b.getConfiguration();a.a=!_.B(c.conviva)&&typeof c.conviva===_.Bd;a.a?"undefined"===typeof window.Conviva?(a.h.warn("Conviva SDK is not loaded. Will do nothing."),a.a=!1,c=new _.H(1,9,9E3),a.T(b,c)):b.namespace()===_.zc&&(a.a=!1,
|
|
14
|
+
a.h.debug("Conviva does not report when casting.")):a.h.warn("Conviva plugin is loaded but not configured. Will do nothing.")},TK=function(a){const b=[];typeof a===_.Bd&&(a.customerKey||b.push("customerKey"),a.viewerId||b.push("viewerId"));if(0<b.length)throw new _.H(1,9,9001,{missingKeys:b});};var VK=class{constructor(a,b){this.l=a;this.S=b;this.B="";this.A=_.ma;this.f=new _.P("clpp.conviva.ad");this.g=new _.jo;this.a=null;this.h=this.o=this.w=this.j=!1}initialize(a){this.f.debug("Initialize Ad Insights");this.h=this.w=!1;this.B=a.viewerId;this.A=a.playerName||_.ma;KK(this)}release(){this.f.debug("Release Ad Insights");this.w?this.f.debug(_.ha):(_.Mf(this.g),this.a&&IK(this,UK),this.g.release(),this.w=!0,this.j=this.h=!1)}destroy(){this.f.debug(_.Oc);this.o?this.f.debug(_.fa):this.o=!0}C(){this.f.debug(AK)}F(){this.f.debug(BK)}L(a){this.f.debug("onAdStarted()");
|
|
15
|
+
a=a.ad;this.j||(this.f.warn("Ad load event was not triggered. This will have incidence on VSF"),HK(this,a));this.j=!1;this.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.PLAYING);this.a.reportAdMetric(Conviva.Constants.Playback.RESOLUTION,a.qb(),a.pb());this.a.reportAdMetric(Conviva.Constants.Playback.BITRATE,a.eb())}m(a){this.f.debug("onAdStateChanged()");if(this.a){const b=c=>{this.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,c)};switch(a.type){case _.Gb:case _.Hb:b(Conviva.Constants.PlayerState.PLAYING);
|
|
16
|
+
break;case _.Fb:b(Conviva.Constants.PlayerState.PAUSED);break;case _.yb:b(Conviva.Constants.PlayerState.BUFFERING)}}}N(){this.f.debug("onAdStopped()");this.a&&!this.h&&IK(this,UK)}K(){this.f.debug("onAdSkipped()");this.a&&IK(this,LK)}G(){this.f.debug("onAdClicked()");this.a&&this.a.reportAdPlayerEvent("AdClicked")}I(){this.f.debug("onAdImpression()");if(this.a){const a=Conviva.Constants.Events;this.a.reportAdPlayerEvent(a.AD_IMPRESSION_START);this.a.reportAdPlayerEvent(a.AD_IMPRESSION_END)}}J(a){this.f.debug("onAdLoaded()");
|
|
17
|
+
const b=a.ad,c=()=>{this.j=!0;HK(this,b)};if(-1!==b.getPodIndex()||this.l.getPosition()>=this.l.getDuration()-5)c();else this.g.on(this.l,_.ue,()=>{this.l.getPosition()>=this.l.getDuration()-5&&(this.g.off(this.l,_.ue),c())})}H(){this.f.debug("onAdFirstQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_FIRST_QUARTILE)}U(){this.f.debug("onAdMidPoint()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_MID_QUARTILE)}R(){this.f.debug("onAdThirdQuartile()");this.a&&
|
|
18
|
+
this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_THIRD_QUARTILE)}},LK=0,UK=1,JK=2;var WK=class{constructor(a,b){this.l=a;this.g=new _.jo;this.f=null;this.o=!1;this.G=!0;this.B=this.h=this.A=this.C=this.m=!1;this.R=0;this.J=!1;this.w=null;this.I=!1;this.a=b;this.K=this.F=null;this.j=[];this.H=0}initialize(a,b,c){this.m||(this.a.debug("Initialize conviva"),this.G=!1,this.F=_.kf(b),this.K=c,this.l=a,MK(this,this.F),this.g.on(this.l,_.Rd,this.ma.bind(this)),this.g.on(this.l,_.je,this.aa.bind(this)),this.g.on(this.l,_.gc,this.L.bind(this)),this.g.on(this.l,_.Ce,this.Y.bind(this)),this.g.on(this.l,
|
|
19
|
+
_.Be,this.W.bind(this)),this.g.on(this.l,_.wb,this.S.bind(this)),this.g.on(this.l,_.xb,this.U.bind(this)),this.g.on(this.l,_.Nb,this.ba.bind(this)),this.g.on(this.l,_.fc,this.ga.bind(this)),this.g.on(this.l,_.$c,this.N.bind(this)),NK(this)&&(this.a.debug("Start a new session: A new video starts in autoplay."),PK(this)))}release(){this.a.debug("Release conviva");this.G?this.a.debug(_.ha):(_.Mf(this.g),OK(this)||this.o||!NK(this)||this.f&&this.f.reportPlaybackFailed("Exit Before Video Start"),OK(this)&&
|
|
20
|
+
RK(this),this.f=null,this.G=!0)}destroy(){this.a.debug(_.Oc);this.m?this.a.debug(_.fa):this.m=!0}reportAppEvent(a,b){let c=!1;try{Conviva.Analytics.reportAppEvent(a,b),c=!0}catch(d){this.a.debug("Report app event error",d),c=!1}return c}ma(){this.a.debug("onPlayRequest()");OK(this)||NK(this)?OK(this)&&this.A&&!this.h&&(this.a.debug("Resuming VST monitoring ..."),OK(this)&&!this.h&&(this.f.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_ENDED),this.h=!0),this.A=!1):(this.a.debug("Creating conviva session. On Play Requested / No autoplay"),
|
|
21
|
+
PK(this))}aa(a){this.a.debug(_.Gd);const b=c=>{if(this.o&&(this.a.debug("Creating conviva session (On Seek / Replay)"),MK(this,this.F),PK(this),QK(this),OK(this))){var d=this.l.getTrackManager();d=d.ia()||d.Pa();d.width&&d.height&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.RESOLUTION,d.width,d.height);d.bandwidth&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.BITRATE,d.bandwidth/1E3)}OK(this)&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,c)};switch(a.detail.currentState){case _.Hl:b(Conviva.Constants.PlayerState.PLAYING);
|
|
22
|
+
break;case _.Gl:b(Conviva.Constants.PlayerState.PAUSED);break;case _.zl:b(Conviva.Constants.PlayerState.BUFFERING);break;case _.wl:this.a.debug("onVideoEnded()"),OK(this)&&(this.w&&this.w.fb()?(this.a.debug("Waiting for postroll Ad before terminating session"),this.J=!0):RK(this))}}L(a){this.a.debug(_.Cd);if(OK(this)){if(a=a.detail,typeof a.width===_.r&&typeof a.height===_.r&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.RESOLUTION,a.width,a.height),a.bandwidth&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.BITRATE,
|
|
23
|
+
a.bandwidth/1E3),(a=a.rendition)&&a.track&&(a=a.track)&&a.frameRate){const b={};b[Conviva.Constants.ENCODED_FRAMERATE]=a.frameRate;this.f.setContentInfo(b)}}else this.j.push({ve:this.L.bind(this),he:a})}Y(){this.a.debug("onSeeking()");OK(this)&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)}W(){this.a.debug("onSeeked()");OK(this)&&this.f.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_ENDED)}ba(a){this.a.debug("onAdsTimelineChanged()");if(a=a.adsTimeline)this.w=a}S(a){this.a.debug(AK);
|
|
24
|
+
var b=a.ad;a=0===b.Qa();const c=EK(b.getPodIndex());OK(this)||NK(this)||!a||PK(this);if(OK(this)){a=0===b.tb()?Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE;let d=0;const e={};1===b.sb()&&(d=b.getDuration());e[Conviva.Constants.POD_DURATION]=d;e[Conviva.Constants.POD_INDEX]=++this.R;e[Conviva.Constants.POD_POSITION]=c;b=Conviva.Constants.AdPlayer;b=a!==Conviva.Constants.AdType.CLIENT_SIDE||_.ki()?b.CONTENT:b.SEPARATE;this.f.reportAdBreakStarted(a,b,e);this.B=!0}else this.a.debug("Bug: should already have a valid session")}U(){this.a.debug(BK);
|
|
25
|
+
OK(this)&&this.B&&(this.f.reportAdBreakEnded(),this.B=!1,this.J&&RK(this))}N(a){this.a.debug(_.Dd);if(this.o&&this.I)this.a.debug("Session ended in VPF; ignoring subsequent errors");else{var b=a.detail||null,c=b&&b.message||"Player error",d=Conviva.Constants.ErrorSeverity.WARNING;b&&b.severity&&b.severity===_.G&&(d=Conviva.Constants.ErrorSeverity.FATAL,OK(this)||PK(this));OK(this)?(this.a.debug("Report error",c,d),this.f.reportPlaybackError(c,d),d===Conviva.Constants.ErrorSeverity.FATAL&&(this.a.debug("Video Playback Failure"),
|
|
26
|
+
this.I=!0,RK(this))):this.j.push({ve:this.N.bind(this),he:a})}}ga(){this.a.debug("onAutoPlayBlocked()");OK(this)&&(this.a.debug("Auto-play blocked. Pausing VST monitoring."),this.A=!0,OK(this)&&this.h&&(this.f.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_STARTED),this.h=!1))}};var XK=class{constructor(){this.g=this.f=null;this.a=!1;this.h=new _.P("clpp.conviva")}onPlayerCreated(a){this.f=new WK(a,this.h)}onContentWillLoad(a,b){SK(this,a);if(this.a){var c=a.getConfiguration();c=_.kf(c.conviva||{});try{TK(c);const d=c.enableAdInsights||!1;this.f.initialize(a,c,b);d&&(this.g=new VK(a,()=>this.f.f),this.g.initialize(c))}catch(d){d instanceof _.H?this.T(a,d):this.T(a,new _.H(1,9,9002,d,d))}}}onContentLoaded(){this.a&&QK(this.f)}onPlayerWillDestroy(){this.a&&(this.a=!1,this.f.destroy(),
|
|
27
|
+
this.f=null,this.g&&(this.g.destroy(),this.g=null))}onPlayerWillRelease(){this.a&&(this.f.release(),this.g&&this.g.release())}id(){return"conviva"}T(a,b){a.trigger(new _.F(_.$c,{detail:b}))}reportAppEvent(a,b){return this.f?this.f.reportAppEvent(a,b):!1}};_.A("clpp.conviva.ConvivaPlugin",XK);XK.prototype.reportAppEvent=XK.prototype.reportAppEvent;XK.Id="conviva";_.Hm(new class{create(){return new XK}});};f.call(g, window);
|