@flowplayer/player 3.32.0 → 3.32.1-rc.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/core.js +1 -1
- package/default.js +1 -1
- package/embed.js +2 -2
- package/index.d.ts +13 -1
- package/package.json +2 -2
- package/plugins/ads.d.ts +13 -1
- package/plugins/ads.js +1 -1
- package/plugins/airplay.d.ts +13 -1
- package/plugins/analytics.d.ts +13 -1
- package/plugins/analytics.js +1 -1
- package/plugins/asel.d.ts +13 -1
- package/plugins/asel.js +1 -1
- package/plugins/audio.d.ts +13 -1
- package/plugins/chapters.d.ts +13 -1
- package/plugins/chromecast.d.ts +13 -1
- package/plugins/comscore.d.ts +13 -1
- package/plugins/consent.d.ts +13 -1
- package/plugins/context-menu.d.ts +13 -1
- package/plugins/cuepoints.d.ts +13 -1
- package/plugins/dash.d.ts +13 -1
- package/plugins/drm.d.ts +13 -1
- package/plugins/endscreen.d.ts +13 -1
- package/plugins/fas.d.ts +13 -1
- package/plugins/float-on-scroll.d.ts +13 -1
- package/plugins/ga4.d.ts +13 -1
- package/plugins/gemius.d.ts +13 -1
- package/plugins/google-analytics.d.ts +13 -1
- package/plugins/hls.d.ts +13 -1
- package/plugins/hls.js +1 -1
- package/plugins/id3.d.ts +13 -1
- package/plugins/iframe.d.ts +13 -1
- package/plugins/keyboard.d.ts +13 -1
- package/plugins/media-session.d.ts +13 -1
- package/plugins/message.d.ts +13 -1
- package/plugins/message.js +1 -1
- package/plugins/ovp.d.ts +13 -1
- package/plugins/ovp.js +1 -1
- package/plugins/playlist.d.ts +13 -1
- package/plugins/playlist.js +1 -1
- package/plugins/preview.d.ts +13 -1
- package/plugins/qsel.d.ts +13 -1
- package/plugins/qsel.js +1 -1
- package/plugins/qul.d.ts +13 -1
- package/plugins/rts.d.ts +13 -1
- package/plugins/rts.js +4 -4
- package/plugins/share.d.ts +13 -1
- package/plugins/share.js +1 -1
- package/plugins/speed.d.ts +13 -1
- package/plugins/speed.js +1 -1
- package/plugins/ssai.d.ts +13 -1
- package/plugins/ssai.js +1 -1
- package/plugins/subtitles.d.ts +13 -1
- package/plugins/subtitles.js +1 -1
- package/plugins/thumbnails.d.ts +13 -1
- package/plugins/tizen.d.ts +13 -1
- package/plugins/vtsel.d.ts +13 -1
- package/plugins/vtsel.js +1 -1
- package/plugins/webos.d.ts +13 -1
- package/util/loader.d.ts +13 -1
package/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { Get } from 'type-fest';
|
|
2
2
|
import type { Level } from 'hls.js';
|
|
3
|
+
import type { Paths } from 'type-fest';
|
|
3
4
|
import type { Representation } from 'dashjs';
|
|
5
|
+
import type { Translation } from '@flowplayer/translations';
|
|
4
6
|
import type { TupleToUnion } from 'type-fest';
|
|
5
7
|
|
|
6
8
|
/* Excluded from this release type: AnyLoader */
|
|
@@ -1264,7 +1266,8 @@ export declare type Player = HTMLVideoElement & PlayerEventOverloads & {
|
|
|
1264
1266
|
/**
|
|
1265
1267
|
* Adds a language to the project. See {@link https://developer.wowza.com/docs/wowza-flowplayer/player/translations/#using-npm| Official documentation}
|
|
1266
1268
|
*/
|
|
1267
|
-
i18n(k:
|
|
1269
|
+
i18n(k: TranslationKey): string;
|
|
1270
|
+
i18n(k: string, fallback: string): string;
|
|
1268
1271
|
/* Excluded from this release type: deviceId */
|
|
1269
1272
|
/* Excluded from this release type: live_state */
|
|
1270
1273
|
/**
|
|
@@ -1999,6 +2002,15 @@ export declare type TouchMoveEventDetail = TouchEvent;
|
|
|
1999
2002
|
*/
|
|
2000
2003
|
export declare type TouchStartEventDetail = TouchEvent;
|
|
2001
2004
|
|
|
2005
|
+
/**
|
|
2006
|
+
* @public
|
|
2007
|
+
* All possible full paths to each translation, i.e. "core.mute"| "core.play" | "ads.ad" etc.
|
|
2008
|
+
* This type is useful for developers using translation querying based on path, like in lodash's get()
|
|
2009
|
+
*/
|
|
2010
|
+
export declare type TranslationKey = Paths<Translation, {
|
|
2011
|
+
leavesOnly: true;
|
|
2012
|
+
}>;
|
|
2013
|
+
|
|
2002
2014
|
declare type TSampleRate = typeof SampleRate;
|
|
2003
2015
|
|
|
2004
2016
|
declare const TV = "is-tv";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flowplayer/player",
|
|
3
|
-
"version": "3.32.
|
|
3
|
+
"version": "3.32.1-rc.1",
|
|
4
4
|
"description": "video player for the future",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"flowplayer",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"types": "index.d.ts",
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"hls.js": "1.6.12",
|
|
21
|
-
"type-fest": "^
|
|
21
|
+
"type-fest": "^5.1.0",
|
|
22
22
|
"dashjs": "5.0.3"
|
|
23
23
|
},
|
|
24
24
|
"exports": {
|
package/plugins/ads.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { Get } from 'type-fest';
|
|
2
2
|
import type { Level } from 'hls.js';
|
|
3
|
+
import type { Paths } from 'type-fest';
|
|
3
4
|
import type { Representation } from 'dashjs';
|
|
5
|
+
import type { Translation } from '@flowplayer/translations';
|
|
4
6
|
import type { TupleToUnion } from 'type-fest';
|
|
5
7
|
|
|
6
8
|
declare const AD_ATTRIBUTION: number;
|
|
@@ -3372,7 +3374,8 @@ declare type Player = HTMLVideoElement & PlayerEventOverloads & {
|
|
|
3372
3374
|
/**
|
|
3373
3375
|
* Adds a language to the project. See {@link https://developer.wowza.com/docs/wowza-flowplayer/player/translations/#using-npm| Official documentation}
|
|
3374
3376
|
*/
|
|
3375
|
-
i18n(k:
|
|
3377
|
+
i18n(k: TranslationKey): string;
|
|
3378
|
+
i18n(k: string, fallback: string): string;
|
|
3376
3379
|
/* Excluded from this release type: deviceId */
|
|
3377
3380
|
/* Excluded from this release type: live_state */
|
|
3378
3381
|
/**
|
|
@@ -4223,6 +4226,15 @@ TOUCH_START = "touchstart";
|
|
|
4223
4226
|
|
|
4224
4227
|
declare const TOUCHED = "is-touched";
|
|
4225
4228
|
|
|
4229
|
+
/**
|
|
4230
|
+
* @public
|
|
4231
|
+
* All possible full paths to each translation, i.e. "core.mute"| "core.play" | "ads.ad" etc.
|
|
4232
|
+
* This type is useful for developers using translation querying based on path, like in lodash's get()
|
|
4233
|
+
*/
|
|
4234
|
+
declare type TranslationKey = Paths<Translation, {
|
|
4235
|
+
leavesOnly: true;
|
|
4236
|
+
}>;
|
|
4237
|
+
|
|
4226
4238
|
declare type TSampleRate = typeof SampleRate;
|
|
4227
4239
|
|
|
4228
4240
|
declare const TV = "is-tv";
|
package/plugins/ads.js
CHANGED
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* https://github.com/lancedikson/bowser
|
|
5
5
|
* MIT License | (c) Dustin Diaz 2012-2015
|
|
6
6
|
* MIT License | (c) Denis Demchenko 2015-2019
|
|
7
|
-
*/const ye=class Bowser{static getParser(t,e=!1){if("string"!=typeof t)throw new Error("UserAgent should be a string");return new Parser(t,e)}static parse(t){return new Parser(t).getResult()}static get BROWSER_MAP(){return ce}static get ENGINE_MAP(){return pe}static get OS_MAP(){return he}static get PLATFORMS_MAP(){return ue}}.parse(window.navigator.userAgent),{platform:Ae,os:be,browser:we}=ye,Ee=t=>t&&t.toLowerCase();var Se={rnd:Math.random().toString(36).substr(2,32),os:Ee(be.name+(be.versionName?` ${be.versionName}`:"")),device:Ee(Ae.type),browser:Ee(we.name),browser_version:(we&&we.version?we.version:"unknown").split(".").shift(),plugin_version:"3.32.0"};const Te="https://fp-eu-w1-aai.flowplayer.com/in",Le="POST",Oe=[y,v,A,E,w,q,O],Re=["event_type","ad_tag_id","media_id","player_id","site_id","sitegroup_id","rnd","os","device","browser","browser_version","plugin_version","player_version"],Me=["vast_error","reason","request_load_time","ad_type","vast_ad_id"],Pe=vt("ads/analytics"),ke=RequestQueue.of(),De=(...t)=>Object.assign({},...t);class Analytics{static of(t,e){return new Analytics(t,e)}static ensure_required_keys(t,e){return t.required_keys.filter(t=>!(t in e))}static pluck_valid_keys(t,e){return((t,...e)=>Object.keys(t).filter(t=>~e.indexOf(t)).reduce((e,s)=>Object.assign(e,{[s]:t[s]}),{}))(e,...t.valid_keys)}static mergeMetadata(t,e={}){return t.metadata=Analytics.pluck_valid_keys(t,De(t.metadata,e,{player_version:"3.32.0"})),t}constructor(t,e={}){this.emitter=t,this.metadata=De(Se,e.metadata||{}),this.emitter=t,this.events=e.events||[],this.required_keys=e.required_keys||[],this.optional_keys=e.optional_keys||[],this.valid_keys=this.required_keys.slice(0).concat(this.optional_keys),Pe(this),this.wireup()}wireup(){this.events.forEach(t=>{this.emitter.on(t,e=>{const s=e.detail,i=De(this.metadata,{event_type:t},s),r=Analytics.pluck_valid_keys(this,i),a=Analytics.ensure_required_keys(this,r);if(Pe(`Event[${t}]`,{payload:r,observation:s}),a.length)return Pe(`Analytics.validate_metadata() failed for\n Event[${t}]\n missing keys: ${a}`,r);RequestQueue.rpush(ke,[Te,Le,r])})})}destroy(){const t=this;t.emitter=t.metadata=t.events=t.required_keys=t.optional_keys=t.valid_keys=void 0}}class EventBus{constructor(t=document.createElement("div"),e=[]){this._bus=t,this._listeners=e}removeAllListeners(){this._listeners.length=0,this._bus=document.createElement("div")}emit(t,e){const s=new CustomEvent(t,{detail:e||{}});this._bus.dispatchEvent(s)}on(t,e){this._listeners.push([t,e]),this._bus.addEventListener(t,e,{passive:!0})}once(t,e){this._bus.addEventListener(t,e,{once:!0})}removeListener(t,e){this._bus.removeEventListener(t,e)}}const Ie=vt("ads/controller"),Ce={show_all_ads_on_seek:!1,timeout:5e3,preload_advance:10};class AdsController extends EventBus{constructor(t={}){var e;super(),this.adapter=function(t,e){return t.adapter?new t.adapter(e):new IMA(e)}(t,this),this.opts=Object.assign(Object.assign({},Ce),t),this.analytics=(e=this,Analytics.of(e,{required_keys:Re,optional_keys:Me,events:Oe})),this._state=AdsState.of(),this._schedule=void 0,this._lastAd=void 0,this._macros=new Macros(t.parameters||{}),this.wireup(),this.content_processing_src=!1}reset(){return this.removeAllListeners(),this.wireup(),this.analytics&&this.analytics.wireup(),this._state.reset(),this.adapter.reset(),this}destroy(){this.removeAllListeners(),this.analytics&&this.analytics.destroy(),this.adapter&&this.adapter.destroy();const t=this;t.analytics=void 0,t.opts=void 0,t.adapter=void 0,t._state=void 0,t._schedule=void 0,t._lastAd=void 0,t._macros=void 0}stop(){this.adapter&&this.adapter.stop()}onContentNewSrc(){this._state.reset(),this.adapter.destroyManager(),this.adapter.contentComplete()}wireup(){const t=()=>{var t,e;this.adapter.onAdRequestEnd(),null===(t=this.videoTag)||void 0===t||t.setState("ad-paused",!1),null===(e=this.videoTag)||void 0===e||e.setState("ad-playing",!0),this._state.toggleState(oe.PLAYING,!0)};this.on(B,t),this.on(w,t),this.on(T,t);const e=t=>{var e,s;(null==t?void 0:t.type)!==v&&this.adapter.onAdRequestEnd(),null===(e=this.videoTag)||void 0===e||e.setState("ad-paused",(null==t?void 0:t.type)===S),null===(s=this.videoTag)||void 0===s||s.setState("ad-playing",!1),this.adPlaying&&this._state.toggleState(oe.PLAYING,!1)};this.on(k,e),this.on(_,e),this.on(m,e),this.on(v,e),this.on(S,e),this.on(O,e),this.on(E,e),this.on(k,()=>{requestAnimationFrame(()=>{this._state.toggleState(oe.BREAK_ACTIVE,!1)})}),this.on(F,()=>{console.error("Adapter init failed"),e(),this._state.toggleState(oe.FATAL_ERROR,!0)}),this.on(j,async t=>{if(Ie("Ads.on(RELOAD_AD_REQUESTED)",t),this._schedule){if(e(),t)return this._schedule.reset(this._schedule.getAds());this._state.hasAny(oe.AD_AVAILABLE)&&(this._schedule.decrement(),this._state.toggleState(oe.AD_AVAILABLE,!1))}})}async initialize(t,e={},s){return Ie("Ads.initialize():",t,e,s),this._state.toggleState(oe.INITIALIZING,!0),Object.assign(this.opts,e),Array.isArray(t)&&this.setSchedule(t),await this.adapter.init(this.opts),this._macros=this._macros.fork(Object.assign({},e.parameters||{},{autoplay:e.autoplay,muted:e.muted})),this.adapter.isReady()&&await this.adapterInitialized(s),this}get videoTag(){return this.adapter.getVideoTag()}get adInfo(){return this.adapter.getAdInfo()}async setVideoTag(t){Ie("Ads.setVideoTag():",t),await this.adapter.setVideoTag(t),this.trigger(f,t),this.adapter.isReady()&&await this.adapterInitialized(),t.on(H,()=>this.adapter.pause()),t.on(V,()=>this.adapter.resume()),t.on(z,()=>t.toggleMute()),t.on(Z,()=>{this.adapter.volume(t.muted?0:0==t.volume?.1:t.volume)}),t.on("src",()=>t.hasState("ad-playing")||t.hasState("ad-paused")?(this.stop(),this.adapter.isLinearAd()?(this.setIsContentProcessingNewSrc(!0),void this.once(k,()=>{setTimeout(()=>{this.setIsContentProcessingNewSrc(!1),this.onContentNewSrc()},0)})):this.onContentNewSrc()):this.onContentNewSrc())}waitForVideoTag(){return new Promise(t=>{const e=this.adapter.getVideoTag();if(e)return t(e);this.on(f,e=>{this.once(g,()=>t(e))})})}async adapterInitialized(t){Ie("Ads.adapterInitialized()"),this._state.toggleState(oe.INITIALIZING,!1),this._state.toggleState(oe.BREAK_ACTIVE,!!this.hasPreroll()),await this.setCurrentTime(0,t),this.checkIfBreakComplete(),this.adapter.isAdPod()||t&&!this.opts.autoplay||this.trigger(_)}async fetchNextAd(t,e=0){var s,i;if(!this._schedule)return;if(!this.adapter.isReady())return;if(e>50)throw this._state.toggleState(oe.FATAL_ERROR,!0),this._state.toggleState(oe.FETCHING_AD,!1),new Error("Ads.fetchNextAd() :max_recursion_depth");const r=(null===(s=this._schedule)||void 0===s?void 0:s.getNextAd())||(null===(i=this._schedule)||void 0===i?void 0:i.getPostroll());if(!r||this.adapter.canDismissNonLinear()||-1===t)if(this._schedule.waitForLoad(t,r,this.opts.preload_ads))this._state.toggleState(oe.FETCHING_AD,!1);else if(r!==this._schedule.getPostroll()||(this._schedule.setPostrollActive(),-1===t))if(this._schedule.isDrained()||this._schedule.increment(),r){Ie("Ads.fetchNextAd",r),this._state.toggleState(oe.FETCHING_AD,!0);try{return await this.requestAd(r),this._state.toggleState(oe.AD_AVAILABLE,!0),void this._state.toggleState(oe.FETCHING_AD,!1)}catch(s){return Ie("Ads.fetchNextAd(err: %o, ad: %o)",s,r),this.setLastAd(r),r!==this._schedule.getPostroll()?await this.fetchNextAd(t,++e):void this._state.toggleState(oe.FETCHING_AD,!1)}}else this._state.toggleState(oe.FETCHING_AD,!1);else this._state.toggleState(oe.FETCHING_AD,!1)}skipAdsOnSeek(t){if(!this._schedule)return;let e=this._schedule.getNextAd();for(;e&&e.time<t;)this._schedule.increment(),e=this._schedule.getNextAd()}async setCurrentTime(t,e=!1,s=!1){if(!this._schedule)return;if(!this.adapter.isReady())return;if(this._state.hasAny(oe.FETCHING_AD))return;if(this._state.hasAny(oe.PLAYING)&&this.adapter.isLinearAd())return;const i=0===t&&0===this._schedule.getNextIndex();try{if(s&&!this.opts.show_all_ads_on_seek&&this.skipAdsOnSeek(t),this._state.hasAny(oe.AD_AVAILABLE)||await this.fetchNextAd(t),!this._state.hasAny(oe.AD_AVAILABLE)||!this.shallPlayAd(t)||e)return;await this.playAd(),await this.setCurrentTime(t),this.checkIfBreakComplete()}catch(t){Ie("setCurrentTime: Error(from: setCurrentTime, message: %s)",t.message)}finally{i&&this.trigger(I)}}async playAd(){var t;if(!this._state.hasAny(oe.AD_AVAILABLE))return;this._state.toggleState(oe.AD_AVAILABLE,!1),this._state.toggleState(oe.BREAK_ACTIVE,!0);const e=null===(t=this._schedule)||void 0===t?void 0:t.getCurrentAd();try{await this.adapter.playAd()}catch(t){console.error("Ads.playAd: error",t)}finally{e&&this.setLastAd(e)}}checkIfBreakComplete(){if(!this._state.hasAny(oe.BREAK_ACTIVE))return Ie("Ads.checkIfBreakComplete(:bail, ad: %o)",this.getLastAd());Ie("Ads.checkIfBreakComplete(:run, ad: %o)",this.getLastAd()),this._state.toggleState(oe.BREAK_ACTIVE,!1),this.adapter.isAdPod()||this.trigger(k)}resetScheduleCounter(){this._schedule&&this._schedule.resetCounter()}setSchedule(t,e){if(e&&!isNaN(e)&&this._schedule&&this._schedule.updateContentDuration(e),this._schedule&&this._schedule.getNextIndex()>0)return this._schedule.setAds(t);this._schedule=new Schedule(t,{preload_advance:this.opts.preload_advance,content_duration:e?0:e})}toJSON(){return this._schedule?this._schedule.toJSON():[]}trigger(t,e={}){var s;if(!this.adapter.getVideoTag())return;if(!this._state)return;if(t===k&&this._state.hasAny(oe.BREAK_ACTIVE)&&!this.adapter.isAdPod()&&!e.force)return Ie("skipping AD_BREAK_COMPLETE reason: %s pod=%s",this._state.toString(),this.adapter.isAdPod());if(null===(i=e)||"object"!=typeof i||ae(i)!==re)return this.dispatch(t,e);var i;const r=Object.assign({},this.adapter.getOpts()||{},(null===(s=this._schedule)||void 0===s?void 0:s.getCurrentAd())||{},{ad_type:this.ad_type},e);return this.dispatch(t,r)}dispatch(t,e){const s=this.adapter.getVideoTag();if(s){Ie(":dispatch",t,e),this.adapter.isAdPod()&&"object"==typeof e&&"time"in e&&"preroll"!==e.ad_type&&(e.time=this.adapter.getAdBreakTime());try{const i={event:"ads/"+t,detail:{outstream:e.outstream,ad_type:e.ad_type,ad_break_time:e.time,ad_remaining_seconds:e.remaining,ad_muted:e.muted,ad_duration_seconds:e.duration,ad_error_reason:e.reason,ad_vast_error:e.vast_error,ad_vast_error_type:e.vast_error_type,ad_request_load_type:e.request_load_time}};s.dispatchEvent(new CustomEvent("health:record",{detail:i}))}catch(t){Ie(":error",t)}ct(s,t,e),this.emit(t,e)}}get ad_type(){if(!this.videoTag)return;if(!this.adapter.isAdPod())return this._schedule&&this._schedule.getCurrentType();const t=this.adapter.getAdBreakTime();return-1===t?"postroll":this.videoTag.hasState(nt)||t<1?"preroll":"midroll"}shouldRestartContent(){if(this.getIsContentProcessingNewSrc())return!1;if(this.adapter.isAdPod())return!0;const t=this.getLastAd();return!t||!t.outstream&&!1!==t.restart}async finished(t){if(this._schedule&&(Ie("Ads.finished"),!(this.adapter.isCustomPlaybackEnabled()&&this._state.hasAny(oe.PLAYING)&&this.adapter.isLinearAd()))){Ie("Ads.finished: trying to play postroll");try{if(!this._schedule.getPostroll())return Ie("Ads.finished: no postroll found"),await this.adapter.contentComplete();this._state.hasAny(oe.AD_AVAILABLE)||await this.fetchNextAd(-1),await this.playAd(),this.adapter.contentComplete()}catch(t){Ie("Ads.finished: postroll failed:",t)}finally{this.trigger(D),this.checkIfBreakComplete(),"function"==typeof t&&t()}}}hasPreroll(){return this._schedule&&Schedule.hasPreroll(this._schedule.getAds())}shallPlayAd(t){var e;return(!this.adapter||!this.adapter.isAdPod())&&(!(!this._state||this._state.hasAny(oe.FATAL_ERROR))&&!!(null===(e=this._schedule)||void 0===e?void 0:e.shallPlayAd(t)))}setLastAd(t){return this._lastAd=t,this}setIsContentProcessingNewSrc(t){this.content_processing_src=t}getLastAd(){return this._lastAd}getIsContentProcessingNewSrc(){return this.content_processing_src}mergeMacros(t={}){return this._macros=this._macros.fork(Object.assign({},t)),this}get paused(){return this.adapter&&this.adapter.isPaused()}pause(){this.adapter&&this.adapter.pause()}resume(){this.adapter&&this.adapter.resume()}resize(t){this.adapter&&this.adapter.onResize(t)}async requestAd(t,e=0,s=this.opts.timeout){if(!this._state)return;Ie("Ads.requestAd(ad: %o)",{ad:t,timeout:s,idx:e});const i=await ie(t);if(void 0===i[e])return setTimeout(()=>this.trigger(_),0),Promise.reject(new Error("Ad failed, no fallbacks left"));if(!i[e])return await this.requestAd(i,e+1,s);this.trigger(y,t);const r=this._macros.compile(i[e],te(this.opts,this.adapter.getDimensions()));try{return void await this.adapter.initAd(r,s)}catch(t){return Ie(`Ads.requestAd(:fallback, idx: ${e}, length: ${i.length}, adTag: ${i[e]})\nError `,{adTag:i,err:t}),this.requestAd(i,e+1,s)}}resetSchedule(t){this._schedule&&this._schedule.reset(t)}get adPlaying(){return this._state&&this._state.hasAny(oe.PLAYING)}get adBreak(){return this._state&&this._state.hasAny(oe.BREAK_ACTIVE)}get adRequesting(){return this._state.hasAny(oe.FETCHING_AD)}get adLinear(){return this.adBreak&&this.adapter.isLinearAd()}}var Ne=new Blob([new Uint8Array([255,227,24,196,0,0,0,3,72,1,64,0,0,4,132,16,31,227,192,225,76,255,67,12,255,221,27,255,228,97,73,63,255,195,131,69,192,232,223,255,255,207,102,239,255,255,255,101,158,206,70,20,59,255,254,95,70,149,66,4,16,128,0,2,2,32,240,138,255,36,106,183,255,227,24,196,59,11,34,62,80,49,135,40,0,253,29,191,209,200,141,71,7,255,252,152,74,15,130,33,185,6,63,255,252,195,70,203,86,53,15,255,255,247,103,76,121,64,32,47,255,34,227,194,209,138,76,65,77,69,51,46,57,55,170,170,170,170,170,170,170,170,170,170,255,227,24,196,73,13,153,210,100,81,135,56,0,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170])],{type:"audio/mpeg"}),Ue=new Blob([new Uint8Array([0,0,0,28,102,116,121,112,105,115,111,109,0,0,2,0,105,115,111,109,105,115,111,50,109,112,52,49,0,0,0,8,102,114,101,101,0,0,2,239,109,100,97,116,33,16,5,32,164,27,255,192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,55,167,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,112,33,16,5,32,164,27,255,192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,55,167,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,112,0,0,2,194,109,111,111,118,0,0,0,108,109,118,104,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,232,0,0,0,47,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,1,236,116,114,97,107,0,0,0,92,116,107,104,100,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,47,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,36,101,100,116,115,0,0,0,28,101,108,115,116,0,0,0,0,0,0,0,1,0,0,0,47,0,0,0,0,0,1,0,0,0,0,1,100,109,100,105,97,0,0,0,32,109,100,104,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,172,68,0,0,8,0,85,196,0,0,0,0,0,45,104,100,108,114,0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0,0,0,1,15,109,105,110,102,0,0,0,16,115,109,104,100,0,0,0,0,0,0,0,0,0,0,0,36,100,105,110,102,0,0,0,28,100,114,101,102,0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1,0,0,0,211,115,116,98,108,0,0,0,103,115,116,115,100,0,0,0,0,0,0,0,1,0,0,0,87,109,112,52,97,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,2,0,16,0,0,0,0,172,68,0,0,0,0,0,51,101,115,100,115,0,0,0,0,3,128,128,128,34,0,2,0,4,128,128,128,20,64,21,0,0,0,0,1,244,0,0,1,243,249,5,128,128,128,2,18,16,6,128,128,128,1,2,0,0,0,24,115,116,116,115,0,0,0,0,0,0,0,1,0,0,0,2,0,0,4,0,0,0,0,28,115,116,115,99,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,2,0,0,0,1,0,0,0,28,115,116,115,122,0,0,0,0,0,0,0,0,0,0,0,2,0,0,1,115,0,0,1,116,0,0,0,20,115,116,99,111,0,0,0,0,0,0,0,1,0,0,0,44,0,0,0,98,117,100,116,97,0,0,0,90,109,101,116,97,0,0,0,0,0,0,0,33,104,100,108,114,0,0,0,0,0,0,0,0,109,100,105,114,97,112,112,108,0,0,0,0,0,0,0,0,0,0,0,0,45,105,108,115,116,0,0,0,37,169,116,111,111,0,0,0,29,100,97,116,97,0,0,0,1,0,0,0,0,76,97,118,102,53,54,46,52,48,46,49,48,49])],{type:"video/mp4"});function xe(t){return Object.assign({muted:!1,timeout:250,inline:!1},t)}function Fe(t,e){var s=t.muted,i=t.timeout,r=t.inline,a=e(),n=a.element,o=a.source,d=void 0,l=void 0,c=void 0;return n.muted=s,!0===s&&n.setAttribute("muted","muted"),!0===r&&n.setAttribute("playsinline","playsinline"),n.src=o,new Promise(function(t){d=n.play(),l=setTimeout(function(){c(!1,new Error("Timeout "+i+" ms has been reached"))},i),c=function(e){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;n.remove(),n.srcObject=null,clearTimeout(l),t({result:e,error:s})},void 0!==d?d.then(function(){return c(!0)}).catch(function(t){return c(!1,t)}):c(!0)})}var Be={audio:function(t){return Fe(t=xe(t),function(){return{element:document.createElement("audio"),source:URL.createObjectURL(Ne)}})},video:function(t){return Fe(t=xe(t),function(){return{element:document.createElement("video"),source:URL.createObjectURL(Ue)}})}};let je;async function qe(t=!0){return je||(je=await Be.video({timeout:500,muted:t}),je)}const He=new Blob([new Uint8Array([0,0,0,28,102,116,121,112,105,115,111,109,0,0,2,0,105,115,111,109,105,115,111,50,109,112,52,49,0,0,0,8,102,114,101,101,0,0,2,239,109,100,97,116,33,16,5,32,164,27,255,192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,55,167,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,112,33,16,5,32,164,27,255,192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,55,167,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,112,0,0,2,194,109,111,111,118,0,0,0,108,109,118,104,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,232,0,0,0,47,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,1,236,116,114,97,107,0,0,0,92,116,107,104,100,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,47,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,36,101,100,116,115,0,0,0,28,101,108,115,116,0,0,0,0,0,0,0,1,0,0,0,47,0,0,0,0,0,1,0,0,0,0,1,100,109,100,105,97,0,0,0,32,109,100,104,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,172,68,0,0,8,0,85,196,0,0,0,0,0,45,104,100,108,114,0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0,0,0,1,15,109,105,110,102,0,0,0,16,115,109,104,100,0,0,0,0,0,0,0,0,0,0,0,36,100,105,110,102,0,0,0,28,100,114,101,102,0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1,0,0,0,211,115,116,98,108,0,0,0,103,115,116,115,100,0,0,0,0,0,0,0,1,0,0,0,87,109,112,52,97,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,2,0,16,0,0,0,0,172,68,0,0,0,0,0,51,101,115,100,115,0,0,0,0,3,128,128,128,34,0,2,0,4,128,128,128,20,64,21,0,0,0,0,1,244,0,0,1,243,249,5,128,128,128,2,18,16,6,128,128,128,1,2,0,0,0,24,115,116,116,115,0,0,0,0,0,0,0,1,0,0,0,2,0,0,4,0,0,0,0,28,115,116,115,99,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,2,0,0,0,1,0,0,0,28,115,116,115,122,0,0,0,0,0,0,0,0,0,0,0,2,0,0,1,115,0,0,1,116,0,0,0,20,115,116,99,111,0,0,0,0,0,0,0,1,0,0,0,44,0,0,0,98,117,100,116,97,0,0,0,90,109,101,116,97,0,0,0,0,0,0,0,33,104,100,108,114,0,0,0,0,0,0,0,0,109,100,105,114,97,112,112,108,0,0,0,0,0,0,0,0,0,0,0,0,45,105,108,115,116,0,0,0,37,169,116,111,111,0,0,0,29,100,97,116,97,0,0,0,1,0,0,0,0,76,97,118,102,53,54,46,52,48,46,49,48,49])],{type:"video/mp4"});var Ve=Object.freeze({__proto__:null,STICKY_CONTROLS:1,NO_FULLSCREEN:2,NO_AD_INDICATOR:4,AD_ATTRIBUTION:8,AD_CHOICES:16,REMAINING_TIME:32,VOLUME_BAR:64});const ze=["progress","duration","remaining"];class AdUI extends HTMLElement{static get observedAttributes(){return ze}constructor(t){super(),this.player=t,this.className="fp-ad-ui",this.append(...t.createComponents(wt,Et)),t.on(Q,t=>{let{ui_flags:e}=t.detail;if(e=e||0,(8&e)>0){const t=document.createElement("div");t.classList.add("ad-attribution"),t.textContent=this.player.i18n("ads.advertisement","Advertisement"),this.append(t)}})}}const Ge=vt("fpads:native:outstream"),We={OUTSTREAM:"is-outstream",HIDDEN:"is-outstream-hidden",SHOWING:"is-outstream-visible",DONE:"is-outstream-done"};var Qe,$e;!function(t){t.OUTSTREAM_VISIBLE="ads-outstream-visible",t.OUTSTREAM_VIEWPORT_UPDATE="ads-outstream-viewport-update",t.OUTSTREAM_TEARDOWN="ads-outstream-teardown",t.OUTSTREAM_ENDSCREEN_READY="ads-outstream-endscreen-ready"}(Qe||(Qe={})),function(t){t[t.None=0]="None",t[t.Booting=1]="Booting",t[t.Ready=2]="Ready",t[t.Disposed=3]="Disposed"}($e||($e={}));class Outstream{constructor({ads:t,root:e,content:s,ima:i}){this.state=$e.None,Ge("creating Outstream instance"),this.content=s,this.ads=t,this.root=e,this.ima=i,this.aspectRatio=s.videoHeight/s.videoWidth,this.dimensions=function(t){if(t.clientWidth>0||t.clientHeight)return h(t);const e={height:t.style.height};p(t,"opacity",0),p(t,"display","absolute"),p(t,"display","inline-block"),p(t,"height","auto");const s=h(t);return p(t,"height",e.height),p(t,"opacity",1),s}(this.root),this.adUi=new AdUI(s),this.initialVolumeState={},e.classList.add(We.OUTSTREAM),e.append(this.adUi),this.hide(),this.ads.on(b,t=>{var e;if(this.state==$e.Disposed)return;const s=!!(null===(e=t.detail)||void 0===e?void 0:e.linear);this.ads.resize(Object.assign(Object.assign({},this.dimensions),{linear:s}))}),s.on(Y,t=>{if(this.state==$e.Disposed)return;const e=t.detail;e&&(this.dimensions={width:e.contentRect.width,height:e.contentRect.height},this.ads.resize(this.dimensions))});let r=1,a=!0;s.on("intersectionchange",t=>{if(this.state==$e.Disposed)return;const e=t.detail;if(e)switch(this.state){case $e.Booting:return Ge(":boot skipping intersectionchange");case $e.None:return this.state=$e.Booting,this.begin_life_cycle();case $e.Ready:if(r=e.ratio,e.ratio>=.5&&this.ads.adPlaying)return;e.ratio>=.5&&a&&this.ads.resume(),e.ratio<.5&&this.ads.pause()}}),this.content.on(S,()=>a=r<.5),this.setup(),setTimeout(()=>(this.state=$e.Booting,this.begin_life_cycle()),0)}hide(){return this}restore_aspect_ratio(){return Ge(`Outstream.restore_aspect_ratio(${this.aspectRatio})`),this.content.setOpts({ratio:this.aspectRatio}),this}show(){this.root.classList.remove(Outstream.CLASS.HIDDEN),this.root.classList.add(Outstream.CLASS.SHOWING),this.content.setState("ad-linear",!0)}async begin_life_cycle(){var t;this.state=$e.Ready;const{error:e,result:s}=await qe(!1),{result:i}=await qe(!0);this.content.emit(Q,{ui_flags:null===(t=this.content.opts.ads)||void 0===t?void 0:t.ui}),this.attach_ad_listeners(),this.initialVolumeState={can_autoplay:!(!s&&!i),muted:!s},Ge(`Outstream.show() :autoplay >> sound=${s}`),e&&this.content&&!s&&(this.content.muted=!0,this.content.volume=0),await this.ads.setVideoTag(this.content),await Rt({ads:this.ads,content:this.content,adContainer:this.adUi,ima:this.ima,state:{listening:!1},config:this.content.opts}),It({content:this.content,ads:this.ads}),this.state=$e.Ready}attach_ad_listeners(){this.ads.once(b,()=>{this.show(),this.ads.adPlaying&&this.ads.pause()});const t=()=>{Lt.forEach(e=>this.ads.removeListener(e,t));const e=new CustomEvent(Qe.OUTSTREAM_TEARDOWN);Ge("Outstream(:teardown)",e),this.content.dispatchEvent(e)};Lt.forEach(e=>this.ads.once(e,t)),this.content.once(Qe.OUTSTREAM_TEARDOWN,t=>{setTimeout(()=>{if(t.defaultPrevented)return this.handle_endscreen();this.dispose()},0)})}handle_endscreen(){this.reset_ui(),this.ads.reset(),kt({config:this.content.opts,ui:this.adUi,ads:this.ads,adContainer:this.adUi,ima:this.ima,content:this.content,root:this.content.root,state:{started:!0,listening:!1},initial:{muted:!0,volume:1}})}empty_src(){this.content.setSrc({type:"video/mp4",src:URL.createObjectURL(He)})}setup(){this.root.classList.add(Outstream.CLASS.OUTSTREAM),this.root.classList.add(Outstream.CLASS.HIDDEN),this.content.setState("ad-linear",!1),this.empty_src()}reset_ui(){const t=this.root;t.classList.remove(Outstream.CLASS.SHOWING),t.classList.remove(Outstream.CLASS.OUTSTREAM)}dispose(){if(this.state==$e.Disposed)return;const t=this.root,e=this.content;this.reset_ui(),t.classList.add(Outstream.CLASS.OUTSTREAM),t.classList.add(Outstream.CLASS.DONE);const s=this;s.video=s.container=s.ads=0,this.state=$e.Disposed,e.destroy(),t.innerHTML=""}}function Ke(t){return t&&"number"==typeof t.time}function Ye(t){return t&&"number"==typeof t.percentage&&"number"!=typeof t.time}Outstream.CLASS=We;const Ze=vt("ads/ima/sdk");var Je;async function Xe(t,e){var s;const i=null===(s=null===window||void 0===window?void 0:window.google)||void 0===s?void 0:s.ima;if(e?null==i?void 0:i.dai:i)return void Ze(":noop");const r=e?"https://imasdk.googleapis.com/js/sdkloader/ima3_dai.js":t._storage.getItem("ima/debug")?"https://imasdk.googleapis.com/js/sdkloader/ima3_debug.js":"https://imasdk.googleapis.com/js/sdkloader/ima3.js";try{return await async function(t){return new Promise((e,s)=>{let i=document.querySelector(`script[src='${t}']`);if(i)return ts(i,e,s);i=document.createElement("script"),i.setAttribute("state",Je.LOADING),ts(i,e,s),i.src=t,document.head.appendChild(i)})}(r),void Ze(":loaded")}catch(t){Ze(`:error ${t.message}`,t)}}function ts(t,e,s){const i=t.getAttribute("state");if(i&&[Je.ERROR,Je.LOADED].includes(i))return e(void 0);t.addEventListener("load",()=>{t.setAttribute("state",Je.LOADED),e(void 0)},{once:!0}),["error","abort"].forEach(e=>{t.addEventListener(e,()=>{t.setAttribute("state",Je.ERROR),s("script failed to load")},{once:!0})})}!function(t){t.LOADING="loading",t.LOADED="loaded",t.ERROR="error"}(Je||(Je={}));const es=1;var ss;!function(t){t.LOADING="loading",t.LOADED="loaded",t.ERROR="error"}(ss||(ss={}));const is=vt("ads/ima/sdk"),rs="https://cdn.jsdelivr.net/npm/prebid.js@latest/dist/not-for-prod/prebid.js",as=rs;async function ns(t){var e;const s=t._storage.getItem("prebid/debug")?rs:as;if(null===(e=null===window||void 0===window?void 0:window.pbjs)||void 0===e?void 0:e.version)is(":noop");else if(!document.querySelector(`script[src='${s}']`))try{return await async function(t){return new Promise((e,s)=>{let i=document.querySelector(`script[src='${t}']`);i||(i=document.createElement("script")),i.setAttribute("state",ss.LOADING);const r=i.getAttribute("state");if(r&&[ss.ERROR,ss.LOADED].includes(r))return e(void 0);i.addEventListener("load",()=>{i.setAttribute("state",ss.LOADED),e(void 0)},{once:!0}),["error","abort"].forEach(t=>{i.addEventListener(t,()=>{i.setAttribute("state",ss.ERROR),s("script failed to load")},{once:!0})}),i.src=t,document.head.appendChild(i)})}(s),void is(":loaded")}catch(t){console.warn(`:error / failed to load prebid.js / ${t.message}`,t)}}const os=window.pbjs=window.pbjs||{};os.que=os.que||[];class PrebidAdController{constructor(t,e){this.player=t,this.config=e,this.player=t,this.bestOffer="",os.que.push(()=>{var s,i;const r=this.createAdUnit();os.addAdUnits(r);const a=(null===(i=null===(s=e.ads)||void 0===s?void 0:s.prebid)||void 0===i?void 0:i.pbjs)||{};os.setConfig(Object.assign({enableSendAllBids:!0},a)),t.emit($,{pbjs:os}),os.requestBids({bidsBackHandler:t=>{var s,i,a,n,o;const d=null===(s=t[this.prebidCode()])||void 0===s?void 0:s.bids;if(!d)return;if(0==d.length)return;const l=d[0];if(l&&l.vastUrl)return this.bestOffer=l.vastUrl;const c=os.adServers.dfp.buildVideoUrl({adUnit:r,params:{iu:null===(a=null===(i=e.ads)||void 0===i?void 0:i.prebid)||void 0===a?void 0:a.iu,cust_params:null===(o=null===(n=e.ads)||void 0===n?void 0:n.prebid)||void 0===o?void 0:o.custom_params,output:"vast"}});this.bestOffer=c}})})}prebidCode(){var t,e;return(null===(e=null===(t=this.config.ads)||void 0===t?void 0:t.prebid)||void 0===e?void 0:e.code)||this.player.root.id}videoInfo(){var t,e;return(null===(e=null===(t=this.config.ads)||void 0===t?void 0:t.prebid)||void 0===e?void 0:e.video)||{context:"instream",playerSize:[[this.player.videoWidth||640,this.player.videoHeight||480]]}}createAdUnit(){var t,e;return{code:this.prebidCode(),mediaTypes:{video:this.videoInfo()},bids:null===(e=null===(t=this.config.ads)||void 0===t?void 0:t.prebid)||void 0===e?void 0:e.bidders}}vastGenerator(){return async()=>this.bestOffer}}function ds(t,e){var s,i;const r=null===(s=e.ads)||void 0===s?void 0:s.prebid;if(!r)return;if((null===(i=t.prebidController)||void 0===i?void 0:i.config)===e)return;!function(t,{feature_name:e,behavior:s,sample_rate:i}){e&&(i||(i=es),t.emit("flowplayer:feature",{feature_name:e,behavior:s,sample_rate:i}))}(t,{feature_name:"prebid",behavior:"used"}),t.prebidController||(t.prebidController=new PrebidAdController(t,e),ns(t));const a=t.prebidController;if(a){const e=r.breaks.map(t=>({adTag:a.vastGenerator(),time:t}));t.setOpts({ima:{ads:e}})}}const ls=vt("ads/index");async function cs(t,e,s){var i;let r;if(s.on("config",()=>{var e,i,a;void 0===r&&t.autoplay&&!s.currentSrc&&(a=t.autoplay,r=!0===a?ut.ON:!1===a?ut.OFF:a,t.autoplay=0),(null===(e=t.ads)||void 0===e?void 0:e.prebid)&&ds(s,t),Array.isArray(null===(i=null==t?void 0:t.ima)||void 0===i?void 0:i.ads)&&qt(s)&&Object.assign(t,{hls:{native:!0}}),s.ads&&d()}),s.once("loadstart",()=>{setTimeout(()=>{var e;if(!Array.isArray(null===(e=null==t?void 0:t.ima)||void 0===e?void 0:e.ads)&&void 0!==r){if(t.autoplay=r,s.setState(dt,!0),!s.hasState(lt))return s.once(st,()=>s.togglePlay(!0));s.togglePlay(!0)}},0)}),await Xe(s),!("google"in window))return console.warn("google.ima unavailable");let a=!1;const n=s.ads=new AdsController,o=n.analytics;function d(){const i=t.ima;if(!i||!Array.isArray(i.ads))return;const d=t.duration||s.duration;if(i.ads=function(t,e){return Array.isArray(t)?t.filter(t=>Ke(t)||Ye(t)).reduce((t,s)=>{if(Ke(s))return t.push(s),t;if(s.lazy)return t.push(s),t;if(Ye(s)){const i=Object.assign({},s),r=s.percentage?s.percentage*e:0;return isNaN(r)||(i.time=r<0||r===e?-1:r),t.push(i),t}return t},[]):(console.warn("AdSchedule was not an Array"),[])}(i.ads,d),n.setSchedule(i.ads,d),t.metadata&&Analytics.mergeMetadata(o,t.metadata),t.metadata&&n.mergeMacros(t.metadata),t.metadata&&i.parameters&&(i.parameters=Object.assign(Object.assign({},i.parameters),t.metadata)),Analytics.mergeMetadata(o,{muted:t.muted||!1,autoplay:t.autoplay||!1}),!a){if(a=!0,t.lang&&!i.Locale&&(i.Locale=t.lang),Schedule.isOutstream(i.ads))return ls("is outstream, returning"),new Outstream({root:e,content:s,ads:n,ima:i});Ot({config:Object.assign(Object.assign({},t),{autoplay:r}),root:e,content:s,ads:n,ima:i})}}n.resize(h(e)),n.on(D,()=>{n.adapter.isCustomPlaybackEnabled()&&n.once(k,()=>{s.src=s.original_src,s.once("canplay",()=>{s.togglePlay(!1)}),s.webkitExitFullscreen()})}),s.on("reap",function(){n&&n.destroy()}),(null===(i=t.ads)||void 0===i?void 0:i.prebid)&&ds(s,t),d()}class AdControls extends HTMLElement{constructor(t){super(),this.player=t,this.classList.add("fp-ad-controls"),this.append(this.adRemainingTime(),yt(this.player,St),this.playbackButtons(),this.volumeBtn(),yt(this.player,"flowplayer-volume-bar"),...this.fullscreenIcons(),this.adChoices()),t.on(Q,this.applyStyleFlags.bind(this))}fullscreenIcons(){return this.player.createComponents("flowplayer-fullscreen-enter-icon","flowplayer-fullscreen-exit-icon").map(t=>(t.onclick=()=>this.player.toggleFullScreen(),t))}volumeBtn(){const t=yt(this.player,"flowplayer-volume-icon");return t.onclick=()=>this.player.emit(z),t}playbackButtons(){const t=document.createElement("div");t.classList.add("ad-playback-controls");const e=yt(this.player,"flowplayer-small-play-icon"),s=yt(this.player,"flowplayer-small-pause-icon");return e.addEventListener("click",()=>{this.player.emit(V),setTimeout(function(){s.focus&&s.focus()},100)}),s.addEventListener("click",()=>{this.player.emit(H),setTimeout(function(){e.focus&&e.focus()},100)}),t.append(e,s),t}adChoices(){const t=document.createElement("div");return t.classList.add("fp-ad-choices"),t.textContent=this.player.i18n("ads.adchoices","AdChoices"),t.addEventListener("click",t=>{t.preventDefault(),this.player.togglePlay(!1),window.open("https://adssettings.google.com","_blank")}),t}adRemainingTime(){const t=document.createElement("div");return t.classList.add("fp-ad-remaining","fp-color-text"),this.prepend(t),this.player.on(L,e=>{const s=e.detail.remaining;t.textContent=function(t){if(isNaN(t)||t>=Number.MAX_SAFE_INTEGER)return"";const e=t<0?"-":"";t=Math.round(Math.abs(t));const s=Math.floor(t/3600);let i=Math.floor(t/60);return t-=60*i,s>=1?(i-=60*s,e+s+":"+ht(i)+":"+ht(t)):e+ht(i)+":"+ht(t)}(parseFloat(s+""))}),t}applyStyleFlags(t){var e;const s=null!==(e=t.detail.ui_flags)&&void 0!==e?e:0;this.classList.toggle("is-ad-controls-sticky",(1&s)>0),this.classList.toggle("no-indicator",(4&s)>0),this.classList.toggle("is-ad-choices",(16&s)>0),this.classList.toggle("no-volume-bar",!(64&s)),this.classList.toggle("is-ad-remaining",(32&s)>0),this.classList.toggle("no-fullscreen",(2&s)>0)}}class AdCountdown extends HTMLElement{static get observedAttributes(){return["remaining"]}constructor(t){super(),this.player=t,this.className="fp-ad-countdown",t.on(L,t=>{const{duration:e,remaining:s}=t.detail;this.setAttribute("duration",e+""),this.setAttribute("remaining",s+"")}),t.on(w,t=>{t.detail.linear&&(this.style.setProperty("--ad-percent-previous","0"),this.style.setProperty("--ad-percent-complete","0"))}),this.addEventListener("animationend",()=>{const t=this.style.getPropertyValue("--ad-percent-complete")||"0";this.style.setProperty("--ad-percent-previous",t)})}attributeChangedCallback(t,e,s){if("remaining"===t)return this.onRemaining(s)}onRemaining(t){const e=parseFloat(this.getAttribute("duration")||"0");t||(t=e+"");const s=parseFloat(t),i=this.style.getPropertyValue("--ad-percent-complete")||"0";this.style.setProperty("--ad-percent-previous",i),this.classList.remove("go");const r=((e-s)/e*100).toFixed(3);requestAnimationFrame(()=>{this.style.setProperty("--ad-percent-complete",r),this.classList.add("go")})}}class AdIndicator extends HTMLElement{static get observedAttributes(){return["position","totals"]}constructor(t){super(),this.player=t,this.render(),t.on(w,t=>{const{position:e,totals:s}=t.detail.ad;this.setAttribute("position",e+""),this.setAttribute("totals",s+"")})}attributeChangedCallback(t,e){switch(t){case"position":case"totals":return this.updateText()}}updateText(){if(!this.element)return;const t=parseFloat(this.getAttribute("position")||"0"),e=parseFloat(this.getAttribute("totals")||"0");this.element.textContent=`${this.player.i18n("ads.indicator","ADS")} ${t} / ${e}`}render(){this.element=document.createElement("div"),this.element.classList.add("ad-indicator","fp-color-text"),this.element.textContent=this.player.i18n("ads.indicator","ADS"),this.append(this.element)}}var us,hs=Object.freeze({__proto__:null,SINGlE_INLINE_LINEAR:"https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/single_ad_samples&sz=640x480&cust_params=sample_ct%3Dlinear&ciu_szs=300x250%2C728x90&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator=",SINGLE_SKIPPABLE_INLINE:"https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/single_preroll_skippable&sz=640x480&ciu_szs=300x250%2C728x90&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator=",SINGLE_REDIRECT_LINEAR:"https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/single_ad_samples&sz=640x480&cust_params=sample_ct%3Dredirectlinear&ciu_szs=300x250%2C728x90&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator=",SINGLE_REDIRECT_ERROR:"https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/single_ad_samples&sz=640x480&cust_params=sample_ct%3Dredirecterror&ciu_szs=300x250%2C728x90&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator=",SINGLE_REDIRECT_BROKEN:"https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/single_ad_samples&sz=640x480&cust_params=sample_ct%3Dredirecterror&ciu_szs=300x250%2C728x90&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&nofb=1&correlator=",SINGLE_VPAID_20_LINEAR:"https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/single_ad_samples&sz=640x480&cust_params=sample_ct%3Dlinearvpaid2js&ciu_szs=300x250%2C728x90&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator=",SINGLE_VPAID_20_NON_LINEAR:"https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/single_ad_samples&sz=640x480&cust_params=sample_ct%3Dnonlinearvpaid2js&ciu_szs=728x90%2C300x250&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator=",SINGLE_NON_LINEAR_INLINE:"https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/nonlinear_ad_samples&sz=480x70&cust_params=sample_ct%3Dnonlinear&ciu_szs=300x250%2C728x90&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator=",VMAP_SESSION_AD_RULE_PREROLL:"https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/vmap_ad_samples&sz=640x480&cust_params=sar%3Da0f2&ciu_szs=300x250&ad_rule=1&gdfp_req=1&output=vmap&unviewed_position_start=1&env=vp&impl=s&correlator=",VMAP_PREROLL:"https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/vmap_ad_samples&sz=640x480&cust_params=sample_ar%3Dpreonly&ciu_szs=300x250%2C728x90&gdfp_req=1&ad_rule=1&output=vmap&unviewed_position_start=1&env=vp&impl=s&correlator=",VMAP_PREROLL_BUMPER:"https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/vmap_ad_samples&sz=640x480&cust_params=sample_ar%3Dpreonlybumper&ciu_szs=300x250&gdfp_req=1&ad_rule=1&output=vmap&unviewed_position_start=1&env=vp&impl=s&correlator=",VMAP_POSTROLL:"https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/vmap_ad_samples&sz=640x480&cust_params=sample_ar%3Dpostonly&ciu_szs=300x250&gdfp_req=1&ad_rule=1&output=vmap&unviewed_position_start=1&env=vp&impl=s&correlator=",VMAP_POSTROLL_BUMPER:"https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/vmap_ad_samples&sz=640x480&cust_params=sample_ar%3Dpostonlybumper&ciu_szs=300x250&gdfp_req=1&ad_rule=1&output=vmap&unviewed_position_start=1&env=vp&impl=s&correlator="});const{samsung_tv:ps}=u(),gs=(us=class Ads{constructor(t){this.umd=t,At(t,bt,AdUI),At(t,wt,AdControls),At(t,Et,AdCountdown),At(t,St,AdIndicator)}init(t,e,s){if(c.from_token(t.token||"").is_granted(c.permissions.ADS)&&!ps)return cs(t,e,s)}},us.pluginName="ads",us.events=K,us.ui=Ve,us.tags=hs,us);return function(t,e){if("object"==typeof exports&&"undefined"!=typeof module)return e;if(null===document.currentScript)return e;"flowplayer"in t||(t.flowplayer={extensions:[]});const s=t.flowplayer;return"function"==typeof s?(s(e),e):(Array.isArray(s.extensions)||(s.extensions=[]),~s.extensions.indexOf(e)||s.extensions.push(e),e)}(window,gs)});
|
|
7
|
+
*/const ye=class Bowser{static getParser(t,e=!1){if("string"!=typeof t)throw new Error("UserAgent should be a string");return new Parser(t,e)}static parse(t){return new Parser(t).getResult()}static get BROWSER_MAP(){return ce}static get ENGINE_MAP(){return pe}static get OS_MAP(){return he}static get PLATFORMS_MAP(){return ue}}.parse(window.navigator.userAgent),{platform:Ae,os:be,browser:we}=ye,Ee=t=>t&&t.toLowerCase();var Se={rnd:Math.random().toString(36).substr(2,32),os:Ee(be.name+(be.versionName?` ${be.versionName}`:"")),device:Ee(Ae.type),browser:Ee(we.name),browser_version:(we&&we.version?we.version:"unknown").split(".").shift(),plugin_version:"3.32.1-rc.1"};const Te="https://fp-eu-w1-aai.flowplayer.com/in",Le="POST",Oe=[y,v,A,E,w,q,O],Re=["event_type","ad_tag_id","media_id","player_id","site_id","sitegroup_id","rnd","os","device","browser","browser_version","plugin_version","player_version"],Me=["vast_error","reason","request_load_time","ad_type","vast_ad_id"],Pe=vt("ads/analytics"),ke=RequestQueue.of(),De=(...t)=>Object.assign({},...t);class Analytics{static of(t,e){return new Analytics(t,e)}static ensure_required_keys(t,e){return t.required_keys.filter(t=>!(t in e))}static pluck_valid_keys(t,e){return((t,...e)=>Object.keys(t).filter(t=>~e.indexOf(t)).reduce((e,s)=>Object.assign(e,{[s]:t[s]}),{}))(e,...t.valid_keys)}static mergeMetadata(t,e={}){return t.metadata=Analytics.pluck_valid_keys(t,De(t.metadata,e,{player_version:"3.32.1-rc.1"})),t}constructor(t,e={}){this.emitter=t,this.metadata=De(Se,e.metadata||{}),this.emitter=t,this.events=e.events||[],this.required_keys=e.required_keys||[],this.optional_keys=e.optional_keys||[],this.valid_keys=this.required_keys.slice(0).concat(this.optional_keys),Pe(this),this.wireup()}wireup(){this.events.forEach(t=>{this.emitter.on(t,e=>{const s=e.detail,i=De(this.metadata,{event_type:t},s),r=Analytics.pluck_valid_keys(this,i),a=Analytics.ensure_required_keys(this,r);if(Pe(`Event[${t}]`,{payload:r,observation:s}),a.length)return Pe(`Analytics.validate_metadata() failed for\n Event[${t}]\n missing keys: ${a}`,r);RequestQueue.rpush(ke,[Te,Le,r])})})}destroy(){const t=this;t.emitter=t.metadata=t.events=t.required_keys=t.optional_keys=t.valid_keys=void 0}}class EventBus{constructor(t=document.createElement("div"),e=[]){this._bus=t,this._listeners=e}removeAllListeners(){this._listeners.length=0,this._bus=document.createElement("div")}emit(t,e){const s=new CustomEvent(t,{detail:e||{}});this._bus.dispatchEvent(s)}on(t,e){this._listeners.push([t,e]),this._bus.addEventListener(t,e,{passive:!0})}once(t,e){this._bus.addEventListener(t,e,{once:!0})}removeListener(t,e){this._bus.removeEventListener(t,e)}}const Ie=vt("ads/controller"),Ce={show_all_ads_on_seek:!1,timeout:5e3,preload_advance:10};class AdsController extends EventBus{constructor(t={}){var e;super(),this.adapter=function(t,e){return t.adapter?new t.adapter(e):new IMA(e)}(t,this),this.opts=Object.assign(Object.assign({},Ce),t),this.analytics=(e=this,Analytics.of(e,{required_keys:Re,optional_keys:Me,events:Oe})),this._state=AdsState.of(),this._schedule=void 0,this._lastAd=void 0,this._macros=new Macros(t.parameters||{}),this.wireup(),this.content_processing_src=!1}reset(){return this.removeAllListeners(),this.wireup(),this.analytics&&this.analytics.wireup(),this._state.reset(),this.adapter.reset(),this}destroy(){this.removeAllListeners(),this.analytics&&this.analytics.destroy(),this.adapter&&this.adapter.destroy();const t=this;t.analytics=void 0,t.opts=void 0,t.adapter=void 0,t._state=void 0,t._schedule=void 0,t._lastAd=void 0,t._macros=void 0}stop(){this.adapter&&this.adapter.stop()}onContentNewSrc(){this._state.reset(),this.adapter.destroyManager(),this.adapter.contentComplete()}wireup(){const t=()=>{var t,e;this.adapter.onAdRequestEnd(),null===(t=this.videoTag)||void 0===t||t.setState("ad-paused",!1),null===(e=this.videoTag)||void 0===e||e.setState("ad-playing",!0),this._state.toggleState(oe.PLAYING,!0)};this.on(B,t),this.on(w,t),this.on(T,t);const e=t=>{var e,s;(null==t?void 0:t.type)!==v&&this.adapter.onAdRequestEnd(),null===(e=this.videoTag)||void 0===e||e.setState("ad-paused",(null==t?void 0:t.type)===S),null===(s=this.videoTag)||void 0===s||s.setState("ad-playing",!1),this.adPlaying&&this._state.toggleState(oe.PLAYING,!1)};this.on(k,e),this.on(_,e),this.on(m,e),this.on(v,e),this.on(S,e),this.on(O,e),this.on(E,e),this.on(k,()=>{requestAnimationFrame(()=>{this._state.toggleState(oe.BREAK_ACTIVE,!1)})}),this.on(F,()=>{console.error("Adapter init failed"),e(),this._state.toggleState(oe.FATAL_ERROR,!0)}),this.on(j,async t=>{if(Ie("Ads.on(RELOAD_AD_REQUESTED)",t),this._schedule){if(e(),t)return this._schedule.reset(this._schedule.getAds());this._state.hasAny(oe.AD_AVAILABLE)&&(this._schedule.decrement(),this._state.toggleState(oe.AD_AVAILABLE,!1))}})}async initialize(t,e={},s){return Ie("Ads.initialize():",t,e,s),this._state.toggleState(oe.INITIALIZING,!0),Object.assign(this.opts,e),Array.isArray(t)&&this.setSchedule(t),await this.adapter.init(this.opts),this._macros=this._macros.fork(Object.assign({},e.parameters||{},{autoplay:e.autoplay,muted:e.muted})),this.adapter.isReady()&&await this.adapterInitialized(s),this}get videoTag(){return this.adapter.getVideoTag()}get adInfo(){return this.adapter.getAdInfo()}async setVideoTag(t){Ie("Ads.setVideoTag():",t),await this.adapter.setVideoTag(t),this.trigger(f,t),this.adapter.isReady()&&await this.adapterInitialized(),t.on(H,()=>this.adapter.pause()),t.on(V,()=>this.adapter.resume()),t.on(z,()=>t.toggleMute()),t.on(Z,()=>{this.adapter.volume(t.muted?0:0==t.volume?.1:t.volume)}),t.on("src",()=>t.hasState("ad-playing")||t.hasState("ad-paused")?(this.stop(),this.adapter.isLinearAd()?(this.setIsContentProcessingNewSrc(!0),void this.once(k,()=>{setTimeout(()=>{this.setIsContentProcessingNewSrc(!1),this.onContentNewSrc()},0)})):this.onContentNewSrc()):this.onContentNewSrc())}waitForVideoTag(){return new Promise(t=>{const e=this.adapter.getVideoTag();if(e)return t(e);this.on(f,e=>{this.once(g,()=>t(e))})})}async adapterInitialized(t){Ie("Ads.adapterInitialized()"),this._state.toggleState(oe.INITIALIZING,!1),this._state.toggleState(oe.BREAK_ACTIVE,!!this.hasPreroll()),await this.setCurrentTime(0,t),this.checkIfBreakComplete(),this.adapter.isAdPod()||t&&!this.opts.autoplay||this.trigger(_)}async fetchNextAd(t,e=0){var s,i;if(!this._schedule)return;if(!this.adapter.isReady())return;if(e>50)throw this._state.toggleState(oe.FATAL_ERROR,!0),this._state.toggleState(oe.FETCHING_AD,!1),new Error("Ads.fetchNextAd() :max_recursion_depth");const r=(null===(s=this._schedule)||void 0===s?void 0:s.getNextAd())||(null===(i=this._schedule)||void 0===i?void 0:i.getPostroll());if(!r||this.adapter.canDismissNonLinear()||-1===t)if(this._schedule.waitForLoad(t,r,this.opts.preload_ads))this._state.toggleState(oe.FETCHING_AD,!1);else if(r!==this._schedule.getPostroll()||(this._schedule.setPostrollActive(),-1===t))if(this._schedule.isDrained()||this._schedule.increment(),r){Ie("Ads.fetchNextAd",r),this._state.toggleState(oe.FETCHING_AD,!0);try{return await this.requestAd(r),this._state.toggleState(oe.AD_AVAILABLE,!0),void this._state.toggleState(oe.FETCHING_AD,!1)}catch(s){return Ie("Ads.fetchNextAd(err: %o, ad: %o)",s,r),this.setLastAd(r),r!==this._schedule.getPostroll()?await this.fetchNextAd(t,++e):void this._state.toggleState(oe.FETCHING_AD,!1)}}else this._state.toggleState(oe.FETCHING_AD,!1);else this._state.toggleState(oe.FETCHING_AD,!1)}skipAdsOnSeek(t){if(!this._schedule)return;let e=this._schedule.getNextAd();for(;e&&e.time<t;)this._schedule.increment(),e=this._schedule.getNextAd()}async setCurrentTime(t,e=!1,s=!1){if(!this._schedule)return;if(!this.adapter.isReady())return;if(this._state.hasAny(oe.FETCHING_AD))return;if(this._state.hasAny(oe.PLAYING)&&this.adapter.isLinearAd())return;const i=0===t&&0===this._schedule.getNextIndex();try{if(s&&!this.opts.show_all_ads_on_seek&&this.skipAdsOnSeek(t),this._state.hasAny(oe.AD_AVAILABLE)||await this.fetchNextAd(t),!this._state.hasAny(oe.AD_AVAILABLE)||!this.shallPlayAd(t)||e)return;await this.playAd(),await this.setCurrentTime(t),this.checkIfBreakComplete()}catch(t){Ie("setCurrentTime: Error(from: setCurrentTime, message: %s)",t.message)}finally{i&&this.trigger(I)}}async playAd(){var t;if(!this._state.hasAny(oe.AD_AVAILABLE))return;this._state.toggleState(oe.AD_AVAILABLE,!1),this._state.toggleState(oe.BREAK_ACTIVE,!0);const e=null===(t=this._schedule)||void 0===t?void 0:t.getCurrentAd();try{await this.adapter.playAd()}catch(t){console.error("Ads.playAd: error",t)}finally{e&&this.setLastAd(e)}}checkIfBreakComplete(){if(!this._state.hasAny(oe.BREAK_ACTIVE))return Ie("Ads.checkIfBreakComplete(:bail, ad: %o)",this.getLastAd());Ie("Ads.checkIfBreakComplete(:run, ad: %o)",this.getLastAd()),this._state.toggleState(oe.BREAK_ACTIVE,!1),this.adapter.isAdPod()||this.trigger(k)}resetScheduleCounter(){this._schedule&&this._schedule.resetCounter()}setSchedule(t,e){if(e&&!isNaN(e)&&this._schedule&&this._schedule.updateContentDuration(e),this._schedule&&this._schedule.getNextIndex()>0)return this._schedule.setAds(t);this._schedule=new Schedule(t,{preload_advance:this.opts.preload_advance,content_duration:e?0:e})}toJSON(){return this._schedule?this._schedule.toJSON():[]}trigger(t,e={}){var s;if(!this.adapter.getVideoTag())return;if(!this._state)return;if(t===k&&this._state.hasAny(oe.BREAK_ACTIVE)&&!this.adapter.isAdPod()&&!e.force)return Ie("skipping AD_BREAK_COMPLETE reason: %s pod=%s",this._state.toString(),this.adapter.isAdPod());if(null===(i=e)||"object"!=typeof i||ae(i)!==re)return this.dispatch(t,e);var i;const r=Object.assign({},this.adapter.getOpts()||{},(null===(s=this._schedule)||void 0===s?void 0:s.getCurrentAd())||{},{ad_type:this.ad_type},e);return this.dispatch(t,r)}dispatch(t,e){const s=this.adapter.getVideoTag();if(s){Ie(":dispatch",t,e),this.adapter.isAdPod()&&"object"==typeof e&&"time"in e&&"preroll"!==e.ad_type&&(e.time=this.adapter.getAdBreakTime());try{const i={event:"ads/"+t,detail:{outstream:e.outstream,ad_type:e.ad_type,ad_break_time:e.time,ad_remaining_seconds:e.remaining,ad_muted:e.muted,ad_duration_seconds:e.duration,ad_error_reason:e.reason,ad_vast_error:e.vast_error,ad_vast_error_type:e.vast_error_type,ad_request_load_type:e.request_load_time}};s.dispatchEvent(new CustomEvent("health:record",{detail:i}))}catch(t){Ie(":error",t)}ct(s,t,e),this.emit(t,e)}}get ad_type(){if(!this.videoTag)return;if(!this.adapter.isAdPod())return this._schedule&&this._schedule.getCurrentType();const t=this.adapter.getAdBreakTime();return-1===t?"postroll":this.videoTag.hasState(nt)||t<1?"preroll":"midroll"}shouldRestartContent(){if(this.getIsContentProcessingNewSrc())return!1;if(this.adapter.isAdPod())return!0;const t=this.getLastAd();return!t||!t.outstream&&!1!==t.restart}async finished(t){if(this._schedule&&(Ie("Ads.finished"),!(this.adapter.isCustomPlaybackEnabled()&&this._state.hasAny(oe.PLAYING)&&this.adapter.isLinearAd()))){Ie("Ads.finished: trying to play postroll");try{if(!this._schedule.getPostroll())return Ie("Ads.finished: no postroll found"),await this.adapter.contentComplete();this._state.hasAny(oe.AD_AVAILABLE)||await this.fetchNextAd(-1),await this.playAd(),this.adapter.contentComplete()}catch(t){Ie("Ads.finished: postroll failed:",t)}finally{this.trigger(D),this.checkIfBreakComplete(),"function"==typeof t&&t()}}}hasPreroll(){return this._schedule&&Schedule.hasPreroll(this._schedule.getAds())}shallPlayAd(t){var e;return(!this.adapter||!this.adapter.isAdPod())&&(!(!this._state||this._state.hasAny(oe.FATAL_ERROR))&&!!(null===(e=this._schedule)||void 0===e?void 0:e.shallPlayAd(t)))}setLastAd(t){return this._lastAd=t,this}setIsContentProcessingNewSrc(t){this.content_processing_src=t}getLastAd(){return this._lastAd}getIsContentProcessingNewSrc(){return this.content_processing_src}mergeMacros(t={}){return this._macros=this._macros.fork(Object.assign({},t)),this}get paused(){return this.adapter&&this.adapter.isPaused()}pause(){this.adapter&&this.adapter.pause()}resume(){this.adapter&&this.adapter.resume()}resize(t){this.adapter&&this.adapter.onResize(t)}async requestAd(t,e=0,s=this.opts.timeout){if(!this._state)return;Ie("Ads.requestAd(ad: %o)",{ad:t,timeout:s,idx:e});const i=await ie(t);if(void 0===i[e])return setTimeout(()=>this.trigger(_),0),Promise.reject(new Error("Ad failed, no fallbacks left"));if(!i[e])return await this.requestAd(i,e+1,s);this.trigger(y,t);const r=this._macros.compile(i[e],te(this.opts,this.adapter.getDimensions()));try{return void await this.adapter.initAd(r,s)}catch(t){return Ie(`Ads.requestAd(:fallback, idx: ${e}, length: ${i.length}, adTag: ${i[e]})\nError `,{adTag:i,err:t}),this.requestAd(i,e+1,s)}}resetSchedule(t){this._schedule&&this._schedule.reset(t)}get adPlaying(){return this._state&&this._state.hasAny(oe.PLAYING)}get adBreak(){return this._state&&this._state.hasAny(oe.BREAK_ACTIVE)}get adRequesting(){return this._state.hasAny(oe.FETCHING_AD)}get adLinear(){return this.adBreak&&this.adapter.isLinearAd()}}var Ne=new Blob([new Uint8Array([255,227,24,196,0,0,0,3,72,1,64,0,0,4,132,16,31,227,192,225,76,255,67,12,255,221,27,255,228,97,73,63,255,195,131,69,192,232,223,255,255,207,102,239,255,255,255,101,158,206,70,20,59,255,254,95,70,149,66,4,16,128,0,2,2,32,240,138,255,36,106,183,255,227,24,196,59,11,34,62,80,49,135,40,0,253,29,191,209,200,141,71,7,255,252,152,74,15,130,33,185,6,63,255,252,195,70,203,86,53,15,255,255,247,103,76,121,64,32,47,255,34,227,194,209,138,76,65,77,69,51,46,57,55,170,170,170,170,170,170,170,170,170,170,255,227,24,196,73,13,153,210,100,81,135,56,0,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170])],{type:"audio/mpeg"}),Ue=new Blob([new Uint8Array([0,0,0,28,102,116,121,112,105,115,111,109,0,0,2,0,105,115,111,109,105,115,111,50,109,112,52,49,0,0,0,8,102,114,101,101,0,0,2,239,109,100,97,116,33,16,5,32,164,27,255,192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,55,167,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,112,33,16,5,32,164,27,255,192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,55,167,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,112,0,0,2,194,109,111,111,118,0,0,0,108,109,118,104,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,232,0,0,0,47,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,1,236,116,114,97,107,0,0,0,92,116,107,104,100,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,47,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,36,101,100,116,115,0,0,0,28,101,108,115,116,0,0,0,0,0,0,0,1,0,0,0,47,0,0,0,0,0,1,0,0,0,0,1,100,109,100,105,97,0,0,0,32,109,100,104,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,172,68,0,0,8,0,85,196,0,0,0,0,0,45,104,100,108,114,0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0,0,0,1,15,109,105,110,102,0,0,0,16,115,109,104,100,0,0,0,0,0,0,0,0,0,0,0,36,100,105,110,102,0,0,0,28,100,114,101,102,0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1,0,0,0,211,115,116,98,108,0,0,0,103,115,116,115,100,0,0,0,0,0,0,0,1,0,0,0,87,109,112,52,97,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,2,0,16,0,0,0,0,172,68,0,0,0,0,0,51,101,115,100,115,0,0,0,0,3,128,128,128,34,0,2,0,4,128,128,128,20,64,21,0,0,0,0,1,244,0,0,1,243,249,5,128,128,128,2,18,16,6,128,128,128,1,2,0,0,0,24,115,116,116,115,0,0,0,0,0,0,0,1,0,0,0,2,0,0,4,0,0,0,0,28,115,116,115,99,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,2,0,0,0,1,0,0,0,28,115,116,115,122,0,0,0,0,0,0,0,0,0,0,0,2,0,0,1,115,0,0,1,116,0,0,0,20,115,116,99,111,0,0,0,0,0,0,0,1,0,0,0,44,0,0,0,98,117,100,116,97,0,0,0,90,109,101,116,97,0,0,0,0,0,0,0,33,104,100,108,114,0,0,0,0,0,0,0,0,109,100,105,114,97,112,112,108,0,0,0,0,0,0,0,0,0,0,0,0,45,105,108,115,116,0,0,0,37,169,116,111,111,0,0,0,29,100,97,116,97,0,0,0,1,0,0,0,0,76,97,118,102,53,54,46,52,48,46,49,48,49])],{type:"video/mp4"});function xe(t){return Object.assign({muted:!1,timeout:250,inline:!1},t)}function Fe(t,e){var s=t.muted,i=t.timeout,r=t.inline,a=e(),n=a.element,o=a.source,d=void 0,l=void 0,c=void 0;return n.muted=s,!0===s&&n.setAttribute("muted","muted"),!0===r&&n.setAttribute("playsinline","playsinline"),n.src=o,new Promise(function(t){d=n.play(),l=setTimeout(function(){c(!1,new Error("Timeout "+i+" ms has been reached"))},i),c=function(e){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;n.remove(),n.srcObject=null,clearTimeout(l),t({result:e,error:s})},void 0!==d?d.then(function(){return c(!0)}).catch(function(t){return c(!1,t)}):c(!0)})}var Be={audio:function(t){return Fe(t=xe(t),function(){return{element:document.createElement("audio"),source:URL.createObjectURL(Ne)}})},video:function(t){return Fe(t=xe(t),function(){return{element:document.createElement("video"),source:URL.createObjectURL(Ue)}})}};let je;async function qe(t=!0){return je||(je=await Be.video({timeout:500,muted:t}),je)}const He=new Blob([new Uint8Array([0,0,0,28,102,116,121,112,105,115,111,109,0,0,2,0,105,115,111,109,105,115,111,50,109,112,52,49,0,0,0,8,102,114,101,101,0,0,2,239,109,100,97,116,33,16,5,32,164,27,255,192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,55,167,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,112,33,16,5,32,164,27,255,192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,55,167,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,112,0,0,2,194,109,111,111,118,0,0,0,108,109,118,104,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,232,0,0,0,47,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,1,236,116,114,97,107,0,0,0,92,116,107,104,100,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,47,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,36,101,100,116,115,0,0,0,28,101,108,115,116,0,0,0,0,0,0,0,1,0,0,0,47,0,0,0,0,0,1,0,0,0,0,1,100,109,100,105,97,0,0,0,32,109,100,104,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,172,68,0,0,8,0,85,196,0,0,0,0,0,45,104,100,108,114,0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0,0,0,1,15,109,105,110,102,0,0,0,16,115,109,104,100,0,0,0,0,0,0,0,0,0,0,0,36,100,105,110,102,0,0,0,28,100,114,101,102,0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1,0,0,0,211,115,116,98,108,0,0,0,103,115,116,115,100,0,0,0,0,0,0,0,1,0,0,0,87,109,112,52,97,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,2,0,16,0,0,0,0,172,68,0,0,0,0,0,51,101,115,100,115,0,0,0,0,3,128,128,128,34,0,2,0,4,128,128,128,20,64,21,0,0,0,0,1,244,0,0,1,243,249,5,128,128,128,2,18,16,6,128,128,128,1,2,0,0,0,24,115,116,116,115,0,0,0,0,0,0,0,1,0,0,0,2,0,0,4,0,0,0,0,28,115,116,115,99,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,2,0,0,0,1,0,0,0,28,115,116,115,122,0,0,0,0,0,0,0,0,0,0,0,2,0,0,1,115,0,0,1,116,0,0,0,20,115,116,99,111,0,0,0,0,0,0,0,1,0,0,0,44,0,0,0,98,117,100,116,97,0,0,0,90,109,101,116,97,0,0,0,0,0,0,0,33,104,100,108,114,0,0,0,0,0,0,0,0,109,100,105,114,97,112,112,108,0,0,0,0,0,0,0,0,0,0,0,0,45,105,108,115,116,0,0,0,37,169,116,111,111,0,0,0,29,100,97,116,97,0,0,0,1,0,0,0,0,76,97,118,102,53,54,46,52,48,46,49,48,49])],{type:"video/mp4"});var Ve=Object.freeze({__proto__:null,STICKY_CONTROLS:1,NO_FULLSCREEN:2,NO_AD_INDICATOR:4,AD_ATTRIBUTION:8,AD_CHOICES:16,REMAINING_TIME:32,VOLUME_BAR:64});const ze=["progress","duration","remaining"];class AdUI extends HTMLElement{static get observedAttributes(){return ze}constructor(t){super(),this.player=t,this.className="fp-ad-ui",this.append(...t.createComponents(wt,Et)),t.on(Q,t=>{let{ui_flags:e}=t.detail;if(e=e||0,(8&e)>0){const t=document.createElement("div");t.classList.add("ad-attribution"),t.textContent=this.player.i18n("ads.advertisement","Advertisement"),this.append(t)}})}}const Ge=vt("fpads:native:outstream"),We={OUTSTREAM:"is-outstream",HIDDEN:"is-outstream-hidden",SHOWING:"is-outstream-visible",DONE:"is-outstream-done"};var Qe,$e;!function(t){t.OUTSTREAM_VISIBLE="ads-outstream-visible",t.OUTSTREAM_VIEWPORT_UPDATE="ads-outstream-viewport-update",t.OUTSTREAM_TEARDOWN="ads-outstream-teardown",t.OUTSTREAM_ENDSCREEN_READY="ads-outstream-endscreen-ready"}(Qe||(Qe={})),function(t){t[t.None=0]="None",t[t.Booting=1]="Booting",t[t.Ready=2]="Ready",t[t.Disposed=3]="Disposed"}($e||($e={}));class Outstream{constructor({ads:t,root:e,content:s,ima:i}){this.state=$e.None,Ge("creating Outstream instance"),this.content=s,this.ads=t,this.root=e,this.ima=i,this.aspectRatio=s.videoHeight/s.videoWidth,this.dimensions=function(t){if(t.clientWidth>0||t.clientHeight)return h(t);const e={height:t.style.height};p(t,"opacity",0),p(t,"display","absolute"),p(t,"display","inline-block"),p(t,"height","auto");const s=h(t);return p(t,"height",e.height),p(t,"opacity",1),s}(this.root),this.adUi=new AdUI(s),this.initialVolumeState={},e.classList.add(We.OUTSTREAM),e.append(this.adUi),this.hide(),this.ads.on(b,t=>{var e;if(this.state==$e.Disposed)return;const s=!!(null===(e=t.detail)||void 0===e?void 0:e.linear);this.ads.resize(Object.assign(Object.assign({},this.dimensions),{linear:s}))}),s.on(Y,t=>{if(this.state==$e.Disposed)return;const e=t.detail;e&&(this.dimensions={width:e.contentRect.width,height:e.contentRect.height},this.ads.resize(this.dimensions))});let r=1,a=!0;s.on("intersectionchange",t=>{if(this.state==$e.Disposed)return;const e=t.detail;if(e)switch(this.state){case $e.Booting:return Ge(":boot skipping intersectionchange");case $e.None:return this.state=$e.Booting,this.begin_life_cycle();case $e.Ready:if(r=e.ratio,e.ratio>=.5&&this.ads.adPlaying)return;e.ratio>=.5&&a&&this.ads.resume(),e.ratio<.5&&this.ads.pause()}}),this.content.on(S,()=>a=r<.5),this.setup(),setTimeout(()=>(this.state=$e.Booting,this.begin_life_cycle()),0)}hide(){return this}restore_aspect_ratio(){return Ge(`Outstream.restore_aspect_ratio(${this.aspectRatio})`),this.content.setOpts({ratio:this.aspectRatio}),this}show(){this.root.classList.remove(Outstream.CLASS.HIDDEN),this.root.classList.add(Outstream.CLASS.SHOWING),this.content.setState("ad-linear",!0)}async begin_life_cycle(){var t;this.state=$e.Ready;const{error:e,result:s}=await qe(!1),{result:i}=await qe(!0);this.content.emit(Q,{ui_flags:null===(t=this.content.opts.ads)||void 0===t?void 0:t.ui}),this.attach_ad_listeners(),this.initialVolumeState={can_autoplay:!(!s&&!i),muted:!s},Ge(`Outstream.show() :autoplay >> sound=${s}`),e&&this.content&&!s&&(this.content.muted=!0,this.content.volume=0),await this.ads.setVideoTag(this.content),await Rt({ads:this.ads,content:this.content,adContainer:this.adUi,ima:this.ima,state:{listening:!1},config:this.content.opts}),It({content:this.content,ads:this.ads}),this.state=$e.Ready}attach_ad_listeners(){this.ads.once(b,()=>{this.show(),this.ads.adPlaying&&this.ads.pause()});const t=()=>{Lt.forEach(e=>this.ads.removeListener(e,t));const e=new CustomEvent(Qe.OUTSTREAM_TEARDOWN);Ge("Outstream(:teardown)",e),this.content.dispatchEvent(e)};Lt.forEach(e=>this.ads.once(e,t)),this.content.once(Qe.OUTSTREAM_TEARDOWN,t=>{setTimeout(()=>{if(t.defaultPrevented)return this.handle_endscreen();this.dispose()},0)})}handle_endscreen(){this.reset_ui(),this.ads.reset(),kt({config:this.content.opts,ui:this.adUi,ads:this.ads,adContainer:this.adUi,ima:this.ima,content:this.content,root:this.content.root,state:{started:!0,listening:!1},initial:{muted:!0,volume:1}})}empty_src(){this.content.setSrc({type:"video/mp4",src:URL.createObjectURL(He)})}setup(){this.root.classList.add(Outstream.CLASS.OUTSTREAM),this.root.classList.add(Outstream.CLASS.HIDDEN),this.content.setState("ad-linear",!1),this.empty_src()}reset_ui(){const t=this.root;t.classList.remove(Outstream.CLASS.SHOWING),t.classList.remove(Outstream.CLASS.OUTSTREAM)}dispose(){if(this.state==$e.Disposed)return;const t=this.root,e=this.content;this.reset_ui(),t.classList.add(Outstream.CLASS.OUTSTREAM),t.classList.add(Outstream.CLASS.DONE);const s=this;s.video=s.container=s.ads=0,this.state=$e.Disposed,e.destroy(),t.innerHTML=""}}function Ke(t){return t&&"number"==typeof t.time}function Ye(t){return t&&"number"==typeof t.percentage&&"number"!=typeof t.time}Outstream.CLASS=We;const Ze=vt("ads/ima/sdk");var Je;async function Xe(t,e){var s;const i=null===(s=null===window||void 0===window?void 0:window.google)||void 0===s?void 0:s.ima;if(e?null==i?void 0:i.dai:i)return void Ze(":noop");const r=e?"https://imasdk.googleapis.com/js/sdkloader/ima3_dai.js":t._storage.getItem("ima/debug")?"https://imasdk.googleapis.com/js/sdkloader/ima3_debug.js":"https://imasdk.googleapis.com/js/sdkloader/ima3.js";try{return await async function(t){return new Promise((e,s)=>{let i=document.querySelector(`script[src='${t}']`);if(i)return ts(i,e,s);i=document.createElement("script"),i.setAttribute("state",Je.LOADING),ts(i,e,s),i.src=t,document.head.appendChild(i)})}(r),void Ze(":loaded")}catch(t){Ze(`:error ${t.message}`,t)}}function ts(t,e,s){const i=t.getAttribute("state");if(i&&[Je.ERROR,Je.LOADED].includes(i))return e(void 0);t.addEventListener("load",()=>{t.setAttribute("state",Je.LOADED),e(void 0)},{once:!0}),["error","abort"].forEach(e=>{t.addEventListener(e,()=>{t.setAttribute("state",Je.ERROR),s("script failed to load")},{once:!0})})}!function(t){t.LOADING="loading",t.LOADED="loaded",t.ERROR="error"}(Je||(Je={}));const es=1;var ss;!function(t){t.LOADING="loading",t.LOADED="loaded",t.ERROR="error"}(ss||(ss={}));const is=vt("ads/ima/sdk"),rs="https://cdn.jsdelivr.net/npm/prebid.js@latest/dist/not-for-prod/prebid.js",as=rs;async function ns(t){var e;const s=t._storage.getItem("prebid/debug")?rs:as;if(null===(e=null===window||void 0===window?void 0:window.pbjs)||void 0===e?void 0:e.version)is(":noop");else if(!document.querySelector(`script[src='${s}']`))try{return await async function(t){return new Promise((e,s)=>{let i=document.querySelector(`script[src='${t}']`);i||(i=document.createElement("script")),i.setAttribute("state",ss.LOADING);const r=i.getAttribute("state");if(r&&[ss.ERROR,ss.LOADED].includes(r))return e(void 0);i.addEventListener("load",()=>{i.setAttribute("state",ss.LOADED),e(void 0)},{once:!0}),["error","abort"].forEach(t=>{i.addEventListener(t,()=>{i.setAttribute("state",ss.ERROR),s("script failed to load")},{once:!0})}),i.src=t,document.head.appendChild(i)})}(s),void is(":loaded")}catch(t){console.warn(`:error / failed to load prebid.js / ${t.message}`,t)}}const os=window.pbjs=window.pbjs||{};os.que=os.que||[];class PrebidAdController{constructor(t,e){this.player=t,this.config=e,this.player=t,this.bestOffer="",os.que.push(()=>{var s,i;const r=this.createAdUnit();os.addAdUnits(r);const a=(null===(i=null===(s=e.ads)||void 0===s?void 0:s.prebid)||void 0===i?void 0:i.pbjs)||{};os.setConfig(Object.assign({enableSendAllBids:!0},a)),t.emit($,{pbjs:os}),os.requestBids({bidsBackHandler:t=>{var s,i,a,n,o;const d=null===(s=t[this.prebidCode()])||void 0===s?void 0:s.bids;if(!d)return;if(0==d.length)return;const l=d[0];if(l&&l.vastUrl)return this.bestOffer=l.vastUrl;const c=os.adServers.dfp.buildVideoUrl({adUnit:r,params:{iu:null===(a=null===(i=e.ads)||void 0===i?void 0:i.prebid)||void 0===a?void 0:a.iu,cust_params:null===(o=null===(n=e.ads)||void 0===n?void 0:n.prebid)||void 0===o?void 0:o.custom_params,output:"vast"}});this.bestOffer=c}})})}prebidCode(){var t,e;return(null===(e=null===(t=this.config.ads)||void 0===t?void 0:t.prebid)||void 0===e?void 0:e.code)||this.player.root.id}videoInfo(){var t,e;return(null===(e=null===(t=this.config.ads)||void 0===t?void 0:t.prebid)||void 0===e?void 0:e.video)||{context:"instream",playerSize:[[this.player.videoWidth||640,this.player.videoHeight||480]]}}createAdUnit(){var t,e;return{code:this.prebidCode(),mediaTypes:{video:this.videoInfo()},bids:null===(e=null===(t=this.config.ads)||void 0===t?void 0:t.prebid)||void 0===e?void 0:e.bidders}}vastGenerator(){return async()=>this.bestOffer}}function ds(t,e){var s,i;const r=null===(s=e.ads)||void 0===s?void 0:s.prebid;if(!r)return;if((null===(i=t.prebidController)||void 0===i?void 0:i.config)===e)return;!function(t,{feature_name:e,behavior:s,sample_rate:i}){e&&(i||(i=es),t.emit("flowplayer:feature",{feature_name:e,behavior:s,sample_rate:i}))}(t,{feature_name:"prebid",behavior:"used"}),t.prebidController||(t.prebidController=new PrebidAdController(t,e),ns(t));const a=t.prebidController;if(a){const e=r.breaks.map(t=>({adTag:a.vastGenerator(),time:t}));t.setOpts({ima:{ads:e}})}}const ls=vt("ads/index");async function cs(t,e,s){var i;let r;if(s.on("config",()=>{var e,i,a;void 0===r&&t.autoplay&&!s.currentSrc&&(a=t.autoplay,r=!0===a?ut.ON:!1===a?ut.OFF:a,t.autoplay=0),(null===(e=t.ads)||void 0===e?void 0:e.prebid)&&ds(s,t),Array.isArray(null===(i=null==t?void 0:t.ima)||void 0===i?void 0:i.ads)&&qt(s)&&Object.assign(t,{hls:{native:!0}}),s.ads&&d()}),s.once("loadstart",()=>{setTimeout(()=>{var e;if(!Array.isArray(null===(e=null==t?void 0:t.ima)||void 0===e?void 0:e.ads)&&void 0!==r){if(t.autoplay=r,s.setState(dt,!0),!s.hasState(lt))return s.once(st,()=>s.togglePlay(!0));s.togglePlay(!0)}},0)}),await Xe(s),!("google"in window))return console.warn("google.ima unavailable");let a=!1;const n=s.ads=new AdsController,o=n.analytics;function d(){const i=t.ima;if(!i||!Array.isArray(i.ads))return;const d=t.duration||s.duration;if(i.ads=function(t,e){return Array.isArray(t)?t.filter(t=>Ke(t)||Ye(t)).reduce((t,s)=>{if(Ke(s))return t.push(s),t;if(s.lazy)return t.push(s),t;if(Ye(s)){const i=Object.assign({},s),r=s.percentage?s.percentage*e:0;return isNaN(r)||(i.time=r<0||r===e?-1:r),t.push(i),t}return t},[]):(console.warn("AdSchedule was not an Array"),[])}(i.ads,d),n.setSchedule(i.ads,d),t.metadata&&Analytics.mergeMetadata(o,t.metadata),t.metadata&&n.mergeMacros(t.metadata),t.metadata&&i.parameters&&(i.parameters=Object.assign(Object.assign({},i.parameters),t.metadata)),Analytics.mergeMetadata(o,{muted:t.muted||!1,autoplay:t.autoplay||!1}),!a){if(a=!0,t.lang&&!i.Locale&&(i.Locale=t.lang),Schedule.isOutstream(i.ads))return ls("is outstream, returning"),new Outstream({root:e,content:s,ads:n,ima:i});Ot({config:Object.assign(Object.assign({},t),{autoplay:r}),root:e,content:s,ads:n,ima:i})}}n.resize(h(e)),n.on(D,()=>{n.adapter.isCustomPlaybackEnabled()&&n.once(k,()=>{s.src=s.original_src,s.once("canplay",()=>{s.togglePlay(!1)}),s.webkitExitFullscreen()})}),s.on("reap",function(){n&&n.destroy()}),(null===(i=t.ads)||void 0===i?void 0:i.prebid)&&ds(s,t),d()}class AdControls extends HTMLElement{constructor(t){super(),this.player=t,this.classList.add("fp-ad-controls"),this.append(this.adRemainingTime(),yt(this.player,St),this.playbackButtons(),this.volumeBtn(),yt(this.player,"flowplayer-volume-bar"),...this.fullscreenIcons(),this.adChoices()),t.on(Q,this.applyStyleFlags.bind(this))}fullscreenIcons(){return this.player.createComponents("flowplayer-fullscreen-enter-icon","flowplayer-fullscreen-exit-icon").map(t=>(t.onclick=()=>this.player.toggleFullScreen(),t))}volumeBtn(){const t=yt(this.player,"flowplayer-volume-icon");return t.onclick=()=>this.player.emit(z),t}playbackButtons(){const t=document.createElement("div");t.classList.add("ad-playback-controls");const e=yt(this.player,"flowplayer-small-play-icon"),s=yt(this.player,"flowplayer-small-pause-icon");return e.addEventListener("click",()=>{this.player.emit(V),setTimeout(function(){s.focus&&s.focus()},100)}),s.addEventListener("click",()=>{this.player.emit(H),setTimeout(function(){e.focus&&e.focus()},100)}),t.append(e,s),t}adChoices(){const t=document.createElement("div");return t.classList.add("fp-ad-choices"),t.textContent=this.player.i18n("ads.adchoices","AdChoices"),t.addEventListener("click",t=>{t.preventDefault(),this.player.togglePlay(!1),window.open("https://adssettings.google.com","_blank")}),t}adRemainingTime(){const t=document.createElement("div");return t.classList.add("fp-ad-remaining","fp-color-text"),this.prepend(t),this.player.on(L,e=>{const s=e.detail.remaining;t.textContent=function(t){if(isNaN(t)||t>=Number.MAX_SAFE_INTEGER)return"";const e=t<0?"-":"";t=Math.round(Math.abs(t));const s=Math.floor(t/3600);let i=Math.floor(t/60);return t-=60*i,s>=1?(i-=60*s,e+s+":"+ht(i)+":"+ht(t)):e+ht(i)+":"+ht(t)}(parseFloat(s+""))}),t}applyStyleFlags(t){var e;const s=null!==(e=t.detail.ui_flags)&&void 0!==e?e:0;this.classList.toggle("is-ad-controls-sticky",(1&s)>0),this.classList.toggle("no-indicator",(4&s)>0),this.classList.toggle("is-ad-choices",(16&s)>0),this.classList.toggle("no-volume-bar",!(64&s)),this.classList.toggle("is-ad-remaining",(32&s)>0),this.classList.toggle("no-fullscreen",(2&s)>0)}}class AdCountdown extends HTMLElement{static get observedAttributes(){return["remaining"]}constructor(t){super(),this.player=t,this.className="fp-ad-countdown",t.on(L,t=>{const{duration:e,remaining:s}=t.detail;this.setAttribute("duration",e+""),this.setAttribute("remaining",s+"")}),t.on(w,t=>{t.detail.linear&&(this.style.setProperty("--ad-percent-previous","0"),this.style.setProperty("--ad-percent-complete","0"))}),this.addEventListener("animationend",()=>{const t=this.style.getPropertyValue("--ad-percent-complete")||"0";this.style.setProperty("--ad-percent-previous",t)})}attributeChangedCallback(t,e,s){if("remaining"===t)return this.onRemaining(s)}onRemaining(t){const e=parseFloat(this.getAttribute("duration")||"0");t||(t=e+"");const s=parseFloat(t),i=this.style.getPropertyValue("--ad-percent-complete")||"0";this.style.setProperty("--ad-percent-previous",i),this.classList.remove("go");const r=((e-s)/e*100).toFixed(3);requestAnimationFrame(()=>{this.style.setProperty("--ad-percent-complete",r),this.classList.add("go")})}}class AdIndicator extends HTMLElement{static get observedAttributes(){return["position","totals"]}constructor(t){super(),this.player=t,this.render(),t.on(w,t=>{const{position:e,totals:s}=t.detail.ad;this.setAttribute("position",e+""),this.setAttribute("totals",s+"")})}attributeChangedCallback(t,e){switch(t){case"position":case"totals":return this.updateText()}}updateText(){if(!this.element)return;const t=parseFloat(this.getAttribute("position")||"0"),e=parseFloat(this.getAttribute("totals")||"0");this.element.textContent=`${this.player.i18n("ads.indicator","ADS")} ${t} / ${e}`}render(){this.element=document.createElement("div"),this.element.classList.add("ad-indicator","fp-color-text"),this.element.textContent=this.player.i18n("ads.indicator","ADS"),this.append(this.element)}}var us,hs=Object.freeze({__proto__:null,SINGlE_INLINE_LINEAR:"https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/single_ad_samples&sz=640x480&cust_params=sample_ct%3Dlinear&ciu_szs=300x250%2C728x90&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator=",SINGLE_SKIPPABLE_INLINE:"https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/single_preroll_skippable&sz=640x480&ciu_szs=300x250%2C728x90&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator=",SINGLE_REDIRECT_LINEAR:"https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/single_ad_samples&sz=640x480&cust_params=sample_ct%3Dredirectlinear&ciu_szs=300x250%2C728x90&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator=",SINGLE_REDIRECT_ERROR:"https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/single_ad_samples&sz=640x480&cust_params=sample_ct%3Dredirecterror&ciu_szs=300x250%2C728x90&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator=",SINGLE_REDIRECT_BROKEN:"https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/single_ad_samples&sz=640x480&cust_params=sample_ct%3Dredirecterror&ciu_szs=300x250%2C728x90&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&nofb=1&correlator=",SINGLE_VPAID_20_LINEAR:"https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/single_ad_samples&sz=640x480&cust_params=sample_ct%3Dlinearvpaid2js&ciu_szs=300x250%2C728x90&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator=",SINGLE_VPAID_20_NON_LINEAR:"https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/single_ad_samples&sz=640x480&cust_params=sample_ct%3Dnonlinearvpaid2js&ciu_szs=728x90%2C300x250&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator=",SINGLE_NON_LINEAR_INLINE:"https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/nonlinear_ad_samples&sz=480x70&cust_params=sample_ct%3Dnonlinear&ciu_szs=300x250%2C728x90&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator=",VMAP_SESSION_AD_RULE_PREROLL:"https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/vmap_ad_samples&sz=640x480&cust_params=sar%3Da0f2&ciu_szs=300x250&ad_rule=1&gdfp_req=1&output=vmap&unviewed_position_start=1&env=vp&impl=s&correlator=",VMAP_PREROLL:"https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/vmap_ad_samples&sz=640x480&cust_params=sample_ar%3Dpreonly&ciu_szs=300x250%2C728x90&gdfp_req=1&ad_rule=1&output=vmap&unviewed_position_start=1&env=vp&impl=s&correlator=",VMAP_PREROLL_BUMPER:"https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/vmap_ad_samples&sz=640x480&cust_params=sample_ar%3Dpreonlybumper&ciu_szs=300x250&gdfp_req=1&ad_rule=1&output=vmap&unviewed_position_start=1&env=vp&impl=s&correlator=",VMAP_POSTROLL:"https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/vmap_ad_samples&sz=640x480&cust_params=sample_ar%3Dpostonly&ciu_szs=300x250&gdfp_req=1&ad_rule=1&output=vmap&unviewed_position_start=1&env=vp&impl=s&correlator=",VMAP_POSTROLL_BUMPER:"https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/vmap_ad_samples&sz=640x480&cust_params=sample_ar%3Dpostonlybumper&ciu_szs=300x250&gdfp_req=1&ad_rule=1&output=vmap&unviewed_position_start=1&env=vp&impl=s&correlator="});const{samsung_tv:ps}=u(),gs=(us=class Ads{constructor(t){this.umd=t,At(t,bt,AdUI),At(t,wt,AdControls),At(t,Et,AdCountdown),At(t,St,AdIndicator)}init(t,e,s){if(c.from_token(t.token||"").is_granted(c.permissions.ADS)&&!ps)return cs(t,e,s)}},us.pluginName="ads",us.events=K,us.ui=Ve,us.tags=hs,us);return function(t,e){if("object"==typeof exports&&"undefined"!=typeof module)return e;if(null===document.currentScript)return e;"flowplayer"in t||(t.flowplayer={extensions:[]});const s=t.flowplayer;return"function"==typeof s?(s(e),e):(Array.isArray(s.extensions)||(s.extensions=[]),~s.extensions.indexOf(e)||s.extensions.push(e),e)}(window,gs)});
|
package/plugins/airplay.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { Get } from 'type-fest';
|
|
2
2
|
import type { HlsConfig } from 'hls.js';
|
|
3
3
|
import type { Level } from 'hls.js';
|
|
4
|
+
import type { Paths } from 'type-fest';
|
|
4
5
|
import type { Representation } from 'dashjs';
|
|
6
|
+
import type { Translation } from '@flowplayer/translations';
|
|
5
7
|
import type { TupleToUnion } from 'type-fest';
|
|
6
8
|
|
|
7
9
|
/**
|
|
@@ -1214,7 +1216,8 @@ declare type Player = HTMLVideoElement & PlayerEventOverloads & {
|
|
|
1214
1216
|
/**
|
|
1215
1217
|
* Adds a language to the project. See {@link https://developer.wowza.com/docs/wowza-flowplayer/player/translations/#using-npm| Official documentation}
|
|
1216
1218
|
*/
|
|
1217
|
-
i18n(k:
|
|
1219
|
+
i18n(k: TranslationKey): string;
|
|
1220
|
+
i18n(k: string, fallback: string): string;
|
|
1218
1221
|
/* Excluded from this release type: deviceId */
|
|
1219
1222
|
/* Excluded from this release type: live_state */
|
|
1220
1223
|
/**
|
|
@@ -1913,6 +1916,15 @@ TOUCH_START = "touchstart";
|
|
|
1913
1916
|
|
|
1914
1917
|
declare const TOUCHED = "is-touched";
|
|
1915
1918
|
|
|
1919
|
+
/**
|
|
1920
|
+
* @public
|
|
1921
|
+
* All possible full paths to each translation, i.e. "core.mute"| "core.play" | "ads.ad" etc.
|
|
1922
|
+
* This type is useful for developers using translation querying based on path, like in lodash's get()
|
|
1923
|
+
*/
|
|
1924
|
+
declare type TranslationKey = Paths<Translation, {
|
|
1925
|
+
leavesOnly: true;
|
|
1926
|
+
}>;
|
|
1927
|
+
|
|
1916
1928
|
declare type TSampleRate = typeof SampleRate;
|
|
1917
1929
|
|
|
1918
1930
|
declare const TV = "is-tv";
|
package/plugins/analytics.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { Get } from 'type-fest';
|
|
2
2
|
import type { Level } from 'hls.js';
|
|
3
|
+
import type { Paths } from 'type-fest';
|
|
3
4
|
import type { Representation } from 'dashjs';
|
|
5
|
+
import type { Translation } from '@flowplayer/translations';
|
|
4
6
|
import type { TupleToUnion } from 'type-fest';
|
|
5
7
|
|
|
6
8
|
/**
|
|
@@ -1208,7 +1210,8 @@ declare type Player = HTMLVideoElement & PlayerEventOverloads & {
|
|
|
1208
1210
|
/**
|
|
1209
1211
|
* Adds a language to the project. See {@link https://developer.wowza.com/docs/wowza-flowplayer/player/translations/#using-npm| Official documentation}
|
|
1210
1212
|
*/
|
|
1211
|
-
i18n(k:
|
|
1213
|
+
i18n(k: TranslationKey): string;
|
|
1214
|
+
i18n(k: string, fallback: string): string;
|
|
1212
1215
|
/* Excluded from this release type: deviceId */
|
|
1213
1216
|
/* Excluded from this release type: live_state */
|
|
1214
1217
|
/**
|
|
@@ -1907,6 +1910,15 @@ TOUCH_START = "touchstart";
|
|
|
1907
1910
|
|
|
1908
1911
|
declare const TOUCHED = "is-touched";
|
|
1909
1912
|
|
|
1913
|
+
/**
|
|
1914
|
+
* @public
|
|
1915
|
+
* All possible full paths to each translation, i.e. "core.mute"| "core.play" | "ads.ad" etc.
|
|
1916
|
+
* This type is useful for developers using translation querying based on path, like in lodash's get()
|
|
1917
|
+
*/
|
|
1918
|
+
declare type TranslationKey = Paths<Translation, {
|
|
1919
|
+
leavesOnly: true;
|
|
1920
|
+
}>;
|
|
1921
|
+
|
|
1910
1922
|
declare type TSampleRate = typeof SampleRate;
|
|
1911
1923
|
|
|
1912
1924
|
declare const TV = "is-tv";
|
package/plugins/analytics.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.analytics=t())}(this,function(){"use strict";const e=(...e)=>e.reduce((e,t)=>Object.assign(Object.assign({},e),t),{}),t=(e,t)=>{const r=e.lastIndexOf(t);return~r&&e.splice(r,1),e};class RequestQueue{static of(){return new RequestQueue}static is_empty(e){return 0==e.pending.length}static is_high_water(e){return e.open.length==RequestQueue.MAX_OPEN_REQUESTS}static maybe_spawn_req(e){if(RequestQueue.is_empty(e))return e;if(RequestQueue.is_high_water(e))return e;try{const t=RequestQueue.lpop(e);t&&RequestQueue.request(e,t)}catch(e){}}static increment_failures(e){return e.stats.failures++,e.stats.failures>RequestQueue.MAX_FAILURE_COUNT&&(e.stats.ttl=Date.now()+RequestQueue.REQUEST_TTL_MS),e}static handle_error(e,t){RequestQueue.rm(e,t),RequestQueue.increment_failures(e)}static request(e,[t,r,n]){if(Date.now()<e.stats.ttl)return;const i=new XMLHttpRequest;e.open.push(i),i.timeout=RequestQueue.REQUEST_TIMEOUT_MS,i.ontimeout=function(){RequestQueue.handle_error(e,i)},i.onerror=function(t){RequestQueue.handle_error(e,i)},i.onreadystatechange=function(){i.readyState==XMLHttpRequest.DONE&&RequestQueue.rm(e,i),Math.floor(i.status/100)},i.onload=function(){RequestQueue.rm(e,i),e.stats.failures&&e.stats.failures--},i.open(r,t),i.setRequestHeader("Content-Type","text/plain;charset=UTF-8");try{i.send(JSON.stringify(n))}catch(e){}}static rpush(e,...t){return t.forEach(t=>{e.pending.length>=RequestQueue.MAX_PENDING||(e.pending.push(t),RequestQueue.maybe_spawn_req(e))}),e}static lpop(e){return e.pending.shift()}static rm(e,r){return t(e.open,r),e}constructor(){this.pending=[],this.open=[],this.stats={failures:0,ttl:0}}}RequestQueue.MAX_OPEN_REQUESTS=3,RequestQueue.MAX_PENDING=5,RequestQueue.REQUEST_TIMEOUT_MS=4e3,RequestQueue.REQUEST_TTL_MS=5e3,RequestQueue.MAX_FAILURE_COUNT=3;var r=RequestQueue.of();const n=/:([a-zA-Z_]+)/g;class Log{static prepare(e,t){const r=document.createEvent("Event");return r.initEvent(e,!1,!0),r.ns=e,r.data=t,r}static of(e){return new Log(e)}constructor(e){this.emitter=e}info(e){this.emitter.dispatchEvent(Log.prepare(Log.NAMESPACE.INFO,e))}error(e){this.emitter.dispatchEvent(Log.prepare(Log.NAMESPACE.ERROR,e))}warn(e){this.emitter.dispatchEvent(Log.prepare(Log.NAMESPACE.WARN,e))}}var i,o;Log.NAMESPACE={INFO:"tracker:info",ERROR:"tracker:err",WARN:"tracker:warn"},function(e){e.POST="POST",e.PUT="PUT",e.GET="GET"}(i||(i={}));class Tracker{static of(e,t){return new Tracker(e,t)}static ensure_required_keys(e,t){return e.required_keys.filter(e=>!(e in t))}static pluck_valid_keys(t,r){return((t,...r)=>Object.keys(t).filter(e=>~r.indexOf(e)).reduce((r,n)=>e(r,{[n]:t[n]}),{}))(r,...t.valid_keys)}static merge_metadata(t,r={}){return t.metadata=Tracker.pluck_valid_keys(t,e(t.metadata,r)),t}static assert_emitter_api(e){if("function"!=typeof(e||{}).addEventListener)throw new Error("Tracker() received an emitter that does not implement the addEventListener method");if("function"!=typeof(e||{}).removeEventListener)throw new Error("Tracker() received an emitter that does not implement the removeEventListener method")}static create_listener(e,t,r){var n;e.listeners.push([t,r]),null===(n=e.emitter)||void 0===n||n.addEventListener(t,r)}constructor(t,i={}){const o=this;if(this.emitter=t,this.url=i.url,this.log=Log.of(this.emitter),this.verb=i.verb,this.metadata=e({},i.metadata||{}),this.rq=i.rq||r,this.events=i.events||[],this.required_keys=i.required_keys||[],this.optional_keys=i.optional_keys||[],this.listeners=[],this.valid_keys=this.required_keys.slice(0).concat(this.optional_keys),Tracker.assert_emitter_api(this.emitter),void 0===Tracker.verb[this.verb])throw new Error(`invalid HTTP verb[${this.verb}] passed`);if("string"!=typeof this.url)throw new Error(`invalid API url[${this.url}] passed`);Tracker.TRACKERS.push(this),o.events.forEach(t=>{Tracker.create_listener(this,t,(r={})=>{const i=e(o.metadata,{event_type:t},r.data||r),a=function(e,t){return e.replace(n,e=>{const r=e.slice(1,e.length);return r in t?t[r].toString():e})}(o.url,i),s=Tracker.pluck_valid_keys(o,i),u=Tracker.ensure_required_keys(o,s);if(u.length)return o.log.error(`Tracker.validate_metadata() failed for\n Event[${t}]\n missing keys: ${u}\n payload:\n ${JSON.stringify(s,null,2)}`);this.rq&&RequestQueue.rpush(this.rq,[a,this.verb,s])})})}destroy(){this.listeners.forEach(([e,t])=>{var r;return null===(r=this.emitter)||void 0===r?void 0:r.removeEventListener(e,t)}),delete this.rq,delete this.emitter,t(Tracker.TRACKERS,this)}put(e={}){return Tracker.merge_metadata(this,e),this}}Tracker.TRACKERS=[],Tracker.QUEUE=r,Tracker.verb=i,function(e){e[e.ADS=2]="ADS",e[e.ANALYTICS=4]="ANALYTICS",e[e.NO_METERING=8]="NO_METERING",e[e.DEVELOPER_PLAN=16]="DEVELOPER_PLAN",e[e.WOWZA_VIDEO=32]="WOWZA_VIDEO"}(o||(o={}));const a=["localhost","127.0.0.1","0.0.0.0","s.codepen.io","cdpn.io","try.flowplayer.com"];function s(e,t){return!!~a.indexOf(e)||e.indexOf(t)===e.length-t.length}s.check_whitelist=function(e){return!!~a.indexOf(e)};function u(e){this.message=e}u.prototype=new Error,u.prototype.name="InvalidCharacterError";var d="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new u("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,n,i=0,o=0,a="";n=t.charAt(o++);~n&&(r=i%4?64*r+n:n,i++%4)?a+=String.fromCharCode(255&r>>(-2*i&6)):0)n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(n);return a};var c=function(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return function(e){return decodeURIComponent(d(e).replace(/(.)/g,function(e,t){var r=t.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r}))}(t)}catch(e){return d(t)}};function l(e){this.message=e}l.prototype=new Error,l.prototype.name="InvalidTokenError";var f=function(e,t){if("string"!=typeof e)throw new l("Invalid token specified");var r=!0===(t=t||{}).header?0:1;try{return JSON.parse(c(e.split(".")[r]))}catch(e){throw new l("Invalid token specified: "+e.message)}};f.InvalidTokenError=l;const p="production";function _(e,t){const r={valid_jwt:!1,raw:"",data:{acl:0},exp:0};let n={c:"{}",exp:0};t=t||{};try{n=f(e),r.valid_jwt=!0}catch(e){}return r.raw=e,r.data=JSON.parse(n.c),r.exp=n.exp,t.require_valid_token&&_.validate(r),r}function h(e){return{grant:e,is_granted:t=>(e&t)===t}}function m(e,t,r){const n=function(e){return Array.isArray(e)?e.slice(0):e.split(".")}(t);for(;n.length;){if(null==e)return r;const t=n.shift();if("string"!=typeof t)return r;e=e[t]}return null==e?r:e}_.validate=function(e){if("string"==typeof e&&(e=_(e)),!e||!e.raw){if(s.check_whitelist(window.location.hostname)||"dev"===p.toString())return!0;throw new Error("No token provided in configuration")}if(!e.valid_jwt)throw new Error("Invalid token provided");const t=window.location.hostname,r=s.bind(null,t);if("dev"!==p.toString()&&e.data.domain&&e.data.domain.length&&!e.data.domain.some(r))throw new Error("Domain not allowed");if("dev"!==p.toString()&&1e3*e.exp-Date.now()<0)throw new Error("Expired token");return!0},_.id=function(e){if(e)return"string"==typeof e&&(e=_(e)),e.data.id},h.of=h,h.from_token=function(e){const t=_(e,{require_valid_token:!0});return h.of(t.data.acl)},h.permissions=o;var v="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};var y="ping",k="display",g="view";const w=["sitegroup_id","session_id","media_id","site_id","player_id","video_type"],E=["created","position"],T=["player_version","created","source","category","category_id","autoplay","muted","customer_user_id"];const R=100,q=1e3;function A(e,t){return e.duration/1===e.duration&&Object.assign(t,function(e){const t=e/R;return{segment_duration:t,breakpoints:Array(...Array(R)).map(function(e,r){return Math.floor(r*t*q)/q})}}(e.duration))}function S(e,t,r){if(!t.segment_duration&&!A(e,t))return;const n=function(e,t,r){const n=t.last_idx,i=r?99:O(e,t);return t.last_idx=i,i<=n?[]:t.breakpoints.slice(n,99==i?100:i).map(function(e){return t.breakpoints.indexOf(e)})}(e,t,r);0!=n.length&&e.emit(y,{position:n})}function O(e,t){return Math.min(Math.floor(e.currentTime/t.segment_duration),99)}function b(){try{const e=window.location!==window.parent.location?document.referrer:document.location.href;return"string"==typeof e&&e.slice(0,200)}catch(e){return!1}}var N;const Q="vod",x="live",L=[k,y,g];function I(e,t,r){switch(null==t?void 0:t.kind){case"live":return function(e,t){const r=Date.now();r-t.last_tracked_ts<6e4||(t.last_tracked_ts=r,++t.ticks,e.emit(y,{position:60*t.ticks}))}(e,t);case"vod":return S(e,t,"boolean"==typeof r&&r)}}function M(e){const t=e.ads;return void 0!==t&&(void 0!==t.schedule&&("function"==typeof t.hasPreroll&&(t.currentRequests?t.currentRequests:!!t.adPlaying||!(!t.hasPreroll()||0!=t.nextIndex))))}const P=((N=class Analytics{init(e,t,r){if(!h.from_token(e.token||"").is_granted(h.permissions.ANALYTICS))return;if(r.hasState("consent-no-tracking"))return;if(r.analytics)return;const n=r.analytics={ticker:void 0,last_media_id:"",ended:!1},i={locked:void 0,ttl:6e3,task:()=>{I(r,n.ticker)}};const o={session_id:r.deviceId(),autoplay:r.autoplay,muted:r.muted,player_id:e.player_id,customer_user_id:e.customer_user_id,player_version:"3.32.0"},a=Tracker.of(r,{verb:Tracker.verb.POST,url:"https://ptm.flowplayer.com/:video_type/:sitegroup_id/:event_type",events:L,required_keys:w,optional_keys:T.concat(E).slice(0),metadata:o});r.on("reap",function(){a&&a.destroy()}),r.on("config",function(t){if(!a)return;const i=m(t,"data.metadata",{});if(!i.media_id&&i.stream_target_id&&(i.media_id=i.stream_target_id),!i.media_id)return;const o=m(a,"metadata.media_id");if(o&&i.media_id==o)return;const s=m(e,"analytics",{});a.put(i),a.put(s);const u=m(e,"metadata.live_start_time",e.live)?x:Q;a.put({video_type:u,source:e.source||b()||""}),n.ticker=e.live?{ticks:0,last_tracked_ts:Date.now(),kind:"live"}:{last_idx:0,segment_duration:0,breakpoints:[],kind:"vod"},n.ended=!1,r.emit(k)});let s=0;r.on("playing",function(){if(!a)return;if(s||function(e,t){return e.metadata.media_id&&e.metadata.media_id==t.last_media_id}(a,n))return;a.put({muted:r.muted});const e=M(r);if(e)return s=Promise.resolve(e).then(function(){n.last_media_id=a.metadata.media_id,r.emit(g),s=0}).catch(function(){s=0});n.last_media_id=a.metadata.media_id,r.emit(g)}),r.on("timeupdate",function(){var t;a&&(s||M(r)||n.ended||(!e.live&&r.currentTime+.25>=r.duration&&I(r,n.ticker,!0),(t=i).locked||(t.locked=setTimeout(function(){return t.task(),function(e){return e.locked=void 0,e}(t)},t.ttl))))}),r.on("seeked",function(){a&&n.ticker&&"vod"==n.ticker.kind&&function(e,t){A(e,t),t.last_idx=O(e,t)}(r,n.ticker)}),r.on("ended",function(){a&&function(e,t){t.ended||(t.ended=!0,I(e,t.ticker))}(r,n)})}}).pluginName="analytics",N),C=function(e,t){if("object"==typeof exports&&"undefined"!=typeof module)return t;if(null===document.currentScript)return t;"flowplayer"in e||(e.flowplayer={extensions:[]});const r=e.flowplayer;return"function"==typeof r?(r(t),t):(Array.isArray(r.extensions)||(r.extensions=[]),~r.extensions.indexOf(t)||r.extensions.push(t),t)}("undefined"!=typeof window?window:void 0!==v?v:{},P);return C});
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.analytics=t())}(this,function(){"use strict";const e=(...e)=>e.reduce((e,t)=>Object.assign(Object.assign({},e),t),{}),t=(e,t)=>{const r=e.lastIndexOf(t);return~r&&e.splice(r,1),e};class RequestQueue{static of(){return new RequestQueue}static is_empty(e){return 0==e.pending.length}static is_high_water(e){return e.open.length==RequestQueue.MAX_OPEN_REQUESTS}static maybe_spawn_req(e){if(RequestQueue.is_empty(e))return e;if(RequestQueue.is_high_water(e))return e;try{const t=RequestQueue.lpop(e);t&&RequestQueue.request(e,t)}catch(e){}}static increment_failures(e){return e.stats.failures++,e.stats.failures>RequestQueue.MAX_FAILURE_COUNT&&(e.stats.ttl=Date.now()+RequestQueue.REQUEST_TTL_MS),e}static handle_error(e,t){RequestQueue.rm(e,t),RequestQueue.increment_failures(e)}static request(e,[t,r,n]){if(Date.now()<e.stats.ttl)return;const i=new XMLHttpRequest;e.open.push(i),i.timeout=RequestQueue.REQUEST_TIMEOUT_MS,i.ontimeout=function(){RequestQueue.handle_error(e,i)},i.onerror=function(t){RequestQueue.handle_error(e,i)},i.onreadystatechange=function(){i.readyState==XMLHttpRequest.DONE&&RequestQueue.rm(e,i),Math.floor(i.status/100)},i.onload=function(){RequestQueue.rm(e,i),e.stats.failures&&e.stats.failures--},i.open(r,t),i.setRequestHeader("Content-Type","text/plain;charset=UTF-8");try{i.send(JSON.stringify(n))}catch(e){}}static rpush(e,...t){return t.forEach(t=>{e.pending.length>=RequestQueue.MAX_PENDING||(e.pending.push(t),RequestQueue.maybe_spawn_req(e))}),e}static lpop(e){return e.pending.shift()}static rm(e,r){return t(e.open,r),e}constructor(){this.pending=[],this.open=[],this.stats={failures:0,ttl:0}}}RequestQueue.MAX_OPEN_REQUESTS=3,RequestQueue.MAX_PENDING=5,RequestQueue.REQUEST_TIMEOUT_MS=4e3,RequestQueue.REQUEST_TTL_MS=5e3,RequestQueue.MAX_FAILURE_COUNT=3;var r=RequestQueue.of();const n=/:([a-zA-Z_]+)/g;class Log{static prepare(e,t){const r=document.createEvent("Event");return r.initEvent(e,!1,!0),r.ns=e,r.data=t,r}static of(e){return new Log(e)}constructor(e){this.emitter=e}info(e){this.emitter.dispatchEvent(Log.prepare(Log.NAMESPACE.INFO,e))}error(e){this.emitter.dispatchEvent(Log.prepare(Log.NAMESPACE.ERROR,e))}warn(e){this.emitter.dispatchEvent(Log.prepare(Log.NAMESPACE.WARN,e))}}var i,o;Log.NAMESPACE={INFO:"tracker:info",ERROR:"tracker:err",WARN:"tracker:warn"},function(e){e.POST="POST",e.PUT="PUT",e.GET="GET"}(i||(i={}));class Tracker{static of(e,t){return new Tracker(e,t)}static ensure_required_keys(e,t){return e.required_keys.filter(e=>!(e in t))}static pluck_valid_keys(t,r){return((t,...r)=>Object.keys(t).filter(e=>~r.indexOf(e)).reduce((r,n)=>e(r,{[n]:t[n]}),{}))(r,...t.valid_keys)}static merge_metadata(t,r={}){return t.metadata=Tracker.pluck_valid_keys(t,e(t.metadata,r)),t}static assert_emitter_api(e){if("function"!=typeof(e||{}).addEventListener)throw new Error("Tracker() received an emitter that does not implement the addEventListener method");if("function"!=typeof(e||{}).removeEventListener)throw new Error("Tracker() received an emitter that does not implement the removeEventListener method")}static create_listener(e,t,r){var n;e.listeners.push([t,r]),null===(n=e.emitter)||void 0===n||n.addEventListener(t,r)}constructor(t,i={}){const o=this;if(this.emitter=t,this.url=i.url,this.log=Log.of(this.emitter),this.verb=i.verb,this.metadata=e({},i.metadata||{}),this.rq=i.rq||r,this.events=i.events||[],this.required_keys=i.required_keys||[],this.optional_keys=i.optional_keys||[],this.listeners=[],this.valid_keys=this.required_keys.slice(0).concat(this.optional_keys),Tracker.assert_emitter_api(this.emitter),void 0===Tracker.verb[this.verb])throw new Error(`invalid HTTP verb[${this.verb}] passed`);if("string"!=typeof this.url)throw new Error(`invalid API url[${this.url}] passed`);Tracker.TRACKERS.push(this),o.events.forEach(t=>{Tracker.create_listener(this,t,(r={})=>{const i=e(o.metadata,{event_type:t},r.data||r),a=function(e,t){return e.replace(n,e=>{const r=e.slice(1,e.length);return r in t?t[r].toString():e})}(o.url,i),s=Tracker.pluck_valid_keys(o,i),u=Tracker.ensure_required_keys(o,s);if(u.length)return o.log.error(`Tracker.validate_metadata() failed for\n Event[${t}]\n missing keys: ${u}\n payload:\n ${JSON.stringify(s,null,2)}`);this.rq&&RequestQueue.rpush(this.rq,[a,this.verb,s])})})}destroy(){this.listeners.forEach(([e,t])=>{var r;return null===(r=this.emitter)||void 0===r?void 0:r.removeEventListener(e,t)}),delete this.rq,delete this.emitter,t(Tracker.TRACKERS,this)}put(e={}){return Tracker.merge_metadata(this,e),this}}Tracker.TRACKERS=[],Tracker.QUEUE=r,Tracker.verb=i,function(e){e[e.ADS=2]="ADS",e[e.ANALYTICS=4]="ANALYTICS",e[e.NO_METERING=8]="NO_METERING",e[e.DEVELOPER_PLAN=16]="DEVELOPER_PLAN",e[e.WOWZA_VIDEO=32]="WOWZA_VIDEO"}(o||(o={}));const a=["localhost","127.0.0.1","0.0.0.0","s.codepen.io","cdpn.io","try.flowplayer.com"];function s(e,t){return!!~a.indexOf(e)||e.indexOf(t)===e.length-t.length}s.check_whitelist=function(e){return!!~a.indexOf(e)};function u(e){this.message=e}u.prototype=new Error,u.prototype.name="InvalidCharacterError";var d="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new u("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,n,i=0,o=0,a="";n=t.charAt(o++);~n&&(r=i%4?64*r+n:n,i++%4)?a+=String.fromCharCode(255&r>>(-2*i&6)):0)n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(n);return a};var c=function(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return function(e){return decodeURIComponent(d(e).replace(/(.)/g,function(e,t){var r=t.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r}))}(t)}catch(e){return d(t)}};function l(e){this.message=e}l.prototype=new Error,l.prototype.name="InvalidTokenError";var f=function(e,t){if("string"!=typeof e)throw new l("Invalid token specified");var r=!0===(t=t||{}).header?0:1;try{return JSON.parse(c(e.split(".")[r]))}catch(e){throw new l("Invalid token specified: "+e.message)}};f.InvalidTokenError=l;const p="production";function _(e,t){const r={valid_jwt:!1,raw:"",data:{acl:0},exp:0};let n={c:"{}",exp:0};t=t||{};try{n=f(e),r.valid_jwt=!0}catch(e){}return r.raw=e,r.data=JSON.parse(n.c),r.exp=n.exp,t.require_valid_token&&_.validate(r),r}function h(e){return{grant:e,is_granted:t=>(e&t)===t}}function m(e,t,r){const n=function(e){return Array.isArray(e)?e.slice(0):e.split(".")}(t);for(;n.length;){if(null==e)return r;const t=n.shift();if("string"!=typeof t)return r;e=e[t]}return null==e?r:e}_.validate=function(e){if("string"==typeof e&&(e=_(e)),!e||!e.raw){if(s.check_whitelist(window.location.hostname)||"dev"===p.toString())return!0;throw new Error("No token provided in configuration")}if(!e.valid_jwt)throw new Error("Invalid token provided");const t=window.location.hostname,r=s.bind(null,t);if("dev"!==p.toString()&&e.data.domain&&e.data.domain.length&&!e.data.domain.some(r))throw new Error("Domain not allowed");if("dev"!==p.toString()&&1e3*e.exp-Date.now()<0)throw new Error("Expired token");return!0},_.id=function(e){if(e)return"string"==typeof e&&(e=_(e)),e.data.id},h.of=h,h.from_token=function(e){const t=_(e,{require_valid_token:!0});return h.of(t.data.acl)},h.permissions=o;var v="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};var y="ping",k="display",g="view";const w=["sitegroup_id","session_id","media_id","site_id","player_id","video_type"],E=["created","position"],T=["player_version","created","source","category","category_id","autoplay","muted","customer_user_id"];const R=100,q=1e3;function A(e,t){return e.duration/1===e.duration&&Object.assign(t,function(e){const t=e/R;return{segment_duration:t,breakpoints:Array(...Array(R)).map(function(e,r){return Math.floor(r*t*q)/q})}}(e.duration))}function S(e,t,r){if(!t.segment_duration&&!A(e,t))return;const n=function(e,t,r){const n=t.last_idx,i=r?99:O(e,t);return t.last_idx=i,i<=n?[]:t.breakpoints.slice(n,99==i?100:i).map(function(e){return t.breakpoints.indexOf(e)})}(e,t,r);0!=n.length&&e.emit(y,{position:n})}function O(e,t){return Math.min(Math.floor(e.currentTime/t.segment_duration),99)}function b(){try{const e=window.location!==window.parent.location?document.referrer:document.location.href;return"string"==typeof e&&e.slice(0,200)}catch(e){return!1}}var N;const Q="vod",x="live",L=[k,y,g];function I(e,t,r){switch(null==t?void 0:t.kind){case"live":return function(e,t){const r=Date.now();r-t.last_tracked_ts<6e4||(t.last_tracked_ts=r,++t.ticks,e.emit(y,{position:60*t.ticks}))}(e,t);case"vod":return S(e,t,"boolean"==typeof r&&r)}}function M(e){const t=e.ads;return void 0!==t&&(void 0!==t.schedule&&("function"==typeof t.hasPreroll&&(t.currentRequests?t.currentRequests:!!t.adPlaying||!(!t.hasPreroll()||0!=t.nextIndex))))}const P=((N=class Analytics{init(e,t,r){if(!h.from_token(e.token||"").is_granted(h.permissions.ANALYTICS))return;if(r.hasState("consent-no-tracking"))return;if(r.analytics)return;const n=r.analytics={ticker:void 0,last_media_id:"",ended:!1},i={locked:void 0,ttl:6e3,task:()=>{I(r,n.ticker)}};const o={session_id:r.deviceId(),autoplay:r.autoplay,muted:r.muted,player_id:e.player_id,customer_user_id:e.customer_user_id,player_version:"3.32.1-rc.1"},a=Tracker.of(r,{verb:Tracker.verb.POST,url:"https://ptm.flowplayer.com/:video_type/:sitegroup_id/:event_type",events:L,required_keys:w,optional_keys:T.concat(E).slice(0),metadata:o});r.on("reap",function(){a&&a.destroy()}),r.on("config",function(t){if(!a)return;const i=m(t,"data.metadata",{});if(!i.media_id&&i.stream_target_id&&(i.media_id=i.stream_target_id),!i.media_id)return;const o=m(a,"metadata.media_id");if(o&&i.media_id==o)return;const s=m(e,"analytics",{});a.put(i),a.put(s);const u=m(e,"metadata.live_start_time",e.live)?x:Q;a.put({video_type:u,source:e.source||b()||""}),n.ticker=e.live?{ticks:0,last_tracked_ts:Date.now(),kind:"live"}:{last_idx:0,segment_duration:0,breakpoints:[],kind:"vod"},n.ended=!1,r.emit(k)});let s=0;r.on("playing",function(){if(!a)return;if(s||function(e,t){return e.metadata.media_id&&e.metadata.media_id==t.last_media_id}(a,n))return;a.put({muted:r.muted});const e=M(r);if(e)return s=Promise.resolve(e).then(function(){n.last_media_id=a.metadata.media_id,r.emit(g),s=0}).catch(function(){s=0});n.last_media_id=a.metadata.media_id,r.emit(g)}),r.on("timeupdate",function(){var t;a&&(s||M(r)||n.ended||(!e.live&&r.currentTime+.25>=r.duration&&I(r,n.ticker,!0),(t=i).locked||(t.locked=setTimeout(function(){return t.task(),function(e){return e.locked=void 0,e}(t)},t.ttl))))}),r.on("seeked",function(){a&&n.ticker&&"vod"==n.ticker.kind&&function(e,t){A(e,t),t.last_idx=O(e,t)}(r,n.ticker)}),r.on("ended",function(){a&&function(e,t){t.ended||(t.ended=!0,I(e,t.ticker))}(r,n)})}}).pluginName="analytics",N),C=function(e,t){if("object"==typeof exports&&"undefined"!=typeof module)return t;if(null===document.currentScript)return t;"flowplayer"in e||(e.flowplayer={extensions:[]});const r=e.flowplayer;return"function"==typeof r?(r(t),t):(Array.isArray(r.extensions)||(r.extensions=[]),~r.extensions.indexOf(t)||r.extensions.push(t),t)}("undefined"!=typeof window?window:void 0!==v?v:{},P);return C});
|
package/plugins/asel.d.ts
CHANGED
|
@@ -2,7 +2,9 @@ import type { Get } from 'type-fest';
|
|
|
2
2
|
import type Hls from 'hls.js';
|
|
3
3
|
import type { Level } from 'hls.js';
|
|
4
4
|
import type { LevelAttributes } from 'hls.js';
|
|
5
|
+
import type { Paths } from 'type-fest';
|
|
5
6
|
import type { Representation } from 'dashjs';
|
|
7
|
+
import type { Translation } from '@flowplayer/translations';
|
|
6
8
|
import type { TupleToUnion } from 'type-fest';
|
|
7
9
|
|
|
8
10
|
/* Excluded from this release type: AnyLoader */
|
|
@@ -1325,7 +1327,8 @@ declare type Player = HTMLVideoElement & PlayerEventOverloads & {
|
|
|
1325
1327
|
/**
|
|
1326
1328
|
* Adds a language to the project. See {@link https://developer.wowza.com/docs/wowza-flowplayer/player/translations/#using-npm| Official documentation}
|
|
1327
1329
|
*/
|
|
1328
|
-
i18n(k:
|
|
1330
|
+
i18n(k: TranslationKey): string;
|
|
1331
|
+
i18n(k: string, fallback: string): string;
|
|
1329
1332
|
/* Excluded from this release type: deviceId */
|
|
1330
1333
|
/* Excluded from this release type: live_state */
|
|
1331
1334
|
/**
|
|
@@ -2054,6 +2057,15 @@ declare const TRACKS = "audio:tracks";
|
|
|
2054
2057
|
*/
|
|
2055
2058
|
export declare type TracksEventDetail = AudioTrack[];
|
|
2056
2059
|
|
|
2060
|
+
/**
|
|
2061
|
+
* @public
|
|
2062
|
+
* All possible full paths to each translation, i.e. "core.mute"| "core.play" | "ads.ad" etc.
|
|
2063
|
+
* This type is useful for developers using translation querying based on path, like in lodash's get()
|
|
2064
|
+
*/
|
|
2065
|
+
declare type TranslationKey = Paths<Translation, {
|
|
2066
|
+
leavesOnly: true;
|
|
2067
|
+
}>;
|
|
2068
|
+
|
|
2057
2069
|
declare type TSampleRate = typeof SampleRate;
|
|
2058
2070
|
|
|
2059
2071
|
declare const TV = "is-tv";
|
package/plugins/asel.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.asel=t())}(this,function(){"use strict";const e="click",t="audio:set",n="audio:update",s="audio:tracks";var i=Object.freeze({__proto__:null,SET:t,SWITCH:n,TRACKS:s});function o(e,t,n){const s=function(e){return Array.isArray(e)?e.slice(0):e.split(".")}(t);for(;s.length;){if(null==e)return n;const t=s.shift();if("string"!=typeof t)return n;e=e[t]}return null==e?n:e}const r=navigator.languages||[navigator.language];const a="@flowplayer/audio/track";function l(e,n){e.emit(t,n),n.autoselect&&e._storage.setItem(a,n.lang)}function c(e){return e.toLowerCase()}function u(e,t,n){t=t.slice(0);const s={},i=e.getItem(a);let l=function(){try{return r.reduce((e,t)=>~t.indexOf("-")?e.concat(t,t.split("-")[0]):e.concat(t),[])}catch(e){return[]}}().map(c),u=-1;if("number"==typeof n)return n;for("string"==typeof n&&(n=n.toLowerCase(),~l.indexOf(n)&&l.splice(l.indexOf(n),1),l.unshift(c(n))),Array.isArray(n)&&(l=n.map(c));t.length;){++u;const e=t.shift();if(null==e?void 0:e.autoselect){if(i==e.lang)return console.debug("restoring lang from previous session: ",i),u;if(e.default&&(s.fallback=[u,e]),e.lang&&~l.indexOf(e.lang.toLowerCase())){const t=l.indexOf(e.lang);if(t<o(s,"by_lang.2",1/0)&&(s.by_lang=[u,e,t]),0===t)break}}}return o(s,"by_lang.0",o(s,"fallback.0",void 0))}const d=(e,t)=>new(((e,t)=>{const n=e.get(t);if(!n)throw new Error(`no flowplayer component with the name ${t} exists`);const s=window.customElements.get(t);if(!s)throw new Error(`no default flowplayer component with the name ${t} exists`);const i=window.customElements.get(n);return"function"!=typeof i?s:i})(e._customElements,t))(e);class FlowplayerComponent extends HTMLElement{constructor(e){super(),this.player=e}}const m="has-menu-opened",f="fp-menu-container",h="fp-on",p="fp-invis",y="details[open]."+f;class FlowplayerMenu extends FlowplayerComponent{constructor(t){super(t),this.player=t,this.menuContainer=document.createElement("details"),this.summaryEle=document.createElement("summary"),this.menuHeader=document.createElement("div"),this.menuTitle=document.createElement("h3"),this.olEle=document.createElement("ol"),this.olEle.id=g(),this.menu=document.createElement("div"),this.closeEle=document.createElement("span"),this.menuHeader.classList.add("fp-menu-header"),this.menuHeader.append(this.menuTitle,this.closeEle),this.menu.classList.add("fp-menu"),this.menu.append(this.menuHeader,this.olEle),this.closeEle.classList.add("fp-close"),this.closeEle.textContent="×",this.menuContainer.classList.add(f),this.menuContainer.append(this.summaryEle,this.menu),this.menuContainer.addEventListener(e,e=>{if(e.defaultPrevented)return;e.preventDefault();const n=this.menuContainer.open;n||(v(),document.active_menu=this.menuContainer),this.menuContainer.open=!n,t.root.classList.toggle(m,!n),this.summaryEle.setAttribute("aria-expanded",n?"false":"true")}),this.addEventListener("focusin",e=>{e.target;HTMLLIElement}),this.addEventListener("focusout",e=>{e.target;HTMLLIElement}),this.append(this.menuContainer),this.olEle.setAttribute("aria-labelledby",this.summaryEle.id),this.olEle.setAttribute("role","menu"),this.summaryEle.setAttribute("aria-haspopup","true"),this.summaryEle.setAttribute("aria-controls",this.olEle.id),this.summaryEle.setAttribute("tabindex","0"),this.summaryEle.setAttribute("aria-expanded","false"),this.summaryEle.setAttribute("role","button")}get options(){return this.olEle.querySelectorAll("li")}setMenuAttrs(e){if(this.className=e.class,this.toggle_visibility(!0),this.summaryEle.id||(this.summaryEle.id=e.id||g()),this.summaryEle.setAttribute("aria-label",e.menuTitle||"Menu"),e.summaryTitle&&(this.summaryEle.textContent=e.summaryTitle),e.summaryIcon){const t=d(this.player,e.summaryIcon);t.setAttribute("tabindex",""),this.summaryEle.append(t)}e.menuTitle&&(this.menuTitle.textContent=e.menuTitle),this.menu.classList.toggle("fp-icons",!!e.icons),this.addEventListener(e.options_event,e=>{this.render(e.data)}),e.item_selected_event&&this.addEventListener(e.item_selected_event,e=>{void 0!==e.data&&this.select_item(e.data.selected_index)})}render(e){this.olEle&&(this.olEle.innerHTML="",e&&e.forEach(this.menuOption,this),this.toggle_visibility(!(null==e?void 0:e.length)))}menuOption(t,n){const s=document.createElement("li");s.setAttribute("tabindex","0"),t.icon&&s.append(t.icon);const i=document.createElement("span");i.textContent=t.text,s.append(i),this.olEle.appendChild(s),t.isButton?(s.setAttribute("role","menuitem"),s.addEventListener(e,()=>{"function"==typeof t.onclick&&t.onclick()})):(s.setAttribute("role","menuitemradio"),s.setAttribute("aria-checked","false"),s.addEventListener(e,()=>{this.select_item(n),"function"==typeof t.onclick&&t.onclick()}),t.selected&&this.select_item(n))}select_item(e){var t;if(
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.asel=t())}(this,function(){"use strict";const e="click",t="audio:set",n="audio:update",s="audio:tracks";var i=Object.freeze({__proto__:null,SET:t,SWITCH:n,TRACKS:s});function o(e,t,n){const s=function(e){return Array.isArray(e)?e.slice(0):e.split(".")}(t);for(;s.length;){if(null==e)return n;const t=s.shift();if("string"!=typeof t)return n;e=e[t]}return null==e?n:e}const r=navigator.languages||[navigator.language];const a="@flowplayer/audio/track";function l(e,n){e.emit(t,n),n.autoselect&&e._storage.setItem(a,n.lang)}function c(e){return e.toLowerCase()}function u(e,t,n){t=t.slice(0);const s={},i=e.getItem(a);let l=function(){try{return r.reduce((e,t)=>~t.indexOf("-")?e.concat(t,t.split("-")[0]):e.concat(t),[])}catch(e){return[]}}().map(c),u=-1;if("number"==typeof n)return n;for("string"==typeof n&&(n=n.toLowerCase(),~l.indexOf(n)&&l.splice(l.indexOf(n),1),l.unshift(c(n))),Array.isArray(n)&&(l=n.map(c));t.length;){++u;const e=t.shift();if(null==e?void 0:e.autoselect){if(i==e.lang)return console.debug("restoring lang from previous session: ",i),u;if(e.default&&(s.fallback=[u,e]),e.lang&&~l.indexOf(e.lang.toLowerCase())){const t=l.indexOf(e.lang);if(t<o(s,"by_lang.2",1/0)&&(s.by_lang=[u,e,t]),0===t)break}}}return o(s,"by_lang.0",o(s,"fallback.0",void 0))}const d=(e,t)=>new(((e,t)=>{const n=e.get(t);if(!n)throw new Error(`no flowplayer component with the name ${t} exists`);const s=window.customElements.get(t);if(!s)throw new Error(`no default flowplayer component with the name ${t} exists`);const i=window.customElements.get(n);return"function"!=typeof i?s:i})(e._customElements,t))(e);class FlowplayerComponent extends HTMLElement{constructor(e){super(),this.player=e}}const m="has-menu-opened",f="fp-menu-container",h="fp-on",p="fp-invis",y="details[open]."+f;class FlowplayerMenu extends FlowplayerComponent{constructor(t){super(t),this.player=t,this.menuContainer=document.createElement("details"),this.summaryEle=document.createElement("summary"),this.menuHeader=document.createElement("div"),this.menuTitle=document.createElement("h3"),this.olEle=document.createElement("ol"),this.olEle.id=g(),this.menu=document.createElement("div"),this.closeEle=document.createElement("span"),this.menuHeader.classList.add("fp-menu-header"),this.menuHeader.append(this.menuTitle,this.closeEle),this.menu.classList.add("fp-menu"),this.menu.append(this.menuHeader,this.olEle),this.closeEle.classList.add("fp-close"),this.closeEle.textContent="×",this.menuContainer.classList.add(f),this.menuContainer.append(this.summaryEle,this.menu),this.menuContainer.addEventListener(e,e=>{if(e.defaultPrevented)return;e.preventDefault();const n=this.menuContainer.open;n||(v(),document.active_menu=this.menuContainer),this.menuContainer.open=!n,t.root.classList.toggle(m,!n),this.summaryEle.setAttribute("aria-expanded",n?"false":"true")}),this.addEventListener("focusin",e=>{e.target;HTMLLIElement}),this.addEventListener("focusout",e=>{e.target;HTMLLIElement}),this.append(this.menuContainer),this.olEle.setAttribute("aria-labelledby",this.summaryEle.id),this.olEle.setAttribute("role","menu"),this.summaryEle.setAttribute("aria-haspopup","true"),this.summaryEle.setAttribute("aria-controls",this.olEle.id),this.summaryEle.setAttribute("tabindex","0"),this.summaryEle.setAttribute("aria-expanded","false"),this.summaryEle.setAttribute("role","button")}get options(){return this.olEle.querySelectorAll("li")}setMenuAttrs(e){if(this.className=e.class,this.toggle_visibility(!0),this.summaryEle.id||(this.summaryEle.id=e.id||g()),this.summaryEle.setAttribute("aria-label",e.menuTitle||"Menu"),e.summaryTitle&&(this.summaryEle.textContent=e.summaryTitle),e.summaryIcon){const t=d(this.player,e.summaryIcon);t.setAttribute("tabindex",""),this.summaryEle.append(t)}e.menuTitle&&(this.menuTitle.textContent=e.menuTitle),this.menu.classList.toggle("fp-icons",!!e.icons),this.addEventListener(e.options_event,e=>{this.render(e.data)}),e.item_selected_event&&this.addEventListener(e.item_selected_event,e=>{void 0!==e.data&&this.select_item(e.data.selected_index)})}render(e){this.olEle&&(this.olEle.innerHTML="",e&&e.forEach(this.menuOption,this),this.toggle_visibility(!(null==e?void 0:e.length)))}menuOption(t,n){const s=document.createElement("li");s.setAttribute("tabindex","0"),t.icon&&s.append(t.icon);const i=document.createElement("span");i.textContent=t.text,s.append(i),this.olEle.appendChild(s),t.isButton?(s.setAttribute("role","menuitem"),s.addEventListener(e,()=>{"function"==typeof t.onclick&&t.onclick()})):(s.setAttribute("role","menuitemradio"),s.setAttribute("aria-checked","false"),s.addEventListener(e,()=>{this.select_item(n),"function"==typeof t.onclick&&t.onclick()}),t.selected&&this.select_item(n))}select_item(e){var t;if(this.options[e]&&!(null===(t=this.options[e])||void 0===t?void 0:t.hasAttribute("aria-checked")))throw new Error("Cannot select a button-only item");this.options.forEach((t,n)=>{t.hasAttribute("aria-checked")&&(t.classList.toggle(h,n===e),t.setAttribute("aria-checked",n===e?"true":"false"))})}unselect_item(){this.options.forEach(e=>{e.classList.remove(h),e.hasAttribute("aria-checked")&&e.setAttribute("aria-checked","false")})}toggle_visibility(e){this.classList.toggle(p,e),this.menu.style.setProperty("display",e?"none":"flex")}}function v(){Array.from(document.querySelectorAll(".fp-engine")).forEach(e=>{var t;const n=e.root.querySelector(y);n&&(n.open=!1,null===(t=n.querySelector("summary"))||void 0===t||t.removeAttribute("aria-expanded"),e.root.classList.toggle(m,!1))})}function g(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}function E(e,t,n){const s=function(e,t){const n=new CustomEvent(e,{detail:t,cancelable:!0});return t&&Object.defineProperty(n,"data",{get:()=>t}),n}(t,n);return e.dispatchEvent(s),e}document.addEventListener(e,function(e){this.active_menu&&!e.composedPath().includes(this.active_menu)&&(v(),this.active_menu=void 0)}),function(){let e=!1;try{const t=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("testPassive",null,t),window.removeEventListener("testPassive",null,t)}catch(e){}}();const b="flowplayer-audio-menu";var w;const _=((w=class Asel{constructor(e){((e,t,n)=>{window.customElements.get(t)||window.customElements.define(t,n),e.customElements.get(t)||e.customElements.set(t,t)})(e,b,class extends FlowplayerMenu{})}init(e,r,a){if(!1===e.asel)return;let c=[];const m=d(a,b);m instanceof FlowplayerMenu&&m.setMenuAttrs({summaryTitle:a.i18n("audio.button_txt"),menuTitle:a.i18n("audio.menu_title"),class:"fp-asel",options_event:w.events.TRACKS,item_selected_event:w.events.SWITCH});const f=function(e){const n={tracks:[],events:i};return Object.assign(n,{set:function(s){if(!("number"!=typeof s||s<0||s>n.tracks.length-1))return e.emit(t,n.tracks[s]),n},get:function(e){if("number"==typeof e)return n.tracks[e]}}),n}(a);a.asel=f,a.on("mount",function(){var e;null===(e=function(e,t){const n=e._customElements.get(t);return n&&e.root.querySelector(n)||void 0}(a,a.hasState("is-tv")?"flowplayer-tv-menu":"flowplayer-control"))||void 0===e||e.append(m)}),a.on("src",()=>{f.tracks=[],f.active_track=void 0,E(m,w.events.TRACKS,[])}),a.on(s,function(t){if(!Array.isArray(t.data)||t.data.length===c.length&&t.data.every((e,t)=>e===c[t]))return;c=t.data,f.tracks=c.slice();const n=o(e,"asel.sort");"function"==typeof n&&f.tracks.sort(n),E(m,w.events.TRACKS,Array.from({length:f.tracks.length}).map((e,t)=>{const n=f.tracks[t];return{text:n.name||n.label||n.lang,onclick:l.bind(0,a,n)}})),f.active_track=f.tracks.find(e=>e.enabled),f.active_track&&E(m,w.events.SWITCH,{selected_index:f.tracks.indexOf(f.active_track)});const s=u(a._storage,f.tracks,o(e,"asel.default_lang",!1));return m instanceof FlowplayerMenu&&m.toggle_visibility(t.data.length<2),void 0!==s?f.set(s):void 0}),a.on(n,function(e){var t;null===(t=a.asel)||void 0===t||t.tracks.find((t,n)=>{var s,i;t!==e.detail&&t.id!==(null!==(i=null===(s=e.detail)||void 0===s?void 0:s.id)&&void 0!==i?i:-1)||(a.asel.active_track=t,E(m,w.events.SWITCH,{selected_index:n}))})}),a.audioTracks&&(a.audioTracks.addEventListener("addtrack",function(){a.hls||a.emit(s,Array.from(a.audioTracks))}),a.on(t,function(e){if(a.hls)return;const t=e.detail;f.active_track=t,t&&Array.from(a.audioTracks).forEach(e=>{e.enabled=t.id===e.id,e.enabled&&E(m,w.events.SWITCH,{selected_index:f.tracks.indexOf(t)})})}))}}).pluginName="asel",w.events=i,w);return function(e,t){if("object"==typeof exports&&"undefined"!=typeof module)return t;if(null===document.currentScript)return t;"flowplayer"in e||(e.flowplayer={extensions:[]});const n=e.flowplayer;return"function"==typeof n?(n(t),t):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(t)||n.extensions.push(t),t)}(window,_)});
|
package/plugins/audio.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { Get } from 'type-fest';
|
|
2
2
|
import type { Level } from 'hls.js';
|
|
3
|
+
import type { Paths } from 'type-fest';
|
|
3
4
|
import type { Representation } from 'dashjs';
|
|
5
|
+
import type { Translation } from '@flowplayer/translations';
|
|
4
6
|
import type { TupleToUnion } from 'type-fest';
|
|
5
7
|
|
|
6
8
|
/* Excluded from this release type: AnyLoader */
|
|
@@ -1208,7 +1210,8 @@ declare type Player = HTMLVideoElement & PlayerEventOverloads & {
|
|
|
1208
1210
|
/**
|
|
1209
1211
|
* Adds a language to the project. See {@link https://developer.wowza.com/docs/wowza-flowplayer/player/translations/#using-npm| Official documentation}
|
|
1210
1212
|
*/
|
|
1211
|
-
i18n(k:
|
|
1213
|
+
i18n(k: TranslationKey): string;
|
|
1214
|
+
i18n(k: string, fallback: string): string;
|
|
1212
1215
|
/* Excluded from this release type: deviceId */
|
|
1213
1216
|
/* Excluded from this release type: live_state */
|
|
1214
1217
|
/**
|
|
@@ -1907,6 +1910,15 @@ TOUCH_START = "touchstart";
|
|
|
1907
1910
|
|
|
1908
1911
|
declare const TOUCHED = "is-touched";
|
|
1909
1912
|
|
|
1913
|
+
/**
|
|
1914
|
+
* @public
|
|
1915
|
+
* All possible full paths to each translation, i.e. "core.mute"| "core.play" | "ads.ad" etc.
|
|
1916
|
+
* This type is useful for developers using translation querying based on path, like in lodash's get()
|
|
1917
|
+
*/
|
|
1918
|
+
declare type TranslationKey = Paths<Translation, {
|
|
1919
|
+
leavesOnly: true;
|
|
1920
|
+
}>;
|
|
1921
|
+
|
|
1910
1922
|
declare type TSampleRate = typeof SampleRate;
|
|
1911
1923
|
|
|
1912
1924
|
declare const TV = "is-tv";
|
package/plugins/chapters.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { Get } from 'type-fest';
|
|
2
2
|
import type { Level } from 'hls.js';
|
|
3
|
+
import type { Paths } from 'type-fest';
|
|
3
4
|
import type { Representation } from 'dashjs';
|
|
5
|
+
import type { Translation } from '@flowplayer/translations';
|
|
4
6
|
import type { TupleToUnion } from 'type-fest';
|
|
5
7
|
|
|
6
8
|
/* Excluded from this release type: AnyLoader */
|
|
@@ -1217,7 +1219,8 @@ declare type Player = HTMLVideoElement & PlayerEventOverloads & {
|
|
|
1217
1219
|
/**
|
|
1218
1220
|
* Adds a language to the project. See {@link https://developer.wowza.com/docs/wowza-flowplayer/player/translations/#using-npm| Official documentation}
|
|
1219
1221
|
*/
|
|
1220
|
-
i18n(k:
|
|
1222
|
+
i18n(k: TranslationKey): string;
|
|
1223
|
+
i18n(k: string, fallback: string): string;
|
|
1221
1224
|
/* Excluded from this release type: deviceId */
|
|
1222
1225
|
/* Excluded from this release type: live_state */
|
|
1223
1226
|
/**
|
|
@@ -1916,6 +1919,15 @@ TOUCH_START = "touchstart";
|
|
|
1916
1919
|
|
|
1917
1920
|
declare const TOUCHED = "is-touched";
|
|
1918
1921
|
|
|
1922
|
+
/**
|
|
1923
|
+
* @public
|
|
1924
|
+
* All possible full paths to each translation, i.e. "core.mute"| "core.play" | "ads.ad" etc.
|
|
1925
|
+
* This type is useful for developers using translation querying based on path, like in lodash's get()
|
|
1926
|
+
*/
|
|
1927
|
+
declare type TranslationKey = Paths<Translation, {
|
|
1928
|
+
leavesOnly: true;
|
|
1929
|
+
}>;
|
|
1930
|
+
|
|
1919
1931
|
declare type TSampleRate = typeof SampleRate;
|
|
1920
1932
|
|
|
1921
1933
|
declare const TV = "is-tv";
|