@castlabs/prestoplay 6.17.1 → 6.18.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 +30 -0
- package/cjs/cl.adobe.js +3 -3
- package/cjs/cl.airplay.js +3 -3
- package/cjs/cl.broadpeak.js +7 -7
- package/cjs/cl.cast.js +111 -111
- package/cjs/cl.conviva.js +33 -33
- package/cjs/cl.core.js +566 -558
- package/cjs/cl.crypto.js +9 -9
- package/cjs/cl.dash.js +75 -74
- package/cjs/cl.externs.js +46 -46
- package/cjs/cl.freewheel.js +24 -24
- package/cjs/cl.hls.js +71 -69
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +29 -29
- package/cjs/cl.ima.js +23 -23
- package/cjs/cl.mse.js +311 -311
- 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 +15 -15
- package/cjs/cl.simid.js +15 -15
- package/cjs/cl.smooth.js +72 -72
- package/cjs/cl.thumbnails.js +26 -26
- package/cjs/cl.tizen.js +69 -69
- package/cjs/cl.ttml.js +28 -28
- 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 +87 -87
- package/cl.conviva.js +27 -27
- package/cl.core.js +456 -450
- package/cl.crypto.js +8 -8
- package/cl.dash.js +70 -69
- package/cl.externs.js +46 -46
- package/cl.freewheel.js +19 -19
- package/cl.hls.js +72 -72
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +26 -26
- package/cl.ima.js +17 -17
- package/cl.mse.js +274 -273
- 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 +13 -13
- package/cl.smooth.js +59 -59
- 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 +15 -15
- package/cl.vtt.js +12 -12
- package/cl.youbora.js +15 -15
- package/package.json +2 -2
- package/typings.d.ts +37 -3
package/cl.cast.js
CHANGED
|
@@ -1,89 +1,89 @@
|
|
|
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.T.length){a.w=!0;a.o.
|
|
8
|
-
cast.framework.CastContext.getInstance();b.removeEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.N);b.removeEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.aa)}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.S=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
|
-
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.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 _.
|
|
20
|
-
_.
|
|
21
|
-
if(a&&a.drm){var d=a.drm,e=_.
|
|
22
|
-
_.
|
|
23
|
-
a.licenseHandler=void 0},
|
|
24
|
-
|
|
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 Z(d,c,g,e,f)}return b},
|
|
26
|
-
this.player=null;return Promise.resolve()}getState(){return this.
|
|
27
|
-
timeSinceLastStateChangeMS:b-this.C};this.C=b;this.l&&_.
|
|
28
|
-
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(_.
|
|
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}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
"cast",{get:()=>window.cast_,set:e=>{window.cast_=e;window.setTimeout(()=>{
|
|
34
|
-
a}
|
|
35
|
-
new _.H(1,8,8003,void 0);try{yield
|
|
36
|
-
a,b)})}pause(){return new Promise((a,b)=>{this.isEnded()&&a();if(!this.a)return b(
|
|
37
|
-
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 YS="Cannot seek during ads playout.",ZS="Cannot switch track",$S="Media session does not exist.",aT="No receivers available",bT="Reset ABR functionality not available on cast.",cT="SDK not yet ready",dT="Sender is destroyed.",eT="clpp.cast.CastProxy",fT="clpp.cast.Player",gT="clpp.cast.Receiver",hT="urn:x-cast:castlabs",iT="urn:x-cast:com.google.cast.media",jT=function(a){return _.x(function*(){yield _.gp(a,_.Je);yield _.gp(a,_.Ie)})},kT=function(a){return JSON.stringify(a,(b,c)=>
|
|
2
|
+
{if("license"!==b&&typeof c!==_.Yd){if(c instanceof Event){b={};for(const d in c){const e=c[d];typeof e===_.Fe?"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}})},lT=function(a){if(typeof a!==_.Qf)return a;try{return JSON.parse(a,(b,c)=>"NaN"===c?NaN:"-Infinity"===c?-Infinity:"Infinity"===c?Infinity:c)}catch(b){return a}},mT=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=_.Ej(d,a.mimeType,g);f&&g&&(h=_.Si(a.url),(h=yield c.fetch(h).R)&&h.data&&(e=f.a(_.J(h.data)),e={url:URL.createObjectURL(new Blob([e])),kind:a.kind,language:a.language,label:a.label,mimeType:g}));return e})},nT=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 _.mg:return d.FMP4;case _.lg:return b===_.N?d.MPEG2_TS:c.TS;case _.Gc:return c.AAC;case _.Hc:return c.AC3;case _.Ic:return c.E_AC3;case "audio/mpeg":return c.MP3;case _.Jc:return c.FMP4}},pT=function(a){a=void 0===a?oT: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}},qT=function(a,b){return a.h.filter(c=>c.type===b)},sT=function(a,b){const c=rT(a);return qT(a,b).find(d=>c.includes(d.id))||null},uT=function(a,b,c){const d=a.a.a;if(d)if(c){a.f[b]=c.renditions[0];c=[+c.id];if(b!==_.K){const e=a.ua();e&&c.push(+e.id)}c=new chrome.cast.media.EditTracksInfoRequest(c);
|
|
6
|
+
d.editTracksInfo(c,()=>{a.f[b]=null;tT(a,b)},e=>{a.f[b]=null;a.g.debug(ZS,e)})}else b===_.K&&(c=new chrome.cast.media.EditTracksInfoRequest([]),d.editTracksInfo(c,()=>{tT(a,b)},e=>{a.g.debug(ZS,e)}))},rT=function(a){a=a.a?a.a.a:null;return(a?a.activeTrackIds||[]:[]).map(b=>b.toString())},tT=function(a,b){b===_.L?a.a.trigger(new _.E(_.Jk)):b===_.K&&a.a.trigger(new _.E(_.Kk))},xT=function(a){if(a)for(const b of vT)wT(b)},wT=function(a){if(!a.w&&window.chrome&&chrome.cast&&chrome.cast.isAvailable&&window.cast&&
|
|
7
|
+
cast.framework&&cast.framework.CastContext&&a.T.length){a.w=!0;a.o.Ie();var b=cast.framework.CastContext.getInstance(),c=new cast.framework.CastOptions;c.receiverApplicationId=a.T;c.autoJoinPolicy=chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED;b.setOptions(c);b.addEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.N);b.addEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.aa);yT&&a.o.ha(.02)}},zT=function(a){return _.x(function*(){vT.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.aa)}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.S=null;a.X=null})},AT=function(a){return _.x(function*(){a.ub()||(yield cast.framework.CastContext.getInstance().requestSession())})},CT=function(a,b,c){c=
|
|
9
|
+
void 0===c?0:c;return _.x(function*(){var d=a.f.ua();d&&d.language&&(a.h.preferredTextLanguage=d.language);(d=a.f.na())&&d.language&&(a.h.preferredAudioLanguage=d.language);yield BT(a,{source:a.getLoadedSource(),currentTime:c,isLive:a.isLive(),ue:a.getPresentationStartTime(),autoplay:b,Xa:a.h})})},BT=function(a,b){return _.x(function*(){var c=chrome.cast.media.StreamType;yield AT(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=nT(b.Lb,_.N);e.hlsSegmentFormat=nT(c,_.L);b.Xa&&(a.L&&(c=yield Promise.resolve(a.L(b.Xa)))&&(b.Xa=c),a.h=b.Xa,a.C=_.bo(a.h),a.B=a.C.findIndex(k=>k.url===b.source.url),b.Xa.remoteTextTracks&&(c=yield Promise.all(b.Xa.remoteTextTracks.map(a.la.bind(a))),e.tracks=c.filter(k=>k),b.Xa.remoteTextTracks=void 0),delete b.Xa.autoplay,b.Xa.startTime=null,e.customData={playerConfiguration:kT(b.Xa)});c=a.nb()||{};
|
|
11
|
+
var f=DT(c.metadataType),g;typeof b.ue===_.t&&(g={metadataType:f,sectionStartAbsoluteTime:b.ue});var h;b.source.name&&(h={metadataType:f,title:b.source.name});c=ET(c);if(g=FT(Object.assign({},g,h,c)))e.metadata=g;e=new chrome.cast.media.LoadRequest(e);typeof b.autoplay===_.Pc&&(e.autoplay=b.autoplay);typeof b.currentTime===_.t&&(e.currentTime=b.currentTime);yield d.loadMedia(e)}})},FT=function(a){if(!a)return null;a:{var b=a.metadataType;const c=Object.entries(GT);for(const d of c){const [e,f]=d;
|
|
12
|
+
if(f===b){b=e;break a}}b=null}if(!b)return null;b=pT(GT[b]);return Object.assign(b,a)},DT=function(a){var b=void 0===b?oT:b;return Object.values(GT).includes(a)?a:b},ET=function(a){const b={};for(const c in a)void 0!==a[c]&&(b[c]=a[c]);return b},IT=function(a,b){HT(a,b.getMediaSession());b.addEventListener(cast.framework.SessionEventType.MEDIA_SESSION,a.W);b.addMessageListener(hT,a.O)},JT=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},HT=function(a,b){a.a=b;a.a&&(a.H.release(),a.G=null,a.l=null,a.l=new cast.framework.RemotePlayer,a.G=new cast.framework.RemotePlayerController(a.l),a.H.on(a.G,cast.framework.RemotePlayerEventType.CURRENT_TIME_CHANGED,a.ea.bind(a)),a.f&&a.f.load(),a.j&&a.j.init(),a.trigger(new _.E(_.se)))},MT=function(a){return new KT(a.h,()=>{a.trigger(new _.E(_.Yc))},(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.Ue&&(d.preferredAudioLanguage=c.Ue);c.Lf&&(d.preferredTextLanguage=c.Lf);_.ip(a.f,null);a.trigger(new _.E("castingended"));a.j(b,d)}},()=>LT(a))},LT=function(a){return _.x(function*(){a.trigger(new _.E(_.Xc));a.f.a!==a.a&&a.f&&a.a&&(yield a.f.release(),_.ip(a.f,a.a))})},PT=function(a,b,c){return _.x(function*(){var d=b.adTagUrl;if(d)try{NT=!1;const e=_.Si(d),f=yield c.fetch(e).R;if(f&&f.data){const g=_.oi(f.data),h=(new DOMParser).parseFromString(g,
|
|
15
|
+
_.Wf);if(h.getElementsByTagName("vmap:VMAP").length)_.C("VMAP detected."),a.vmapAdsRequest=OT(g);else if(h.getElementsByTagName("VAST").length){_.C("VAST detected.");{d=g;const k=new cast.framework.messages.BreakClip("bc1");k.vastAdsRequest=OT(d);const l=new cast.framework.messages.Break("b1",[k.id],0);a.breakClips=[k];a.breaks=[l]}}else _.C("Unsupported schema."),NT=!0}}catch(e){_.C("Failed to fetch an ad",e),NT=!0}})},OT=function(a){const b=new cast.framework.messages.VastAdsRequest;b.adsResponse=
|
|
16
|
+
a;return b},QT=function(a,b){b=new _.H(1,10,10003,{errorType:b});a.m.onError(b)},RT=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},TT=function(a,b,c){if(c instanceof cast.framework.events.BreaksEvent||-1!==a.getPosition()){var d=null;(c=ST(a,c))&&(d={ad:c});a.m.trigger(new _.E(b,d))}},ST=function(a,b){let c=null;if(a.a&&b instanceof cast.framework.events.BreaksEvent){let d=null,e=null,f;typeof b.breakClipId===_.Qf&&(d=a.a.getBreakClipById(b.breakClipId));typeof b.breakId===
|
|
17
|
+
_.Qf&&(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},UT=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]},VT=function(a){const b=
|
|
18
|
+
a.dashTimedMetadata;let c=_.eg;b&&(c=b.schemeIdUri);return{type:c.startsWith(_.dg)?_.th:_.rh,schemeIdUri:c,id:a.id||"",startTime:a.startTime,endTime:a.endTime,value:b&&b.value||"",eventElement:b?b.eventElement:null}},WT=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},YT=function(a){a.a=WT().getTextTracksManager();const b=a.a.getTracks();a.j=XT(_.K,b)},XT=function(a,b){const c=[];for(const d of b)b=new _.hj(d.trackId.toString(),a),b.roles=d.roles||[],b.kind=d.subtype||
|
|
19
|
+
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 _.pj(b.id,b)),c.push(b);return c},ZT=function(a,b,c,d){c=_.Ah(c).filter(g=>g);var e=!1;let f=[];b===_.L?f=a.getAudioTracks():b===_.K&&(f=a.ka());if(c=c.find(g=>{const h=_.bi(g);return f.some(k=>{k=_.bi(k.language||"");return _.ci(h,k)})})){const g=
|
|
20
|
+
_.bi(c);c=f.filter(h=>{h=_.bi(h.language||"");return _.ci(g,h)});f=c.length?c:f;e=e||!!c.length}_.xi(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===_.L?a.wa(e):b===_.K&&a.La(e))},$T=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},cU=function(a,b){var c=()=>{b.protectionSystem=cast.framework.ContentProtection.NONE;b.licenseUrl=void 0;b.licenseRequestHandler=void 0;b.licenseHandler=void 0};
|
|
21
|
+
if(a&&a.drm){var d=a.drm,e=_.ql(d);if(e){var f=[_.xd];_.bo(a)[0].type!==_.Ec&&f.unshift(_.zd);d.preferredDrmSystem===_.xd&&f.reverse();for(var g,h;f.length&&!h;)g=f.shift(),h=e.Za[g];h?(c=g===_.zd?cast.framework.ContentProtection.WIDEVINE:g===_.xd?cast.framework.ContentProtection.PLAYREADY:void 0,b.protectionSystem=c,b.licenseUrl=h.licenseUrl,c={ldlDelay:0,customData:{}},aU(b,h,a,c),bU(b,h,a,c)):c()}else c()}else c()},aU=function(a,b,c,d){b.modifiers.licenseRequest?a.licenseRequestHandler=e=>{const f=
|
|
22
|
+
_.Si({method:_.ub,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},bU=function(a,b,c,d){b.modifiers.licenseResponse?a.licenseHandler=(e,f)=>_.x(function*(){const g=_.Ti(Object.assign({},f.headers),e.buffer,200,"");yield b.modifiers.licenseResponse(c,g,d);return _.J(g.data)}):
|
|
23
|
+
a.licenseHandler=void 0},fU=function(){return dU||(dU=new eU)},gU=function(){return cast.framework.CastReceiverContext.getInstance()},iU=function(a,b){a.g.debug("Detected HLS, parsing");var c=cast.framework.messages.HlsVideoSegmentFormat;a=gU();var {hlsVideoSegmentFormat:d}=gU().getPlayerManager().getMediaInformation()||{};c=d===c.FMP4?_.mg:_.lg;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=
|
|
24
|
+
hU(f,_.pa),h=hU(f,_.Cb);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")},hU=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},kU=function(a,b){let c=null;const d=jU(a);d&&(c={ad:d});a.f.trigger(new _.E(b,c))},jU=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 Z(d,c,g,e,f)}return b},lU=class{constructor(a,b){this.log=new _.R(b);this.player=a;this.l=null;this.h=_.Wn;this.o=_.At;this.j=2;this.C=Date.now();this.B=-1}release(){this.a(_.Wn)}destroy(){this.l=
|
|
26
|
+
this.player=null;return Promise.resolve()}getState(){return this.h}onError(a){a.severity===_.F&&this.a(_.Vn)}a(a){if(a!==this.h)if(this.h===_.Vn&&a!==_.Wn)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===_.Rn?(this.B=b,this.player.trigger(new _.E(_.Uc,{detail:{bufferedTimeMS:-1,reason:this.j}}))):this.o===_.Rn&&this.player.trigger(new _.E(_.Qc,{detail:{bufferedTimeMS:b-this.B,reason:this.j}}));a={currentState:this.h,previousState:this.o,
|
|
27
|
+
timeSinceLastStateChangeMS:b-this.C};this.C=b;this.l&&_.Fn(this.l,this.h);this.player.trigger(new _.E(_.Nf,{detail:a}))}}};_.z("clpp.cast.CastUtils",class{});var oT=0,GT={GENERIC:oT,MOVIE:1,TV_SHOW:2,MUSIC_TRACK:3,PHOTO:4,AUDIOBOOK_CHAPTER:5};var mU=class extends lU{constructor(a){super(a,"clpp.cast.SenderStateManager");this.w=this.f=null;this.A=this.Hb.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)}Hb(){if(this.f&&
|
|
28
|
+
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(_.On);break;case chrome.cast.media.IdleReason.ERROR:this.a(_.Vn);break;default:this.a(_.Wn)}break;case chrome.cast.media.PlayerState.PLAYING:this.a(_.Zn);break;case chrome.cast.media.PlayerState.PAUSED:this.a(_.Yn);break;case chrome.cast.media.PlayerState.BUFFERING:this.a(_.Rn)}}};var nU=class extends _.S{constructor(){super();this.g=new _.R("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=_.L;break;case chrome.cast.media.TrackType.TEXT:c=_.K}c=new _.hj(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 _.pj(c.id,c));return c}):[],this.a.trigger(new _.E(_.dt)))}destroy(){this.a=null}getVideoTracks(){return qT(this,_.N)}getAudioTracks(){return qT(this,_.L)}ka(){return qT(this,_.K)}oa(){const a=this.Ja();return a?a.renditions[0]:null}Qa(){const a=this.na();return a?a.renditions[0]:null}Ia(){const a=this.ua();return a?a.renditions[0]:
|
|
30
|
+
null}cb(){return this.f[_.N]||null}ob(){return this.f[_.L]||null}pb(){return this.f[_.K]||null}Ja(){return sT(this,_.N)}na(){return sT(this,_.L)}ua(){return sT(this,_.K)}jb(a){uT(this,_.N,a)}wa(a){uT(this,_.L,a)}La(a){uT(this,_.K,a)}Ya(a){this.jb(a&&a.track)}hb(a){this.wa(a&&a.track)}ib(a){this.La(a&&a.track)}addTextTrack(){return _.x(function*(){})}ra(){return!0}};nU.prototype.isAbrEnabled=nU.prototype.ra;nU.prototype.addTextTrack=nU.prototype.addTextTrack;nU.prototype.setTextRendition=nU.prototype.ib;
|
|
31
|
+
nU.prototype.setAudioRendition=nU.prototype.hb;nU.prototype.setVideoRendition=nU.prototype.Ya;nU.prototype.setTextTrack=nU.prototype.La;nU.prototype.setAudioTrack=nU.prototype.wa;nU.prototype.setVideoTrack=nU.prototype.jb;nU.prototype.getTextTrack=nU.prototype.ua;nU.prototype.getAudioTrack=nU.prototype.na;nU.prototype.getVideoTrack=nU.prototype.Ja;nU.prototype.getLoadingTextRendition=nU.prototype.pb;nU.prototype.getLoadingAudioRendition=nU.prototype.ob;nU.prototype.getLoadingVideoRendition=nU.prototype.cb;
|
|
32
|
+
nU.prototype.getTextRendition=nU.prototype.Ia;nU.prototype.getAudioRendition=nU.prototype.Qa;nU.prototype.getVideoRendition=nU.prototype.oa;nU.prototype.getTextTracks=nU.prototype.ka;nU.prototype.getAudioTracks=nU.prototype.getAudioTracks;nU.prototype.getVideoTracks=nU.prototype.getVideoTracks;var KT=class extends _.ft{constructor(a,b,c,d){super();this.g=new _.R(_.kd);this.T=a;this.o=new _.Tj(b);this.S=c;this.X=d;this.h=this.I=_.Uk();this.C=[];this.B=0;this.K=new _.ap;this.G=this.l=this.a=null;this.A=this.w=!1;this.Z="";this.ga=1E6;this.f=new nU;this.f.initialize(this);this.j=new mU(this);this.H=new _.ts;this.J=null;this.F=new Set;this.N=this.Fa.bind(this);this.aa=this.Oa.bind(this);this.W=this.Na.bind(this);this.O=this.Ma.bind(this);this.L=null;window.cast||Object.defineProperty(window,
|
|
33
|
+
"cast",{get:()=>window.cast_,set:e=>{window.cast_=e;window.setTimeout(()=>{xT(!0)},0)}});wT(this);vT.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(_.qb)}appendLoad(){return Promise.reject(_.qb)}seekWith(){return Promise.reject(_.qb)}destroy(){return _.x(function*(){})}kd(a){this.L=
|
|
34
|
+
a}jc(){return this.w}ub(){return this.A}de(){return this.Z}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,kT(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 _.x(function*(){if(!a.jc())throw a.g.warn(cT),new _.H(1,8,8001,void 0);if(!yT)throw a.g.warn(aT),new _.H(1,8,8002,void 0);if(a.ub())throw a.g.warn("Already casting"),
|
|
35
|
+
new _.H(1,8,8003,void 0);try{yield AT(a)}catch(b){const c={};b instanceof chrome.cast.Error?(c.detailedErrorCode=b.code,c.details=b.details,c.reason=b.description):c.detailedErrorCode=b;throw new _.H(1,8,8E3,c);}})}be(){this.ub()&&cast.framework.CastContext.getInstance().endCurrentSession(!0)}addMessageListener(a){typeof a===_.Yd&&this.F.add(a)}removeMessageListener(a){typeof a===_.Yd&&this.F.delete(a)}play(){return this.isEnded()?CT(this,!0):new Promise((a,b)=>{if(!this.a)return b($S);this.a.play(null,
|
|
36
|
+
a,b)})}pause(){return new Promise((a,b)=>{this.isEnded()&&a();if(!this.a)return b($S);this.a.pause(null,a,b)})}isPaused(){return!!this.a&&this.a.playerState===chrome.cast.media.PlayerState.PAUSED}isEnded(){return this.getState()===_.On}seek(a){return this.isEnded()?CT(this,!1,a):new Promise((b,c)=>{this.a||c($S);this.l.isPlayingBreak&&c(YS);const d=new chrome.cast.media.SeekRequest;d.currentTime=a;this.trigger(new _.E(_.gg));this.a.seek(d,()=>{this.trigger(new _.E(_.fg));b()},c)})}getPosition(){return this.getMediaPosition()}getMediaPosition(){return this.a&&
|
|
37
|
+
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(iT,{type:"SET_PLAYBACK_RATE",requestId:Math.round(1E3*Math.random()),mediaSessionId:this.a.mediaSessionId,playbackRate:a})}getVolume(){return this.a&&
|
|
38
38
|
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=
|
|
39
|
-
{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():_.
|
|
40
|
-
isLive:c.isLive,autoplay:b.
|
|
41
|
-
(this.trigger(new _.E(_.r,{detail:a})),this.j))this.j.onError(a)}namespace(){return _.
|
|
42
|
-
this.
|
|
43
|
-
case cast.framework.SessionState.SESSION_RESUMED:this.
|
|
44
|
-
this.
|
|
45
|
-
d.mimeType,c.customData={mimeType:a.mimeType,url:a.url});return c})}getTextDisplayer(){return null}};
|
|
46
|
-
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.
|
|
47
|
-
isLive:q,autoplay:!b.f.isPaused(),currentTime:Math.max(b.f.getPosition()-1,0),
|
|
48
|
-
yield b.a.sendMessage(
|
|
49
|
-
|
|
50
|
-
|
|
39
|
+
{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():_.At}getStats(){return this.a&&this.a.customData&&this.a.customData.stats?lT(this.a.customData.stats):_.Jn()}isLive(){return Infinity===this.getDuration()}load(a){const b=this;return _.x(function*(){if(b.jc())if(yT){b.C=_.bo(a);b.h=_.Wk(b.I,a);var c=b.C[b.B];yield BT(b,{source:c,
|
|
40
|
+
isLive:c.isLive,autoplay:b.h.autoplay,Xa:b.h,Lb:c.Lb,audioMimeType:c.audioMimeType})}else b.g.warn(aT);else b.g.warn(cT)})}getBufferInfo(){return new _.et}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}getLoadedSource(){return this.C[this.B]}getPeriods(){return[]}getDrmInfo(){return null}getTimelineCues(){return[]}resetAbr(){this.g.warn(bT)}onError(a){if(a&&
|
|
41
|
+
(this.trigger(new _.E(_.r,{detail:a})),this.j))this.j.onError(a)}namespace(){return _.kd}canPlay(){return this.jc()?2:0}nb(){return this.J}nc(a){this.J=FT(a)}Xd(){this.J=null}De(a){const b=this.nb()||{};a={metadataType:DT(b.metadataType),title:a};this.nc(Object.assign({},b,a))}Be(a){const b=this.nb()||{},c=DT(b.metadataType);a=new chrome.cast.Image(a);this.nc(Object.assign({},b,{metadataType:c,images:[a]}))}Ae(a){const b=this.nb()||{};this.nc(Object.assign({},b,{metadataType:3,artist:a}))}Ce(a){const b=
|
|
42
|
+
this.nb()||{};a={metadataType:DT(b.metadataType),releaseDate:a};this.nc(Object.assign({},b,a))}Fa(a){const b=cast.framework.CastContext.getInstance(),c=a.castState===cast.framework.CastState.CONNECTED;yT=a.castState!==cast.framework.CastState.NO_DEVICES_AVAILABLE;this.Z=c?b.getCurrentSession().getCastDevice().friendlyName:"";this.o.Ie()}Oa(a){this.g.debug(`state: ${a.sessionState}, details:`,a);switch(a.sessionState){case cast.framework.SessionState.SESSION_STARTED:this.A=!0;IT(this,a.session);break;
|
|
43
|
+
case cast.framework.SessionState.SESSION_RESUMED:this.ub()||(this.A=!0,IT(this,a.session),this.X());break;case cast.framework.SessionState.SESSION_ENDED:if(this.ub()&&this.a){const d=this.a.media;var b=this.f.na(),c=this.f.ua();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:JT(this),Lf:c,Ue:b})}a.session.removeEventListener(cast.framework.SessionEventType.MEDIA_SESSION,this.W);a.session.removeMessageListener(hT,
|
|
44
|
+
this.O);this.A=!1;this.a=null;this.H.release();this.l=this.G=null}}Na(a){this.g.debug("New media session",a.mediaSession);HT(this,a.mediaSession)}Ma(a,b){if(a===hT&&0<this.F.size){const c=lT(b);this.F.forEach(d=>d(c))}}ea(){this.trigger(new _.E(_.Xf))}la(a){const b=this;return _.x(function*(){let c=null;const d=yield mT(a,[_.Vf,_.Dc],b.K,b.h);d&&(c=new chrome.cast.media.Track(b.ga++,chrome.cast.media.TrackType.TEXT),c.language=d.language,c.name=d.label||null,c.trackContentId=d.url,c.trackContentType=
|
|
45
|
+
d.mimeType,c.customData={mimeType:a.mimeType,url:a.url});return c})}getTextDisplayer(){return null}};KT.prototype.getTextDisplayer=KT.prototype.getTextDisplayer;KT.prototype.getNetworkEngine=KT.prototype.getNetworkEngine;KT.prototype.setNetworkEngine=KT.prototype.setNetworkEngine;var yT=!1,vT=new Set;window.__onGCastApiAvailable=xT;var oU=class extends _.ft{constructor(a,b,c){super();this.f=a;this.h=b;this.j=typeof c===_.Yd?c:(d,e)=>{this.f&&d!==_.On&&d!==_.Wn&&this.f.load(e)};this.a=MT(this);this.g=new _.R(eT);this.f&&this.forwardEventsTo(this.f)}destroy(){const a=this;return _.x(function*(){a.a&&(yield zT(a.a),a.a=null);a.f&&a.stopForwardingEventsTo(a.f)})}Ud(){return!!this.a&&this.a.jc()&&yT}ub(){return!!this.a&&this.a.ub()}de(){return this.a?this.a.de():""}kd(a){this.a&&this.a.kd(a)}cast(a){const b=this;return _.x(function*(){if(b.a)try{if(yield b.a.cast(),
|
|
46
|
+
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.ua();n&&(n.language&&(l.preferredTextLanguage=n.language),n.roles.length&&(l.preferredTextRole=n.roles[0]));const q=e&&typeof e.isLive===_.Pc?e.isLive:b.f.isLive();d={source:e,
|
|
47
|
+
isLive:q,autoplay:!b.f.isPaused(),currentTime:Math.max(b.f.getPosition()-1,0),ue:b.f.getPresentationStartTime(),Lb:h,audioMimeType:k,Xa:l}}var c=d}yield LT(b);b.a&&(c&&(c.autoplay=!b.f.isPaused()),a?yield b.f.load(a):b.a.a||(yield BT(b.a,c)))}}catch(d){b.g.error("Error while trying to cast",d),c=new _.E(_.r,{detail:d}),b.trigger(c)}})}be(){this.a&&this.a.be()}kg(a){const b=this;return _.x(function*(){a!==b.h&&(b.h=a,b.a&&(yield zT(b.a)),b.a=MT(b))})}sendMessage(a){const b=this;return _.x(function*(){b.a?
|
|
48
|
+
yield b.a.sendMessage(hT,a):b.g.warn(dT)})}addMessageListener(a){this.a?this.a.addMessageListener(a):this.g.warn(dT)}removeMessageListener(a){this.a?this.a.removeMessageListener(a):this.g.warn(dT)}nb(){return this.a&&this.a.nb()}nc(a){this.a&&this.a.nc(a)}Xd(){this.a&&this.a.Xd()}De(a){this.a&&this.a.De(a)}Be(a){this.a&&this.a.Be(a)}Ae(a){this.a&&this.a.Ae(a)}Ce(a){this.a&&this.a.Ce(a)}};_.z(eT,oU);oU.prototype.setContentReleaseDate=oU.prototype.Ce;oU.prototype.setContentArtist=oU.prototype.Ae;
|
|
49
|
+
oU.prototype.setContentImage=oU.prototype.Be;oU.prototype.setContentTitle=oU.prototype.De;oU.prototype.clearContentMetadata=oU.prototype.Xd;oU.prototype.setContentMetadata=oU.prototype.nc;oU.prototype.getContentMetadata=oU.prototype.nb;oU.prototype.removeMessageListener=oU.prototype.removeMessageListener;oU.prototype.addMessageListener=oU.prototype.addMessageListener;oU.prototype.sendMessage=oU.prototype.sendMessage;oU.prototype.changeReceiverId=oU.prototype.kg;oU.prototype.forceDisconnect=oU.prototype.be;
|
|
50
|
+
oU.prototype.cast=oU.prototype.cast;oU.prototype.setPlayerConfigInterceptor=oU.prototype.kd;oU.prototype.getReceiverName=oU.prototype.de;oU.prototype.isCasting=oU.prototype.ub;oU.prototype.canCast=oU.prototype.Ud;oU.prototype.destroy=oU.prototype.destroy;var pU=class extends lU{constructor(a){super(a,"clpp.cast.StateManager");this.I=this.S.bind(this);this.H=this.O.bind(this);this.A=this.Z.bind(this);this.w=this.X.bind(this);this.K=this.W.bind(this);this.J=this.T.bind(this);this.L=this.ga.bind(this);this.G=this.aa.bind(this);this.F=this.U.bind(this);this.f=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,
|
|
51
51
|
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();
|
|
52
|
-
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 _.E(_.
|
|
53
|
-
this.a(_.
|
|
54
|
-
null}getMediaUrl(){return this.a.contentUrl||this.a.contentId||null}
|
|
55
|
-
Z.prototype.getWrapperAdIds=Z.prototype.getWrapperAdIds;Z.prototype.getSequenceLength=Z.prototype.
|
|
56
|
-
Z.prototype.isBumper=Z.prototype.
|
|
57
|
-
Z.prototype.getAdManagerVersion=Z.prototype.
|
|
58
|
-
this.
|
|
59
|
-
switch(a.type){case cast.framework.events.EventType.PLAYER_LOADING:this.a=
|
|
60
|
-
break;case cast.framework.events.EventType.BREAK_CLIP_ENDED:a.endedReason===b.SKIPPED?(
|
|
61
|
-
|
|
62
|
-
_.
|
|
63
|
-
this.
|
|
64
|
-
this.f.setActiveById(+a.id)}
|
|
65
|
-
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]),
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
cast.framework.messages.PlayerState,b
|
|
69
|
-
a.play();return Promise.resolve()}pause(){const a
|
|
70
|
-
|
|
71
|
-
null}getLoadedSource(){const a
|
|
72
|
-
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():_.
|
|
73
|
-
this;return _.x(function*(){b.f=new _.
|
|
74
|
-
a}getNetworkEngine(){return this.F}getSourceIndex(){return this.l}setSourceIndex(a){this.l=a}getPeriods(){return[]}namespace(){return
|
|
75
|
-
b&&(this.
|
|
76
|
-
a=Object.assign({},a,{media:b})}}return a}G(a,b){let c=null;a.media.customData&&(c=
|
|
77
|
-
|
|
78
|
-
c.customNamespaces={};c.customNamespaces[
|
|
79
|
-
this.A);a.start(c);a.addCustomMessageListener(
|
|
80
|
-
b){
|
|
81
|
-
1;0<=f;--f){var g=e[f].getAttribute("contentType");if(g===_.w||g===_.p){g=e[f].getAttribute(_.
|
|
82
|
-
(new XMLSerializer).serializeToString(a)}if(c=b.getElementsByTagName(_.
|
|
83
|
-
(new XMLSerializer).serializeToString(a)}return a}C(a){const b=this;return _.x(function*(){let c=a;var d;c.media.customData&&(d=
|
|
84
|
-
d.url,c.media.contentType=d.type,d.
|
|
85
|
-
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))}_.
|
|
86
|
-
|
|
87
|
-
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(
|
|
88
|
-
return _.x(function*(){a.
|
|
89
|
-
|
|
52
|
+
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 _.E(_.Te));this.a(_.Zn)}O(){this.a(_.Yn)}Z(){this.a(_.On)}X(a){a.isBuffering?
|
|
53
|
+
this.a(_.Rn):(a=this.player.isPaused()?_.Yn:_.Zn,this.a(a))}W(){this.j=1;this.player.trigger(new _.E(_.gg))}T(){this.player.trigger(new _.E(_.fg))}ga(){this.j=2}aa(){this.a(_.Xn)}N(a){const b=this.player.getStats();this.player.trigger(new _.E(_.Nc,{detail:{bandwidth:a.totalBitrate,width:b.width,height:b.height}}))}U(a){a=new _.H(_.F,7,7300,{detailedErrorCode:a.detailedErrorCode,error:a.error,reason:a.reason});this.player.trigger(new _.E(_.r,{detail:a}));this.a(_.Vn)}};var Z=class{constructor(a,b,c,d,e){this.a=a;this.f=b;this.j=typeof c===_.t?c:1;this.l=typeof d===_.t?d:1;this.h=typeof e===_.t?e:0}yb(){return"Google Cast Framework"}zb(){return cast.framework.VERSION}Fb(){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}kc(){return!1}Qb(){return this.a.clickThroughUrl||
|
|
54
|
+
null}getMediaUrl(){return this.a.contentUrl||this.a.contentId||null}Cb(){return 0}Bb(){return 0}qb(){return 0}eb(){switch(this.Rb()){case 0:return 0;case -1:return 2;default:return 1}}getPodIndex(){return this.h}Rb(){return this.f.position}Sb(){return this.j}Eb(){return this.l}getWrapperAdIds(){return[]}getWrapperAdSystems(){return[]}getWrapperCreativeIds(){return[]}};Z.prototype.getWrapperCreativeIds=Z.prototype.getWrapperCreativeIds;Z.prototype.getWrapperAdSystems=Z.prototype.getWrapperAdSystems;
|
|
55
|
+
Z.prototype.getWrapperAdIds=Z.prototype.getWrapperAdIds;Z.prototype.getSequenceLength=Z.prototype.Eb;Z.prototype.getPositionInSequence=Z.prototype.Sb;Z.prototype.getPodTimeOffset=Z.prototype.Rb;Z.prototype.getPodIndex=Z.prototype.getPodIndex;Z.prototype.getPodType=Z.prototype.eb;Z.prototype.getMediaBitrate=Z.prototype.qb;Z.prototype.getMediaHeight=Z.prototype.Bb;Z.prototype.getMediaWidth=Z.prototype.Cb;Z.prototype.getMediaUrl=Z.prototype.getMediaUrl;Z.prototype.getClickThroughUrl=Z.prototype.Qb;
|
|
56
|
+
Z.prototype.isBumper=Z.prototype.kc;Z.prototype.getSkipTimeOffset=Z.prototype.getSkipTimeOffset;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;Z.prototype.getCreativeId=Z.prototype.getCreativeId;Z.prototype.getId=Z.prototype.getId;Z.prototype.getTechnology=Z.prototype.Fb;
|
|
57
|
+
Z.prototype.getAdManagerVersion=Z.prototype.zb;Z.prototype.getAdManagerName=Z.prototype.yb;var qU=class{constructor(a){this.a=a}getCuePoints(){return this.a.map(a=>a.position)}Tb(){return!!this.a.find(a=>0===a.position)}sb(){return!!this.a.find(a=>-1===a.position)}};qU.prototype.hasPostroll=qU.prototype.sb;qU.prototype.hasPreroll=qU.prototype.Tb;qU.prototype.getCuePoints=qU.prototype.getCuePoints;var rU=class{constructor(a){this.m=a;this.a=null;this.h=this.j.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];RT().addEventListener(this.f,
|
|
58
|
+
this.h)}load(){const a=this;return _.x(function*(){NT&&(NT=!1,QT(a,0))})}start(){return _.x(function*(){RT().play()})}resume(){-1!==this.getPosition()&&RT().play()}pause(){-1!==this.getPosition()&&RT().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}dispose(){const a=this;return _.x(function*(){RT().removeEventListener(a.f,a.h)})}j(a){const b=cast.framework.events.EndedReason;
|
|
59
|
+
switch(a.type){case cast.framework.events.EventType.PLAYER_LOADING:this.a=RT().getBreakManager();this.a.setPlayWatchedBreak(!0);a=this.a.getBreaks();this.m.trigger(new _.E(_.uc,{adsTimeline:new qU(a)}));break;case cast.framework.events.EventType.BREAK_CLIP_LOADING:TT(this,_.jc,a);break;case cast.framework.events.EventType.BREAK_STARTED:TT(this,_.cc,a);break;case cast.framework.events.EventType.BREAK_ENDED:TT(this,_.dc,a);break;case cast.framework.events.EventType.BREAK_CLIP_STARTED:TT(this,_.qc,a);
|
|
60
|
+
break;case cast.framework.events.EventType.BREAK_CLIP_ENDED:a.endedReason===b.SKIPPED?(TT(this,_.pc,a),TT(this,_.rc,a)):a.endedReason===b.STOPPED?TT(this,_.rc,a):a.endedReason===b.END_OF_STREAM?(TT(this,_.gc,a),TT(this,_.rc,a)):a.endedReason===b.ERROR&&QT(this,1);break;case cast.framework.events.EventType.PLAYING:TT(this,_.oc,a);break;case cast.framework.events.EventType.PAUSE:TT(this,_.mc,a);break;case cast.framework.events.EventType.BUFFERING:a.isBuffering?TT(this,_.ec,a):TT(this,_.oc,a)}}};
|
|
61
|
+
rU.prototype.getPosition=rU.prototype.getPosition;rU.prototype.setVolume=rU.prototype.setVolume;rU.prototype.getVolume=rU.prototype.getVolume;rU.prototype.skip=rU.prototype.skip;rU.prototype.pause=rU.prototype.pause;rU.prototype.resume=rU.prototype.resume;var NT=!1;var sU=class{constructor(a){this.Zb=a;this.a=this.f.bind(this)}init(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().addEventListener(UT(),this.a)}release(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().removeEventListener(UT(),this.a)}getTimelineCues(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager().getTimedMetadata().map(a=>VT(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=
|
|
62
|
+
_.uh;break;case cast.framework.events.EventType.TIMED_METADATA_ENTER:b=_.wh;break;case cast.framework.events.EventType.TIMED_METADATA_EXIT:b=_.xh}b&&this.Zb(new _.E(b,{detail:VT(a.timedMetadataInfo)}))}else for(b of this.getTimelineCues())this.Zb(new _.E(_.uh,{detail:b}))}};var tU=class extends _.S{constructor(){super();this.g=new _.R("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;WT().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;WT().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.l)}getVideoTracks(){return[]}getAudioTracks(){return this.h}ka(){return this.j}oa(){return null}Qa(){const a=
|
|
63
|
+
this.na();return a&&a.renditions[0]}Ia(){const a=this.ua();return a&&a.renditions[0]}cb(){return null}ob(){return null}pb(){return null}Ja(){return null}na(){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}ua(){let a=null;if(this.a){let b=this.a.getActiveIds()[0];typeof b===_.t&&(b=b.toString(),a=this.ka().find(c=>c.id===b)||null)}return a}jb(){this.g.warn("Video tracks unavailable on Cast")}wa(a){a&&this.f&&
|
|
64
|
+
this.f.setActiveById(+a.id)}La(a){this.a&&(a?this.a.setActiveByIds([+a.id]):this.a.setActiveByIds([]))}Ya(){this.g.warn("Video renditions unavailable on Cast")}hb(a){this.wa(a&&a.track)}ib(a){this.La(a&&a.track)}addTextTrack(a){const b=this;return _.x(function*(){var c=b.m.getConfiguration();if((c=yield mT(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=
|
|
65
|
+
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]),YT(b)}catch(e){throw b.g.warn("failed on track",a),e;}}})}ra(){return!0}w(){this.f=WT().getAudioTracksManager();var a=this.f.getTracks();this.h=XT(_.L,a);YT(this);a=this.m.getConfiguration();ZT(this,_.L,a.preferredAudioLanguage,a.preferredAudioRole);ZT(this,_.K,a.preferredTextLanguage,a.preferredTextRole)}};tU.prototype.isAbrEnabled=tU.prototype.ra;
|
|
66
|
+
tU.prototype.addTextTrack=tU.prototype.addTextTrack;tU.prototype.setTextRendition=tU.prototype.ib;tU.prototype.setAudioRendition=tU.prototype.hb;tU.prototype.setVideoRendition=tU.prototype.Ya;tU.prototype.setTextTrack=tU.prototype.La;tU.prototype.setAudioTrack=tU.prototype.wa;tU.prototype.setVideoTrack=tU.prototype.jb;tU.prototype.getTextTrack=tU.prototype.ua;tU.prototype.getAudioTrack=tU.prototype.na;tU.prototype.getVideoTrack=tU.prototype.Ja;tU.prototype.getLoadingTextRendition=tU.prototype.pb;
|
|
67
|
+
tU.prototype.getLoadingAudioRendition=tU.prototype.ob;tU.prototype.getLoadingVideoRendition=tU.prototype.cb;tU.prototype.getTextRendition=tU.prototype.Ia;tU.prototype.getAudioRendition=tU.prototype.Qa;tU.prototype.getVideoRendition=tU.prototype.oa;tU.prototype.getTextTracks=tU.prototype.ka;tU.prototype.getAudioTracks=tU.prototype.getAudioTracks;tU.prototype.getVideoTracks=tU.prototype.getVideoTracks;var uU=class extends _.ft{constructor(){super();this.g=new _.R(fT);this.h=this.w=_.Uk();this.A=null;this.l=-1;this.F=new _.ap;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=$T();a.setMessageInterceptor(cast.framework.messages.MessageType.MEDIA_STATUS,this.H.bind(this));a.setMediaPlaybackInfoHandler(this.G.bind(this));this.a=new pU(this);this.a.init();this.j=new tU;this.j.initialize(this);this.o=new sU(c=>this.trigger(c));this.o.init()}unload(){const a=
|
|
68
|
+
cast.framework.messages.PlayerState,b=$T();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=_.Uk();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=$T();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot play during ads playout.");
|
|
69
|
+
a.play();return Promise.resolve()}pause(){const a=$T();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot pause during ads playout.");a.pause();return Promise.resolve()}isPaused(){return $T().getPlayerState()===cast.framework.messages.PlayerState.PAUSED}isEnded(){return $T().getPlayerState()===cast.framework.messages.PlayerState.IDLE}seek(a){const b=$T();if(null!==b.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject(YS);b.seek(a);return Promise.resolve()}getPosition(){return this.getMediaPosition()}getMediaPosition(){return $T().getCurrentTimeSec()}getDuration(){return this.getMediaDuration()}getMediaDuration(){const a=
|
|
70
|
+
$T().getDurationSec();return typeof a===_.t?-1===a?Infinity:a:-1}getPlaybackRate(){return $T().getPlaybackRate()}setPlaybackRate(a){if(0<a){const b=new cast.framework.messages.SetPlaybackRateRequestData;b.playbackRate=a;$T().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||
|
|
71
|
+
null}getLoadedSource(){const a=$T().getMediaInformation();if(a){var b=$T().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,Rh:b,name:c}}return null}getDrmInfo(){return null}getPresentationStartTime(){return $T().getStartAbsoluteTime()}getSeekRange(){let a={start:0,end:this.getDuration()};if(this.isLive()){const b=$T().getLiveSeekableRange();
|
|
72
|
+
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():_.At}getStats(){var a=_.Jn();if(this.f){a=$T().getStats();this.f.f=a.estimatedBandwidth||NaN;this.f.o=a.streamBandwidth||NaN;var b=this.f,c=a.height||NaN;b.w=a.width||NaN;b.h=c;b=this.f;c=typeof a.decodedFrames===_.t?a.decodedFrames:NaN;b.l=typeof a.droppedFrames===_.t?a.droppedFrames:NaN;b.j=c;a=this.f.getStats()}return a}isLive(){return Infinity===this.getDuration()}load(a){const b=
|
|
73
|
+
this;return _.x(function*(){b.f=new _.yt;b.a.l=b.f.a;b.A=_.bo(a);b.h=_.Wk(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:kT(b.h),local:!0};yield $T().load(d)}})}getBufferInfo(){this.g.warn(_.qa);return new _.et}getTrackManager(){return this.j}getConfiguration(){return this.h}getSurface(){return this.B}getTimeline(){return null}setupPlaylist(){return Promise.reject(_.qb)}appendLoad(){return Promise.reject(_.qb)}seekWith(){return Promise.reject(_.qb)}setNetworkEngine(a){this.F=
|
|
74
|
+
a}getNetworkEngine(){return this.F}getSourceIndex(){return this.l}setSourceIndex(a){this.l=a}getPeriods(){return[]}namespace(){return fT}getTimelineCues(){return this.o&&this.o.getTimelineCues()||[]}resetAbr(){this.g.warn(bT)}onError(a){a=new _.E(_.r,{detail:a});this.trigger(a)}canPlay(){return _.gk()?2:0}H(a){a=Object.assign({},a);a.customData||(a.customData={});a.customData.stats=kT(this.getStats());var b=$T(),c=a.media||b.getMediaInformation();b=b.getStartAbsoluteTime();c&&typeof b===_.t&&c.startAbsoluteTime!==
|
|
75
|
+
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=$T().getStartAbsoluteTime();if(typeof d===_.t){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;
|
|
76
|
+
a=Object.assign({},a,{media:b})}}return a}G(a,b){let c=null;a.media.customData&&(c=lT(a.media.customData.playerConfiguration));(a=c?c.abr:null)&&typeof a.defaultBandwidthEstimate===_.t?b.initialBandwidth=a.defaultBandwidthEstimate:b.initialBandwidth=void 0;cU(c,b);return b}getTextDisplayer(){return null}setDrmCustomDataModifier(){}setCdnErrorCallback(){}detach(){}};uU.prototype.getTextDisplayer=uU.prototype.getTextDisplayer;uU.prototype.getNetworkEngine=uU.prototype.getNetworkEngine;
|
|
77
|
+
uU.prototype.setNetworkEngine=uU.prototype.setNetworkEngine;var eU=class{constructor(){this.a=!1;this.g=new _.R(gT);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 _.ts;this.l=null}init(a){a&&(this.f=new uU,_.ip(a,this.f),this.m=a,this.o.on(window,"unload",()=>{const b=this;return _.x(function*(){b.m&&b.m.getState()!==_.Wn&&(yield jT(b.m))})}))}start(){if(!this.a&&window.cast&&cast.framework&&cast.framework.CastReceiverContext){this.a=!0;var a=gU(),b=gU().getPlayerManager(),c=new cast.framework.CastReceiverOptions;
|
|
78
|
+
c.customNamespaces={};c.customNamespaces[hT]=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.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,
|
|
79
|
+
this.A);a.start(c);a.addCustomMessageListener(hT,this.w)}}stop(){if(this.a){this.a=!1;this.o.release();const a=gU();gU().getPlayerManager().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.A);a.removeCustomMessageListener(hT,this.w);a.stop();this.m=this.f=null}}kd(a){this.j=a}qh(a){this.l=a}on(a,b){gU().addEventListener(a,b)}off(a,b){gU().removeEventListener(a,b)}addMessageListener(a){typeof a===_.Yd&&this.h.add(a)}removeMessageListener(a){typeof a===_.Yd&&this.h.delete(a)}sendMessage(a,
|
|
80
|
+
b){gU().sendCustomMessage(hT,b,kT(a))}jc(){return this.a}nb(){var a;return a=(a=gU().getPlayerManager().getMediaInformation())&&a.metadata?a.metadata:null}F(a){a=a.trim();if(a.startsWith("#EXTM3U"))return iU(this,a);try{var b=(new DOMParser).parseFromString(a,_.Wf)}catch(k){return a}var c=b.getElementsByTagName("MPD")[0];if(c){a=c;this.g.debug("Detected DASH, parsing");b=gU();c=a.getElementsByTagName("Period");for(var d=c.length-1;0<=d;--d){var e=c[d].getElementsByTagName(_.ha);for(var f=e.length-
|
|
81
|
+
1;0<=f;--f){var g=e[f].getAttribute("contentType");if(g===_.w||g===_.p){g=e[f].getAttribute(_.ze);var h=e[f].getElementsByTagName(_.Db);for(let k=h.length-1;0<=k;--k){const l=h[k].getAttribute(_.ze)||g,m=h[k].getAttribute(_.sd);let n=h[k].getAttribute(_.Cg)||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(_.Db).length||c[d].removeChild(e[f])}}c[d].getElementsByTagName(_.ha).length||a.removeChild(c[d])}return a=
|
|
82
|
+
(new XMLSerializer).serializeToString(a)}if(c=b.getElementsByTagName(_.Jb)[0]){a=c;this.g.debug("Detected Smooth, parsing");b=gU();c=a.getElementsByTagName("StreamIndex");for(d=c.length-1;0<=d;--d)if(c[d].getAttribute("Type")===_.w){e=c[d].getElementsByTagName(_.Bb);for(f=e.length-1;0<=f;--f)g=e[f].getAttribute(_.hb)||void 0,h=e[f].getAttribute(_.gb)||void 0,void 0!==g&&(g=+g),void 0!==h&&(h=+h),b.canDisplayType(_.mg,void 0,g,h)||c[d].removeChild(e[f]);c[d].getElementsByTagName(_.Bb).length||a.removeChild(c[d])}a=
|
|
83
|
+
(new XMLSerializer).serializeToString(a)}return a}C(a){const b=this;return _.x(function*(){let c=a;var d;c.media.customData&&(d=lT(c.media.customData.playerConfiguration));if(b.m&&d){b.j&&(d=(yield Promise.resolve(b.j(d)))||d);d.ima&&(yield PT(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 _.sp(b.m,d),yield _.tp(b.m),d=b.m.getLoadedSource(),c.media.contentId=
|
|
84
|
+
d.url,c.media.contentType=d.type,d.Lb&&(c.media.hlsVideoSegmentFormat=nT(d.Lb,_.N)),d.audioMimeType&&(c.media.hlsSegmentFormat=nT(d.audioMimeType,_.L)));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=gU().getPlayerManager(),
|
|
85
|
+
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))}_.vp(this.m)}}B(a){if(0<this.h.size){const b=lT(a.data);this.h.forEach(c=>c(b))}}};_.z(gT,eU);eU.prototype.getContentMetadata=eU.prototype.nb;eU.prototype.isApiReady=eU.prototype.jc;eU.prototype.sendMessage=eU.prototype.sendMessage;eU.prototype.removeMessageListener=eU.prototype.removeMessageListener;
|
|
86
|
+
eU.prototype.addMessageListener=eU.prototype.addMessageListener;eU.prototype.off=eU.prototype.off;eU.prototype.on=eU.prototype.on;eU.prototype.setLoadRequestDataInterceptor=eU.prototype.qh;eU.prototype.setPlayerConfigInterceptor=eU.prototype.kd;eU.prototype.stop=eU.prototype.stop;eU.prototype.start=eU.prototype.start;eU.prototype.init=eU.prototype.init;eU.getInstance=fU;var dU=null;var vU=class{constructor(a){this.f=a;this.a=null;this.h=new _.ts;this.j=[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.l.bind(a);for(const d of a.j)a.h.on(b,d,c)}})}start(){return _.x(function*(){})}resume(){this.a&&
|
|
87
|
+
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(iT,{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}dispose(){const a=this;
|
|
88
|
+
return _.x(function*(){a.h.release()})}l(a){switch(a.field){case "mediaInfo":a.value&&(a=a.value,a.breaks&&this.f.trigger(new _.E(_.uc,{adsTimeline:new qU(a.breaks)})));break;case "isPlayingBreak":a.value?kU(this,_.cc):(kU(this,_.gc),kU(this,_.rc),kU(this,_.dc));break;case "currentBreakClipNumber":0<=a.value&&(0<a.value&&(kU(this,_.gc),kU(this,_.rc)),kU(this,_.qc));break;case "isPaused":this.a.isPlayingBreak&&(a.value?kU(this,_.mc):kU(this,_.oc))}}};vU.prototype.getPosition=vU.prototype.getPosition;
|
|
89
|
+
vU.prototype.setVolume=vU.prototype.setVolume;vU.prototype.getVolume=vU.prototype.getVolume;vU.prototype.skip=vU.prototype.skip;vU.prototype.pause=vU.prototype.pause;vU.prototype.resume=vU.prototype.resume;var wU=class{name(){return"clpp.cast.ads.SenderAdsManagerFactory"}isSupported(a,b){return a.namespace()!==_.kd?!1:!(!b||!b.ima)}create(a){return new vU(a.a)}};wU.prototype.create=wU.prototype.create;wU.prototype.isSupported=wU.prototype.isSupported;wU.prototype.name=wU.prototype.name;_.ro(new wU);var xU=class{name(){return"clpp.cast.ads.AdsManagerFactory"}isSupported(a,b){return fU().jc()?!(!b||!b.ima):!1}create(a){return new rU(a)}};xU.prototype.create=xU.prototype.create;xU.prototype.isSupported=xU.prototype.isSupported;xU.prototype.name=xU.prototype.name;_.ro(new xU);};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.
|
|
10
|
-
b.connectionType);a.a=Conviva.Analytics.buildVideoAnalytics();a.o=!1;b={};b[Conviva.Constants.FRAMEWORK_NAME]=_.ra;b[Conviva.Constants.FRAMEWORK_VERSION]=_.fa;a.a.setPlayerInfo(b)},
|
|
11
|
-
new _.
|
|
12
|
-
h);if(h=a.m.getStats()){h=h.decodedFrames;const k=h-a.H;a.H=h;isFinite(k)&&(a.
|
|
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.
|
|
14
|
-
a.
|
|
15
|
-
a=a.ad;this.j||(this.
|
|
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.
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var zS="Ad Error",AS="onAdBreakStarted()",BS="onAdBreakStopped()",CS=function(a){var b=_.vk();let c=Conviva.Constants.DeviceType.DESKTOP,d=Conviva.Constants.DeviceCategory.WEB;const e=b.os;b=b.osVersion.name;let f="";_.hk()&&(f="Apple");_.gk()?(f="Google",c=Conviva.Constants.DeviceType.SETTOP,d=Conviva.Constants.DeviceCategory.CHROMECAST):_.ik()?(c=Conviva.Constants.DeviceType.MOBILE,/(android)/i.test(navigator.userAgent)?d=Conviva.Constants.DeviceCategory.ANDROID_DEVICE:_.hk()&&(d=Conviva.Constants.DeviceCategory.APPLE_DEVICE)):
|
|
2
|
+
_.ak()||_.Xj()||_.Wj("Hisense")?(c=Conviva.Constants.DeviceType.SMARTTV,d=Conviva.Constants.DeviceCategory.SMART_TV,_.ak()?(b="",f="LG",d=Conviva.Constants.DeviceCategory.LG_TV):_.Xj()?(f="Samsung",d=Conviva.Constants.DeviceCategory.SAMSUNG_TV):_.Wj("Hisense")&&(b="",f="Hisense")):_.Wj("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},DS=function(a){return a?Conviva.Constants.StreamType.LIVE:Conviva.Constants.StreamType.VOD},ES=function(a){return 0===a?"Pre-roll":-1===a?"Post-roll":"Mid-roll"},GS=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
|
+
DS(!!d);e[Conviva.Constants.ASSET_NAME]=zS;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"]=FS(a.getId()),e["c3.ad.creativeId"]=FS(a.getCreativeId()),e["c3.ad.system"]=FS(a.getAdSystem()),e["c3.ad.mediaFileApiFramework"]=FS(a.getApiFramework()),e["c3.ad.advertiser"]=FS(a.getAdvertiserName()),e["c3.ad.position"]=ES(a.getPodIndex()),e["c3.ad.technology"]=0===a.Fb()?Conviva.Constants.AdType.CLIENT_SIDE:
|
|
5
|
+
Conviva.Constants.AdType.SERVER_SIDE,e["c3.ad.adManagerName"]=FS(a.yb()),e["c3.ad.adManagerVersion"]=FS(a.zb()),e["c3.ad.advertiserCategory"]=FS(null),e["c3.ad.advertiserId"]=FS(null),e["c3.ad.breakId"]=FS(null),e["c3.ad.campaignName"]=FS(null),e["c3.ad.category"]=FS(null),e["c3.ad.classification"]=FS(null),e["c3.ad.creativeName"]=FS(null),e["c3.ad.sequence"]=FS(a.Sb()),e["c3.ad.sessionStartEvent"]=FS(null),e["c3.ad.unitName"]=FS(null),e["c3.ad.dayPart"]=FS(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"]=FS(b),e["c3.ad.firstAdSystem"]=FS(c),e["c3.ad.firstCreativeId"]=FS(a));return e},FS=function(a){return a?""+a:"NA"},KS=function(a){a.f.on(a.m,_.cc,a.C.bind(a));a.f.on(a.m,_.dc,a.F.bind(a));a.f.on(a.m,_.qc,a.L.bind(a));a.f.on(a.m,_.nc,a.l.bind(a));a.f.on(a.m,_.mc,a.l.bind(a));a.f.on(a.m,_.oc,a.l.bind(a));a.f.on(a.m,_.ec,a.l.bind(a));a.f.on(a.m,_.rc,a.N.bind(a));
|
|
7
|
+
a.f.on(a.m,_.pc,a.K.bind(a));a.f.on(a.m,_.fc,a.G.bind(a));a.f.on(a.m,_.ic,a.I.bind(a));a.f.on(a.m,_.jc,a.J.bind(a));a.f.on(a.m,_.hc,a.H.bind(a));a.f.on(a.m,_.lc,a.T.bind(a));a.f.on(a.m,_.sc,a.O.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=zS}null===a.a&&HS(a,null);a.a.reportAdError(c,b.FATAL);a.h=!0;a.g.debug("Ad Playback Failure");
|
|
8
|
+
IS(a,JS,c)}})},IS=function(a,b,c=zS){if(a.a){a.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED);switch(b){case JS:a.a.reportAdFailed(c,GS(null,a.B,a.A));break;case LS:a.a.reportAdSkipped();break;default:a.a.reportAdEnded()}a.a.release();a.a=null;a.j=!1}},HS=function(a,b){if(!a.o){a.h=!1;try{if(a.a=Conviva.Analytics.buildAdAnalytics(a.S()),b){const c=GS(b,a.B,a.A,a.m.isLive()),d=String(b.zb()),e={};e[Conviva.Constants.FRAMEWORK_NAME]=b.yb();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)}}},MS=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(CS(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]=_.fa;a.a.setPlayerInfo(b)},NS=function(a){return a.m.getConfiguration().autoplay||!1},PS=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 _.Kl(b.url);b&&(f[Conviva.Constants.ASSET_NAME]=b.name||"N/A",f[Conviva.Constants.STREAM_URL]=_.jj(g));f[Conviva.Constants.PLAYER_NAME]=c.playerName||_.ra;f[Conviva.Constants.VIEWER_ID]=d;f[Conviva.Constants.DEFAULT_RESOURCE]=e;if(c&&!_.A(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(OS(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.hf(h.args)}));a.j=[]}},QS=function(a){if(!a.l&&a.a){const b=DS(a.m.isLive()),c={};c[Conviva.Constants.IS_LIVE]=b;c[Conviva.Constants.DURATION]=a.m.getDuration();a.a.setContentInfo(c)}},OS=function(a){return null!==a.a&&a.C},RS=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.O=0,a.J=!1,a.j=[],a.H=0)},SS=function(a,b){var c=b.getConfiguration();a.a=!_.A(c.conviva)&&typeof c.conviva===_.Fe;a.a?"undefined"===typeof window.Conviva?(a.g.warn("Conviva SDK is not loaded. Will do nothing."),a.a=!1,c=new _.H(1,9,9E3),a.U(b,c)):b.namespace()===_.kd&&(a.a=!1,
|
|
14
|
+
a.g.debug("Conviva does not report when casting.")):a.g.warn("Conviva plugin is loaded but not configured. Will do nothing.")},TS=function(a){const b=[];typeof a===_.Fe&&(a.customerKey||b.push("customerKey"),a.viewerId||b.push("viewerId"));if(0<b.length)throw new _.H(1,9,9001,{missingKeys:b});};var VS=class{constructor(a,b){this.m=a;this.S=b;this.B="";this.A=_.ra;this.g=new _.R("clpp.conviva.ad");this.f=new _.ts;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;KS(this)}release(){this.g.debug("Release Ad Insights");this.w?this.g.debug(_.ja):(_.ph(this.f),this.a&&IS(this,US),this.f.release(),this.w=!0,this.j=this.h=!1)}destroy(){this.g.debug(_.Ed);this.o?this.g.debug(_.ia):this.o=!0}C(){this.g.debug(AS)}F(){this.g.debug(BS)}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"),HS(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.Cb(),a.Bb());this.a.reportAdMetric(Conviva.Constants.Playback.BITRATE,a.qb())}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 _.nc:case _.oc:b(Conviva.Constants.PlayerState.PLAYING);
|
|
16
|
+
break;case _.mc:b(Conviva.Constants.PlayerState.PAUSED);break;case _.ec:b(Conviva.Constants.PlayerState.BUFFERING)}}}N(){this.g.debug("onAdStopped()");this.a&&!this.h&&IS(this,US)}K(){this.g.debug("onAdSkipped()");this.a&&IS(this,LS)}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;HS(this,b)};if(-1!==b.getPodIndex()||this.m.getPosition()>=this.m.getDuration()-5)c();else this.f.on(this.m,_.Xf,()=>{this.m.getPosition()>=this.m.getDuration()-5&&(this.f.off(this.m,_.Xf),c())})}H(){this.g.debug("onAdFirstQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_FIRST_QUARTILE)}T(){this.g.debug("onAdMidPoint()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_MID_QUARTILE)}O(){this.g.debug("onAdThirdQuartile()");this.a&&
|
|
18
|
+
this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_THIRD_QUARTILE)}},LS=0,US=1,JS=2;var WS=class{constructor(a,b){this.m=a;this.f=new _.ts;this.a=null;this.o=!1;this.G=!0;this.B=this.h=this.A=this.C=this.l=!1;this.O=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=_.Qg(b),this.K=c,this.m=a,MS(this,this.F),this.f.on(this.m,_.Te,this.ea.bind(this)),this.f.on(this.m,_.Nf,this.Z.bind(this)),this.f.on(this.m,_.Nc,this.L.bind(this)),this.f.on(this.m,_.gg,this.X.bind(this)),this.f.on(this.m,
|
|
19
|
+
_.fg,this.W.bind(this)),this.f.on(this.m,_.cc,this.S.bind(this)),this.f.on(this.m,_.dc,this.T.bind(this)),this.f.on(this.m,_.uc,this.aa.bind(this)),this.f.on(this.m,_.Mc,this.ga.bind(this)),this.f.on(this.m,_.r,this.N.bind(this)),NS(this)&&(this.g.debug("Start a new session: A new video starts in autoplay."),PS(this)))}release(){this.g.debug("Release conviva");this.G?this.g.debug(_.ja):(_.ph(this.f),OS(this)||this.o||!NS(this)||this.a&&this.a.reportPlaybackFailed("Exit Before Video Start"),OS(this)&&
|
|
20
|
+
RS(this),this.a=null,this.G=!0)}destroy(){this.g.debug(_.Ed);this.l?this.g.debug(_.ia):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}ea(){this.g.debug("onPlayRequest()");OS(this)||NS(this)?OS(this)&&this.A&&!this.h&&(this.g.debug("Resuming VST monitoring ..."),OS(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
|
+
PS(this))}Z(a){this.g.debug(_.Ke);const b=c=>{if(this.o&&(this.g.debug("Creating conviva session (On Seek / Replay)"),MS(this,this.F),PS(this),QS(this),OS(this))){var d=this.m.getTrackManager();d=d.oa()||d.cb();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)}OS(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,c)};switch(a.detail.currentState){case _.Zn:b(Conviva.Constants.PlayerState.PLAYING);
|
|
22
|
+
break;case _.Yn:b(Conviva.Constants.PlayerState.PAUSED);break;case _.Rn:b(Conviva.Constants.PlayerState.BUFFERING);break;case _.On:this.g.debug("onVideoEnded()"),OS(this)&&(this.w&&this.w.sb()?(this.g.debug("Waiting for postroll Ad before terminating session"),this.J=!0):RS(this))}}L(a){this.g.debug(_.Ge);if(OS(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({hf:this.L.bind(this),args:a})}X(){this.g.debug("onSeeking()");OS(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)}W(){this.g.debug("onSeeked()");OS(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_ENDED)}aa(a){this.g.debug("onAdsTimelineChanged()");if(a=a.adsTimeline)this.w=a}S(a){this.g.debug(AS);
|
|
24
|
+
var b=a.ad;a=0===b.eb();const c=ES(b.getPodIndex());OS(this)||NS(this)||!a||PS(this);if(OS(this)){a=0===b.Fb()?Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE;let d=0;const e={};1===b.Eb()&&(d=b.getDuration());e[Conviva.Constants.POD_DURATION]=d;e[Conviva.Constants.POD_INDEX]=++this.O;e[Conviva.Constants.POD_POSITION]=c;b=Conviva.Constants.AdPlayer;b=a!==Conviva.Constants.AdType.CLIENT_SIDE||_.gk()?b.CONTENT:b.SEPARATE;this.a.reportAdBreakStarted(a,b,e);this.B=!0}else this.g.debug("Bug: should already have a valid session")}T(){this.g.debug(BS);
|
|
25
|
+
OS(this)&&this.B&&(this.a.reportAdBreakEnded(),this.B=!1,this.J&&RS(this))}N(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===_.F&&(d=Conviva.Constants.ErrorSeverity.FATAL,OS(this)||PS(this));OS(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,RS(this))):this.j.push({hf:this.N.bind(this),args:a})}}ga(){this.g.debug("onAutoPlayBlocked()");OS(this)&&(this.g.debug("Auto-play blocked. Pausing VST monitoring."),this.A=!0,OS(this)&&this.h&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_STARTED),this.h=!1))}};var XS=class{constructor(){this.h=this.f=null;this.a=!1;this.g=new _.R("clpp.conviva")}onPlayerCreated(a){this.f=new WS(a,this.g)}onContentWillLoad(a,b){SS(this,a);if(this.a){var c=a.getConfiguration();c=_.Qg(c.conviva||{});try{TS(c);const d=c.enableAdInsights||!1;this.f.initialize(a,c,b);d&&(this.h=new VS(a,()=>this.f.a),this.h.initialize(c))}catch(d){d instanceof _.H?this.U(a,d):this.U(a,new _.H(1,9,9002,d,d))}}}onContentLoaded(){this.a&&QS(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"}U(a,b){a.trigger(new _.E(_.r,{detail:b}))}reportAppEvent(a,b){return this.f?this.f.reportAppEvent(a,b):!1}};_.z("clpp.conviva.ConvivaPlugin",XS);XS.prototype.reportAppEvent=XS.prototype.reportAppEvent;XS.Id="conviva";_.dp(new class{create(){return new XS}});};f.call(g, window);
|