@castlabs/prestoplay 6.25.2 → 6.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/README.md +5 -5
- package/cjs/cl.adobe.js +3 -3
- package/cjs/cl.airplay.js +3 -3
- package/cjs/cl.broadpeak.js +7 -7
- package/cjs/cl.cast.js +112 -112
- package/cjs/cl.conviva.js +32 -32
- package/cjs/cl.core.js +601 -600
- package/cjs/cl.crypto.js +9 -9
- package/cjs/cl.dash.js +89 -88
- package/cjs/cl.externs.js +37 -31
- package/cjs/cl.freewheel.js +24 -24
- package/cjs/cl.hls.js +77 -77
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +30 -30
- package/cjs/cl.ima.js +23 -23
- package/cjs/cl.mediatailor.js +3 -3
- package/cjs/cl.mse.js +341 -334
- package/cjs/cl.muxdata.js +15 -15
- package/cjs/cl.onboard.js +3 -3
- package/cjs/cl.persistent.js +14 -14
- package/cjs/cl.playlist.js +6 -6
- package/cjs/cl.sessions.js +16 -16
- package/cjs/cl.simid.js +17 -17
- package/cjs/cl.smooth.js +72 -72
- package/cjs/cl.thumbnails.js +26 -26
- package/cjs/cl.tizen.js +71 -71
- package/cjs/cl.ttml.js +29 -29
- package/cjs/cl.verimatrix.js +5 -5
- package/cjs/cl.vimond.js +12 -12
- package/cjs/cl.vr.js +19 -19
- package/cjs/cl.vtt.js +14 -14
- package/cjs/cl.yospace.js +4 -4
- package/cjs/cl.youbora.js +38 -36
- package/cl.adobe.js +3 -3
- package/cl.airplay.js +3 -3
- package/cl.broadpeak.js +5 -5
- package/cl.cast.js +87 -87
- package/cl.conviva.js +27 -27
- package/cl.core.js +489 -488
- package/cl.crypto.js +9 -9
- package/cl.dash.js +82 -82
- package/cl.externs.js +37 -31
- package/cl.freewheel.js +19 -19
- package/cl.hls.js +79 -80
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +26 -26
- package/cl.ima.js +17 -17
- package/cl.mediatailor.js +3 -3
- package/cl.mse.js +299 -292
- package/cl.muxdata.js +13 -13
- package/cl.onboard.js +4 -4
- package/cl.persistent.js +10 -10
- package/cl.playlist.js +5 -5
- package/cl.sessions.js +10 -10
- package/cl.simid.js +14 -14
- package/cl.smooth.js +60 -60
- package/cl.thumbnails.js +19 -19
- 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 +14 -14
- package/cl.vtt.js +12 -12
- package/cl.yospace.js +3 -3
- package/cl.youbora.js +28 -27
- package/package.json +3 -3
- package/typings.d.ts +41 -3
package/cl.cast.js
CHANGED
|
@@ -1,90 +1,90 @@
|
|
|
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
|
-
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.S.length){a.w=!0;a.o.
|
|
8
|
-
cast.framework.CastContext.getInstance();b.removeEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.M);b.removeEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.da)}b=[];a.f&&(b.push(a.f.destroy()),a.f=null);a.j&&(b.push(a.j.destroy()),a.j=null);yield Promise.all(b);a.A=!1;a.o&&(a.o.stop(),a.o=null);a.R=null;a.X=null})},
|
|
9
|
-
void 0===c?0:c;return _.x(function*(){var d=a.f.
|
|
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
|
-
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.
|
|
15
|
-
_.
|
|
16
|
-
e),
|
|
17
|
-
null,e=null,f;typeof b.breakClipId===_.
|
|
18
|
-
cast.framework.events.EventType.TIMED_METADATA_EXIT]},
|
|
19
|
-
new _.
|
|
20
|
-
_.
|
|
21
|
-
b.licenseUrl=void 0;b.licenseRequestHandler=void 0;b.licenseHandler=void 0};if(a&&a.drm){var d=a.drm,e=_.
|
|
22
|
-
function(a,b,c,d){b.modifiers.licenseRequest?a.licenseRequestHandler=e=>{const f=_.
|
|
23
|
-
e.buffer,200,"");yield b.modifiers.licenseResponse(c,g,d);return _.K(g.data)}):a.licenseHandler=void 0},
|
|
24
|
-
|
|
25
|
-
++e}return d.join("\n")},
|
|
26
|
-
c.breakClipIds.length,f=0>=c.position?c.position:b.breaks.filter(h=>0<=h.position).sort((h,k)=>h.position-k.position).findIndex(h=>h===c));b.breakClips&&(d=b.breakClips.find(h=>h.id===a.a.breakClipId)||null);b=new Z(d,c,g,e,f)}return b},
|
|
27
|
-
_.G&&this.a(_.
|
|
28
|
-
{detail:a}))}}};_.z("clpp.cast.CastUtils",class{});var
|
|
29
|
-
this.w&&!this.w.isPlayingBreak)switch(this.f.playerState){case chrome.cast.media.PlayerState.IDLE:switch(this.f.idleReason){case chrome.cast.media.IdleReason.FINISHED:this.a(_.
|
|
30
|
-
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 _.
|
|
31
|
-
null}rb(){return this.f[_.N]||null}Fb(){return this.f[_.M]||null}Gb(){return this.f[_.L]||null}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"cast",{get:()=>window.cast_,set:e=>{window.cast_=e;window.setTimeout(()=>{
|
|
35
|
-
a}xc(){return this.w}Mb(){return this.A}
|
|
36
|
-
new _.I(1,8,8003,void 0);try{yield
|
|
37
|
-
a,b)})}pause(){return new Promise((a,b)=>{this.isEnded()&&a();if(!this.a)return b(
|
|
38
|
-
this.a.getEstimatedTime()||0}getDuration(){return this.getMediaDuration()}getMediaDuration(){if(!this.a||!this.a.media)return-1;const a=this.a.media.duration;return typeof a!==_.t?-1:-1===a?Infinity:a}setDrmCustomDataModifier(){}setCdnErrorCallback(){}detach(){}getPlaybackRate(){return this.a&&this.a.playbackRate||0}setPlaybackRate(a){this.a&&0<a&&this.sendMessage(
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var VV="Cannot seek during ads playout.",WV="Cannot switch track",XV="Media session does not exist.",YV="No receivers available",ZV="Reset ABR functionality not available on cast.",$V="SDK not yet ready",aW="Sender is destroyed.",bW="clpp.cast.CastProxy",cW="clpp.cast.Player",dW="clpp.cast.Receiver",eW="urn:x-cast:castlabs",fW="urn:x-cast:com.google.cast.media",gW=function(a){return _.x(function*(){yield _.Rr(a,_.Je);yield _.Rr(a,_.Ie)})},hW=function(a){return JSON.stringify(a,(b,c)=>
|
|
2
|
+
{if("license"!==b&&typeof c!==_.Wd){if(c instanceof Event){b={};for(const d in c){const e=c[d];typeof e===_.Ee?"detail"===d&&(b[d]=e):d in Event||(b[d]=e)}return b}return typeof c===_.t?isNaN(c)?"NaN":isFinite(c)?c:0>c?"-Infinity":"Infinity":c}})},iW=function(a){if(typeof a!==_.Pf)return a;try{return JSON.parse(a,(b,c)=>"NaN"===c?NaN:"-Infinity"===c?-Infinity:"Infinity"===c?Infinity:c)}catch(b){return a}},jW=function(a,b,c,d){return _.x(function*(){if(b.includes(a.mimeType))return a;var e=null;let f=
|
|
3
|
+
null,g=null;for(var h=0;h<b.length&&!f;)g=b[h++],f=_.ik(d,a.mimeType,g);f&&g&&(h=_.sj(a.url),(h=yield c.fetch(h).T)&&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})},kW=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 _.rg:return d.FMP4;case _.qg:return b===_.N?d.MPEG2_TS:c.TS;case _.Bc:return c.AAC;case _.Ec:return c.AC3;case _.Fc:return c.E_AC3;case "audio/mpeg":return c.MP3;case _.Gc:return c.FMP4}},mW=function(a){a=void 0===a?lW:a;var b=cast.framework.messages||chrome.cast.media;if(!b)throw new _.I(1,8,8001);const c=b.MetadataType,d=b.GenericMediaMetadata,e=b.MovieMediaMetadata,f=b.TvShowMediaMetadata,g=b.MusicTrackMediaMetadata,h=b.PhotoMediaMetadata;
|
|
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}},nW=function(a,b){return a.h.filter(c=>c.type===b)},pW=function(a,b){const c=oW(a);return nW(a,b).find(d=>c.includes(d.id))||null},rW=function(a,b,c){const d=a.a.a;if(d)if(c){a.f[b]=c.renditions[0];c=[+c.id];if(b!==_.L){const e=a.ta();e&&c.push(+e.id)}c=new chrome.cast.media.EditTracksInfoRequest(c);
|
|
6
|
+
d.editTracksInfo(c,()=>{a.f[b]=null;qW(a,b)},e=>{a.f[b]=null;a.g.debug(WV,e)})}else b===_.L&&(c=new chrome.cast.media.EditTracksInfoRequest([]),d.editTracksInfo(c,()=>{qW(a,b)},e=>{a.g.debug(WV,e)}))},oW=function(a){a=a.a?a.a.a:null;return(a?a.activeTrackIds||[]:[]).map(b=>b.toString())},qW=function(a,b){b===_.M?a.a.trigger(new _.F(_.Jc)):b===_.L&&a.a.trigger(new _.F(_.Wf))},uW=function(a){if(a)for(const b of sW)tW(b)},tW=function(a){if(!a.w&&window.chrome&&chrome.cast&&chrome.cast.isAvailable&&window.cast&&
|
|
7
|
+
cast.framework&&cast.framework.CastContext&&a.S.length){a.w=!0;a.o.lf();var b=cast.framework.CastContext.getInstance(),c=new cast.framework.CastOptions;c.receiverApplicationId=a.S;c.autoJoinPolicy=chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED;b.setOptions(c);b.addEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.M);b.addEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.da);vW&&a.o.la(.02)}},wW=function(a){return _.x(function*(){sW.delete(a);if(a.w){a.w=!1;var b=
|
|
8
|
+
cast.framework.CastContext.getInstance();b.removeEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.M);b.removeEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.da)}b=[];a.f&&(b.push(a.f.destroy()),a.f=null);a.j&&(b.push(a.j.destroy()),a.j=null);yield Promise.all(b);a.A=!1;a.o&&(a.o.stop(),a.o=null);a.R=null;a.X=null})},xW=function(a){return _.x(function*(){a.Mb()||(yield cast.framework.CastContext.getInstance().requestSession())})},zW=function(a,b,c){c=
|
|
9
|
+
void 0===c?0:c;return _.x(function*(){var d=a.f.ta();d&&d.language&&(a.h.preferredTextLanguage=d.language);(d=a.f.oa())&&d.language&&(a.h.preferredAudioLanguage=d.language);yield yW(a,{source:a.getLoadedSource(),currentTime:c,isLive:a.isLive(),Ve:a.getPresentationStartTime(),autoplay:b,ib:a.h})})},yW=function(a,b){return _.x(function*(){var c=chrome.cast.media.StreamType;yield xW(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=kW(b.Zb,_.N);e.hlsSegmentFormat=kW(c,_.M);b.ib&&(a.L&&(c=yield Promise.resolve(a.L(b.ib)))&&(b.ib=c),a.h=b.ib,a.C=_.bp(a.h),a.B=a.C.findIndex(k=>k.url===b.source.url),b.ib.remoteTextTracks&&(c=yield Promise.all(b.ib.remoteTextTracks.map(a.za.bind(a))),e.tracks=c.filter(k=>k),b.ib.remoteTextTracks=void 0),delete b.ib.autoplay,b.ib.startTime=null,e.customData={playerConfiguration:hW(b.ib)});c=a.Eb()||{};
|
|
11
|
+
var f=AW(c.metadataType),g;typeof b.Ve===_.t&&(g={metadataType:f,sectionStartAbsoluteTime:b.Ve});var h;b.source.name&&(h={metadataType:f,title:b.source.name});c=BW(c);if(g=CW(Object.assign({},g,h,c)))e.metadata=g;e=new chrome.cast.media.LoadRequest(e);typeof b.autoplay===_.Mc&&(e.autoplay=b.autoplay);typeof b.currentTime===_.t&&(e.currentTime=b.currentTime);yield d.loadMedia(e)}})},CW=function(a){if(!a)return null;a:{var b=a.metadataType;const c=Object.entries(DW);for(const d of c){const [e,f]=d;
|
|
12
|
+
if(f===b){b=e;break a}}b=null}if(!b)return null;b=mW(DW[b]);return Object.assign(b,a)},AW=function(a){var b=void 0===b?lW:b;return Object.values(DW).includes(a)?a:b},BW=function(a){const b={};for(const c in a)void 0!==a[c]&&(b[c]=a[c]);return b},FW=function(a,b){EW(a,b.getMediaSession());b.addEventListener(cast.framework.SessionEventType.MEDIA_SESSION,a.V);b.addMessageListener(eW,a.P)},GW=function(a){const b=a.getPosition();a.a&&a.a.media?(a=a.a.media.startAbsoluteTime,a=typeof a!==_.t?null:a):a=
|
|
13
|
+
null;a=null===a?null:a+b;return null===a?b:a},EW=function(a,b){a.a=b;a.a&&(a.G.release(),a.F=null,a.l=null,a.l=new cast.framework.RemotePlayer,a.F=new cast.framework.RemotePlayerController(a.l),a.G.on(a.F,cast.framework.RemotePlayerEventType.CURRENT_TIME_CHANGED,a.ia.bind(a)),a.G.on(a.F,cast.framework.RemotePlayerEventType.MEDIA_INFO_CHANGED,a.bb.bind(a)),a.j&&a.j.init(),a.trigger(new _.F(_.ne)))},JW=function(a){return new HW(a.h,()=>{a.trigger(new _.F(_.Sc))},(b,c)=>{{const d=a.f.getConfiguration();
|
|
14
|
+
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.Ff&&(d.preferredAudioLanguage=c.Ff);c.Gg&&(d.preferredTextLanguage=c.Gg);_.Tr(a.f,null);a.trigger(new _.F("castingended"));a.j(b,d)}},()=>IW(a))},IW=function(a){return _.x(function*(){a.trigger(new _.F(_.Rc));a.f.a!==a.a&&a.f&&a.a&&(yield a.f.release(),_.Tr(a.f,a.a))})},MW=function(a,b,c){return _.x(function*(){var d=b.adTagUrl;if(d)try{KW=!1;const e=
|
|
15
|
+
_.sj(d),f=yield c.fetch(e).T;if(f&&f.data){const g=_.Si(f.data),h=(new DOMParser).parseFromString(g,_.Vf);if(h.getElementsByTagName("vmap:VMAP").length)_.C("VMAP detected."),a.vmapAdsRequest=LW(g);else if(h.getElementsByTagName("VAST").length){_.C("VAST detected.");{d=g;const k=new cast.framework.messages.BreakClip("bc1");k.vastAdsRequest=LW(d);const l=new cast.framework.messages.Break("b1",[k.id],0);a.breakClips=[k];a.breaks=[l]}}else _.C("Unsupported schema."),KW=!0}}catch(e){_.C("Failed to fetch an ad",
|
|
16
|
+
e),KW=!0}})},LW=function(a){const b=new cast.framework.messages.VastAdsRequest;b.adsResponse=a;return b},NW=function(a,b){b=new _.I(1,10,10003,{errorType:b});a.m.onError(b)},OW=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},QW=function(a,b,c){if(c instanceof cast.framework.events.BreaksEvent||-1!==a.getPosition()){var d=null;(c=PW(a,c))&&(d={ad:c});a.m.trigger(new _.F(b,d))}},PW=function(a,b){let c=null;if(a.a&&b instanceof cast.framework.events.BreaksEvent){let d=
|
|
17
|
+
null,e=null,f;typeof b.breakClipId===_.Pf&&(d=a.a.getBreakClipById(b.breakClipId));typeof b.breakId===_.Pf&&(e=a.a.getBreakById(b.breakId),!e&&d&&(e=a.a.getBreaks().find(g=>g.breakClipIds.includes(d.id))||null),e&&(f=a.a.getBreaks().filter(g=>0<=g.position).sort((g,h)=>g.position-h.position).findIndex(g=>g===e)));c=new Z(d,e,b.index,b.total,f)}return c},RW=function(){return[cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,cast.framework.events.EventType.TIMED_METADATA_CHANGED,cast.framework.events.EventType.TIMED_METADATA_ENTER,
|
|
18
|
+
cast.framework.events.EventType.TIMED_METADATA_EXIT]},SW=function(a){const b=a.dashTimedMetadata;let c=_.jg;b&&(c=b.schemeIdUri);return{type:c.startsWith(_.ig)?_.Rh:_.gg,schemeIdUri:c,id:a.id||"",startTime:a.startTime,endTime:a.endTime,value:b&&b.value||"",eventElement:b?b.eventElement:null}},TW=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},VW=function(a){a.a=TW().getTextTracksManager();const b=a.a.getTracks();a.j=UW(_.L,b)},UW=function(a,b){const c=[];for(const d of b)b=
|
|
19
|
+
new _.Rj(d.trackId.toString(),a),b.roles=d.roles||[],b.kind=d.subtype||null,b.language=d.language||null,b.originalLanguage=d.language||null,b.label=d.name||null,b.src=d.trackContentId||null,b.mimeType=d.trackContentType||null,d.customData&&(b.mimeType=d.customData.mimeType||b.mimeType,b.src=d.customData.url||b.src),b.renditions.push(new _.Vj(b.id,b)),c.push(b);return c},WW=function(a,b,c,d){c=_.bi(c).filter(g=>g);var e=!1;let f=[];b===_.M?f=a.getAudioTracks():b===_.L&&(f=a.pa());if(c=c.find(g=>{const h=
|
|
20
|
+
_.Di(g);return f.some(k=>{k=_.Di(k.language||"");return _.Ei(h,k)})})){const g=_.Di(c);c=f.filter(h=>{h=_.Di(h.language||"");return _.Ei(g,h)});f=c.length?c:f;e=e||!!c.length}_.aj(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===_.M?a.ya(e):b===_.L&&a.Ua(e))},XW=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},$W=function(a,b){var c=()=>{b.protectionSystem=cast.framework.ContentProtection.NONE;
|
|
21
|
+
b.licenseUrl=void 0;b.licenseRequestHandler=void 0;b.licenseHandler=void 0};if(a&&a.drm){var d=a.drm,e=_.Yl(d);if(e){var f=[_.rd];_.bp(a)[0].type!==_.zc&&f.unshift(_.td);d.preferredDrmSystem===_.rd&&f.reverse();for(var g,h;f.length&&!h;)g=f.shift(),h=e.Ja[g];h?(c=g===_.td?cast.framework.ContentProtection.WIDEVINE:g===_.rd?cast.framework.ContentProtection.PLAYREADY:void 0,b.protectionSystem=c,b.licenseUrl=h.licenseUrl,c={ldlDelay:0,customData:{}},YW(b,h,a,c),ZW(b,h,a,c)):c()}else c()}else c()},YW=
|
|
22
|
+
function(a,b,c,d){b.modifiers.licenseRequest?a.licenseRequestHandler=e=>{const f=_.sj({method:_.db,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},ZW=function(a,b,c,d){b.modifiers.licenseResponse?a.licenseHandler=(e,f)=>_.x(function*(){const g=_.wj(Object.assign({},f.headers),
|
|
23
|
+
e.buffer,200,"");yield b.modifiers.licenseResponse(c,g,d);return _.K(g.data)}):a.licenseHandler=void 0},cX=function(){return aX||(aX=new bX)},dX=function(){return cast.framework.CastReceiverContext.getInstance()},eX=function(){const a=dX().getPlayerManager().getMediaInformation();return a&&a.metadata?a.metadata:null},fX=function(a,b){const c=dX().getPlayerManager().getMediaInformation();c?(b?c.metadata=b:delete c.metadata,a=!0,a=void 0===a?!1:a,dX().getPlayerManager().setMediaInformation(c,a)):a.g.warn("No mediaInformation is present. Skipping metadata update.")},
|
|
24
|
+
hX=function(a,b){a.g.debug("Detected HLS, parsing");var c=cast.framework.messages.HlsVideoSegmentFormat;a=dX();var {hlsVideoSegmentFormat:d}=dX().getPlayerManager().getMediaInformation()||{};c=d===c.FMP4?_.rg:_.qg;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=gX(f,_.pa),h=gX(f,_.lb);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);
|
|
25
|
+
++e}return d.join("\n")},gX=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},jX=function(a,b){let c=null;const d=iX(a);d&&(c={ad:d});a.f.trigger(new _.F(b,c))},iX=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=
|
|
26
|
+
c.breakClipIds.length,f=0>=c.position?c.position:b.breaks.filter(h=>0<=h.position).sort((h,k)=>h.position-k.position).findIndex(h=>h===c));b.breakClips&&(d=b.breakClips.find(h=>h.id===a.a.breakClipId)||null);b=new Z(d,c,g,e,f)}return b},kX=class{constructor(a,b){this.log=new _.T(b);this.player=a;this.l=null;this.h=_.Wo;this.o=_.kv;this.j=2;this.C=Date.now();this.B=-1}release(){this.a(_.Wo)}destroy(){this.l=this.player=null;return Promise.resolve()}getState(){return this.h}onError(a){a.severity===
|
|
27
|
+
_.G&&this.a(_.Po)}a(a){if(a!==this.h)if(this.h===_.Po&&a!==_.Wo)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===_.So?(this.B=b,this.player.trigger(new _.F(_.Oc,{detail:{bufferedTimeMS:-1,reason:this.j}}))):this.o===_.So&&this.player.trigger(new _.F(_.Nc,{detail:{bufferedTimeMS:b-this.B,reason:this.j}}));a={currentState:this.h,previousState:this.o,timeSinceLastStateChangeMS:b-this.C};this.C=b;this.l&&_.Ho(this.l,this.h);this.player.trigger(new _.F(_.Mf,
|
|
28
|
+
{detail:a}))}}};_.z("clpp.cast.CastUtils",class{});var lW=0,DW={GENERIC:lW,MOVIE:1,TV_SHOW:2,MUSIC_TRACK:3,PHOTO:4,AUDIOBOOK_CHAPTER:5};var lX=class extends kX{constructor(a){super(a,"clpp.cast.SenderStateManager");this.w=this.f=null;this.A=this.Vb.bind(this)}init(){const a=this.player,b=a.a;b&&(this.f&&this.f.removeUpdateListener(this.A),this.f=b,this.f.addUpdateListener(this.A),this.w=a.l)}destroy(){const a=this,b=()=>Object.getPrototypeOf(Object.getPrototypeOf(this)).destroy;return _.x(function*(){a.f&&(a.f.removeUpdateListener(a.A),a.f=null);yield b().call(a)})}a(a){const b=this.player.l;b&&b.isPlayingBreak||super.a(a)}Vb(){if(this.f&&
|
|
29
|
+
this.w&&!this.w.isPlayingBreak)switch(this.f.playerState){case chrome.cast.media.PlayerState.IDLE:switch(this.f.idleReason){case chrome.cast.media.IdleReason.FINISHED:this.a(_.Oo);break;case chrome.cast.media.IdleReason.ERROR:this.a(_.Po);break;default:this.a(_.Wo)}break;case chrome.cast.media.PlayerState.PLAYING:this.a(_.Zo);break;case chrome.cast.media.PlayerState.PAUSED:this.a(_.Yo);break;case chrome.cast.media.PlayerState.BUFFERING:this.a(_.So)}}};var mX=class extends _.U{constructor(){super();this.g=new _.T("clpp.cast.SenderTrackManager");this.a=null;this.h=[];this.f={}}initialize(a){this.a=a}release(){this.h=[];this.f={}}load(){this.release();var a=this.a.a;a&&(a=a.media)&&(this.h=(a=a.tracks)?a.map(b=>{switch(b.type){case chrome.cast.media.TrackType.VIDEO:var c=_.N;break;case chrome.cast.media.TrackType.AUDIO:c=_.M;break;case chrome.cast.media.TrackType.TEXT:c=_.L}c=new _.Rj(b.trackId.toString(),c);c.kind=b.subtype;c.language=b.language;
|
|
30
|
+
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 _.Vj(c.id,c));return c}):[],this.a.trigger(new _.F(_.bg)))}destroy(){this.a=null}getVideoTracks(){return nW(this,_.N)}getAudioTracks(){return nW(this,_.M)}pa(){return nW(this,_.L)}qa(){const a=this.Fa();return a?a.renditions[0]:null}Oa(){const a=this.oa();return a?a.renditions[0]:null}Sa(){const a=this.ta();return a?a.renditions[0]:
|
|
31
|
+
null}rb(){return this.f[_.N]||null}Fb(){return this.f[_.M]||null}Gb(){return this.f[_.L]||null}Fa(){return pW(this,_.N)}oa(){return pW(this,_.M)}ta(){return pW(this,_.L)}Ab(a){rW(this,_.N,a)}ya(a){rW(this,_.M,a)}Ua(a){rW(this,_.L,a)}jb(a){this.Ab(a&&a.track)}yb(a){this.ya(a&&a.track)}zb(a){this.Ua(a&&a.track)}addTextTrack(){return _.x(function*(){})}va(){return!0}};mX.prototype.isAbrEnabled=mX.prototype.va;mX.prototype.addTextTrack=mX.prototype.addTextTrack;mX.prototype.setTextRendition=mX.prototype.zb;
|
|
32
|
+
mX.prototype.setAudioRendition=mX.prototype.yb;mX.prototype.setVideoRendition=mX.prototype.jb;mX.prototype.setTextTrack=mX.prototype.Ua;mX.prototype.setAudioTrack=mX.prototype.ya;mX.prototype.setVideoTrack=mX.prototype.Ab;mX.prototype.getTextTrack=mX.prototype.ta;mX.prototype.getAudioTrack=mX.prototype.oa;mX.prototype.getVideoTrack=mX.prototype.Fa;mX.prototype.getLoadingTextRendition=mX.prototype.Gb;mX.prototype.getLoadingAudioRendition=mX.prototype.Fb;mX.prototype.getLoadingVideoRendition=mX.prototype.rb;
|
|
33
|
+
mX.prototype.getTextRendition=mX.prototype.Sa;mX.prototype.getAudioRendition=mX.prototype.Oa;mX.prototype.getVideoRendition=mX.prototype.qa;mX.prototype.getTextTracks=mX.prototype.pa;mX.prototype.getAudioTracks=mX.prototype.getAudioTracks;mX.prototype.getVideoTracks=mX.prototype.getVideoTracks;var HW=class extends _.vu{constructor(a,b,c,d){super();this.g=new _.T(_.dd);this.S=a;this.o=new _.wk(b);this.R=c;this.X=d;this.h=this.I=_.wl();this.C=[];this.B=0;this.K=new _.Dr;this.F=this.l=this.a=null;this.A=this.w=!1;this.ba="";this.fa=1E6;this.f=new mX;this.f.initialize(this);this.j=new lX(this);this.G=new _.Rt;this.J=null;this.H=new Set;this.M=this.Ka.bind(this);this.da=this.Db.bind(this);this.V=this.Cb.bind(this);this.P=this.Wa.bind(this);this.L=null;window.cast||Object.defineProperty(window,
|
|
34
|
+
"cast",{get:()=>window.cast_,set:e=>{window.cast_=e;window.setTimeout(()=>{uW(!0)},0)}});tW(this);sW.add(this)}init(a,b){this.h=this.I=b}unload(){return new Promise((a,b)=>{this.f&&this.f.release();this.a&&!this.a.idleReason||a();this.a.stop(null,a,b)})}release(){return this.unload().then(()=>{this.j&&this.j.release()})}getTimeline(){return null}setupPlaylist(){return Promise.reject(_.$a)}appendLoad(){return Promise.reject(_.$a)}seekWith(){return Promise.reject(_.$a)}setSeekInterceptor(){}setPlaybackSessionId(){}getBandwidthEstimate(){return null}destroy(){return _.x(function*(){})}Gd(a){this.L=
|
|
35
|
+
a}xc(){return this.w}Mb(){return this.A}Ge(){return this.ba}sendMessage(a,b){const c=this;return _.x(function*(){let d;const e=cast.framework.CastContext.getInstance().getCurrentSession();if(e)try{yield e.sendMessage(a,hW(b))}catch(f){d=new _.I(1,8,8E3,{detailedErrorCode:f})}else d=new _.I(1,8,8004,void 0);if(d)c.onError(d)})}cast(){const a=this;return _.x(function*(){if(!a.xc())throw a.g.warn($V),new _.I(1,8,8001,void 0);if(!vW)throw a.g.warn(YV),new _.I(1,8,8002,void 0);if(a.Mb())throw a.g.warn("Already casting"),
|
|
36
|
+
new _.I(1,8,8003,void 0);try{yield xW(a)}catch(b){const c={};b instanceof chrome.cast.Error?(c.detailedErrorCode=b.code,c.details=b.details,c.reason=b.description):c.detailedErrorCode=b;throw new _.I(1,8,8E3,c);}})}Fe(){this.Mb()&&cast.framework.CastContext.getInstance().endCurrentSession(!0)}addMessageListener(a){typeof a===_.Wd&&this.H.add(a)}removeMessageListener(a){typeof a===_.Wd&&this.H.delete(a)}play(){return this.isEnded()?zW(this,!0):new Promise((a,b)=>{if(!this.a)return b(XV);this.a.play(null,
|
|
37
|
+
a,b)})}pause(){return new Promise((a,b)=>{this.isEnded()&&a();if(!this.a)return b(XV);this.a.pause(null,a,b)})}isPaused(){return!!this.a&&this.a.playerState===chrome.cast.media.PlayerState.PAUSED}isEnded(){return this.getState()===_.Oo}seek(a){return this.isEnded()?zW(this,!1,a):new Promise((b,c)=>{this.a||c(XV);this.l.isPlayingBreak&&c(VV);const d=new chrome.cast.media.SeekRequest;d.currentTime=a;this.trigger(new _.F(_.lg));this.a.seek(d,()=>{this.trigger(new _.F(_.kg));b()},c)})}getPosition(){return this.getMediaPosition()}getMediaPosition(){return this.a&&
|
|
38
|
+
this.a.getEstimatedTime()||0}getDuration(){return this.getMediaDuration()}getMediaDuration(){if(!this.a||!this.a.media)return-1;const a=this.a.media.duration;return typeof a!==_.t?-1:-1===a?Infinity:a}setDrmCustomDataModifier(){}setCdnErrorCallback(){}detach(){}getPlaybackRate(){return this.a&&this.a.playbackRate||0}setPlaybackRate(a){this.a&&0<a&&this.sendMessage(fW,{type:"SET_PLAYBACK_RATE",requestId:Math.round(1E3*Math.random()),mediaSessionId:this.a.mediaSessionId,playbackRate:a})}getVolume(){return this.a&&
|
|
39
39
|
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||!this.a.media||!this.a.media.metadata)return null;const a=this.a.media.metadata.sectionStartAbsoluteTime;return typeof a!==_.t?null:1E-8===a?0:a}getSeekRange(){let a=
|
|
40
|
-
{start:0,end:this.getDuration()};if(this.isLive()){const b=this.a.getEstimatedLiveSeekableRange();b&&typeof b.start===_.t&&typeof b.end===_.t&&(a={start:b.start,end:b.end})}return a}getState(){return this.j?this.j.getState():_.
|
|
41
|
-
isLive:c.isLive,autoplay:b.h.autoplay,ib:b.h,Zb:c.Zb,audioMimeType:c.audioMimeType})}else b.g.warn(
|
|
42
|
-
(this.trigger(new _.F(_.
|
|
43
|
-
this.Eb()||{};a={metadataType:
|
|
44
|
-
case cast.framework.SessionState.SESSION_RESUMED:this.Mb()||(this.A=!0,
|
|
45
|
-
this.P);this.A=!1;this.a=null;this.G.release();this.l=this.F=null}}Cb(a){this.g.debug("New media session",a.mediaSession);
|
|
46
|
-
d.label||null,c.trackContentId=d.url,c.trackContentType=d.mimeType,c.customData={mimeType:a.mimeType,url:a.url});return c})}getTextDisplayer(){return null}},
|
|
47
|
-
this;return _.x(function*(){if(b.a)try{if(yield b.a.cast(),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.
|
|
48
|
-
e&&typeof e.isLive===_.
|
|
49
|
-
b.a=
|
|
50
|
-
|
|
51
|
-
|
|
40
|
+
{start:0,end:this.getDuration()};if(this.isLive()){const b=this.a.getEstimatedLiveSeekableRange();b&&typeof b.start===_.t&&typeof b.end===_.t&&(a={start:b.start,end:b.end})}return a}getState(){return this.j?this.j.getState():_.kv}getStats(){return this.a&&this.a.customData&&this.a.customData.stats?iW(this.a.customData.stats):_.Lo()}isLive(){return Infinity===this.getDuration()}load(a){const b=this;return _.x(function*(){if(b.xc())if(vW){b.C=_.bp(a);b.h=_.yl(b.I,a);var c=b.C[b.B];yield yW(b,{source:c,
|
|
41
|
+
isLive:c.isLive,autoplay:b.h.autoplay,ib:b.h,Zb:c.Zb,audioMimeType:c.audioMimeType})}else b.g.warn(YV);else b.g.warn($V)})}getBufferInfo(){return new _.uu}getTrackManager(){return this.f}getConfiguration(){return this.h}getSurface(){return null}setNetworkEngine(a){this.K=a}getNetworkEngine(){return this.K}getSourceIndex(){return this.B}setSourceIndex(a){this.B=a}setCmsdManager(){}getLoadedSource(){return this.C[this.B]}getPeriods(){return[]}getDrmInfo(){return null}getTimelineCues(){return[]}getCueTimeline(){return null}resetAbr(){this.g.warn(ZV)}onError(a){if(a&&
|
|
42
|
+
(this.trigger(new _.F(_.r,{detail:a})),this.j))this.j.onError(a)}namespace(){return _.dd}canPlay(){return this.xc()?2:0}Eb(){return this.J}Yb(a){this.J=CW(a)}Be(){this.J=null}ff(a){const b=this.Eb()||{};a={metadataType:AW(b.metadataType),title:a};this.Yb(Object.assign({},b,a))}df(a){const b=this.Eb()||{},c=AW(b.metadataType);a=new chrome.cast.Image(a);this.Yb(Object.assign({},b,{metadataType:c,images:[a]}))}cf(a){const b=this.Eb()||{};this.Yb(Object.assign({},b,{metadataType:3,artist:a}))}ef(a){const b=
|
|
43
|
+
this.Eb()||{};a={metadataType:AW(b.metadataType),releaseDate:a};this.Yb(Object.assign({},b,a))}Ka(a){const b=cast.framework.CastContext.getInstance(),c=a.castState===cast.framework.CastState.CONNECTED;vW=a.castState!==cast.framework.CastState.NO_DEVICES_AVAILABLE;this.ba=c?b.getCurrentSession().getCastDevice().friendlyName:"";this.o.lf()}Db(a){this.g.debug(`state: ${a.sessionState}, details:`,a);switch(a.sessionState){case cast.framework.SessionState.SESSION_STARTED:this.A=!0;FW(this,a.session);break;
|
|
44
|
+
case cast.framework.SessionState.SESSION_RESUMED:this.Mb()||(this.A=!0,FW(this,a.session),this.X());break;case cast.framework.SessionState.SESSION_ENDED:if(this.Mb()&&this.a){const d=this.a.media;var b=this.f.oa(),c=this.f.ta();b=b&&b.language||void 0;c=c&&c.language||void 0;this.R(this.getState(),{source:{url:d.contentId,type:d.contentType,isLive:this.isLive()},currentTime:GW(this),Gg:c,Ff:b})}a.session.removeEventListener(cast.framework.SessionEventType.MEDIA_SESSION,this.V);a.session.removeMessageListener(eW,
|
|
45
|
+
this.P);this.A=!1;this.a=null;this.G.release();this.l=this.F=null}}Cb(a){this.g.debug("New media session",a.mediaSession);EW(this,a.mediaSession)}bb(a){a.value&&a.value.tracks&&this.f&&this.f.load()}Wa(a,b){if(a===eW&&0<this.H.size){const c=iW(b);this.H.forEach(d=>d(c))}}ia(){this.trigger(new _.F(_.ag))}za(a){const b=this;return _.x(function*(){let c=null;const d=yield jW(a,[_.Uf,_.yc],b.K,b.h);d&&(c=new chrome.cast.media.Track(b.fa++,chrome.cast.media.TrackType.TEXT),c.language=d.language,c.name=
|
|
46
|
+
d.label||null,c.trackContentId=d.url,c.trackContentType=d.mimeType,c.customData={mimeType:a.mimeType,url:a.url});return c})}getTextDisplayer(){return null}},vW=!1,sW=new Set;window.__onGCastApiAvailable=uW;var nX=class extends _.vu{constructor(a,b,c){super();this.f=a;this.h=b;this.j=typeof c===_.Wd?c:this.l;this.a=JW(this);this.g=new _.T(bW);this.f&&this.forwardEventsTo(this.f)}destroy(){const a=this;return _.x(function*(){a.a&&(yield wW(a.a),a.a=null);a.f&&a.stopForwardingEventsTo(a.f)})}l(a,b){this.f&&a!==_.Oo&&a!==_.Wo&&(delete b.license,this.f.load(b))}ye(){return!!this.a&&this.a.xc()&&vW}Mb(){return!!this.a&&this.a.Mb()}Ge(){return this.a?this.a.Ge():""}Gd(a){this.a&&this.a.Gd(a)}cast(a){const b=
|
|
47
|
+
this;return _.x(function*(){if(b.a)try{if(yield b.a.cast(),b.f&&b.a){{let d=null;const e=b.f.getLoadedSource();if(e){const f=b.f.getTrackManager(),g=f.getVideoTracks()[0];let h,k;g&&g.mimeType&&(h=g.mimeType);const l=b.f.getConfiguration(),m=f.oa();m&&(m.mimeType&&(k=m.mimeType),m.language&&(l.preferredAudioLanguage=m.language),m.roles.length&&(l.preferredAudioRole=m.roles[0]));const n=f.ta();n&&(n.language&&(l.preferredTextLanguage=n.language),n.roles.length&&(l.preferredTextRole=n.roles[0]));const q=
|
|
48
|
+
e&&typeof e.isLive===_.Mc?e.isLive:b.f.isLive();d={source:e,isLive:q,autoplay:!b.f.isPaused(),currentTime:Math.max(b.f.getPosition()-1,0),Ve:b.f.getPresentationStartTime(),Zb:h,audioMimeType:k,ib:l}}var c=d}yield IW(b);b.a&&(c&&(c.autoplay=!b.f.isPaused()),a?yield b.f.load(a):b.a.a||(yield yW(b.a,c)))}}catch(d){b.g.error("Error while trying to cast",d),c=new _.F(_.r,{detail:d}),b.trigger(c)}})}Fe(){this.a&&this.a.Fe()}ih(a){const b=this;return _.x(function*(){a!==b.h&&(b.h=a,b.a&&(yield wW(b.a)),
|
|
49
|
+
b.a=JW(b))})}sendMessage(a){const b=this;return _.x(function*(){b.a?yield b.a.sendMessage(eW,a):b.g.warn(aW)})}addMessageListener(a){this.a?this.a.addMessageListener(a):this.g.warn(aW)}removeMessageListener(a){this.a?this.a.removeMessageListener(a):this.g.warn(aW)}Eb(){return this.a&&this.a.Eb()}Yb(a){this.a&&this.a.Yb(a)}Be(){this.a&&this.a.Be()}ff(a){this.a&&this.a.ff(a)}df(a){this.a&&this.a.df(a)}cf(a){this.a&&this.a.cf(a)}ef(a){this.a&&this.a.ef(a)}};_.z(bW,nX);
|
|
50
|
+
nX.prototype.setContentReleaseDate=nX.prototype.ef;nX.prototype.setContentArtist=nX.prototype.cf;nX.prototype.setContentImage=nX.prototype.df;nX.prototype.setContentTitle=nX.prototype.ff;nX.prototype.clearContentMetadata=nX.prototype.Be;nX.prototype.setContentMetadata=nX.prototype.Yb;nX.prototype.getContentMetadata=nX.prototype.Eb;nX.prototype.removeMessageListener=nX.prototype.removeMessageListener;nX.prototype.addMessageListener=nX.prototype.addMessageListener;nX.prototype.sendMessage=nX.prototype.sendMessage;
|
|
51
|
+
nX.prototype.changeReceiverId=nX.prototype.ih;nX.prototype.forceDisconnect=nX.prototype.Fe;nX.prototype.cast=nX.prototype.cast;nX.prototype.setPlayerConfigInterceptor=nX.prototype.Gd;nX.prototype.getReceiverName=nX.prototype.Ge;nX.prototype.isCasting=nX.prototype.Mb;nX.prototype.canCast=nX.prototype.ye;nX.prototype.destroy=nX.prototype.destroy;var oX=class extends kX{constructor(a){super(a,"clpp.cast.StateManager");this.I=this.S.bind(this);this.H=this.R.bind(this);this.A=this.da.bind(this);this.w=this.ba.bind(this);this.K=this.X.bind(this);this.J=this.V.bind(this);this.L=this.ia.bind(this);this.G=this.fa.bind(this);this.F=this.P.bind(this);this.f=this.M.bind(this)}init(){const a=cast.framework.events.EventType,b=cast.framework.CastReceiverContext.getInstance().getPlayerManager();b.addEventListener(a.PLAYING,this.I);b.addEventListener(a.PAUSE,
|
|
52
52
|
this.H);b.addEventListener(a.MEDIA_FINISHED,this.A);b.addEventListener(a.BUFFERING,this.w);b.addEventListener(a.SEEKING,this.K);b.addEventListener(a.SEEKED,this.J);b.addEventListener(a.STALLED,this.L);b.addEventListener(a.PLAYER_LOADING,this.G);b.addEventListener(a.ERROR,this.F);b.addEventListener(a.BITRATE_CHANGED,this.f)}destroy(){const a=this,b=()=>Object.getPrototypeOf(Object.getPrototypeOf(this)).destroy;return _.x(function*(){const c=cast.framework.events.EventType,d=cast.framework.CastReceiverContext.getInstance().getPlayerManager();
|
|
53
|
-
d.removeEventListener(c.PLAYING,a.I);d.removeEventListener(c.PAUSE,a.H);d.removeEventListener(c.MEDIA_FINISHED,a.A);d.removeEventListener(c.BUFFERING,a.w);d.removeEventListener(c.SEEKING,a.K);d.removeEventListener(c.SEEKED,a.J);d.removeEventListener(c.STALLED,a.L);d.removeEventListener(c.PLAYER_LOADING,a.G);d.removeEventListener(c.ERROR,a.F);d.removeEventListener(c.BITRATE_CHANGED,a.f);yield b().call(a)})}S(){this.player.trigger(new _.F(_.
|
|
54
|
-
this.a(_.
|
|
55
|
-
null}getMediaUrl(){return this.a.contentUrl||this.a.contentId||null}fb(){return 0}eb(){return 0}
|
|
56
|
-
Z.prototype.getWrapperAdSystems=Z.prototype.getWrapperAdSystems;Z.prototype.canSeek=Z.prototype.canSeek;Z.prototype.getWrapperAdIds=Z.prototype.getWrapperAdIds;Z.prototype.getSequenceLength=Z.prototype.gb;Z.prototype.getPositionInSequence=Z.prototype.sb;Z.prototype.getPodTimeOffset=Z.prototype.Hb;Z.prototype.getPodIndex=Z.prototype.getPodIndex;Z.prototype.getPodType=Z.prototype.
|
|
53
|
+
d.removeEventListener(c.PLAYING,a.I);d.removeEventListener(c.PAUSE,a.H);d.removeEventListener(c.MEDIA_FINISHED,a.A);d.removeEventListener(c.BUFFERING,a.w);d.removeEventListener(c.SEEKING,a.K);d.removeEventListener(c.SEEKED,a.J);d.removeEventListener(c.STALLED,a.L);d.removeEventListener(c.PLAYER_LOADING,a.G);d.removeEventListener(c.ERROR,a.F);d.removeEventListener(c.BITRATE_CHANGED,a.f);yield b().call(a)})}S(){this.player.trigger(new _.F(_.Te));this.a(_.Zo)}R(){this.a(_.Yo)}da(){this.a(_.Oo)}ba(a){a.isBuffering?
|
|
54
|
+
this.a(_.So):(a=this.player.isPaused()?_.Yo:_.Zo,this.a(a))}X(){this.j=1;this.player.trigger(new _.F(_.lg))}V(){this.player.trigger(new _.F(_.kg))}ia(){this.j=2}fa(){this.a(_.Xo)}M(a){const b=this.player.getStats();this.player.trigger(new _.F(_.Lc,{detail:{bandwidth:a.totalBitrate,width:b.width,height:b.height}}))}P(a){a=new _.I(_.G,7,7300,{detailedErrorCode:a.detailedErrorCode,error:a.error,reason:a.reason});this.player.trigger(new _.F(_.r,{detail:a}));this.a(_.Po)}};var Z=class{constructor(a,b,c,d,e){this.a=a;this.f=b;this.l=typeof c===_.t?c:1;this.h=typeof d===_.t?d:1;this.j=typeof e===_.t?e:0}ob(){return"Google Cast Framework"}pb(){return cast.framework.VERSION}ub(){return 0}getId(){return""}getCreativeId(){return""}Qb(){return""}getApiFramework(){return null}getAdSystem(){return""}getAdvertiserName(){return""}getTitle(){return this.a.title||""}getDuration(){return this.a.duration||0}getPosition(){return 0}getSkipTimeOffset(){return this.a.whenSkippable||0}Tb(){return!1}qb(){return this.a.clickThroughUrl||
|
|
55
|
+
null}getMediaUrl(){return this.a.contentUrl||this.a.contentId||null}fb(){return 0}eb(){return 0}Qa(){return 0}Ra(){switch(this.Hb()){case 0:return 0;case -1:return 2;default:return 1}}getPodIndex(){return this.j}Hb(){return this.f.position}sb(){return this.l}gb(){return this.h}getWrapperAdIds(){return[]}canSeek(){return!1}getWrapperAdSystems(){return[]}getWrapperCreativeIds(){return[]}Sb(){return null}};Z.prototype.getVideoElement=Z.prototype.Sb;Z.prototype.getWrapperCreativeIds=Z.prototype.getWrapperCreativeIds;
|
|
56
|
+
Z.prototype.getWrapperAdSystems=Z.prototype.getWrapperAdSystems;Z.prototype.canSeek=Z.prototype.canSeek;Z.prototype.getWrapperAdIds=Z.prototype.getWrapperAdIds;Z.prototype.getSequenceLength=Z.prototype.gb;Z.prototype.getPositionInSequence=Z.prototype.sb;Z.prototype.getPodTimeOffset=Z.prototype.Hb;Z.prototype.getPodIndex=Z.prototype.getPodIndex;Z.prototype.getPodType=Z.prototype.Ra;Z.prototype.getMediaBitrate=Z.prototype.Qa;Z.prototype.getMediaHeight=Z.prototype.eb;Z.prototype.getMediaWidth=Z.prototype.fb;
|
|
57
57
|
Z.prototype.getMediaUrl=Z.prototype.getMediaUrl;Z.prototype.getClickThroughUrl=Z.prototype.qb;Z.prototype.isBumper=Z.prototype.Tb;Z.prototype.getSkipTimeOffset=Z.prototype.getSkipTimeOffset;Z.prototype.getPosition=Z.prototype.getPosition;Z.prototype.getDuration=Z.prototype.getDuration;Z.prototype.getTitle=Z.prototype.getTitle;Z.prototype.getAdvertiserName=Z.prototype.getAdvertiserName;Z.prototype.getAdSystem=Z.prototype.getAdSystem;Z.prototype.getApiFramework=Z.prototype.getApiFramework;
|
|
58
|
-
Z.prototype.getSourceId=Z.prototype.Qb;Z.prototype.getCreativeId=Z.prototype.getCreativeId;Z.prototype.getId=Z.prototype.getId;Z.prototype.getTechnology=Z.prototype.ub;Z.prototype.getAdManagerVersion=Z.prototype.pb;Z.prototype.getAdManagerName=Z.prototype.ob;var
|
|
59
|
-
this.j)}load(){const a=this;return _.x(function*(){
|
|
60
|
-
switch(a.type){case cast.framework.events.EventType.PLAYER_LOADING:this.a=
|
|
61
|
-
break;case cast.framework.events.EventType.BREAK_CLIP_ENDED:a.endedReason===b.SKIPPED?(
|
|
62
|
-
|
|
63
|
-
_.
|
|
64
|
-
this.
|
|
65
|
-
this.f.setActiveById(+a.id)}
|
|
66
|
-
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]),
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
cast.framework.messages.PlayerState,b=
|
|
70
|
-
a.play();return Promise.resolve()}pause(){const a=
|
|
71
|
-
|
|
72
|
-
null}getLoadedSource(){const a=
|
|
73
|
-
b&&typeof b.start===_.t&&typeof b.end===_.t&&(a={start:b.start,end:b.end})}return a}getState(){return this.a?this.a.getState():_.
|
|
74
|
-
this;return _.x(function*(){b.f=new _.
|
|
75
|
-
a}setCmsdManager(){}getNetworkEngine(){return this.F}getSourceIndex(){return this.l}setSourceIndex(a){this.l=a}getPeriods(){return[]}namespace(){return
|
|
76
|
-
c&&typeof b===_.t&&c.startAbsoluteTime!==b&&(this.g.info("Syncing startAbsoluteTime."+`Old value: ${c.startAbsoluteTime}, `+`new value: ${b}`),c.startAbsoluteTime=b,a=Object.assign({},a,{media:c}));{c=cast.framework.messages.StreamType;b=a.media;var d=!!b;const e=this.isLive(),f=d&&!b.metadata,g=!!a.liveSeekableRange;if(d&&g&&(!e||e&&f)){d=
|
|
77
|
-
d;b.metadata=h}b.streamType=c.LIVE;a=Object.assign({},a,{media:b})}}return a}G(a,b){var c=null;a.media.customData&&(c=
|
|
78
|
-
a)a=Object.assign({},b.shakaConfig,{streaming:{lowLatencyMode:!0}}),b=Object.assign({},b,{shakaConfig:a});return b}getTextDisplayer(){return null}setDrmCustomDataModifier(){}setCdnErrorCallback(){}detach(){}};var
|
|
79
|
-
c.customNamespaces={};c.customNamespaces[
|
|
80
|
-
this.A);a.start(c);a.addCustomMessageListener(
|
|
81
|
-
b){
|
|
82
|
-
1;0<=f;--f){var g=e[f].getAttribute("contentType");if(g===_.w||g===_.p){g=e[f].getAttribute(_.
|
|
83
|
-
(new XMLSerializer).serializeToString(a)}if(c=b.getElementsByTagName(_.
|
|
84
|
-
(new XMLSerializer).serializeToString(a)}return a}C(a){const b=this;return _.x(function*(){let c=a;var d;c.media.customData&&(d=
|
|
85
|
-
d.url,c.media.contentType=d.type,d.Zb&&(c.media.hlsVideoSegmentFormat=
|
|
86
|
-
c=b.getLiveSeekableRange();if(c){a=c.start;c=c.end;var d=this.m.getConfiguration().startTime;typeof a!==_.t||typeof c!==_.t||typeof d!==_.t||d>=a&&d<=c||(b=b.getMediaTimeForAbsoluteTime(d),typeof b===_.t&&b>=a&&b<=c&&this.m.seek(b))}_.
|
|
87
|
-
|
|
88
|
-
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(
|
|
89
|
-
this;return _.x(function*(){a.j.release()})}A(a){switch(a.field){case "mediaInfo":a.value&&(a=a.value,a.breaks&&this.f.trigger(new _.F(_.
|
|
90
|
-
|
|
58
|
+
Z.prototype.getSourceId=Z.prototype.Qb;Z.prototype.getCreativeId=Z.prototype.getCreativeId;Z.prototype.getId=Z.prototype.getId;Z.prototype.getTechnology=Z.prototype.ub;Z.prototype.getAdManagerVersion=Z.prototype.pb;Z.prototype.getAdManagerName=Z.prototype.ob;var pX=class{constructor(a){this.a=a}getCuePoints(){return this.a.map(a=>a.position)}Kb(){return!!this.a.find(a=>0===a.position)}Jb(){return!!this.a.find(a=>-1===a.position)}};pX.prototype.hasPostroll=pX.prototype.Jb;pX.prototype.hasPreroll=pX.prototype.Kb;pX.prototype.getCuePoints=pX.prototype.getCuePoints;var qX=class{constructor(a){this.m=a;this.a=null;this.j=this.w.bind(this);this.f=[cast.framework.events.EventType.PLAYER_LOADING,cast.framework.events.EventType.BREAK_CLIP_LOADING,cast.framework.events.EventType.BREAK_STARTED,cast.framework.events.EventType.BREAK_ENDED,cast.framework.events.EventType.BREAK_CLIP_STARTED,cast.framework.events.EventType.BREAK_CLIP_ENDED,cast.framework.events.EventType.PLAYING,cast.framework.events.EventType.PAUSE,cast.framework.events.EventType.BUFFERING];OW().addEventListener(this.f,
|
|
59
|
+
this.j)}load(){const a=this;return _.x(function*(){KW&&(KW=!1,NW(a,0))})}start(){return _.x(function*(){OW().play()})}o(){}resume(){-1!==this.getPosition()&&OW().play()}pause(){-1!==this.getPosition()&&OW().pause()}skip(){}getVolume(){return this.m.getVolume()||0}setVolume(a){this.m.setVolume(a)}getPosition(){const a=this.a&&this.a.getBreakClipCurrentTimeSec();return typeof a===_.t?a:-1}l(){return!0}h(){const a=this;return _.x(function*(){OW().removeEventListener(a.f,a.j)})}w(a){const b=cast.framework.events.EndedReason;
|
|
60
|
+
switch(a.type){case cast.framework.events.EventType.PLAYER_LOADING:this.a=OW().getBreakManager();this.a.setPlayWatchedBreak(!0);a=this.a.getBreaks();this.m.trigger(new _.F(_.pc,{adsTimeline:new pX(a)}));break;case cast.framework.events.EventType.BREAK_CLIP_LOADING:QW(this,_.bc,a);break;case cast.framework.events.EventType.BREAK_STARTED:QW(this,_.Sb,a);break;case cast.framework.events.EventType.BREAK_ENDED:QW(this,_.Tb,a);break;case cast.framework.events.EventType.BREAK_CLIP_STARTED:QW(this,_.hc,a);
|
|
61
|
+
break;case cast.framework.events.EventType.BREAK_CLIP_ENDED:a.endedReason===b.SKIPPED?(QW(this,_.gc,a),QW(this,_.lc,a)):a.endedReason===b.STOPPED?QW(this,_.lc,a):a.endedReason===b.END_OF_STREAM?(QW(this,_.Wb,a),QW(this,_.lc,a)):a.endedReason===b.ERROR&&NW(this,1);break;case cast.framework.events.EventType.PLAYING:QW(this,_.fc,a);break;case cast.framework.events.EventType.PAUSE:QW(this,_.dc,a);break;case cast.framework.events.EventType.BUFFERING:a.isBuffering?QW(this,_.Ub,a):QW(this,_.fc,a)}}};
|
|
62
|
+
qX.prototype.getPosition=qX.prototype.getPosition;qX.prototype.setVolume=qX.prototype.setVolume;qX.prototype.getVolume=qX.prototype.getVolume;qX.prototype.skip=qX.prototype.skip;qX.prototype.pause=qX.prototype.pause;qX.prototype.resume=qX.prototype.resume;var KW=!1;var rX=class{constructor(a){this.Va=a;this.a=this.f.bind(this)}init(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().addEventListener(RW(),this.a)}release(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().removeEventListener(RW(),this.a)}getTimelineCues(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager().getTimedMetadata().map(a=>SW(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=
|
|
63
|
+
_.Xf;break;case cast.framework.events.EventType.TIMED_METADATA_ENTER:b=_.Yf;break;case cast.framework.events.EventType.TIMED_METADATA_EXIT:b=_.Zf}b&&this.Va(new _.F(b,{detail:SW(a.timedMetadataInfo)}))}else for(b of this.getTimelineCues())this.Va(new _.F(_.Xf,{detail:b}))}};var sX=class extends _.U{constructor(){super();this.g=new _.T("clpp.cast.TrackManager");this.m=null;this.o=1E9;this.h=[];this.j=[];this.l=this.w.bind(this);this.a=this.f=null}initialize(a){this.m=a;TW().addEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.l)}release(){this.h=[];this.j=[];this.a=this.f=null}load(){}destroy(){this.m=null;TW().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.l)}getVideoTracks(){return[]}getAudioTracks(){return this.h}pa(){return this.j}qa(){return null}Oa(){const a=
|
|
64
|
+
this.oa();return a&&a.renditions[0]}Sa(){const a=this.ta();return a&&a.renditions[0]}rb(){return null}Fb(){return null}Gb(){return null}Fa(){return null}oa(){let a=null;if(this.f){let b=this.f.getActiveId();typeof b===_.t&&(b=b.toString(),a=this.getAudioTracks().find(c=>c.id===b)||null)}return a}ta(){let a=null;if(this.a){let b=this.a.getActiveIds()[0];typeof b===_.t&&(b=b.toString(),a=this.pa().find(c=>c.id===b)||null)}return a}Ab(){this.g.warn("Video tracks unavailable on Cast")}ya(a){a&&this.f&&
|
|
65
|
+
this.f.setActiveById(+a.id)}Ua(a){this.a&&(a?this.a.setActiveByIds([+a.id]):this.a.setActiveByIds([]))}jb(){this.g.warn("Video renditions unavailable on Cast")}yb(a){this.ya(a&&a.track)}zb(a){this.Ua(a&&a.track)}addTextTrack(a){const b=this;return _.x(function*(){var c=b.m.getConfiguration();if((c=yield jW(a,Object.values(cast.framework.messages.CaptionMimeType),b.m.getNetworkEngine(),c))&&b.a){const d=new cast.framework.messages.Track(b.o++,cast.framework.messages.TrackType.TEXT);d.isInband=!1;d.language=
|
|
66
|
+
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]),VW(b)}catch(e){throw b.g.warn("failed on track",a),e;}}})}va(){return!0}w(){this.f=TW().getAudioTracksManager();var a=this.f.getTracks();this.h=UW(_.M,a);VW(this);a=this.m.getConfiguration();WW(this,_.M,a.preferredAudioLanguage,a.preferredAudioRole);WW(this,_.L,a.preferredTextLanguage,a.preferredTextRole)}};sX.prototype.isAbrEnabled=sX.prototype.va;
|
|
67
|
+
sX.prototype.addTextTrack=sX.prototype.addTextTrack;sX.prototype.setTextRendition=sX.prototype.zb;sX.prototype.setAudioRendition=sX.prototype.yb;sX.prototype.setVideoRendition=sX.prototype.jb;sX.prototype.setTextTrack=sX.prototype.Ua;sX.prototype.setAudioTrack=sX.prototype.ya;sX.prototype.setVideoTrack=sX.prototype.Ab;sX.prototype.getTextTrack=sX.prototype.ta;sX.prototype.getAudioTrack=sX.prototype.oa;sX.prototype.getVideoTrack=sX.prototype.Fa;sX.prototype.getLoadingTextRendition=sX.prototype.Gb;
|
|
68
|
+
sX.prototype.getLoadingAudioRendition=sX.prototype.Fb;sX.prototype.getLoadingVideoRendition=sX.prototype.rb;sX.prototype.getTextRendition=sX.prototype.Sa;sX.prototype.getAudioRendition=sX.prototype.Oa;sX.prototype.getVideoRendition=sX.prototype.qa;sX.prototype.getTextTracks=sX.prototype.pa;sX.prototype.getAudioTracks=sX.prototype.getAudioTracks;sX.prototype.getVideoTracks=sX.prototype.getVideoTracks;var tX=class extends _.vu{constructor(){super();this.g=new _.T(cW);this.h=this.w=_.wl();this.A=null;this.l=-1;this.F=new _.Dr;this.f=this.o=this.j=this.a=this.B=null;this.C=!1}init(a,b){this.B=a;b&&(this.h=this.w=b);a=XW();a.setMessageInterceptor(cast.framework.messages.MessageType.MEDIA_STATUS,this.H.bind(this));a.setMediaPlaybackInfoHandler(this.G.bind(this));this.a=new oX(this);this.a.init();this.j=new sX;this.j.initialize(this);this.o=new rX(c=>this.trigger(c));this.o.init()}unload(){const a=
|
|
69
|
+
cast.framework.messages.PlayerState,b=XW();b.getPlayerState()!==a.IDLE&&b.stop();this.j&&this.j.release();this.o&&this.o.release();this.f=null;return Promise.resolve()}release(){return this.unload().then(()=>{this.a&&this.a.release()})}destroy(){const a=this;return _.x(function*(){a.B=null;a.w=_.wl();a.h=a.w;a.l=-1;a.A=null;a.a&&(yield a.a.destroy(),a.a=null);a.j&&(a.j.destroy(),a.j=null)})}play(){const a=XW();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot play during ads playout.");
|
|
70
|
+
a.play();return Promise.resolve()}pause(){const a=XW();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot pause during ads playout.");a.pause();return Promise.resolve()}isPaused(){return XW().getPlayerState()===cast.framework.messages.PlayerState.PAUSED}isEnded(){return XW().getPlayerState()===cast.framework.messages.PlayerState.IDLE}seek(a){const b=XW();if(null!==b.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject(VV);b.seek(a);return Promise.resolve()}getPosition(){return this.getMediaPosition()}setSeekInterceptor(){}setPlaybackSessionId(){}getBandwidthEstimate(){return null}getMediaPosition(){return XW().getCurrentTimeSec()}getDuration(){return this.getMediaDuration()}getMediaDuration(){const a=
|
|
71
|
+
XW().getDurationSec();return typeof a===_.t?-1===a?Infinity:a:-1}getPlaybackRate(){return XW().getPlaybackRate()}setPlaybackRate(a){if(0<a){const b=new cast.framework.messages.SetPlaybackRateRequestData;b.playbackRate=a;XW().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||
|
|
72
|
+
null}getLoadedSource(){const a=XW().getMediaInformation();if(a){var b=XW().getPlaybackConfig();b=!!b&&b.protectionSystem!==cast.framework.ContentProtection.NONE;var c=this.A&&-1!==this.l?this.A[this.l]:null;c=c?c.name:void 0;!c&&a.metadata&&(c=a.metadata.title);return{url:a.contentId,type:a.contentType,aj:b,name:c}}return null}getDrmInfo(){return null}getPresentationStartTime(){return XW().getStartAbsoluteTime()}getSeekRange(){let a={start:0,end:this.getDuration()};if(this.isLive()){const b=XW().getLiveSeekableRange();
|
|
73
|
+
b&&typeof b.start===_.t&&typeof b.end===_.t&&(a={start:b.start,end:b.end})}return a}getState(){return this.a?this.a.getState():_.kv}getStats(){var a=_.Lo();if(this.f){a=XW().getStats();this.f.h=a.estimatedBandwidth||NaN;this.f.w=a.streamBandwidth||NaN;var b=this.f,c=a.height||NaN;b.A=a.width||NaN;b.j=c;b=this.f;c=typeof a.decodedFrames===_.t?a.decodedFrames:NaN;b.o=typeof a.droppedFrames===_.t?a.droppedFrames:NaN;b.l=c;a=this.f.getStats()}return a}isLive(){return Infinity===this.getDuration()}load(a){const b=
|
|
74
|
+
this;return _.x(function*(){b.f=new _.jv;b.a.l=b.f.a;b.A=_.bp(a);b.h=_.yl(b.w,a);if(b.C)b.C=!1;else{var c=b.A[b.l],d=new cast.framework.messages.LoadRequestData;d.autoplay=b.h.autoplay;typeof b.h.startTime===_.t&&(d.currentTime=b.h.startTime);c.type&&(d.media.contentType=c.type);d.media.contentId=c.url;d.media.customData={playerConfiguration:hW(b.h),local:!0};yield XW().load(d)}})}getBufferInfo(){this.g.warn(_.qa);return new _.uu}getTrackManager(){return this.j}getConfiguration(){return this.h}getSurface(){return this.B}getTimeline(){return null}setupPlaylist(){return Promise.reject(_.$a)}appendLoad(){return Promise.reject(_.$a)}seekWith(){return Promise.reject(_.$a)}setNetworkEngine(a){this.F=
|
|
75
|
+
a}setCmsdManager(){}getNetworkEngine(){return this.F}getSourceIndex(){return this.l}setSourceIndex(a){this.l=a}getPeriods(){return[]}namespace(){return cW}getTimelineCues(){return this.o&&this.o.getTimelineCues()||[]}getCueTimeline(){return null}resetAbr(){this.g.warn(ZV)}onError(a){a=new _.F(_.r,{detail:a});this.trigger(a)}canPlay(){return _.Jk()?2:0}H(a){a=Object.assign({},a);a.customData||(a.customData={});a.customData.stats=hW(this.getStats());var b=XW(),c=a.media||b.getMediaInformation();b=b.getStartAbsoluteTime();
|
|
76
|
+
c&&typeof b===_.t&&c.startAbsoluteTime!==b&&(this.g.info("Syncing startAbsoluteTime."+`Old value: ${c.startAbsoluteTime}, `+`new value: ${b}`),c.startAbsoluteTime=b,a=Object.assign({},a,{media:c}));{c=cast.framework.messages.StreamType;b=a.media;var d=!!b;const e=this.isLive(),f=d&&!b.metadata,g=!!a.liveSeekableRange;if(d&&g&&(!e||e&&f)){d=XW().getStartAbsoluteTime();if(typeof d===_.t){b.startAbsoluteTime=d;let h;f?h=new cast.framework.messages.GenericMediaMetadata:h=b.metadata;h.sectionStartAbsoluteTime=
|
|
77
|
+
d;b.metadata=h}b.streamType=c.LIVE;a=Object.assign({},a,{media:b})}}return a}G(a,b){var c=null;a.media.customData&&(c=iW(a.media.customData.playerConfiguration));var d=c?c.abr||null:null,e=b;d&&typeof d.defaultBandwidthEstimate===_.t?e.initialBandwidth=d.defaultBandwidthEstimate:e.initialBandwidth=void 0;$W(c,b);d=null;a.media.customData&&(d=iW(a.media.customData["com.castlabs.reactnative.PlayerConfiguration"]));a=(a=d&&d.LiveConfiguration)?0===a.liveEdgeLatencyMs:!1;if(a=null!=c&&c.lowLatencyMode||
|
|
78
|
+
a)a=Object.assign({},b.shakaConfig,{streaming:{lowLatencyMode:!0}}),b=Object.assign({},b,{shakaConfig:a});return b}getTextDisplayer(){return null}setDrmCustomDataModifier(){}setCdnErrorCallback(){}detach(){}};var bX=class{constructor(){this.a=!1;this.g=new _.T(dW);this.f=this.m=null;this.h=new Set;this.A=this.G.bind(this);this.w=this.B.bind(this);this.j=null;this.o=new _.Rt;this.l=null}init(a){a&&(this.f=new tX,_.Tr(a,this.f),this.m=a,this.o.on(window,"unload",()=>{const b=this;return _.x(function*(){b.m&&b.m.getState()!==_.Wo&&(yield gW(b.m))})}))}start(){if(!this.a&&window.cast&&cast.framework&&cast.framework.CastReceiverContext){this.a=!0;var a=dX(),b=dX().getPlayerManager(),c=new cast.framework.CastReceiverOptions;
|
|
79
|
+
c.customNamespaces={};c.customNamespaces[eW]=cast.framework.system.MessageType.JSON;var d=new cast.framework.PlaybackConfig;d.manifestHandler=this.F.bind(this);d.shakaConfig={streaming:{ignoreTextStreamFailures:!0}};d.enableSmoothLiveRefresh=!0;c.playbackConfig=d;if(d=this.m&&this.m.getSurface().getMedia())c.mediaElement=d;c.disableIdleTimeout=!0;c.maxInactivity=Infinity;b.setMessageInterceptor(cast.framework.messages.MessageType.LOAD,this.C.bind(this));b.addEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,
|
|
80
|
+
this.A);a.start(c);a.addCustomMessageListener(eW,this.w)}}stop(){if(this.a){this.a=!1;this.o.release();const a=dX();dX().getPlayerManager().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.A);a.removeCustomMessageListener(eW,this.w);a.stop();this.m=this.f=null}}Gd(a){this.j=a}zi(a){this.l=a}on(a,b){dX().addEventListener(a,b)}off(a,b){dX().removeEventListener(a,b)}addMessageListener(a){typeof a===_.Wd&&this.h.add(a)}removeMessageListener(a){typeof a===_.Wd&&this.h.delete(a)}sendMessage(a,
|
|
81
|
+
b){dX().sendCustomMessage(eW,b,hW(a))}xc(){return this.a}Eb(){return eX()}Yb(a){fX(this,a)}Ni(a){const b=eX();let c=null;a?c=Object.assign({},b,a):c=b;fX(this,c)}F(a){a=a.trim();if(a.startsWith("#EXTM3U"))return hX(this,a);try{var b=(new DOMParser).parseFromString(a,_.Vf)}catch(k){return a}var c=b.getElementsByTagName("MPD")[0];if(c){a=c;this.g.debug("Detected DASH, parsing");b=dX();c=a.getElementsByTagName("Period");for(var d=c.length-1;0<=d;--d){var e=c[d].getElementsByTagName(_.fa);for(var f=e.length-
|
|
82
|
+
1;0<=f;--f){var g=e[f].getAttribute("contentType");if(g===_.w||g===_.p){g=e[f].getAttribute(_.ve);var h=e[f].getElementsByTagName(_.mb);for(let k=h.length-1;0<=k;--k){const l=h[k].getAttribute(_.ve)||g,m=h[k].getAttribute(_.md);let n=h[k].getAttribute(_.Hg)||void 0,q=h[k].getAttribute(_.Zd)||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(_.mb).length||c[d].removeChild(e[f])}}c[d].getElementsByTagName(_.fa).length||a.removeChild(c[d])}return a=
|
|
83
|
+
(new XMLSerializer).serializeToString(a)}if(c=b.getElementsByTagName(_.rb)[0]){a=c;this.g.debug("Detected Smooth, parsing");b=dX();c=a.getElementsByTagName("StreamIndex");for(d=c.length-1;0<=d;--d)if(c[d].getAttribute("Type")===_.w){e=c[d].getElementsByTagName(_.kb);for(f=e.length-1;0<=f;--f)g=e[f].getAttribute(_.Ra)||void 0,h=e[f].getAttribute(_.Qa)||void 0,void 0!==g&&(g=+g),void 0!==h&&(h=+h),b.canDisplayType(_.rg,void 0,g,h)||c[d].removeChild(e[f]);c[d].getElementsByTagName(_.kb).length||a.removeChild(c[d])}a=
|
|
84
|
+
(new XMLSerializer).serializeToString(a)}return a}C(a){const b=this;return _.x(function*(){let c=a;var d;c.media.customData&&(d=iW(c.media.customData.playerConfiguration));if(b.m&&d){b.j&&(d=(yield Promise.resolve(b.j(d)))||d);d.ima&&(yield MW(c.media,d.ima,b.m.getNetworkEngine()));typeof d.startTime===_.t&&d.startTime!==c.currentTime?c.currentTime=d.startTime:d.startTime=c.currentTime||null;c.media.customData.local||(b.f.C=!0,yield _.ds(b.m,d),yield _.es(b.m),d=b.m.getLoadedSource(),c.media.contentId=
|
|
85
|
+
d.url,c.media.contentType=d.type,d.Zb&&(c.media.hlsVideoSegmentFormat=kW(d.Zb,_.N)),d.audioMimeType&&(c.media.hlsSegmentFormat=kW(d.audioMimeType,_.M)));const e=c.media.metadata;e&&typeof e.sectionStartAbsoluteTime===_.t&&(d=e.sectionStartAbsoluteTime,e.sectionStartAbsoluteTime=0===d?1E-8:d);void 0===c.autoplay&&(c.autoplay=b.m.getConfiguration().autoplay)}b.l&&(d=yield Promise.resolve(b.l(c)))&&(c=d);return c})}G(a){if(this.m&&(!a.media.customData||!a.media.customData.local)){var b=dX().getPlayerManager(),
|
|
86
|
+
c=b.getLiveSeekableRange();if(c){a=c.start;c=c.end;var d=this.m.getConfiguration().startTime;typeof a!==_.t||typeof c!==_.t||typeof d!==_.t||d>=a&&d<=c||(b=b.getMediaTimeForAbsoluteTime(d),typeof b===_.t&&b>=a&&b<=c&&this.m.seek(b))}_.gs(this.m)}}B(a){if(0<this.h.size){const b=iW(a.data);this.h.forEach(c=>c(b))}}};_.z(dW,bX);bX.prototype.updateContentMetadata=bX.prototype.Ni;bX.prototype.setContentMetadata=bX.prototype.Yb;bX.prototype.getContentMetadata=bX.prototype.Eb;bX.prototype.isApiReady=bX.prototype.xc;
|
|
87
|
+
bX.prototype.sendMessage=bX.prototype.sendMessage;bX.prototype.removeMessageListener=bX.prototype.removeMessageListener;bX.prototype.addMessageListener=bX.prototype.addMessageListener;bX.prototype.off=bX.prototype.off;bX.prototype.on=bX.prototype.on;bX.prototype.setLoadRequestDataInterceptor=bX.prototype.zi;bX.prototype.setPlayerConfigInterceptor=bX.prototype.Gd;bX.prototype.stop=bX.prototype.stop;bX.prototype.start=bX.prototype.start;bX.prototype.init=bX.prototype.init;bX.getInstance=cX;var aX=null;var uX=class{constructor(a){this.f=a;this.a=null;this.j=new _.Rt;this.w=[cast.framework.RemotePlayerEventType.IS_PLAYING_BREAK_CHANGED,cast.framework.RemotePlayerEventType.CURRENT_BREAK_CLIP_NUMBER_CHANGED,cast.framework.RemotePlayerEventType.MEDIA_INFO_CHANGED,cast.framework.RemotePlayerEventType.IS_PAUSED_CHANGED]}load(){const a=this;return _.x(function*(){a.a=a.f.l;if(a.a){const b=a.a.controller,c=a.A.bind(a);for(const d of a.w)a.j.on(b,d,c)}})}start(){return _.x(function*(){})}o(){}resume(){this.a&&
|
|
88
|
+
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(fW,{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===_.t&&(a=b));return a}l(){return!0}h(){const a=
|
|
89
|
+
this;return _.x(function*(){a.j.release()})}A(a){switch(a.field){case "mediaInfo":a.value&&(a=a.value,a.breaks&&this.f.trigger(new _.F(_.pc,{adsTimeline:new pX(a.breaks)})));break;case "isPlayingBreak":a.value?jX(this,_.Sb):(jX(this,_.Wb),jX(this,_.lc),jX(this,_.Tb));break;case "currentBreakClipNumber":0<=a.value&&(0<a.value&&(jX(this,_.Wb),jX(this,_.lc)),jX(this,_.hc));break;case "isPaused":this.a.isPlayingBreak&&(a.value?jX(this,_.dc):jX(this,_.fc))}}};uX.prototype.getPosition=uX.prototype.getPosition;
|
|
90
|
+
uX.prototype.setVolume=uX.prototype.setVolume;uX.prototype.getVolume=uX.prototype.getVolume;uX.prototype.skip=uX.prototype.skip;uX.prototype.pause=uX.prototype.pause;uX.prototype.resume=uX.prototype.resume;_.pp(new class{name(){return"clpp.cast.ads.SenderAdsManagerFactory"}a(a,b){return a.namespace()!==_.dd?!1:!(!b||!b.ima)}create(a){return new uX(a.a)}});_.pp(new class{name(){return"clpp.cast.ads.AdsManagerFactory"}a(a,b){return cX().xc()?!(!b||!b.ima):!1}create(a){return new qX(a)}});};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.f.on(a.m,_.
|
|
8
|
-
|
|
9
|
-
d;a.a.setAdPlayerInfo(e);a.a.reportAdStarted(c)}}catch(c){a.g.error("Could not create ad analytics session",c)}}},
|
|
10
|
-
b.connectionType);a.a=Conviva.Analytics.buildVideoAnalytics();a.o=!1;b={};b[Conviva.Constants.FRAMEWORK_NAME]=_.
|
|
11
|
-
new _.
|
|
12
|
-
h);if(h=a.m.getStats()){h=h.decodedFrames;const k=h-a.H;a.H=h;isFinite(k)&&(a.g.debug("Current FPS",k),a.a.reportPlaybackMetric(Conviva.Constants.Playback.RENDERED_FRAMERATE,k))}}});a.C=!0;a.h=!0;a.I=!1;0<a.j.length&&(a.g.debug("Report deferred events"),a.j.forEach(h=>{h.
|
|
13
|
-
a.a&&(a.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED),a.a.reportPlaybackEnded(),a.a.release(),Conviva.Analytics.release(),a.o=!0,a.C=!1,a.A=!1,a.h=!1,a.w=null,a.B=!1,a.P=0,a.J=!1,a.j=[],a.H=0)},
|
|
14
|
-
a.g.debug("Conviva does not report when casting.")):a.g.debug("Conviva plugin is loaded but not configured. Will do nothing.")},
|
|
15
|
-
a=a.ad;this.j||(this.g.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.a.setContentInfo(b)}}else this.j.push({
|
|
24
|
-
var b=a.ad;a=0===b.
|
|
25
|
-
|
|
26
|
-
this.I=!0,
|
|
27
|
-
this.f=null,this.h&&(this.h.destroy(),this.h=null))}onPlayerWillRelease(){this.a&&(this.f.release(),this.h&&this.h.release())}id(){return"conviva"}reportAppEvent(a,b){return this.f?this.f.reportAppEvent(a,b):!1}};_.z("clpp.conviva.ConvivaPlugin",
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var vV="Ad Error",wV="onAdBreakStarted()",xV="onAdBreakStopped()",yV=function(a){var b=_.Yk();let c=Conviva.Constants.DeviceType.DESKTOP,d=Conviva.Constants.DeviceCategory.WEB;const e=b.os;b=b.osVersion.name;let f="";_.Kk()&&(f="Apple");_.Jk()?(f="Google",c=Conviva.Constants.DeviceType.SETTOP,d=Conviva.Constants.DeviceCategory.CHROMECAST):_.Lk()?(c=Conviva.Constants.DeviceType.MOBILE,/(android)/i.test(navigator.userAgent)?d=Conviva.Constants.DeviceCategory.ANDROID_DEVICE:_.Kk()&&(d=Conviva.Constants.DeviceCategory.APPLE_DEVICE)):
|
|
2
|
+
_.Dk()||_.Ak()||_.zk("Hisense")?(c=Conviva.Constants.DeviceType.SMARTTV,d=Conviva.Constants.DeviceCategory.SMART_TV,_.Dk()?(b="",f="LG",d=Conviva.Constants.DeviceCategory.LG_TV):_.Ak()?(f="Samsung",d=Conviva.Constants.DeviceCategory.SAMSUNG_TV):_.zk("Hisense")&&(b="",f="Hisense")):_.zk("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},zV=function(a){return a?Conviva.Constants.StreamType.LIVE:Conviva.Constants.StreamType.VOD},AV=function(a){return 0===a?"Pre-roll":-1===a?"Post-roll":"Mid-roll"},CV=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
|
+
zV(!!d);e[Conviva.Constants.ASSET_NAME]=vV;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"]=BV(a.getId()),e["c3.ad.creativeId"]=BV(a.getCreativeId()),e["c3.ad.system"]=BV(a.getAdSystem()),e["c3.ad.mediaFileApiFramework"]=BV(a.getApiFramework()),e["c3.ad.advertiser"]=BV(a.getAdvertiserName()),e["c3.ad.position"]=AV(a.getPodIndex()),e["c3.ad.technology"]=0===a.ub()?Conviva.Constants.AdType.CLIENT_SIDE:
|
|
5
|
+
Conviva.Constants.AdType.SERVER_SIDE,e["c3.ad.adManagerName"]=BV(a.ob()),e["c3.ad.adManagerVersion"]=BV(a.pb()),e["c3.ad.advertiserCategory"]=BV(null),e["c3.ad.advertiserId"]=BV(null),e["c3.ad.breakId"]=BV(null),e["c3.ad.campaignName"]=BV(null),e["c3.ad.category"]=BV(null),e["c3.ad.classification"]=BV(null),e["c3.ad.creativeName"]=BV(null),e["c3.ad.sequence"]=BV(a.sb()),e["c3.ad.sessionStartEvent"]=BV(null),e["c3.ad.unitName"]=BV(null),e["c3.ad.dayPart"]=BV(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"]=BV(b),e["c3.ad.firstAdSystem"]=BV(c),e["c3.ad.firstCreativeId"]=BV(a));return e},BV=function(a){return a?""+a:"NA"},GV=function(a){a.f.on(a.m,_.Sb,a.C.bind(a));a.f.on(a.m,_.Tb,a.F.bind(a));a.f.on(a.m,_.hc,a.L.bind(a));a.f.on(a.m,_.ec,a.l.bind(a));a.f.on(a.m,_.dc,a.l.bind(a));a.f.on(a.m,_.fc,a.l.bind(a));a.f.on(a.m,_.Ub,a.l.bind(a));a.f.on(a.m,_.lc,a.M.bind(a));
|
|
7
|
+
a.f.on(a.m,_.gc,a.K.bind(a));a.f.on(a.m,_.Vb,a.G.bind(a));a.f.on(a.m,_.ac,a.I.bind(a));a.f.on(a.m,_.bc,a.J.bind(a));a.f.on(a.m,_.Xb,a.H.bind(a));a.f.on(a.m,_.cc,a.S.bind(a));a.f.on(a.m,_.nc,a.P.bind(a));a.f.on(a.m,_.r,b=>{var c=b.detail;if(10003===c.code&&(a.g.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=vV}null===a.a&&DV(a,null);a.a.reportAdError(c,b.FATAL);a.h=!0;a.g.debug("Ad Playback Failure");
|
|
8
|
+
EV(a,FV,c)}})},EV=function(a,b,c=vV){if(a.a){a.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED);switch(b){case FV:a.a.reportAdFailed(c,CV(null,a.B,a.A));break;case HV:a.a.reportAdSkipped();break;default:a.a.reportAdEnded()}a.a.release();a.a=null;a.j=!1}},DV=function(a,b){if(!a.o){a.h=!1;try{if(a.a=Conviva.Analytics.buildAdAnalytics(a.R()),b){const c=CV(b,a.B,a.A,a.m.isLive()),d=String(b.pb()),e={};e[Conviva.Constants.FRAMEWORK_NAME]=b.ob();e[Conviva.Constants.FRAMEWORK_VERSION]=
|
|
9
|
+
d;a.a.setAdPlayerInfo(e);a.a.reportAdStarted(c)}}catch(c){a.g.error("Could not create ad analytics session",c)}}},IV=function(a,b){const c={};c[Conviva.Constants.LOG_LEVEL]=Conviva.Constants.LogLevel.DEBUG;b.serviceUrl&&(a.g.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(yV(b));b.connectionType&&Conviva.Analytics.reportDeviceMetric(Conviva.Constants.Network.CONNECTION_TYPE,
|
|
10
|
+
b.connectionType);a.a=Conviva.Analytics.buildVideoAnalytics();a.o=!1;b={};b[Conviva.Constants.FRAMEWORK_NAME]=_.ra;b[Conviva.Constants.FRAMEWORK_VERSION]=_.ea;a.a.setPlayerInfo(b)},JV=function(a){return a.m.getConfiguration().autoplay||!1},LV=function(a){if(!a.l)if(a.C)a.g.warn("Current session still active. No-op.");else{var b=a.m.getLoadedSource()||a.K,c=a.m.getConfiguration().conviva||null,d=c&&c.viewerId||"N/A",e=c&&c.defaultResource||"N/A";a.g.debug(a.m.getConfiguration().source);var f={},g=
|
|
11
|
+
new _.rm(b.url);b&&(f[Conviva.Constants.ASSET_NAME]=b.name||"N/A",f[Conviva.Constants.STREAM_URL]=_.fj(g));f[Conviva.Constants.PLAYER_NAME]=c.playerName||_.ra;f[Conviva.Constants.VIEWER_ID]=d;f[Conviva.Constants.DEFAULT_RESOURCE]=e;if(c&&!_.B(c.customTags))for(const h in c.customTags)f[h]=c.customTags[h];a.a.reportPlaybackRequested(f);a.a.setCallback(()=>{a.g.debug("reportMiscellaneousMetrics()");if(KV(a)){var h=1E3*a.m.getPosition();a.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAY_HEAD_TIME,
|
|
12
|
+
h);if(h=a.m.getStats()){h=h.decodedFrames;const k=h-a.H;a.H=h;isFinite(k)&&(a.g.debug("Current FPS",k),a.a.reportPlaybackMetric(Conviva.Constants.Playback.RENDERED_FRAMERATE,k))}}});a.C=!0;a.h=!0;a.I=!1;0<a.j.length&&(a.g.debug("Report deferred events"),a.j.forEach(h=>{h.Xf(h.args)}));a.j=[]}},MV=function(a){if(!a.l&&a.a){const b=zV(a.m.isLive()),c={};c[Conviva.Constants.IS_LIVE]=b;c[Conviva.Constants.DURATION]=a.m.getDuration();a.a.setContentInfo(c)}},KV=function(a){return null!==a.a&&a.C},NV=function(a){a.g.debug("terminateSession()");
|
|
13
|
+
a.a&&(a.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED),a.a.reportPlaybackEnded(),a.a.release(),Conviva.Analytics.release(),a.o=!0,a.C=!1,a.A=!1,a.h=!1,a.w=null,a.B=!1,a.P=0,a.J=!1,a.j=[],a.H=0)},PV=function(a,b){const c=b.getConfiguration();a.a=!_.B(c.conviva)&&typeof c.conviva===_.Ee;a.a?"undefined"===typeof window.Conviva?(a.g.warn("Conviva SDK is not loaded. Will do nothing."),a.a=!1,a=new _.I(1,9,9E3),OV(b,a)):b.namespace()===_.dd&&(a.a=!1,
|
|
14
|
+
a.g.debug("Conviva does not report when casting.")):a.g.debug("Conviva plugin is loaded but not configured. Will do nothing.")},QV=function(a){const b=[];typeof a===_.Ee&&(a.customerKey||b.push("customerKey"),a.viewerId||b.push("viewerId"));if(0<b.length)throw new _.I(1,9,9001,{missingKeys:b});},OV=function(a,b){a.trigger(new _.F(_.r,{detail:b}))};var SV=class{constructor(a,b){this.m=a;this.R=b;this.B="";this.A=_.ra;this.g=new _.T("clpp.conviva.ad");this.f=new _.Rt;this.a=null;this.h=this.o=this.w=this.j=!1}initialize(a){this.g.debug("Initialize Ad Insights");this.h=this.w=!1;this.B=a.viewerId;this.A=a.playerName||_.ra;GV(this)}release(){this.g.debug("Release Ad Insights");this.w?this.g.debug(_.ia):(_.Fh(this.f),this.a&&EV(this,RV),this.f.release(),this.w=!0,this.j=this.h=!1)}destroy(){this.g.debug(_.Ad);this.o?this.g.debug(_.ha):this.o=!0}C(){this.g.debug(wV)}F(){this.g.debug(xV)}L(a){this.g.debug("onAdStarted()");
|
|
15
|
+
a=a.ad;this.j||(this.g.warn("Ad load event was not triggered. This will have incidence on VSF"),DV(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.fb(),a.eb());this.a.reportAdMetric(Conviva.Constants.Playback.BITRATE,a.Qa())}l(a){this.g.debug("onAdStateChanged()");if(this.a){const b=c=>{this.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,c)};switch(a.type){case _.ec:case _.fc:b(Conviva.Constants.PlayerState.PLAYING);
|
|
16
|
+
break;case _.dc:b(Conviva.Constants.PlayerState.PAUSED);break;case _.Ub:b(Conviva.Constants.PlayerState.BUFFERING)}}}M(){this.g.debug("onAdStopped()");this.a&&!this.h&&EV(this,RV)}K(){this.g.debug("onAdSkipped()");this.a&&EV(this,HV)}G(){this.g.debug("onAdClicked()");this.a&&this.a.reportAdPlayerEvent("AdClicked")}I(){this.g.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.g.debug("onAdLoaded()");
|
|
17
|
+
const b=a.ad,c=()=>{this.j=!0;DV(this,b)};if(-1!==b.getPodIndex()||this.m.getPosition()>=this.m.getDuration()-5)c();else this.f.on(this.m,_.ag,()=>{this.m.getPosition()>=this.m.getDuration()-5&&(this.f.off(this.m,_.ag),c())})}H(){this.g.debug("onAdFirstQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_FIRST_QUARTILE)}S(){this.g.debug("onAdMidPoint()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_MID_QUARTILE)}P(){this.g.debug("onAdThirdQuartile()");this.a&&
|
|
18
|
+
this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_THIRD_QUARTILE)}},HV=0,RV=1,FV=2;var TV=class{constructor(a,b){this.m=a;this.f=new _.Rt;this.a=null;this.o=!1;this.G=!0;this.B=this.h=this.A=this.C=this.l=!1;this.P=0;this.J=!1;this.w=null;this.I=!1;this.g=b;this.K=this.F=null;this.j=[];this.H=0}initialize(a,b,c){this.l||(this.g.debug("Initialize conviva"),this.G=!1,this.F=_.Zg(b),this.K=c,this.m=a,IV(this,this.F),this.f.on(this.m,_.Te,this.ia.bind(this)),this.f.on(this.m,_.Mf,this.ba.bind(this)),this.f.on(this.m,_.Lc,this.L.bind(this)),this.f.on(this.m,_.lg,this.X.bind(this)),this.f.on(this.m,
|
|
19
|
+
_.kg,this.V.bind(this)),this.f.on(this.m,_.Sb,this.R.bind(this)),this.f.on(this.m,_.Tb,this.S.bind(this)),this.f.on(this.m,_.pc,this.da.bind(this)),this.f.on(this.m,_.Kc,this.fa.bind(this)),this.f.on(this.m,_.r,this.M.bind(this)),JV(this)&&(this.g.debug("Start a new session: A new video starts in autoplay."),LV(this)))}release(){this.g.debug("Release conviva");this.G?this.g.debug(_.ia):(_.Fh(this.f),KV(this)||this.o||!JV(this)||this.a&&this.a.reportPlaybackFailed("Exit Before Video Start"),KV(this)&&
|
|
20
|
+
NV(this),this.a=null,this.G=!0)}destroy(){this.g.debug(_.Ad);this.l?this.g.debug(_.ha):this.l=!0}reportAppEvent(a,b){let c=!1;try{Conviva.Analytics.reportAppEvent(a,b),c=!0}catch(d){this.g.debug("Report app event error",d),c=!1}return c}ia(){this.g.debug("onPlayRequest()");KV(this)||JV(this)?KV(this)&&this.A&&!this.h&&(this.g.debug("Resuming VST monitoring ..."),KV(this)&&!this.h&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_ENDED),this.h=!0),this.A=!1):(this.g.debug("Creating conviva session. On Play Requested / No autoplay"),
|
|
21
|
+
LV(this))}ba(a){this.g.debug(_.Ke);const b=c=>{if(this.o&&(this.g.debug("Creating conviva session (On Seek / Replay)"),IV(this,this.F),LV(this),MV(this),KV(this))){var d=this.m.getTrackManager();d=d.qa()||d.rb();d.width&&d.height&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.RESOLUTION,d.width,d.height);d.bandwidth&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.BITRATE,d.bandwidth/1E3)}KV(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,c)};switch(a.detail.currentState){case _.Zo:b(Conviva.Constants.PlayerState.PLAYING);
|
|
22
|
+
break;case _.Yo:b(Conviva.Constants.PlayerState.PAUSED);break;case _.So:b(Conviva.Constants.PlayerState.BUFFERING);break;case _.Oo:this.g.debug("onVideoEnded()"),KV(this)&&(this.w&&this.w.Jb()?(this.g.debug("Waiting for postroll Ad before terminating session"),this.J=!0):NV(this))}}L(a){this.g.debug(_.Fe);if(KV(this)){if(a=a.detail,typeof a.width===_.t&&typeof a.height===_.t&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.RESOLUTION,a.width,a.height),a.bandwidth&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.BITRATE,
|
|
23
|
+
a.bandwidth/1E3),(a=a.rendition)&&a.track&&(a=a.track)&&a.frameRate){const b={};b[Conviva.Constants.ENCODED_FRAMERATE]=a.frameRate;this.a.setContentInfo(b)}}else this.j.push({Xf:this.L.bind(this),args:a})}X(){this.g.debug("onSeeking()");KV(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)}V(){this.g.debug("onSeeked()");KV(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_ENDED)}da(a){this.g.debug("onAdsTimelineChanged()");if(a=a.adsTimeline)this.w=a}R(a){this.g.debug(wV);
|
|
24
|
+
var b=a.ad;a=0===b.Ra();const c=AV(b.getPodIndex());KV(this)||JV(this)||!a||LV(this);if(KV(this)){a=0===b.ub()?Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE;let d=0;const e={};1===b.gb()&&(d=b.getDuration());e[Conviva.Constants.POD_DURATION]=d;e[Conviva.Constants.POD_INDEX]=++this.P;e[Conviva.Constants.POD_POSITION]=c;b=Conviva.Constants.AdPlayer;b=a!==Conviva.Constants.AdType.CLIENT_SIDE||_.Jk()?b.CONTENT:b.SEPARATE;this.a.reportAdBreakStarted(a,b,e);this.B=!0}else this.g.debug("Bug: should already have a valid session")}S(){this.g.debug(xV);
|
|
25
|
+
KV(this)&&this.B&&(this.a.reportAdBreakEnded(),this.B=!1,this.J&&NV(this))}M(a){this.g.debug(_.He);if(this.o&&this.I)this.g.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,KV(this)||LV(this));KV(this)?(this.g.debug("Report error",c,d),this.a.reportPlaybackError(c,d),d===Conviva.Constants.ErrorSeverity.FATAL&&(this.g.debug("Video Playback Failure"),
|
|
26
|
+
this.I=!0,NV(this))):this.j.push({Xf:this.M.bind(this),args:a})}}fa(){this.g.debug("onAutoPlayBlocked()");KV(this)&&(this.g.debug("Auto-play blocked. Pausing VST monitoring."),this.A=!0,KV(this)&&this.h&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_STARTED),this.h=!1))}};var UV=class{constructor(){this.h=this.f=null;this.a=!1;this.g=new _.T("clpp.conviva")}onPlayerCreated(a){this.f=new TV(a,this.g)}onContentWillLoad(a,b){PV(this,a);if(this.a){var c=a.getConfiguration();c=_.Zg(c.conviva||{});try{QV(c);const d=c.enableAdInsights||!1;this.f.initialize(a,c,b);d&&(this.h=new SV(a,()=>this.f.a),this.h.initialize(c))}catch(d){d instanceof _.I?OV(a,d):OV(a,new _.I(1,9,9002,d,d))}}}onContentLoaded(){this.a&&MV(this.f)}onPlayerWillDestroy(){this.a&&(this.a=!1,this.f.destroy(),
|
|
27
|
+
this.f=null,this.h&&(this.h.destroy(),this.h=null))}onPlayerWillRelease(){this.a&&(this.f.release(),this.h&&this.h.release())}id(){return"conviva"}reportAppEvent(a,b){return this.f?this.f.reportAppEvent(a,b):!1}};_.z("clpp.conviva.ConvivaPlugin",UV);UV.prototype.reportAppEvent=UV.prototype.reportAppEvent;UV.Id="conviva";_.Mr(new class{create(){return new UV}});};f.call(g, window);
|