@flowplayer/player 3.9.0 → 3.9.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowplayer/player",
3
- "version": "3.9.0",
3
+ "version": "3.9.1",
4
4
  "description": "video player for the future",
5
5
  "license": "https://flowplayer.com/commercial-license",
6
6
  "main": "default.js",
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 ge=class Bowser{static getParser(e,t=!1){if("string"!=typeof e)throw new Error("UserAgent should be a string");return new Parser(e,t)}static parse(e){return new Parser(e).getResult()}static get BROWSER_MAP(){return ae}static get ENGINE_MAP(){return de}static get OS_MAP(){return oe}static get PLATFORMS_MAP(){return ne}}.parse(window.navigator.userAgent),{platform:me,os:_e,browser:fe}=ge,ye=e=>e&&e.toLowerCase();var ve={rnd:Math.random().toString(36).substr(2,32),os:ye(_e.name+(_e.versionName?" "+_e.versionName:"")),device:ye(me.type),browser:ye(fe.name),browser_version:(fe&&fe.version?fe.version:"unknown").split(".").shift(),plugin_version:"3.9.0"};const Ae="https://fp-eu-w1-aai.flowplayer.com/in",we="POST",be=["ad-requested","ad-request-error","ad-request-completed","ad-completed","ad-started","ad-error","ad-skipped"],Ee=["event_type","ad_tag_id","media_id","player_id","site_id","sitegroup_id","rnd","os","device","browser","browser_version","plugin_version","player_version"],Se=["vast_error","reason","request_load_time","ad_type","vast_ad_id"],Le=v("ads/analytics"),Te=RequestQueue.of(),Oe=(...e)=>Object.assign({},...e);class Analytics{constructor(e,t={}){this.emitter=e,this.metadata=Oe(ve,t.metadata||{}),this.emitter=e,this.events=t.events||[],this.required_keys=t.required_keys||[],this.optional_keys=t.optional_keys||[],this.valid_keys=this.required_keys.slice(0).concat(this.optional_keys),Le(this),this.wireup()}static of(e,t){return new Analytics(e,t)}static ensure_required_keys(e,t){return e.required_keys.filter(e=>!(e in t))}static pluck_valid_keys(e,t){return((e,...t)=>Object.keys(e).filter(e=>~t.indexOf(e)).reduce((t,s)=>Object.assign(t,{[s]:e[s]}),{}))(t,...e.valid_keys)}static mergeMetadata(e,t={}){return e.metadata=Analytics.pluck_valid_keys(e,Oe(e.metadata,t,{player_version:"3.9.0"})),e}wireup(){this.events.forEach(e=>{this.emitter.on(e,t=>{const s=t.detail,i=Oe(this.metadata,{event_type:e},s),r=Analytics.pluck_valid_keys(this,i),a=Analytics.ensure_required_keys(this,r);if(Le(`Event[${e}]`,{payload:r,observation:s}),a.length)return Le(`Analytics.validate_metadata() failed for\n Event[${e}]\n missing keys: ${a}`,r);RequestQueue.rpush(Te,[Ae,we,r])})})}destroy(){this.emitter=this.metadata=this.events=this.required_keys=this.optional_keys=this.valid_keys=void 0}}const Re=v("ads/controller"),Me={show_all_ads_on_seek:!1,timeout:5e3,preload_advance:10};class AdsController extends class EventBus{constructor(e=document.createElement("div"),t=[]){this._bus=e,this._listeners=t}removeAllListeners(){this._listeners.length=0,this._bus=document.createElement("div")}emit(e,t){const s=new CustomEvent(e,{detail:t||{}});this._bus.dispatchEvent(s)}on(e,t){this._listeners.push([e,t]),this._bus.addEventListener(e,t,{passive:!0})}once(e,t){this._bus.addEventListener(e,t,{once:!0})}removeListener(e,t){this._bus.removeEventListener(e,t)}}{constructor(e={}){var t;super(),this.adapter=function(e,t){return e.adapter?new e.adapter(t):new IMA(t)}(e,this),this.opts=Object.assign(Object.assign({},Me),e),this.analytics=(t=this,Analytics.of(t,{required_keys:Ee,optional_keys:Se,events:be})),this._state=AdsState.of(),this._schedule=void 0,this._lastAd=void 0,this._macros=new Macros(e.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();this.analytics=void 0,this.opts=void 0,this.adapter=void 0,this._state=void 0,this._schedule=void 0,this._lastAd=void 0,this._macros=void 0}stop(){this.adapter&&this.adapter.stop()}onContentNewSrc(){this._state.reset(),this.adapter.destroyManager(),this.adapter.contentComplete()}wireup(){const e=()=>{var e;const t=new CustomEvent("ad/playing");null===(e=this.videoTag)||void 0===e||e.dispatchEvent(t),this._state.toggleState(te.PLAYING,!0)};this.on("ad-play-requested",e),this.on("ad-started",e),this.on("ad-resumed",e);const t=()=>{var e;if(!this.adPlaying)return;const t=new CustomEvent("ad/paused");null===(e=this.videoTag)||void 0===e||e.dispatchEvent(t),this._state.toggleState(te.PLAYING,!1)};this.on("ad-break-completed",t),this.on("ad-teardown",t),this.on("ad-playback-error",t),this.on("ad-request-error",t),this.on("ad-paused",t),this.on("ad-skipped",t),this.on("ad-completed",t),this.on("ad-break-completed",()=>{requestAnimationFrame(()=>{var e;const t=new CustomEvent("ad/complete");null===(e=this.videoTag)||void 0===e||e.dispatchEvent(t),this._state.toggleState(te.BREAK_ACTIVE,!1)})}),this.on("ad-adapter-init-failed",()=>{console.error("Adapter init failed"),t(),this._state.toggleState(te.FATAL_ERROR,!0)}),this.on("reload-ad-requested",async e=>{if(Re("Ads.on(RELOAD_AD_REQUESTED)",e),this._schedule){if(t(),e)return this._schedule.reset(this._schedule.getAds());this._state.hasAny(te.AD_AVAILABLE)&&(this._schedule.decrement(),this._state.toggleState(te.AD_AVAILABLE,!1))}})}async initialize(e,t={},s){return Re("Ads.initialize():",e,t,s),this._state.toggleState(te.INITIALIZING,!0),Object.assign(this.opts,t),Array.isArray(e)&&this.setSchedule(e),await this.adapter.init(this.opts),this._macros=this._macros.fork(Object.assign({},t.parameters||{},{autoplay:t.autoplay,muted:t.muted})),this.adapter.isReady()&&await this.adapterInitialized(s),this}get videoTag(){return this.adapter.getVideoTag()}get adInfo(){return this.adapter.getAdInfo()}async setVideoTag(e){Re("Ads.setVideoTag():",e),await this.adapter.setVideoTag(e),this.trigger("ad-videotag-attached",e),this.adapter.isReady()&&await this.adapterInitialized(),e.on("request/ad/pause",()=>this.adapter.pause()),e.on("request/ad/play",()=>this.adapter.resume()),e.on("request/ad/muteunmute",()=>e.toggleMute()),e.on("volumechange",()=>{this.adapter.volume(e.muted?0:0==e.volume?.1:e.volume)}),e.on("src",()=>e.hasState("ad-playing")||e.hasState("ad-paused")?(this.stop(),this.adapter.isLinearAd()?(this.setIsContentProcessingNewSrc(!0),void this.once("ad-break-completed",()=>{setTimeout(()=>{this.setIsContentProcessingNewSrc(!1),this.onContentNewSrc()},0)})):this.onContentNewSrc()):this.onContentNewSrc())}waitForVideoTag(){return new Promise(e=>{const t=this.adapter.getVideoTag();if(t)return e(t);this.on("ad-videotag-attached",t=>{this.once(g,()=>e(t))})})}async adapterInitialized(e){Re("Ads.adapterInitialized()"),this._state.toggleState(te.INITIALIZING,!1),this._state.toggleState(te.BREAK_ACTIVE,!!this.hasPreroll()),await this.setCurrentTime(0,e),this.checkIfBreakComplete(),this.adapter.isAdPod()||e&&!this.opts.autoplay||this.trigger("ad-teardown")}async fetchNextAd(e,t=0){var s,i;if(!this._schedule)return;if(!this.adapter.isReady())return;if(t>50)throw this._state.toggleState(te.FATAL_ERROR,!0),this._state.toggleState(te.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===e)if(this._schedule.waitForLoad(e,r,this.opts.preload_ads))this._state.toggleState(te.FETCHING_AD,!1);else if(r===this._schedule.getPostroll()&&this._schedule.setPostrollActive(),this._schedule.isDrained()||this._schedule.increment(),r){Re("Ads.fetchNextAd",r),this._state.toggleState(te.FETCHING_AD,!0);try{return await this.requestAd(r),this._state.toggleState(te.AD_AVAILABLE,!0),void this._state.toggleState(te.FETCHING_AD,!1)}catch(s){if(Re("Ads.fetchNextAd(err: %o, ad: %o)",s,r),this.setLastAd(r),r!==this._schedule.getPostroll())return await this.fetchNextAd(e,++t)}}else this._state.toggleState(te.FETCHING_AD,!1)}skipAdsOnSeek(e){if(!this._schedule)return;let t=this._schedule.getNextAd();for(;t&&t.time<e;)this._schedule.increment(),t=this._schedule.getNextAd()}async setCurrentTime(e,t=!1,s=!1){if(!this._schedule)return;if(!this.adapter.isReady())return;if(this._state.hasAny(te.FETCHING_AD))return;if(this._state.hasAny(te.PLAYING)&&this.adapter.isLinearAd())return;const i=0===e&&0===this._schedule.getNextIndex();try{if(s&&!this.opts.show_all_ads_on_seek&&this.skipAdsOnSeek(e),this._state.hasAny(te.AD_AVAILABLE)||await this.fetchNextAd(e),!this._state.hasAny(te.AD_AVAILABLE)||!this.shallPlayAd(e)||t)return;await this.playAd(),await this.setCurrentTime(e),this.checkIfBreakComplete()}catch(e){Re("setCurrentTime: Error(from: setCurrentTime, message: %s)",e.message)}finally{i&&this.trigger("ad-preroll-finished")}}async playAd(){var e;if(!this._state.hasAny(te.AD_AVAILABLE))return;this._state.toggleState(te.AD_AVAILABLE,!1),this._state.toggleState(te.BREAK_ACTIVE,!0);const t=null===(e=this._schedule)||void 0===e?void 0:e.getCurrentAd();try{await this.adapter.playAd()}catch(e){console.error("Ads.playAd: error",e)}finally{t&&this.setLastAd(t)}}checkIfBreakComplete(){if(!this._state.hasAny(te.BREAK_ACTIVE))return Re("Ads.checkIfBreakComplete(:bail, ad: %o)",this.getLastAd());Re("Ads.checkIfBreakComplete(:run, ad: %o)",this.getLastAd()),this._state.toggleState(te.BREAK_ACTIVE,!1),this.adapter.isAdPod()||this.trigger("ad-break-completed")}resetScheduleCounter(){this._schedule&&this._schedule.resetCounter()}setSchedule(e,t){if(t&&!isNaN(t)&&this._schedule&&this._schedule.updateContentDuration(t),this._schedule&&this._schedule.getNextIndex()>0)return this._schedule.setAds(e);this._schedule=new Schedule(e,{preload_advance:this.opts.preload_advance,content_duration:t?0:t})}toJSON(){return this._schedule?this._schedule.toJSON():[]}trigger(e,t={}){var s;if(!this.adapter.getVideoTag())return;if(!this._state)return;if("ad-break-completed"===e&&this._state.hasAny(te.BREAK_ACTIVE)&&!this.adapter.isAdPod())return Re("skipping AD_BREAK_COMPLETE reason: %s pod=%s",this._state.toString(),this.adapter.isAdPod());if(null===(i=t)||"object"!=typeof i||X(i)!==J)return this.dispatch(e,t);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},t);return this.dispatch(e,r)}dispatch(e,t){const s=this.adapter.getVideoTag();if(s){Re(":dispatch",e,t);try{const i={event:"ads/"+e,detail:{outstream:t.outstream,ad_type:t.ad_type,ad_break_time:t.time,ad_remaining_seconds:t.remaining,ad_muted:t.muted,ad_duration_seconds:t.duration,ad_error_reason:t.reason,ad_vast_error:t.vast_error,ad_vast_error_type:t.vast_error_type,ad_request_load_type:t.request_load_time}};s.dispatchEvent(new CustomEvent("health:record",{detail:i}))}catch(e){Re(":error",e)}se(s,e,t),this.emit(e,t)}}get ad_type(){return this._schedule&&this._schedule.getCurrentType()}shouldRestartContent(){if(this.getIsContentProcessingNewSrc())return!1;if(this.adapter.isAdPod())return!0;const e=this.getLastAd();return!e||!e.outstream&&!1!==e.restart}async finished(e){if(this._schedule&&(Re("Ads.finished"),!(this.adapter.isSharedVideoTag()&&this._state.hasAny(te.PLAYING)&&this.adapter.isLinearAd()))){Re("Ads.finished: trying to play postroll");try{if(!this._schedule.getPostroll())return Re("Ads.finished: no postroll found"),await this.adapter.contentComplete();this._state.hasAny(te.AD_AVAILABLE)||await this.fetchNextAd(-1),await this.playAd(),this.adapter.contentComplete()}catch(e){Re("Ads.finished: postroll failed:",e)}finally{this.trigger("ad-postroll-finished"),this.checkIfBreakComplete(),"function"==typeof e&&e()}}}hasPreroll(){return this._schedule&&Schedule.hasPreroll(this._schedule.getAds())}shallPlayAd(e){var t;return(!this.adapter||!this.adapter.isAdPod())&&(!(!this._state||this._state.hasAny(te.FATAL_ERROR))&&!!(null===(t=this._schedule)||void 0===t?void 0:t.shallPlayAd(e)))}setLastAd(e){return this._lastAd=e,this}setIsContentProcessingNewSrc(e){this.content_processing_src=e}getLastAd(){return this._lastAd}getIsContentProcessingNewSrc(){return this.content_processing_src}mergeMacros(e={}){return this._macros=this._macros.fork(Object.assign({},e)),this}get paused(){return this.adapter&&this.adapter.isPaused()}pause(){this.adapter&&this.adapter.pause()}resume(){this.adapter&&this.adapter.resume()}resize(e){this.adapter&&this.adapter.onResize(e)}async requestAd(e,t=0,s=this.opts.timeout){if(!this._state)return;Re("Ads.requestAd(ad: %o)",{ad:e,timeout:s,idx:t});const i=await async function e(t){if("function"==typeof t)return[await Z(t)];if("string"==typeof t)return[await Z(t)];if(Array.isArray(t)){const e=t;return await Promise.all(e.map(Z))}if("object"==typeof t&&t&&t.adTag)return await e(t.adTag);throw new Error(`\n unhandled ads type ${typeof t}:\n ${JSON.stringify(t)}\n can be:\n | Array<string>\n | string\n | function\n | {adTag: Array<string>|string|function}\n `)}(e);if(void 0===i[t])return Promise.reject(new Error("Ad failed, no fallbacks left"));if(!i[t])return await this.requestAd(i,t+1,s);this.trigger("ad-requested",e);const r=this._macros.compile(i[t],K(this.opts,this.adapter.getDimensions()));try{return void await this.adapter.initAd(r,s)}catch(e){return Re(`Ads.requestAd(:fallback, idx: ${t}, length: ${i.length}, adTag: ${i[t]})\nError `,{adTag:i,err:e}),this.requestAd(i,t+1,s)}}resetSchedule(e){this._schedule&&this._schedule.reset(e)}get adPlaying(){return this._state&&this._state.hasAny(te.PLAYING)}get adBreak(){return this._state&&this._state.hasAny(te.BREAK_ACTIVE)}get adRequesting(){return this._state.hasAny(te.FETCHING_AD)}get adLinear(){return this.adBreak&&this.adapter.isLinearAd()}}var De=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"}),Ie=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 Pe(e){return Object.assign({muted:!1,timeout:250,inline:!1},e)}function ke(e,t){var s=e.muted,i=e.timeout,r=e.inline,a=t(),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(e){d=n.play(),l=setTimeout((function(){c(!1,new Error("Timeout "+i+" ms has been reached"))}),i),c=function(t){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;n.remove(),n.srcObject=null,clearTimeout(l),e({result:t,error:s})},void 0!==d?d.then((function(){return c(!0)})).catch((function(e){return c(!1,e)})):c(!0)}))}var Ce={audio:function(e){return ke(e=Pe(e),(function(){return{element:document.createElement("audio"),source:URL.createObjectURL(De)}}))},video:function(e){return ke(e=Pe(e),(function(){return{element:document.createElement("video"),source:URL.createObjectURL(Ie)}}))}};let Ne=void 0;async function Ue(e=!0){return Ne||(Ne=await Ce.video({timeout:500,muted:e}),Ne)}const xe=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 Fe=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});function qe(e){const t="number"==typeof e?e:parseInt(e,10);return(t>9?"":"0")+t}const Be=["progress","duration","remaining"],je=v("ads/ui");class AdUI extends HTMLElement{constructor(e,t=document.createElement("div")){super(),this.player=e,this.adContainer=t,this.render(),e.addEventListener("ad/playing",e=>this.updateState(e.type)),e.addEventListener("ad/paused",e=>this.updateState(e.type)),e.addEventListener("ad/complete",e=>this.updateState(e.type)),e.on("ad-progress",e=>{const{remaining:t}=e.detail;this.setAttribute("remaining",t+"")}),e.on("ad/hide-first-frame",e=>{const{root:t}=e.detail;je("hideFirstFrame"),t.classList.toggle("ad-hide-first-frame",!0)}),e.on("ad/show-first-frame",e=>{const{root:t}=e.detail;je("showFirstFrame"),t.classList.toggle("ad-hide-first-frame",!1)}),e.on("ad/resize",e=>{const{opts:t}=e.detail,s=this.style;t.linear?t.width&&(s.width=t.width+"px"):t.width?this.adContainer.style.width=t.width+"px":s.removeProperty("width"),t.height?s.height=t.height+"px":s.removeProperty("height")}),e.on("ad/set-ui-flags",e=>{let{ui_flags:t}=e.detail;if(t=t||0,this.classList.toggle("is-ad-controls-sticky",(1&t)>0),this.classList.toggle("no-fullscreen",(2&t)>0),this.classList.toggle("no-indicator",(4&t)>0),(8&t)>0){const e=document.createElement("div");e.classList.add("ad-attribution"),e.textContent=this.player.i18n("ads.advertisement","Advertisement"),this.adContainer.append(e)}if(this.classList.toggle("no-volume-bar",0==(64&t)),(32&t)>0&&this.controls&&(this.remaining=document.createElement("div"),this.remaining.classList.add("fp-ad-remaining","fp-color-text"),this.controls.prepend(this.remaining)),(16&t)>0&&this.controls){this.classList.toggle("is-ad-choices",!0);const e=document.createElement("div");e.classList.add("fp-ad-choices"),e.textContent=this.player.i18n("ads.adchoices","AdChoices"),e.addEventListener("click",e=>{e.preventDefault(),this.player.togglePlay(!1),window.open("https://adssettings.google.com","_blank")}),this.controls.append(e)}})}static get observedAttributes(){return Be}updateState(e){["ad/paused","ad/playing"].forEach(t=>{const s=t.replace("/","-"),i=e===t;this.player.setState(s,i),this.classList.toggle(s,i)})}attributeChangedCallback(e,t,s){switch(e){case"duration":return this.onDurationChange(parseFloat(s));case"progress":return this.onProgress(parseFloat(t),parseFloat(s));case"remaining":return this.onRemaining(s)}}onDurationChange(e){}onProgress(e,t){}onRemaining(e){this.remaining&&(this.remaining.textContent=function(e){if(isNaN(e)||e>=Number.MAX_SAFE_INTEGER)return"";const t=e<0?"-":"";e=Math.round(Math.abs(e));const s=Math.floor(e/3600);let i=Math.floor(e/60);return e-=60*i,s>=1?(i-=60*s,t+s+":"+qe(i)+":"+qe(e)):t+qe(i)+":"+qe(e)}(parseFloat(e)))}render(){this.adContainer.classList.add("fp-ad-container"),this.append(this.adContainer),this.controls=A(this.player,"flowplayer-ad-controls");const e=A(this.player,"flowplayer-ad-countdown");this.append(this.controls,e)}}const Ve=v("fpads:native:outstream"),ze={OUTSTREAM:"is-outstream",HIDDEN:"is-outstream-hidden",SHOWING:"is-outstream-visible",DONE:"is-outstream-done"};var He,Ge;!function(e){e.OUTSTREAM_VISIBLE="ads-outstream-visible",e.OUTSTREAM_VIEWPORT_UPDATE="ads-outstream-viewport-update",e.OUTSTREAM_TEARDOWN="ads-outstream-teardown",e.OUTSTREAM_ENDSCREEN_READY="ads-outstream-endscreen-ready"}(He||(He={})),function(e){e[e.None=0]="None",e[e.Booting=1]="Booting",e[e.Ready=2]="Ready",e[e.Disposed=3]="Disposed"}(Ge||(Ge={}));class Outstream{constructor({ads:e,root:t,content:s,ima:i}){this.state=Ge.None,Ve("creating Outstream instance"),this.content=s,this.ads=e,this.root=t,this.ima=i,this.aspectRatio=s.videoHeight/s.videoWidth,this.dimensions=function(e){if(e.clientWidth>0||e.clientHeight)return h(e);const t={height:e.style.height};p(e,"opacity",0),p(e,"display","absolute"),p(e,"display","inline-block"),p(e,"height","auto");const s=h(e);return p(e,"height",t.height),p(e,"opacity",1),s}(this.root),this.adUi=new AdUI(s),this.adContainer=this.adUi.adContainer,this.initialVolumeState={},t.classList.add(ze.OUTSTREAM),t.append(this.adUi),this.hide(),this.ads.on("ad-pause-content",e=>{var t;if(this.state==Ge.Disposed)return;const s=!!(null===(t=e.detail)||void 0===t?void 0:t.linear);this.ads.resize(Object.assign(Object.assign({},this.dimensions),{linear:s}))}),s.on("resize",e=>{if(this.state==Ge.Disposed)return;const t=e.detail;t&&(this.dimensions={width:t.contentRect.width,height:t.contentRect.height},this.ads.resize(this.dimensions))}),s.on("intersectionchange",e=>{if(this.state==Ge.Disposed)return;const t=e.detail;if(t)switch(this.state){case Ge.Booting:return Ve(":boot skipping intersectionchange");case Ge.None:return this.state=Ge.Booting,this.begin_life_cycle();case Ge.Ready:if(t.ratio>=.5&&this.ads.adPlaying)return;t.ratio>=.5&&this.ads.resume(),t.ratio<.5&&this.ads.pause()}}),this.setup(),setTimeout(()=>(this.state=Ge.Booting,this.begin_life_cycle()),0)}hide(){return this}restore_aspect_ratio(){return Ve(`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.adUi.classList.add("linear","on")}async begin_life_cycle(){var e;this.state=Ge.Ready;const{error:t,result:s}=await Ue(!1),{result:i}=await Ue(!0);this.content.emit("ad/set-ui-flags",{ui_flags:null===(e=this.content.opts.ads)||void 0===e?void 0:e.ui}),this.attach_ad_listeners(),this.initialVolumeState={can_autoplay:!(!s&&!i),muted:!s},Ve("Outstream.show() :autoplay >> sound="+s),t&&this.content&&!s&&(this.content.muted=!0,this.content.volume=0),await this.ads.setVideoTag(this.content),await T({ads:this.ads,content:this.content,adContainer:this.adContainer,ima:this.ima,state:{listening:!1},config:this.content.opts}),I({content:this.content,ads:this.ads}),this.state=Ge.Ready}attach_ad_listeners(){const e=this.ads;e.once("ad-pause-content",()=>{this.show(),this.ads.adPlaying&&this.ads.pause()}),this.ima.always_show_controls||e.on("vpaid-init",()=>this.adUi.classList.add("is-vpaid"));const t=()=>{S.forEach(e=>this.ads.removeListener(e,t));const e=new CustomEvent(He.OUTSTREAM_TEARDOWN);Ve("Outstream(:teardown)",e),this.content.dispatchEvent(e)};S.forEach(e=>this.ads.once(e,t)),this.content.once(He.OUTSTREAM_TEARDOWN,e=>{setTimeout(()=>{if(e.defaultPrevented)return this.handle_endscreen();this.dispose()},0)})}handle_endscreen(){this.reset_ui(),this.ads.reset(),M({config:this.content.opts,ui:this.adUi,ads:this.ads,adContainer:this.adContainer,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(xe)})}setup(){this.root.classList.add(Outstream.CLASS.OUTSTREAM),this.root.classList.add(Outstream.CLASS.HIDDEN),this.empty_src()}reset_ui(){const e=this.root;e.classList.remove(Outstream.CLASS.SHOWING),e.classList.remove(Outstream.CLASS.OUTSTREAM),this.adUi.classList.remove("on")}dispose(){if(this.state==Ge.Disposed)return;const e=this.root,t=this.content;this.reset_ui(),e.classList.add(Outstream.CLASS.OUTSTREAM),e.classList.add(Outstream.CLASS.DONE);this.video=this.container=this.ads=0,this.state=Ge.Disposed,t.destroy(),e.innerHTML=""}}function Qe(e){return e&&"number"==typeof e.time}function We(e){return e&&"number"==typeof e.percentage&&"number"!=typeof e.time}Outstream.CLASS=ze;const $e=v("ads/ima/sdk");var Ke;async function Ye(e){var t;if(null===(t=null===window||void 0===window?void 0:window.google)||void 0===t?void 0:t.ima)return void $e(":noop");const s=e._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(e){return new Promise((t,s)=>{let i=document.querySelector(`script[src='${e}']`);if(i)return Ze(i,t,s);i=document.createElement("script"),i.setAttribute("state",Ke.LOADING),Ze(i,t,s),i.src=e,document.head.appendChild(i)})}(s),void $e(":loaded")}catch(e){$e(":error "+e.message,e)}}function Ze(e,t,s){const i=e.getAttribute("state");if(i&&[Ke.ERROR,Ke.LOADED].includes(i))return t(void 0);e.addEventListener("load",()=>{e.setAttribute("state",Ke.LOADED),t(void 0)},{once:!0}),["error","abort"].forEach(t=>{e.addEventListener(t,()=>{e.setAttribute("state",Ke.ERROR),s("script failed to load")},{once:!0})})}!function(e){e.LOADING="loading",e.LOADED="loaded",e.ERROR="error"}(Ke||(Ke={}));const Je=v("ads/index");async function Xe(e,t,s){let i;if(s.on("config",()=>{void 0===i&&e.autoplay&&!s.currentSrc&&(i=e.autoplay,e.autoplay=0),s.ads&&o()}),s.once("loadstart",()=>{setTimeout(()=>{var t;if(!Array.isArray(null===(t=null==e?void 0:e.ima)||void 0===t?void 0:t.ads)&&void 0!==i){if(e.autoplay=i,s.setState("is-autoplay",!0),!s.hasState(f))return s.once("viewenter",()=>s.togglePlay(!0));s.togglePlay(!0)}},0)}),await Ye(s),!("google"in window))return console.warn("google.ima unavailable");let r=!1;const a=s.ads=new AdsController,n=a.analytics;function o(){const o=e.ima;if(!o||!Array.isArray(o.ads))return;const d=e.duration||s.duration;if(o.ads=function(e,t){return Array.isArray(e)?e.filter(e=>Qe(e)||We(e)).reduce((e,s)=>{if(Qe(s))return e.push(s),e;if(s.lazy)return e.push(s),e;if(We(s)){const i=Object.assign({},s),r=s.percentage?s.percentage*t:0;return isNaN(r)||(i.time=r<0||r===t?-1:r),e.push(i),e}return e},[]):(console.warn("AdSchedule was not an Array"),[])}(o.ads,d),a.setSchedule(o.ads,d),e.metadata&&Analytics.mergeMetadata(n,e.metadata),e.metadata&&a.mergeMacros(e.metadata),e.metadata&&o.parameters&&(o.parameters=Object.assign(Object.assign({},o.parameters),e.metadata)),Analytics.mergeMetadata(n,{muted:e.muted||!1,autoplay:e.autoplay||!1}),!r){if(r=!0,e.lang&&!o.Locale&&(o.Locale=e.lang),Schedule.isOutstream(o.ads))return Je("is outstream, returning"),new Outstream({root:t,content:s,ads:a,ima:o});L({config:Object.assign(Object.assign({},e),{autoplay:i}),root:t,content:s,ads:a,ima:o})}}a.resize(h(t)),_&&(s.on(["fullscreenenter","fullscreenexit","webkitendfullscreen"],e=>{var t;const i="fullscreenenter"===e.type;null===(t=null==s?void 0:s.ads)||void 0===t||t.adapter.setIOSPlaysInline(!i)}),a.on("ad-postroll-finished",()=>{a.adapter.isSharedVideoTag()&&a.once("ad-break-completed",()=>{s.src=s.original_src,s.once("canplay",()=>{s.togglePlay(!1)}),s.webkitExitFullscreen()})})),s.on("reap",(function(){a&&a.destroy()})),o()}class AdControls extends HTMLElement{constructor(e){super(),this.player=e,this.render()}render(){this.classList.add("fp-ad-controls");const e=A(this.player,"flowplayer-ad-indicator"),t=document.createElement("div");t.classList.add("ad-playback-controls");const s=A(this.player,"flowplayer-small-play-icon"),i=A(this.player,"flowplayer-small-pause-icon");s.addEventListener("click",()=>{this.player.emit("request/ad/play"),setTimeout((function(){i.focus&&i.focus()}),100)}),i.addEventListener("click",()=>{this.player.emit("request/ad/pause"),setTimeout((function(){s.focus&&s.focus()}),100)}),t.append(s,i);const r=A(this.player,"flowplayer-volume-icon");r.addEventListener("click",()=>this.player.emit("request/ad/muteunmute"));const a=A(this.player,"flowplayer-volume-bar"),n=A(this.player,"flowplayer-header-right-zone");this.append(e,t,r,a,n)}}class AdCountdown extends HTMLElement{constructor(e){super(),this.player=e,e.on("ad-progress",e=>{const{duration:t,remaining:s}=e.detail;this.setAttribute("duration",t+""),this.setAttribute("remaining",s+"")}),e.on("ad-started",e=>{e.detail.linear&&(this.style.setProperty("--ad-percent-previous","0"),this.style.setProperty("--ad-percent-complete","0"))}),this.addEventListener("animationend",()=>{const e=this.style.getPropertyValue("--ad-percent-complete")||"0";this.style.setProperty("--ad-percent-previous",e)})}static get observedAttributes(){return["remaining"]}attributeChangedCallback(e,t,s){switch(e){case"remaining":return this.onRemaining(s)}}onRemaining(e){const t=parseFloat(this.getAttribute("duration")||"0");e||(e=t+"");const s=parseFloat(e),i=this.style.getPropertyValue("--ad-percent-complete")||"0";this.style.setProperty("--ad-percent-previous",i),this.classList.remove("go");const r=((t-s)/t*100).toFixed(3);requestAnimationFrame(()=>{this.style.setProperty("--ad-percent-complete",r),this.classList.add("go")})}}class AdIndicator extends HTMLElement{constructor(e){super(),this.player=e,this.render(),e.on("ad-started",e=>{const{position:t,totals:s}=e.detail.ad;this.setAttribute("position",t+""),this.setAttribute("totals",s+"")})}static get observedAttributes(){return["position","totals"]}attributeChangedCallback(e,t){switch(e){case"position":case"totals":return this.updateText()}}updateText(){if(!this.element)return;const e=parseFloat(this.getAttribute("position")||"0"),t=parseFloat(this.getAttribute("totals")||"0");this.element.textContent=`${this.player.i18n("ads.indicator","ADS")} ${e} / ${t}`}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 et=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:tt}=u();class Ads{constructor(e){this.umd=e,w(e,b,AdUI),w(e,"flowplayer-ad-controls",AdControls),w(e,"flowplayer-ad-countdown",AdCountdown),w(e,"flowplayer-ad-indicator",AdIndicator)}init(e,t,s){if(c.from_token(e.token||"").is_granted(c.permissions.ADS)&&!tt)return Xe(e,t,s)}}return Ads.events=m,Ads.ui=Fe,Ads.tags=et,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 s=e.flowplayer;"function"==typeof s?s(t):(Array.isArray(s.extensions)||(s.extensions=[]),~s.extensions.indexOf(t)||s.extensions.push(t))}(window,Ads),Ads}));
7
+ */const ge=class Bowser{static getParser(e,t=!1){if("string"!=typeof e)throw new Error("UserAgent should be a string");return new Parser(e,t)}static parse(e){return new Parser(e).getResult()}static get BROWSER_MAP(){return ae}static get ENGINE_MAP(){return de}static get OS_MAP(){return oe}static get PLATFORMS_MAP(){return ne}}.parse(window.navigator.userAgent),{platform:me,os:_e,browser:fe}=ge,ye=e=>e&&e.toLowerCase();var ve={rnd:Math.random().toString(36).substr(2,32),os:ye(_e.name+(_e.versionName?" "+_e.versionName:"")),device:ye(me.type),browser:ye(fe.name),browser_version:(fe&&fe.version?fe.version:"unknown").split(".").shift(),plugin_version:"3.9.1"};const Ae="https://fp-eu-w1-aai.flowplayer.com/in",we="POST",be=["ad-requested","ad-request-error","ad-request-completed","ad-completed","ad-started","ad-error","ad-skipped"],Ee=["event_type","ad_tag_id","media_id","player_id","site_id","sitegroup_id","rnd","os","device","browser","browser_version","plugin_version","player_version"],Se=["vast_error","reason","request_load_time","ad_type","vast_ad_id"],Le=v("ads/analytics"),Te=RequestQueue.of(),Oe=(...e)=>Object.assign({},...e);class Analytics{constructor(e,t={}){this.emitter=e,this.metadata=Oe(ve,t.metadata||{}),this.emitter=e,this.events=t.events||[],this.required_keys=t.required_keys||[],this.optional_keys=t.optional_keys||[],this.valid_keys=this.required_keys.slice(0).concat(this.optional_keys),Le(this),this.wireup()}static of(e,t){return new Analytics(e,t)}static ensure_required_keys(e,t){return e.required_keys.filter(e=>!(e in t))}static pluck_valid_keys(e,t){return((e,...t)=>Object.keys(e).filter(e=>~t.indexOf(e)).reduce((t,s)=>Object.assign(t,{[s]:e[s]}),{}))(t,...e.valid_keys)}static mergeMetadata(e,t={}){return e.metadata=Analytics.pluck_valid_keys(e,Oe(e.metadata,t,{player_version:"3.9.1"})),e}wireup(){this.events.forEach(e=>{this.emitter.on(e,t=>{const s=t.detail,i=Oe(this.metadata,{event_type:e},s),r=Analytics.pluck_valid_keys(this,i),a=Analytics.ensure_required_keys(this,r);if(Le(`Event[${e}]`,{payload:r,observation:s}),a.length)return Le(`Analytics.validate_metadata() failed for\n Event[${e}]\n missing keys: ${a}`,r);RequestQueue.rpush(Te,[Ae,we,r])})})}destroy(){this.emitter=this.metadata=this.events=this.required_keys=this.optional_keys=this.valid_keys=void 0}}const Re=v("ads/controller"),Me={show_all_ads_on_seek:!1,timeout:5e3,preload_advance:10};class AdsController extends class EventBus{constructor(e=document.createElement("div"),t=[]){this._bus=e,this._listeners=t}removeAllListeners(){this._listeners.length=0,this._bus=document.createElement("div")}emit(e,t){const s=new CustomEvent(e,{detail:t||{}});this._bus.dispatchEvent(s)}on(e,t){this._listeners.push([e,t]),this._bus.addEventListener(e,t,{passive:!0})}once(e,t){this._bus.addEventListener(e,t,{once:!0})}removeListener(e,t){this._bus.removeEventListener(e,t)}}{constructor(e={}){var t;super(),this.adapter=function(e,t){return e.adapter?new e.adapter(t):new IMA(t)}(e,this),this.opts=Object.assign(Object.assign({},Me),e),this.analytics=(t=this,Analytics.of(t,{required_keys:Ee,optional_keys:Se,events:be})),this._state=AdsState.of(),this._schedule=void 0,this._lastAd=void 0,this._macros=new Macros(e.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();this.analytics=void 0,this.opts=void 0,this.adapter=void 0,this._state=void 0,this._schedule=void 0,this._lastAd=void 0,this._macros=void 0}stop(){this.adapter&&this.adapter.stop()}onContentNewSrc(){this._state.reset(),this.adapter.destroyManager(),this.adapter.contentComplete()}wireup(){const e=()=>{var e;const t=new CustomEvent("ad/playing");null===(e=this.videoTag)||void 0===e||e.dispatchEvent(t),this._state.toggleState(te.PLAYING,!0)};this.on("ad-play-requested",e),this.on("ad-started",e),this.on("ad-resumed",e);const t=()=>{var e;if(!this.adPlaying)return;const t=new CustomEvent("ad/paused");null===(e=this.videoTag)||void 0===e||e.dispatchEvent(t),this._state.toggleState(te.PLAYING,!1)};this.on("ad-break-completed",t),this.on("ad-teardown",t),this.on("ad-playback-error",t),this.on("ad-request-error",t),this.on("ad-paused",t),this.on("ad-skipped",t),this.on("ad-completed",t),this.on("ad-break-completed",()=>{requestAnimationFrame(()=>{var e;const t=new CustomEvent("ad/complete");null===(e=this.videoTag)||void 0===e||e.dispatchEvent(t),this._state.toggleState(te.BREAK_ACTIVE,!1)})}),this.on("ad-adapter-init-failed",()=>{console.error("Adapter init failed"),t(),this._state.toggleState(te.FATAL_ERROR,!0)}),this.on("reload-ad-requested",async e=>{if(Re("Ads.on(RELOAD_AD_REQUESTED)",e),this._schedule){if(t(),e)return this._schedule.reset(this._schedule.getAds());this._state.hasAny(te.AD_AVAILABLE)&&(this._schedule.decrement(),this._state.toggleState(te.AD_AVAILABLE,!1))}})}async initialize(e,t={},s){return Re("Ads.initialize():",e,t,s),this._state.toggleState(te.INITIALIZING,!0),Object.assign(this.opts,t),Array.isArray(e)&&this.setSchedule(e),await this.adapter.init(this.opts),this._macros=this._macros.fork(Object.assign({},t.parameters||{},{autoplay:t.autoplay,muted:t.muted})),this.adapter.isReady()&&await this.adapterInitialized(s),this}get videoTag(){return this.adapter.getVideoTag()}get adInfo(){return this.adapter.getAdInfo()}async setVideoTag(e){Re("Ads.setVideoTag():",e),await this.adapter.setVideoTag(e),this.trigger("ad-videotag-attached",e),this.adapter.isReady()&&await this.adapterInitialized(),e.on("request/ad/pause",()=>this.adapter.pause()),e.on("request/ad/play",()=>this.adapter.resume()),e.on("request/ad/muteunmute",()=>e.toggleMute()),e.on("volumechange",()=>{this.adapter.volume(e.muted?0:0==e.volume?.1:e.volume)}),e.on("src",()=>e.hasState("ad-playing")||e.hasState("ad-paused")?(this.stop(),this.adapter.isLinearAd()?(this.setIsContentProcessingNewSrc(!0),void this.once("ad-break-completed",()=>{setTimeout(()=>{this.setIsContentProcessingNewSrc(!1),this.onContentNewSrc()},0)})):this.onContentNewSrc()):this.onContentNewSrc())}waitForVideoTag(){return new Promise(e=>{const t=this.adapter.getVideoTag();if(t)return e(t);this.on("ad-videotag-attached",t=>{this.once(g,()=>e(t))})})}async adapterInitialized(e){Re("Ads.adapterInitialized()"),this._state.toggleState(te.INITIALIZING,!1),this._state.toggleState(te.BREAK_ACTIVE,!!this.hasPreroll()),await this.setCurrentTime(0,e),this.checkIfBreakComplete(),this.adapter.isAdPod()||e&&!this.opts.autoplay||this.trigger("ad-teardown")}async fetchNextAd(e,t=0){var s,i;if(!this._schedule)return;if(!this.adapter.isReady())return;if(t>50)throw this._state.toggleState(te.FATAL_ERROR,!0),this._state.toggleState(te.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===e)if(this._schedule.waitForLoad(e,r,this.opts.preload_ads))this._state.toggleState(te.FETCHING_AD,!1);else if(r===this._schedule.getPostroll()&&this._schedule.setPostrollActive(),this._schedule.isDrained()||this._schedule.increment(),r){Re("Ads.fetchNextAd",r),this._state.toggleState(te.FETCHING_AD,!0);try{return await this.requestAd(r),this._state.toggleState(te.AD_AVAILABLE,!0),void this._state.toggleState(te.FETCHING_AD,!1)}catch(s){if(Re("Ads.fetchNextAd(err: %o, ad: %o)",s,r),this.setLastAd(r),r!==this._schedule.getPostroll())return await this.fetchNextAd(e,++t)}}else this._state.toggleState(te.FETCHING_AD,!1)}skipAdsOnSeek(e){if(!this._schedule)return;let t=this._schedule.getNextAd();for(;t&&t.time<e;)this._schedule.increment(),t=this._schedule.getNextAd()}async setCurrentTime(e,t=!1,s=!1){if(!this._schedule)return;if(!this.adapter.isReady())return;if(this._state.hasAny(te.FETCHING_AD))return;if(this._state.hasAny(te.PLAYING)&&this.adapter.isLinearAd())return;const i=0===e&&0===this._schedule.getNextIndex();try{if(s&&!this.opts.show_all_ads_on_seek&&this.skipAdsOnSeek(e),this._state.hasAny(te.AD_AVAILABLE)||await this.fetchNextAd(e),!this._state.hasAny(te.AD_AVAILABLE)||!this.shallPlayAd(e)||t)return;await this.playAd(),await this.setCurrentTime(e),this.checkIfBreakComplete()}catch(e){Re("setCurrentTime: Error(from: setCurrentTime, message: %s)",e.message)}finally{i&&this.trigger("ad-preroll-finished")}}async playAd(){var e;if(!this._state.hasAny(te.AD_AVAILABLE))return;this._state.toggleState(te.AD_AVAILABLE,!1),this._state.toggleState(te.BREAK_ACTIVE,!0);const t=null===(e=this._schedule)||void 0===e?void 0:e.getCurrentAd();try{await this.adapter.playAd()}catch(e){console.error("Ads.playAd: error",e)}finally{t&&this.setLastAd(t)}}checkIfBreakComplete(){if(!this._state.hasAny(te.BREAK_ACTIVE))return Re("Ads.checkIfBreakComplete(:bail, ad: %o)",this.getLastAd());Re("Ads.checkIfBreakComplete(:run, ad: %o)",this.getLastAd()),this._state.toggleState(te.BREAK_ACTIVE,!1),this.adapter.isAdPod()||this.trigger("ad-break-completed")}resetScheduleCounter(){this._schedule&&this._schedule.resetCounter()}setSchedule(e,t){if(t&&!isNaN(t)&&this._schedule&&this._schedule.updateContentDuration(t),this._schedule&&this._schedule.getNextIndex()>0)return this._schedule.setAds(e);this._schedule=new Schedule(e,{preload_advance:this.opts.preload_advance,content_duration:t?0:t})}toJSON(){return this._schedule?this._schedule.toJSON():[]}trigger(e,t={}){var s;if(!this.adapter.getVideoTag())return;if(!this._state)return;if("ad-break-completed"===e&&this._state.hasAny(te.BREAK_ACTIVE)&&!this.adapter.isAdPod())return Re("skipping AD_BREAK_COMPLETE reason: %s pod=%s",this._state.toString(),this.adapter.isAdPod());if(null===(i=t)||"object"!=typeof i||X(i)!==J)return this.dispatch(e,t);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},t);return this.dispatch(e,r)}dispatch(e,t){const s=this.adapter.getVideoTag();if(s){Re(":dispatch",e,t);try{const i={event:"ads/"+e,detail:{outstream:t.outstream,ad_type:t.ad_type,ad_break_time:t.time,ad_remaining_seconds:t.remaining,ad_muted:t.muted,ad_duration_seconds:t.duration,ad_error_reason:t.reason,ad_vast_error:t.vast_error,ad_vast_error_type:t.vast_error_type,ad_request_load_type:t.request_load_time}};s.dispatchEvent(new CustomEvent("health:record",{detail:i}))}catch(e){Re(":error",e)}se(s,e,t),this.emit(e,t)}}get ad_type(){return this._schedule&&this._schedule.getCurrentType()}shouldRestartContent(){if(this.getIsContentProcessingNewSrc())return!1;if(this.adapter.isAdPod())return!0;const e=this.getLastAd();return!e||!e.outstream&&!1!==e.restart}async finished(e){if(this._schedule&&(Re("Ads.finished"),!(this.adapter.isSharedVideoTag()&&this._state.hasAny(te.PLAYING)&&this.adapter.isLinearAd()))){Re("Ads.finished: trying to play postroll");try{if(!this._schedule.getPostroll())return Re("Ads.finished: no postroll found"),await this.adapter.contentComplete();this._state.hasAny(te.AD_AVAILABLE)||await this.fetchNextAd(-1),await this.playAd(),this.adapter.contentComplete()}catch(e){Re("Ads.finished: postroll failed:",e)}finally{this.trigger("ad-postroll-finished"),this.checkIfBreakComplete(),"function"==typeof e&&e()}}}hasPreroll(){return this._schedule&&Schedule.hasPreroll(this._schedule.getAds())}shallPlayAd(e){var t;return(!this.adapter||!this.adapter.isAdPod())&&(!(!this._state||this._state.hasAny(te.FATAL_ERROR))&&!!(null===(t=this._schedule)||void 0===t?void 0:t.shallPlayAd(e)))}setLastAd(e){return this._lastAd=e,this}setIsContentProcessingNewSrc(e){this.content_processing_src=e}getLastAd(){return this._lastAd}getIsContentProcessingNewSrc(){return this.content_processing_src}mergeMacros(e={}){return this._macros=this._macros.fork(Object.assign({},e)),this}get paused(){return this.adapter&&this.adapter.isPaused()}pause(){this.adapter&&this.adapter.pause()}resume(){this.adapter&&this.adapter.resume()}resize(e){this.adapter&&this.adapter.onResize(e)}async requestAd(e,t=0,s=this.opts.timeout){if(!this._state)return;Re("Ads.requestAd(ad: %o)",{ad:e,timeout:s,idx:t});const i=await async function e(t){if("function"==typeof t)return[await Z(t)];if("string"==typeof t)return[await Z(t)];if(Array.isArray(t)){const e=t;return await Promise.all(e.map(Z))}if("object"==typeof t&&t&&t.adTag)return await e(t.adTag);throw new Error(`\n unhandled ads type ${typeof t}:\n ${JSON.stringify(t)}\n can be:\n | Array<string>\n | string\n | function\n | {adTag: Array<string>|string|function}\n `)}(e);if(void 0===i[t])return Promise.reject(new Error("Ad failed, no fallbacks left"));if(!i[t])return await this.requestAd(i,t+1,s);this.trigger("ad-requested",e);const r=this._macros.compile(i[t],K(this.opts,this.adapter.getDimensions()));try{return void await this.adapter.initAd(r,s)}catch(e){return Re(`Ads.requestAd(:fallback, idx: ${t}, length: ${i.length}, adTag: ${i[t]})\nError `,{adTag:i,err:e}),this.requestAd(i,t+1,s)}}resetSchedule(e){this._schedule&&this._schedule.reset(e)}get adPlaying(){return this._state&&this._state.hasAny(te.PLAYING)}get adBreak(){return this._state&&this._state.hasAny(te.BREAK_ACTIVE)}get adRequesting(){return this._state.hasAny(te.FETCHING_AD)}get adLinear(){return this.adBreak&&this.adapter.isLinearAd()}}var De=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"}),Ie=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 Pe(e){return Object.assign({muted:!1,timeout:250,inline:!1},e)}function ke(e,t){var s=e.muted,i=e.timeout,r=e.inline,a=t(),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(e){d=n.play(),l=setTimeout((function(){c(!1,new Error("Timeout "+i+" ms has been reached"))}),i),c=function(t){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;n.remove(),n.srcObject=null,clearTimeout(l),e({result:t,error:s})},void 0!==d?d.then((function(){return c(!0)})).catch((function(e){return c(!1,e)})):c(!0)}))}var Ce={audio:function(e){return ke(e=Pe(e),(function(){return{element:document.createElement("audio"),source:URL.createObjectURL(De)}}))},video:function(e){return ke(e=Pe(e),(function(){return{element:document.createElement("video"),source:URL.createObjectURL(Ie)}}))}};let Ne=void 0;async function Ue(e=!0){return Ne||(Ne=await Ce.video({timeout:500,muted:e}),Ne)}const xe=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 Fe=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});function qe(e){const t="number"==typeof e?e:parseInt(e,10);return(t>9?"":"0")+t}const Be=["progress","duration","remaining"],je=v("ads/ui");class AdUI extends HTMLElement{constructor(e,t=document.createElement("div")){super(),this.player=e,this.adContainer=t,this.render(),e.addEventListener("ad/playing",e=>this.updateState(e.type)),e.addEventListener("ad/paused",e=>this.updateState(e.type)),e.addEventListener("ad/complete",e=>this.updateState(e.type)),e.on("ad-progress",e=>{const{remaining:t}=e.detail;this.setAttribute("remaining",t+"")}),e.on("ad/hide-first-frame",e=>{const{root:t}=e.detail;je("hideFirstFrame"),t.classList.toggle("ad-hide-first-frame",!0)}),e.on("ad/show-first-frame",e=>{const{root:t}=e.detail;je("showFirstFrame"),t.classList.toggle("ad-hide-first-frame",!1)}),e.on("ad/resize",e=>{const{opts:t}=e.detail,s=this.style;t.linear?t.width&&(s.width=t.width+"px"):t.width?this.adContainer.style.width=t.width+"px":s.removeProperty("width"),t.height?s.height=t.height+"px":s.removeProperty("height")}),e.on("ad/set-ui-flags",e=>{let{ui_flags:t}=e.detail;if(t=t||0,this.classList.toggle("is-ad-controls-sticky",(1&t)>0),this.classList.toggle("no-fullscreen",(2&t)>0),this.classList.toggle("no-indicator",(4&t)>0),(8&t)>0){const e=document.createElement("div");e.classList.add("ad-attribution"),e.textContent=this.player.i18n("ads.advertisement","Advertisement"),this.adContainer.append(e)}if(this.classList.toggle("no-volume-bar",0==(64&t)),(32&t)>0&&this.controls&&(this.remaining=document.createElement("div"),this.remaining.classList.add("fp-ad-remaining","fp-color-text"),this.controls.prepend(this.remaining)),(16&t)>0&&this.controls){this.classList.toggle("is-ad-choices",!0);const e=document.createElement("div");e.classList.add("fp-ad-choices"),e.textContent=this.player.i18n("ads.adchoices","AdChoices"),e.addEventListener("click",e=>{e.preventDefault(),this.player.togglePlay(!1),window.open("https://adssettings.google.com","_blank")}),this.controls.append(e)}})}static get observedAttributes(){return Be}updateState(e){["ad/paused","ad/playing"].forEach(t=>{const s=t.replace("/","-"),i=e===t;this.player.setState(s,i),this.classList.toggle(s,i)})}attributeChangedCallback(e,t,s){switch(e){case"duration":return this.onDurationChange(parseFloat(s));case"progress":return this.onProgress(parseFloat(t),parseFloat(s));case"remaining":return this.onRemaining(s)}}onDurationChange(e){}onProgress(e,t){}onRemaining(e){this.remaining&&(this.remaining.textContent=function(e){if(isNaN(e)||e>=Number.MAX_SAFE_INTEGER)return"";const t=e<0?"-":"";e=Math.round(Math.abs(e));const s=Math.floor(e/3600);let i=Math.floor(e/60);return e-=60*i,s>=1?(i-=60*s,t+s+":"+qe(i)+":"+qe(e)):t+qe(i)+":"+qe(e)}(parseFloat(e)))}render(){this.adContainer.classList.add("fp-ad-container"),this.append(this.adContainer),this.controls=A(this.player,"flowplayer-ad-controls");const e=A(this.player,"flowplayer-ad-countdown");this.append(this.controls,e)}}const Ve=v("fpads:native:outstream"),ze={OUTSTREAM:"is-outstream",HIDDEN:"is-outstream-hidden",SHOWING:"is-outstream-visible",DONE:"is-outstream-done"};var He,Ge;!function(e){e.OUTSTREAM_VISIBLE="ads-outstream-visible",e.OUTSTREAM_VIEWPORT_UPDATE="ads-outstream-viewport-update",e.OUTSTREAM_TEARDOWN="ads-outstream-teardown",e.OUTSTREAM_ENDSCREEN_READY="ads-outstream-endscreen-ready"}(He||(He={})),function(e){e[e.None=0]="None",e[e.Booting=1]="Booting",e[e.Ready=2]="Ready",e[e.Disposed=3]="Disposed"}(Ge||(Ge={}));class Outstream{constructor({ads:e,root:t,content:s,ima:i}){this.state=Ge.None,Ve("creating Outstream instance"),this.content=s,this.ads=e,this.root=t,this.ima=i,this.aspectRatio=s.videoHeight/s.videoWidth,this.dimensions=function(e){if(e.clientWidth>0||e.clientHeight)return h(e);const t={height:e.style.height};p(e,"opacity",0),p(e,"display","absolute"),p(e,"display","inline-block"),p(e,"height","auto");const s=h(e);return p(e,"height",t.height),p(e,"opacity",1),s}(this.root),this.adUi=new AdUI(s),this.adContainer=this.adUi.adContainer,this.initialVolumeState={},t.classList.add(ze.OUTSTREAM),t.append(this.adUi),this.hide(),this.ads.on("ad-pause-content",e=>{var t;if(this.state==Ge.Disposed)return;const s=!!(null===(t=e.detail)||void 0===t?void 0:t.linear);this.ads.resize(Object.assign(Object.assign({},this.dimensions),{linear:s}))}),s.on("resize",e=>{if(this.state==Ge.Disposed)return;const t=e.detail;t&&(this.dimensions={width:t.contentRect.width,height:t.contentRect.height},this.ads.resize(this.dimensions))}),s.on("intersectionchange",e=>{if(this.state==Ge.Disposed)return;const t=e.detail;if(t)switch(this.state){case Ge.Booting:return Ve(":boot skipping intersectionchange");case Ge.None:return this.state=Ge.Booting,this.begin_life_cycle();case Ge.Ready:if(t.ratio>=.5&&this.ads.adPlaying)return;t.ratio>=.5&&this.ads.resume(),t.ratio<.5&&this.ads.pause()}}),this.setup(),setTimeout(()=>(this.state=Ge.Booting,this.begin_life_cycle()),0)}hide(){return this}restore_aspect_ratio(){return Ve(`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.adUi.classList.add("linear","on")}async begin_life_cycle(){var e;this.state=Ge.Ready;const{error:t,result:s}=await Ue(!1),{result:i}=await Ue(!0);this.content.emit("ad/set-ui-flags",{ui_flags:null===(e=this.content.opts.ads)||void 0===e?void 0:e.ui}),this.attach_ad_listeners(),this.initialVolumeState={can_autoplay:!(!s&&!i),muted:!s},Ve("Outstream.show() :autoplay >> sound="+s),t&&this.content&&!s&&(this.content.muted=!0,this.content.volume=0),await this.ads.setVideoTag(this.content),await T({ads:this.ads,content:this.content,adContainer:this.adContainer,ima:this.ima,state:{listening:!1},config:this.content.opts}),I({content:this.content,ads:this.ads}),this.state=Ge.Ready}attach_ad_listeners(){const e=this.ads;e.once("ad-pause-content",()=>{this.show(),this.ads.adPlaying&&this.ads.pause()}),this.ima.always_show_controls||e.on("vpaid-init",()=>this.adUi.classList.add("is-vpaid"));const t=()=>{S.forEach(e=>this.ads.removeListener(e,t));const e=new CustomEvent(He.OUTSTREAM_TEARDOWN);Ve("Outstream(:teardown)",e),this.content.dispatchEvent(e)};S.forEach(e=>this.ads.once(e,t)),this.content.once(He.OUTSTREAM_TEARDOWN,e=>{setTimeout(()=>{if(e.defaultPrevented)return this.handle_endscreen();this.dispose()},0)})}handle_endscreen(){this.reset_ui(),this.ads.reset(),M({config:this.content.opts,ui:this.adUi,ads:this.ads,adContainer:this.adContainer,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(xe)})}setup(){this.root.classList.add(Outstream.CLASS.OUTSTREAM),this.root.classList.add(Outstream.CLASS.HIDDEN),this.empty_src()}reset_ui(){const e=this.root;e.classList.remove(Outstream.CLASS.SHOWING),e.classList.remove(Outstream.CLASS.OUTSTREAM),this.adUi.classList.remove("on")}dispose(){if(this.state==Ge.Disposed)return;const e=this.root,t=this.content;this.reset_ui(),e.classList.add(Outstream.CLASS.OUTSTREAM),e.classList.add(Outstream.CLASS.DONE);this.video=this.container=this.ads=0,this.state=Ge.Disposed,t.destroy(),e.innerHTML=""}}function Qe(e){return e&&"number"==typeof e.time}function We(e){return e&&"number"==typeof e.percentage&&"number"!=typeof e.time}Outstream.CLASS=ze;const $e=v("ads/ima/sdk");var Ke;async function Ye(e){var t;if(null===(t=null===window||void 0===window?void 0:window.google)||void 0===t?void 0:t.ima)return void $e(":noop");const s=e._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(e){return new Promise((t,s)=>{let i=document.querySelector(`script[src='${e}']`);if(i)return Ze(i,t,s);i=document.createElement("script"),i.setAttribute("state",Ke.LOADING),Ze(i,t,s),i.src=e,document.head.appendChild(i)})}(s),void $e(":loaded")}catch(e){$e(":error "+e.message,e)}}function Ze(e,t,s){const i=e.getAttribute("state");if(i&&[Ke.ERROR,Ke.LOADED].includes(i))return t(void 0);e.addEventListener("load",()=>{e.setAttribute("state",Ke.LOADED),t(void 0)},{once:!0}),["error","abort"].forEach(t=>{e.addEventListener(t,()=>{e.setAttribute("state",Ke.ERROR),s("script failed to load")},{once:!0})})}!function(e){e.LOADING="loading",e.LOADED="loaded",e.ERROR="error"}(Ke||(Ke={}));const Je=v("ads/index");async function Xe(e,t,s){let i;if(s.on("config",()=>{void 0===i&&e.autoplay&&!s.currentSrc&&(i=e.autoplay,e.autoplay=0),s.ads&&o()}),s.once("loadstart",()=>{setTimeout(()=>{var t;if(!Array.isArray(null===(t=null==e?void 0:e.ima)||void 0===t?void 0:t.ads)&&void 0!==i){if(e.autoplay=i,s.setState("is-autoplay",!0),!s.hasState(f))return s.once("viewenter",()=>s.togglePlay(!0));s.togglePlay(!0)}},0)}),await Ye(s),!("google"in window))return console.warn("google.ima unavailable");let r=!1;const a=s.ads=new AdsController,n=a.analytics;function o(){const o=e.ima;if(!o||!Array.isArray(o.ads))return;const d=e.duration||s.duration;if(o.ads=function(e,t){return Array.isArray(e)?e.filter(e=>Qe(e)||We(e)).reduce((e,s)=>{if(Qe(s))return e.push(s),e;if(s.lazy)return e.push(s),e;if(We(s)){const i=Object.assign({},s),r=s.percentage?s.percentage*t:0;return isNaN(r)||(i.time=r<0||r===t?-1:r),e.push(i),e}return e},[]):(console.warn("AdSchedule was not an Array"),[])}(o.ads,d),a.setSchedule(o.ads,d),e.metadata&&Analytics.mergeMetadata(n,e.metadata),e.metadata&&a.mergeMacros(e.metadata),e.metadata&&o.parameters&&(o.parameters=Object.assign(Object.assign({},o.parameters),e.metadata)),Analytics.mergeMetadata(n,{muted:e.muted||!1,autoplay:e.autoplay||!1}),!r){if(r=!0,e.lang&&!o.Locale&&(o.Locale=e.lang),Schedule.isOutstream(o.ads))return Je("is outstream, returning"),new Outstream({root:t,content:s,ads:a,ima:o});L({config:Object.assign(Object.assign({},e),{autoplay:i}),root:t,content:s,ads:a,ima:o})}}a.resize(h(t)),_&&(s.on(["fullscreenenter","fullscreenexit","webkitendfullscreen"],e=>{var t;const i="fullscreenenter"===e.type;null===(t=null==s?void 0:s.ads)||void 0===t||t.adapter.setIOSPlaysInline(!i)}),a.on("ad-postroll-finished",()=>{a.adapter.isSharedVideoTag()&&a.once("ad-break-completed",()=>{s.src=s.original_src,s.once("canplay",()=>{s.togglePlay(!1)}),s.webkitExitFullscreen()})})),s.on("reap",(function(){a&&a.destroy()})),o()}class AdControls extends HTMLElement{constructor(e){super(),this.player=e,this.render()}render(){this.classList.add("fp-ad-controls");const e=A(this.player,"flowplayer-ad-indicator"),t=document.createElement("div");t.classList.add("ad-playback-controls");const s=A(this.player,"flowplayer-small-play-icon"),i=A(this.player,"flowplayer-small-pause-icon");s.addEventListener("click",()=>{this.player.emit("request/ad/play"),setTimeout((function(){i.focus&&i.focus()}),100)}),i.addEventListener("click",()=>{this.player.emit("request/ad/pause"),setTimeout((function(){s.focus&&s.focus()}),100)}),t.append(s,i);const r=A(this.player,"flowplayer-volume-icon");r.addEventListener("click",()=>this.player.emit("request/ad/muteunmute"));const a=A(this.player,"flowplayer-volume-bar"),n=A(this.player,"flowplayer-header-right-zone");this.append(e,t,r,a,n)}}class AdCountdown extends HTMLElement{constructor(e){super(),this.player=e,e.on("ad-progress",e=>{const{duration:t,remaining:s}=e.detail;this.setAttribute("duration",t+""),this.setAttribute("remaining",s+"")}),e.on("ad-started",e=>{e.detail.linear&&(this.style.setProperty("--ad-percent-previous","0"),this.style.setProperty("--ad-percent-complete","0"))}),this.addEventListener("animationend",()=>{const e=this.style.getPropertyValue("--ad-percent-complete")||"0";this.style.setProperty("--ad-percent-previous",e)})}static get observedAttributes(){return["remaining"]}attributeChangedCallback(e,t,s){switch(e){case"remaining":return this.onRemaining(s)}}onRemaining(e){const t=parseFloat(this.getAttribute("duration")||"0");e||(e=t+"");const s=parseFloat(e),i=this.style.getPropertyValue("--ad-percent-complete")||"0";this.style.setProperty("--ad-percent-previous",i),this.classList.remove("go");const r=((t-s)/t*100).toFixed(3);requestAnimationFrame(()=>{this.style.setProperty("--ad-percent-complete",r),this.classList.add("go")})}}class AdIndicator extends HTMLElement{constructor(e){super(),this.player=e,this.render(),e.on("ad-started",e=>{const{position:t,totals:s}=e.detail.ad;this.setAttribute("position",t+""),this.setAttribute("totals",s+"")})}static get observedAttributes(){return["position","totals"]}attributeChangedCallback(e,t){switch(e){case"position":case"totals":return this.updateText()}}updateText(){if(!this.element)return;const e=parseFloat(this.getAttribute("position")||"0"),t=parseFloat(this.getAttribute("totals")||"0");this.element.textContent=`${this.player.i18n("ads.indicator","ADS")} ${e} / ${t}`}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 et=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:tt}=u();class Ads{constructor(e){this.umd=e,w(e,b,AdUI),w(e,"flowplayer-ad-controls",AdControls),w(e,"flowplayer-ad-countdown",AdCountdown),w(e,"flowplayer-ad-indicator",AdIndicator)}init(e,t,s){if(c.from_token(e.token||"").is_granted(c.permissions.ADS)&&!tt)return Xe(e,t,s)}}return Ads.events=m,Ads.ui=Fe,Ads.tags=et,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 s=e.flowplayer;"function"==typeof s?s(t):(Array.isArray(s.extensions)||(s.extensions=[]),~s.extensions.indexOf(t)||s.extensions.push(t))}(window,Ads),Ads}));
@@ -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";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(e){var t={exports:{}};return e(t,t.exports),t.exports}var n,r=t((function(t,n){var r=e&&e.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};n.__esModule=!0,n.remove=n.downcase=n.pluck=n.merge=void 0,n.merge=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.reduce((function(e,t){return r(r({},e),t)}),{})},n.pluck=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return Object.keys(e).filter((function(e){return~t.indexOf(e)})).reduce((function(t,r){var i;return n.merge(t,((i={})[r]=e[r],i))}),{})},n.downcase=function(e){return(e||"").toString().toLowerCase()},n.remove=function(e,t){var n=e.lastIndexOf(t);return~n&&e.splice(n,1),e}})),i=t((function(t,n){var i=e&&e.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=e&&e.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=e&&e.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&i(t,e,n);return o(t,e),t};n.__esModule=!0;var u=a(r),s=function(){function e(){this.pending=[],this.open=[],this.stats={failures:0,ttl:0}}return e.of=function(){return new e},e.is_empty=function(e){return 0==e.pending.length},e.is_high_water=function(t){return t.open.length==e.MAX_OPEN_REQUESTS},e.maybe_spawn_req=function(t){if(e.is_empty(t))return t;if(e.is_high_water(t))return t;try{var n=e.lpop(t);n&&e.request(t,n)}catch(e){}},e.increment_failures=function(t){return t.stats.failures++,t.stats.failures>e.MAX_FAILURE_COUNT&&(t.stats.ttl=Date.now()+e.REQUEST_TTL_MS),t},e.handle_error=function(t,n){e.rm(t,n),e.increment_failures(t)},e.request=function(t,n){var r=n[0],i=n[1],o=n[2];if(!(Date.now()<t.stats.ttl)){var a=new XMLHttpRequest;t.open.push(a),a.timeout=e.REQUEST_TIMEOUT_MS,a.ontimeout=function(){e.handle_error(t,a)},a.onerror=function(n){e.handle_error(t,a)},a.onreadystatechange=function(){a.readyState==XMLHttpRequest.DONE&&e.rm(t,a),Math.floor(a.status/100)},a.onload=function(){e.rm(t,a),t.stats.failures&&t.stats.failures--},a.open(i,r),a.setRequestHeader("Content-Type","text/plain;charset=UTF-8");try{a.send(JSON.stringify(o))}catch(e){}}},e.rpush=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];return n.forEach((function(n){t.pending.length>=e.MAX_PENDING||(t.pending.push(n),e.maybe_spawn_req(t))})),t},e.lpop=function(e){return e.pending.shift()},e.rm=function(e,t){return u.remove(e.open,t),e},e.MAX_OPEN_REQUESTS=3,e.MAX_PENDING=5,e.REQUEST_TIMEOUT_MS=4e3,e.REQUEST_TTL_MS=5e3,e.MAX_FAILURE_COUNT=3,e}();n.default=s})),o=t((function(t,n){var r=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};n.__esModule=!0;var o=r(i);n.default=o.default.of()})),a=t((function(e,t){t.__esModule=!0,t.prepare_url=t.URL_PARAM=void 0,t.URL_PARAM=/:([a-zA-Z_]+)/g,t.prepare_url=function(e,n){return e.url.replace(t.URL_PARAM,(function(t){if((t=t.slice(1,t.length))in n)return n[t].toString();e.log.error(new Error("\n preparing url["+e.url+"] failed\n \n parameter["+t+"] not detected in params:\n \n "+JSON.stringify(n,null,2)+"\n "))}))}})),u=t((function(e,t){t.__esModule=!0,t.Log=void 0;var n=function(){function e(e){this.emitter=e}return e.prepare=function(e,t){var n=document.createEvent("Event");return n.initEvent(e,!1,!0),n.ns=e,n.data=t,n},e.of=function(t){return new e(t)},e.prototype.info=function(t){this.emitter.dispatchEvent(e.prepare(e.NAMESPACE.INFO,t))},e.prototype.error=function(t){this.emitter.dispatchEvent(e.prepare(e.NAMESPACE.ERROR,t))},e.prototype.warn=function(t){this.emitter.dispatchEvent(e.prepare(e.NAMESPACE.WARN,t))},e.NAMESPACE={INFO:"tracker:info",ERROR:"tracker:err",WARN:"tracker:warn"},e}();t.Log=n})),s=t((function(e,t){var n;t.__esModule=!0,t.Verb=void 0,(n=t.Verb||(t.Verb={})).POST="POST",n.PUT="PUT",n.GET="GET"})),d=t((function(t,n){var d=e&&e.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),c=e&&e.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),f=e&&e.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&d(t,e,n);return c(t,e),t},l=e&&e.__spreadArrays||function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],a=0,u=o.length;a<u;a++,i++)r[i]=o[a];return r},p=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};n.__esModule=!0;var _=p(o),v=p(i),m=f(a),h=f(r),y=function(){function e(t,n){var r=this;void 0===n&&(n={});var i=this;if(this.emitter=t,this.url=n.url,this.log=u.Log.of(this.emitter),this.verb=n.verb,this.metadata=h.merge({},n.metadata||{}),this.rq=n.rq||_.default,this.events=n.events||[],this.required_keys=n.required_keys||[],this.optional_keys=n.optional_keys||[],this.listeners=[],this.valid_keys=this.required_keys.slice(0).concat(this.optional_keys),e.assert_emitter_api(this.emitter),void 0===e.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");e.TRACKERS.push(this),i.events.forEach((function(t){e.create_listener(r,t,(function(n){void 0===n&&(n={});var o=h.merge(i.metadata,{event_type:t},n.data||n),a=m.prepare_url(i,o),u=e.pluck_valid_keys(i,o),s=e.ensure_required_keys(i,u);if(s.length)return i.log.error("Tracker.validate_metadata() failed for \n Event["+t+"]\n missing keys: "+s+"\n payload:\n "+JSON.stringify(u,null,2));v.default.rpush(r.rq,[a,r.verb,u])}))}))}return e.of=function(t,n){return new e(t,n)},e.ensure_required_keys=function(e,t){return e.required_keys.filter((function(e){return!(e in t)}))},e.pluck_valid_keys=function(e,t){return h.pluck.apply(h,l([t],e.valid_keys))},e.merge_metadata=function(t,n){return void 0===n&&(n={}),t.metadata=e.pluck_valid_keys(t,h.merge(t.metadata,n)),t},e.assert_emitter_api=function(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")},e.create_listener=function(e,t,n){e.listeners.push([t,n]),e.emitter.addEventListener(t,n)},e.prototype.destroy=function(){var t=this;this.listeners.forEach((function(e){var n=e[0],r=e[1];return t.emitter.removeEventListener(n,r)})),delete this.rq,delete this.emitter,h.remove(e.TRACKERS,this)},e.prototype.put=function(t){return void 0===t&&(t={}),e.merge_metadata(this,t),this},e.TRACKERS=[],e.QUEUE=_.default,e.verb=s.Verb,e}();n.default=y})),c=t((function(t,n){var r=e&&e.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=e&&e.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=e&&e.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t},u=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};n.__esModule=!0,n.API=n.Tracker=void 0;var s=u(d);n.Tracker=s.default;var c=o(a);n.API=c}));!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"}(n||(n={}));const f=["localhost","127.0.0.1","0.0.0.0","s.codepen.io","cdpn.io","try.flowplayer.com"];function l(e,t){return!!~f.indexOf(e)||e.indexOf(t)===e.length-t.length}l.check_whitelist=function(e){return!!~f.indexOf(e)};function p(e){this.message=e}p.prototype=new Error,p.prototype.name="InvalidCharacterError";var _="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new p("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,r,i=0,o=0,a="";r=t.charAt(o++);~r&&(n=i%4?64*n+r:r,i++%4)?a+=String.fromCharCode(255&n>>(-2*i&6)):0)r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(r);return a};var v=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(_(e).replace(/(.)/g,(function(e,t){var n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n})))}(t)}catch(e){return _(t)}};function m(e){this.message=e}m.prototype=new Error,m.prototype.name="InvalidTokenError";var h=function(e,t){if("string"!=typeof e)throw new m("Invalid token specified");var n=!0===(t=t||{}).header?0:1;try{return JSON.parse(v(e.split(".")[n]))}catch(e){throw new m("Invalid token specified: "+e.message)}};h.InvalidTokenError=m;const y="production";function g(e,t){const n={valid_jwt:!1,raw:"",data:{acl:0},exp:0};let r={c:"{}",exp:0};t=t||{};try{r=h(e),n.valid_jwt=!0}catch(e){}return n.raw=e,n.data=JSON.parse(r.c),n.exp=r.exp,t.require_valid_token&&g.validate(n),n}function w(e){return{grant:e,is_granted:t=>(e&t)===t}}function k(e,t,n){const r=function(e){return Array.isArray(e)?e.slice(0):e.split(".")}(t);for(;r.length;){if(null==e)return n;const t=r.shift();if("string"!=typeof t)return n;e=e[t]}return null==e?n:e}g.validate=function(e){if("string"==typeof e&&(e=g(e)),!e||!e.raw){if(l.check_whitelist(window.location.hostname)||"dev"===y.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,n=l.bind(null,t);if("dev"!==y.toString()&&e.data.domain&&e.data.domain.length&&!e.data.domain.some(n))throw new Error("Domain not allowed");if("dev"!==y.toString()&&1e3*e.exp-Date.now()<0)throw new Error("Expired token");return!0},g.id=function(e){if(e)return"string"==typeof e&&(e=g(e)),e.data.id},w.of=w,w.from_token=function(e){const t=g(e,{require_valid_token:!0});return w.of(t.data.acl)},w.permissions=n;var E="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};var b="ping",O="display",A="view";const T=["sitegroup_id","session_id","media_id","site_id","player_id","video_type"],S=["created","position"],M=["player_version","created","source","category","category_id","autoplay","muted","customer_user_id"];function P(e,t){return e.duration/1===e.duration&&Object.assign(t,function(e){const t=e/100;return{segment_duration:t,breakpoints:Array(...Array(100)).map((function(e,n){return Math.floor(n*t*1e3)/1e3}))}}(e.duration))}function R(e,t,n){if(!t.segment_duration&&!P(e,t))return;const r=function(e,t,n){const r=t.last_idx,i=n?99:x(e,t);return t.last_idx=i,i<=r?[]:t.breakpoints.slice(r,99==i?100:i).map((function(e){return t.breakpoints.indexOf(e)}))}(e,t,n);0!=r.length&&e.emit(b,{position:r})}function x(e,t){return Math.min(Math.floor(e.currentTime/t.segment_duration),99)}function N(){try{return window.location!==window.parent.location?document.referrer:document.location.href}catch(e){return!1}}const I="vod",L="live",j=[O,b,A];function q(e,t,n){switch(null==t?void 0:t.kind){case"live":return function(e,t){const n=Date.now();n-t.last_tracked_ts<6e4||(t.last_tracked_ts=n,++t.ticks,e.emit(b,{position:60*t.ticks}))}(e,t);case"vod":return R(e,t,"boolean"==typeof n&&n)}}function U(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))))}class Analytics{init(e,t,n){if(!w.from_token(e.token||"").is_granted(w.permissions.ANALYTICS))return;if(n.hasState("consent-no-tracking"))return;if(n.analytics)return;const r=n.analytics={ticker:void 0,last_media_id:"",ended:!1},i={locked:!1,ttl:6e3,task:()=>{q(n,r.ticker)}};const o={session_id:n.deviceId(),autoplay:n.autoplay,muted:n.muted,player_id:e.player_id,customer_user_id:e.customer_user_id,player_version:"3.9.0"},a=c.Tracker.of(n,{verb:c.Tracker.verb.POST,url:"https://ptm.flowplayer.com/:video_type/:sitegroup_id/:event_type",events:j,required_keys:T,optional_keys:M.concat(S).slice(0),metadata:o});n.on("reap",(function(){a&&a.destroy()})),n.on("config",(function(t){if(!a)return;const i=k(t,"data.metadata",{});if(!i.media_id)return;const o=k(a,"metadata.media_id");if(o&&i.media_id==o)return;const u=k(e,"analytics",{});a.put(i),a.put(u);const s=k(e,"metadata.live_start_time",e.live)?L:I;a.put({video_type:s,source:e.source||N()||""}),r.ticker=e.live?{ticks:0,last_tracked_ts:Date.now(),kind:"live"}:{last_idx:0,segment_duration:0,breakpoints:[],kind:"vod"},r.ended=!1,n.emit(O)}));let u=0;n.on("playing",(function(){if(!a)return;if(u||function(e,t){return e.metadata.media_id&&e.metadata.media_id==t.last_media_id}(a,r))return;a.put({muted:n.muted});const e=U(n);if(e)return u=Promise.resolve(e).then((function(){r.last_media_id=a.metadata.media_id,n.emit(A),u=0})).catch((function(){u=0}));r.last_media_id=a.metadata.media_id,n.emit(A)})),n.on("timeupdate",(function(){var t;a&&(u||U(n)||r.ended||(!e.live&&n.currentTime+.25>=n.duration&&q(n,r.ticker,!0),(t=i).locked||(t.locked=setTimeout((function(){return t.task(),function(e){return e.locked=!1,e}(t)}),t.ttl))))})),n.on("seeked",(function(){a&&r.ticker&&"vod"==r.ticker.kind&&function(e,t){P(e,t),t.last_idx=x(e,t)}(n,r.ticker)})),n.on("ended",(function(){a&&function(e,t){t.ended||(t.ended=!0,q(e,t.ticker))}(n,r)}))}}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;"function"==typeof n?n(t):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(t)||n.extensions.push(t))}("undefined"!=typeof window?window:void 0!==E?E:{},Analytics),Analytics}));
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";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(e){var t={exports:{}};return e(t,t.exports),t.exports}var n,r=t((function(t,n){var r=e&&e.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};n.__esModule=!0,n.remove=n.downcase=n.pluck=n.merge=void 0,n.merge=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.reduce((function(e,t){return r(r({},e),t)}),{})},n.pluck=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return Object.keys(e).filter((function(e){return~t.indexOf(e)})).reduce((function(t,r){var i;return n.merge(t,((i={})[r]=e[r],i))}),{})},n.downcase=function(e){return(e||"").toString().toLowerCase()},n.remove=function(e,t){var n=e.lastIndexOf(t);return~n&&e.splice(n,1),e}})),i=t((function(t,n){var i=e&&e.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=e&&e.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=e&&e.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&i(t,e,n);return o(t,e),t};n.__esModule=!0;var u=a(r),s=function(){function e(){this.pending=[],this.open=[],this.stats={failures:0,ttl:0}}return e.of=function(){return new e},e.is_empty=function(e){return 0==e.pending.length},e.is_high_water=function(t){return t.open.length==e.MAX_OPEN_REQUESTS},e.maybe_spawn_req=function(t){if(e.is_empty(t))return t;if(e.is_high_water(t))return t;try{var n=e.lpop(t);n&&e.request(t,n)}catch(e){}},e.increment_failures=function(t){return t.stats.failures++,t.stats.failures>e.MAX_FAILURE_COUNT&&(t.stats.ttl=Date.now()+e.REQUEST_TTL_MS),t},e.handle_error=function(t,n){e.rm(t,n),e.increment_failures(t)},e.request=function(t,n){var r=n[0],i=n[1],o=n[2];if(!(Date.now()<t.stats.ttl)){var a=new XMLHttpRequest;t.open.push(a),a.timeout=e.REQUEST_TIMEOUT_MS,a.ontimeout=function(){e.handle_error(t,a)},a.onerror=function(n){e.handle_error(t,a)},a.onreadystatechange=function(){a.readyState==XMLHttpRequest.DONE&&e.rm(t,a),Math.floor(a.status/100)},a.onload=function(){e.rm(t,a),t.stats.failures&&t.stats.failures--},a.open(i,r),a.setRequestHeader("Content-Type","text/plain;charset=UTF-8");try{a.send(JSON.stringify(o))}catch(e){}}},e.rpush=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];return n.forEach((function(n){t.pending.length>=e.MAX_PENDING||(t.pending.push(n),e.maybe_spawn_req(t))})),t},e.lpop=function(e){return e.pending.shift()},e.rm=function(e,t){return u.remove(e.open,t),e},e.MAX_OPEN_REQUESTS=3,e.MAX_PENDING=5,e.REQUEST_TIMEOUT_MS=4e3,e.REQUEST_TTL_MS=5e3,e.MAX_FAILURE_COUNT=3,e}();n.default=s})),o=t((function(t,n){var r=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};n.__esModule=!0;var o=r(i);n.default=o.default.of()})),a=t((function(e,t){t.__esModule=!0,t.prepare_url=t.URL_PARAM=void 0,t.URL_PARAM=/:([a-zA-Z_]+)/g,t.prepare_url=function(e,n){return e.url.replace(t.URL_PARAM,(function(t){if((t=t.slice(1,t.length))in n)return n[t].toString();e.log.error(new Error("\n preparing url["+e.url+"] failed\n \n parameter["+t+"] not detected in params:\n \n "+JSON.stringify(n,null,2)+"\n "))}))}})),u=t((function(e,t){t.__esModule=!0,t.Log=void 0;var n=function(){function e(e){this.emitter=e}return e.prepare=function(e,t){var n=document.createEvent("Event");return n.initEvent(e,!1,!0),n.ns=e,n.data=t,n},e.of=function(t){return new e(t)},e.prototype.info=function(t){this.emitter.dispatchEvent(e.prepare(e.NAMESPACE.INFO,t))},e.prototype.error=function(t){this.emitter.dispatchEvent(e.prepare(e.NAMESPACE.ERROR,t))},e.prototype.warn=function(t){this.emitter.dispatchEvent(e.prepare(e.NAMESPACE.WARN,t))},e.NAMESPACE={INFO:"tracker:info",ERROR:"tracker:err",WARN:"tracker:warn"},e}();t.Log=n})),s=t((function(e,t){var n;t.__esModule=!0,t.Verb=void 0,(n=t.Verb||(t.Verb={})).POST="POST",n.PUT="PUT",n.GET="GET"})),d=t((function(t,n){var d=e&&e.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),c=e&&e.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),f=e&&e.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&d(t,e,n);return c(t,e),t},l=e&&e.__spreadArrays||function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],a=0,u=o.length;a<u;a++,i++)r[i]=o[a];return r},p=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};n.__esModule=!0;var _=p(o),v=p(i),m=f(a),h=f(r),y=function(){function e(t,n){var r=this;void 0===n&&(n={});var i=this;if(this.emitter=t,this.url=n.url,this.log=u.Log.of(this.emitter),this.verb=n.verb,this.metadata=h.merge({},n.metadata||{}),this.rq=n.rq||_.default,this.events=n.events||[],this.required_keys=n.required_keys||[],this.optional_keys=n.optional_keys||[],this.listeners=[],this.valid_keys=this.required_keys.slice(0).concat(this.optional_keys),e.assert_emitter_api(this.emitter),void 0===e.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");e.TRACKERS.push(this),i.events.forEach((function(t){e.create_listener(r,t,(function(n){void 0===n&&(n={});var o=h.merge(i.metadata,{event_type:t},n.data||n),a=m.prepare_url(i,o),u=e.pluck_valid_keys(i,o),s=e.ensure_required_keys(i,u);if(s.length)return i.log.error("Tracker.validate_metadata() failed for \n Event["+t+"]\n missing keys: "+s+"\n payload:\n "+JSON.stringify(u,null,2));v.default.rpush(r.rq,[a,r.verb,u])}))}))}return e.of=function(t,n){return new e(t,n)},e.ensure_required_keys=function(e,t){return e.required_keys.filter((function(e){return!(e in t)}))},e.pluck_valid_keys=function(e,t){return h.pluck.apply(h,l([t],e.valid_keys))},e.merge_metadata=function(t,n){return void 0===n&&(n={}),t.metadata=e.pluck_valid_keys(t,h.merge(t.metadata,n)),t},e.assert_emitter_api=function(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")},e.create_listener=function(e,t,n){e.listeners.push([t,n]),e.emitter.addEventListener(t,n)},e.prototype.destroy=function(){var t=this;this.listeners.forEach((function(e){var n=e[0],r=e[1];return t.emitter.removeEventListener(n,r)})),delete this.rq,delete this.emitter,h.remove(e.TRACKERS,this)},e.prototype.put=function(t){return void 0===t&&(t={}),e.merge_metadata(this,t),this},e.TRACKERS=[],e.QUEUE=_.default,e.verb=s.Verb,e}();n.default=y})),c=t((function(t,n){var r=e&&e.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=e&&e.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=e&&e.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t},u=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};n.__esModule=!0,n.API=n.Tracker=void 0;var s=u(d);n.Tracker=s.default;var c=o(a);n.API=c}));!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"}(n||(n={}));const f=["localhost","127.0.0.1","0.0.0.0","s.codepen.io","cdpn.io","try.flowplayer.com"];function l(e,t){return!!~f.indexOf(e)||e.indexOf(t)===e.length-t.length}l.check_whitelist=function(e){return!!~f.indexOf(e)};function p(e){this.message=e}p.prototype=new Error,p.prototype.name="InvalidCharacterError";var _="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new p("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,r,i=0,o=0,a="";r=t.charAt(o++);~r&&(n=i%4?64*n+r:r,i++%4)?a+=String.fromCharCode(255&n>>(-2*i&6)):0)r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(r);return a};var v=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(_(e).replace(/(.)/g,(function(e,t){var n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n})))}(t)}catch(e){return _(t)}};function m(e){this.message=e}m.prototype=new Error,m.prototype.name="InvalidTokenError";var h=function(e,t){if("string"!=typeof e)throw new m("Invalid token specified");var n=!0===(t=t||{}).header?0:1;try{return JSON.parse(v(e.split(".")[n]))}catch(e){throw new m("Invalid token specified: "+e.message)}};h.InvalidTokenError=m;const y="production";function g(e,t){const n={valid_jwt:!1,raw:"",data:{acl:0},exp:0};let r={c:"{}",exp:0};t=t||{};try{r=h(e),n.valid_jwt=!0}catch(e){}return n.raw=e,n.data=JSON.parse(r.c),n.exp=r.exp,t.require_valid_token&&g.validate(n),n}function w(e){return{grant:e,is_granted:t=>(e&t)===t}}function k(e,t,n){const r=function(e){return Array.isArray(e)?e.slice(0):e.split(".")}(t);for(;r.length;){if(null==e)return n;const t=r.shift();if("string"!=typeof t)return n;e=e[t]}return null==e?n:e}g.validate=function(e){if("string"==typeof e&&(e=g(e)),!e||!e.raw){if(l.check_whitelist(window.location.hostname)||"dev"===y.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,n=l.bind(null,t);if("dev"!==y.toString()&&e.data.domain&&e.data.domain.length&&!e.data.domain.some(n))throw new Error("Domain not allowed");if("dev"!==y.toString()&&1e3*e.exp-Date.now()<0)throw new Error("Expired token");return!0},g.id=function(e){if(e)return"string"==typeof e&&(e=g(e)),e.data.id},w.of=w,w.from_token=function(e){const t=g(e,{require_valid_token:!0});return w.of(t.data.acl)},w.permissions=n;var E="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};var b="ping",O="display",A="view";const T=["sitegroup_id","session_id","media_id","site_id","player_id","video_type"],S=["created","position"],M=["player_version","created","source","category","category_id","autoplay","muted","customer_user_id"];function P(e,t){return e.duration/1===e.duration&&Object.assign(t,function(e){const t=e/100;return{segment_duration:t,breakpoints:Array(...Array(100)).map((function(e,n){return Math.floor(n*t*1e3)/1e3}))}}(e.duration))}function R(e,t,n){if(!t.segment_duration&&!P(e,t))return;const r=function(e,t,n){const r=t.last_idx,i=n?99:x(e,t);return t.last_idx=i,i<=r?[]:t.breakpoints.slice(r,99==i?100:i).map((function(e){return t.breakpoints.indexOf(e)}))}(e,t,n);0!=r.length&&e.emit(b,{position:r})}function x(e,t){return Math.min(Math.floor(e.currentTime/t.segment_duration),99)}function N(){try{return window.location!==window.parent.location?document.referrer:document.location.href}catch(e){return!1}}const I="vod",L="live",j=[O,b,A];function q(e,t,n){switch(null==t?void 0:t.kind){case"live":return function(e,t){const n=Date.now();n-t.last_tracked_ts<6e4||(t.last_tracked_ts=n,++t.ticks,e.emit(b,{position:60*t.ticks}))}(e,t);case"vod":return R(e,t,"boolean"==typeof n&&n)}}function U(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))))}class Analytics{init(e,t,n){if(!w.from_token(e.token||"").is_granted(w.permissions.ANALYTICS))return;if(n.hasState("consent-no-tracking"))return;if(n.analytics)return;const r=n.analytics={ticker:void 0,last_media_id:"",ended:!1},i={locked:!1,ttl:6e3,task:()=>{q(n,r.ticker)}};const o={session_id:n.deviceId(),autoplay:n.autoplay,muted:n.muted,player_id:e.player_id,customer_user_id:e.customer_user_id,player_version:"3.9.1"},a=c.Tracker.of(n,{verb:c.Tracker.verb.POST,url:"https://ptm.flowplayer.com/:video_type/:sitegroup_id/:event_type",events:j,required_keys:T,optional_keys:M.concat(S).slice(0),metadata:o});n.on("reap",(function(){a&&a.destroy()})),n.on("config",(function(t){if(!a)return;const i=k(t,"data.metadata",{});if(!i.media_id)return;const o=k(a,"metadata.media_id");if(o&&i.media_id==o)return;const u=k(e,"analytics",{});a.put(i),a.put(u);const s=k(e,"metadata.live_start_time",e.live)?L:I;a.put({video_type:s,source:e.source||N()||""}),r.ticker=e.live?{ticks:0,last_tracked_ts:Date.now(),kind:"live"}:{last_idx:0,segment_duration:0,breakpoints:[],kind:"vod"},r.ended=!1,n.emit(O)}));let u=0;n.on("playing",(function(){if(!a)return;if(u||function(e,t){return e.metadata.media_id&&e.metadata.media_id==t.last_media_id}(a,r))return;a.put({muted:n.muted});const e=U(n);if(e)return u=Promise.resolve(e).then((function(){r.last_media_id=a.metadata.media_id,n.emit(A),u=0})).catch((function(){u=0}));r.last_media_id=a.metadata.media_id,n.emit(A)})),n.on("timeupdate",(function(){var t;a&&(u||U(n)||r.ended||(!e.live&&n.currentTime+.25>=n.duration&&q(n,r.ticker,!0),(t=i).locked||(t.locked=setTimeout((function(){return t.task(),function(e){return e.locked=!1,e}(t)}),t.ttl))))})),n.on("seeked",(function(){a&&r.ticker&&"vod"==r.ticker.kind&&function(e,t){P(e,t),t.last_idx=x(e,t)}(n,r.ticker)})),n.on("ended",(function(){a&&function(e,t){t.ended||(t.ended=!0,q(e,t.ticker))}(n,r)}))}}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;"function"==typeof n?n(t):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(t)||n.extensions.push(t))}("undefined"!=typeof window?window:void 0!==E?E:{},Analytics),Analytics}));
package/plugins/ga4.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.ga4=t())}(this,(function(){"use strict";class GoogleAnalytics4Plugin{constructor(e){this.muted=!1,this.quartiles=[0,0,0],this.ad_type="preroll",this.preroll_counter=0,this.midroll_counter=0,this.postroll_counter=0,this.event_categories={live:"Live",videos:"Videos"},this.event_actions={fullscreen_enter:"fullscreen_enter",fullscreen_exit:"fullscreen_exit",video_player_load:"video_player_load",video_start:"video_start",video_click_play:"video_click_play",video_pause:"video_pause",video_resume:"video_resume",video_mute:"video_mute",video_unmute:"video_unmute",video_25_percent:"video_25_percent",video_50_percent:"video_50_percent",video_75_percent:"video_75_percent",video_complete:"video_complete",live_start:"live_start",live_click_play:"live_click_play",live_pause:"live_pause",live_resume:"live_resume",live_mute:"live_mute",live_unmute:"live_unmute",live_complete:"live_complete",ad_start_preroll:"ad_start_preroll",ad_start_midroll:"ad_start_midroll",ad_start_postroll:"ad_start_postroll",ad_completed_preroll:"ad_completed_preroll",ad_completed_midroll:"ad_completed_midroll",ad_completed_postroll:"ad_completed_postroll",ad_skipped_preroll:"ad_skipped_preroll",ad_skipped_midroll:"ad_skipped_midroll",ad_skipped_postroll:"ad_skipped_postroll",ad_break_completed:"ad_break_completed"},this.flowplayer=e}init(e,t,i){this.config=e,this.video=i,this.muted=i.muted,i.on(["mount","timeupdate","play","ended","pause","playing","volumechange","ad-started","ad-completed","ad-skipped","ad-break-completed","config","play","fullscreenenter","fullscreenexit"],t=>{switch(t.type){case"playing":this.track(e.live?this.event_actions.live_resume:this.event_actions.video_resume);break;case"pause":if(Math.abs(i.duration-i.currentTime)<1)break;this.track(e.live?this.event_actions.live_pause:this.event_actions.video_pause);break;case"play":(i.hasState("is-starting")||i.hasState("is-ended"))&&this.track(e.live?this.event_actions.live_start:this.event_actions.video_start),this.track(e.live?this.event_actions.live_click_play:this.event_actions.video_click_play);break;case"mount":this.track(this.event_actions.video_player_load);break;case"timeupdate":this.progress(i);break;case"ended":this.track(e.live?this.event_actions.live_complete:this.event_actions.video_complete),this.reset();break;case"volumechange":this.volumechange(i);break;case"ad-started":this.adstarted(t);break;case"ad-completed":this.adcompleted(t);break;case"ad-break-completed":this.adbreakcompleted();break;case"config":this.configured(t.detail);break;case"fullscreenenter":this.track(this.event_actions.fullscreen_enter);break;case"fullscreenexit":this.track(this.event_actions.fullscreen_exit);break;case"ad-skipped":this.adskipped()}})}progress(e){e.opts.live||(e.currentTime/e.duration>.25&&0===this.quartiles[0]?(this.quartiles[0]=1,this.track(this.event_actions.video_25_percent)):e.currentTime/e.duration>.5&&0===this.quartiles[1]?(this.quartiles[1]=1,this.track(this.event_actions.video_50_percent)):e.currentTime/e.duration>.75&&0===this.quartiles[2]&&(this.quartiles[2]=1,this.track(this.event_actions.video_75_percent)))}volumechange(e){this.muted!==e.muted&&(this.muted=e.muted,e.muted?this.track(e.opts.live?this.event_actions.live_mute:this.event_actions.video_mute):this.track(e.opts.live?this.event_actions.live_unmute:this.event_actions.video_unmute))}reset(){this.quartiles=[0,0,0],this.preroll_counter=0,this.midroll_counter=0,this.postroll_counter=0}configured(e){var t,i;(null===(t=null==e?void 0:e.ga)||void 0===t?void 0:t.event_actions)&&(this.event_actions=e.ga.event_actions),(null===(i=null==e?void 0:e.ga)||void 0===i?void 0:i.event_categories)&&(this.event_categories=e.ga.event_categories)}checkForAdCounter(e,t){return e.replace("[x]",t+"")}adstarted(e){var t;switch((null===(t=e.data)||void 0===t?void 0:t.ad_type)||"preroll"){case"midroll":this.ad_type="midroll",this.midroll_counter++,this.track(this.checkForAdCounter(this.event_actions.ad_start_midroll,this.midroll_counter));break;case"postroll":this.ad_type="postroll",this.postroll_counter++,this.track(this.checkForAdCounter(this.event_actions.ad_start_postroll,this.postroll_counter));break;default:this.ad_type="preroll",this.preroll_counter++,this.track(this.checkForAdCounter(this.event_actions.ad_start_preroll,this.preroll_counter))}}adcompleted(e){var t;switch((null===(t=e.data)||void 0===t?void 0:t.ad_type)||"preroll"){case"midroll":this.track(this.event_actions.ad_completed_midroll);break;case"postroll":this.track(this.event_actions.ad_completed_postroll);break;default:this.track(this.event_actions.ad_completed_preroll)}}adskipped(){if(this.ad_type)switch(this.ad_type){case"midroll":this.track(this.event_actions.ad_skipped_midroll);break;case"postroll":this.track(this.event_actions.ad_skipped_postroll);break;default:this.track(this.event_actions.ad_skipped_preroll)}else this.track(this.event_actions.ad_skipped_preroll)}adbreakcompleted(){this.track(this.event_actions.ad_break_completed)}pushToDataLayer(e,t,i){var s,o;if(window.dataLayer)try{window.dataLayer.push(Object.assign({event:"flowplayer",event_action:e,event_label:i,event_category:t,duration:null===(s=this.video)||void 0===s?void 0:s.duration},null===(o=null==this?void 0:this.config)||void 0===o?void 0:o.ga.custom_data))}catch(e){}}track(e){var t,i,s,o,a,l,r,n;if(!this.config||!this.config.ga||!e||(null===(t=null==this?void 0:this.video)||void 0===t?void 0:t.hasState("consent-no-tracking")))return;const d=(null===(i=this.video)||void 0===i?void 0:i.opts.live)?this.event_categories.live:this.event_categories.videos,c=null===(s=this.config.ga)||void 0===s?void 0:s.ga_instances,_=(null===(o=null==this?void 0:this.config)||void 0===o?void 0:o.title)||(null===(a=this.config.metadata)||void 0===a?void 0:a.title)||"unknown video";if((null===(r=null===(l=this.config)||void 0===l?void 0:l.ga)||void 0===r?void 0:r.data_layer_tracking)||!c||!c.length)return this.pushToDataLayer(e,d,_);gtag("event",e,Object.assign({send_to:c,event_category:d,event_label:_,duration:null===(n=this.video)||void 0===n?void 0:n.duration},this.config.ga.custom_data))}}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 i=e.flowplayer;"function"==typeof i?i(t):(Array.isArray(i.extensions)||(i.extensions=[]),~i.extensions.indexOf(t)||i.extensions.push(t))}(window,GoogleAnalytics4Plugin),GoogleAnalytics4Plugin}));
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.ga4=t())}(this,(function(){"use strict";class GoogleAnalytics4Plugin{constructor(e){this.muted=!1,this.quartiles=[0,0,0],this.ad_type="preroll",this.preroll_counter=0,this.midroll_counter=0,this.postroll_counter=0,this.event_categories={live:"Live",videos:"Videos"},this.event_actions={fullscreen_enter:"fullscreen_enter",fullscreen_exit:"fullscreen_exit",video_player_load:"video_player_load",video_start:"video_start",video_click_play:"video_click_play",video_pause:"video_pause",video_resume:"video_resume",video_mute:"video_mute",video_unmute:"video_unmute",video_25_percent:"video_25_percent",video_50_percent:"video_50_percent",video_75_percent:"video_75_percent",video_complete:"video_complete",live_start:"live_start",live_click_play:"live_click_play",live_pause:"live_pause",live_resume:"live_resume",live_mute:"live_mute",live_unmute:"live_unmute",live_complete:"live_complete",ad_start_preroll:"ad_start_preroll",ad_start_midroll:"ad_start_midroll",ad_start_postroll:"ad_start_postroll",ad_completed_preroll:"ad_completed_preroll",ad_completed_midroll:"ad_completed_midroll",ad_completed_postroll:"ad_completed_postroll",ad_skipped_preroll:"ad_skipped_preroll",ad_skipped_midroll:"ad_skipped_midroll",ad_skipped_postroll:"ad_skipped_postroll",ad_break_completed:"ad_break_completed"},this.flowplayer=e}init(e,t,i){var s;this.config=e,this.video=i,this.muted=i.muted,i.on(["mount","timeupdate","play","ended","pause","playing","volumechange","ad-started","ad-completed","ad-skipped","ad-break-completed","config","play","fullscreenenter","fullscreenexit"],(s=t=>{switch(t.type){case"playing":this.track(e.live?this.event_actions.live_resume:this.event_actions.video_resume);break;case"pause":if(Math.abs(i.duration-i.currentTime)<1)break;this.track(e.live?this.event_actions.live_pause:this.event_actions.video_pause);break;case"play":(i.hasState("is-starting")||i.hasState("is-ended"))&&this.track(e.live?this.event_actions.live_start:this.event_actions.video_start),this.track(e.live?this.event_actions.live_click_play:this.event_actions.video_click_play);break;case"mount":this.track(this.event_actions.video_player_load);break;case"timeupdate":this.progress(i);break;case"ended":this.track(e.live?this.event_actions.live_complete:this.event_actions.video_complete),this.reset();break;case"volumechange":this.volumechange(i);break;case"ad-started":this.adstarted(t);break;case"ad-completed":this.adcompleted(t);break;case"ad-break-completed":this.adbreakcompleted();break;case"config":this.configured(t.detail);break;case"fullscreenenter":this.track(this.event_actions.fullscreen_enter);break;case"fullscreenexit":this.track(this.event_actions.fullscreen_exit);break;case"ad-skipped":this.adskipped()}},e=>{setTimeout((function(){if(!e.defaultPrevented)return s(e)}),0)}))}progress(e){e.opts.live||(e.currentTime/e.duration>.25&&0===this.quartiles[0]?(this.quartiles[0]=1,this.track(this.event_actions.video_25_percent)):e.currentTime/e.duration>.5&&0===this.quartiles[1]?(this.quartiles[1]=1,this.track(this.event_actions.video_50_percent)):e.currentTime/e.duration>.75&&0===this.quartiles[2]&&(this.quartiles[2]=1,this.track(this.event_actions.video_75_percent)))}volumechange(e){this.muted!==e.muted&&(this.muted=e.muted,e.muted?this.track(e.opts.live?this.event_actions.live_mute:this.event_actions.video_mute):this.track(e.opts.live?this.event_actions.live_unmute:this.event_actions.video_unmute))}reset(){this.quartiles=[0,0,0],this.preroll_counter=0,this.midroll_counter=0,this.postroll_counter=0}configured(e){var t,i;(null===(t=null==e?void 0:e.ga)||void 0===t?void 0:t.event_actions)&&(this.event_actions=e.ga.event_actions),(null===(i=null==e?void 0:e.ga)||void 0===i?void 0:i.event_categories)&&(this.event_categories=e.ga.event_categories)}checkForAdCounter(e,t){return e.replace("[x]",t+"")}adstarted(e){var t;switch((null===(t=e.data)||void 0===t?void 0:t.ad_type)||"preroll"){case"midroll":this.ad_type="midroll",this.midroll_counter++,this.track(this.checkForAdCounter(this.event_actions.ad_start_midroll,this.midroll_counter));break;case"postroll":this.ad_type="postroll",this.postroll_counter++,this.track(this.checkForAdCounter(this.event_actions.ad_start_postroll,this.postroll_counter));break;default:this.ad_type="preroll",this.preroll_counter++,this.track(this.checkForAdCounter(this.event_actions.ad_start_preroll,this.preroll_counter))}}adcompleted(e){var t;switch((null===(t=e.data)||void 0===t?void 0:t.ad_type)||"preroll"){case"midroll":this.track(this.event_actions.ad_completed_midroll);break;case"postroll":this.track(this.event_actions.ad_completed_postroll);break;default:this.track(this.event_actions.ad_completed_preroll)}}adskipped(){if(this.ad_type)switch(this.ad_type){case"midroll":this.track(this.event_actions.ad_skipped_midroll);break;case"postroll":this.track(this.event_actions.ad_skipped_postroll);break;default:this.track(this.event_actions.ad_skipped_preroll)}else this.track(this.event_actions.ad_skipped_preroll)}adbreakcompleted(){this.track(this.event_actions.ad_break_completed)}pushToDataLayer(e,t,i){var s,o;if(window.dataLayer)try{window.dataLayer.push(Object.assign({event:"flowplayer",event_action:e,event_label:i,event_category:t,duration:null===(s=this.video)||void 0===s?void 0:s.duration},null===(o=null==this?void 0:this.config)||void 0===o?void 0:o.ga.custom_data))}catch(e){}}track(e){var t,i,s,o,a,l,r,n;if(!this.config||!this.config.ga||!e||(null===(t=null==this?void 0:this.video)||void 0===t?void 0:t.hasState("consent-no-tracking")))return;const d=(null===(i=this.video)||void 0===i?void 0:i.opts.live)?this.event_categories.live:this.event_categories.videos,c=null===(s=this.config.ga)||void 0===s?void 0:s.ga_instances,_=(null===(o=null==this?void 0:this.config)||void 0===o?void 0:o.title)||(null===(a=this.config.metadata)||void 0===a?void 0:a.title)||"unknown video";if((null===(r=null===(l=this.config)||void 0===l?void 0:l.ga)||void 0===r?void 0:r.data_layer_tracking)||!c||!c.length)return this.pushToDataLayer(e,d,_);gtag("event",e,Object.assign({send_to:c,event_category:d,event_label:_,duration:null===(n=this.video)||void 0===n?void 0:n.duration},this.config.ga.custom_data))}}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 i=e.flowplayer;"function"==typeof i?i(t):(Array.isArray(i.extensions)||(i.extensions=[]),~i.extensions.indexOf(t)||i.extensions.push(t))}(window,GoogleAnalytics4Plugin),GoogleAnalytics4Plugin}));
package/plugins/gemius.js CHANGED
@@ -1 +1 @@
1
- !function(i,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):((i="undefined"!=typeof globalThis?globalThis:i||self).flowplayer=i.flowplayer||{},i.flowplayer.gemius=e())}(this,(function(){"use strict";function i(i,e,t){const r=function(i){return Array.isArray(i)?i.slice(0):i.split(".")}(e);for(;r.length;){if(null==i)return t;const e=r.shift();if("string"!=typeof e)return t;i=i[e]}return null==i?t:i}const e=["playerID","gemiusID"],t=["programID","additionalParameters.programName","additionalParameters.programType","additionalParameters.programDuration"],r=["adName","adDuration","adType","campaignClassification","quality","resolution","volume"];function s(e,t){const r=[];return t.forEach((function(t){void 0===i(e,t)&&r.push(t)})),r.length&&console.warn("Missing Gemius configuration: ",r.join(", ")),0===r.length}function a(i){return i<.5||isNaN(i)?0:Math.round(i)}function n(i,e){return-1===i||e?-1:Math.max(0,Math.min(100,Math.round(100*i)))}return function(i,e){if("object"==typeof exports&&"undefined"!=typeof module)return e;if(null===document.currentScript)return e;"flowplayer"in i||(i.flowplayer={extensions:[]});const t=i.flowplayer;return"function"==typeof t?(t(e),e):(Array.isArray(t.extensions)||(t.extensions=[]),~t.extensions.indexOf(e)||t.extensions.push(e),e)}(window,class GemiusPlugin{constructor(i){this.started=!1,this.starting=!1,this.paused=!1,this.seeking=!1,this.buffering=!1,this.currentTime=0,this.flowplayer=i}init(i,e,t){return"function"!=typeof GemiusPlayer?console.warn("Gemius SDK needs to be loaded prior loading gemius plugin"):i.gemius?void(t.hasState("consent-no-tracking")||(this.gemius=i.gemius,t.on("reap",()=>{this.gemiusPlayer&&this.gemius&&this.gemius.programID&&this.gemiusPlayer.programEvent(this.gemius.programID,a(t.currentTime),"stop"),this.gemiusPlayer=void 0,this.resetParams(),window.removeEventListener("beforeunload",this.handle_window_unload.bind(this,t))}),window.addEventListener("beforeunload",this.handle_window_unload.bind(this,t)),t.on(["config","loadedmetadata","src","loadstart"],e=>{var r,s;(null===(r=e.data)||void 0===r?void 0:r.gemius)&&(this.gemius=Object.assign(Object.assign({},this.gemius),null===(s=e.data)||void 0===s?void 0:s.gemius)),e.type===this.getInitEventType(i)&&this.initGemius(i,t)}),t.on("volumechange",()=>{var i;this.gemiusPlayer&&(null===(i=this.gemius)||void 0===i?void 0:i.programID)&&this.gemiusPlayer.programEvent(this.gemius.programID,a(t.currentTime),"chngVol",{volume:n(t.volume,t.muted)})}),t.on("resize",()=>{var i;this.gemiusPlayer&&(null===(i=this.gemius)||void 0===i?void 0:i.programID)&&(this.sendPlayWithRequiremets(t),this.gemiusPlayer.programEvent(this.gemius.programID,a(t.currentTime),"chngRes",{resolution:t.clientWidth+"x"+t.clientHeight}))}),t.on("play",()=>{this.buffering=!1,this.starting=!0,this.started?this.sendPlay(t):this.sendPlayWithRequiremets(t),this.paused=!1}),t.on("ended",()=>{var i;this.started&&(this.resetParams(),this.gemiusPlayer&&(null===(i=this.gemius)||void 0===i?void 0:i.programID)&&this.gemiusPlayer.programEvent(this.gemius.programID,a(t.currentTime),"complete"))}),t.on("seeking",()=>{var i;this.started&&!this.seeking&&(this.seeking=!0,this.gemiusPlayer&&(null===(i=this.gemius)||void 0===i?void 0:i.programID)&&this.gemiusPlayer.programEvent(this.gemius.programID,this.currentTime,"seek"))}),t.on("seeked",()=>{var i;this.started&&!this.paused&&(this.seeking=!1,this.gemiusPlayer&&(null===(i=this.gemius)||void 0===i?void 0:i.programID)&&this.gemiusPlayer.programEvent(this.gemius.programID,a(t.currentTime),"play",{autoPlay:this.gemius.additionalParameters.autoPlay,volume:n(this.gemius.additionalParameters.volume||0)||0}))}),t.on("pause",()=>{var e;this.started&&t.currentTime>.25&&(i.live||i.duration&&i.duration-t.currentTime>.25)&&(this.paused=!0,this.gemiusPlayer&&(null===(e=this.gemius)||void 0===e?void 0:e.programID)&&this.gemiusPlayer.programEvent(this.gemius.programID,a(t.currentTime),"pause"))}),t.on("waiting",()=>{var i;!this.buffering&&t.currentTime>.5&&(this.buffering=!0,this.gemiusPlayer&&(null===(i=this.gemius)||void 0===i?void 0:i.programID)&&this.gemiusPlayer.programEvent(this.gemius.programID,a(t.currentTime),"buffer"))}),t.on("timeupdate",()=>{this.currentTime=Math.round(t.currentTime)}),t.on("renderplugin",i=>{i.detail.adContainer&&(t.on("ad-started",i=>{var e,t;const s=i.detail;var a;s&&(this.paused=!1,this.currentAd={id:s.vast_ad_id||"unknown id",duration:(null===(e=s.ad)||void 0===e?void 0:e.duration)||-1,currentTime:0},this.gemiusPlayer&&(null===(t=this.gemius)||void 0===t?void 0:t.programID)&&(this.gemiusPlayer.newAd(s.vast_ad_id,(a=Object.assign({},this.gemius.additionalParameters,function(i){var e,t,r;return{adDuration:null===(e=i.ad)||void 0===e?void 0:e.duration,adType:i.ad_type,resolution:(null===(t=i.ad)||void 0===t?void 0:t.width)+"x"+(null===(r=i.ad)||void 0===r?void 0:r.height),volume:n(i.volume)}}(s)),r.reduce((function(i,e){return a&&a.hasOwnProperty(e)&&(i[e]=a[e]),i}),{}))),this.gemiusPlayer.adEvent(this.gemius.programID,this.currentAd.id,0,"play",{autoPlay:this.gemius.additionalParameters.autoPlay,volume:n(s.volume)})))}),t.on("ad-paused",()=>{var i;this.paused=!0,this.currentAd&&this.gemiusPlayer&&(null===(i=this.gemius)||void 0===i?void 0:i.programID)&&this.gemiusPlayer.adEvent(this.gemius.programID,this.currentAd.id,this.currentAd.currentTime,"pause")}),t.on("ad-resumed",i=>{var e;const t=i.detail;if(t&&this.currentAd&&this.paused){if(this.paused=!1,!this.gemiusPlayer||!(null===(e=this.gemius)||void 0===e?void 0:e.programID))return;this.gemiusPlayer.adEvent(this.gemius.programID,this.currentAd.id,this.currentAd.currentTime,"play",{autoPlay:this.gemius.additionalParameters.autoPlay,volume:n(t.volume)})}}),t.on("ad-completed",()=>{var i;if(this.currentAd){if(!this.gemiusPlayer||!(null===(i=this.gemius)||void 0===i?void 0:i.programID))return;this.gemiusPlayer.adEvent(this.gemius.programID,this.currentAd.id,this.currentAd.duration,"complete"),this.currentAd=void 0}}),t.on("ad-progress",i=>{const e=i.detail;e&&this.currentAd&&(this.currentAd.currentTime=Math.round(e.duration-e.remaining)||0)}),t.on("ad-volume-changed",i=>{var e;const t=i.detail;if("number"==typeof t&&this.currentAd){const i=t||-1;if(!this.gemiusPlayer||!(null===(e=this.gemius)||void 0===e?void 0:e.programID))return;this.gemiusPlayer.adEvent(this.gemius.programID,this.currentAd.id,this.currentAd.duration,"chngVol",{volume:n(i)})}}))}))):console.warn("Gemius plugin loaded but not configured")}resetParams(){this.seeking=!1,this.starting=!1,this.started=!1,this.paused=!1,this.buffering=!1,this.currentAd=void 0,this.currentTime=0}sendPlay(i){var e;this.gemiusPlayer&&(null===(e=this.gemius)||void 0===e?void 0:e.programID)&&(this.started=!0,this.gemiusPlayer.programEvent(this.gemius.programID,a(i.currentTime),"play",{autoPlay:this.gemius.additionalParameters.autoPlay,volume:n(this.gemius.additionalParameters.volume||0)}))}sendPlayWithRequiremets(i){this.starting&&!this.started&&i.videoWidth>0&&this.sendPlay(i)}getInitEventType(i){return!i.ima&&i.autoplay?"src":"loadstart"}initGemius(r,a){if(!s(i(r,"gemius",{}),e))return;if(!this.gemius)return;const u={currentDomain:this.gemius.additionalParameters.currentDomain,volume:n(this.gemius.additionalParameters.volume||0)};if(this.gemiusPlayer&&(this.gemiusPlayer=void 0),this.gemiusPlayer=new GemiusPlayer(this.gemius.playerID,this.gemius.gemiusID,u),this.gemiusPlayer.setVideoObject(a),!s(this.gemius,t))return;const o={programName:this.gemius.additionalParameters.programName,programDuration:this.gemius.additionalParameters.programDuration,programType:this.gemius.additionalParameters.programType,volume:n(this.gemius.additionalParameters.volume||0)};this.gemiusPlayer.newProgram(this.gemius.programID,o),this.sendPlayWithRequiremets(a)}handle_window_unload(i){var e;this.gemiusPlayer&&(null===(e=this.gemius)||void 0===e?void 0:e.programID)&&this.gemiusPlayer.programEvent(this.gemius.programID,a(i.currentTime),"close"),this.resetParams()}})}));
1
+ !function(i,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):((i="undefined"!=typeof globalThis?globalThis:i||self).flowplayer=i.flowplayer||{},i.flowplayer.gemius=e())}(this,(function(){"use strict";function i(i,e,t){const r=function(i){return Array.isArray(i)?i.slice(0):i.split(".")}(e);for(;r.length;){if(null==i)return t;const e=r.shift();if("string"!=typeof e)return t;i=i[e]}return null==i?t:i}const e=["playerID","gemiusID"],t=["programID","additionalParameters.programName","additionalParameters.programType","additionalParameters.programDuration"],r=["adName","adDuration","adType","campaignClassification","quality","resolution","volume"];function s(e,t){const r=[];return t.forEach((function(t){void 0===i(e,t)&&r.push(t)})),r.length&&console.warn("Missing Gemius configuration: ",r.join(", ")),0===r.length}function a(i){return i<.5||isNaN(i)?0:Math.round(i)}function n(i,e){return-1===i||e?-1:Math.max(0,Math.min(100,Math.round(100*i)))}return function(i,e){if("object"==typeof exports&&"undefined"!=typeof module)return e;if(null===document.currentScript)return e;"flowplayer"in i||(i.flowplayer={extensions:[]});const t=i.flowplayer;return"function"==typeof t?(t(e),e):(Array.isArray(t.extensions)||(t.extensions=[]),~t.extensions.indexOf(e)||t.extensions.push(e),e)}(window,class GemiusPlugin{constructor(i){this.started=!1,this.starting=!1,this.paused=!1,this.seeking=!1,this.buffering=!1,this.currentTime=0,this.flowplayer=i}init(i,e,t){if("function"!=typeof GemiusPlayer)return console.warn("Gemius SDK needs to be loaded prior loading gemius plugin");if(!i.gemius)return console.warn("Gemius plugin loaded but not configured");var s;t.hasState("consent-no-tracking")||(this.gemius=i.gemius,t.on("reap",()=>{this.gemiusPlayer&&this.gemius&&this.gemius.programID&&this.gemiusPlayer.programEvent(this.gemius.programID,a(t.currentTime),"stop"),this.gemiusPlayer=void 0,this.resetParams(),window.removeEventListener("beforeunload",this.handle_window_unload.bind(this,t))}),window.addEventListener("beforeunload",this.handle_window_unload.bind(this,t)),t.on(["config","loadedmetadata","src","loadstart"],e=>{var r,s;(null===(r=e.data)||void 0===r?void 0:r.gemius)&&(this.gemius=Object.assign(Object.assign({},this.gemius),null===(s=e.data)||void 0===s?void 0:s.gemius)),e.type===this.getInitEventType(i)&&this.initGemius(i,t)}),t.on("volumechange",()=>{var i;this.gemiusPlayer&&(null===(i=this.gemius)||void 0===i?void 0:i.programID)&&this.gemiusPlayer.programEvent(this.gemius.programID,a(t.currentTime),"chngVol",{volume:n(t.volume,t.muted)})}),t.on("resize",()=>{var i;this.gemiusPlayer&&(null===(i=this.gemius)||void 0===i?void 0:i.programID)&&(this.sendPlayWithRequiremets(t),this.gemiusPlayer.programEvent(this.gemius.programID,a(t.currentTime),"chngRes",{resolution:t.clientWidth+"x"+t.clientHeight}))}),t.on("play",()=>{this.buffering=!1,this.starting=!0,this.started?this.sendPlay(t):this.sendPlayWithRequiremets(t),this.paused=!1}),t.on("ended",(s=()=>{var i;this.started&&(this.resetParams(),this.gemiusPlayer&&(null===(i=this.gemius)||void 0===i?void 0:i.programID)&&this.gemiusPlayer.programEvent(this.gemius.programID,a(t.currentTime),"complete"))},i=>{setTimeout((function(){if(!i.defaultPrevented)return s(i)}),0)})),t.on("seeking",()=>{var i;this.started&&!this.seeking&&(this.seeking=!0,this.gemiusPlayer&&(null===(i=this.gemius)||void 0===i?void 0:i.programID)&&this.gemiusPlayer.programEvent(this.gemius.programID,this.currentTime,"seek"))}),t.on("seeked",()=>{var i;this.started&&!this.paused&&(this.seeking=!1,this.gemiusPlayer&&(null===(i=this.gemius)||void 0===i?void 0:i.programID)&&this.gemiusPlayer.programEvent(this.gemius.programID,a(t.currentTime),"play",{autoPlay:this.gemius.additionalParameters.autoPlay,volume:n(this.gemius.additionalParameters.volume||0)||0}))}),t.on("pause",()=>{var e;this.started&&t.currentTime>.25&&(i.live||i.duration&&i.duration-t.currentTime>.25)&&(this.paused=!0,this.gemiusPlayer&&(null===(e=this.gemius)||void 0===e?void 0:e.programID)&&this.gemiusPlayer.programEvent(this.gemius.programID,a(t.currentTime),"pause"))}),t.on("waiting",()=>{var i;!this.buffering&&t.currentTime>.5&&(this.buffering=!0,this.gemiusPlayer&&(null===(i=this.gemius)||void 0===i?void 0:i.programID)&&this.gemiusPlayer.programEvent(this.gemius.programID,a(t.currentTime),"buffer"))}),t.on("timeupdate",()=>{this.currentTime=Math.round(t.currentTime)}),t.on("ad-started",i=>{var e,t;const s=i.detail;var a;s&&(this.paused=!1,this.currentAd={id:s.vast_ad_id||"unknown id",duration:(null===(e=s.ad)||void 0===e?void 0:e.duration)||-1,currentTime:0},this.gemiusPlayer&&(null===(t=this.gemius)||void 0===t?void 0:t.programID)&&(this.gemiusPlayer.newAd(s.vast_ad_id,(a=Object.assign({},this.gemius.additionalParameters,function(i){var e,t,r;return{adDuration:null===(e=i.ad)||void 0===e?void 0:e.duration,adType:i.ad_type,resolution:(null===(t=i.ad)||void 0===t?void 0:t.width)+"x"+(null===(r=i.ad)||void 0===r?void 0:r.height),volume:n(i.volume)}}(s)),r.reduce((function(i,e){return a&&a.hasOwnProperty(e)&&(i[e]=a[e]),i}),{}))),this.gemiusPlayer.adEvent(this.gemius.programID,this.currentAd.id,0,"play",{autoPlay:this.gemius.additionalParameters.autoPlay,volume:n(s.volume)})))}),t.on("ad-paused",()=>{var i;this.paused=!0,this.currentAd&&this.gemiusPlayer&&(null===(i=this.gemius)||void 0===i?void 0:i.programID)&&this.gemiusPlayer.adEvent(this.gemius.programID,this.currentAd.id,this.currentAd.currentTime,"pause")}),t.on("ad-resumed",i=>{var e;const t=i.detail;if(t&&this.currentAd&&this.paused){if(this.paused=!1,!this.gemiusPlayer||!(null===(e=this.gemius)||void 0===e?void 0:e.programID))return;this.gemiusPlayer.adEvent(this.gemius.programID,this.currentAd.id,this.currentAd.currentTime,"play",{autoPlay:this.gemius.additionalParameters.autoPlay,volume:n(t.volume)})}}),t.on("ad-completed",()=>{var i;if(this.currentAd){if(!this.gemiusPlayer||!(null===(i=this.gemius)||void 0===i?void 0:i.programID))return;this.gemiusPlayer.adEvent(this.gemius.programID,this.currentAd.id,this.currentAd.duration,"complete"),this.currentAd=void 0}}),t.on("ad-progress",i=>{const e=i.detail;e&&this.currentAd&&(this.currentAd.currentTime=Math.round(e.duration-e.remaining)||0)}),t.on("ad-volume-changed",i=>{var e;const t=i.detail;if("number"==typeof t&&this.currentAd){const i=t||-1;if(!this.gemiusPlayer||!(null===(e=this.gemius)||void 0===e?void 0:e.programID))return;this.gemiusPlayer.adEvent(this.gemius.programID,this.currentAd.id,this.currentAd.duration,"chngVol",{volume:n(i)})}}))}resetParams(){this.seeking=!1,this.starting=!1,this.started=!1,this.paused=!1,this.buffering=!1,this.currentAd=void 0,this.currentTime=0}sendPlay(i){var e;this.gemiusPlayer&&(null===(e=this.gemius)||void 0===e?void 0:e.programID)&&(this.started=!0,this.gemiusPlayer.programEvent(this.gemius.programID,a(i.currentTime),"play",{autoPlay:this.gemius.additionalParameters.autoPlay,volume:n(this.gemius.additionalParameters.volume||0)}))}sendPlayWithRequiremets(i){this.starting&&!this.started&&i.videoWidth>0&&this.sendPlay(i)}getInitEventType(i){return!i.ima&&i.autoplay?"src":"loadstart"}initGemius(r,a){if(!s(i(r,"gemius",{}),e))return;if(!this.gemius)return;const u={currentDomain:this.gemius.additionalParameters.currentDomain,volume:n(this.gemius.additionalParameters.volume||0)};if(this.gemiusPlayer&&(this.gemiusPlayer=void 0),this.gemiusPlayer=new GemiusPlayer(this.gemius.playerID,this.gemius.gemiusID,u),this.gemiusPlayer.setVideoObject(a),!s(this.gemius,t))return;const o={programName:this.gemius.additionalParameters.programName,programDuration:this.gemius.additionalParameters.programDuration,programType:this.gemius.additionalParameters.programType,volume:n(this.gemius.additionalParameters.volume||0)};this.gemiusPlayer.newProgram(this.gemius.programID,o),this.sendPlayWithRequiremets(a)}handle_window_unload(i){var e;this.gemiusPlayer&&(null===(e=this.gemius)||void 0===e?void 0:e.programID)&&this.gemiusPlayer.programEvent(this.gemius.programID,a(i.currentTime),"close"),this.resetParams()}})}));
@@ -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.google_analytics=t())}(this,(function(){"use strict";class GoogleAnalyticsPlugin{constructor(e){this.muted=!1,this.ga_extensions=[],this.quartiles=[0,0,0],this.ad_type="preroll",this.preroll_counter=0,this.midroll_counter=0,this.postroll_counter=0,this.event_categories={live:"Live",videos:"Videos"},this.event_actions={fullscreen_enter:"fullscreen_enter",fullscreen_exit:"fullscreen_exit",video_player_load:"video_player_load",video_start:"video_start",video_click_play:"video_click_play",video_pause:"video_pause",video_resume:"video_resume",video_mute:"video_mute",video_unmute:"video_unmute",video_25_percent:"video_25_percent",video_50_percent:"video_50_percent",video_75_percent:"video_75_percent",video_complete:"video_complete",live_start:"live_start",live_click_play:"live_click_play",live_pause:"live_pause",live_resume:"live_resume",live_mute:"live_mute",live_unmute:"live_unmute",live_complete:"live_complete",ad_start_preroll:"ad_start_preroll",ad_start_midroll:"ad_start_midroll",ad_start_postroll:"ad_start_postroll",ad_completed_preroll:"ad_completed_preroll",ad_completed_midroll:"ad_completed_midroll",ad_completed_postroll:"ad_completed_postroll",ad_skipped_preroll:"ad_skipped_preroll",ad_skipped_midroll:"ad_skipped_midroll",ad_skipped_postroll:"ad_skipped_postroll",ad_break_completed:"ad_break_completed"},console.warn("universal analytics by Google has been sunset, please use the ga4 plugin"),this.flowplayer=e}init(e,t,i){this.config=e,this.video=i,this.muted=i.muted,i.on(["mount","timeupdate","play","ended","pause","playing","volumechange","ad-started","ad-completed","ad-skipped","ad-break-completed","config","play","fullscreenenter","fullscreenexit"],t=>{switch(t.type){case"playing":this.track(e.live?this.event_actions.live_resume:this.event_actions.video_resume);break;case"pause":if(Math.abs(i.duration-i.currentTime)<1)break;this.track(e.live?this.event_actions.live_pause:this.event_actions.video_pause);break;case"play":(i.hasState("is-starting")||i.hasState("is-ended"))&&this.track(e.live?this.event_actions.live_start:this.event_actions.video_start),this.track(e.live?this.event_actions.live_click_play:this.event_actions.video_click_play);break;case"mount":this.track(this.event_actions.video_player_load);break;case"timeupdate":this.progress(i);break;case"ended":this.track(e.live?this.event_actions.live_complete:this.event_actions.video_complete),this.reset();break;case"volumechange":this.volumechange(i);break;case"ad-started":this.adstarted(t);break;case"ad-completed":this.adcompleted(t);break;case"ad-break-completed":this.adbreakcompleted();break;case"config":this.configured(t.detail);break;case"fullscreenenter":this.track(this.event_actions.fullscreen_enter);break;case"fullscreenexit":this.track(this.event_actions.fullscreen_exit);break;case"ad-skipped":this.adskipped()}})}setup_ga(e){window.ga&&!this.ga_extensions.length&&e.forEach((e,t)=>{var i;window.ga("create",e,"auto","ext"+(t+1)),(null===(i=this.config)||void 0===i?void 0:i.ga.custom_data)&&window.ga("ext"+(t+1)+".set",this.config.ga.custom_data),this.ga_extensions.push("ext"+(t+1))})}progress(e){e.opts.live||(e.currentTime/e.duration>.25&&0===this.quartiles[0]?(this.quartiles[0]=1,this.track(this.event_actions.video_25_percent)):e.currentTime/e.duration>.5&&0===this.quartiles[1]?(this.quartiles[1]=1,this.track(this.event_actions.video_50_percent)):e.currentTime/e.duration>.75&&0===this.quartiles[2]&&(this.quartiles[2]=1,this.track(this.event_actions.video_75_percent)))}volumechange(e){this.muted!==e.muted&&(this.muted=e.muted,e.muted?this.track(e.opts.live?this.event_actions.live_mute:this.event_actions.video_mute):this.track(e.opts.live?this.event_actions.live_unmute:this.event_actions.video_unmute))}reset(){this.quartiles=[0,0,0],this.preroll_counter=0,this.midroll_counter=0,this.postroll_counter=0}configured(e){var t,i;(null===(t=null==e?void 0:e.ga)||void 0===t?void 0:t.event_actions)&&(this.event_actions=e.ga.event_actions),(null===(i=null==e?void 0:e.ga)||void 0===i?void 0:i.event_categories)&&(this.event_categories=e.ga.event_categories)}checkForAdCounter(e,t){return e.replace("[x]",t+"")}adstarted(e){var t;switch((null===(t=e.data)||void 0===t?void 0:t.ad_type)||"preroll"){case"midroll":this.ad_type="midroll",this.midroll_counter++,this.track(this.checkForAdCounter(this.event_actions.ad_start_midroll,this.midroll_counter));break;case"postroll":this.ad_type="postroll",this.postroll_counter++,this.track(this.checkForAdCounter(this.event_actions.ad_start_postroll,this.postroll_counter));break;default:this.ad_type="preroll",this.preroll_counter++,this.track(this.checkForAdCounter(this.event_actions.ad_start_preroll,this.preroll_counter))}}adcompleted(e){var t;switch((null===(t=e.data)||void 0===t?void 0:t.ad_type)||"preroll"){case"midroll":this.track(this.event_actions.ad_completed_midroll);break;case"postroll":this.track(this.event_actions.ad_completed_postroll);break;default:this.track(this.event_actions.ad_completed_preroll)}}adskipped(){if(this.ad_type)switch(this.ad_type){case"midroll":this.track(this.event_actions.ad_skipped_midroll);break;case"postroll":this.track(this.event_actions.ad_skipped_postroll);break;default:this.track(this.event_actions.ad_skipped_preroll)}else this.track(this.event_actions.ad_skipped_preroll)}adbreakcompleted(){this.track(this.event_actions.ad_break_completed)}pushToDataLayer(e,t,i){var s;if(window.dataLayer)try{window.dataLayer.push({event:"Flowplayer",video_name:i,action:e,category:t,duration:null===(s=this.video)||void 0===s?void 0:s.duration})}catch(e){}}track(e){var t,i,s,o,a;if(!this.config||!this.config.ga||!e||(null===(t=null==this?void 0:this.video)||void 0===t?void 0:t.hasState("consent-no-tracking")))return;const l=(null===(i=this.video)||void 0===i?void 0:i.opts.live)?this.event_categories.live:this.event_categories.videos,r=null===(s=this.config.ga)||void 0===s?void 0:s.ga_instances,n=(null===(o=null==this?void 0:this.config)||void 0===o?void 0:o.title)||(null===(a=this.config.metadata)||void 0===a?void 0:a.title)||"unknown video";return this.config.ga.data_layer_tracking?this.pushToDataLayer(e,l,n):(this.setup_ga(r),this.ga_extensions.length&&void 0!==window.ga&&null!==window.ga?void this.ga_extensions.forEach(t=>{window.ga(t+".send","event",l,e,n)}):console.debug("ga console.send","event",l,e,n))}}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 i=e.flowplayer;"function"==typeof i?i(t):(Array.isArray(i.extensions)||(i.extensions=[]),~i.extensions.indexOf(t)||i.extensions.push(t))}(window,GoogleAnalyticsPlugin),GoogleAnalyticsPlugin}));
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.google_analytics=t())}(this,(function(){"use strict";class GoogleAnalyticsPlugin{constructor(e){this.muted=!1,this.ga_extensions=[],this.quartiles=[0,0,0],this.ad_type="preroll",this.preroll_counter=0,this.midroll_counter=0,this.postroll_counter=0,this.event_categories={live:"Live",videos:"Videos"},this.event_actions={fullscreen_enter:"fullscreen_enter",fullscreen_exit:"fullscreen_exit",video_player_load:"video_player_load",video_start:"video_start",video_click_play:"video_click_play",video_pause:"video_pause",video_resume:"video_resume",video_mute:"video_mute",video_unmute:"video_unmute",video_25_percent:"video_25_percent",video_50_percent:"video_50_percent",video_75_percent:"video_75_percent",video_complete:"video_complete",live_start:"live_start",live_click_play:"live_click_play",live_pause:"live_pause",live_resume:"live_resume",live_mute:"live_mute",live_unmute:"live_unmute",live_complete:"live_complete",ad_start_preroll:"ad_start_preroll",ad_start_midroll:"ad_start_midroll",ad_start_postroll:"ad_start_postroll",ad_completed_preroll:"ad_completed_preroll",ad_completed_midroll:"ad_completed_midroll",ad_completed_postroll:"ad_completed_postroll",ad_skipped_preroll:"ad_skipped_preroll",ad_skipped_midroll:"ad_skipped_midroll",ad_skipped_postroll:"ad_skipped_postroll",ad_break_completed:"ad_break_completed"},console.warn("universal analytics by Google has been sunset, please use the ga4 plugin"),this.flowplayer=e}init(e,t,i){var s;this.config=e,this.video=i,this.muted=i.muted,i.on(["mount","timeupdate","play","ended","pause","playing","volumechange","ad-started","ad-completed","ad-skipped","ad-break-completed","config","play","fullscreenenter","fullscreenexit"],(s=t=>{switch(t.type){case"playing":this.track(e.live?this.event_actions.live_resume:this.event_actions.video_resume);break;case"pause":if(Math.abs(i.duration-i.currentTime)<1)break;this.track(e.live?this.event_actions.live_pause:this.event_actions.video_pause);break;case"play":(i.hasState("is-starting")||i.hasState("is-ended"))&&this.track(e.live?this.event_actions.live_start:this.event_actions.video_start),this.track(e.live?this.event_actions.live_click_play:this.event_actions.video_click_play);break;case"mount":this.track(this.event_actions.video_player_load);break;case"timeupdate":this.progress(i);break;case"ended":this.track(e.live?this.event_actions.live_complete:this.event_actions.video_complete),this.reset();break;case"volumechange":this.volumechange(i);break;case"ad-started":this.adstarted(t);break;case"ad-completed":this.adcompleted(t);break;case"ad-break-completed":this.adbreakcompleted();break;case"config":this.configured(t.detail);break;case"fullscreenenter":this.track(this.event_actions.fullscreen_enter);break;case"fullscreenexit":this.track(this.event_actions.fullscreen_exit);break;case"ad-skipped":this.adskipped()}},e=>{setTimeout((function(){if(!e.defaultPrevented)return s(e)}),0)}))}setup_ga(e){window.ga&&!this.ga_extensions.length&&e.forEach((e,t)=>{var i;window.ga("create",e,"auto","ext"+(t+1)),(null===(i=this.config)||void 0===i?void 0:i.ga.custom_data)&&window.ga("ext"+(t+1)+".set",this.config.ga.custom_data),this.ga_extensions.push("ext"+(t+1))})}progress(e){e.opts.live||(e.currentTime/e.duration>.25&&0===this.quartiles[0]?(this.quartiles[0]=1,this.track(this.event_actions.video_25_percent)):e.currentTime/e.duration>.5&&0===this.quartiles[1]?(this.quartiles[1]=1,this.track(this.event_actions.video_50_percent)):e.currentTime/e.duration>.75&&0===this.quartiles[2]&&(this.quartiles[2]=1,this.track(this.event_actions.video_75_percent)))}volumechange(e){this.muted!==e.muted&&(this.muted=e.muted,e.muted?this.track(e.opts.live?this.event_actions.live_mute:this.event_actions.video_mute):this.track(e.opts.live?this.event_actions.live_unmute:this.event_actions.video_unmute))}reset(){this.quartiles=[0,0,0],this.preroll_counter=0,this.midroll_counter=0,this.postroll_counter=0}configured(e){var t,i;(null===(t=null==e?void 0:e.ga)||void 0===t?void 0:t.event_actions)&&(this.event_actions=e.ga.event_actions),(null===(i=null==e?void 0:e.ga)||void 0===i?void 0:i.event_categories)&&(this.event_categories=e.ga.event_categories)}checkForAdCounter(e,t){return e.replace("[x]",t+"")}adstarted(e){var t;switch((null===(t=e.data)||void 0===t?void 0:t.ad_type)||"preroll"){case"midroll":this.ad_type="midroll",this.midroll_counter++,this.track(this.checkForAdCounter(this.event_actions.ad_start_midroll,this.midroll_counter));break;case"postroll":this.ad_type="postroll",this.postroll_counter++,this.track(this.checkForAdCounter(this.event_actions.ad_start_postroll,this.postroll_counter));break;default:this.ad_type="preroll",this.preroll_counter++,this.track(this.checkForAdCounter(this.event_actions.ad_start_preroll,this.preroll_counter))}}adcompleted(e){var t;switch((null===(t=e.data)||void 0===t?void 0:t.ad_type)||"preroll"){case"midroll":this.track(this.event_actions.ad_completed_midroll);break;case"postroll":this.track(this.event_actions.ad_completed_postroll);break;default:this.track(this.event_actions.ad_completed_preroll)}}adskipped(){if(this.ad_type)switch(this.ad_type){case"midroll":this.track(this.event_actions.ad_skipped_midroll);break;case"postroll":this.track(this.event_actions.ad_skipped_postroll);break;default:this.track(this.event_actions.ad_skipped_preroll)}else this.track(this.event_actions.ad_skipped_preroll)}adbreakcompleted(){this.track(this.event_actions.ad_break_completed)}pushToDataLayer(e,t,i){var s;if(window.dataLayer)try{window.dataLayer.push({event:"Flowplayer",video_name:i,action:e,category:t,duration:null===(s=this.video)||void 0===s?void 0:s.duration})}catch(e){}}track(e){var t,i,s,o,a;if(!this.config||!this.config.ga||!e||(null===(t=null==this?void 0:this.video)||void 0===t?void 0:t.hasState("consent-no-tracking")))return;const l=(null===(i=this.video)||void 0===i?void 0:i.opts.live)?this.event_categories.live:this.event_categories.videos,r=null===(s=this.config.ga)||void 0===s?void 0:s.ga_instances,n=(null===(o=null==this?void 0:this.config)||void 0===o?void 0:o.title)||(null===(a=this.config.metadata)||void 0===a?void 0:a.title)||"unknown video";return this.config.ga.data_layer_tracking?this.pushToDataLayer(e,l,n):(this.setup_ga(r),this.ga_extensions.length&&void 0!==window.ga&&null!==window.ga?void this.ga_extensions.forEach(t=>{window.ga(t+".send","event",l,e,n)}):console.debug("ga console.send","event",l,e,n))}}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 i=e.flowplayer;"function"==typeof i?i(t):(Array.isArray(i.extensions)||(i.extensions=[]),~i.extensions.indexOf(t)||i.extensions.push(t))}(window,GoogleAnalyticsPlugin),GoogleAnalyticsPlugin}));
package/plugins/health.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.health=t())}(this,(function(){"use strict";const e="rebuffer";var t=Object.freeze({__proto__:null,RECORD:"health:record",REBUFFER:e,DISPLAY:"display"});const n="load",i="fullscreenenter",o="fullscreenexit",s="loadedmetadata",r="loadeddata",a="progress",d="loadstart",c="pause",l="playing",u="waiting",_="canplay",h="ended",f="seeked",p="seeking";function y(e){try{return!!new URL(e)}catch(e){return!1}}function m(e,t){const n=function(){try{return localStorage.getItem("flowplayer/debug")}catch(e){return""}}(),i=(i,...o)=>{try{const s=(null==t?void 0:t.debug)||n;s&&e.match(s)&&console.log(`flowplayer/${e} -- ${i}`,...o)}catch(e){console.warn(e)}};return i.log=i,i}const v=navigator;function E(e){var t,n;const i=null===(t=e.hls)||void 0===t?void 0:t.bandwidthEstimate;return i?1e-6*i:(null===(n=v.connection)||void 0===n?void 0:n.downlink)||-1}function g(e,t){return async function(e,t){try{await fetch(e,{body:t,method:"POST",mode:"no-cors"})}catch(e){}}(e,JSON.stringify({events:t}))}const w="https://ljsp.lwcdn.com".concat("/web/public/countdown/time.json"),R=window,I=R._flowplayerTimekeeper||(R._flowplayerTimekeeper={});var O;!function(e){e[e.OFF=0]="OFF",e[e.ON=1]="ON",e[e.AUDIO_REQUIRED=2]="AUDIO_REQUIRED"}(O||(O={}));const D=e=>{switch(e){case!0:return O.ON;case!1:return O.OFF;default:return e}};function N(){try{return window.location!==window.parent.location?document.referrer:document.location.href}catch(e){return!1}}const T=[],A="https://ihi.flowplayer.com/v1/health/events";function b(e){if(e.suspended)return;const t=T.slice(0);T.length=0,0!=t.length&&(e.logger.log(`:dispatch events={${t.length}}`),g(function(){try{return"undefined"==typeof window?A:window.__FLOWPLAYER_INSIGHTS_URL?window.__FLOWPLAYER_INSIGHTS_URL:A}catch(e){return A}}(),t))}async function S(e,t,n){const i=await U();T.push(Object.assign(t,i)),e.logger.log(":enqueue",t.event,t),T.length<10&&!n||b(e)}const L=()=>{var e,t;try{const n=window;return null===(t=null===(e=null==n?void 0:n.google)||void 0===e?void 0:e.ima)||void 0===t?void 0:t.VERSION}catch(e){return}},U=async()=>{const e=Date.now();try{return{adjusted_time:e-await async function(){const e=I.cachedServerOffset;if(e)return e;const t=I.pendingRequest||(I.pendingRequest=fetch(w)),n=await t,i=parseInt(n.headers.get("age")||"0"),o=await n.json(),s=Date.now()-o.millisUtc-1e3*i;return I.cachedServerOffset=s,I.cachedServerOffset}(),client_time:e}}catch(t){return{client_time:e}}},k=(e,t)=>Object.assign(e,{detail:t}),C=(e,{event:t,media_session_id:n,session_id:i,play_range_id:o})=>({event:t,media_session_id:n,session_id:i,play_range_id:o,device_id:e.deviceId(),version:"3.9.0",commit:"5e10edcaa49f7b86c2d0af0994045a4e87ac4be9",ima_sdk_version:L(),preload:e.opt("preload"),autoplay:D(e.opt("autoplay")),live:e.opt("live"),dvr:!!e.live_state.dvr,source:e.original_src,downlink_mbs:E(e),page_url:N(),player_id:e.opt("metadata.player_id"),media_id:e.opt("metadata.media_id"),site_id:e.opt("metadata.site_id"),category_id:e.opt("metadata.category_id"),sitegroup_id:e.opt("metadata.sitegroup_id"),token:e.token,plugins:e.plugins.map(e=>e.constructor.name).sort((e,t)=>e.localeCompare(t)),current_time:e.currentTime,external_media_id:e.opt("external_media_id")}),M=e=>({bitrate:null==e?void 0:e.bitrate,resolution:null==e?void 0:e.attrs.RESOLUTION,frame_rate:null==e?void 0:e.attrs["FRAME-RATE"]});function x(e,t,n,i){const o=C(t,e.eventInfo(n)),{before:s,after:r}=i;S(e,((e,t,n)=>Object.assign(e,{state:{before:t,after:n}}))(o,M(s),M(r)))}const F=[1e7]+""+-1e3+-4e3+-8e3+-1e11,B=()=>"undefined"==typeof crypto?"":F.replace(/[018]/g,e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16));var P;function H(e){switch(e){case P.MEDIA_PLAYBACK_ABORTED:return"media playback was aborted";case P.MEDIA_ERR_NETWORK:return"a network error occurred";case P.MEDIA_ERR_DECODE:return"unable to decode media content";case P.MEDIA_ERR_SRC_NOT_SUPPORTED:return"unsupported media type";case P.NO_INTERNET:return"no internet connection detected";case P.MIXED_CONTENT:return"cannot load insecure content in a secure context";default:return"an unknown error occurred"}}!function(e){e[e.UNKNOWN=-1]="UNKNOWN",e[e.MEDIA_PLAYBACK_ABORTED=1]="MEDIA_PLAYBACK_ABORTED",e[e.MEDIA_ERR_NETWORK=2]="MEDIA_ERR_NETWORK",e[e.MEDIA_ERR_DECODE=3]="MEDIA_ERR_DECODE",e[e.MEDIA_ERR_SRC_NOT_SUPPORTED=4]="MEDIA_ERR_SRC_NOT_SUPPORTED",e[e.MIXED_CONTENT=1001]="MIXED_CONTENT",e[e.NO_INTERNET=1002]="NO_INTERNET"}(P||(P={}));const j=(e,t)=>{let n=null;return(...i)=>{null!==n&&(clearTimeout(n),n=null),n=setTimeout(()=>t(...i),e)}},K=B();class Health{constructor(e,t){this.session_id=K,this.suspended=!1,this.logger=m("health",t.opts),this.media_session_id=B(),this.play_range_id=B(),this.analyticsLoop=setInterval(()=>b(this),2e3),t.on("reap",()=>clearInterval(this.analyticsLoop)),t.on(l,()=>{this.play_range_id=B()});const n=this;if(t.health={get media_session_id(){return n.media_session_id},set media_session_id(e){n.media_session_id=e},get session_id(){return n.session_id},set session_id(e){n.session_id=e},toggle(e){e?n.resume():n.suspend()}},!Health._UNLOAD_SUBSCRIBED){Health._UNLOAD_SUBSCRIBED=!0;const t=t=>e.instances.forEach(e=>e.emit(t.type));document.addEventListener("visibilitychange",e=>{"hidden"==document.visibilityState&&t(e)}),window.addEventListener("pagehide",t)}}eventInfo(e){return{event:e,media_session_id:this.media_session_id,session_id:this.session_id,play_range_id:this.play_range_id}}suspend(){this.suspended=!0,clearInterval(this.analyticsLoop)}resume(){this.suspended=!1,this.analyticsLoop=setInterval(()=>b(this),2e3)}init(t,m,v){!function(t){t.on(u,(function(n){t.seeking||t.networkState===t.NETWORK_LOADING&&t.readyState!==t.HAVE_NOTHING&&t.emit(e)}))}(v),v.on("display",e=>{S(this,C(v,this.eventInfo(e.type)),!0)}),v.on("health:record",({detail:e})=>{const t=C(v,this.eventInfo(e.event));Object.assign(t,e.detail||{}),S(this,t)}),[_,d,n,s,r,a,u,e].forEach(e=>{v.on(e,e=>{S(this,C(v,this.eventInfo(e.type)))})}),[l,c,p,f,h,i,o].forEach(e=>{v.on(e,e=>{S(this,C(v,this.eventInfo(e.type)))})}),v.on("volumechange",j(800,e=>{const t=C(v,this.eventInfo(e.type));S(this,k(t,{volume:parseFloat(v.volume.toFixed(2)),muted:v.muted}))})),v.on("resize",j(800,e=>{const t=C(v,this.eventInfo(e.type));S(this,k(t,{height:m.clientHeight,width:m.clientWidth}))})),v.on("hls/failover",e=>{const t=C(v,this.eventInfo(e.type)),n=e.detail,{reason:i,from:o}=n;S(this,k(t,{reason:i,from:o}))}),v.on("qualitychange",({type:e,detail:t})=>{switch(t.kind){case"hls":return x(this,v,e,t)}});let E=Date.now()+5e3;v.on("timeupdate",e=>{if(Date.now()<E)return;E=Date.now()+5e3;const t=C(v,this.eventInfo(e.type));var n;S(this,k(t,{duration:(n=v.duration,Number.isFinite(n)?n:n===1/0?-1:void 0)}))}),v.addEventListener("error",e=>{const t=C(v,this.eventInfo(e.type)),n=e.error||v.error;if(!n)return S(this,t,!0);const i=n.code,o={error_message:n.message||H(i),error_code:i,error_stack:n.stack||""};return S(this,k(t,o),!0)}),v.on("src",e=>{var t;const n=null===(t=e.detail)||void 0===t?void 0:t.src;if("string"!=typeof n)return;if(!y(v.original_src))return;if(!y(n))return;if(n==v.original_src)return;this.media_session_id=B();S(this,C(v,this.eventInfo(e.type))),b(this)}),v.on("visibilitychange",e=>{S(this,C(v,this.eventInfo(e.type))),b(this)})}}return Health.events=t,Health._UNLOAD_SUBSCRIBED=!1,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;"function"==typeof n?n(t):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(t)||n.extensions.push(t))}(window,Health),Health}));
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.health=t())}(this,(function(){"use strict";const e="rebuffer";var t=Object.freeze({__proto__:null,RECORD:"health:record",REBUFFER:e,DISPLAY:"display"});const n="load",i="fullscreenenter",o="fullscreenexit",s="loadedmetadata",r="loadeddata",a="progress",d="loadstart",c="pause",l="playing",u="waiting",_="canplay",h="ended",f="seeked",p="seeking";function y(e){try{return!!new URL(e)}catch(e){return!1}}function m(e,t){const n=function(){try{return localStorage.getItem("flowplayer/debug")}catch(e){return""}}(),i=(i,...o)=>{try{const s=(null==t?void 0:t.debug)||n;s&&e.match(s)&&console.log(`flowplayer/${e} -- ${i}`,...o)}catch(e){console.warn(e)}};return i.log=i,i}const v=navigator;function E(e){var t,n;const i=null===(t=e.hls)||void 0===t?void 0:t.bandwidthEstimate;return i?1e-6*i:(null===(n=v.connection)||void 0===n?void 0:n.downlink)||-1}function g(e,t){return async function(e,t){try{await fetch(e,{body:t,method:"POST",mode:"no-cors"})}catch(e){}}(e,JSON.stringify({events:t}))}const w="https://ljsp.lwcdn.com".concat("/web/public/countdown/time.json"),R=window,I=R._flowplayerTimekeeper||(R._flowplayerTimekeeper={});var O;!function(e){e[e.OFF=0]="OFF",e[e.ON=1]="ON",e[e.AUDIO_REQUIRED=2]="AUDIO_REQUIRED"}(O||(O={}));const D=e=>{switch(e){case!0:return O.ON;case!1:return O.OFF;default:return e}};function N(){try{return window.location!==window.parent.location?document.referrer:document.location.href}catch(e){return!1}}const T=[],A="https://ihi.flowplayer.com/v1/health/events";function b(e){if(e.suspended)return;const t=T.slice(0);T.length=0,0!=t.length&&(e.logger.log(`:dispatch events={${t.length}}`),g(function(){try{return"undefined"==typeof window?A:window.__FLOWPLAYER_INSIGHTS_URL?window.__FLOWPLAYER_INSIGHTS_URL:A}catch(e){return A}}(),t))}async function S(e,t,n){const i=await U();T.push(Object.assign(t,i)),e.logger.log(":enqueue",t.event,t),T.length<10&&!n||b(e)}const L=()=>{var e,t;try{const n=window;return null===(t=null===(e=null==n?void 0:n.google)||void 0===e?void 0:e.ima)||void 0===t?void 0:t.VERSION}catch(e){return}},U=async()=>{const e=Date.now();try{return{adjusted_time:e-await async function(){const e=I.cachedServerOffset;if(e)return e;const t=I.pendingRequest||(I.pendingRequest=fetch(w)),n=await t,i=parseInt(n.headers.get("age")||"0"),o=await n.json(),s=Date.now()-o.millisUtc-1e3*i;return I.cachedServerOffset=s,I.cachedServerOffset}(),client_time:e}}catch(t){return{client_time:e}}},k=(e,t)=>Object.assign(e,{detail:t}),C=(e,{event:t,media_session_id:n,session_id:i,play_range_id:o})=>({event:t,media_session_id:n,session_id:i,play_range_id:o,device_id:e.deviceId(),version:"3.9.1",commit:"fe89f61fcf31cfc87d1a635b4b917a7f78055e7a",ima_sdk_version:L(),preload:e.opt("preload"),autoplay:D(e.opt("autoplay")),live:e.opt("live"),dvr:!!e.live_state.dvr,source:e.original_src,downlink_mbs:E(e),page_url:N(),player_id:e.opt("metadata.player_id"),media_id:e.opt("metadata.media_id"),site_id:e.opt("metadata.site_id"),category_id:e.opt("metadata.category_id"),sitegroup_id:e.opt("metadata.sitegroup_id"),token:e.token,plugins:e.plugins.map(e=>e.constructor.name).sort((e,t)=>e.localeCompare(t)),current_time:e.currentTime,external_media_id:e.opt("external_media_id")}),M=e=>({bitrate:null==e?void 0:e.bitrate,resolution:null==e?void 0:e.attrs.RESOLUTION,frame_rate:null==e?void 0:e.attrs["FRAME-RATE"]});function x(e,t,n,i){const o=C(t,e.eventInfo(n)),{before:s,after:r}=i;S(e,((e,t,n)=>Object.assign(e,{state:{before:t,after:n}}))(o,M(s),M(r)))}const F=[1e7]+""+-1e3+-4e3+-8e3+-1e11,B=()=>"undefined"==typeof crypto?"":F.replace(/[018]/g,e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16));var P;function H(e){switch(e){case P.MEDIA_PLAYBACK_ABORTED:return"media playback was aborted";case P.MEDIA_ERR_NETWORK:return"a network error occurred";case P.MEDIA_ERR_DECODE:return"unable to decode media content";case P.MEDIA_ERR_SRC_NOT_SUPPORTED:return"unsupported media type";case P.NO_INTERNET:return"no internet connection detected";case P.MIXED_CONTENT:return"cannot load insecure content in a secure context";default:return"an unknown error occurred"}}!function(e){e[e.UNKNOWN=-1]="UNKNOWN",e[e.MEDIA_PLAYBACK_ABORTED=1]="MEDIA_PLAYBACK_ABORTED",e[e.MEDIA_ERR_NETWORK=2]="MEDIA_ERR_NETWORK",e[e.MEDIA_ERR_DECODE=3]="MEDIA_ERR_DECODE",e[e.MEDIA_ERR_SRC_NOT_SUPPORTED=4]="MEDIA_ERR_SRC_NOT_SUPPORTED",e[e.MIXED_CONTENT=1001]="MIXED_CONTENT",e[e.NO_INTERNET=1002]="NO_INTERNET"}(P||(P={}));const j=(e,t)=>{let n=null;return(...i)=>{null!==n&&(clearTimeout(n),n=null),n=setTimeout(()=>t(...i),e)}},K=B();class Health{constructor(e,t){this.session_id=K,this.suspended=!1,this.logger=m("health",t.opts),this.media_session_id=B(),this.play_range_id=B(),this.analyticsLoop=setInterval(()=>b(this),2e3),t.on("reap",()=>clearInterval(this.analyticsLoop)),t.on(l,()=>{this.play_range_id=B()});const n=this;if(t.health={get media_session_id(){return n.media_session_id},set media_session_id(e){n.media_session_id=e},get session_id(){return n.session_id},set session_id(e){n.session_id=e},toggle(e){e?n.resume():n.suspend()}},!Health._UNLOAD_SUBSCRIBED){Health._UNLOAD_SUBSCRIBED=!0;const t=t=>e.instances.forEach(e=>e.emit(t.type));document.addEventListener("visibilitychange",e=>{"hidden"==document.visibilityState&&t(e)}),window.addEventListener("pagehide",t)}}eventInfo(e){return{event:e,media_session_id:this.media_session_id,session_id:this.session_id,play_range_id:this.play_range_id}}suspend(){this.suspended=!0,clearInterval(this.analyticsLoop)}resume(){this.suspended=!1,this.analyticsLoop=setInterval(()=>b(this),2e3)}init(t,m,v){!function(t){t.on(u,(function(n){t.seeking||t.networkState===t.NETWORK_LOADING&&t.readyState!==t.HAVE_NOTHING&&t.emit(e)}))}(v),v.on("display",e=>{S(this,C(v,this.eventInfo(e.type)),!0)}),v.on("health:record",({detail:e})=>{const t=C(v,this.eventInfo(e.event));Object.assign(t,e.detail||{}),S(this,t)}),[_,d,n,s,r,a,u,e].forEach(e=>{v.on(e,e=>{S(this,C(v,this.eventInfo(e.type)))})}),[l,c,p,f,h,i,o].forEach(e=>{v.on(e,e=>{S(this,C(v,this.eventInfo(e.type)))})}),v.on("volumechange",j(800,e=>{const t=C(v,this.eventInfo(e.type));S(this,k(t,{volume:parseFloat(v.volume.toFixed(2)),muted:v.muted}))})),v.on("resize",j(800,e=>{const t=C(v,this.eventInfo(e.type));S(this,k(t,{height:m.clientHeight,width:m.clientWidth}))})),v.on("hls/failover",e=>{const t=C(v,this.eventInfo(e.type)),n=e.detail,{reason:i,from:o}=n;S(this,k(t,{reason:i,from:o}))}),v.on("qualitychange",({type:e,detail:t})=>{switch(t.kind){case"hls":return x(this,v,e,t)}});let E=Date.now()+5e3;v.on("timeupdate",e=>{if(Date.now()<E)return;E=Date.now()+5e3;const t=C(v,this.eventInfo(e.type));var n;S(this,k(t,{duration:(n=v.duration,Number.isFinite(n)?n:n===1/0?-1:void 0)}))}),v.addEventListener("error",e=>{const t=C(v,this.eventInfo(e.type)),n=e.error||v.error;if(!n)return S(this,t,!0);const i=n.code,o={error_message:n.message||H(i),error_code:i,error_stack:n.stack||""};return S(this,k(t,o),!0)}),v.on("src",e=>{var t;const n=null===(t=e.detail)||void 0===t?void 0:t.src;if("string"!=typeof n)return;if(!y(v.original_src))return;if(!y(n))return;if(n==v.original_src)return;this.media_session_id=B();S(this,C(v,this.eventInfo(e.type))),b(this)}),v.on("visibilitychange",e=>{S(this,C(v,this.eventInfo(e.type))),b(this)})}}return Health.events=t,Health._UNLOAD_SUBSCRIBED=!1,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;"function"==typeof n?n(t):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(t)||n.extensions.push(t))}(window,Health),Health}));