@castlabs/prestoplay 6.10.0 → 6.11.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 +27 -0
- package/cjs/cl.adobe.js +3 -3
- package/cjs/cl.airplay.js +3 -3
- package/cjs/cl.broadpeak.js +6 -6
- package/cjs/cl.cast.js +112 -112
- package/cjs/cl.conviva.js +33 -33
- package/cjs/cl.core.js +467 -435
- package/cjs/cl.crypto.js +9 -10
- package/cjs/cl.dash.js +72 -72
- package/cjs/cl.externs.js +132 -33
- package/cjs/cl.freewheel.js +24 -24
- package/cjs/cl.hls.js +78 -74
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +29 -29
- package/cjs/cl.ima.js +24 -24
- package/cjs/cl.mse.js +274 -274
- package/cjs/cl.muxdata.js +14 -14
- package/cjs/cl.onboard.js +3 -3
- package/cjs/cl.persistent.js +14 -14
- package/cjs/cl.playlist.js +6 -6
- package/cjs/cl.smooth.js +71 -71
- package/cjs/cl.thumbnails.js +24 -24
- package/cjs/cl.tizen.js +71 -71
- package/cjs/cl.ttml.js +29 -27
- package/cjs/cl.verimatrix.js +5 -5
- package/cjs/cl.vimond.js +13 -13
- package/cjs/cl.vr.js +19 -19
- package/cjs/cl.vtt.js +14 -14
- package/cjs/cl.youbora.js +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 +395 -368
- package/cl.crypto.js +9 -9
- package/cl.dash.js +67 -66
- package/cl.externs.js +128 -33
- package/cl.freewheel.js +19 -19
- package/cl.hls.js +64 -61
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +26 -26
- package/cl.ima.js +17 -17
- package/cl.mse.js +238 -239
- package/cl.muxdata.js +12 -12
- package/cl.onboard.js +4 -4
- package/cl.persistent.js +11 -11
- package/cl.playlist.js +5 -5
- package/cl.smooth.js +59 -59
- package/cl.thumbnails.js +17 -17
- package/cl.tizen.js +57 -57
- package/cl.ttml.js +22 -22
- package/cl.verimatrix.js +4 -4
- package/cl.vimond.js +8 -8
- package/cl.vr.js +14 -14
- package/cl.vtt.js +12 -12
- package/cl.youbora.js +15 -15
- package/clpp.styles.css +15 -0
- package/package.json +1 -1
- package/typings.d.ts +202 -19
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.N);b.removeEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.ba)}b=[];a.f&&(b.push(a.f.destroy()),a.f=null);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.
|
|
27
|
-
this.C};this.C=b;this.
|
|
28
|
-
this.w&&!this.w.isPlayingBreak)switch(this.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
52
|
-
this.a(_.
|
|
53
|
-
null}getMediaUrl(){return this.a.contentUrl||this.a.contentId||null}sb(){return 0}rb(){return 0}gb(){return 0}
|
|
54
|
-
Z.prototype.getWrapperAdIds=Z.prototype.getWrapperAdIds;Z.prototype.getSequenceLength=Z.prototype.ub;Z.prototype.getPositionInSequence=Z.prototype.
|
|
55
|
-
Z.prototype.isBumper=Z.prototype
|
|
56
|
-
Z.prototype.getAdManagerVersion=Z.prototype.qb;Z.prototype.getAdManagerName=Z.prototype.pb;var
|
|
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.
|
|
74
|
-
b&&(this.
|
|
75
|
-
a=Object.assign({},a,{media:b})}}return a}G(a,b){let c=null;a.media.customData&&(c=
|
|
76
|
-
|
|
77
|
-
c.customNamespaces={};c.customNamespaces[
|
|
78
|
-
this.A);a.start(c);a.addCustomMessageListener(
|
|
79
|
-
b){
|
|
80
|
-
1;0<=f;--f){var g=e[f].getAttribute("contentType");if(g===_.w||g===_.p){g=e[f].getAttribute(_.
|
|
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.Bb&&(c.media.hlsVideoSegmentFormat=
|
|
84
|
-
c=b.getLiveSeekableRange();if(c){a=c.start;c=c.end;var d=this.
|
|
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 OM="Cannot seek during ads playout.",PM="Cannot switch track",QM="Media session does not exist.",RM="No receivers available",SM="Reset ABR functionality not available on cast.",TM="SDK not yet ready",UM="Sender is destroyed.",VM="clpp.cast.CastProxy",WM="clpp.cast.Player",XM="clpp.cast.Receiver",YM="urn:x-cast:castlabs",$M="urn:x-cast:com.google.cast.media",aN=function(a){return _.x(function*(){yield _.In(a,_.Sd);yield _.In(a,_.Rd)})},bN=function(a){return JSON.stringify(a,(b,c)=>
|
|
2
|
+
{if("license"!==b&&typeof c!==_.od){if(c instanceof Event){b={};for(const d in c){const e=c[d];typeof e===_.Od?"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}})},cN=function(a){if(typeof a!==_.Je)return a;try{return JSON.parse(a,(b,c)=>"NaN"===c?NaN:"-Infinity"===c?-Infinity:"Infinity"===c?Infinity:c)}catch(b){return a}},dN=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=_.ti(d,a.mimeType,g);f&&g&&(h=_.Kh(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})},eN=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 _.ff:return d.FMP4;case _.ef:return b===_.M?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}},gN=function(a){a=void 0===a?fN: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}},hN=function(a,b){return a.g.filter(c=>c.type===b)},jN=function(a,b){const c=iN(a);return hN(a,b).find(d=>c.includes(d.id))||null},lN=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.pa();e&&c.push(+e.id)}c=new chrome.cast.media.EditTracksInfoRequest(c);
|
|
6
|
+
d.editTracksInfo(c,()=>{a.f[b]=null;kN(a,b)},e=>{a.f[b]=null;a.h.debug(PM,e)})}else b===_.K&&(c=new chrome.cast.media.EditTracksInfoRequest([]),d.editTracksInfo(c,()=>{kN(a,b)},e=>{a.h.debug(PM,e)}))},iN=function(a){return(a=a.a?a.a.a:null)?a.activeTrackIds.map(b=>b.toString()):[]},kN=function(a,b){b===_.L?a.a.trigger(new _.F(_.qj)):b===_.K&&a.a.trigger(new _.F(_.rj))},oN=function(a){if(a)for(const b of mN)nN(b)},nN=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.ne();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.N);b.addEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.ba);pN&&a.o.ca(.02)}},qN=function(a){return _.x(function*(){mN.delete(a);if(a.w){a.w=!1;var b=
|
|
8
|
+
cast.framework.CastContext.getInstance();b.removeEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,a.N);b.removeEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,a.ba)}b=[];a.f&&(b.push(a.f.destroy()),a.f=null);a.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.Y=null})},rN=function(a){return _.x(function*(){a.ib()||(yield cast.framework.CastContext.getInstance().requestSession())})},tN=function(a,b,c){c=
|
|
9
|
+
void 0===c?0:c;return _.x(function*(){var d=a.f.pa();d&&d.language&&(a.g.preferredTextLanguage=d.language);(d=a.f.oa())&&d.language&&(a.g.preferredAudioLanguage=d.language);yield sN(a,{source:a.getLoadedSource(),currentTime:c,isLive:a.isLive(),de:a.getPresentationStartTime(),autoplay:b,Oa:a.g})})},sN=function(a,b){return _.x(function*(){var c=chrome.cast.media.StreamType;yield rN(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=eN(b.Bb,_.M);e.hlsSegmentFormat=eN(c,_.L);b.Oa&&(a.M&&(c=yield Promise.resolve(a.M(b.Oa)))&&(b.Oa=c),a.g=b.Oa,a.C=_.Gm(a.g),a.B=a.C.findIndex(k=>k.url===b.source.url),b.Oa.remoteTextTracks&&(c=yield Promise.all(b.Oa.remoteTextTracks.map(a.Na.bind(a))),e.tracks=c.filter(k=>k),b.Oa.remoteTextTracks=void 0),delete b.Oa.autoplay,b.Oa.startTime=null,e.customData={playerConfiguration:bN(b.Oa)});c=a.cb()||{};
|
|
11
|
+
var f=uN(c.metadataType),g;typeof b.de===_.r&&(g={metadataType:f,sectionStartAbsoluteTime:b.de});var h;b.source.name&&(h={metadataType:f,title:b.source.name});c=vN(c);if(g=wN(Object.assign({},g,h,c)))e.metadata=g;e=new chrome.cast.media.LoadRequest(e);typeof b.autoplay===_.nc&&(e.autoplay=b.autoplay);typeof b.currentTime===_.r&&(e.currentTime=b.currentTime);yield d.loadMedia(e)}})},wN=function(a){if(!a)return null;a:{var b=a.metadataType;const c=Object.entries(xN);for(const d of c){const [e,f]=d;
|
|
12
|
+
if(f===b){b=e;break a}}b=null}if(!b)return null;b=gN(xN[b]);return Object.assign(b,a)},uN=function(a){var b=void 0===b?fN:b;return Object.values(xN).includes(a)?a:b},vN=function(a){const b={};for(const c in a)void 0!==a[c]&&(b[c]=a[c]);return b},zN=function(a,b){yN(a,b.getMediaSession());b.addEventListener(cast.framework.SessionEventType.MEDIA_SESSION,a.W);b.addMessageListener(YM,a.R)},AN=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},yN=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.na.bind(a)),a.f&&a.f.load(),a.j&&a.j.init(),a.trigger(new _.F(_.Bd)))},DN=function(a){return new BN(a.g,()=>{a.trigger(new _.F(_.wc))},(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.we&&(d.preferredAudioLanguage=c.we);c.jf&&(d.preferredTextLanguage=c.jf);_.Kn(a.f,null);a.trigger(new _.F("castingended"));a.j(b,d)}},()=>CN(a))},CN=function(a){return _.x(function*(){a.trigger(new _.F(_.vc));a.f.a!==a.a&&a.f&&a.a&&(yield a.f.release(),_.Kn(a.f,a.a))})},GN=function(a,b,c){return _.x(function*(){var d=b.adTagUrl;if(d)try{EN=!1;const e=_.Kh(d),f=yield c.fetch(e).P;if(f&&f.data){const g=_.gh(f.data),h=(new DOMParser).parseFromString(g,
|
|
15
|
+
_.Re);if(h.getElementsByTagName("vmap:VMAP").length)_.C("VMAP detected."),a.vmapAdsRequest=FN(g);else if(h.getElementsByTagName("VAST").length){_.C("VAST detected.");{d=g;const k=new cast.framework.messages.BreakClip("bc1");k.vastAdsRequest=FN(d);const l=new cast.framework.messages.Break("b1",[k.id],0);a.breakClips=[k];a.breaks=[l]}}else _.C("Unsupported schema."),EN=!0}}catch(e){_.C("Failed to fetch an ad",e),EN=!0}})},FN=function(a){const b=new cast.framework.messages.VastAdsRequest;b.adsResponse=
|
|
16
|
+
a;return b},HN=function(a,b){b=new _.H(1,10,10003,{errorType:b});a.m.onError(b)},IN=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},KN=function(a,b,c){if(c instanceof cast.framework.events.BreaksEvent||-1!==a.getPosition()){var d=null;(c=JN(a,c))&&(d={ad:c});a.m.trigger(new _.F(b,d))}},JN=function(a,b){let c=null;if(a.a&&b instanceof cast.framework.events.BreaksEvent){let d=null,e=null,f;typeof b.breakClipId===_.Je&&(d=a.a.getBreakClipById(b.breakClipId));typeof b.breakId===
|
|
17
|
+
_.Je&&(e=a.a.getBreakById(b.breakId),!e&&d&&(e=a.a.getBreaks().find(g=>g.breakClipIds.includes(d.id))||null),e&&(f=a.a.getBreaks().filter(g=>0<=g.position).sort((g,h)=>g.position-h.position).findIndex(g=>g===e)));c=new Z(d,e,b.index,b.total,f)}return c},LN=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]},MN=function(a){const b=
|
|
18
|
+
a.dashTimedMetadata;let c=_.Ze;b&&(c=b.schemeIdUri);return{type:c.startsWith(_.Ye)?_.ng:_.lg,schemeIdUri:c,id:a.id||"",startTime:a.startTime,endTime:a.endTime,value:b&&b.value||"",eventElement:b&&b.eventElement}},NN=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},PN=function(a){a.a=NN().getTextTracksManager();const b=a.a.getTracks();a.j=ON(_.K,b)},ON=function(a,b){const c=[];for(const d of b)b=new _.Zh(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 _.gi(b.id,b)),c.push(b);return c},QN=function(a,b,c,d){c=_.ug(c).filter(g=>g);var e=!1;let f=[];b===_.L?f=a.getAudioTracks():b===_.K&&(f=a.ja());if(c=c.find(g=>{const h=_.Sg(g);return f.some(k=>{k=_.Sg(k.language||"");return _.Tg(h,k)})})){const g=
|
|
20
|
+
_.Sg(c);c=f.filter(h=>{h=_.Sg(h.language||"");return _.Tg(g,h)});f=c.length?c:f;e=e||!!c.length}_.ph(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.sa(e):b===_.K&&a.Ea(e))},RN=function(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager()},UN=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=_.Xj(d);if(e){var f=[_.Qc];_.Gm(a)[0].type!==_.ec&&f.unshift(_.Sc);d.preferredDrmSystem===_.Qc&&f.reverse();for(var g,h;f.length&&!h;)g=f.shift(),h=e.Pa[g];h?(c=g===_.Sc?cast.framework.ContentProtection.WIDEVINE:g===_.Qc?cast.framework.ContentProtection.PLAYREADY:void 0,b.protectionSystem=c,b.licenseUrl=h.licenseUrl,c={ldlDelay:0,customData:{}},SN(b,h,a,c),TN(b,h,a,c)):c()}else c()}else c()},SN=function(a,b,c,d){b.modifiers.licenseRequest?a.licenseRequestHandler=e=>{const f=
|
|
22
|
+
_.Kh({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},TN=function(a,b,c,d){b.modifiers.licenseResponse?a.licenseHandler=(e,f)=>_.x(function*(){const g=_.Lh(Object.assign({},f.headers),e.buffer,200,"");yield b.modifiers.licenseResponse(c,g,d);return _.J(g.data)}):
|
|
23
|
+
a.licenseHandler=void 0},XN=function(){return VN||(VN=new WN)},YN=function(){return cast.framework.CastReceiverContext.getInstance()},$N=function(a,b){a.h.debug("Detected HLS, parsing");var c=cast.framework.messages.HlsVideoSegmentFormat;a=YN();var {hlsVideoSegmentFormat:d}=YN().getPlayerManager().getMediaInformation()||{};c=d===c.FMP4?_.ff:_.ef;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
|
+
ZN(f,_.la),h=ZN(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")},ZN=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},bO=function(a,b){let c=null;const d=aO(a);d&&(c={ad:d});a.f.trigger(new _.F(b,c))},aO=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},cO=class{constructor(a,b){this.log=new _.R(b);this.player=a;this.l=null;this.g=_.Am;this.o=_.Aq;this.j=2;this.C=Date.now();this.B=-1}release(){this.a(_.Am)}destroy(){this.l=
|
|
26
|
+
this.player=null;return Promise.resolve()}getState(){return this.g}onError(a){a.severity===_.G&&this.a(_.zm)}a(a){if(a!==this.g)if(this.g===_.zm&&a!==_.Am)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===_.vm?(this.B=b,this.player.trigger(new _.F(_.sc,{detail:{bufferedTimeMS:-1,reason:this.j}}))):this.o===_.vm&&this.player.trigger(new _.F(_.oc,{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&&_.jm(this.l,this.g);this.player.trigger(new _.F(_.Ge,{detail:a}))}}};_.z("clpp.cast.CastUtils",class{});var fN=0,xN={GENERIC:fN,MOVIE:1,TV_SHOW:2,MUSIC_TRACK:3,PHOTO:4,AUDIOBOOK_CHAPTER:5};var dO=class extends cO{constructor(a){super(a,"clpp.cast.SenderStateManager");this.w=this.f=null;this.A=this.yb.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)}yb(){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(_.sm);break;case chrome.cast.media.IdleReason.ERROR:this.a(_.zm);break;default:this.a(_.Am)}break;case chrome.cast.media.PlayerState.PLAYING:this.a(_.Dm);break;case chrome.cast.media.PlayerState.PAUSED:this.a(_.Cm);break;case chrome.cast.media.PlayerState.BUFFERING:this.a(_.vm)}}};var eO=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 _.Zh(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 _.gi(c.id,c));return c}):[],this.a.trigger(new _.F(_.bq)))}destroy(){this.a=null}getVideoTracks(){return hN(this,_.M)}getAudioTracks(){return hN(this,_.L)}ja(){return hN(this,_.K)}ia(){const a=this.Ka();return a?a.renditions[0]:null}Ha(){const a=this.oa();return a?a.renditions[0]:null}Ia(){const a=this.pa();return a?a.renditions[0]:
|
|
30
|
+
null}Sa(){return this.f[_.M]||null}eb(){return this.f[_.L]||null}fb(){return this.f[_.K]||null}Ka(){return jN(this,_.M)}oa(){return jN(this,_.L)}pa(){return jN(this,_.K)}Xa(a){lN(this,_.M,a)}sa(a){lN(this,_.L,a)}Ea(a){lN(this,_.K,a)}Wa(a){this.Xa(a&&a.track)}kb(a){this.sa(a&&a.track)}lb(a){this.Ea(a&&a.track)}addTextTrack(){return _.x(function*(){})}la(){return!0}};eO.prototype.isAbrEnabled=eO.prototype.la;eO.prototype.addTextTrack=eO.prototype.addTextTrack;eO.prototype.setTextRendition=eO.prototype.lb;
|
|
31
|
+
eO.prototype.setAudioRendition=eO.prototype.kb;eO.prototype.setVideoRendition=eO.prototype.Wa;eO.prototype.setTextTrack=eO.prototype.Ea;eO.prototype.setAudioTrack=eO.prototype.sa;eO.prototype.setVideoTrack=eO.prototype.Xa;eO.prototype.getTextTrack=eO.prototype.pa;eO.prototype.getAudioTrack=eO.prototype.oa;eO.prototype.getVideoTrack=eO.prototype.Ka;eO.prototype.getLoadingTextRendition=eO.prototype.fb;eO.prototype.getLoadingAudioRendition=eO.prototype.eb;eO.prototype.getLoadingVideoRendition=eO.prototype.Sa;
|
|
32
|
+
eO.prototype.getTextRendition=eO.prototype.Ia;eO.prototype.getAudioRendition=eO.prototype.Ha;eO.prototype.getVideoRendition=eO.prototype.ia;eO.prototype.getTextTracks=eO.prototype.ja;eO.prototype.getAudioTracks=eO.prototype.getAudioTracks;eO.prototype.getVideoTracks=eO.prototype.getVideoTracks;var BN=class extends _.dq{constructor(a,b,c,d){super();this.h=new _.R(_.Gc);this.V=a;this.o=new _.zi(b);this.S=c;this.Y=d;this.g=this.I=_.Bj();this.C=[];this.B=0;this.K=new _.Bn;this.G=this.l=this.a=null;this.A=this.w=!1;this.aa="";this.fa=1E6;this.f=new eO;this.f.initialize(this);this.j=new dO(this);this.H=new _.vp;this.J=null;this.F=new Set;this.N=this.Za.bind(this);this.ba=this.bb.bind(this);this.W=this.ab.bind(this);this.R=this.$a.bind(this);this.M=null;window.cast||Object.defineProperty(window,
|
|
33
|
+
"cast",{get:()=>window.cast_,set:e=>{window.cast_=e;window.setTimeout(()=>{oN(!0)},0)}});nN(this);mN.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 _.x(function*(){})}Rc(a){this.M=a}Zb(){return this.w}ib(){return this.A}Jd(){return this.aa}sendMessage(a,b){const c=this;return _.x(function*(){let d;const e=cast.framework.CastContext.getInstance().getCurrentSession();
|
|
34
|
+
if(e)try{yield e.sendMessage(a,bN(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.Zb())throw a.h.warn(TM),new _.H(1,8,8001,void 0);if(!pN)throw a.h.warn(RM),new _.H(1,8,8002,void 0);if(a.ib())throw a.h.warn("Already casting"),new _.H(1,8,8003,void 0);try{yield rN(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);}})}Fd(){this.ib()&&cast.framework.CastContext.getInstance().endCurrentSession(!0)}addMessageListener(a){typeof a===_.od&&this.F.add(a)}removeMessageListener(a){typeof a===_.od&&this.F.delete(a)}play(){return this.isEnded()?tN(this,!0):new Promise((a,b)=>{if(!this.a)return b(QM);this.a.play(null,a,b)})}pause(){return new Promise((a,b)=>{this.isEnded()&&a();if(!this.a)return b(QM);this.a.pause(null,a,b)})}isPaused(){return!!this.a&&this.a.playerState===chrome.cast.media.PlayerState.PAUSED}isEnded(){return this.getState()===
|
|
36
|
+
_.sm}seek(a){return this.isEnded()?tN(this,!1,a):new Promise((b,c)=>{this.a||c(QM);this.l.isPlayingBreak&&c(OM);const d=new chrome.cast.media.SeekRequest;d.currentTime=a;this.trigger(new _.F(_.af));this.a.seek(d,()=>{this.trigger(new _.F(_.$e));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($M,{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():_.Aq}getStats(){return this.a&&this.a.customData&&this.a.customData.stats?cN(this.a.customData.stats):_.nm()}isLive(){return Infinity===
|
|
39
|
+
this.getDuration()}load(a){const b=this;return _.x(function*(){if(b.Zb())if(pN){b.C=_.Gm(a);_.Ej(a)&&(b.g=_.Dj(b.I,a));var c=b.C[b.B];yield sN(b,{source:c,isLive:c.isLive,autoplay:b.g.autoplay,Oa:b.g,Bb:c.Bb,audioMimeType:c.audioMimeType})}else b.h.warn(RM);else b.h.warn(TM)})}getBufferInfo(){return new _.cq}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(SM)}onError(a){if(a&&(this.trigger(new _.F(_.ld,{detail:a})),this.j))this.j.onError(a)}namespace(){return _.Gc}canPlay(){return this.Zb()?2:0}cb(){return this.J}dc(a){this.J=wN(a)}Bd(){this.J=null}je(a){const b=this.cb()||{};a={metadataType:uN(b.metadataType),title:a};this.dc(Object.assign({},b,a))}ge(a){const b=this.cb()||{},c=uN(b.metadataType);a=new chrome.cast.Image(a);
|
|
41
|
+
this.dc(Object.assign({},b,{metadataType:c,images:[a]}))}fe(a){const b=this.cb()||{};this.dc(Object.assign({},b,{metadataType:3,artist:a}))}he(a){const b=this.cb()||{};a={metadataType:uN(b.metadataType),releaseDate:a};this.dc(Object.assign({},b,a))}Za(a){const b=cast.framework.CastContext.getInstance(),c=a.castState===cast.framework.CastState.CONNECTED;pN=a.castState!==cast.framework.CastState.NO_DEVICES_AVAILABLE;this.aa=c?b.getCurrentSession().getCastDevice().friendlyName:"";this.o.ne()}bb(a){this.h.debug(`state: ${a.sessionState}, details:`,
|
|
42
|
+
a);switch(a.sessionState){case cast.framework.SessionState.SESSION_STARTED:this.A=!0;zN(this,a.session);break;case cast.framework.SessionState.SESSION_RESUMED:this.ib()||(this.A=!0,zN(this,a.session),this.Y());break;case cast.framework.SessionState.SESSION_ENDED:if(this.ib()&&this.a){const d=this.a.media;var b=this.f.oa(),c=this.f.pa();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:AN(this),jf:c,
|
|
43
|
+
we:b})}a.session.removeEventListener(cast.framework.SessionEventType.MEDIA_SESSION,this.W);a.session.removeMessageListener(YM,this.R);this.A=!1;this.a=null;this.H.release();this.l=this.G=null}}ab(a){this.h.debug("New media session",a.mediaSession);yN(this,a.mediaSession)}$a(a,b){if(a===YM&&0<this.F.size){const c=cN(b);this.F.forEach(d=>d(c))}}na(){this.trigger(new _.F(_.Se))}Na(a){const b=this;return _.x(function*(){let c=null;const d=yield dN(a,[_.Qe,_.dc],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}};BN.prototype.getTextDisplayer=BN.prototype.getTextDisplayer;BN.prototype.getNetworkEngine=BN.prototype.getNetworkEngine;BN.prototype.setNetworkEngine=BN.prototype.setNetworkEngine;var pN=!1,mN=new Set;window.__onGCastApiAvailable=oN;var fO=class extends _.dq{constructor(a,b,c){super();this.f=a;this.g=b;this.j=typeof c===_.od?c:(d,e)=>{this.f&&d!==_.sm&&d!==_.Am&&this.f.load(e)};this.a=DN(this);this.h=new _.R(VM);this.addDelegate(this.f)}destroy(){const a=this;return _.x(function*(){a.a&&(yield qN(a.a),a.a=null);a.removeDelegate(a.f)})}xd(){return!!this.a&&this.a.Zb()&&pN}ib(){return!!this.a&&this.a.ib()}Jd(){return this.a?this.a.Jd():""}Rc(a){this.a&&this.a.Rc(a)}cast(a){const b=this;return _.x(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.oa();m&&(m.mimeType&&(k=m.mimeType),m.language&&(l.preferredAudioLanguage=m.language),m.roles.length&&(l.preferredAudioRole=m.roles[0]));const n=f.pa();n&&(n.language&&(l.preferredTextLanguage=n.language),n.roles.length&&(l.preferredTextRole=n.roles[0]));const q=e&&typeof e.isLive===_.nc?e.isLive:b.f.isLive();d={source:e,
|
|
46
|
+
isLive:q,autoplay:!b.f.isPaused(),currentTime:Math.max(b.f.getPosition()-1,0),de:b.f.getPresentationStartTime(),Bb:h,audioMimeType:k,Oa:l}}var c=d}yield CN(b);b.a&&(c&&(c.autoplay=!b.f.isPaused()),a?yield b.f.load(a):b.a.a||(yield sN(b.a,c)))}}catch(d){b.h.error("Error while trying to cast",d),c=new _.F(_.ld,{detail:d}),b.trigger(c)}})}Fd(){this.a&&this.a.Fd()}If(a){const b=this;return _.x(function*(){a!==b.g&&(b.g=a,b.a&&(yield qN(b.a)),b.a=DN(b))})}sendMessage(a){const b=this;return _.x(function*(){b.a?
|
|
47
|
+
yield b.a.sendMessage(YM,a):b.h.warn(UM)})}addMessageListener(a){this.a?this.a.addMessageListener(a):this.h.warn(UM)}removeMessageListener(a){this.a?this.a.removeMessageListener(a):this.h.warn(UM)}cb(){return this.a&&this.a.cb()}dc(a){this.a&&this.a.dc(a)}Bd(){this.a&&this.a.Bd()}je(a){this.a&&this.a.je(a)}ge(a){this.a&&this.a.ge(a)}fe(a){this.a&&this.a.fe(a)}he(a){this.a&&this.a.he(a)}};_.z(VM,fO);fO.prototype.setContentReleaseDate=fO.prototype.he;fO.prototype.setContentArtist=fO.prototype.fe;
|
|
48
|
+
fO.prototype.setContentImage=fO.prototype.ge;fO.prototype.setContentTitle=fO.prototype.je;fO.prototype.clearContentMetadata=fO.prototype.Bd;fO.prototype.setContentMetadata=fO.prototype.dc;fO.prototype.getContentMetadata=fO.prototype.cb;fO.prototype.removeMessageListener=fO.prototype.removeMessageListener;fO.prototype.addMessageListener=fO.prototype.addMessageListener;fO.prototype.sendMessage=fO.prototype.sendMessage;fO.prototype.changeReceiverId=fO.prototype.If;fO.prototype.forceDisconnect=fO.prototype.Fd;
|
|
49
|
+
fO.prototype.cast=fO.prototype.cast;fO.prototype.setPlayerConfigInterceptor=fO.prototype.Rc;fO.prototype.getReceiverName=fO.prototype.Jd;fO.prototype.isCasting=fO.prototype.ib;fO.prototype.canCast=fO.prototype.xd;fO.prototype.destroy=fO.prototype.destroy;var gO=class extends cO{constructor(a){super(a,"clpp.cast.StateManager");this.I=this.S.bind(this);this.H=this.R.bind(this);this.A=this.aa.bind(this);this.w=this.Y.bind(this);this.K=this.W.bind(this);this.J=this.V.bind(this);this.M=this.fa.bind(this);this.G=this.ba.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,
|
|
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 _.x(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)})}S(){this.player.trigger(new _.F(_.ee));this.a(_.Dm)}R(){this.a(_.Cm)}aa(){this.a(_.sm)}Y(a){a.isBuffering?
|
|
52
|
+
this.a(_.vm):(a=this.player.isPaused()?_.Cm:_.Dm,this.a(a))}W(){this.j=1;this.player.trigger(new _.F(_.af))}V(){this.player.trigger(new _.F(_.$e))}fa(){this.j=2}ba(){this.a(_.Bm)}N(a){const b=this.player.getStats();this.player.trigger(new _.F(_.mc,{detail:{bandwidth:a.totalBitrate,width:b.width,height:b.height}}))}U(a){a=new _.H(_.G,7,7300,{detailedErrorCode:a.detailedErrorCode,error:a.error,reason:a.reason});this.player.trigger(new _.F(_.ld,{detail:a}));this.a(_.zm)}};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}pb(){return"Google Cast Framework"}qb(){return cast.framework.VERSION}vb(){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}ac(){return!1}Ib(){return this.a.clickThroughUrl||
|
|
53
|
+
null}getMediaUrl(){return this.a.contentUrl||this.a.contentId||null}sb(){return 0}rb(){return 0}gb(){return 0}Ta(){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}ub(){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.ub;Z.prototype.getPositionInSequence=Z.prototype.Kb;Z.prototype.getPodTimeOffset=Z.prototype.Jb;Z.prototype.getPodIndex=Z.prototype.getPodIndex;Z.prototype.getPodType=Z.prototype.Ta;Z.prototype.getMediaBitrate=Z.prototype.gb;Z.prototype.getMediaHeight=Z.prototype.rb;Z.prototype.getMediaWidth=Z.prototype.sb;Z.prototype.getMediaUrl=Z.prototype.getMediaUrl;Z.prototype.getClickThroughUrl=Z.prototype.Ib;
|
|
55
|
+
Z.prototype.isBumper=Z.prototype.ac;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.vb;
|
|
56
|
+
Z.prototype.getAdManagerVersion=Z.prototype.qb;Z.prototype.getAdManagerName=Z.prototype.pb;var hO=class{constructor(a){this.a=a}getCuePoints(){return this.a.map(a=>a.position)}Lb(){return!!this.a.find(a=>0===a.position)}hb(){return!!this.a.find(a=>-1===a.position)}};hO.prototype.hasPostroll=hO.prototype.hb;hO.prototype.hasPreroll=hO.prototype.Lb;hO.prototype.getCuePoints=hO.prototype.getCuePoints;var iO=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];IN().addEventListener(this.f,
|
|
57
|
+
this.g)}load(){const a=this;return _.x(function*(){EN&&(EN=!1,HN(a,0))})}start(){return _.x(function*(){IN().play()})}resume(){-1!==this.getPosition()&&IN().play()}pause(){-1!==this.getPosition()&&IN().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 _.x(function*(){IN().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=IN().getBreakManager();this.a.setPlayWatchedBreak(!0);a=this.a.getBreaks();this.m.trigger(new _.F(_.Vb,{adsTimeline:new hO(a)}));break;case cast.framework.events.EventType.BREAK_CLIP_LOADING:KN(this,_.Jb,a);break;case cast.framework.events.EventType.BREAK_STARTED:KN(this,_.Cb,a);break;case cast.framework.events.EventType.BREAK_ENDED:KN(this,_.Db,a);break;case cast.framework.events.EventType.BREAK_CLIP_STARTED:KN(this,_.Pb,a);
|
|
59
|
+
break;case cast.framework.events.EventType.BREAK_CLIP_ENDED:a.endedReason===b.SKIPPED?(KN(this,_.Ob,a),KN(this,_.Qb,a)):a.endedReason===b.STOPPED?KN(this,_.Qb,a):a.endedReason===b.END_OF_STREAM?(KN(this,_.Gb,a),KN(this,_.Qb,a)):a.endedReason===b.ERROR&&HN(this,1);break;case cast.framework.events.EventType.PLAYING:KN(this,_.Nb,a);break;case cast.framework.events.EventType.PAUSE:KN(this,_.Lb,a);break;case cast.framework.events.EventType.BUFFERING:a.isBuffering?KN(this,_.Eb,a):KN(this,_.Nb,a)}}};
|
|
60
|
+
iO.prototype.getPosition=iO.prototype.getPosition;iO.prototype.setVolume=iO.prototype.setVolume;iO.prototype.getVolume=iO.prototype.getVolume;iO.prototype.skip=iO.prototype.skip;iO.prototype.pause=iO.prototype.pause;iO.prototype.resume=iO.prototype.resume;var EN=!1;var jO=class{constructor(a){this.Qb=a;this.a=this.f.bind(this)}init(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().addEventListener(LN(),this.a)}release(){cast.framework.CastReceiverContext.getInstance().getPlayerManager().removeEventListener(LN(),this.a)}getTimelineCues(){return cast.framework.CastReceiverContext.getInstance().getPlayerManager().getTimedMetadata().map(a=>MN(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
|
+
_.og;break;case cast.framework.events.EventType.TIMED_METADATA_ENTER:b=_.qg;break;case cast.framework.events.EventType.TIMED_METADATA_EXIT:b=_.rg}b&&this.Qb(new _.F(b,{detail:MN(a.timedMetadataInfo)}))}else for(b of this.getTimelineCues())this.Qb(new _.F(_.og,{detail:b}))}};var kO=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;NN().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;NN().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.l)}getVideoTracks(){return[]}getAudioTracks(){return this.g}ja(){return this.j}ia(){return null}Ha(){const a=
|
|
62
|
+
this.oa();return a&&a.renditions[0]}Ia(){const a=this.pa();return a&&a.renditions[0]}Sa(){return null}eb(){return null}fb(){return null}Ka(){return null}oa(){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}pa(){let a=null;if(this.a){let b=this.a.getActiveIds()[0];typeof b===_.r&&(b=b.toString(),a=this.ja().find(c=>c.id===b)||null)}return a}Xa(){this.h.warn("Video tracks unavailable on Cast")}sa(a){a&&this.f&&
|
|
63
|
+
this.f.setActiveById(+a.id)}Ea(a){this.a&&(a?this.a.setActiveByIds([+a.id]):this.a.setActiveByIds([]))}Wa(){this.h.warn("Video renditions unavailable on Cast")}kb(a){this.sa(a&&a.track)}lb(a){this.Ea(a&&a.track)}addTextTrack(a){const b=this;return _.x(function*(){var c=b.m.getConfiguration();if((c=yield dN(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]),PN(b)}catch(e){throw b.h.warn("failed on track",a),e;}}})}la(){return!0}w(){this.f=NN().getAudioTracksManager();var a=this.f.getTracks();this.g=ON(_.L,a);PN(this);a=this.m.getConfiguration();QN(this,_.L,a.preferredAudioLanguage,a.preferredAudioRole);QN(this,_.K,a.preferredTextLanguage,a.preferredTextRole)}};kO.prototype.isAbrEnabled=kO.prototype.la;
|
|
65
|
+
kO.prototype.addTextTrack=kO.prototype.addTextTrack;kO.prototype.setTextRendition=kO.prototype.lb;kO.prototype.setAudioRendition=kO.prototype.kb;kO.prototype.setVideoRendition=kO.prototype.Wa;kO.prototype.setTextTrack=kO.prototype.Ea;kO.prototype.setAudioTrack=kO.prototype.sa;kO.prototype.setVideoTrack=kO.prototype.Xa;kO.prototype.getTextTrack=kO.prototype.pa;kO.prototype.getAudioTrack=kO.prototype.oa;kO.prototype.getVideoTrack=kO.prototype.Ka;kO.prototype.getLoadingTextRendition=kO.prototype.fb;
|
|
66
|
+
kO.prototype.getLoadingAudioRendition=kO.prototype.eb;kO.prototype.getLoadingVideoRendition=kO.prototype.Sa;kO.prototype.getTextRendition=kO.prototype.Ia;kO.prototype.getAudioRendition=kO.prototype.Ha;kO.prototype.getVideoRendition=kO.prototype.ia;kO.prototype.getTextTracks=kO.prototype.ja;kO.prototype.getAudioTracks=kO.prototype.getAudioTracks;kO.prototype.getVideoTracks=kO.prototype.getVideoTracks;var lO=class extends _.dq{constructor(){super();this.h=new _.R(WM);this.g=this.w=_.Bj();this.A=null;this.l=-1;this.F=new _.Bn;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=RN();a.setMessageInterceptor(cast.framework.messages.MessageType.MEDIA_STATUS,this.H.bind(this));a.setMediaPlaybackInfoHandler(this.G.bind(this));this.a=new gO(this);this.a.init();this.j=new kO;this.j.initialize(this);this.o=new jO(c=>this.trigger(c));this.o.init()}unload(){const a=
|
|
67
|
+
cast.framework.messages.PlayerState,b=RN();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=_.Bj();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=RN();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot play during ads playout.");
|
|
68
|
+
a.play();return Promise.resolve()}pause(){const a=RN();if(null!==a.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject("Cannot pause during ads playout.");a.pause();return Promise.resolve()}isPaused(){return RN().getPlayerState()===cast.framework.messages.PlayerState.PAUSED}isEnded(){return RN().getPlayerState()===cast.framework.messages.PlayerState.IDLE}seek(a){const b=RN();if(null!==b.getBreakManager().getBreakClipCurrentTimeSec())return Promise.reject(OM);b.seek(a);return Promise.resolve()}getPosition(){return RN().getCurrentTimeSec()}getDuration(){const a=
|
|
69
|
+
RN().getDurationSec();return typeof a===_.r?-1===a?Infinity:a:-1}getPlaybackRate(){return RN().getPlaybackRate()}setPlaybackRate(a){if(0<a){const b=new cast.framework.messages.SetPlaybackRateRequestData;b.playbackRate=a;RN().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=RN().getMediaInformation();if(a){var b=RN().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,bh:b,name:c}}return null}getDrmInfo(){return null}getPresentationStartTime(){return RN().getStartAbsoluteTime()}getSeekRange(){let a={start:0,end:this.getDuration()};if(this.isLive()){const b=RN().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():_.Aq}getStats(){var a=_.nm();if(this.f){a=RN().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 _.x(function*(){b.f=new _.yq;b.a.l=b.f.a;b.A=_.Gm(a);_.Ej(a)&&(b.g=_.Dj(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:bN(b.g),local:!0};yield RN().load(d)}})}getBufferInfo(){this.h.warn(_.ma);return new _.cq}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 WM}getTimelineCues(){return this.o&&this.o.getTimelineCues()||[]}resetAbr(){this.h.warn(SM)}onError(a){a=new _.F(_.ld,{detail:a});this.trigger(a)}canPlay(){return _.Oi()?2:0}H(a){a=Object.assign({},a);a.customData||(a.customData={});a.customData.stats=bN(this.getStats());var b=RN(),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=RN().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=cN(a.media.customData.playerConfiguration));(a=c?c.abr:null)&&typeof a.defaultBandwidthEstimate===_.r?b.initialBandwidth=a.defaultBandwidthEstimate:b.initialBandwidth=void 0;UN(c,b);return b}getTextDisplayer(){return null}setDrmCustomDataModifier(){}setCdnErrorCallback(){}detach(){}};lO.prototype.getTextDisplayer=lO.prototype.getTextDisplayer;lO.prototype.getNetworkEngine=lO.prototype.getNetworkEngine;
|
|
76
|
+
lO.prototype.setNetworkEngine=lO.prototype.setNetworkEngine;var WN=class{constructor(){this.a=!1;this.h=new _.R(XM);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 _.vp;this.l=null}init(a){a&&(this.f=new lO,_.Kn(a,this.f),this.m=a,this.o.on(window,"unload",()=>{const b=this;return _.x(function*(){b.m&&b.m.getState()!==_.Am&&(yield aN(b.m))})}))}start(){if(!this.a&&window.cast&&cast.framework&&cast.framework.CastReceiverContext){this.a=!0;var a=YN(),b=YN().getPlayerManager(),c=new cast.framework.CastReceiverOptions;
|
|
77
|
+
c.customNamespaces={};c.customNamespaces[YM]=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(YM,this.w)}}stop(){if(this.a){this.a=!1;this.o.release();const a=YN();YN().getPlayerManager().removeEventListener(cast.framework.events.EventType.PLAYER_LOAD_COMPLETE,this.A);a.removeCustomMessageListener(YM,this.w);a.stop();this.m=this.f=null}}Rc(a){this.j=a}Gg(a){this.l=a}on(a,b){YN().addEventListener(a,b)}off(a,b){YN().removeEventListener(a,b)}addMessageListener(a){typeof a===_.od&&this.g.add(a)}removeMessageListener(a){typeof a===_.od&&this.g.delete(a)}sendMessage(a,
|
|
79
|
+
b){YN().sendCustomMessage(YM,b,bN(a))}Zb(){return this.a}cb(){var a;return a=(a=YN().getPlayerManager().getMediaInformation())&&a.metadata?a.metadata:null}F(a){a=a.trim();if(a.startsWith("#EXTM3U"))return $N(this,a);try{var b=(new DOMParser).parseFromString(a,_.Re)}catch(k){return a}var c=b.getElementsByTagName("MPD")[0];if(c){a=c;this.h.debug("Detected DASH, parsing");b=YN();c=a.getElementsByTagName("Period");for(var d=c.length-1;0<=d;--d){var e=c[d].getElementsByTagName(_.ea);for(var f=e.length-
|
|
80
|
+
1;0<=f;--f){var g=e[f].getAttribute("contentType");if(g===_.w||g===_.p){g=e[f].getAttribute(_.Hd);var h=e[f].getElementsByTagName(_.gb);for(let k=h.length-1;0<=k;--k){const l=h[k].getAttribute(_.Hd)||g,m=h[k].getAttribute(_.Mc);let n=h[k].getAttribute(_.tf)||void 0,q=h[k].getAttribute(_.pd)||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(_.gb).length||c[d].removeChild(e[f])}}c[d].getElementsByTagName(_.ea).length||a.removeChild(c[d])}return a=
|
|
81
|
+
(new XMLSerializer).serializeToString(a)}if(c=b.getElementsByTagName(_.ob)[0]){a=c;this.h.debug("Detected Smooth, parsing");b=YN();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(_.Ma)||void 0,h=e[f].getAttribute(_.La)||void 0,void 0!==g&&(g=+g),void 0!==h&&(h=+h),b.canDisplayType(_.ff,void 0,g,h)||c[d].removeChild(e[f]);c[d].getElementsByTagName(_.bb).length||a.removeChild(c[d])}a=
|
|
82
|
+
(new XMLSerializer).serializeToString(a)}return a}C(a){const b=this;return _.x(function*(){let c=a;var d;c.media.customData&&(d=cN(c.media.customData.playerConfiguration));if(b.m&&d){b.j&&(d=(yield Promise.resolve(b.j(d)))||d);d.ima&&(yield GN(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 _.Rn(b.m,d),yield _.Sn(b.m),d=b.m.getLoadedSource(),c.media.contentId=
|
|
83
|
+
d.url,c.media.contentType=d.type,d.Bb&&(c.media.hlsVideoSegmentFormat=eN(d.Bb,_.M)),d.audioMimeType&&(c.media.hlsSegmentFormat=eN(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=YN().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))}_.Un(this.m)}}B(a){if(0<this.g.size){const b=cN(a.data);this.g.forEach(c=>c(b))}}};_.z(XM,WN);WN.prototype.getContentMetadata=WN.prototype.cb;WN.prototype.isApiReady=WN.prototype.Zb;WN.prototype.sendMessage=WN.prototype.sendMessage;WN.prototype.removeMessageListener=WN.prototype.removeMessageListener;
|
|
85
|
+
WN.prototype.addMessageListener=WN.prototype.addMessageListener;WN.prototype.off=WN.prototype.off;WN.prototype.on=WN.prototype.on;WN.prototype.setLoadRequestDataInterceptor=WN.prototype.Gg;WN.prototype.setPlayerConfigInterceptor=WN.prototype.Rc;WN.prototype.stop=WN.prototype.stop;WN.prototype.start=WN.prototype.start;WN.prototype.init=WN.prototype.init;WN.getInstance=XN;var VN=null;var mO=class{constructor(a){this.f=a;this.a=null;this.g=new _.vp;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.g.on(b,d,c)}})}start(){return _.x(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($M,{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 _.x(function*(){a.g.release()})}l(a){switch(a.field){case "mediaInfo":a.value&&(a=a.value,a.breaks&&this.f.trigger(new _.F(_.Vb,{adsTimeline:new hO(a.breaks)})));break;case "isPlayingBreak":a.value?bO(this,_.Cb):(bO(this,_.Gb),bO(this,_.Qb),bO(this,_.Db));break;case "currentBreakClipNumber":0<=a.value&&(0<a.value&&(bO(this,_.Gb),bO(this,_.Qb)),bO(this,_.Pb));break;case "isPaused":this.a.isPlayingBreak&&(a.value?bO(this,_.Lb):bO(this,_.Nb))}}};mO.prototype.getPosition=mO.prototype.getPosition;
|
|
88
|
+
mO.prototype.setVolume=mO.prototype.setVolume;mO.prototype.getVolume=mO.prototype.getVolume;mO.prototype.skip=mO.prototype.skip;mO.prototype.pause=mO.prototype.pause;mO.prototype.resume=mO.prototype.resume;var nO=class{name(){return"clpp.cast.ads.SenderAdsManagerFactory"}da(a,b){return a.namespace()!==_.Gc?!1:!(!b||!b.ima)}create(a){return new mO(a.a)}};nO.prototype.create=nO.prototype.create;nO.prototype.isSupported=nO.prototype.da;nO.prototype.name=nO.prototype.name;_.Um(new nO);var oO=class{name(){return"clpp.cast.ads.AdsManagerFactory"}da(a,b){return XN().Zb()?!(!b||!b.ima):!1}create(a){return new iO(a)}};oO.prototype.create=oO.prototype.create;oO.prototype.isSupported=oO.prototype.da;oO.prototype.name=oO.prototype.name;_.Um(new oO);};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.
|
|
8
|
-
|
|
9
|
-
d;a.a.setAdPlayerInfo(e);a.a.reportAdStarted(c)}}catch(c){a.
|
|
10
|
-
b.connectionType);a.
|
|
11
|
-
new _.
|
|
12
|
-
h);if(h=a.
|
|
13
|
-
a.
|
|
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.
|
|
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.
|
|
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"}U(a,b){a.trigger(new _.F(_.
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var pM="Ad Error",qM="onAdBreakStarted()",rM="onAdBreakStopped()",sM=function(a){var b=_.cj();let c=Conviva.Constants.DeviceType.DESKTOP,d=Conviva.Constants.DeviceCategory.WEB;const e=b.os;b=b.osVersion.name;let f="";_.Pi()&&(f="Apple");_.Oi()?(f="Google",c=Conviva.Constants.DeviceType.SETTOP,d=Conviva.Constants.DeviceCategory.CHROMECAST):_.Qi()?(c=Conviva.Constants.DeviceType.MOBILE,/(android)/i.test(navigator.userAgent)?d=Conviva.Constants.DeviceCategory.ANDROID_DEVICE:_.Pi()&&(d=Conviva.Constants.DeviceCategory.APPLE_DEVICE)):
|
|
2
|
+
_.Ii()||_.Fi()||_.Ei("Hisense")?(c=Conviva.Constants.DeviceType.SMARTTV,d=Conviva.Constants.DeviceCategory.SMART_TV,_.Ii()?(b="",f="LG",d=Conviva.Constants.DeviceCategory.LG_TV):_.Fi()?(f="Samsung",d=Conviva.Constants.DeviceCategory.SAMSUNG_TV):_.Ei("Hisense")&&(b="",f="Hisense")):_.Ei("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},tM=function(a){return a?Conviva.Constants.StreamType.LIVE:Conviva.Constants.StreamType.VOD},uM=function(a){return 0===a?"Pre-roll":-1===a?"Post-roll":"Mid-roll"},wM=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
|
+
tM(!!d);e[Conviva.Constants.ASSET_NAME]=pM;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"]=vM(a.getId()),e["c3.ad.creativeId"]=vM(a.getCreativeId()),e["c3.ad.system"]=vM(a.getAdSystem()),e["c3.ad.mediaFileApiFramework"]=vM(a.getApiFramework()),e["c3.ad.advertiser"]=vM(a.getAdvertiserName()),e["c3.ad.position"]=uM(a.getPodIndex()),e["c3.ad.technology"]=0===a.vb()?Conviva.Constants.AdType.CLIENT_SIDE:
|
|
5
|
+
Conviva.Constants.AdType.SERVER_SIDE,e["c3.ad.adManagerName"]=vM(a.pb()),e["c3.ad.adManagerVersion"]=vM(a.qb()),e["c3.ad.advertiserCategory"]=vM(null),e["c3.ad.advertiserId"]=vM(null),e["c3.ad.breakId"]=vM(null),e["c3.ad.campaignName"]=vM(null),e["c3.ad.category"]=vM(null),e["c3.ad.classification"]=vM(null),e["c3.ad.creativeName"]=vM(null),e["c3.ad.sequence"]=vM(a.Kb()),e["c3.ad.sessionStartEvent"]=vM(null),e["c3.ad.unitName"]=vM(null),e["c3.ad.dayPart"]=vM(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"]=vM(b),e["c3.ad.firstAdSystem"]=vM(c),e["c3.ad.firstCreativeId"]=vM(a));return e},vM=function(a){return a?""+a:"NA"},AM=function(a){a.f.on(a.m,_.Cb,a.C.bind(a));a.f.on(a.m,_.Db,a.F.bind(a));a.f.on(a.m,_.Pb,a.M.bind(a));a.f.on(a.m,_.Mb,a.l.bind(a));a.f.on(a.m,_.Lb,a.l.bind(a));a.f.on(a.m,_.Nb,a.l.bind(a));a.f.on(a.m,_.Eb,a.l.bind(a));a.f.on(a.m,_.Qb,a.N.bind(a));
|
|
7
|
+
a.f.on(a.m,_.Ob,a.K.bind(a));a.f.on(a.m,_.Fb,a.G.bind(a));a.f.on(a.m,_.Ib,a.I.bind(a));a.f.on(a.m,_.Jb,a.J.bind(a));a.f.on(a.m,_.Hb,a.H.bind(a));a.f.on(a.m,_.Kb,a.V.bind(a));a.f.on(a.m,_.Rb,a.R.bind(a));a.f.on(a.m,_.ld,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=pM}null===a.a&&xM(a,null);a.a.reportAdError(c,b.FATAL);a.g=!0;a.h.debug("Ad Playback Failure");
|
|
8
|
+
yM(a,zM,c)}})},yM=function(a,b,c=pM){if(a.a){a.a.reportAdMetric(Conviva.Constants.Playback.PLAYER_STATE,Conviva.Constants.PlayerState.STOPPED);switch(b){case zM:a.a.reportAdFailed(c,wM(null,a.B,a.A));break;case BM:a.a.reportAdSkipped();break;default:a.a.reportAdEnded()}a.a.release();a.a=null;a.j=!1}},xM=function(a,b){if(!a.o){a.g=!1;try{if(a.a=Conviva.Analytics.buildAdAnalytics(a.S()),b){const c=wM(b,a.B,a.A,a.m.isLive()),d=String(b.qb()),e={};e[Conviva.Constants.FRAMEWORK_NAME]=b.pb();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)}}},CM=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(sM(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]=_.na;b[Conviva.Constants.FRAMEWORK_VERSION]=_.da;a.a.setPlayerInfo(b)},DM=function(a){return a.m.getConfiguration().autoplay||!1},FM=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 _.rk(b.url);b&&(f[Conviva.Constants.ASSET_NAME]=b.name||"N/A",f[Conviva.Constants.STREAM_URL]=_.ai(g));f[Conviva.Constants.PLAYER_NAME]=c.playerName||_.na;f[Conviva.Constants.VIEWER_ID]=d;f[Conviva.Constants.DEFAULT_RESOURCE]=e;if(c&&!_.B(c.customTags))for(const h in c.customTags)f[h]=c.customTags[h];a.a.reportPlaybackRequested(f);a.a.setCallback(()=>{a.h.debug("reportMiscellaneousMetrics()");if(EM(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.Je(h.ue)}));a.j=[]}},GM=function(a){if(!a.l&&a.a){const b=tM(a.m.isLive()),c={};c[Conviva.Constants.IS_LIVE]=b;c[Conviva.Constants.DURATION]=a.m.getDuration();a.a.setContentInfo(c)}},EM=function(a){return null!==a.a&&a.C},HM=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)},IM=function(a,b){var c=b.getConfiguration();a.a=!_.B(c.conviva)&&typeof c.conviva===_.Od;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.U(b,c)):b.namespace()===_.Gc&&(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.")},JM=function(a){const b=[];typeof a===_.Od&&(a.customerKey||b.push("customerKey"),a.viewerId||b.push("viewerId"));if(0<b.length)throw new _.H(1,9,9001,{missingKeys:b});};var LM=class{constructor(a,b){this.m=a;this.S=b;this.B="";this.A=_.na;this.h=new _.R("clpp.conviva.ad");this.f=new _.vp;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||_.na;AM(this)}release(){this.h.debug("Release Ad Insights");this.w?this.h.debug(_.ha):(_.jg(this.f),this.a&&yM(this,KM),this.f.release(),this.w=!0,this.j=this.g=!1)}destroy(){this.h.debug(_.Wc);this.o?this.h.debug(_.fa):this.o=!0}C(){this.h.debug(qM)}F(){this.h.debug(rM)}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"),xM(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.sb(),a.rb());this.a.reportAdMetric(Conviva.Constants.Playback.BITRATE,a.gb())}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 _.Mb:case _.Nb:b(Conviva.Constants.PlayerState.PLAYING);
|
|
16
|
+
break;case _.Lb:b(Conviva.Constants.PlayerState.PAUSED);break;case _.Eb:b(Conviva.Constants.PlayerState.BUFFERING)}}}N(){this.h.debug("onAdStopped()");this.a&&!this.g&&yM(this,KM)}K(){this.h.debug("onAdSkipped()");this.a&&yM(this,BM)}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;xM(this,b)};if(-1!==b.getPodIndex()||this.m.getPosition()>=this.m.getDuration()-5)c();else this.f.on(this.m,_.Se,()=>{this.m.getPosition()>=this.m.getDuration()-5&&(this.f.off(this.m,_.Se),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)}},BM=0,KM=1,zM=2;var MM=class{constructor(a,b){this.m=a;this.f=new _.vp;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=_.Hf(b),this.K=c,this.m=a,CM(this,this.F),this.f.on(this.m,_.ee,this.na.bind(this)),this.f.on(this.m,_.Ge,this.aa.bind(this)),this.f.on(this.m,_.mc,this.M.bind(this)),this.f.on(this.m,_.af,this.Y.bind(this)),this.f.on(this.m,
|
|
19
|
+
_.$e,this.W.bind(this)),this.f.on(this.m,_.Cb,this.S.bind(this)),this.f.on(this.m,_.Db,this.V.bind(this)),this.f.on(this.m,_.Vb,this.ba.bind(this)),this.f.on(this.m,_.lc,this.fa.bind(this)),this.f.on(this.m,_.ld,this.N.bind(this)),DM(this)&&(this.h.debug("Start a new session: A new video starts in autoplay."),FM(this)))}release(){this.h.debug("Release conviva");this.G?this.h.debug(_.ha):(_.jg(this.f),EM(this)||this.o||!DM(this)||this.a&&this.a.reportPlaybackFailed("Exit Before Video Start"),EM(this)&&
|
|
20
|
+
HM(this),this.a=null,this.G=!0)}destroy(){this.h.debug(_.Wc);this.l?this.h.debug(_.fa):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}na(){this.h.debug("onPlayRequest()");EM(this)||DM(this)?EM(this)&&this.A&&!this.g&&(this.h.debug("Resuming VST monitoring ..."),EM(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
|
+
FM(this))}aa(a){this.h.debug(_.Td);const b=c=>{if(this.o&&(this.h.debug("Creating conviva session (On Seek / Replay)"),CM(this,this.F),FM(this),GM(this),EM(this))){var d=this.m.getTrackManager();d=d.ia()||d.Sa();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)}EM(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.PLAYER_STATE,c)};switch(a.detail.currentState){case _.Dm:b(Conviva.Constants.PlayerState.PLAYING);
|
|
22
|
+
break;case _.Cm:b(Conviva.Constants.PlayerState.PAUSED);break;case _.vm:b(Conviva.Constants.PlayerState.BUFFERING);break;case _.sm:this.h.debug("onVideoEnded()"),EM(this)&&(this.w&&this.w.hb()?(this.h.debug("Waiting for postroll Ad before terminating session"),this.J=!0):HM(this))}}M(a){this.h.debug(_.Pd);if(EM(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({Je:this.M.bind(this),ue:a})}Y(){this.h.debug("onSeeking()");EM(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_STARTED)}W(){this.h.debug("onSeeked()");EM(this)&&this.a.reportPlaybackMetric(Conviva.Constants.Playback.SEEK_ENDED)}ba(a){this.h.debug("onAdsTimelineChanged()");if(a=a.adsTimeline)this.w=a}S(a){this.h.debug(qM);
|
|
24
|
+
var b=a.ad;a=0===b.Ta();const c=uM(b.getPodIndex());EM(this)||DM(this)||!a||FM(this);if(EM(this)){a=0===b.vb()?Conviva.Constants.AdType.CLIENT_SIDE:Conviva.Constants.AdType.SERVER_SIDE;let d=0;const e={};1===b.ub()&&(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||_.Oi()?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(rM);
|
|
25
|
+
EM(this)&&this.B&&(this.a.reportAdBreakEnded(),this.B=!1,this.J&&HM(this))}N(a){this.h.debug(_.Qd);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===_.G&&(d=Conviva.Constants.ErrorSeverity.FATAL,EM(this)||FM(this));EM(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,HM(this))):this.j.push({Je:this.N.bind(this),ue:a})}}fa(){this.h.debug("onAutoPlayBlocked()");EM(this)&&(this.h.debug("Auto-play blocked. Pausing VST monitoring."),this.A=!0,EM(this)&&this.g&&(this.a.reportPlaybackEvent(Conviva.Constants.Events.USER_WAIT_STARTED),this.g=!1))}};var NM=class{constructor(){this.g=this.f=null;this.a=!1;this.h=new _.R("clpp.conviva")}onPlayerCreated(a){this.f=new MM(a,this.h)}onContentWillLoad(a,b){IM(this,a);if(this.a){var c=a.getConfiguration();c=_.Hf(c.conviva||{});try{JM(c);const d=c.enableAdInsights||!1;this.f.initialize(a,c,b);d&&(this.g=new LM(a,()=>this.f.a),this.g.initialize(c))}catch(d){d instanceof _.H?this.U(a,d):this.U(a,new _.H(1,9,9002,d,d))}}}onContentLoaded(){this.a&&GM(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"}U(a,b){a.trigger(new _.F(_.ld,{detail:b}))}reportAppEvent(a,b){return this.f?this.f.reportAppEvent(a,b):!1}};_.z("clpp.conviva.ConvivaPlugin",NM);NM.prototype.reportAppEvent=NM.prototype.reportAppEvent;NM.Id="conviva";_.En(new class{create(){return new NM}});};f.call(g, window);
|