@castlabs/prestoplay 6.13.0 → 6.14.1
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 +42 -0
- package/cjs/cl.adobe.js +3 -3
- package/cjs/cl.airplay.js +3 -3
- package/cjs/cl.broadpeak.js +7 -6
- package/cjs/cl.cast.js +111 -111
- package/cjs/cl.conviva.js +33 -33
- package/cjs/cl.core.js +528 -518
- package/cjs/cl.crypto.js +9 -9
- package/cjs/cl.dash.js +72 -72
- package/cjs/cl.externs.js +60 -58
- package/cjs/cl.freewheel.js +24 -24
- package/cjs/cl.hls.js +69 -67
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +29 -30
- package/cjs/cl.ima.js +23 -23
- package/cjs/cl.mse.js +265 -274
- package/cjs/cl.muxdata.js +15 -14
- package/cjs/cl.onboard.js +3 -3
- package/cjs/cl.persistent.js +13 -13
- package/cjs/cl.playlist.js +6 -6
- package/cjs/cl.simid.js +15 -15
- package/cjs/cl.smooth.js +71 -71
- package/cjs/cl.thumbnails.js +26 -26
- package/cjs/cl.tizen.js +70 -70
- 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 +20 -20
- package/cl.adobe.js +3 -3
- package/cl.airplay.js +3 -3
- package/cl.broadpeak.js +5 -5
- package/cl.cast.js +88 -88
- package/cl.conviva.js +27 -27
- package/cl.core.js +441 -431
- package/cl.crypto.js +8 -8
- package/cl.dash.js +68 -68
- package/cl.externs.js +60 -58
- package/cl.freewheel.js +19 -19
- package/cl.hls.js +71 -69
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +26 -26
- package/cl.ima.js +17 -17
- package/cl.mse.js +236 -239
- package/cl.muxdata.js +13 -12
- package/cl.onboard.js +4 -4
- package/cl.persistent.js +11 -11
- package/cl.playlist.js +5 -5
- 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 +14 -14
- package/cl.vtt.js +12 -12
- package/cl.youbora.js +15 -15
- package/clpp.styles.css +2 -0
- package/package.json +4 -4
- package/typings.d.ts +93 -50
package/cl.cast.js
CHANGED
|
@@ -1,88 +1,88 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
{if("license"!==b&&typeof c!==_.
|
|
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.V.length){a.w=!0;a.o.
|
|
8
|
-
cast.framework.CastContext.getInstance();b.removeEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.
|
|
9
|
-
void 0===c?0:c;return _.
|
|
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.g}onError(a){a.severity===_.
|
|
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
|
-
if(e)try{yield e.sendMessage(a,
|
|
35
|
-
b;throw new _.H(1,8,8E3,c);}})}
|
|
36
|
-
_.
|
|
37
|
-
this.a.playbackRate||0}setPlaybackRate(a){this.a&&0<a&&this.sendMessage(
|
|
38
|
-
!this.a.media||!this.a.media.metadata)return null;const a=this.a.media.metadata.sectionStartAbsoluteTime;return typeof a!==_.r?null:1E-8===a?0:a}getSeekRange(){let a={start:0,end:this.getDuration()};if(this.isLive()){const b=this.a.getEstimatedLiveSeekableRange();b&&typeof b.start===_.r&&typeof b.end===_.r&&(a={start:b.start,end:b.end})}return a}getState(){return this.j?this.j.getState():_.
|
|
39
|
-
this.getDuration()}load(a){const b=this;return _.
|
|
40
|
-
a}getLoadedSource(){return this.C[this.B]}getPeriods(){return[]}getDrmInfo(){return null}getTimelineCues(){return[]}resetAbr(){this.h.warn(
|
|
41
|
-
this.
|
|
42
|
-
a);switch(a.sessionState){case cast.framework.SessionState.SESSION_STARTED:this.A=!0;
|
|
43
|
-
|
|
44
|
-
chrome.cast.media.TrackType.TEXT),c.language=d.language,c.name=d.label||null,c.trackContentId=d.url,c.trackContentType=d.mimeType,c.customData={mimeType:a.mimeType,url:a.url});return c})}getTextDisplayer(){return null}};
|
|
45
|
-
b.f&&b.a){{let d=null;const e=b.f.getLoadedSource();if(e){const f=b.f.getTrackManager(),g=f.getVideoTracks()[0];let h,k;g&&g.mimeType&&(h=g.mimeType);const l=b.f.getConfiguration(),m=f.
|
|
46
|
-
isLive:q,autoplay:!b.f.isPaused(),currentTime:Math.max(b.f.getPosition()-1,0),
|
|
47
|
-
yield b.a.sendMessage(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
this.H);b.addEventListener(a.MEDIA_FINISHED,this.A);b.addEventListener(a.BUFFERING,this.w);b.addEventListener(a.SEEKING,this.K);b.addEventListener(a.SEEKED,this.J);b.addEventListener(a.STALLED,this.M);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 _.
|
|
51
|
-
d.removeEventListener(c.PLAYING,a.I);d.removeEventListener(c.PAUSE,a.H);d.removeEventListener(c.MEDIA_FINISHED,a.A);d.removeEventListener(c.BUFFERING,a.w);d.removeEventListener(c.SEEKING,a.K);d.removeEventListener(c.SEEKED,a.J);d.removeEventListener(c.STALLED,a.M);d.removeEventListener(c.PLAYER_LOADING,a.G);d.removeEventListener(c.ERROR,a.F);d.removeEventListener(c.BITRATE_CHANGED,a.f);yield b().call(a)})}
|
|
52
|
-
this.a(_.
|
|
53
|
-
null}getMediaUrl(){return this.a.contentUrl||this.a.contentId||null}
|
|
54
|
-
Z.prototype.getWrapperAdIds=Z.prototype.getWrapperAdIds;Z.prototype.getSequenceLength=Z.prototype.
|
|
55
|
-
Z.prototype.isBumper=Z.prototype.
|
|
56
|
-
Z.prototype.getAdManagerVersion=Z.prototype.
|
|
57
|
-
this.g)}load(){const a=this;return _.
|
|
58
|
-
switch(a.type){case cast.framework.events.EventType.PLAYER_LOADING:this.a=
|
|
59
|
-
break;case cast.framework.events.EventType.BREAK_CLIP_ENDED:a.endedReason===b.SKIPPED?(
|
|
60
|
-
|
|
61
|
-
_.
|
|
62
|
-
this.
|
|
63
|
-
this.f.setActiveById(+a.id)}
|
|
64
|
-
c.language;d.name=c.label;d.subtype=c.kind;d.trackContentId=c.url;d.trackContentType=c.mimeType;d.customData={mimeType:a.mimeType,url:a.url};try{b.a.addTracks([d]),
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
cast.framework.messages.PlayerState,b=
|
|
68
|
-
a.play();return Promise.resolve()}pause(){const a=
|
|
69
|
-
|
|
70
|
-
null}getLoadedSource(){const a=
|
|
71
|
-
b&&typeof b.start===_.r&&typeof b.end===_.r&&(a={start:b.start,end:b.end})}return a}getState(){return this.a?this.a.getState():_.
|
|
72
|
-
this;return _.
|
|
73
|
-
a}getNetworkEngine(){return this.F}getSourceIndex(){return this.l}setSourceIndex(a){this.l=a}getPeriods(){return[]}namespace(){return
|
|
74
|
-
b&&(this.h.info("Syncing startAbsoluteTime."+`Old value: ${c.startAbsoluteTime}, `+`new value: ${b}`),c.startAbsoluteTime=b,a=Object.assign({},a,{media:c}));{c=cast.framework.messages.StreamType;b=a.media;var d=!!b;const e=this.isLive(),f=d&&!b.metadata,g=!!a.liveSeekableRange;if(d&&g&&(!e||e&&f)){d=
|
|
75
|
-
a=Object.assign({},a,{media:b})}}return a}G(a,b){let c=null;a.media.customData&&(c=
|
|
76
|
-
|
|
77
|
-
c.customNamespaces={};c.customNamespaces[
|
|
78
|
-
this.A);a.start(c);a.addCustomMessageListener(
|
|
79
|
-
b){
|
|
80
|
-
1;0<=f;--f){var g=e[f].getAttribute("contentType");if(g===_.
|
|
81
|
-
(new XMLSerializer).serializeToString(a)}if(c=b.getElementsByTagName(_.
|
|
82
|
-
(new XMLSerializer).serializeToString(a)}return a}C(a){const b=this;return _.
|
|
83
|
-
d.url,c.media.contentType=d.type,d.Eb&&(c.media.hlsVideoSegmentFormat=
|
|
84
|
-
c=b.getLiveSeekableRange();if(c){a=c.start;c=c.end;var d=this.m.getConfiguration().startTime;typeof a!==_.r||typeof c!==_.r||typeof d!==_.r||d>=a&&d<=c||(b=b.getMediaTimeForAbsoluteTime(d),typeof b===_.r&&b>=a&&b<=c&&this.m.seek(b))}_.
|
|
85
|
-
|
|
86
|
-
this.a.isPlayingBreak&&this.a.isPaused&&this.a.controller.playOrPause()}pause(){this.a&&this.a.isPlayingBreak&&!this.a.isPaused&&this.a.controller.playOrPause()}skip(){const a=this.f.a;a&&this.f.sendMessage(
|
|
87
|
-
return _.
|
|
88
|
-
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var zP="Cannot seek during ads playout.",AP="Cannot switch track",BP="Media session does not exist.",CP="No receivers available",DP="Reset ABR functionality not available on cast.",EP="SDK not yet ready",FP="Sender is destroyed.",GP="clpp.cast.CastProxy",HP="clpp.cast.Player",IP="clpp.cast.Receiver",JP="urn:x-cast:castlabs",LP="urn:x-cast:com.google.cast.media",MP=function(a){return _.w(function*(){yield _.Ko(a,_.Ce);yield _.Ko(a,_.Be)})},NP=function(a){return JSON.stringify(a,(b,c)=>
|
|
2
|
+
{if("license"!==b&&typeof c!==_.Td){if(c instanceof Event){b={};for(const d in c){const e=c[d];typeof e===_.ye?"detail"===d&&(b[d]=e):d in Event||(b[d]=e)}return b}return typeof c===_.r?isNaN(c)?"NaN":isFinite(c)?c:0>c?"-Infinity":"Infinity":c}})},OP=function(a){if(typeof a!==_.yf)return a;try{return JSON.parse(a,(b,c)=>"NaN"===c?NaN:"-Infinity"===c?-Infinity:"Infinity"===c?Infinity:c)}catch(b){return a}},PP=function(a,b,c,d){return _.w(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=_.lj(d,a.mimeType,g);f&&g&&(h=_.zi(a.url),(h=yield c.fetch(h).P)&&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})},QP=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 _.Yf:return d.FMP4;case _.Xf:return b===_.M?d.MPEG2_TS:c.TS;case _.Ec:return c.AAC;case _.Fc:return c.AC3;case _.Gc:return c.E_AC3;case "audio/mpeg":return c.MP3;case _.Hc:return c.FMP4}},SP=function(a){a=void 0===a?RP: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}},TP=function(a,b){return a.g.filter(c=>c.type===b)},VP=function(a,b){const c=UP(a);return TP(a,b).find(d=>c.includes(d.id))||null},XP=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.qa();e&&c.push(+e.id)}c=new chrome.cast.media.EditTracksInfoRequest(c);
|
|
6
|
+
d.editTracksInfo(c,()=>{a.f[b]=null;WP(a,b)},e=>{a.f[b]=null;a.h.debug(AP,e)})}else b===_.K&&(c=new chrome.cast.media.EditTracksInfoRequest([]),d.editTracksInfo(c,()=>{WP(a,b)},e=>{a.h.debug(AP,e)}))},UP=function(a){a=a.a?a.a.a:null;return(a?a.activeTrackIds||[]:[]).map(b=>b.toString())},WP=function(a,b){b===_.L?a.a.trigger(new _.C(_.pk)):b===_.K&&a.a.trigger(new _.C(_.qk))},$P=function(a){if(a)for(const b of YP)ZP(b)},ZP=function(a){if(!a.w&&window.chrome&&chrome.cast&&chrome.cast.isAvailable&&window.cast&&
|
|
7
|
+
cast.framework&&cast.framework.CastContext&&a.V.length){a.w=!0;a.o.ve();var b=cast.framework.CastContext.getInstance(),c=new cast.framework.CastOptions;c.receiverApplicationId=a.V;c.autoJoinPolicy=chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED;b.setOptions(c);b.addEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.O);b.addEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.ba);aQ&&a.o.ca(.02)}},bQ=function(a){return _.w(function*(){YP.delete(a);if(a.w){a.w=!1;var b=
|
|
8
|
+
cast.framework.CastContext.getInstance();b.removeEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.O);b.removeEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.ba)}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.U=null;a.Z=null})},cQ=function(a){return _.w(function*(){a.lb()||(yield cast.framework.CastContext.getInstance().requestSession())})},eQ=function(a,b,c){c=
|
|
9
|
+
void 0===c?0:c;return _.w(function*(){var d=a.f.qa();d&&d.language&&(a.g.preferredTextLanguage=d.language);(d=a.f.ja())&&d.language&&(a.g.preferredAudioLanguage=d.language);yield dQ(a,{source:a.getLoadedSource(),currentTime:c,isLive:a.isLive(),me:a.getPresentationStartTime(),autoplay:b,Qa:a.g})})},dQ=function(a,b){return _.w(function*(){var c=chrome.cast.media.StreamType;yield cQ(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=QP(b.Eb,_.M);e.hlsSegmentFormat=QP(c,_.L);b.Qa&&(a.M&&(c=yield Promise.resolve(a.M(b.Qa)))&&(b.Qa=c),a.g=b.Qa,a.C=_.In(a.g),a.B=a.C.findIndex(k=>k.url===b.source.url),b.Qa.remoteTextTracks&&(c=yield Promise.all(b.Qa.remoteTextTracks.map(a.Oa.bind(a))),e.tracks=c.filter(k=>k),b.Qa.remoteTextTracks=void 0),delete b.Qa.autoplay,b.Qa.startTime=null,e.customData={playerConfiguration:NP(b.Qa)});c=a.gb()||{};
|
|
11
|
+
var f=fQ(c.metadataType),g;typeof b.me===_.r&&(g={metadataType:f,sectionStartAbsoluteTime:b.me});var h;b.source.name&&(h={metadataType:f,title:b.source.name});c=gQ(c);if(g=hQ(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===_.r&&(e.currentTime=b.currentTime);yield d.loadMedia(e)}})},hQ=function(a){if(!a)return null;a:{var b=a.metadataType;const c=Object.entries(iQ);for(const d of c){const [e,f]=d;
|
|
12
|
+
if(f===b){b=e;break a}}b=null}if(!b)return null;b=SP(iQ[b]);return Object.assign(b,a)},fQ=function(a){var b=void 0===b?RP:b;return Object.values(iQ).includes(a)?a:b},gQ=function(a){const b={};for(const c in a)void 0!==a[c]&&(b[c]=a[c]);return b},kQ=function(a,b){jQ(a,b.getMediaSession());b.addEventListener(cast.framework.SessionEventType.MEDIA_SESSION,a.W);b.addMessageListener(JP,a.R)},lQ=function(a){const b=a.getPosition();a.a&&a.a.media?(a=a.a.media.startAbsoluteTime,a=typeof a!==_.r?null:a):a=
|
|
13
|
+
null;a=null===a?null:a+b;return null===a?b:a},jQ=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.oa.bind(a)),a.f&&a.f.load(),a.j&&a.j.init(),a.trigger(new _.C(_.le)))},oQ=function(a){return new mQ(a.g,()=>{a.trigger(new _.C(_.Sc))},(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.Fe&&(d.preferredAudioLanguage=c.Fe);c.zf&&(d.preferredTextLanguage=c.zf);_.Mo(a.f,null);a.trigger(new _.C("castingended"));a.j(b,d)}},()=>nQ(a))},nQ=function(a){return _.w(function*(){a.trigger(new _.C(_.Rc));a.f.a!==a.a&&a.f&&a.a&&(yield a.f.release(),_.Mo(a.f,a.a))})},rQ=function(a,b,c){return _.w(function*(){var d=b.adTagUrl;if(d)try{pQ=!1;const e=_.zi(d),f=yield c.fetch(e).P;if(f&&f.data){const g=_.Wh(f.data),h=(new DOMParser).parseFromString(g,
|
|
15
|
+
_.Ef);if(h.getElementsByTagName("vmap:VMAP").length)_.B("VMAP detected."),a.vmapAdsRequest=qQ(g);else if(h.getElementsByTagName("VAST").length){_.B("VAST detected.");{d=g;const k=new cast.framework.messages.BreakClip("bc1");k.vastAdsRequest=qQ(d);const l=new cast.framework.messages.Break("b1",[k.id],0);a.breakClips=[k];a.breaks=[l]}}else _.B("Unsupported schema."),pQ=!0}}catch(e){_.B("Failed to fetch an ad",e),pQ=!0}})},qQ=function(a){const b=new cast.framework.messages.VastAdsRequest;b.adsResponse=
|
|
16
|
+
a;return b},sQ=function(a,b){b=new _.H(1,10,10003,{errorType:b});a.m.onError(b)},tQ=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},vQ=function(a,b,c){if(c instanceof cast.framework.events.BreaksEvent||-1!==a.getPosition()){var d=null;(c=uQ(a,c))&&(d={ad:c});a.m.trigger(new _.C(b,d))}},uQ=function(a,b){let c=null;if(a.a&&b instanceof cast.framework.events.BreaksEvent){let d=null,e=null,f;typeof b.breakClipId===_.yf&&(d=a.a.getBreakClipById(b.breakClipId));typeof b.breakId===
|
|
17
|
+
_.yf&&(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},wQ=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]},xQ=function(a){const b=
|
|
18
|
+
a.dashTimedMetadata;let c=_.Mf;b&&(c=b.schemeIdUri);return{type:c.startsWith(_.Lf)?_.ah:_.Zg,schemeIdUri:c,id:a.id||"",startTime:a.startTime,endTime:a.endTime,value:b&&b.value||"",eventElement:b&&b.eventElement}},yQ=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},AQ=function(a){a.a=yQ().getTextTracksManager();const b=a.a.getTracks();a.j=zQ(_.K,b)},zQ=function(a,b){const c=[];for(const d of b)b=new _.Pi(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 _.Zi(b.id,b)),c.push(b);return c},BQ=function(a,b,c,d){c=_.hh(c).filter(g=>g);var e=!1;let f=[];b===_.L?f=a.getAudioTracks():b===_.K&&(f=a.ga());if(c=c.find(g=>{const h=_.Jh(g);return f.some(k=>{k=_.Jh(k.language||"");return _.Kh(h,k)})})){const g=
|
|
20
|
+
_.Jh(c);c=f.filter(h=>{h=_.Jh(h.language||"");return _.Kh(g,h)});f=c.length?c:f;e=e||!!c.length}_.ei(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.h.info("Will select track",e),b===_.L?a.ta(e):b===_.K&&a.Ha(e))},CQ=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},FQ=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=_.Wk(d);if(e){var f=[_.sd];_.In(a)[0].type!==_.zc&&f.unshift(_.ud);d.preferredDrmSystem===_.sd&&f.reverse();for(var g,h;f.length&&!h;)g=f.shift(),h=e.Sa[g];h?(c=g===_.ud?cast.framework.ContentProtection.WIDEVINE:g===_.sd?cast.framework.ContentProtection.PLAYREADY:void 0,b.protectionSystem=c,b.licenseUrl=h.licenseUrl,c={ldlDelay:0,customData:{}},DQ(b,h,a,c),EQ(b,h,a,c)):c()}else c()}else c()},DQ=function(a,b,c,d){b.modifiers.licenseRequest?a.licenseRequestHandler=e=>{const f=
|
|
22
|
+
_.zi({method:"POST",uris:[e.url]});e.headers&&(f.headers=e.headers);f.body=e.content;f.allowCrossSiteCredentials=e.withCredentials;b.modifiers.licenseRequest(c,f,d);e.url=f.uris[0];e.headers=f.headers;e.content=f.body;e.withCredentials=f.allowCrossSiteCredentials}:a.licenseRequestHandler=void 0},EQ=function(a,b,c,d){b.modifiers.licenseResponse?a.licenseHandler=(e,f)=>_.w(function*(){const g=_.Ai(Object.assign({},f.headers),e.buffer,200,"");yield b.modifiers.licenseResponse(c,g,d);return _.J(g.data)}):
|
|
23
|
+
a.licenseHandler=void 0},IQ=function(){return GQ||(GQ=new HQ)},JQ=function(){return cast.framework.CastReceiverContext.getInstance()},LQ=function(a,b){a.h.debug("Detected HLS, parsing");var c=cast.framework.messages.HlsVideoSegmentFormat;a=JQ();var {hlsVideoSegmentFormat:d}=JQ().getPlayerManager().getMediaInformation()||{};c=d===c.FMP4?_.Yf:_.Xf;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
|
+
KQ(f,_.na),h=KQ(f,_.vb);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")},KQ=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},NQ=function(a,b){let c=null;const d=MQ(a);d&&(c={ad:d});a.f.trigger(new _.C(b,c))},MQ=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},OQ=class{constructor(a,b){this.log=new _.R(b);this.player=a;this.l=null;this.g=_.Cn;this.o=_.Ls;this.j=2;this.C=Date.now();this.B=-1}release(){this.a(_.Cn)}destroy(){this.l=
|
|
26
|
+
this.player=null;return Promise.resolve()}getState(){return this.g}onError(a){a.severity===_.F&&this.a(_.Bn)}a(a){if(a!==this.g)if(this.g===_.Bn&&a!==_.Cn)this.log.debug("Player is in ERROR state and can not switch to",a);else{var b=Date.now();this.o=this.g;this.g=a;this.g===_.xn?(this.B=b,this.player.trigger(new _.C(_.Oc,{detail:{bufferedTimeMS:-1,reason:this.j}}))):this.o===_.xn&&this.player.trigger(new _.C(_.Nc,{detail:{bufferedTimeMS:b-this.B,reason:this.j}}));a={currentState:this.g,previousState:this.o,
|
|
27
|
+
timeSinceLastStateChangeMS:b-this.C};this.C=b;this.l&&_.ln(this.l,this.g);this.player.trigger(new _.C(_.vf,{detail:a}))}}};_.x("clpp.cast.CastUtils",class{});var RP=0,iQ={GENERIC:RP,MOVIE:1,TV_SHOW:2,MUSIC_TRACK:3,PHOTO:4,AUDIOBOOK_CHAPTER:5};var PQ=class extends OQ{constructor(a){super(a,"clpp.cast.SenderStateManager");this.w=this.f=null;this.A=this.Bb.bind(this)}init(){const a=this.player,b=a.a;b&&(this.f&&this.f.removeUpdateListener(this.A),this.f=b,this.f.addUpdateListener(this.A),this.w=a.l)}destroy(){const a=this,b=()=>Object.getPrototypeOf(Object.getPrototypeOf(this)).destroy;return _.w(function*(){a.f&&(a.f.removeUpdateListener(a.A),a.f=null);yield b().call(a)})}a(a){const b=this.player.l;b&&b.isPlayingBreak||super.a(a)}Bb(){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(_.un);break;case chrome.cast.media.IdleReason.ERROR:this.a(_.Bn);break;default:this.a(_.Cn)}break;case chrome.cast.media.PlayerState.PLAYING:this.a(_.Fn);break;case chrome.cast.media.PlayerState.PAUSED:this.a(_.En);break;case chrome.cast.media.PlayerState.BUFFERING:this.a(_.xn)}}};var QQ=class extends _.S{constructor(){super();this.h=new _.R("clpp.cast.SenderTrackManager");this.a=null;this.g=[];this.f={}}initialize(a){this.a=a}release(){this.g=[];this.f={}}load(){this.release();var a=this.a.a;a&&(a=a.media)&&(this.g=(a=a.tracks)?a.map(b=>{switch(b.type){case chrome.cast.media.TrackType.VIDEO:var c=_.M;break;case chrome.cast.media.TrackType.AUDIO:c=_.L;break;case chrome.cast.media.TrackType.TEXT:c=_.K}c=new _.Pi(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 _.Zi(c.id,c));return c}):[],this.a.trigger(new _.C(_.os)))}destroy(){this.a=null}getVideoTracks(){return TP(this,_.M)}getAudioTracks(){return TP(this,_.L)}ga(){return TP(this,_.K)}ka(){const a=this.Ea();return a?a.renditions[0]:null}Ka(){const a=this.ja();return a?a.renditions[0]:null}Da(){const a=this.qa();return a?a.renditions[0]:
|
|
30
|
+
null}Va(){return this.f[_.M]||null}hb(){return this.f[_.L]||null}ib(){return this.f[_.K]||null}Ea(){return VP(this,_.M)}ja(){return VP(this,_.L)}qa(){return VP(this,_.K)}ab(a){XP(this,_.M,a)}ta(a){XP(this,_.L,a)}Ha(a){XP(this,_.K,a)}Ra(a){this.ab(a&&a.track)}Za(a){this.ta(a&&a.track)}$a(a){this.Ha(a&&a.track)}addTextTrack(){return _.w(function*(){})}ma(){return!0}};QQ.prototype.isAbrEnabled=QQ.prototype.ma;QQ.prototype.addTextTrack=QQ.prototype.addTextTrack;QQ.prototype.setTextRendition=QQ.prototype.$a;
|
|
31
|
+
QQ.prototype.setAudioRendition=QQ.prototype.Za;QQ.prototype.setVideoRendition=QQ.prototype.Ra;QQ.prototype.setTextTrack=QQ.prototype.Ha;QQ.prototype.setAudioTrack=QQ.prototype.ta;QQ.prototype.setVideoTrack=QQ.prototype.ab;QQ.prototype.getTextTrack=QQ.prototype.qa;QQ.prototype.getAudioTrack=QQ.prototype.ja;QQ.prototype.getVideoTrack=QQ.prototype.Ea;QQ.prototype.getLoadingTextRendition=QQ.prototype.ib;QQ.prototype.getLoadingAudioRendition=QQ.prototype.hb;QQ.prototype.getLoadingVideoRendition=QQ.prototype.Va;
|
|
32
|
+
QQ.prototype.getTextRendition=QQ.prototype.Da;QQ.prototype.getAudioRendition=QQ.prototype.Ka;QQ.prototype.getVideoRendition=QQ.prototype.ka;QQ.prototype.getTextTracks=QQ.prototype.ga;QQ.prototype.getAudioTracks=QQ.prototype.getAudioTracks;QQ.prototype.getVideoTracks=QQ.prototype.getVideoTracks;var mQ=class extends _.qs{constructor(a,b,c,d){super();this.h=new _.R(_.fd);this.V=a;this.o=new _.zj(b);this.U=c;this.Z=d;this.g=this.I=_.Ak();this.C=[];this.B=0;this.K=new _.Eo;this.G=this.l=this.a=null;this.A=this.w=!1;this.aa="";this.fa=1E6;this.f=new QQ;this.f.initialize(this);this.j=new PQ(this);this.H=new _.Er;this.J=null;this.F=new Set;this.O=this.cb.bind(this);this.ba=this.qb.bind(this);this.W=this.fb.bind(this);this.R=this.eb.bind(this);this.M=null;window.cast||Object.defineProperty(window,
|
|
33
|
+
"cast",{get:()=>window.cast_,set:e=>{window.cast_=e;window.setTimeout(()=>{$P(!0)},0)}});ZP(this);YP.add(this)}init(a,b){this.g=this.I=b}unload(){return new Promise((a,b)=>{this.f&&this.f.release();this.a&&!this.a.idleReason||a();this.a.stop(null,a,b)})}release(){return this.unload().then(()=>{this.j&&this.j.release()})}destroy(){return _.w(function*(){})}bd(a){this.M=a}bc(){return this.w}lb(){return this.A}Rd(){return this.aa}sendMessage(a,b){const c=this;return _.w(function*(){let d;const e=cast.framework.CastContext.getInstance().getCurrentSession();
|
|
34
|
+
if(e)try{yield e.sendMessage(a,NP(b))}catch(f){d=new _.H(1,8,8E3,{detailedErrorCode:f})}else d=new _.H(1,8,8004,void 0);if(d)c.onError(d)})}cast(){const a=this;return _.w(function*(){if(!a.bc())throw a.h.warn(EP),new _.H(1,8,8001,void 0);if(!aQ)throw a.h.warn(CP),new _.H(1,8,8002,void 0);if(a.lb())throw a.h.warn("Already casting"),new _.H(1,8,8003,void 0);try{yield cQ(a)}catch(b){const c={};b instanceof chrome.cast.Error?(c.detailedErrorCode=b.code,c.details=b.details,c.reason=b.description):c.detailedErrorCode=
|
|
35
|
+
b;throw new _.H(1,8,8E3,c);}})}Od(){this.lb()&&cast.framework.CastContext.getInstance().endCurrentSession(!0)}addMessageListener(a){typeof a===_.Td&&this.F.add(a)}removeMessageListener(a){typeof a===_.Td&&this.F.delete(a)}play(){return this.isEnded()?eQ(this,!0):new Promise((a,b)=>{if(!this.a)return b(BP);this.a.play(null,a,b)})}pause(){return new Promise((a,b)=>{this.isEnded()&&a();if(!this.a)return b(BP);this.a.pause(null,a,b)})}isPaused(){return!!this.a&&this.a.playerState===chrome.cast.media.PlayerState.PAUSED}isEnded(){return this.getState()===
|
|
36
|
+
_.un}seek(a){return this.isEnded()?eQ(this,!1,a):new Promise((b,c)=>{this.a||c(BP);this.l.isPlayingBreak&&c(zP);const d=new chrome.cast.media.SeekRequest;d.currentTime=a;this.trigger(new _.C(_.Pf));this.a.seek(d,()=>{this.trigger(new _.C(_.Of));b()},c)})}getPosition(){return this.a&&this.a.getEstimatedTime()||0}getDuration(){if(!this.a||!this.a.media)return-1;const a=this.a.media.duration;return typeof a!==_.r?-1:-1===a?Infinity:a}setDrmCustomDataModifier(){}setCdnErrorCallback(){}detach(){}getPlaybackRate(){return this.a&&
|
|
37
|
+
this.a.playbackRate||0}setPlaybackRate(a){this.a&&0<a&&this.sendMessage(LP,{type:"SET_PLAYBACK_RATE",requestId:Math.round(1E3*Math.random()),mediaSessionId:this.a.mediaSessionId,playbackRate:a})}getVolume(){return this.a&&this.a.volume.level}setVolume(a){this.a&&0<=a&&1>=a&&(a=new chrome.cast.media.VolumeRequest(new chrome.cast.Volume(a)),this.a.setVolume(a))}isMuted(){return this.a&&this.a.volume.muted}setMuted(a){this.a&&(a=new chrome.cast.media.VolumeRequest(new chrome.cast.Volume(void 0,a)),this.a.setVolume(a))}getPresentationStartTime(){if(!this.a||
|
|
38
|
+
!this.a.media||!this.a.media.metadata)return null;const a=this.a.media.metadata.sectionStartAbsoluteTime;return typeof a!==_.r?null:1E-8===a?0:a}getSeekRange(){let a={start:0,end:this.getDuration()};if(this.isLive()){const b=this.a.getEstimatedLiveSeekableRange();b&&typeof b.start===_.r&&typeof b.end===_.r&&(a={start:b.start,end:b.end})}return a}getState(){return this.j?this.j.getState():_.Ls}getStats(){return this.a&&this.a.customData&&this.a.customData.stats?OP(this.a.customData.stats):_.pn()}isLive(){return Infinity===
|
|
39
|
+
this.getDuration()}load(a){const b=this;return _.w(function*(){if(b.bc())if(aQ){b.C=_.In(a);b.g=_.Ck(b.I,a);var c=b.C[b.B];yield dQ(b,{source:c,isLive:c.isLive,autoplay:b.g.autoplay,Qa:b.g,Eb:c.Eb,audioMimeType:c.audioMimeType})}else b.h.warn(CP);else b.h.warn(EP)})}getBufferInfo(){return new _.ps}getTrackManager(){return this.f}getConfiguration(){return this.g}getSurface(){return null}setNetworkEngine(a){this.K=a}getNetworkEngine(){return this.K}getSourceIndex(){return this.B}setSourceIndex(a){this.B=
|
|
40
|
+
a}getLoadedSource(){return this.C[this.B]}getPeriods(){return[]}getDrmInfo(){return null}getTimelineCues(){return[]}resetAbr(){this.h.warn(DP)}onError(a){if(a&&(this.trigger(new _.C(_.Qd,{detail:a})),this.j))this.j.onError(a)}namespace(){return _.fd}canPlay(){return this.bc()?2:0}gb(){return this.J}hc(a){this.J=hQ(a)}Kd(){this.J=null}re(a){const b=this.gb()||{};a={metadataType:fQ(b.metadataType),title:a};this.hc(Object.assign({},b,a))}pe(a){const b=this.gb()||{},c=fQ(b.metadataType);a=new chrome.cast.Image(a);
|
|
41
|
+
this.hc(Object.assign({},b,{metadataType:c,images:[a]}))}oe(a){const b=this.gb()||{};this.hc(Object.assign({},b,{metadataType:3,artist:a}))}qe(a){const b=this.gb()||{};a={metadataType:fQ(b.metadataType),releaseDate:a};this.hc(Object.assign({},b,a))}cb(a){const b=cast.framework.CastContext.getInstance(),c=a.castState===cast.framework.CastState.CONNECTED;aQ=a.castState!==cast.framework.CastState.NO_DEVICES_AVAILABLE;this.aa=c?b.getCurrentSession().getCastDevice().friendlyName:"";this.o.ve()}qb(a){this.h.debug(`state: ${a.sessionState}, details:`,
|
|
42
|
+
a);switch(a.sessionState){case cast.framework.SessionState.SESSION_STARTED:this.A=!0;kQ(this,a.session);break;case cast.framework.SessionState.SESSION_RESUMED:this.lb()||(this.A=!0,kQ(this,a.session),this.Z());break;case cast.framework.SessionState.SESSION_ENDED:if(this.lb()&&this.a){const d=this.a.media;var b=this.f.ja(),c=this.f.qa();b=b&&b.language||void 0;c=c&&c.language||void 0;this.U(this.getState(),{source:{url:d.contentId,type:d.contentType,isLive:this.isLive()},currentTime:lQ(this),zf:c,
|
|
43
|
+
Fe:b})}a.session.removeEventListener(cast.framework.SessionEventType.MEDIA_SESSION,this.W);a.session.removeMessageListener(JP,this.R);this.A=!1;this.a=null;this.H.release();this.l=this.G=null}}fb(a){this.h.debug("New media session",a.mediaSession);jQ(this,a.mediaSession)}eb(a,b){if(a===JP&&0<this.F.size){const c=OP(b);this.F.forEach(d=>d(c))}}oa(){this.trigger(new _.C(_.Ff))}Oa(a){const b=this;return _.w(function*(){let c=null;const d=yield PP(a,[_.Df,_.yc],b.K,b.g);d&&(c=new chrome.cast.media.Track(b.fa++,
|
|
44
|
+
chrome.cast.media.TrackType.TEXT),c.language=d.language,c.name=d.label||null,c.trackContentId=d.url,c.trackContentType=d.mimeType,c.customData={mimeType:a.mimeType,url:a.url});return c})}getTextDisplayer(){return null}};mQ.prototype.getTextDisplayer=mQ.prototype.getTextDisplayer;mQ.prototype.getNetworkEngine=mQ.prototype.getNetworkEngine;mQ.prototype.setNetworkEngine=mQ.prototype.setNetworkEngine;var aQ=!1,YP=new Set;window.__onGCastApiAvailable=$P;var RQ=class extends _.qs{constructor(a,b,c){super();this.f=a;this.g=b;this.j=typeof c===_.Td?c:(d,e)=>{this.f&&d!==_.un&&d!==_.Cn&&this.f.load(e)};this.a=oQ(this);this.h=new _.R(GP);this.addDelegate(this.f)}destroy(){const a=this;return _.w(function*(){a.a&&(yield bQ(a.a),a.a=null);a.removeDelegate(a.f)})}Gd(){return!!this.a&&this.a.bc()&&aQ}lb(){return!!this.a&&this.a.lb()}Rd(){return this.a?this.a.Rd():""}bd(a){this.a&&this.a.bd(a)}cast(a){const b=this;return _.w(function*(){if(b.a)try{if(yield b.a.cast(),
|
|
45
|
+
b.f&&b.a){{let d=null;const e=b.f.getLoadedSource();if(e){const f=b.f.getTrackManager(),g=f.getVideoTracks()[0];let h,k;g&&g.mimeType&&(h=g.mimeType);const l=b.f.getConfiguration(),m=f.ja();m&&(m.mimeType&&(k=m.mimeType),m.language&&(l.preferredAudioLanguage=m.language),m.roles.length&&(l.preferredAudioRole=m.roles[0]));const n=f.qa();n&&(n.language&&(l.preferredTextLanguage=n.language),n.roles.length&&(l.preferredTextRole=n.roles[0]));const q=e&&typeof e.isLive===_.Mc?e.isLive:b.f.isLive();d={source:e,
|
|
46
|
+
isLive:q,autoplay:!b.f.isPaused(),currentTime:Math.max(b.f.getPosition()-1,0),me:b.f.getPresentationStartTime(),Eb:h,audioMimeType:k,Qa:l}}var c=d}yield nQ(b);b.a&&(c&&(c.autoplay=!b.f.isPaused()),a?yield b.f.load(a):b.a.a||(yield dQ(b.a,c)))}}catch(d){b.h.error("Error while trying to cast",d),c=new _.C(_.Qd,{detail:d}),b.trigger(c)}})}Od(){this.a&&this.a.Od()}Wf(a){const b=this;return _.w(function*(){a!==b.g&&(b.g=a,b.a&&(yield bQ(b.a)),b.a=oQ(b))})}sendMessage(a){const b=this;return _.w(function*(){b.a?
|
|
47
|
+
yield b.a.sendMessage(JP,a):b.h.warn(FP)})}addMessageListener(a){this.a?this.a.addMessageListener(a):this.h.warn(FP)}removeMessageListener(a){this.a?this.a.removeMessageListener(a):this.h.warn(FP)}gb(){return this.a&&this.a.gb()}hc(a){this.a&&this.a.hc(a)}Kd(){this.a&&this.a.Kd()}re(a){this.a&&this.a.re(a)}pe(a){this.a&&this.a.pe(a)}oe(a){this.a&&this.a.oe(a)}qe(a){this.a&&this.a.qe(a)}};_.x(GP,RQ);RQ.prototype.setContentReleaseDate=RQ.prototype.qe;RQ.prototype.setContentArtist=RQ.prototype.oe;
|
|
48
|
+
RQ.prototype.setContentImage=RQ.prototype.pe;RQ.prototype.setContentTitle=RQ.prototype.re;RQ.prototype.clearContentMetadata=RQ.prototype.Kd;RQ.prototype.setContentMetadata=RQ.prototype.hc;RQ.prototype.getContentMetadata=RQ.prototype.gb;RQ.prototype.removeMessageListener=RQ.prototype.removeMessageListener;RQ.prototype.addMessageListener=RQ.prototype.addMessageListener;RQ.prototype.sendMessage=RQ.prototype.sendMessage;RQ.prototype.changeReceiverId=RQ.prototype.Wf;RQ.prototype.forceDisconnect=RQ.prototype.Od;
|
|
49
|
+
RQ.prototype.cast=RQ.prototype.cast;RQ.prototype.setPlayerConfigInterceptor=RQ.prototype.bd;RQ.prototype.getReceiverName=RQ.prototype.Rd;RQ.prototype.isCasting=RQ.prototype.lb;RQ.prototype.canCast=RQ.prototype.Gd;RQ.prototype.destroy=RQ.prototype.destroy;var SQ=class extends OQ{constructor(a){super(a,"clpp.cast.StateManager");this.I=this.U.bind(this);this.H=this.R.bind(this);this.A=this.aa.bind(this);this.w=this.Z.bind(this);this.K=this.W.bind(this);this.J=this.V.bind(this);this.M=this.fa.bind(this);this.G=this.ba.bind(this);this.F=this.T.bind(this);this.f=this.O.bind(this)}init(){const a=cast.framework.events.EventType,b=cast.framework.CastReceiverContext.getInstance().getPlayerManager();b.addEventListener(a.PLAYING,this.I);b.addEventListener(a.PAUSE,
|
|
50
|
+
this.H);b.addEventListener(a.MEDIA_FINISHED,this.A);b.addEventListener(a.BUFFERING,this.w);b.addEventListener(a.SEEKING,this.K);b.addEventListener(a.SEEKED,this.J);b.addEventListener(a.STALLED,this.M);b.addEventListener(a.PLAYER_LOADING,this.G);b.addEventListener(a.ERROR,this.F);b.addEventListener(a.BITRATE_CHANGED,this.f)}destroy(){const a=this,b=()=>Object.getPrototypeOf(Object.getPrototypeOf(this)).destroy;return _.w(function*(){const c=cast.framework.events.EventType,d=cast.framework.CastReceiverContext.getInstance().getPlayerManager();
|
|
51
|
+
d.removeEventListener(c.PLAYING,a.I);d.removeEventListener(c.PAUSE,a.H);d.removeEventListener(c.MEDIA_FINISHED,a.A);d.removeEventListener(c.BUFFERING,a.w);d.removeEventListener(c.SEEKING,a.K);d.removeEventListener(c.SEEKED,a.J);d.removeEventListener(c.STALLED,a.M);d.removeEventListener(c.PLAYER_LOADING,a.G);d.removeEventListener(c.ERROR,a.F);d.removeEventListener(c.BITRATE_CHANGED,a.f);yield b().call(a)})}U(){this.player.trigger(new _.C(_.Me));this.a(_.Fn)}R(){this.a(_.En)}aa(){this.a(_.un)}Z(a){a.isBuffering?
|
|
52
|
+
this.a(_.xn):(a=this.player.isPaused()?_.En:_.Fn,this.a(a))}W(){this.j=1;this.player.trigger(new _.C(_.Pf))}V(){this.player.trigger(new _.C(_.Of))}fa(){this.j=2}ba(){this.a(_.Dn)}O(a){const b=this.player.getStats();this.player.trigger(new _.C(_.Lc,{detail:{bandwidth:a.totalBitrate,width:b.width,height:b.height}}))}T(a){a=new _.H(_.F,7,7300,{detailedErrorCode:a.detailedErrorCode,error:a.error,reason:a.reason});this.player.trigger(new _.C(_.Qd,{detail:a}));this.a(_.Bn)}};var Z=class{constructor(a,b,c,d,e){this.a=a;this.f=b;this.j=typeof c===_.r?c:1;this.l=typeof d===_.r?d:1;this.g=typeof e===_.r?e:0}sb(){return"Google Cast Framework"}tb(){return cast.framework.VERSION}zb(){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}dc(){return!1}Ib(){return this.a.clickThroughUrl||
|
|
53
|
+
null}getMediaUrl(){return this.a.contentUrl||this.a.contentId||null}wb(){return 0}vb(){return 0}jb(){return 0}Wa(){switch(this.Jb()){case 0:return 0;case -1:return 2;default:return 1}}getPodIndex(){return this.g}Jb(){return this.f.position}Kb(){return this.j}yb(){return this.l}getWrapperAdIds(){return[]}getWrapperAdSystems(){return[]}getWrapperCreativeIds(){return[]}};Z.prototype.getWrapperCreativeIds=Z.prototype.getWrapperCreativeIds;Z.prototype.getWrapperAdSystems=Z.prototype.getWrapperAdSystems;
|
|
54
|
+
Z.prototype.getWrapperAdIds=Z.prototype.getWrapperAdIds;Z.prototype.getSequenceLength=Z.prototype.yb;Z.prototype.getPositionInSequence=Z.prototype.Kb;Z.prototype.getPodTimeOffset=Z.prototype.Jb;Z.prototype.getPodIndex=Z.prototype.getPodIndex;Z.prototype.getPodType=Z.prototype.Wa;Z.prototype.getMediaBitrate=Z.prototype.jb;Z.prototype.getMediaHeight=Z.prototype.vb;Z.prototype.getMediaWidth=Z.prototype.wb;Z.prototype.getMediaUrl=Z.prototype.getMediaUrl;Z.prototype.getClickThroughUrl=Z.prototype.Ib;
|
|
55
|
+
Z.prototype.isBumper=Z.prototype.dc;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.zb;
|
|
56
|
+
Z.prototype.getAdManagerVersion=Z.prototype.tb;Z.prototype.getAdManagerName=Z.prototype.sb;var TQ=class{constructor(a){this.a=a}getCuePoints(){return this.a.map(a=>a.position)}Lb(){return!!this.a.find(a=>0===a.position)}kb(){return!!this.a.find(a=>-1===a.position)}};TQ.prototype.hasPostroll=TQ.prototype.kb;TQ.prototype.hasPreroll=TQ.prototype.Lb;TQ.prototype.getCuePoints=TQ.prototype.getCuePoints;var UQ=class{constructor(a){this.m=a;this.a=null;this.g=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];tQ().addEventListener(this.f,
|
|
57
|
+
this.g)}load(){const a=this;return _.w(function*(){pQ&&(pQ=!1,sQ(a,0))})}start(){return _.w(function*(){tQ().play()})}resume(){-1!==this.getPosition()&&tQ().play()}pause(){-1!==this.getPosition()&&tQ().pause()}skip(){}getVolume(){return this.m.getVolume()||0}setVolume(a){this.m.setVolume(a)}getPosition(){const a=this.a&&this.a.getBreakClipCurrentTimeSec();return typeof a===_.r?a:-1}dispose(){const a=this;return _.w(function*(){tQ().removeEventListener(a.f,a.g)})}j(a){const b=cast.framework.events.EndedReason;
|
|
58
|
+
switch(a.type){case cast.framework.events.EventType.PLAYER_LOADING:this.a=tQ().getBreakManager();this.a.setPlayWatchedBreak(!0);a=this.a.getBreaks();this.m.trigger(new _.C(_.oc,{adsTimeline:new TQ(a)}));break;case cast.framework.events.EventType.BREAK_CLIP_LOADING:vQ(this,_.ec,a);break;case cast.framework.events.EventType.BREAK_STARTED:vQ(this,_.Xb,a);break;case cast.framework.events.EventType.BREAK_ENDED:vQ(this,_.Zb,a);break;case cast.framework.events.EventType.BREAK_CLIP_STARTED:vQ(this,_.kc,a);
|
|
59
|
+
break;case cast.framework.events.EventType.BREAK_CLIP_ENDED:a.endedReason===b.SKIPPED?(vQ(this,_.jc,a),vQ(this,_.lc,a)):a.endedReason===b.STOPPED?vQ(this,_.lc,a):a.endedReason===b.END_OF_STREAM?(vQ(this,_.bc,a),vQ(this,_.lc,a)):a.endedReason===b.ERROR&&sQ(this,1);break;case cast.framework.events.EventType.PLAYING:vQ(this,_.ic,a);break;case cast.framework.events.EventType.PAUSE:vQ(this,_.gc,a);break;case cast.framework.events.EventType.BUFFERING:a.isBuffering?vQ(this,_.$b,a):vQ(this,_.ic,a)}}};
|
|
60
|
+
UQ.prototype.getPosition=UQ.prototype.getPosition;UQ.prototype.setVolume=UQ.prototype.setVolume;UQ.prototype.getVolume=UQ.prototype.getVolume;UQ.prototype.skip=UQ.prototype.skip;UQ.prototype.pause=UQ.prototype.pause;UQ.prototype.resume=UQ.prototype.resume;var pQ=!1;var VQ=class{constructor(a){this.Rb=a;this.a=this.f.bind(this)}init(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().addEventListener(wQ(),this.a)}release(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().removeEventListener(wQ(),this.a)}getTimelineCues(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager().getTimedMetadata().map(a=>xQ(a))}f(a){if(a instanceof cast.framework.events.TimedMetadataEvent){var b=null;switch(a.type){case cast.framework.events.EventType.TIMED_METADATA_CHANGED:b=
|
|
61
|
+
_.bh;break;case cast.framework.events.EventType.TIMED_METADATA_ENTER:b=_.dh;break;case cast.framework.events.EventType.TIMED_METADATA_EXIT:b=_.eh}b&&this.Rb(new _.C(b,{detail:xQ(a.timedMetadataInfo)}))}else for(b of this.getTimelineCues())this.Rb(new _.C(_.bh,{detail:b}))}};var WQ=class extends _.S{constructor(){super();this.h=new _.R("clpp.cast.TrackManager");this.m=null;this.o=1E9;this.g=[];this.j=[];this.l=this.w.bind(this);this.a=this.f=null}initialize(a){this.m=a;yQ().addEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.l)}release(){this.g=[];this.j=[];this.a=this.f=null}load(){}destroy(){this.m=null;yQ().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.l)}getVideoTracks(){return[]}getAudioTracks(){return this.g}ga(){return this.j}ka(){return null}Ka(){const a=
|
|
62
|
+
this.ja();return a&&a.renditions[0]}Da(){const a=this.qa();return a&&a.renditions[0]}Va(){return null}hb(){return null}ib(){return null}Ea(){return null}ja(){let a=null;if(this.f){let b=this.f.getActiveId();typeof b===_.r&&(b=b.toString(),a=this.getAudioTracks().find(c=>c.id===b)||null)}return a}qa(){let a=null;if(this.a){let b=this.a.getActiveIds()[0];typeof b===_.r&&(b=b.toString(),a=this.ga().find(c=>c.id===b)||null)}return a}ab(){this.h.warn("Video tracks unavailable on Cast")}ta(a){a&&this.f&&
|
|
63
|
+
this.f.setActiveById(+a.id)}Ha(a){this.a&&(a?this.a.setActiveByIds([+a.id]):this.a.setActiveByIds([]))}Ra(){this.h.warn("Video renditions unavailable on Cast")}Za(a){this.ta(a&&a.track)}$a(a){this.Ha(a&&a.track)}addTextTrack(a){const b=this;return _.w(function*(){var c=b.m.getConfiguration();if((c=yield PP(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=
|
|
64
|
+
c.language;d.name=c.label;d.subtype=c.kind;d.trackContentId=c.url;d.trackContentType=c.mimeType;d.customData={mimeType:a.mimeType,url:a.url};try{b.a.addTracks([d]),AQ(b)}catch(e){throw b.h.warn("failed on track",a),e;}}})}ma(){return!0}w(){this.f=yQ().getAudioTracksManager();var a=this.f.getTracks();this.g=zQ(_.L,a);AQ(this);a=this.m.getConfiguration();BQ(this,_.L,a.preferredAudioLanguage,a.preferredAudioRole);BQ(this,_.K,a.preferredTextLanguage,a.preferredTextRole)}};WQ.prototype.isAbrEnabled=WQ.prototype.ma;
|
|
65
|
+
WQ.prototype.addTextTrack=WQ.prototype.addTextTrack;WQ.prototype.setTextRendition=WQ.prototype.$a;WQ.prototype.setAudioRendition=WQ.prototype.Za;WQ.prototype.setVideoRendition=WQ.prototype.Ra;WQ.prototype.setTextTrack=WQ.prototype.Ha;WQ.prototype.setAudioTrack=WQ.prototype.ta;WQ.prototype.setVideoTrack=WQ.prototype.ab;WQ.prototype.getTextTrack=WQ.prototype.qa;WQ.prototype.getAudioTrack=WQ.prototype.ja;WQ.prototype.getVideoTrack=WQ.prototype.Ea;WQ.prototype.getLoadingTextRendition=WQ.prototype.ib;
|
|
66
|
+
WQ.prototype.getLoadingAudioRendition=WQ.prototype.hb;WQ.prototype.getLoadingVideoRendition=WQ.prototype.Va;WQ.prototype.getTextRendition=WQ.prototype.Da;WQ.prototype.getAudioRendition=WQ.prototype.Ka;WQ.prototype.getVideoRendition=WQ.prototype.ka;WQ.prototype.getTextTracks=WQ.prototype.ga;WQ.prototype.getAudioTracks=WQ.prototype.getAudioTracks;WQ.prototype.getVideoTracks=WQ.prototype.getVideoTracks;var XQ=class extends _.qs{constructor(){super();this.h=new _.R(HP);this.g=this.w=_.Ak();this.A=null;this.l=-1;this.F=new _.Eo;this.f=this.o=this.j=this.a=this.B=null;this.C=!1}init(a,b){this.B=a;b&&(this.g=this.w=b);a=CQ();a.setMessageInterceptor(cast.framework.messages.MessageType.MEDIA_STATUS,this.H.bind(this));a.setMediaPlaybackInfoHandler(this.G.bind(this));this.a=new SQ(this);this.a.init();this.j=new WQ;this.j.initialize(this);this.o=new VQ(c=>this.trigger(c));this.o.init()}unload(){const a=
|
|
67
|
+
cast.framework.messages.PlayerState,b=CQ();b.getPlayerState()!==a.IDLE&&b.stop();this.j&&this.j.release();this.o&&this.o.release();this.f=null;return Promise.resolve()}release(){return this.unload().then(()=>{this.a&&this.a.release()})}destroy(){const a=this;return _.w(function*(){a.B=null;a.w=_.Ak();a.g=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=CQ();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot play during ads playout.");
|
|
68
|
+
a.play();return Promise.resolve()}pause(){const a=CQ();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot pause during ads playout.");a.pause();return Promise.resolve()}isPaused(){return CQ().getPlayerState()===cast.framework.messages.PlayerState.PAUSED}isEnded(){return CQ().getPlayerState()===cast.framework.messages.PlayerState.IDLE}seek(a){const b=CQ();if(null!==b.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject(zP);b.seek(a);return Promise.resolve()}getPosition(){return CQ().getCurrentTimeSec()}getDuration(){const a=
|
|
69
|
+
CQ().getDurationSec();return typeof a===_.r?-1===a?Infinity:a:-1}getPlaybackRate(){return CQ().getPlaybackRate()}setPlaybackRate(a){if(0<a){const b=new cast.framework.messages.SetPlaybackRateRequestData;b.playbackRate=a;CQ().sendLocalMediaRequest(b)}}getVolume(){return cast.framework.CastReceiverContext.getInstance().getSystemVolume().level||null}setVolume(a){0<=a&&1>=a&&cast.framework.CastReceiverContext.getInstance().setSystemVolumeLevel(a)}setMuted(a){cast.framework.CastReceiverContext.getInstance().setSystemVolumeMuted(a)}isMuted(){return cast.framework.CastReceiverContext.getInstance().getSystemVolume().muted||
|
|
70
|
+
null}getLoadedSource(){const a=CQ().getMediaInformation();if(a){var b=CQ().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,sh:b,name:c}}return null}getDrmInfo(){return null}getPresentationStartTime(){return CQ().getStartAbsoluteTime()}getSeekRange(){let a={start:0,end:this.getDuration()};if(this.isLive()){const b=CQ().getLiveSeekableRange();
|
|
71
|
+
b&&typeof b.start===_.r&&typeof b.end===_.r&&(a={start:b.start,end:b.end})}return a}getState(){return this.a?this.a.getState():_.Ls}getStats(){var a=_.pn();if(this.f){a=CQ().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.g=c;b=this.f;c=typeof a.decodedFrames===_.r?a.decodedFrames:NaN;b.l=typeof a.droppedFrames===_.r?a.droppedFrames:NaN;b.j=c;a=this.f.getStats()}return a}isLive(){return Infinity===this.getDuration()}load(a){const b=
|
|
72
|
+
this;return _.w(function*(){b.f=new _.Js;b.a.l=b.f.a;b.A=_.In(a);b.g=_.Ck(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.g.autoplay;typeof b.g.startTime===_.r&&(d.currentTime=b.g.startTime);c.type&&(d.media.contentType=c.type);d.media.contentId=c.url;d.media.customData={playerConfiguration:NP(b.g),local:!0};yield CQ().load(d)}})}getBufferInfo(){this.h.warn(_.oa);return new _.ps}getTrackManager(){return this.j}getConfiguration(){return this.g}getSurface(){return this.B}setNetworkEngine(a){this.F=
|
|
73
|
+
a}getNetworkEngine(){return this.F}getSourceIndex(){return this.l}setSourceIndex(a){this.l=a}getPeriods(){return[]}namespace(){return HP}getTimelineCues(){return this.o&&this.o.getTimelineCues()||[]}resetAbr(){this.h.warn(DP)}onError(a){a=new _.C(_.Qd,{detail:a});this.trigger(a)}canPlay(){return _.Mj()?2:0}H(a){a=Object.assign({},a);a.customData||(a.customData={});a.customData.stats=NP(this.getStats());var b=CQ(),c=a.media||b.getMediaInformation();b=b.getStartAbsoluteTime();c&&typeof b===_.r&&c.startAbsoluteTime!==
|
|
74
|
+
b&&(this.h.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=CQ().getStartAbsoluteTime();if(typeof d===_.r){b.startAbsoluteTime=d;let h;f?h=new cast.framework.messages.GenericMediaMetadata:h=b.metadata;h.sectionStartAbsoluteTime=d;b.metadata=h}b.streamType=c.LIVE;
|
|
75
|
+
a=Object.assign({},a,{media:b})}}return a}G(a,b){let c=null;a.media.customData&&(c=OP(a.media.customData.playerConfiguration));(a=c?c.abr:null)&&typeof a.defaultBandwidthEstimate===_.r?b.initialBandwidth=a.defaultBandwidthEstimate:b.initialBandwidth=void 0;FQ(c,b);return b}getTextDisplayer(){return null}setDrmCustomDataModifier(){}setCdnErrorCallback(){}detach(){}};XQ.prototype.getTextDisplayer=XQ.prototype.getTextDisplayer;XQ.prototype.getNetworkEngine=XQ.prototype.getNetworkEngine;
|
|
76
|
+
XQ.prototype.setNetworkEngine=XQ.prototype.setNetworkEngine;var HQ=class{constructor(){this.a=!1;this.h=new _.R(IP);this.f=this.m=null;this.g=new Set;this.A=this.G.bind(this);this.w=this.B.bind(this);this.j=null;this.o=new _.Er;this.l=null}init(a){a&&(this.f=new XQ,_.Mo(a,this.f),this.m=a,this.o.on(window,"unload",()=>{const b=this;return _.w(function*(){b.m&&b.m.getState()!==_.Cn&&(yield MP(b.m))})}))}start(){if(!this.a&&window.cast&&cast.framework&&cast.framework.CastReceiverContext){this.a=!0;var a=JQ(),b=JQ().getPlayerManager(),c=new cast.framework.CastReceiverOptions;
|
|
77
|
+
c.customNamespaces={};c.customNamespaces[JP]=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,
|
|
78
|
+
this.A);a.start(c);a.addCustomMessageListener(JP,this.w)}}stop(){if(this.a){this.a=!1;this.o.release();const a=JQ();JQ().getPlayerManager().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.A);a.removeCustomMessageListener(JP,this.w);a.stop();this.m=this.f=null}}bd(a){this.j=a}Tg(a){this.l=a}on(a,b){JQ().addEventListener(a,b)}off(a,b){JQ().removeEventListener(a,b)}addMessageListener(a){typeof a===_.Td&&this.g.add(a)}removeMessageListener(a){typeof a===_.Td&&this.g.delete(a)}sendMessage(a,
|
|
79
|
+
b){JQ().sendCustomMessage(JP,b,NP(a))}bc(){return this.a}gb(){var a;return a=(a=JQ().getPlayerManager().getMediaInformation())&&a.metadata?a.metadata:null}F(a){a=a.trim();if(a.startsWith("#EXTM3U"))return LQ(this,a);try{var b=(new DOMParser).parseFromString(a,_.Ef)}catch(k){return a}var c=b.getElementsByTagName("MPD")[0];if(c){a=c;this.h.debug("Detected DASH, parsing");b=JQ();c=a.getElementsByTagName("Period");for(var d=c.length-1;0<=d;--d){var e=c[d].getElementsByTagName(_.fa);for(var f=e.length-
|
|
80
|
+
1;0<=f;--f){var g=e[f].getAttribute("contentType");if(g===_.u||g===_.p){g=e[f].getAttribute(_.se);var h=e[f].getElementsByTagName(_.xb);for(let k=h.length-1;0<=k;--k){const l=h[k].getAttribute(_.se)||g,m=h[k].getAttribute(_.md);let n=h[k].getAttribute(_.kg)||void 0,q=h[k].getAttribute(_.Ud)||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(_.xb).length||c[d].removeChild(e[f])}}c[d].getElementsByTagName(_.fa).length||a.removeChild(c[d])}return a=
|
|
81
|
+
(new XMLSerializer).serializeToString(a)}if(c=b.getElementsByTagName(_.Eb)[0]){a=c;this.h.debug("Detected Smooth, parsing");b=JQ();c=a.getElementsByTagName("StreamIndex");for(d=c.length-1;0<=d;--d)if(c[d].getAttribute("Type")===_.u){e=c[d].getElementsByTagName(_.ub);for(f=e.length-1;0<=f;--f)g=e[f].getAttribute(_.eb)||void 0,h=e[f].getAttribute(_.db)||void 0,void 0!==g&&(g=+g),void 0!==h&&(h=+h),b.canDisplayType(_.Yf,void 0,g,h)||c[d].removeChild(e[f]);c[d].getElementsByTagName(_.ub).length||a.removeChild(c[d])}a=
|
|
82
|
+
(new XMLSerializer).serializeToString(a)}return a}C(a){const b=this;return _.w(function*(){let c=a;var d;c.media.customData&&(d=OP(c.media.customData.playerConfiguration));if(b.m&&d){b.j&&(d=(yield Promise.resolve(b.j(d)))||d);d.ima&&(yield rQ(c.media,d.ima,b.m.getNetworkEngine()));typeof d.startTime===_.r&&d.startTime!==c.currentTime?c.currentTime=d.startTime:d.startTime=c.currentTime||null;c.media.customData.local||(b.f.C=!0,yield _.To(b.m,d),yield _.Uo(b.m),d=b.m.getLoadedSource(),c.media.contentId=
|
|
83
|
+
d.url,c.media.contentType=d.type,d.Eb&&(c.media.hlsVideoSegmentFormat=QP(d.Eb,_.M)),d.audioMimeType&&(c.media.hlsSegmentFormat=QP(d.audioMimeType,_.L)));const e=c.media.metadata;e&&typeof e.sectionStartAbsoluteTime===_.r&&(d=e.sectionStartAbsoluteTime,e.sectionStartAbsoluteTime=0===d?1E-8:d);void 0===c.autoplay&&(c.autoplay=b.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=JQ().getPlayerManager(),
|
|
84
|
+
c=b.getLiveSeekableRange();if(c){a=c.start;c=c.end;var d=this.m.getConfiguration().startTime;typeof a!==_.r||typeof c!==_.r||typeof d!==_.r||d>=a&&d<=c||(b=b.getMediaTimeForAbsoluteTime(d),typeof b===_.r&&b>=a&&b<=c&&this.m.seek(b))}_.Wo(this.m)}}B(a){if(0<this.g.size){const b=OP(a.data);this.g.forEach(c=>c(b))}}};_.x(IP,HQ);HQ.prototype.getContentMetadata=HQ.prototype.gb;HQ.prototype.isApiReady=HQ.prototype.bc;HQ.prototype.sendMessage=HQ.prototype.sendMessage;HQ.prototype.removeMessageListener=HQ.prototype.removeMessageListener;
|
|
85
|
+
HQ.prototype.addMessageListener=HQ.prototype.addMessageListener;HQ.prototype.off=HQ.prototype.off;HQ.prototype.on=HQ.prototype.on;HQ.prototype.setLoadRequestDataInterceptor=HQ.prototype.Tg;HQ.prototype.setPlayerConfigInterceptor=HQ.prototype.bd;HQ.prototype.stop=HQ.prototype.stop;HQ.prototype.start=HQ.prototype.start;HQ.prototype.init=HQ.prototype.init;HQ.getInstance=IQ;var GQ=null;var YQ=class{constructor(a){this.f=a;this.a=null;this.g=new _.Er;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 _.w(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.g.on(b,d,c)}})}start(){return _.w(function*(){})}resume(){this.a&&
|
|
86
|
+
this.a.isPlayingBreak&&this.a.isPaused&&this.a.controller.playOrPause()}pause(){this.a&&this.a.isPlayingBreak&&!this.a.isPaused&&this.a.controller.playOrPause()}skip(){const a=this.f.a;a&&this.f.sendMessage(LP,{type:"SKIP_AD",requestId:Math.round(1E3*Math.random()),mediaSessionId:a.mediaSessionId})}getVolume(){return this.f.getVolume()||0}setVolume(a){this.f.setVolume(a)}getPosition(){let a=-1;var b=this.f.a;b&&(b=b.getEstimatedBreakClipTime(),typeof b===_.r&&(a=b));return a}dispose(){const a=this;
|
|
87
|
+
return _.w(function*(){a.g.release()})}l(a){switch(a.field){case "mediaInfo":a.value&&(a=a.value,a.breaks&&this.f.trigger(new _.C(_.oc,{adsTimeline:new TQ(a.breaks)})));break;case "isPlayingBreak":a.value?NQ(this,_.Xb):(NQ(this,_.bc),NQ(this,_.lc),NQ(this,_.Zb));break;case "currentBreakClipNumber":0<=a.value&&(0<a.value&&(NQ(this,_.bc),NQ(this,_.lc)),NQ(this,_.kc));break;case "isPaused":this.a.isPlayingBreak&&(a.value?NQ(this,_.gc):NQ(this,_.ic))}}};YQ.prototype.getPosition=YQ.prototype.getPosition;
|
|
88
|
+
YQ.prototype.setVolume=YQ.prototype.setVolume;YQ.prototype.getVolume=YQ.prototype.getVolume;YQ.prototype.skip=YQ.prototype.skip;YQ.prototype.pause=YQ.prototype.pause;YQ.prototype.resume=YQ.prototype.resume;var ZQ=class{name(){return"clpp.cast.ads.SenderAdsManagerFactory"}isSupported(a,b){return a.namespace()!==_.fd?!1:!(!b||!b.ima)}create(a){return new YQ(a.a)}};ZQ.prototype.create=ZQ.prototype.create;ZQ.prototype.isSupported=ZQ.prototype.isSupported;ZQ.prototype.name=ZQ.prototype.name;_.Xn(new ZQ);var $Q=class{name(){return"clpp.cast.ads.AdsManagerFactory"}isSupported(a,b){return IQ().bc()?!(!b||!b.ima):!1}create(a){return new UQ(a)}};$Q.prototype.create=$Q.prototype.create;$Q.prototype.isSupported=$Q.prototype.isSupported;$Q.prototype.name=$Q.prototype.name;_.Xn(new $Q);};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.h.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]=_.pa;b[Conviva.Constants.FRAMEWORK_VERSION]=_.da;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.h.debug("Current FPS",k),a.a.reportPlaybackMetric(Conviva.Constants.Playback.RENDERED_FRAMERATE,k))}}});a.C=!0;a.g=!0;a.I=!1;0<a.j.length&&(a.h.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.g=!1,a.w=null,a.B=!1,a.R=0,a.J=!1,a.j=[],a.H=0)},
|
|
14
|
-
a.h.debug("Conviva does not report when casting.")):a.h.warn("Conviva plugin is loaded but not configured. Will do nothing.")},
|
|
15
|
-
a=a.ad;this.j||(this.h.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.g&&(this.g.destroy(),this.g=null))}onPlayerWillRelease(){this.a&&(this.f.release(),this.g&&this.g.release())}id(){return"conviva"}
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var aP="Ad Error",bP="onAdBreakStarted()",cP="onAdBreakStopped()",dP=function(a){var b=_.bk();let c=Conviva.Constants.DeviceType.DESKTOP,d=Conviva.Constants.DeviceCategory.WEB;const e=b.os;b=b.osVersion.name;let f="";_.Nj()&&(f="Apple");_.Mj()?(f="Google",c=Conviva.Constants.DeviceType.SETTOP,d=Conviva.Constants.DeviceCategory.CHROMECAST):_.Oj()?(c=Conviva.Constants.DeviceType.MOBILE,/(android)/i.test(navigator.userAgent)?d=Conviva.Constants.DeviceCategory.ANDROID_DEVICE:_.Nj()&&(d=Conviva.Constants.DeviceCategory.APPLE_DEVICE)):
|
|
2
|
+
_.Gj()||_.Dj()||_.Cj("Hisense")?(c=Conviva.Constants.DeviceType.SMARTTV,d=Conviva.Constants.DeviceCategory.SMART_TV,_.Gj()?(b="",f="LG",d=Conviva.Constants.DeviceCategory.LG_TV):_.Dj()?(f="Samsung",d=Conviva.Constants.DeviceCategory.SAMSUNG_TV):_.Cj("Hisense")&&(b="",f="Hisense")):_.Cj("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},eP=function(a){return a?Conviva.Constants.StreamType.LIVE:Conviva.Constants.StreamType.VOD},fP=function(a){return 0===a?"Pre-roll":-1===a?"Post-roll":"Mid-roll"},hP=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
|
+
eP(!!d);e[Conviva.Constants.ASSET_NAME]=aP;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"]=gP(a.getId()),e["c3.ad.creativeId"]=gP(a.getCreativeId()),e["c3.ad.system"]=gP(a.getAdSystem()),e["c3.ad.mediaFileApiFramework"]=gP(a.getApiFramework()),e["c3.ad.advertiser"]=gP(a.getAdvertiserName()),e["c3.ad.position"]=fP(a.getPodIndex()),e["c3.ad.technology"]=0===a.zb()?Conviva.Constants.AdType.CLIENT_SIDE:
|
|
5
|
+
Conviva.Constants.AdType.SERVER_SIDE,e["c3.ad.adManagerName"]=gP(a.sb()),e["c3.ad.adManagerVersion"]=gP(a.tb()),e["c3.ad.advertiserCategory"]=gP(null),e["c3.ad.advertiserId"]=gP(null),e["c3.ad.breakId"]=gP(null),e["c3.ad.campaignName"]=gP(null),e["c3.ad.category"]=gP(null),e["c3.ad.classification"]=gP(null),e["c3.ad.creativeName"]=gP(null),e["c3.ad.sequence"]=gP(a.Kb()),e["c3.ad.sessionStartEvent"]=gP(null),e["c3.ad.unitName"]=gP(null),e["c3.ad.dayPart"]=gP(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"]=gP(b),e["c3.ad.firstAdSystem"]=gP(c),e["c3.ad.firstCreativeId"]=gP(a));return e},gP=function(a){return a?""+a:"NA"},lP=function(a){a.f.on(a.m,_.Xb,a.C.bind(a));a.f.on(a.m,_.Zb,a.F.bind(a));a.f.on(a.m,_.kc,a.M.bind(a));a.f.on(a.m,_.hc,a.l.bind(a));a.f.on(a.m,_.gc,a.l.bind(a));a.f.on(a.m,_.ic,a.l.bind(a));a.f.on(a.m,_.$b,a.l.bind(a));a.f.on(a.m,_.lc,a.O.bind(a));
|
|
7
|
+
a.f.on(a.m,_.jc,a.K.bind(a));a.f.on(a.m,_.ac,a.G.bind(a));a.f.on(a.m,_.dc,a.I.bind(a));a.f.on(a.m,_.ec,a.J.bind(a));a.f.on(a.m,_.cc,a.H.bind(a));a.f.on(a.m,_.fc,a.V.bind(a));a.f.on(a.m,_.mc,a.R.bind(a));a.f.on(a.m,_.Qd,b=>{var c=b.detail;if(10003===c.code&&(a.h.debug("onAdError()"),!a.g)){b=Conviva.Constants.ErrorSeverity;switch(c.data.errorType){case 0:c="Ad Load Error";break;case 1:c="Ad Play Error";break;default:c=aP}null===a.a&&iP(a,null);a.a.reportAdError(c,b.FATAL);a.g=!0;a.h.debug("Ad Playback Failure");
|
|
8
|
+
jP(a,kP,c)}})},jP=function(a,b,c=aP){if(a.a){a.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED);switch(b){case kP:a.a.reportAdFailed(c,hP(null,a.B,a.A));break;case mP:a.a.reportAdSkipped();break;default:a.a.reportAdEnded()}a.a.release();a.a=null;a.j=!1}},iP=function(a,b){if(!a.o){a.g=!1;try{if(a.a=Conviva.Analytics.buildAdAnalytics(a.U()),b){const c=hP(b,a.B,a.A,a.m.isLive()),d=String(b.tb()),e={};e[Conviva.Constants.FRAMEWORK_NAME]=b.sb();e[Conviva.Constants.FRAMEWORK_VERSION]=
|
|
9
|
+
d;a.a.setAdPlayerInfo(e);a.a.reportAdStarted(c)}}catch(c){a.h.error("Could not create ad analytics session",c)}}},nP=function(a,b){const c={};c[Conviva.Constants.LOG_LEVEL]=Conviva.Constants.LogLevel.DEBUG;b.serviceUrl&&(a.h.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(dP(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]=_.pa;b[Conviva.Constants.FRAMEWORK_VERSION]=_.da;a.a.setPlayerInfo(b)},oP=function(a){return a.m.getConfiguration().autoplay||!1},qP=function(a){if(!a.l)if(a.C)a.h.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.h.debug(a.m.getConfiguration().source);var f={},g=
|
|
11
|
+
new _.ql(b.url);b&&(f[Conviva.Constants.ASSET_NAME]=b.name||"N/A",f[Conviva.Constants.STREAM_URL]=_.Ri(g));f[Conviva.Constants.PLAYER_NAME]=c.playerName||_.pa;f[Conviva.Constants.VIEWER_ID]=d;f[Conviva.Constants.DEFAULT_RESOURCE]=e;if(c&&!_.z(c.customTags))for(const h in c.customTags)f[h]=c.customTags[h];a.a.reportPlaybackRequested(f);a.a.setCallback(()=>{a.h.debug("reportMiscellaneousMetrics()");if(pP(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.h.debug("Current FPS",k),a.a.reportPlaybackMetric(Conviva.Constants.Playback.RENDERED_FRAMERATE,k))}}});a.C=!0;a.g=!0;a.I=!1;0<a.j.length&&(a.h.debug("Report deferred events"),a.j.forEach(h=>{h.Te(h.args)}));a.j=[]}},rP=function(a){if(!a.l&&a.a){const b=eP(a.m.isLive()),c={};c[Conviva.Constants.IS_LIVE]=b;c[Conviva.Constants.DURATION]=a.m.getDuration();a.a.setContentInfo(c)}},pP=function(a){return null!==a.a&&a.C},sP=function(a){a.h.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.g=!1,a.w=null,a.B=!1,a.R=0,a.J=!1,a.j=[],a.H=0)},tP=function(a,b){var c=b.getConfiguration();a.a=!_.z(c.conviva)&&typeof c.conviva===_.ye;a.a?"undefined"===typeof window.Conviva?(a.h.warn("Conviva SDK is not loaded. Will do nothing."),a.a=!1,c=new _.H(1,9,9E3),a.T(b,c)):b.namespace()===_.fd&&(a.a=!1,
|
|
14
|
+
a.h.debug("Conviva does not report when casting.")):a.h.warn("Conviva plugin is loaded but not configured. Will do nothing.")},uP=function(a){const b=[];typeof a===_.ye&&(a.customerKey||b.push("customerKey"),a.viewerId||b.push("viewerId"));if(0<b.length)throw new _.H(1,9,9001,{missingKeys:b});};var wP=class{constructor(a,b){this.m=a;this.U=b;this.B="";this.A=_.pa;this.h=new _.R("clpp.conviva.ad");this.f=new _.Er;this.a=null;this.g=this.o=this.w=this.j=!1}initialize(a){this.h.debug("Initialize Ad Insights");this.g=this.w=!1;this.B=a.viewerId;this.A=a.playerName||_.pa;lP(this)}release(){this.h.debug("Release Ad Insights");this.w?this.h.debug(_.ia):(_.Xg(this.f),this.a&&jP(this,vP),this.f.release(),this.w=!0,this.j=this.g=!1)}destroy(){this.h.debug(_.zd);this.o?this.h.debug(_.ha):this.o=!0}C(){this.h.debug(bP)}F(){this.h.debug(cP)}M(a){this.h.debug("onAdStarted()");
|
|
15
|
+
a=a.ad;this.j||(this.h.warn("Ad load event was not triggered. This will have incidence on VSF"),iP(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.wb(),a.vb());this.a.reportAdMetric(Conviva.Constants.Playback.BITRATE,a.jb())}l(a){this.h.debug("onAdStateChanged()");if(this.a){const b=c=>{this.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,c)};switch(a.type){case _.hc:case _.ic:b(Conviva.Constants.PlayerState.PLAYING);
|
|
16
|
+
break;case _.gc:b(Conviva.Constants.PlayerState.PAUSED);break;case _.$b:b(Conviva.Constants.PlayerState.BUFFERING)}}}O(){this.h.debug("onAdStopped()");this.a&&!this.g&&jP(this,vP)}K(){this.h.debug("onAdSkipped()");this.a&&jP(this,mP)}G(){this.h.debug("onAdClicked()");this.a&&this.a.reportAdPlayerEvent("AdClicked")}I(){this.h.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.h.debug("onAdLoaded()");
|
|
17
|
+
const b=a.ad,c=()=>{this.j=!0;iP(this,b)};if(-1!==b.getPodIndex()||this.m.getPosition()>=this.m.getDuration()-5)c();else this.f.on(this.m,_.Ff,()=>{this.m.getPosition()>=this.m.getDuration()-5&&(this.f.off(this.m,_.Ff),c())})}H(){this.h.debug("onAdFirstQuartile()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_FIRST_QUARTILE)}V(){this.h.debug("onAdMidPoint()");this.a&&this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_MID_QUARTILE)}R(){this.h.debug("onAdThirdQuartile()");this.a&&
|
|
18
|
+
this.a.reportAdPlayerEvent(Conviva.Constants.Events.AD_THIRD_QUARTILE)}},mP=0,vP=1,kP=2;var xP=class{constructor(a,b){this.m=a;this.f=new _.Er;this.a=null;this.o=!1;this.G=!0;this.B=this.g=this.A=this.C=this.l=!1;this.R=0;this.J=!1;this.w=null;this.I=!1;this.h=b;this.K=this.F=null;this.j=[];this.H=0}initialize(a,b,c){this.l||(this.h.debug("Initialize conviva"),this.G=!1,this.F=_.yg(b),this.K=c,this.m=a,nP(this,this.F),this.f.on(this.m,_.Me,this.oa.bind(this)),this.f.on(this.m,_.vf,this.aa.bind(this)),this.f.on(this.m,_.Lc,this.M.bind(this)),this.f.on(this.m,_.Pf,this.Z.bind(this)),this.f.on(this.m,
|
|
19
|
+
_.Of,this.W.bind(this)),this.f.on(this.m,_.Xb,this.U.bind(this)),this.f.on(this.m,_.Zb,this.V.bind(this)),this.f.on(this.m,_.oc,this.ba.bind(this)),this.f.on(this.m,_.Kc,this.fa.bind(this)),this.f.on(this.m,_.Qd,this.O.bind(this)),oP(this)&&(this.h.debug("Start a new session: A new video starts in autoplay."),qP(this)))}release(){this.h.debug("Release conviva");this.G?this.h.debug(_.ia):(_.Xg(this.f),pP(this)||this.o||!oP(this)||this.a&&this.a.reportPlaybackFailed("Exit Before Video Start"),pP(this)&&
|
|
20
|
+
sP(this),this.a=null,this.G=!0)}destroy(){this.h.debug(_.zd);this.l?this.h.debug(_.ha):this.l=!0}reportAppEvent(a,b){let c=!1;try{Conviva.Analytics.reportAppEvent(a,b),c=!0}catch(d){this.h.debug("Report app event error",d),c=!1}return c}oa(){this.h.debug("onPlayRequest()");pP(this)||oP(this)?pP(this)&&this.A&&!this.g&&(this.h.debug("Resuming VST monitoring ..."),pP(this)&&!this.g&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_ENDED),this.g=!0),this.A=!1):(this.h.debug("Creating conviva session. On Play Requested / No autoplay"),
|
|
21
|
+
qP(this))}aa(a){this.h.debug(_.De);const b=c=>{if(this.o&&(this.h.debug("Creating conviva session (On Seek / Replay)"),nP(this,this.F),qP(this),rP(this),pP(this))){var d=this.m.getTrackManager();d=d.ka()||d.Va();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)}pP(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,c)};switch(a.detail.currentState){case _.Fn:b(Conviva.Constants.PlayerState.PLAYING);
|
|
22
|
+
break;case _.En:b(Conviva.Constants.PlayerState.PAUSED);break;case _.xn:b(Conviva.Constants.PlayerState.BUFFERING);break;case _.un:this.h.debug("onVideoEnded()"),pP(this)&&(this.w&&this.w.kb()?(this.h.debug("Waiting for postroll Ad before terminating session"),this.J=!0):sP(this))}}M(a){this.h.debug(_.ze);if(pP(this)){if(a=a.detail,typeof a.width===_.r&&typeof a.height===_.r&&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({Te:this.M.bind(this),args:a})}Z(){this.h.debug("onSeeking()");pP(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)}W(){this.h.debug("onSeeked()");pP(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_ENDED)}ba(a){this.h.debug("onAdsTimelineChanged()");if(a=a.adsTimeline)this.w=a}U(a){this.h.debug(bP);
|
|
24
|
+
var b=a.ad;a=0===b.Wa();const c=fP(b.getPodIndex());pP(this)||oP(this)||!a||qP(this);if(pP(this)){a=0===b.zb()?Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE;let d=0;const e={};1===b.yb()&&(d=b.getDuration());e[Conviva.Constants.POD_DURATION]=d;e[Conviva.Constants.POD_INDEX]=++this.R;e[Conviva.Constants.POD_POSITION]=c;b=Conviva.Constants.AdPlayer;b=a!==Conviva.Constants.AdType.CLIENT_SIDE||_.Mj()?b.CONTENT:b.SEPARATE;this.a.reportAdBreakStarted(a,b,e);this.B=!0}else this.h.debug("Bug: should already have a valid session")}V(){this.h.debug(cP);
|
|
25
|
+
pP(this)&&this.B&&(this.a.reportAdBreakEnded(),this.B=!1,this.J&&sP(this))}O(a){this.h.debug(_.Ae);if(this.o&&this.I)this.h.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,pP(this)||qP(this));pP(this)?(this.h.debug("Report error",c,d),this.a.reportPlaybackError(c,d),d===Conviva.Constants.ErrorSeverity.FATAL&&(this.h.debug("Video Playback Failure"),
|
|
26
|
+
this.I=!0,sP(this))):this.j.push({Te:this.O.bind(this),args:a})}}fa(){this.h.debug("onAutoPlayBlocked()");pP(this)&&(this.h.debug("Auto-play blocked. Pausing VST monitoring."),this.A=!0,pP(this)&&this.g&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_STARTED),this.g=!1))}};var yP=class{constructor(){this.g=this.f=null;this.a=!1;this.h=new _.R("clpp.conviva")}onPlayerCreated(a){this.f=new xP(a,this.h)}onContentWillLoad(a,b){tP(this,a);if(this.a){var c=a.getConfiguration();c=_.yg(c.conviva||{});try{uP(c);const d=c.enableAdInsights||!1;this.f.initialize(a,c,b);d&&(this.g=new wP(a,()=>this.f.a),this.g.initialize(c))}catch(d){d instanceof _.H?this.T(a,d):this.T(a,new _.H(1,9,9002,d,d))}}}onContentLoaded(){this.a&&rP(this.f)}onPlayerWillDestroy(){this.a&&(this.a=!1,this.f.destroy(),
|
|
27
|
+
this.f=null,this.g&&(this.g.destroy(),this.g=null))}onPlayerWillRelease(){this.a&&(this.f.release(),this.g&&this.g.release())}id(){return"conviva"}T(a,b){a.trigger(new _.C(_.Qd,{detail:b}))}reportAppEvent(a,b){return this.f?this.f.reportAppEvent(a,b):!1}};_.x("clpp.conviva.ConvivaPlugin",yP);yP.prototype.reportAppEvent=yP.prototype.reportAppEvent;yP.Id="conviva";_.Ho(new class{create(){return new yP}});};f.call(g, window);
|