From 278556b41bd67c2d709a11fc81adc3686dd0de1d Mon Sep 17 00:00:00 2001 From: Tim Bielawski <> Date: Tue, 29 Jan 2019 10:18:49 +0200 Subject: [PATCH 01/22] feat: adds a request mode for ad requests onLoad: This is the default behaviour, ad requests are done when the player is ready onPlay: New behaviour, Ad requests are only made once playback is initiated. This is necessary as some ad networks consider ad requests to be plays --- src/controller.js | 1 + src/player-wrapper.js | 5 +++++ src/sdk-impl.js | 7 ++++--- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/controller.js b/src/controller.js index 790fe88c..c25b20ee 100644 --- a/src/controller.js +++ b/src/controller.js @@ -86,6 +86,7 @@ Controller.IMA_DEFAULTS = { adLabel: 'Advertisement', adLabelNofN: 'of', showControlsForJSAds: true, + requestMode: 'onLoad', }; /** diff --git a/src/player-wrapper.js b/src/player-wrapper.js index 63d2df2c..8faa1073 100644 --- a/src/player-wrapper.js +++ b/src/player-wrapper.js @@ -139,6 +139,11 @@ const PlayerWrapper = function(player, adsPluginSettings, controller) { this.vjsPlayer.on('readyforpreroll', this.onReadyForPreroll.bind(this)); this.vjsPlayer.ready(this.onPlayerReady.bind(this)); + if (this.controller.getSettings().requestMode === 'onPlay') { + this.vjsPlayer.one('play', + this.controller.requestAds.bind(this.controller)); +} + this.vjsPlayer.ads(adsPluginSettings); }; diff --git a/src/sdk-impl.js b/src/sdk-impl.js index 839a88a8..45b08fb8 100644 --- a/src/sdk-impl.js +++ b/src/sdk-impl.js @@ -553,9 +553,10 @@ SdkImpl.prototype.onPlayerReadyForPreroll = function() { SdkImpl.prototype.onPlayerReady = function() { this.initAdObjects(); - if (this.controller.getSettings().adTagUrl || - this.controller.getSettings().adsResponse) { - this.requestAds(); + if ((this.controller.getSettings().adTagUrl || + this.controller.getSettings().adsResponse) && + this.controller.getSettings().requestMode === 'onLoad') { + this.requestAds(); } }; From 168c3c16bba7c88e2ea757734c269dc757e2cd21 Mon Sep 17 00:00:00 2001 From: Jackson Sui Date: Mon, 19 Aug 2019 13:53:45 -0400 Subject: [PATCH 02/22] Readme Update: updates the Readme to highlight an example using es6 import statements --- README.md | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/README.md b/README.md index af35112d..40d4daa9 100644 --- a/README.md +++ b/README.md @@ -18,12 +18,74 @@ your video content. - A JavaScript enabled browser ## Getting started + +### ES6 Imports The easiest way to get started is by using [npm](//www.npmjs.org/). ``` npm install videojs-ima ``` +Your index.html should contain the video.js stylesheet (not included in the npm moduel), +a video player to be used for playback, and a script tag for the ima3.js file and your own +javascript file. + +```html + + + + + + + + + + + + + +``` + +Three imports are required to use the video.js ima moduel, then the standard implementation +of video.js with the ima player can be used. See the player.js exmaple below. + +```javascript +import videojs from 'video.js'; +import 'videojs-contrib-ads'; +import 'videojs-ima'; + +var videoOptions = { + controls: true, + sources: [{ + src: 'PATH_TO_YOUR_CONTENT_VIDEO', + type: 'YOUR_CONTENT_VIDEO_TYPE', + }] +} + +var imaOptions = { + adTagUrl: 'https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/ad_rule_samples&ciu_szs=300x250&ad_rule=1&impl=s&gdfp_req=1&env=vp&output=vmap&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ar%3Dpreonly&cmsid=496&vid=short_onecue&correlator=' +}; + +var player = videojs('content_video', videoOptions); + +var imaOptions = { + adTagUrl: 'YOUR_AD_TAG' +}; + +player.ima(imaOptions); +// On mobile devices, you must call initializeAdDisplayContainer as the result +// of a user action (e.g. button click). If you do not make this call, the SDK +// will make it for you, but not as the result of a user action. For more info +// see our examples, all of which are set up to work on mobile devices. +// player.ima.initializeAdDisplayContainer(); +``` + +### Alternative Setup If you don't use npm, you can download the source from the dist/ folder and include it directly in your project. You'll also need to download the source for the [videojs-contrib-ads plugin](//github.com/videojs/videojs-contrib-ads). From 18186f9f5f527a35634795fef72c9b8fa877be31 Mon Sep 17 00:00:00 2001 From: Jackson Sui Date: Mon, 19 Aug 2019 15:02:41 -0400 Subject: [PATCH 03/22] fix: fixed small errors in Readme update --- README.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/README.md b/README.md index 40d4daa9..cf8df828 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ javascript file. ``` -Three imports are required to use the video.js ima moduel, then the standard implementation +Three imports are required to use the videojs-ima moduel, then the standard implementation of video.js with the ima player can be used. See the player.js exmaple below. ```javascript @@ -65,10 +65,6 @@ var videoOptions = { src: 'PATH_TO_YOUR_CONTENT_VIDEO', type: 'YOUR_CONTENT_VIDEO_TYPE', }] -} - -var imaOptions = { - adTagUrl: 'https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/ad_rule_samples&ciu_szs=300x250&ad_rule=1&impl=s&gdfp_req=1&env=vp&output=vmap&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ar%3Dpreonly&cmsid=496&vid=short_onecue&correlator=' }; var player = videojs('content_video', videoOptions); From 8dd1922585e6c3906fbe30399b533cd49ccd494f Mon Sep 17 00:00:00 2001 From: Jackson Sui Date: Mon, 19 Aug 2019 15:11:44 -0400 Subject: [PATCH 04/22] updates for spelling --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index cf8df828..5c4e4c43 100644 --- a/README.md +++ b/README.md @@ -26,8 +26,8 @@ The easiest way to get started is by using [npm](//www.npmjs.org/). npm install videojs-ima ``` -Your index.html should contain the video.js stylesheet (not included in the npm moduel), -a video player to be used for playback, and a script tag for the ima3.js file and your own +Your index.html should contain the video.js stylesheet (not included in the npm module), +a video player to be used for playback, and a script tags for the IMA SDK and your own javascript file. ```html @@ -40,7 +40,7 @@ javascript file. @@ -51,8 +51,8 @@ javascript file. ``` -Three imports are required to use the videojs-ima moduel, then the standard implementation -of video.js with the ima player can be used. See the player.js exmaple below. +Three imports are required to use the videojs-ima module, then the standard implementation +of video.js with the ima player can be used. See the player.js example below. ```javascript import videojs from 'video.js'; From 8be147e9bcc14b659a474e44977ac9360116f299 Mon Sep 17 00:00:00 2001 From: Jackson Sui Date: Mon, 19 Aug 2019 15:16:34 -0400 Subject: [PATCH 05/22] grammer update --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5c4e4c43..9db30753 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ npm install videojs-ima ``` Your index.html should contain the video.js stylesheet (not included in the npm module), -a video player to be used for playback, and a script tags for the IMA SDK and your own +a video player to be used for playback, and script tags for the IMA SDK and your own javascript file. ```html @@ -51,8 +51,7 @@ javascript file. ``` -Three imports are required to use the videojs-ima module, then the standard implementation -of video.js with the ima player can be used. See the player.js example below. +Three imports are required to use the videojs-ima module as seen in the player.js example below. ```javascript import videojs from 'video.js'; From 1f685b22f45fb5fbf53dafba98d5ea76fa2b3c33 Mon Sep 17 00:00:00 2001 From: Jackson Sui Date: Mon, 19 Aug 2019 15:18:40 -0400 Subject: [PATCH 06/22] one comma --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9db30753..60680bfb 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ javascript file. ``` -Three imports are required to use the videojs-ima module as seen in the player.js example below. +Three imports are required to use the videojs-ima module, as seen in the player.js example below. ```javascript import videojs from 'video.js'; From 9968f03784c5a4f7551369c609247be56b9db902 Mon Sep 17 00:00:00 2001 From: arnaudcasame Date: Tue, 27 Aug 2019 14:59:29 -0400 Subject: [PATCH 07/22] Removes the click eventListener on the adContainer --- src/sdk-impl.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/sdk-impl.js b/src/sdk-impl.js index dddfdf4b..07b631f7 100644 --- a/src/sdk-impl.js +++ b/src/sdk-impl.js @@ -264,9 +264,6 @@ SdkImpl.prototype.onAdsManagerLoaded = function(adsManagerLoadedEvent) { this.adsManager.addEventListener( google.ima.AdEvent.Type.STARTED, this.onAdStarted.bind(this)); - this.adsManager.addEventListener( - google.ima.AdEvent.Type.CLICK, - this.onAdPaused.bind(this)); this.adsManager.addEventListener( google.ima.AdEvent.Type.COMPLETE, this.onAdComplete.bind(this)); From 0f88d3337078fb8091491437e223cbd62fbfd16b Mon Sep 17 00:00:00 2001 From: arnaudcasame Date: Tue, 27 Aug 2019 15:09:00 -0400 Subject: [PATCH 08/22] Generates the distribution files --- dist/videojs.ima.js | 1 - 1 file changed, 1 deletion(-) diff --git a/dist/videojs.ima.js b/dist/videojs.ima.js index 7a7a52d5..1cacb308 100644 --- a/dist/videojs.ima.js +++ b/dist/videojs.ima.js @@ -1366,7 +1366,6 @@ SdkImpl.prototype.onAdsManagerLoaded = function (adsManagerLoadedEvent) { this.adsManager.addEventListener(google.ima.AdEvent.Type.LOADED, this.onAdLoaded.bind(this)); this.adsManager.addEventListener(google.ima.AdEvent.Type.STARTED, this.onAdStarted.bind(this)); - this.adsManager.addEventListener(google.ima.AdEvent.Type.CLICK, this.onAdPaused.bind(this)); this.adsManager.addEventListener(google.ima.AdEvent.Type.COMPLETE, this.onAdComplete.bind(this)); this.adsManager.addEventListener(google.ima.AdEvent.Type.SKIPPED, this.onAdComplete.bind(this)); this.adsManager.addEventListener(google.ima.AdEvent.Type.LOG, this.onAdLog.bind(this)); From 2b854a4841acf98c2ac9c1542dc3600445c3da69 Mon Sep 17 00:00:00 2001 From: Kiro705 Date: Mon, 9 Sep 2019 11:14:53 -0400 Subject: [PATCH 09/22] fix: changed to parseFloat --- src/player-wrapper.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/player-wrapper.js b/src/player-wrapper.js index 679f18d7..31a6f276 100644 --- a/src/player-wrapper.js +++ b/src/player-wrapper.js @@ -384,11 +384,11 @@ PlayerWrapper.prototype.play = function() { PlayerWrapper.prototype.getPlayerWidth = function() { let width = (getComputedStyle(this.vjsPlayer.el()) || {}).width; - if (!width || parseInt(width, 10) === 0) { + if (!width || parseFloat(width, 10) === 0) { width = (this.vjsPlayer.el().getBoundingClientRect() || {}).width; } - return parseInt(width, 10) || this.vjsPlayer.width(); + return parseFloat(width, 10) || this.vjsPlayer.width(); }; @@ -400,11 +400,11 @@ PlayerWrapper.prototype.getPlayerWidth = function() { PlayerWrapper.prototype.getPlayerHeight = function() { let height = (getComputedStyle(this.vjsPlayer.el()) || {}).height; - if (!height || parseInt(height, 10) === 0) { + if (!height || parseFloat(height, 10) === 0) { height = (this.vjsPlayer.el().getBoundingClientRect() || {}).height; } - return parseInt(height, 10) || this.vjsPlayer.height(); + return parseFloat(height, 10) || this.vjsPlayer.height(); }; From 4b5eef9ea97f956970cdea202ae1ab236b4d04f7 Mon Sep 17 00:00:00 2001 From: Kiro705 Date: Mon, 9 Sep 2019 12:46:46 -0400 Subject: [PATCH 10/22] fix: removed second param from parseFloat --- src/player-wrapper.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/player-wrapper.js b/src/player-wrapper.js index 31a6f276..3b3c185b 100644 --- a/src/player-wrapper.js +++ b/src/player-wrapper.js @@ -384,11 +384,11 @@ PlayerWrapper.prototype.play = function() { PlayerWrapper.prototype.getPlayerWidth = function() { let width = (getComputedStyle(this.vjsPlayer.el()) || {}).width; - if (!width || parseFloat(width, 10) === 0) { + if (!width || parseFloat(width) === 0) { width = (this.vjsPlayer.el().getBoundingClientRect() || {}).width; } - return parseFloat(width, 10) || this.vjsPlayer.width(); + return parseFloat(width) || this.vjsPlayer.width(); }; @@ -400,11 +400,11 @@ PlayerWrapper.prototype.getPlayerWidth = function() { PlayerWrapper.prototype.getPlayerHeight = function() { let height = (getComputedStyle(this.vjsPlayer.el()) || {}).height; - if (!height || parseFloat(height, 10) === 0) { + if (!height || parseFloat(height) === 0) { height = (this.vjsPlayer.el().getBoundingClientRect() || {}).height; } - return parseFloat(height, 10) || this.vjsPlayer.height(); + return parseFloat(height) || this.vjsPlayer.height(); }; From 3ceda1b4215bb987288972736396a3dd496524d7 Mon Sep 17 00:00:00 2001 From: Kiro705 Date: Tue, 10 Sep 2019 15:28:23 -0400 Subject: [PATCH 11/22] 1.6.1 --- CHANGELOG.md | 9 +++++++++ package.json | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2cfdc600..2eb7f34d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ + +## [1.6.1](https://github.com/googleads/videojs-ima/compare/v1.6.0...v1.6.1) (2019-09-10) + +### Bug Fixes + +* changed to parseFloat ([2b854a4](https://github.com/googleads/videojs-ima/commit/2b854a4)) +* fixed small errors in Readme update ([18186f9](https://github.com/googleads/videojs-ima/commit/18186f9)) +* removed second param from parseFloat ([4b5eef9](https://github.com/googleads/videojs-ima/commit/4b5eef9)) + # [1.6.0](https://github.com/googleads/videojs-ima/compare/v1.5.2...v1.6.0) (2019-06-26) diff --git a/package.json b/package.json index 1278dd88..92fac0c2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "videojs-ima", - "version": "1.6.0", + "version": "1.6.1", "license": "Apache-2.0", "main": "./dist/videojs.ima.js", "module": "./dist/videojs.ima.es.js", From f8d9546d30f3dacaa14bf9e27cab4be0222903ee Mon Sep 17 00:00:00 2001 From: Kiro705 Date: Tue, 10 Sep 2019 15:49:00 -0400 Subject: [PATCH 12/22] merge commits for v1.6.1 --- dist/videojs.ima.es.js | 2 +- dist/videojs.ima.js | 2 +- dist/videojs.ima.min.js | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dist/videojs.ima.es.js b/dist/videojs.ima.es.js index b0f2d957..d26dbf1a 100644 --- a/dist/videojs.ima.es.js +++ b/dist/videojs.ima.es.js @@ -1102,7 +1102,7 @@ AdUi.prototype.setShowCountdown = function (showCountdownIn) { }; var name = "videojs-ima"; -var version = "1.6.0"; +var version = "1.6.1"; var license = "Apache-2.0"; var main = "./dist/videojs.ima.js"; var module$1 = "./dist/videojs.ima.es.js"; diff --git a/dist/videojs.ima.js b/dist/videojs.ima.js index 1cacb308..6f5ba5c7 100644 --- a/dist/videojs.ima.js +++ b/dist/videojs.ima.js @@ -1108,7 +1108,7 @@ AdUi.prototype.setShowCountdown = function (showCountdownIn) { }; var name = "videojs-ima"; -var version = "1.6.0"; +var version = "1.6.1"; var license = "Apache-2.0"; var main = "./dist/videojs.ima.js"; var module$1 = "./dist/videojs.ima.es.js"; diff --git a/dist/videojs.ima.min.js b/dist/videojs.ima.min.js index a3d8c93d..2271c16e 100644 --- a/dist/videojs.ima.min.js +++ b/dist/videojs.ima.min.js @@ -1 +1,5 @@ +<<<<<<< HEAD !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("video.js")):"function"==typeof define&&define.amd?define(["video.js"],e):t.videojsIma=e(t.videojs)}(this,function(t){"use strict";t=t&&t.hasOwnProperty("default")?t.default:t;var e=function(t,e,i){this.vjsPlayer=t,this.controller=i,this.contentTrackingTimer=null,this.contentComplete=!1,this.updateTimeIntervalHandle=null,this.updateTimeInterval=1e3,this.seekCheckIntervalHandle=null,this.seekCheckInterval=1e3,this.resizeCheckIntervalHandle=null,this.resizeCheckInterval=250,this.seekThreshold=100,this.contentEndedListeners=[],this.contentSource="",this.contentSourceType="",this.contentPlayheadTracker={currentTime:0,previousTime:0,seeking:!1,duration:0},this.vjsPlayerDimensions={width:this.getPlayerWidth(),height:this.getPlayerHeight()},this.vjsControls=this.vjsPlayer.getChild("controlBar"),this.h5Player=null,this.vjsPlayer.one("play",this.setUpPlayerIntervals.bind(this)),this.boundContentEndedListener=this.localContentEndedListener.bind(this),this.vjsPlayer.on("contentended",this.boundContentEndedListener),this.vjsPlayer.on("dispose",this.playerDisposedListener.bind(this)),this.vjsPlayer.on("readyforpreroll",this.onReadyForPreroll.bind(this)),this.vjsPlayer.ready(this.onPlayerReady.bind(this)),this.vjsPlayer.ads(e)};e.prototype.setUpPlayerIntervals=function(){this.updateTimeIntervalHandle=setInterval(this.updateCurrentTime.bind(this),this.updateTimeInterval),this.seekCheckIntervalHandle=setInterval(this.checkForSeeking.bind(this),this.seekCheckInterval),this.resizeCheckIntervalHandle=setInterval(this.checkForResize.bind(this),this.resizeCheckInterval)},e.prototype.updateCurrentTime=function(){this.contentPlayheadTracker.seeking||(this.contentPlayheadTracker.currentTime=this.vjsPlayer.currentTime())},e.prototype.checkForSeeking=function(){var t=1e3*(this.vjsPlayer.currentTime()-this.contentPlayheadTracker.previousTime);Math.abs(t)>this.seekCheckInterval+this.seekThreshold?this.contentPlayheadTracker.seeking=!0:this.contentPlayheadTracker.seeking=!1,this.contentPlayheadTracker.previousTime=this.vjsPlayer.currentTime()},e.prototype.checkForResize=function(){var t=this.getPlayerWidth(),e=this.getPlayerHeight();t==this.vjsPlayerDimensions.width&&e==this.vjsPlayerDimensions.height||(this.vjsPlayerDimensions.width=t,this.vjsPlayerDimensions.height=e,this.controller.onPlayerResize(t,e))},e.prototype.localContentEndedListener=function(){for(var t in this.contentComplete||(this.contentComplete=!0,this.controller.onContentComplete()),this.contentEndedListeners)"function"==typeof this.contentEndedListeners[t]&&this.contentEndedListeners[t]();clearInterval(this.updateTimeIntervalHandle),clearInterval(this.seekCheckIntervalHandle),clearInterval(this.resizeCheckIntervalHandle),this.vjsPlayer.el()&&this.vjsPlayer.one("play",this.setUpPlayerIntervals.bind(this))},e.prototype.onNoPostroll=function(){this.vjsPlayer.trigger("nopostroll")},e.prototype.playerDisposedListener=function(){this.contentEndedListeners=[],this.controller.onPlayerDisposed(),this.contentComplete=!0,this.vjsPlayer.off("contentended",this.boundContentEndedListener),this.vjsPlayer.ads.adTimeoutTimeout&&clearTimeout(this.vjsPlayer.ads.adTimeoutTimeout);var t=[this.updateTimeIntervalHandle,this.seekCheckIntervalHandle,this.resizeCheckIntervalHandle];for(var e in t)t[e]&&clearInterval(t[e])},e.prototype.onReadyForPreroll=function(){this.controller.onPlayerReadyForPreroll()},e.prototype.onPlayerReady=function(){this.h5Player=document.getElementById(this.getPlayerId()).getElementsByClassName("vjs-tech")[0],this.h5Player.hasAttribute("autoplay")&&this.controller.setSetting("adWillAutoPlay",!0),this.onVolumeChange(),this.vjsPlayer.on("fullscreenchange",this.onFullscreenChange.bind(this)),this.vjsPlayer.on("volumechange",this.onVolumeChange.bind(this)),this.controller.onPlayerReady()},e.prototype.onFullscreenChange=function(){this.vjsPlayer.isFullscreen()?this.controller.onPlayerEnterFullscreen():this.controller.onPlayerExitFullscreen()},e.prototype.onVolumeChange=function(){var t=this.vjsPlayer.muted()?0:this.vjsPlayer.volume();this.controller.onPlayerVolumeChanged(t)},e.prototype.injectAdContainerDiv=function(t){this.vjsControls.el().parentNode.appendChild(t)},e.prototype.getContentPlayer=function(){return this.h5Player},e.prototype.getVolume=function(){return this.vjsPlayer.muted()?0:this.vjsPlayer.volume()},e.prototype.setVolume=function(t){this.vjsPlayer.volume(t),0==t?this.vjsPlayer.muted(!0):this.vjsPlayer.muted(!1)},e.prototype.unmute=function(){this.vjsPlayer.muted(!1)},e.prototype.mute=function(){this.vjsPlayer.muted(!0)},e.prototype.play=function(){this.vjsPlayer.play()},e.prototype.getPlayerWidth=function(){var t=(getComputedStyle(this.vjsPlayer.el())||{}).width;return t&&0!==parseInt(t,10)||(t=(this.vjsPlayer.el().getBoundingClientRect()||{}).width),parseInt(t,10)||this.vjsPlayer.width()},e.prototype.getPlayerHeight=function(){var t=(getComputedStyle(this.vjsPlayer.el())||{}).height;return t&&0!==parseInt(t,10)||(t=(this.vjsPlayer.el().getBoundingClientRect()||{}).height),parseInt(t,10)||this.vjsPlayer.height()},e.prototype.getPlayerOptions=function(){return this.vjsPlayer.options_},e.prototype.getPlayerId=function(){return this.vjsPlayer.id()},e.prototype.toggleFullscreen=function(){this.vjsPlayer.isFullscreen()?this.vjsPlayer.exitFullscreen():this.vjsPlayer.requestFullscreen()},e.prototype.getContentPlayheadTracker=function(){return this.contentPlayheadTracker},e.prototype.onAdError=function(t){this.vjsControls.show();var e=void 0!==t.getError?t.getError():t.stack;this.vjsPlayer.trigger({type:"adserror",data:{AdError:e,AdErrorEvent:t}})},e.prototype.onAdLog=function(t){var e=t.getAdData(),i=void 0!==e.adError?e.adError.getMessage():void 0;this.vjsPlayer.trigger({type:"adslog",data:{AdError:i,AdEvent:t}})},e.prototype.onAdBreakStart=function(){this.contentSource=this.vjsPlayer.currentSrc(),this.contentSourceType=this.vjsPlayer.currentType(),this.vjsPlayer.off("contentended",this.boundContentEndedListener),this.vjsPlayer.ads.startLinearAdMode(),this.vjsControls.hide(),this.vjsPlayer.pause()},e.prototype.onAdBreakEnd=function(){this.vjsPlayer.on("contentended",this.boundContentEndedListener),this.vjsPlayer.ads.inAdBreak()&&this.vjsPlayer.ads.endLinearAdMode(),this.vjsControls.show()},e.prototype.onAdStart=function(){this.vjsPlayer.trigger("ads-ad-started")},e.prototype.onAllAdsCompleted=function(){1==this.contentComplete&&(this.vjsPlayer.currentSrc()!=this.contentSource&&this.vjsPlayer.src({src:this.contentSource,type:this.contentSourceType}),this.controller.onContentAndAdsCompleted())},e.prototype.onAdsReady=function(){this.vjsPlayer.trigger("adsready")},e.prototype.changeSource=function(t){this.vjsPlayer.currentSrc()&&(this.vjsPlayer.currentTime(0),this.vjsPlayer.pause()),t&&this.vjsPlayer.src(t),this.vjsPlayer.one("loadedmetadata",this.seekContentToZero.bind(this))},e.prototype.seekContentToZero=function(){this.vjsPlayer.currentTime(0)},e.prototype.triggerPlayerEvent=function(t,e){this.vjsPlayer.trigger(t,e)},e.prototype.addContentEndedListener=function(t){this.contentEndedListeners.push(t)},e.prototype.reset=function(){this.vjsPlayer.on("contentended",this.boundContentEndedListener),this.vjsControls.show(),this.vjsPlayer.ads.inAdBreak()&&this.vjsPlayer.ads.endLinearAdMode(),this.contentPlayheadTracker.currentTime=0,this.contentComplete=!1};var i=function(t){this.controller=t,this.adContainerDiv=document.createElement("div"),this.controlsDiv=document.createElement("div"),this.countdownDiv=document.createElement("div"),this.seekBarDiv=document.createElement("div"),this.progressDiv=document.createElement("div"),this.playPauseDiv=document.createElement("div"),this.muteDiv=document.createElement("div"),this.sliderDiv=document.createElement("div"),this.sliderLevelDiv=document.createElement("div"),this.fullscreenDiv=document.createElement("div"),this.boundOnMouseUp=this.onMouseUp.bind(this),this.boundOnMouseMove=this.onMouseMove.bind(this),this.adPlayheadTracker={currentTime:0,duration:0,isPod:!1,adPosition:0,totalAds:0},this.controlPrefix=this.controller.getPlayerId()+"_",this.showCountdown=!0,!1===this.controller.getSettings().showCountdown&&(this.showCountdown=!1),this.createAdContainer()};i.prototype.createAdContainer=function(){this.assignControlAttributes(this.adContainerDiv,"ima-ad-container"),this.adContainerDiv.style.position="absolute",this.adContainerDiv.style.zIndex=1111,this.adContainerDiv.addEventListener("mouseenter",this.showAdControls.bind(this),!1),this.adContainerDiv.addEventListener("mouseleave",this.hideAdControls.bind(this),!1),this.createControls(),this.controller.injectAdContainerDiv(this.adContainerDiv)},i.prototype.createControls=function(){this.assignControlAttributes(this.controlsDiv,"ima-controls-div"),this.controlsDiv.style.width="100%",this.assignControlAttributes(this.countdownDiv,"ima-countdown-div"),this.countdownDiv.innerHTML=this.controller.getSettings().adLabel,this.countdownDiv.style.display=this.showCountdown?"block":"none",this.assignControlAttributes(this.seekBarDiv,"ima-seek-bar-div"),this.seekBarDiv.style.width="100%",this.assignControlAttributes(this.progressDiv,"ima-progress-div"),this.assignControlAttributes(this.playPauseDiv,"ima-play-pause-div"),this.addClass(this.playPauseDiv,"ima-playing"),this.playPauseDiv.addEventListener("click",this.onAdPlayPauseClick.bind(this),!1),this.assignControlAttributes(this.muteDiv,"ima-mute-div"),this.addClass(this.muteDiv,"ima-non-muted"),this.muteDiv.addEventListener("click",this.onAdMuteClick.bind(this),!1),this.assignControlAttributes(this.sliderDiv,"ima-slider-div"),this.sliderDiv.addEventListener("mousedown",this.onAdVolumeSliderMouseDown.bind(this),!1),this.controller.getIsIos()&&(this.sliderDiv.style.display="none"),this.assignControlAttributes(this.sliderLevelDiv,"ima-slider-level-div"),this.assignControlAttributes(this.fullscreenDiv,"ima-fullscreen-div"),this.addClass(this.fullscreenDiv,"ima-non-fullscreen"),this.fullscreenDiv.addEventListener("click",this.onAdFullscreenClick.bind(this),!1),this.adContainerDiv.appendChild(this.controlsDiv),this.controlsDiv.appendChild(this.countdownDiv),this.controlsDiv.appendChild(this.seekBarDiv),this.controlsDiv.appendChild(this.playPauseDiv),this.controlsDiv.appendChild(this.muteDiv),this.controlsDiv.appendChild(this.sliderDiv),this.controlsDiv.appendChild(this.fullscreenDiv),this.seekBarDiv.appendChild(this.progressDiv),this.sliderDiv.appendChild(this.sliderLevelDiv)},i.prototype.onAdPlayPauseClick=function(){this.controller.onAdPlayPauseClick()},i.prototype.onAdMuteClick=function(){this.controller.onAdMuteClick()},i.prototype.onAdFullscreenClick=function(){this.controller.toggleFullscreen()},i.prototype.onAdsPaused=function(){this.addClass(this.playPauseDiv,"ima-paused"),this.removeClass(this.playPauseDiv,"ima-playing"),this.showAdControls()},i.prototype.onAdsResumed=function(){this.onAdsPlaying(),this.showAdControls()},i.prototype.onAdsPlaying=function(){this.addClass(this.playPauseDiv,"ima-playing"),this.removeClass(this.playPauseDiv,"ima-paused")},i.prototype.updateAdUi=function(t,e,i,n,s){var o=Math.floor(e/60),r=Math.floor(e%60);r.toString().length<2&&(r="0"+r);var a=": ";s>1&&(a=" ("+n+" "+this.controller.getSettings().adLabelNofN+" "+s+"): "),this.countdownDiv.innerHTML=this.controller.getSettings().adLabel+a+o+":"+r;var d=100*(t/i);this.progressDiv.style.width=d+"%"},i.prototype.unmute=function(){this.addClass(this.muteDiv,"ima-non-muted"),this.removeClass(this.muteDiv,"ima-muted"),this.sliderLevelDiv.style.width=100*this.controller.getPlayerVolume()+"%"},i.prototype.mute=function(){this.addClass(this.muteDiv,"ima-muted"),this.removeClass(this.muteDiv,"ima-non-muted"),this.sliderLevelDiv.style.width="0%"},i.prototype.onAdVolumeSliderMouseDown=function(){document.addEventListener("mouseup",this.boundOnMouseUp,!1),document.addEventListener("mousemove",this.boundOnMouseMove,!1)},i.prototype.onMouseMove=function(t){this.changeVolume(t)},i.prototype.onMouseUp=function(t){this.changeVolume(t),document.removeEventListener("mouseup",this.boundOnMouseUp),document.removeEventListener("mousemove",this.boundOnMouseMove)},i.prototype.changeVolume=function(t){var e=(t.clientX-this.sliderDiv.getBoundingClientRect().left)/this.sliderDiv.offsetWidth;e*=100,e=Math.min(Math.max(e,0),100),this.sliderLevelDiv.style.width=e+"%",0==this.percent?(this.addClass(this.muteDiv,"ima-muted"),this.removeClass(this.muteDiv,"ima-non-muted")):(this.addClass(this.muteDiv,"ima-non-muted"),this.removeClass(this.muteDiv,"ima-muted")),this.controller.setVolume(e/100)},i.prototype.showAdContainer=function(){this.adContainerDiv.style.display="block"},i.prototype.hideAdContainer=function(){this.adContainerDiv.style.display="none"},i.prototype.reset=function(){this.hideAdContainer()},i.prototype.onAdError=function(){this.hideAdContainer()},i.prototype.onAdBreakStart=function(t){this.showAdContainer(),"application/javascript"!==t.getAd().getContentType()||this.controller.getSettings().showControlsForJSAds?this.controlsDiv.style.display="block":this.controlsDiv.style.display="none",this.onAdsPlaying(),this.hideAdControls()},i.prototype.onAdBreakEnd=function(){var t=this.controller.getCurrentAd();(null==t||t.isLinear())&&this.hideAdContainer(),this.controlsDiv.style.display="none",this.countdownDiv.innerHTML=""},i.prototype.onAllAdsCompleted=function(){this.hideAdContainer()},i.prototype.onLinearAdStart=function(){this.removeClass(this.adContainerDiv,"bumpable-ima-ad-container")},i.prototype.onNonLinearAdLoad=function(){this.adContainerDiv.style.display="block",this.addClass(this.adContainerDiv,"bumpable-ima-ad-container")},i.prototype.onPlayerEnterFullscreen=function(){this.addClass(this.fullscreenDiv,"ima-fullscreen"),this.removeClass(this.fullscreenDiv,"ima-non-fullscreen")},i.prototype.onPlayerExitFullscreen=function(){this.addClass(this.fullscreenDiv,"ima-non-fullscreen"),this.removeClass(this.fullscreenDiv,"ima-fullscreen")},i.prototype.onPlayerVolumeChanged=function(t){0==t?(this.addClass(this.muteDiv,"ima-muted"),this.removeClass(this.muteDiv,"ima-non-muted"),this.sliderLevelDiv.style.width="0%"):(this.addClass(this.muteDiv,"ima-non-muted"),this.removeClass(this.muteDiv,"ima-muted"),this.sliderLevelDiv.style.width=100*t+"%")},i.prototype.showAdControls=function(){this.addClass(this.controlsDiv,"ima-controls-div-showing"),this.playPauseDiv.style.display="block",this.muteDiv.style.display="block",this.fullscreenDiv.style.display="block",this.controller.getIsIos()||(this.sliderDiv.style.display="block")},i.prototype.hideAdControls=function(){this.removeClass(this.controlsDiv,"ima-controls-div-showing"),this.playPauseDiv.style.display="none",this.muteDiv.style.display="none",this.sliderDiv.style.display="none",this.fullscreenDiv.style.display="none"},i.prototype.assignControlAttributes=function(t,e){t.id=this.controlPrefix+e,t.className=this.controlPrefix+e+" "+e},i.prototype.getClassRegexp=function(t){return new RegExp("(^|[^A-Za-z-])"+t+"((?![A-Za-z-])|$)","gi")},i.prototype.elementHasClass=function(t,e){return this.getClassRegexp(e).test(t.className)},i.prototype.addClass=function(t,e){t.className=t.className.trim()+" "+e},i.prototype.removeClass=function(t,e){var i=this.getClassRegexp(e);t.className=t.className.trim().replace(i,"")},i.prototype.getAdContainerDiv=function(){return this.adContainerDiv},i.prototype.setShowCountdown=function(t){this.showCountdown=t,this.countdownDiv.style.display=this.showCountdown?"block":"none"};var n="1.6.0",s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=function(t){this.controller=t,this.adDisplayContainer=null,this.adDisplayContainerInitialized=!1,this.adsLoader=null,this.adsManager=null,this.adsRenderingSettings=null,this.adsResponse=null,this.currentAd=null,this.adTrackingTimer=null,this.allAdsCompleted=!1,this.adsActive=!1,this.adPlaying=!1,this.adMuted=!1,this.adBreakReadyListener=void 0,this.contentCompleteCalled=!1,this.adsManagerDimensions={width:0,height:0},this.autoPlayAdBreaks=!0,!1===this.controller.getSettings().autoPlayAdBreaks&&(this.autoPlayAdBreaks=!1),this.controller.getSettings().locale&&google.ima.settings.setLocale(this.controller.getSettings().locale),this.controller.getSettings().disableFlashAds&&google.ima.settings.setDisableFlashAds(this.controller.getSettings().disableFlashAds),this.controller.getSettings().disableCustomPlaybackForIOS10Plus&&google.ima.settings.setDisableCustomPlaybackForIOS10Plus(this.controller.getSettings().disableCustomPlaybackForIOS10Plus)};o.prototype.initAdObjects=function(){this.adDisplayContainer=new google.ima.AdDisplayContainer(this.controller.getAdContainerDiv(),this.controller.getContentPlayer()),this.adsLoader=new google.ima.AdsLoader(this.adDisplayContainer),this.adsLoader.getSettings().setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.ENABLED),0==this.controller.getSettings().vpaidAllowed&&this.adsLoader.getSettings().setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.DISABLED),this.controller.getSettings().vpaidMode&&this.adsLoader.getSettings().setVpaidMode(this.controller.getSettings().vpaidMode),this.controller.getSettings().locale&&this.adsLoader.getSettings().setLocale(this.controller.getSettings().locale),this.controller.getSettings().numRedirects&&this.adsLoader.getSettings().setNumRedirects(this.controller.getSettings().numRedirects),this.adsLoader.getSettings().setPlayerType("videojs-ima"),this.adsLoader.getSettings().setPlayerVersion(n),this.adsLoader.getSettings().setAutoPlayAdBreaks(this.autoPlayAdBreaks),this.adsLoader.addEventListener(google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.onAdsManagerLoaded.bind(this),!1),this.adsLoader.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,this.onAdsLoaderError.bind(this),!1)},o.prototype.requestAds=function(){var t=new google.ima.AdsRequest;this.controller.getSettings().adTagUrl?t.adTagUrl=this.controller.getSettings().adTagUrl:t.adsResponse=this.controller.getSettings().adsResponse,this.controller.getSettings().forceNonLinearFullSlot&&(t.forceNonLinearFullSlot=!0),this.controller.getSettings().vastLoadTimeout&&(t.vastLoadTimeout=this.controller.getSettings().vastLoadTimeout),t.linearAdSlotWidth=this.controller.getPlayerWidth(),t.linearAdSlotHeight=this.controller.getPlayerHeight(),t.nonLinearAdSlotWidth=this.controller.getSettings().nonLinearWidth||this.controller.getPlayerWidth(),t.nonLinearAdSlotHeight=this.controller.getSettings().nonLinearHeight||this.controller.getPlayerHeight(),t.setAdWillAutoPlay(this.controller.adsWillAutoplay()),t.setAdWillPlayMuted(this.controller.adsWillPlayMuted());var e=this.controller.getSettings().adsRequest;e&&"object"===(void 0===e?"undefined":s(e))&&Object.keys(e).forEach(function(i){t[i]=e[i]}),this.adsLoader.requestAds(t),this.controller.triggerPlayerEvent("ads-request",t)},o.prototype.onAdsManagerLoaded=function(t){this.createAdsRenderingSettings(),this.adsManager=t.getAdsManager(this.controller.getContentPlayheadTracker(),this.adsRenderingSettings),this.adsManager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,this.onAdError.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.AD_BREAK_READY,this.onAdBreakReady.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,this.onContentPauseRequested.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,this.onContentResumeRequested.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.ALL_ADS_COMPLETED,this.onAllAdsCompleted.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.LOADED,this.onAdLoaded.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.STARTED,this.onAdStarted.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.CLICK,this.onAdPaused.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.COMPLETE,this.onAdComplete.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.SKIPPED,this.onAdComplete.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.LOG,this.onAdLog.bind(this)),this.controller.getIsMobile()&&(this.adsManager.addEventListener(google.ima.AdEvent.Type.PAUSED,this.onAdPaused.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.RESUMED,this.onAdResumed.bind(this))),this.autoPlayAdBreaks||this.initAdsManager(),this.controller.onAdsReady(),this.controller.getSettings().adsManagerLoadedCallback&&this.controller.getSettings().adsManagerLoadedCallback()},o.prototype.onAdsLoaderError=function(t){window.console.warn("AdsLoader error: "+t.getError()),this.controller.onErrorLoadingAds(t),this.adsManager&&this.adsManager.destroy()},o.prototype.initAdsManager=function(){try{var t=this.controller.getPlayerWidth(),e=this.controller.getPlayerHeight();this.adsManagerDimensions.width=t,this.adsManagerDimensions.height=e,this.adsManager.init(t,e,google.ima.ViewMode.NORMAL),this.adsManager.setVolume(this.controller.getPlayerVolume()),this.initializeAdDisplayContainer()}catch(t){this.onAdError(t)}},o.prototype.createAdsRenderingSettings=function(){if(this.adsRenderingSettings=new google.ima.AdsRenderingSettings,this.adsRenderingSettings.restoreCustomPlaybackStateOnAdBreakComplete=!0,this.controller.getSettings().adsRenderingSettings)for(var t in this.controller.getSettings().adsRenderingSettings)""!==t&&(this.adsRenderingSettings[t]=this.controller.getSettings().adsRenderingSettings[t])},o.prototype.onAdError=function(t){var e=void 0!==t.getError?t.getError():t.stack;window.console.warn("Ad error: "+e),this.adsManager.destroy(),this.controller.onAdError(t),this.adsActive=!1,this.adPlaying=!1},o.prototype.onAdBreakReady=function(t){this.adBreakReadyListener(t)},o.prototype.onContentPauseRequested=function(t){this.adsActive=!0,this.adPlaying=!0,this.controller.onAdBreakStart(t)},o.prototype.onContentResumeRequested=function(t){this.adsActive=!1,this.adPlaying=!1,this.controller.onAdBreakEnd()},o.prototype.onAllAdsCompleted=function(t){this.allAdsCompleted=!0,this.controller.onAllAdsCompleted()},o.prototype.onAdLoaded=function(t){t.getAd().isLinear()||(this.controller.onNonLinearAdLoad(),this.controller.playContent())},o.prototype.onAdStarted=function(t){this.currentAd=t.getAd(),this.currentAd.isLinear()?(this.adTrackingTimer=setInterval(this.onAdPlayheadTrackerInterval.bind(this),250),this.controller.onLinearAdStart()):this.controller.onNonLinearAdStart()},o.prototype.onAdPaused=function(){this.controller.onAdsPaused()},o.prototype.onAdResumed=function(t){this.controller.onAdsResumed()},o.prototype.onAdComplete=function(){this.currentAd.isLinear()&&clearInterval(this.adTrackingTimer)},o.prototype.onAdLog=function(t){this.controller.onAdLog(t)},o.prototype.onAdPlayheadTrackerInterval=function(){var t=this.adsManager.getRemainingTime(),e=this.currentAd.getDuration(),i=e-t;i=i>0?i:0;var n=0,s=void 0;this.currentAd.getAdPodInfo()&&(s=this.currentAd.getAdPodInfo().getAdPosition(),n=this.currentAd.getAdPodInfo().getTotalAds()),this.controller.onAdPlayheadUpdated(i,t,e,s,n)},o.prototype.onContentComplete=function(){this.adsLoader&&(this.adsLoader.contentComplete(),this.contentCompleteCalled=!0),this.adsManager&&this.adsManager.getCuePoints()&&!this.adsManager.getCuePoints().includes(-1)&&this.controller.onNoPostroll(),this.allAdsCompleted&&this.controller.onContentAndAdsCompleted()},o.prototype.onPlayerDisposed=function(){this.adTrackingTimer&&clearInterval(this.adTrackingTimer),this.adsManager&&(this.adsManager.destroy(),this.adsManager=null)},o.prototype.onPlayerReadyForPreroll=function(){if(this.autoPlayAdBreaks){this.initAdsManager();try{this.controller.showAdContainer(),this.adsManager.setVolume(this.controller.getPlayerVolume()),this.adsManager.start()}catch(t){this.onAdError(t)}}},o.prototype.onPlayerReady=function(){this.initAdObjects(),(this.controller.getSettings().adTagUrl||this.controller.getSettings().adsResponse)&&this.requestAds()},o.prototype.onPlayerEnterFullscreen=function(){this.adsManager&&this.adsManager.resize(window.screen.width,window.screen.height,google.ima.ViewMode.FULLSCREEN)},o.prototype.onPlayerExitFullscreen=function(){this.adsManager&&this.adsManager.resize(this.controller.getPlayerWidth(),this.controller.getPlayerHeight(),google.ima.ViewMode.NORMAL)},o.prototype.onPlayerVolumeChanged=function(t){this.adsManager&&this.adsManager.setVolume(t),this.adMuted=0==t},o.prototype.onPlayerResize=function(t,e){this.adsManager&&(this.adsManagerDimensions.width=t,this.adsManagerDimensions.height=e,this.adsManager.resize(t,e,google.ima.ViewMode.NORMAL))},o.prototype.getCurrentAd=function(){return this.currentAd},o.prototype.setAdBreakReadyListener=function(t){this.adBreakReadyListener=t},o.prototype.isAdPlaying=function(){return this.adPlaying},o.prototype.isAdMuted=function(){return this.adMuted},o.prototype.pauseAds=function(){this.adsManager.pause(),this.adPlaying=!1},o.prototype.resumeAds=function(){this.adsManager.resume(),this.adPlaying=!0},o.prototype.unmute=function(){this.adsManager.setVolume(1),this.adMuted=!1},o.prototype.mute=function(){this.adsManager.setVolume(0),this.adMuted=!0},o.prototype.setVolume=function(t){this.adsManager.setVolume(t),this.adMuted=0==t},o.prototype.initializeAdDisplayContainer=function(){this.adDisplayContainer&&(this.adDisplayContainerInitialized||(this.adDisplayContainer.initialize(),this.adDisplayContainerInitialized=!0))},o.prototype.playAdBreak=function(){this.autoPlayAdBreaks||(this.controller.showAdContainer(),this.adsManager.setVolume(this.controller.getPlayerVolume()),this.adsManager.start())},o.prototype.addEventListener=function(t,e){this.adsManager&&this.adsManager.addEventListener(t,e)},o.prototype.getAdsManager=function(){return this.adsManager},o.prototype.reset=function(){this.adsActive=!1,this.adPlaying=!1,this.adTrackingTimer&&clearInterval(this.adTrackingTimer),this.adsManager&&(this.adsManager.destroy(),this.adsManager=null),this.adsLoader&&!this.contentCompleteCalled&&this.adsLoader.contentComplete(),this.contentCompleteCalled=!1,this.allAdsCompleted=!1};var r=function(t,n){this.settings={},this.contentAndAdsEndedListeners=[],this.isMobile=navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPad/i)||navigator.userAgent.match(/Android/i),this.isIos=navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPad/i),this.initWithSettings(n);var s={debug:this.settings.debug,timeout:this.settings.timeout,prerollTimeout:this.settings.prerollTimeout},r=this.extend({},s,n.contribAdsSettings||{});this.playerWrapper=new e(t,r,this),this.adUi=new i(this),this.sdkImpl=new o(this)};r.IMA_DEFAULTS={debug:!1,timeout:5e3,prerollTimeout:1e3,adLabel:"Advertisement",adLabelNofN:"of",showControlsForJSAds:!0},r.prototype.initWithSettings=function(t){this.settings=this.extend({},r.IMA_DEFAULTS,t||{}),this.warnAboutDeprecatedSettings(),this.showCountdown=!0,!1===this.settings.showCountdown&&(this.showCountdown=!1)},r.prototype.warnAboutDeprecatedSettings=function(){var t=this;["adWillAutoplay","adsWillAutoplay","adWillPlayMuted","adsWillPlayMuted"].forEach(function(e){void 0!==t.settings[e]&&console.warn("WARNING: videojs.ima setting "+e+" is deprecated")})},r.prototype.getSettings=function(){return this.settings},r.prototype.getIsMobile=function(){return this.isMobile},r.prototype.getIsIos=function(){return this.isIos},r.prototype.injectAdContainerDiv=function(t){this.playerWrapper.injectAdContainerDiv(t)},r.prototype.getAdContainerDiv=function(){return this.adUi.getAdContainerDiv()},r.prototype.getContentPlayer=function(){return this.playerWrapper.getContentPlayer()},r.prototype.getContentPlayheadTracker=function(){return this.playerWrapper.getContentPlayheadTracker()},r.prototype.requestAds=function(){this.sdkImpl.requestAds()},r.prototype.setSetting=function(t,e){this.settings[t]=e},r.prototype.onErrorLoadingAds=function(t){this.adUi.onAdError(),this.playerWrapper.onAdError(t)},r.prototype.onAdPlayPauseClick=function(){this.sdkImpl.isAdPlaying()?(this.adUi.onAdsPaused(),this.sdkImpl.pauseAds()):(this.adUi.onAdsPlaying(),this.sdkImpl.resumeAds())},r.prototype.onAdMuteClick=function(){this.sdkImpl.isAdMuted()?(this.playerWrapper.unmute(),this.adUi.unmute(),this.sdkImpl.unmute()):(this.playerWrapper.mute(),this.adUi.mute(),this.sdkImpl.mute())},r.prototype.setVolume=function(t){this.playerWrapper.setVolume(t),this.sdkImpl.setVolume(t)},r.prototype.getPlayerVolume=function(){return this.playerWrapper.getVolume()},r.prototype.toggleFullscreen=function(){this.playerWrapper.toggleFullscreen()},r.prototype.onAdError=function(t){this.adUi.onAdError(),this.playerWrapper.onAdError(t)},r.prototype.onAdBreakStart=function(t){this.playerWrapper.onAdBreakStart(),this.adUi.onAdBreakStart(t)},r.prototype.showAdContainer=function(){this.adUi.showAdContainer()},r.prototype.onAdBreakEnd=function(){this.playerWrapper.onAdBreakEnd(),this.adUi.onAdBreakEnd()},r.prototype.onAllAdsCompleted=function(){this.adUi.onAllAdsCompleted(),this.playerWrapper.onAllAdsCompleted()},r.prototype.onAdsPaused=function(){this.adUi.onAdsPaused()},r.prototype.onAdsResumed=function(){this.adUi.onAdsResumed()},r.prototype.onAdPlayheadUpdated=function(t,e,i,n,s){this.adUi.updateAdUi(t,e,i,n,s)},r.prototype.onAdLog=function(t){this.playerWrapper.onAdLog(t)},r.prototype.getCurrentAd=function(){return this.sdkImpl.getCurrentAd()},r.prototype.playContent=function(){this.playerWrapper.play()},r.prototype.onLinearAdStart=function(){this.adUi.onLinearAdStart(),this.playerWrapper.onAdStart()},r.prototype.onNonLinearAdLoad=function(){this.adUi.onNonLinearAdLoad()},r.prototype.onNonLinearAdStart=function(){this.adUi.onNonLinearAdLoad(),this.playerWrapper.onAdStart()},r.prototype.getPlayerWidth=function(){return this.playerWrapper.getPlayerWidth()},r.prototype.getPlayerHeight=function(){return this.playerWrapper.getPlayerHeight()},r.prototype.onAdsReady=function(){this.playerWrapper.onAdsReady()},r.prototype.onPlayerResize=function(t,e){this.sdkImpl.onPlayerResize(t,e)},r.prototype.onContentComplete=function(){this.sdkImpl.onContentComplete()},r.prototype.onNoPostroll=function(){this.playerWrapper.onNoPostroll()},r.prototype.onContentAndAdsCompleted=function(){for(var t in this.contentAndAdsEndedListeners)"function"==typeof this.contentAndAdsEndedListeners[t]&&this.contentAndAdsEndedListeners[t]()},r.prototype.onPlayerDisposed=function(){this.contentAndAdsEndedListeners=[],this.sdkImpl.onPlayerDisposed()},r.prototype.onPlayerReadyForPreroll=function(){this.sdkImpl.onPlayerReadyForPreroll()},r.prototype.onPlayerReady=function(){this.sdkImpl.onPlayerReady()},r.prototype.onPlayerEnterFullscreen=function(){this.adUi.onPlayerEnterFullscreen(),this.sdkImpl.onPlayerEnterFullscreen()},r.prototype.onPlayerExitFullscreen=function(){this.adUi.onPlayerExitFullscreen(),this.sdkImpl.onPlayerExitFullscreen()},r.prototype.onPlayerVolumeChanged=function(t){this.adUi.onPlayerVolumeChanged(t),this.sdkImpl.onPlayerVolumeChanged(t)},r.prototype.setContentWithAdTag=function(t,e){this.reset(),this.settings.adTagUrl=e||this.settings.adTagUrl,this.playerWrapper.changeSource(t)},r.prototype.setContentWithAdsResponse=function(t,e){this.reset(),this.settings.adsResponse=e||this.settings.adsResponse,this.playerWrapper.changeSource(t)},r.prototype.setContentWithAdsRequest=function(t,e){this.reset(),this.settings.adsRequest=e||this.settings.adsRequest,this.playerWrapper.changeSource(t)},r.prototype.reset=function(){this.sdkImpl.reset(),this.playerWrapper.reset(),this.adUi.reset()},r.prototype.addContentEndedListener=function(t){this.playerWrapper.addContentEndedListener(t)},r.prototype.addContentAndAdsEndedListener=function(t){this.contentAndAdsEndedListeners.push(t)},r.prototype.setAdBreakReadyListener=function(t){this.sdkImpl.setAdBreakReadyListener(t)},r.prototype.setShowCountdown=function(t){this.adUi.setShowCountdown(t),this.showCountdown=t,this.countdownDiv.style.display=this.showCountdown?"block":"none"},r.prototype.initializeAdDisplayContainer=function(){this.sdkImpl.initializeAdDisplayContainer()},r.prototype.playAdBreak=function(){this.sdkImpl.playAdBreak()},r.prototype.addEventListener=function(t,e){this.sdkImpl.addEventListener(t,e)},r.prototype.getAdsManager=function(){return this.sdkImpl.getAdsManager()},r.prototype.getPlayerId=function(){return this.playerWrapper.getPlayerId()},r.prototype.changeAdTag=function(t){this.reset(),this.settings.adTagUrl=t},r.prototype.pauseAd=function(){this.adUi.onAdsPaused(),this.sdkImpl.pauseAds()},r.prototype.resumeAd=function(){this.adUi.onAdsPlaying(),this.sdkImpl.resumeAds()},r.prototype.adsWillAutoplay=function(){return void 0!==this.settings.adsWillAutoplay?this.settings.adsWillAutoplay:void 0!==this.settings.adWillAutoplay?this.settings.adWillAutoplay:!!this.playerWrapper.getPlayerOptions().autoplay},r.prototype.adsWillPlayMuted=function(){return void 0!==this.settings.adsWillPlayMuted?this.settings.adsWillPlayMuted:void 0!==this.settings.adWillPlayMuted?this.settings.adWillPlayMuted:void 0!==this.playerWrapper.getPlayerOptions().muted?this.playerWrapper.getPlayerOptions().muted:0==this.playerWrapper.getVolume()},r.prototype.triggerPlayerEvent=function(t,e){this.playerWrapper.triggerPlayerEvent(t,e)},r.prototype.extend=function(t){for(var e=void 0,i=void 0,n=void 0,s=arguments.length,o=Array(s>1?s-1:0),r=1;rthis.seekCheckInterval+this.seekThreshold?this.contentPlayheadTracker.seeking=!0:this.contentPlayheadTracker.seeking=!1,this.contentPlayheadTracker.previousTime=this.vjsPlayer.currentTime()},e.prototype.checkForResize=function(){var t=this.getPlayerWidth(),e=this.getPlayerHeight();t==this.vjsPlayerDimensions.width&&e==this.vjsPlayerDimensions.height||(this.vjsPlayerDimensions.width=t,this.vjsPlayerDimensions.height=e,this.controller.onPlayerResize(t,e))},e.prototype.localContentEndedListener=function(){for(var t in this.contentComplete||(this.contentComplete=!0,this.controller.onContentComplete()),this.contentEndedListeners)"function"==typeof this.contentEndedListeners[t]&&this.contentEndedListeners[t]();clearInterval(this.updateTimeIntervalHandle),clearInterval(this.seekCheckIntervalHandle),clearInterval(this.resizeCheckIntervalHandle),this.vjsPlayer.el()&&this.vjsPlayer.one("play",this.setUpPlayerIntervals.bind(this))},e.prototype.onNoPostroll=function(){this.vjsPlayer.trigger("nopostroll")},e.prototype.playerDisposedListener=function(){this.contentEndedListeners=[],this.controller.onPlayerDisposed(),this.contentComplete=!0,this.vjsPlayer.off("contentended",this.boundContentEndedListener),this.vjsPlayer.ads.adTimeoutTimeout&&clearTimeout(this.vjsPlayer.ads.adTimeoutTimeout);var t=[this.updateTimeIntervalHandle,this.seekCheckIntervalHandle,this.resizeCheckIntervalHandle];for(var e in t)t[e]&&clearInterval(t[e])},e.prototype.onReadyForPreroll=function(){this.controller.onPlayerReadyForPreroll()},e.prototype.onPlayerReady=function(){this.h5Player=document.getElementById(this.getPlayerId()).getElementsByClassName("vjs-tech")[0],this.h5Player.hasAttribute("autoplay")&&this.controller.setSetting("adWillAutoPlay",!0),this.onVolumeChange(),this.vjsPlayer.on("fullscreenchange",this.onFullscreenChange.bind(this)),this.vjsPlayer.on("volumechange",this.onVolumeChange.bind(this)),this.controller.onPlayerReady()},e.prototype.onFullscreenChange=function(){this.vjsPlayer.isFullscreen()?this.controller.onPlayerEnterFullscreen():this.controller.onPlayerExitFullscreen()},e.prototype.onVolumeChange=function(){var t=this.vjsPlayer.muted()?0:this.vjsPlayer.volume();this.controller.onPlayerVolumeChanged(t)},e.prototype.injectAdContainerDiv=function(t){this.vjsControls.el().parentNode.appendChild(t)},e.prototype.getContentPlayer=function(){return this.h5Player},e.prototype.getVolume=function(){return this.vjsPlayer.muted()?0:this.vjsPlayer.volume()},e.prototype.setVolume=function(t){this.vjsPlayer.volume(t),0==t?this.vjsPlayer.muted(!0):this.vjsPlayer.muted(!1)},e.prototype.unmute=function(){this.vjsPlayer.muted(!1)},e.prototype.mute=function(){this.vjsPlayer.muted(!0)},e.prototype.play=function(){this.vjsPlayer.play()},e.prototype.getPlayerWidth=function(){var t=(getComputedStyle(this.vjsPlayer.el())||{}).width;return t&&0!==parseFloat(t)||(t=(this.vjsPlayer.el().getBoundingClientRect()||{}).width),parseFloat(t)||this.vjsPlayer.width()},e.prototype.getPlayerHeight=function(){var t=(getComputedStyle(this.vjsPlayer.el())||{}).height;return t&&0!==parseFloat(t)||(t=(this.vjsPlayer.el().getBoundingClientRect()||{}).height),parseFloat(t)||this.vjsPlayer.height()},e.prototype.getPlayerOptions=function(){return this.vjsPlayer.options_},e.prototype.getPlayerId=function(){return this.vjsPlayer.id()},e.prototype.toggleFullscreen=function(){this.vjsPlayer.isFullscreen()?this.vjsPlayer.exitFullscreen():this.vjsPlayer.requestFullscreen()},e.prototype.getContentPlayheadTracker=function(){return this.contentPlayheadTracker},e.prototype.onAdError=function(t){this.vjsControls.show();var e=void 0!==t.getError?t.getError():t.stack;this.vjsPlayer.trigger({type:"adserror",data:{AdError:e,AdErrorEvent:t}})},e.prototype.onAdLog=function(t){var e=t.getAdData(),i=void 0!==e.adError?e.adError.getMessage():void 0;this.vjsPlayer.trigger({type:"adslog",data:{AdError:i,AdEvent:t}})},e.prototype.onAdBreakStart=function(){this.contentSource=this.vjsPlayer.currentSrc(),this.contentSourceType=this.vjsPlayer.currentType(),this.vjsPlayer.off("contentended",this.boundContentEndedListener),this.vjsPlayer.ads.startLinearAdMode(),this.vjsControls.hide(),this.vjsPlayer.pause()},e.prototype.onAdBreakEnd=function(){this.vjsPlayer.on("contentended",this.boundContentEndedListener),this.vjsPlayer.ads.inAdBreak()&&this.vjsPlayer.ads.endLinearAdMode(),this.vjsControls.show()},e.prototype.onAdStart=function(){this.vjsPlayer.trigger("ads-ad-started")},e.prototype.onAllAdsCompleted=function(){1==this.contentComplete&&(this.vjsPlayer.currentSrc()!=this.contentSource&&this.vjsPlayer.src({src:this.contentSource,type:this.contentSourceType}),this.controller.onContentAndAdsCompleted())},e.prototype.onAdsReady=function(){this.vjsPlayer.trigger("adsready")},e.prototype.changeSource=function(t){this.vjsPlayer.currentSrc()&&(this.vjsPlayer.currentTime(0),this.vjsPlayer.pause()),t&&this.vjsPlayer.src(t),this.vjsPlayer.one("loadedmetadata",this.seekContentToZero.bind(this))},e.prototype.seekContentToZero=function(){this.vjsPlayer.currentTime(0)},e.prototype.triggerPlayerEvent=function(t,e){this.vjsPlayer.trigger(t,e)},e.prototype.addContentEndedListener=function(t){this.contentEndedListeners.push(t)},e.prototype.reset=function(){this.vjsPlayer.on("contentended",this.boundContentEndedListener),this.vjsControls.show(),this.vjsPlayer.ads.inAdBreak()&&this.vjsPlayer.ads.endLinearAdMode(),this.contentPlayheadTracker.currentTime=0,this.contentComplete=!1};var i=function(t){this.controller=t,this.adContainerDiv=document.createElement("div"),this.controlsDiv=document.createElement("div"),this.countdownDiv=document.createElement("div"),this.seekBarDiv=document.createElement("div"),this.progressDiv=document.createElement("div"),this.playPauseDiv=document.createElement("div"),this.muteDiv=document.createElement("div"),this.sliderDiv=document.createElement("div"),this.sliderLevelDiv=document.createElement("div"),this.fullscreenDiv=document.createElement("div"),this.boundOnMouseUp=this.onMouseUp.bind(this),this.boundOnMouseMove=this.onMouseMove.bind(this),this.adPlayheadTracker={currentTime:0,duration:0,isPod:!1,adPosition:0,totalAds:0},this.controlPrefix=this.controller.getPlayerId()+"_",this.showCountdown=!0,!1===this.controller.getSettings().showCountdown&&(this.showCountdown=!1),this.createAdContainer()};i.prototype.createAdContainer=function(){this.assignControlAttributes(this.adContainerDiv,"ima-ad-container"),this.adContainerDiv.style.position="absolute",this.adContainerDiv.style.zIndex=1111,this.adContainerDiv.addEventListener("mouseenter",this.showAdControls.bind(this),!1),this.adContainerDiv.addEventListener("mouseleave",this.hideAdControls.bind(this),!1),this.createControls(),this.controller.injectAdContainerDiv(this.adContainerDiv)},i.prototype.createControls=function(){this.assignControlAttributes(this.controlsDiv,"ima-controls-div"),this.controlsDiv.style.width="100%",this.assignControlAttributes(this.countdownDiv,"ima-countdown-div"),this.countdownDiv.innerHTML=this.controller.getSettings().adLabel,this.countdownDiv.style.display=this.showCountdown?"block":"none",this.assignControlAttributes(this.seekBarDiv,"ima-seek-bar-div"),this.seekBarDiv.style.width="100%",this.assignControlAttributes(this.progressDiv,"ima-progress-div"),this.assignControlAttributes(this.playPauseDiv,"ima-play-pause-div"),this.addClass(this.playPauseDiv,"ima-playing"),this.playPauseDiv.addEventListener("click",this.onAdPlayPauseClick.bind(this),!1),this.assignControlAttributes(this.muteDiv,"ima-mute-div"),this.addClass(this.muteDiv,"ima-non-muted"),this.muteDiv.addEventListener("click",this.onAdMuteClick.bind(this),!1),this.assignControlAttributes(this.sliderDiv,"ima-slider-div"),this.sliderDiv.addEventListener("mousedown",this.onAdVolumeSliderMouseDown.bind(this),!1),this.controller.getIsIos()&&(this.sliderDiv.style.display="none"),this.assignControlAttributes(this.sliderLevelDiv,"ima-slider-level-div"),this.assignControlAttributes(this.fullscreenDiv,"ima-fullscreen-div"),this.addClass(this.fullscreenDiv,"ima-non-fullscreen"),this.fullscreenDiv.addEventListener("click",this.onAdFullscreenClick.bind(this),!1),this.adContainerDiv.appendChild(this.controlsDiv),this.controlsDiv.appendChild(this.countdownDiv),this.controlsDiv.appendChild(this.seekBarDiv),this.controlsDiv.appendChild(this.playPauseDiv),this.controlsDiv.appendChild(this.muteDiv),this.controlsDiv.appendChild(this.sliderDiv),this.controlsDiv.appendChild(this.fullscreenDiv),this.seekBarDiv.appendChild(this.progressDiv),this.sliderDiv.appendChild(this.sliderLevelDiv)},i.prototype.onAdPlayPauseClick=function(){this.controller.onAdPlayPauseClick()},i.prototype.onAdMuteClick=function(){this.controller.onAdMuteClick()},i.prototype.onAdFullscreenClick=function(){this.controller.toggleFullscreen()},i.prototype.onAdsPaused=function(){this.addClass(this.playPauseDiv,"ima-paused"),this.removeClass(this.playPauseDiv,"ima-playing"),this.showAdControls()},i.prototype.onAdsResumed=function(){this.onAdsPlaying(),this.showAdControls()},i.prototype.onAdsPlaying=function(){this.addClass(this.playPauseDiv,"ima-playing"),this.removeClass(this.playPauseDiv,"ima-paused")},i.prototype.updateAdUi=function(t,e,i,n,s){var o=Math.floor(e/60),r=Math.floor(e%60);r.toString().length<2&&(r="0"+r);var a=": ";s>1&&(a=" ("+n+" "+this.controller.getSettings().adLabelNofN+" "+s+"): "),this.countdownDiv.innerHTML=this.controller.getSettings().adLabel+a+o+":"+r;var d=100*(t/i);this.progressDiv.style.width=d+"%"},i.prototype.unmute=function(){this.addClass(this.muteDiv,"ima-non-muted"),this.removeClass(this.muteDiv,"ima-muted"),this.sliderLevelDiv.style.width=100*this.controller.getPlayerVolume()+"%"},i.prototype.mute=function(){this.addClass(this.muteDiv,"ima-muted"),this.removeClass(this.muteDiv,"ima-non-muted"),this.sliderLevelDiv.style.width="0%"},i.prototype.onAdVolumeSliderMouseDown=function(){document.addEventListener("mouseup",this.boundOnMouseUp,!1),document.addEventListener("mousemove",this.boundOnMouseMove,!1)},i.prototype.onMouseMove=function(t){this.changeVolume(t)},i.prototype.onMouseUp=function(t){this.changeVolume(t),document.removeEventListener("mouseup",this.boundOnMouseUp),document.removeEventListener("mousemove",this.boundOnMouseMove)},i.prototype.changeVolume=function(t){var e=(t.clientX-this.sliderDiv.getBoundingClientRect().left)/this.sliderDiv.offsetWidth;e*=100,e=Math.min(Math.max(e,0),100),this.sliderLevelDiv.style.width=e+"%",0==this.percent?(this.addClass(this.muteDiv,"ima-muted"),this.removeClass(this.muteDiv,"ima-non-muted")):(this.addClass(this.muteDiv,"ima-non-muted"),this.removeClass(this.muteDiv,"ima-muted")),this.controller.setVolume(e/100)},i.prototype.showAdContainer=function(){this.adContainerDiv.style.display="block"},i.prototype.hideAdContainer=function(){this.adContainerDiv.style.display="none"},i.prototype.reset=function(){this.hideAdContainer()},i.prototype.onAdError=function(){this.hideAdContainer()},i.prototype.onAdBreakStart=function(t){this.showAdContainer(),"application/javascript"!==t.getAd().getContentType()||this.controller.getSettings().showControlsForJSAds?this.controlsDiv.style.display="block":this.controlsDiv.style.display="none",this.onAdsPlaying(),this.hideAdControls()},i.prototype.onAdBreakEnd=function(){var t=this.controller.getCurrentAd();(null==t||t.isLinear())&&this.hideAdContainer(),this.controlsDiv.style.display="none",this.countdownDiv.innerHTML=""},i.prototype.onAllAdsCompleted=function(){this.hideAdContainer()},i.prototype.onLinearAdStart=function(){this.removeClass(this.adContainerDiv,"bumpable-ima-ad-container")},i.prototype.onNonLinearAdLoad=function(){this.adContainerDiv.style.display="block",this.addClass(this.adContainerDiv,"bumpable-ima-ad-container")},i.prototype.onPlayerEnterFullscreen=function(){this.addClass(this.fullscreenDiv,"ima-fullscreen"),this.removeClass(this.fullscreenDiv,"ima-non-fullscreen")},i.prototype.onPlayerExitFullscreen=function(){this.addClass(this.fullscreenDiv,"ima-non-fullscreen"),this.removeClass(this.fullscreenDiv,"ima-fullscreen")},i.prototype.onPlayerVolumeChanged=function(t){0==t?(this.addClass(this.muteDiv,"ima-muted"),this.removeClass(this.muteDiv,"ima-non-muted"),this.sliderLevelDiv.style.width="0%"):(this.addClass(this.muteDiv,"ima-non-muted"),this.removeClass(this.muteDiv,"ima-muted"),this.sliderLevelDiv.style.width=100*t+"%")},i.prototype.showAdControls=function(){this.addClass(this.controlsDiv,"ima-controls-div-showing"),this.playPauseDiv.style.display="block",this.muteDiv.style.display="block",this.fullscreenDiv.style.display="block",this.controller.getIsIos()||(this.sliderDiv.style.display="block")},i.prototype.hideAdControls=function(){this.removeClass(this.controlsDiv,"ima-controls-div-showing"),this.playPauseDiv.style.display="none",this.muteDiv.style.display="none",this.sliderDiv.style.display="none",this.fullscreenDiv.style.display="none"},i.prototype.assignControlAttributes=function(t,e){t.id=this.controlPrefix+e,t.className=this.controlPrefix+e+" "+e},i.prototype.getClassRegexp=function(t){return new RegExp("(^|[^A-Za-z-])"+t+"((?![A-Za-z-])|$)","gi")},i.prototype.elementHasClass=function(t,e){return this.getClassRegexp(e).test(t.className)},i.prototype.addClass=function(t,e){t.className=t.className.trim()+" "+e},i.prototype.removeClass=function(t,e){var i=this.getClassRegexp(e);t.className=t.className.trim().replace(i,"")},i.prototype.getAdContainerDiv=function(){return this.adContainerDiv},i.prototype.setShowCountdown=function(t){this.showCountdown=t,this.countdownDiv.style.display=this.showCountdown?"block":"none"};var n="1.6.1",s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=function(t){this.controller=t,this.adDisplayContainer=null,this.adDisplayContainerInitialized=!1,this.adsLoader=null,this.adsManager=null,this.adsRenderingSettings=null,this.adsResponse=null,this.currentAd=null,this.adTrackingTimer=null,this.allAdsCompleted=!1,this.adsActive=!1,this.adPlaying=!1,this.adMuted=!1,this.adBreakReadyListener=void 0,this.contentCompleteCalled=!1,this.adsManagerDimensions={width:0,height:0},this.autoPlayAdBreaks=!0,!1===this.controller.getSettings().autoPlayAdBreaks&&(this.autoPlayAdBreaks=!1),this.controller.getSettings().locale&&google.ima.settings.setLocale(this.controller.getSettings().locale),this.controller.getSettings().disableFlashAds&&google.ima.settings.setDisableFlashAds(this.controller.getSettings().disableFlashAds),this.controller.getSettings().disableCustomPlaybackForIOS10Plus&&google.ima.settings.setDisableCustomPlaybackForIOS10Plus(this.controller.getSettings().disableCustomPlaybackForIOS10Plus)};o.prototype.initAdObjects=function(){this.adDisplayContainer=new google.ima.AdDisplayContainer(this.controller.getAdContainerDiv(),this.controller.getContentPlayer()),this.adsLoader=new google.ima.AdsLoader(this.adDisplayContainer),this.adsLoader.getSettings().setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.ENABLED),0==this.controller.getSettings().vpaidAllowed&&this.adsLoader.getSettings().setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.DISABLED),this.controller.getSettings().vpaidMode&&this.adsLoader.getSettings().setVpaidMode(this.controller.getSettings().vpaidMode),this.controller.getSettings().locale&&this.adsLoader.getSettings().setLocale(this.controller.getSettings().locale),this.controller.getSettings().numRedirects&&this.adsLoader.getSettings().setNumRedirects(this.controller.getSettings().numRedirects),this.adsLoader.getSettings().setPlayerType("videojs-ima"),this.adsLoader.getSettings().setPlayerVersion(n),this.adsLoader.getSettings().setAutoPlayAdBreaks(this.autoPlayAdBreaks),this.adsLoader.addEventListener(google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.onAdsManagerLoaded.bind(this),!1),this.adsLoader.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,this.onAdsLoaderError.bind(this),!1)},o.prototype.requestAds=function(){var t=new google.ima.AdsRequest;this.controller.getSettings().adTagUrl?t.adTagUrl=this.controller.getSettings().adTagUrl:t.adsResponse=this.controller.getSettings().adsResponse,this.controller.getSettings().forceNonLinearFullSlot&&(t.forceNonLinearFullSlot=!0),this.controller.getSettings().vastLoadTimeout&&(t.vastLoadTimeout=this.controller.getSettings().vastLoadTimeout),t.linearAdSlotWidth=this.controller.getPlayerWidth(),t.linearAdSlotHeight=this.controller.getPlayerHeight(),t.nonLinearAdSlotWidth=this.controller.getSettings().nonLinearWidth||this.controller.getPlayerWidth(),t.nonLinearAdSlotHeight=this.controller.getSettings().nonLinearHeight||this.controller.getPlayerHeight(),t.setAdWillAutoPlay(this.controller.adsWillAutoplay()),t.setAdWillPlayMuted(this.controller.adsWillPlayMuted());var e=this.controller.getSettings().adsRequest;e&&"object"===(void 0===e?"undefined":s(e))&&Object.keys(e).forEach(function(i){t[i]=e[i]}),this.adsLoader.requestAds(t),this.controller.triggerPlayerEvent("ads-request",t)},o.prototype.onAdsManagerLoaded=function(t){this.createAdsRenderingSettings(),this.adsManager=t.getAdsManager(this.controller.getContentPlayheadTracker(),this.adsRenderingSettings),this.adsManager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,this.onAdError.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.AD_BREAK_READY,this.onAdBreakReady.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,this.onContentPauseRequested.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,this.onContentResumeRequested.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.ALL_ADS_COMPLETED,this.onAllAdsCompleted.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.LOADED,this.onAdLoaded.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.STARTED,this.onAdStarted.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.COMPLETE,this.onAdComplete.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.SKIPPED,this.onAdComplete.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.LOG,this.onAdLog.bind(this)),this.controller.getIsMobile()&&(this.adsManager.addEventListener(google.ima.AdEvent.Type.PAUSED,this.onAdPaused.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.RESUMED,this.onAdResumed.bind(this))),this.autoPlayAdBreaks||this.initAdsManager(),this.controller.onAdsReady(),this.controller.getSettings().adsManagerLoadedCallback&&this.controller.getSettings().adsManagerLoadedCallback()},o.prototype.onAdsLoaderError=function(t){window.console.warn("AdsLoader error: "+t.getError()),this.controller.onErrorLoadingAds(t),this.adsManager&&this.adsManager.destroy()},o.prototype.initAdsManager=function(){try{var t=this.controller.getPlayerWidth(),e=this.controller.getPlayerHeight();this.adsManagerDimensions.width=t,this.adsManagerDimensions.height=e,this.adsManager.init(t,e,google.ima.ViewMode.NORMAL),this.adsManager.setVolume(this.controller.getPlayerVolume()),this.initializeAdDisplayContainer()}catch(t){this.onAdError(t)}},o.prototype.createAdsRenderingSettings=function(){if(this.adsRenderingSettings=new google.ima.AdsRenderingSettings,this.adsRenderingSettings.restoreCustomPlaybackStateOnAdBreakComplete=!0,this.controller.getSettings().adsRenderingSettings)for(var t in this.controller.getSettings().adsRenderingSettings)""!==t&&(this.adsRenderingSettings[t]=this.controller.getSettings().adsRenderingSettings[t])},o.prototype.onAdError=function(t){var e=void 0!==t.getError?t.getError():t.stack;window.console.warn("Ad error: "+e),this.adsManager.destroy(),this.controller.onAdError(t),this.adsActive=!1,this.adPlaying=!1},o.prototype.onAdBreakReady=function(t){this.adBreakReadyListener(t)},o.prototype.onContentPauseRequested=function(t){this.adsActive=!0,this.adPlaying=!0,this.controller.onAdBreakStart(t)},o.prototype.onContentResumeRequested=function(t){this.adsActive=!1,this.adPlaying=!1,this.controller.onAdBreakEnd()},o.prototype.onAllAdsCompleted=function(t){this.allAdsCompleted=!0,this.controller.onAllAdsCompleted()},o.prototype.onAdLoaded=function(t){t.getAd().isLinear()||(this.controller.onNonLinearAdLoad(),this.controller.playContent())},o.prototype.onAdStarted=function(t){this.currentAd=t.getAd(),this.currentAd.isLinear()?(this.adTrackingTimer=setInterval(this.onAdPlayheadTrackerInterval.bind(this),250),this.controller.onLinearAdStart()):this.controller.onNonLinearAdStart()},o.prototype.onAdPaused=function(){this.controller.onAdsPaused()},o.prototype.onAdResumed=function(t){this.controller.onAdsResumed()},o.prototype.onAdComplete=function(){this.currentAd.isLinear()&&clearInterval(this.adTrackingTimer)},o.prototype.onAdLog=function(t){this.controller.onAdLog(t)},o.prototype.onAdPlayheadTrackerInterval=function(){var t=this.adsManager.getRemainingTime(),e=this.currentAd.getDuration(),i=e-t;i=i>0?i:0;var n=0,s=void 0;this.currentAd.getAdPodInfo()&&(s=this.currentAd.getAdPodInfo().getAdPosition(),n=this.currentAd.getAdPodInfo().getTotalAds()),this.controller.onAdPlayheadUpdated(i,t,e,s,n)},o.prototype.onContentComplete=function(){this.adsLoader&&(this.adsLoader.contentComplete(),this.contentCompleteCalled=!0),this.adsManager&&this.adsManager.getCuePoints()&&!this.adsManager.getCuePoints().includes(-1)&&this.controller.onNoPostroll(),this.allAdsCompleted&&this.controller.onContentAndAdsCompleted()},o.prototype.onPlayerDisposed=function(){this.adTrackingTimer&&clearInterval(this.adTrackingTimer),this.adsManager&&(this.adsManager.destroy(),this.adsManager=null)},o.prototype.onPlayerReadyForPreroll=function(){if(this.autoPlayAdBreaks){this.initAdsManager();try{this.controller.showAdContainer(),this.adsManager.setVolume(this.controller.getPlayerVolume()),this.adsManager.start()}catch(t){this.onAdError(t)}}},o.prototype.onPlayerReady=function(){this.initAdObjects(),(this.controller.getSettings().adTagUrl||this.controller.getSettings().adsResponse)&&this.requestAds()},o.prototype.onPlayerEnterFullscreen=function(){this.adsManager&&this.adsManager.resize(window.screen.width,window.screen.height,google.ima.ViewMode.FULLSCREEN)},o.prototype.onPlayerExitFullscreen=function(){this.adsManager&&this.adsManager.resize(this.controller.getPlayerWidth(),this.controller.getPlayerHeight(),google.ima.ViewMode.NORMAL)},o.prototype.onPlayerVolumeChanged=function(t){this.adsManager&&this.adsManager.setVolume(t),this.adMuted=0==t},o.prototype.onPlayerResize=function(t,e){this.adsManager&&(this.adsManagerDimensions.width=t,this.adsManagerDimensions.height=e,this.adsManager.resize(t,e,google.ima.ViewMode.NORMAL))},o.prototype.getCurrentAd=function(){return this.currentAd},o.prototype.setAdBreakReadyListener=function(t){this.adBreakReadyListener=t},o.prototype.isAdPlaying=function(){return this.adPlaying},o.prototype.isAdMuted=function(){return this.adMuted},o.prototype.pauseAds=function(){this.adsManager.pause(),this.adPlaying=!1},o.prototype.resumeAds=function(){this.adsManager.resume(),this.adPlaying=!0},o.prototype.unmute=function(){this.adsManager.setVolume(1),this.adMuted=!1},o.prototype.mute=function(){this.adsManager.setVolume(0),this.adMuted=!0},o.prototype.setVolume=function(t){this.adsManager.setVolume(t),this.adMuted=0==t},o.prototype.initializeAdDisplayContainer=function(){this.adDisplayContainer&&(this.adDisplayContainerInitialized||(this.adDisplayContainer.initialize(),this.adDisplayContainerInitialized=!0))},o.prototype.playAdBreak=function(){this.autoPlayAdBreaks||(this.controller.showAdContainer(),this.adsManager.setVolume(this.controller.getPlayerVolume()),this.adsManager.start())},o.prototype.addEventListener=function(t,e){this.adsManager&&this.adsManager.addEventListener(t,e)},o.prototype.getAdsManager=function(){return this.adsManager},o.prototype.reset=function(){this.adsActive=!1,this.adPlaying=!1,this.adTrackingTimer&&clearInterval(this.adTrackingTimer),this.adsManager&&(this.adsManager.destroy(),this.adsManager=null),this.adsLoader&&!this.contentCompleteCalled&&this.adsLoader.contentComplete(),this.contentCompleteCalled=!1,this.allAdsCompleted=!1};var r=function(t,n){this.settings={},this.contentAndAdsEndedListeners=[],this.isMobile=navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPad/i)||navigator.userAgent.match(/Android/i),this.isIos=navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPad/i),this.initWithSettings(n);var s={debug:this.settings.debug,timeout:this.settings.timeout,prerollTimeout:this.settings.prerollTimeout},r=this.extend({},s,n.contribAdsSettings||{});this.playerWrapper=new e(t,r,this),this.adUi=new i(this),this.sdkImpl=new o(this)};r.IMA_DEFAULTS={debug:!1,timeout:5e3,prerollTimeout:1e3,adLabel:"Advertisement",adLabelNofN:"of",showControlsForJSAds:!0},r.prototype.initWithSettings=function(t){this.settings=this.extend({},r.IMA_DEFAULTS,t||{}),this.warnAboutDeprecatedSettings(),this.showCountdown=!0,!1===this.settings.showCountdown&&(this.showCountdown=!1)},r.prototype.warnAboutDeprecatedSettings=function(){var t=this;["adWillAutoplay","adsWillAutoplay","adWillPlayMuted","adsWillPlayMuted"].forEach(function(e){void 0!==t.settings[e]&&console.warn("WARNING: videojs.ima setting "+e+" is deprecated")})},r.prototype.getSettings=function(){return this.settings},r.prototype.getIsMobile=function(){return this.isMobile},r.prototype.getIsIos=function(){return this.isIos},r.prototype.injectAdContainerDiv=function(t){this.playerWrapper.injectAdContainerDiv(t)},r.prototype.getAdContainerDiv=function(){return this.adUi.getAdContainerDiv()},r.prototype.getContentPlayer=function(){return this.playerWrapper.getContentPlayer()},r.prototype.getContentPlayheadTracker=function(){return this.playerWrapper.getContentPlayheadTracker()},r.prototype.requestAds=function(){this.sdkImpl.requestAds()},r.prototype.setSetting=function(t,e){this.settings[t]=e},r.prototype.onErrorLoadingAds=function(t){this.adUi.onAdError(),this.playerWrapper.onAdError(t)},r.prototype.onAdPlayPauseClick=function(){this.sdkImpl.isAdPlaying()?(this.adUi.onAdsPaused(),this.sdkImpl.pauseAds()):(this.adUi.onAdsPlaying(),this.sdkImpl.resumeAds())},r.prototype.onAdMuteClick=function(){this.sdkImpl.isAdMuted()?(this.playerWrapper.unmute(),this.adUi.unmute(),this.sdkImpl.unmute()):(this.playerWrapper.mute(),this.adUi.mute(),this.sdkImpl.mute())},r.prototype.setVolume=function(t){this.playerWrapper.setVolume(t),this.sdkImpl.setVolume(t)},r.prototype.getPlayerVolume=function(){return this.playerWrapper.getVolume()},r.prototype.toggleFullscreen=function(){this.playerWrapper.toggleFullscreen()},r.prototype.onAdError=function(t){this.adUi.onAdError(),this.playerWrapper.onAdError(t)},r.prototype.onAdBreakStart=function(t){this.playerWrapper.onAdBreakStart(),this.adUi.onAdBreakStart(t)},r.prototype.showAdContainer=function(){this.adUi.showAdContainer()},r.prototype.onAdBreakEnd=function(){this.playerWrapper.onAdBreakEnd(),this.adUi.onAdBreakEnd()},r.prototype.onAllAdsCompleted=function(){this.adUi.onAllAdsCompleted(),this.playerWrapper.onAllAdsCompleted()},r.prototype.onAdsPaused=function(){this.adUi.onAdsPaused()},r.prototype.onAdsResumed=function(){this.adUi.onAdsResumed()},r.prototype.onAdPlayheadUpdated=function(t,e,i,n,s){this.adUi.updateAdUi(t,e,i,n,s)},r.prototype.onAdLog=function(t){this.playerWrapper.onAdLog(t)},r.prototype.getCurrentAd=function(){return this.sdkImpl.getCurrentAd()},r.prototype.playContent=function(){this.playerWrapper.play()},r.prototype.onLinearAdStart=function(){this.adUi.onLinearAdStart(),this.playerWrapper.onAdStart()},r.prototype.onNonLinearAdLoad=function(){this.adUi.onNonLinearAdLoad()},r.prototype.onNonLinearAdStart=function(){this.adUi.onNonLinearAdLoad(),this.playerWrapper.onAdStart()},r.prototype.getPlayerWidth=function(){return this.playerWrapper.getPlayerWidth()},r.prototype.getPlayerHeight=function(){return this.playerWrapper.getPlayerHeight()},r.prototype.onAdsReady=function(){this.playerWrapper.onAdsReady()},r.prototype.onPlayerResize=function(t,e){this.sdkImpl.onPlayerResize(t,e)},r.prototype.onContentComplete=function(){this.sdkImpl.onContentComplete()},r.prototype.onNoPostroll=function(){this.playerWrapper.onNoPostroll()},r.prototype.onContentAndAdsCompleted=function(){for(var t in this.contentAndAdsEndedListeners)"function"==typeof this.contentAndAdsEndedListeners[t]&&this.contentAndAdsEndedListeners[t]()},r.prototype.onPlayerDisposed=function(){this.contentAndAdsEndedListeners=[],this.sdkImpl.onPlayerDisposed()},r.prototype.onPlayerReadyForPreroll=function(){this.sdkImpl.onPlayerReadyForPreroll()},r.prototype.onPlayerReady=function(){this.sdkImpl.onPlayerReady()},r.prototype.onPlayerEnterFullscreen=function(){this.adUi.onPlayerEnterFullscreen(),this.sdkImpl.onPlayerEnterFullscreen()},r.prototype.onPlayerExitFullscreen=function(){this.adUi.onPlayerExitFullscreen(),this.sdkImpl.onPlayerExitFullscreen()},r.prototype.onPlayerVolumeChanged=function(t){this.adUi.onPlayerVolumeChanged(t),this.sdkImpl.onPlayerVolumeChanged(t)},r.prototype.setContentWithAdTag=function(t,e){this.reset(),this.settings.adTagUrl=e||this.settings.adTagUrl,this.playerWrapper.changeSource(t)},r.prototype.setContentWithAdsResponse=function(t,e){this.reset(),this.settings.adsResponse=e||this.settings.adsResponse,this.playerWrapper.changeSource(t)},r.prototype.setContentWithAdsRequest=function(t,e){this.reset(),this.settings.adsRequest=e||this.settings.adsRequest,this.playerWrapper.changeSource(t)},r.prototype.reset=function(){this.sdkImpl.reset(),this.playerWrapper.reset(),this.adUi.reset()},r.prototype.addContentEndedListener=function(t){this.playerWrapper.addContentEndedListener(t)},r.prototype.addContentAndAdsEndedListener=function(t){this.contentAndAdsEndedListeners.push(t)},r.prototype.setAdBreakReadyListener=function(t){this.sdkImpl.setAdBreakReadyListener(t)},r.prototype.setShowCountdown=function(t){this.adUi.setShowCountdown(t),this.showCountdown=t,this.countdownDiv.style.display=this.showCountdown?"block":"none"},r.prototype.initializeAdDisplayContainer=function(){this.sdkImpl.initializeAdDisplayContainer()},r.prototype.playAdBreak=function(){this.sdkImpl.playAdBreak()},r.prototype.addEventListener=function(t,e){this.sdkImpl.addEventListener(t,e)},r.prototype.getAdsManager=function(){return this.sdkImpl.getAdsManager()},r.prototype.getPlayerId=function(){return this.playerWrapper.getPlayerId()},r.prototype.changeAdTag=function(t){this.reset(),this.settings.adTagUrl=t},r.prototype.pauseAd=function(){this.adUi.onAdsPaused(),this.sdkImpl.pauseAds()},r.prototype.resumeAd=function(){this.adUi.onAdsPlaying(),this.sdkImpl.resumeAds()},r.prototype.adsWillAutoplay=function(){return void 0!==this.settings.adsWillAutoplay?this.settings.adsWillAutoplay:void 0!==this.settings.adWillAutoplay?this.settings.adWillAutoplay:!!this.playerWrapper.getPlayerOptions().autoplay},r.prototype.adsWillPlayMuted=function(){return void 0!==this.settings.adsWillPlayMuted?this.settings.adsWillPlayMuted:void 0!==this.settings.adWillPlayMuted?this.settings.adWillPlayMuted:void 0!==this.playerWrapper.getPlayerOptions().muted?this.playerWrapper.getPlayerOptions().muted:0==this.playerWrapper.getVolume()},r.prototype.triggerPlayerEvent=function(t,e){this.playerWrapper.triggerPlayerEvent(t,e)},r.prototype.extend=function(t){for(var e=void 0,i=void 0,n=void 0,s=arguments.length,o=Array(s>1?s-1:0),r=1;r>>>>>> f5959c3... Build for samples at v1.6.1 From 3d4e99589eb9220776022d49a8e8c71829125e0e Mon Sep 17 00:00:00 2001 From: Kiro705 Date: Wed, 11 Sep 2019 15:44:28 -0400 Subject: [PATCH 13/22] fix: fixed error in videojs.ima.min.js --- dist/videojs.ima.min.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/dist/videojs.ima.min.js b/dist/videojs.ima.min.js index 2271c16e..d26391e3 100644 --- a/dist/videojs.ima.min.js +++ b/dist/videojs.ima.min.js @@ -1,5 +1 @@ -<<<<<<< HEAD -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("video.js")):"function"==typeof define&&define.amd?define(["video.js"],e):t.videojsIma=e(t.videojs)}(this,function(t){"use strict";t=t&&t.hasOwnProperty("default")?t.default:t;var e=function(t,e,i){this.vjsPlayer=t,this.controller=i,this.contentTrackingTimer=null,this.contentComplete=!1,this.updateTimeIntervalHandle=null,this.updateTimeInterval=1e3,this.seekCheckIntervalHandle=null,this.seekCheckInterval=1e3,this.resizeCheckIntervalHandle=null,this.resizeCheckInterval=250,this.seekThreshold=100,this.contentEndedListeners=[],this.contentSource="",this.contentSourceType="",this.contentPlayheadTracker={currentTime:0,previousTime:0,seeking:!1,duration:0},this.vjsPlayerDimensions={width:this.getPlayerWidth(),height:this.getPlayerHeight()},this.vjsControls=this.vjsPlayer.getChild("controlBar"),this.h5Player=null,this.vjsPlayer.one("play",this.setUpPlayerIntervals.bind(this)),this.boundContentEndedListener=this.localContentEndedListener.bind(this),this.vjsPlayer.on("contentended",this.boundContentEndedListener),this.vjsPlayer.on("dispose",this.playerDisposedListener.bind(this)),this.vjsPlayer.on("readyforpreroll",this.onReadyForPreroll.bind(this)),this.vjsPlayer.ready(this.onPlayerReady.bind(this)),this.vjsPlayer.ads(e)};e.prototype.setUpPlayerIntervals=function(){this.updateTimeIntervalHandle=setInterval(this.updateCurrentTime.bind(this),this.updateTimeInterval),this.seekCheckIntervalHandle=setInterval(this.checkForSeeking.bind(this),this.seekCheckInterval),this.resizeCheckIntervalHandle=setInterval(this.checkForResize.bind(this),this.resizeCheckInterval)},e.prototype.updateCurrentTime=function(){this.contentPlayheadTracker.seeking||(this.contentPlayheadTracker.currentTime=this.vjsPlayer.currentTime())},e.prototype.checkForSeeking=function(){var t=1e3*(this.vjsPlayer.currentTime()-this.contentPlayheadTracker.previousTime);Math.abs(t)>this.seekCheckInterval+this.seekThreshold?this.contentPlayheadTracker.seeking=!0:this.contentPlayheadTracker.seeking=!1,this.contentPlayheadTracker.previousTime=this.vjsPlayer.currentTime()},e.prototype.checkForResize=function(){var t=this.getPlayerWidth(),e=this.getPlayerHeight();t==this.vjsPlayerDimensions.width&&e==this.vjsPlayerDimensions.height||(this.vjsPlayerDimensions.width=t,this.vjsPlayerDimensions.height=e,this.controller.onPlayerResize(t,e))},e.prototype.localContentEndedListener=function(){for(var t in this.contentComplete||(this.contentComplete=!0,this.controller.onContentComplete()),this.contentEndedListeners)"function"==typeof this.contentEndedListeners[t]&&this.contentEndedListeners[t]();clearInterval(this.updateTimeIntervalHandle),clearInterval(this.seekCheckIntervalHandle),clearInterval(this.resizeCheckIntervalHandle),this.vjsPlayer.el()&&this.vjsPlayer.one("play",this.setUpPlayerIntervals.bind(this))},e.prototype.onNoPostroll=function(){this.vjsPlayer.trigger("nopostroll")},e.prototype.playerDisposedListener=function(){this.contentEndedListeners=[],this.controller.onPlayerDisposed(),this.contentComplete=!0,this.vjsPlayer.off("contentended",this.boundContentEndedListener),this.vjsPlayer.ads.adTimeoutTimeout&&clearTimeout(this.vjsPlayer.ads.adTimeoutTimeout);var t=[this.updateTimeIntervalHandle,this.seekCheckIntervalHandle,this.resizeCheckIntervalHandle];for(var e in t)t[e]&&clearInterval(t[e])},e.prototype.onReadyForPreroll=function(){this.controller.onPlayerReadyForPreroll()},e.prototype.onPlayerReady=function(){this.h5Player=document.getElementById(this.getPlayerId()).getElementsByClassName("vjs-tech")[0],this.h5Player.hasAttribute("autoplay")&&this.controller.setSetting("adWillAutoPlay",!0),this.onVolumeChange(),this.vjsPlayer.on("fullscreenchange",this.onFullscreenChange.bind(this)),this.vjsPlayer.on("volumechange",this.onVolumeChange.bind(this)),this.controller.onPlayerReady()},e.prototype.onFullscreenChange=function(){this.vjsPlayer.isFullscreen()?this.controller.onPlayerEnterFullscreen():this.controller.onPlayerExitFullscreen()},e.prototype.onVolumeChange=function(){var t=this.vjsPlayer.muted()?0:this.vjsPlayer.volume();this.controller.onPlayerVolumeChanged(t)},e.prototype.injectAdContainerDiv=function(t){this.vjsControls.el().parentNode.appendChild(t)},e.prototype.getContentPlayer=function(){return this.h5Player},e.prototype.getVolume=function(){return this.vjsPlayer.muted()?0:this.vjsPlayer.volume()},e.prototype.setVolume=function(t){this.vjsPlayer.volume(t),0==t?this.vjsPlayer.muted(!0):this.vjsPlayer.muted(!1)},e.prototype.unmute=function(){this.vjsPlayer.muted(!1)},e.prototype.mute=function(){this.vjsPlayer.muted(!0)},e.prototype.play=function(){this.vjsPlayer.play()},e.prototype.getPlayerWidth=function(){var t=(getComputedStyle(this.vjsPlayer.el())||{}).width;return t&&0!==parseInt(t,10)||(t=(this.vjsPlayer.el().getBoundingClientRect()||{}).width),parseInt(t,10)||this.vjsPlayer.width()},e.prototype.getPlayerHeight=function(){var t=(getComputedStyle(this.vjsPlayer.el())||{}).height;return t&&0!==parseInt(t,10)||(t=(this.vjsPlayer.el().getBoundingClientRect()||{}).height),parseInt(t,10)||this.vjsPlayer.height()},e.prototype.getPlayerOptions=function(){return this.vjsPlayer.options_},e.prototype.getPlayerId=function(){return this.vjsPlayer.id()},e.prototype.toggleFullscreen=function(){this.vjsPlayer.isFullscreen()?this.vjsPlayer.exitFullscreen():this.vjsPlayer.requestFullscreen()},e.prototype.getContentPlayheadTracker=function(){return this.contentPlayheadTracker},e.prototype.onAdError=function(t){this.vjsControls.show();var e=void 0!==t.getError?t.getError():t.stack;this.vjsPlayer.trigger({type:"adserror",data:{AdError:e,AdErrorEvent:t}})},e.prototype.onAdLog=function(t){var e=t.getAdData(),i=void 0!==e.adError?e.adError.getMessage():void 0;this.vjsPlayer.trigger({type:"adslog",data:{AdError:i,AdEvent:t}})},e.prototype.onAdBreakStart=function(){this.contentSource=this.vjsPlayer.currentSrc(),this.contentSourceType=this.vjsPlayer.currentType(),this.vjsPlayer.off("contentended",this.boundContentEndedListener),this.vjsPlayer.ads.startLinearAdMode(),this.vjsControls.hide(),this.vjsPlayer.pause()},e.prototype.onAdBreakEnd=function(){this.vjsPlayer.on("contentended",this.boundContentEndedListener),this.vjsPlayer.ads.inAdBreak()&&this.vjsPlayer.ads.endLinearAdMode(),this.vjsControls.show()},e.prototype.onAdStart=function(){this.vjsPlayer.trigger("ads-ad-started")},e.prototype.onAllAdsCompleted=function(){1==this.contentComplete&&(this.vjsPlayer.currentSrc()!=this.contentSource&&this.vjsPlayer.src({src:this.contentSource,type:this.contentSourceType}),this.controller.onContentAndAdsCompleted())},e.prototype.onAdsReady=function(){this.vjsPlayer.trigger("adsready")},e.prototype.changeSource=function(t){this.vjsPlayer.currentSrc()&&(this.vjsPlayer.currentTime(0),this.vjsPlayer.pause()),t&&this.vjsPlayer.src(t),this.vjsPlayer.one("loadedmetadata",this.seekContentToZero.bind(this))},e.prototype.seekContentToZero=function(){this.vjsPlayer.currentTime(0)},e.prototype.triggerPlayerEvent=function(t,e){this.vjsPlayer.trigger(t,e)},e.prototype.addContentEndedListener=function(t){this.contentEndedListeners.push(t)},e.prototype.reset=function(){this.vjsPlayer.on("contentended",this.boundContentEndedListener),this.vjsControls.show(),this.vjsPlayer.ads.inAdBreak()&&this.vjsPlayer.ads.endLinearAdMode(),this.contentPlayheadTracker.currentTime=0,this.contentComplete=!1};var i=function(t){this.controller=t,this.adContainerDiv=document.createElement("div"),this.controlsDiv=document.createElement("div"),this.countdownDiv=document.createElement("div"),this.seekBarDiv=document.createElement("div"),this.progressDiv=document.createElement("div"),this.playPauseDiv=document.createElement("div"),this.muteDiv=document.createElement("div"),this.sliderDiv=document.createElement("div"),this.sliderLevelDiv=document.createElement("div"),this.fullscreenDiv=document.createElement("div"),this.boundOnMouseUp=this.onMouseUp.bind(this),this.boundOnMouseMove=this.onMouseMove.bind(this),this.adPlayheadTracker={currentTime:0,duration:0,isPod:!1,adPosition:0,totalAds:0},this.controlPrefix=this.controller.getPlayerId()+"_",this.showCountdown=!0,!1===this.controller.getSettings().showCountdown&&(this.showCountdown=!1),this.createAdContainer()};i.prototype.createAdContainer=function(){this.assignControlAttributes(this.adContainerDiv,"ima-ad-container"),this.adContainerDiv.style.position="absolute",this.adContainerDiv.style.zIndex=1111,this.adContainerDiv.addEventListener("mouseenter",this.showAdControls.bind(this),!1),this.adContainerDiv.addEventListener("mouseleave",this.hideAdControls.bind(this),!1),this.createControls(),this.controller.injectAdContainerDiv(this.adContainerDiv)},i.prototype.createControls=function(){this.assignControlAttributes(this.controlsDiv,"ima-controls-div"),this.controlsDiv.style.width="100%",this.assignControlAttributes(this.countdownDiv,"ima-countdown-div"),this.countdownDiv.innerHTML=this.controller.getSettings().adLabel,this.countdownDiv.style.display=this.showCountdown?"block":"none",this.assignControlAttributes(this.seekBarDiv,"ima-seek-bar-div"),this.seekBarDiv.style.width="100%",this.assignControlAttributes(this.progressDiv,"ima-progress-div"),this.assignControlAttributes(this.playPauseDiv,"ima-play-pause-div"),this.addClass(this.playPauseDiv,"ima-playing"),this.playPauseDiv.addEventListener("click",this.onAdPlayPauseClick.bind(this),!1),this.assignControlAttributes(this.muteDiv,"ima-mute-div"),this.addClass(this.muteDiv,"ima-non-muted"),this.muteDiv.addEventListener("click",this.onAdMuteClick.bind(this),!1),this.assignControlAttributes(this.sliderDiv,"ima-slider-div"),this.sliderDiv.addEventListener("mousedown",this.onAdVolumeSliderMouseDown.bind(this),!1),this.controller.getIsIos()&&(this.sliderDiv.style.display="none"),this.assignControlAttributes(this.sliderLevelDiv,"ima-slider-level-div"),this.assignControlAttributes(this.fullscreenDiv,"ima-fullscreen-div"),this.addClass(this.fullscreenDiv,"ima-non-fullscreen"),this.fullscreenDiv.addEventListener("click",this.onAdFullscreenClick.bind(this),!1),this.adContainerDiv.appendChild(this.controlsDiv),this.controlsDiv.appendChild(this.countdownDiv),this.controlsDiv.appendChild(this.seekBarDiv),this.controlsDiv.appendChild(this.playPauseDiv),this.controlsDiv.appendChild(this.muteDiv),this.controlsDiv.appendChild(this.sliderDiv),this.controlsDiv.appendChild(this.fullscreenDiv),this.seekBarDiv.appendChild(this.progressDiv),this.sliderDiv.appendChild(this.sliderLevelDiv)},i.prototype.onAdPlayPauseClick=function(){this.controller.onAdPlayPauseClick()},i.prototype.onAdMuteClick=function(){this.controller.onAdMuteClick()},i.prototype.onAdFullscreenClick=function(){this.controller.toggleFullscreen()},i.prototype.onAdsPaused=function(){this.addClass(this.playPauseDiv,"ima-paused"),this.removeClass(this.playPauseDiv,"ima-playing"),this.showAdControls()},i.prototype.onAdsResumed=function(){this.onAdsPlaying(),this.showAdControls()},i.prototype.onAdsPlaying=function(){this.addClass(this.playPauseDiv,"ima-playing"),this.removeClass(this.playPauseDiv,"ima-paused")},i.prototype.updateAdUi=function(t,e,i,n,s){var o=Math.floor(e/60),r=Math.floor(e%60);r.toString().length<2&&(r="0"+r);var a=": ";s>1&&(a=" ("+n+" "+this.controller.getSettings().adLabelNofN+" "+s+"): "),this.countdownDiv.innerHTML=this.controller.getSettings().adLabel+a+o+":"+r;var d=100*(t/i);this.progressDiv.style.width=d+"%"},i.prototype.unmute=function(){this.addClass(this.muteDiv,"ima-non-muted"),this.removeClass(this.muteDiv,"ima-muted"),this.sliderLevelDiv.style.width=100*this.controller.getPlayerVolume()+"%"},i.prototype.mute=function(){this.addClass(this.muteDiv,"ima-muted"),this.removeClass(this.muteDiv,"ima-non-muted"),this.sliderLevelDiv.style.width="0%"},i.prototype.onAdVolumeSliderMouseDown=function(){document.addEventListener("mouseup",this.boundOnMouseUp,!1),document.addEventListener("mousemove",this.boundOnMouseMove,!1)},i.prototype.onMouseMove=function(t){this.changeVolume(t)},i.prototype.onMouseUp=function(t){this.changeVolume(t),document.removeEventListener("mouseup",this.boundOnMouseUp),document.removeEventListener("mousemove",this.boundOnMouseMove)},i.prototype.changeVolume=function(t){var e=(t.clientX-this.sliderDiv.getBoundingClientRect().left)/this.sliderDiv.offsetWidth;e*=100,e=Math.min(Math.max(e,0),100),this.sliderLevelDiv.style.width=e+"%",0==this.percent?(this.addClass(this.muteDiv,"ima-muted"),this.removeClass(this.muteDiv,"ima-non-muted")):(this.addClass(this.muteDiv,"ima-non-muted"),this.removeClass(this.muteDiv,"ima-muted")),this.controller.setVolume(e/100)},i.prototype.showAdContainer=function(){this.adContainerDiv.style.display="block"},i.prototype.hideAdContainer=function(){this.adContainerDiv.style.display="none"},i.prototype.reset=function(){this.hideAdContainer()},i.prototype.onAdError=function(){this.hideAdContainer()},i.prototype.onAdBreakStart=function(t){this.showAdContainer(),"application/javascript"!==t.getAd().getContentType()||this.controller.getSettings().showControlsForJSAds?this.controlsDiv.style.display="block":this.controlsDiv.style.display="none",this.onAdsPlaying(),this.hideAdControls()},i.prototype.onAdBreakEnd=function(){var t=this.controller.getCurrentAd();(null==t||t.isLinear())&&this.hideAdContainer(),this.controlsDiv.style.display="none",this.countdownDiv.innerHTML=""},i.prototype.onAllAdsCompleted=function(){this.hideAdContainer()},i.prototype.onLinearAdStart=function(){this.removeClass(this.adContainerDiv,"bumpable-ima-ad-container")},i.prototype.onNonLinearAdLoad=function(){this.adContainerDiv.style.display="block",this.addClass(this.adContainerDiv,"bumpable-ima-ad-container")},i.prototype.onPlayerEnterFullscreen=function(){this.addClass(this.fullscreenDiv,"ima-fullscreen"),this.removeClass(this.fullscreenDiv,"ima-non-fullscreen")},i.prototype.onPlayerExitFullscreen=function(){this.addClass(this.fullscreenDiv,"ima-non-fullscreen"),this.removeClass(this.fullscreenDiv,"ima-fullscreen")},i.prototype.onPlayerVolumeChanged=function(t){0==t?(this.addClass(this.muteDiv,"ima-muted"),this.removeClass(this.muteDiv,"ima-non-muted"),this.sliderLevelDiv.style.width="0%"):(this.addClass(this.muteDiv,"ima-non-muted"),this.removeClass(this.muteDiv,"ima-muted"),this.sliderLevelDiv.style.width=100*t+"%")},i.prototype.showAdControls=function(){this.addClass(this.controlsDiv,"ima-controls-div-showing"),this.playPauseDiv.style.display="block",this.muteDiv.style.display="block",this.fullscreenDiv.style.display="block",this.controller.getIsIos()||(this.sliderDiv.style.display="block")},i.prototype.hideAdControls=function(){this.removeClass(this.controlsDiv,"ima-controls-div-showing"),this.playPauseDiv.style.display="none",this.muteDiv.style.display="none",this.sliderDiv.style.display="none",this.fullscreenDiv.style.display="none"},i.prototype.assignControlAttributes=function(t,e){t.id=this.controlPrefix+e,t.className=this.controlPrefix+e+" "+e},i.prototype.getClassRegexp=function(t){return new RegExp("(^|[^A-Za-z-])"+t+"((?![A-Za-z-])|$)","gi")},i.prototype.elementHasClass=function(t,e){return this.getClassRegexp(e).test(t.className)},i.prototype.addClass=function(t,e){t.className=t.className.trim()+" "+e},i.prototype.removeClass=function(t,e){var i=this.getClassRegexp(e);t.className=t.className.trim().replace(i,"")},i.prototype.getAdContainerDiv=function(){return this.adContainerDiv},i.prototype.setShowCountdown=function(t){this.showCountdown=t,this.countdownDiv.style.display=this.showCountdown?"block":"none"};var n="1.6.0",s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=function(t){this.controller=t,this.adDisplayContainer=null,this.adDisplayContainerInitialized=!1,this.adsLoader=null,this.adsManager=null,this.adsRenderingSettings=null,this.adsResponse=null,this.currentAd=null,this.adTrackingTimer=null,this.allAdsCompleted=!1,this.adsActive=!1,this.adPlaying=!1,this.adMuted=!1,this.adBreakReadyListener=void 0,this.contentCompleteCalled=!1,this.adsManagerDimensions={width:0,height:0},this.autoPlayAdBreaks=!0,!1===this.controller.getSettings().autoPlayAdBreaks&&(this.autoPlayAdBreaks=!1),this.controller.getSettings().locale&&google.ima.settings.setLocale(this.controller.getSettings().locale),this.controller.getSettings().disableFlashAds&&google.ima.settings.setDisableFlashAds(this.controller.getSettings().disableFlashAds),this.controller.getSettings().disableCustomPlaybackForIOS10Plus&&google.ima.settings.setDisableCustomPlaybackForIOS10Plus(this.controller.getSettings().disableCustomPlaybackForIOS10Plus)};o.prototype.initAdObjects=function(){this.adDisplayContainer=new google.ima.AdDisplayContainer(this.controller.getAdContainerDiv(),this.controller.getContentPlayer()),this.adsLoader=new google.ima.AdsLoader(this.adDisplayContainer),this.adsLoader.getSettings().setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.ENABLED),0==this.controller.getSettings().vpaidAllowed&&this.adsLoader.getSettings().setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.DISABLED),this.controller.getSettings().vpaidMode&&this.adsLoader.getSettings().setVpaidMode(this.controller.getSettings().vpaidMode),this.controller.getSettings().locale&&this.adsLoader.getSettings().setLocale(this.controller.getSettings().locale),this.controller.getSettings().numRedirects&&this.adsLoader.getSettings().setNumRedirects(this.controller.getSettings().numRedirects),this.adsLoader.getSettings().setPlayerType("videojs-ima"),this.adsLoader.getSettings().setPlayerVersion(n),this.adsLoader.getSettings().setAutoPlayAdBreaks(this.autoPlayAdBreaks),this.adsLoader.addEventListener(google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.onAdsManagerLoaded.bind(this),!1),this.adsLoader.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,this.onAdsLoaderError.bind(this),!1)},o.prototype.requestAds=function(){var t=new google.ima.AdsRequest;this.controller.getSettings().adTagUrl?t.adTagUrl=this.controller.getSettings().adTagUrl:t.adsResponse=this.controller.getSettings().adsResponse,this.controller.getSettings().forceNonLinearFullSlot&&(t.forceNonLinearFullSlot=!0),this.controller.getSettings().vastLoadTimeout&&(t.vastLoadTimeout=this.controller.getSettings().vastLoadTimeout),t.linearAdSlotWidth=this.controller.getPlayerWidth(),t.linearAdSlotHeight=this.controller.getPlayerHeight(),t.nonLinearAdSlotWidth=this.controller.getSettings().nonLinearWidth||this.controller.getPlayerWidth(),t.nonLinearAdSlotHeight=this.controller.getSettings().nonLinearHeight||this.controller.getPlayerHeight(),t.setAdWillAutoPlay(this.controller.adsWillAutoplay()),t.setAdWillPlayMuted(this.controller.adsWillPlayMuted());var e=this.controller.getSettings().adsRequest;e&&"object"===(void 0===e?"undefined":s(e))&&Object.keys(e).forEach(function(i){t[i]=e[i]}),this.adsLoader.requestAds(t),this.controller.triggerPlayerEvent("ads-request",t)},o.prototype.onAdsManagerLoaded=function(t){this.createAdsRenderingSettings(),this.adsManager=t.getAdsManager(this.controller.getContentPlayheadTracker(),this.adsRenderingSettings),this.adsManager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,this.onAdError.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.AD_BREAK_READY,this.onAdBreakReady.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,this.onContentPauseRequested.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,this.onContentResumeRequested.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.ALL_ADS_COMPLETED,this.onAllAdsCompleted.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.LOADED,this.onAdLoaded.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.STARTED,this.onAdStarted.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.CLICK,this.onAdPaused.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.COMPLETE,this.onAdComplete.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.SKIPPED,this.onAdComplete.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.LOG,this.onAdLog.bind(this)),this.controller.getIsMobile()&&(this.adsManager.addEventListener(google.ima.AdEvent.Type.PAUSED,this.onAdPaused.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.RESUMED,this.onAdResumed.bind(this))),this.autoPlayAdBreaks||this.initAdsManager(),this.controller.onAdsReady(),this.controller.getSettings().adsManagerLoadedCallback&&this.controller.getSettings().adsManagerLoadedCallback()},o.prototype.onAdsLoaderError=function(t){window.console.warn("AdsLoader error: "+t.getError()),this.controller.onErrorLoadingAds(t),this.adsManager&&this.adsManager.destroy()},o.prototype.initAdsManager=function(){try{var t=this.controller.getPlayerWidth(),e=this.controller.getPlayerHeight();this.adsManagerDimensions.width=t,this.adsManagerDimensions.height=e,this.adsManager.init(t,e,google.ima.ViewMode.NORMAL),this.adsManager.setVolume(this.controller.getPlayerVolume()),this.initializeAdDisplayContainer()}catch(t){this.onAdError(t)}},o.prototype.createAdsRenderingSettings=function(){if(this.adsRenderingSettings=new google.ima.AdsRenderingSettings,this.adsRenderingSettings.restoreCustomPlaybackStateOnAdBreakComplete=!0,this.controller.getSettings().adsRenderingSettings)for(var t in this.controller.getSettings().adsRenderingSettings)""!==t&&(this.adsRenderingSettings[t]=this.controller.getSettings().adsRenderingSettings[t])},o.prototype.onAdError=function(t){var e=void 0!==t.getError?t.getError():t.stack;window.console.warn("Ad error: "+e),this.adsManager.destroy(),this.controller.onAdError(t),this.adsActive=!1,this.adPlaying=!1},o.prototype.onAdBreakReady=function(t){this.adBreakReadyListener(t)},o.prototype.onContentPauseRequested=function(t){this.adsActive=!0,this.adPlaying=!0,this.controller.onAdBreakStart(t)},o.prototype.onContentResumeRequested=function(t){this.adsActive=!1,this.adPlaying=!1,this.controller.onAdBreakEnd()},o.prototype.onAllAdsCompleted=function(t){this.allAdsCompleted=!0,this.controller.onAllAdsCompleted()},o.prototype.onAdLoaded=function(t){t.getAd().isLinear()||(this.controller.onNonLinearAdLoad(),this.controller.playContent())},o.prototype.onAdStarted=function(t){this.currentAd=t.getAd(),this.currentAd.isLinear()?(this.adTrackingTimer=setInterval(this.onAdPlayheadTrackerInterval.bind(this),250),this.controller.onLinearAdStart()):this.controller.onNonLinearAdStart()},o.prototype.onAdPaused=function(){this.controller.onAdsPaused()},o.prototype.onAdResumed=function(t){this.controller.onAdsResumed()},o.prototype.onAdComplete=function(){this.currentAd.isLinear()&&clearInterval(this.adTrackingTimer)},o.prototype.onAdLog=function(t){this.controller.onAdLog(t)},o.prototype.onAdPlayheadTrackerInterval=function(){var t=this.adsManager.getRemainingTime(),e=this.currentAd.getDuration(),i=e-t;i=i>0?i:0;var n=0,s=void 0;this.currentAd.getAdPodInfo()&&(s=this.currentAd.getAdPodInfo().getAdPosition(),n=this.currentAd.getAdPodInfo().getTotalAds()),this.controller.onAdPlayheadUpdated(i,t,e,s,n)},o.prototype.onContentComplete=function(){this.adsLoader&&(this.adsLoader.contentComplete(),this.contentCompleteCalled=!0),this.adsManager&&this.adsManager.getCuePoints()&&!this.adsManager.getCuePoints().includes(-1)&&this.controller.onNoPostroll(),this.allAdsCompleted&&this.controller.onContentAndAdsCompleted()},o.prototype.onPlayerDisposed=function(){this.adTrackingTimer&&clearInterval(this.adTrackingTimer),this.adsManager&&(this.adsManager.destroy(),this.adsManager=null)},o.prototype.onPlayerReadyForPreroll=function(){if(this.autoPlayAdBreaks){this.initAdsManager();try{this.controller.showAdContainer(),this.adsManager.setVolume(this.controller.getPlayerVolume()),this.adsManager.start()}catch(t){this.onAdError(t)}}},o.prototype.onPlayerReady=function(){this.initAdObjects(),(this.controller.getSettings().adTagUrl||this.controller.getSettings().adsResponse)&&this.requestAds()},o.prototype.onPlayerEnterFullscreen=function(){this.adsManager&&this.adsManager.resize(window.screen.width,window.screen.height,google.ima.ViewMode.FULLSCREEN)},o.prototype.onPlayerExitFullscreen=function(){this.adsManager&&this.adsManager.resize(this.controller.getPlayerWidth(),this.controller.getPlayerHeight(),google.ima.ViewMode.NORMAL)},o.prototype.onPlayerVolumeChanged=function(t){this.adsManager&&this.adsManager.setVolume(t),this.adMuted=0==t},o.prototype.onPlayerResize=function(t,e){this.adsManager&&(this.adsManagerDimensions.width=t,this.adsManagerDimensions.height=e,this.adsManager.resize(t,e,google.ima.ViewMode.NORMAL))},o.prototype.getCurrentAd=function(){return this.currentAd},o.prototype.setAdBreakReadyListener=function(t){this.adBreakReadyListener=t},o.prototype.isAdPlaying=function(){return this.adPlaying},o.prototype.isAdMuted=function(){return this.adMuted},o.prototype.pauseAds=function(){this.adsManager.pause(),this.adPlaying=!1},o.prototype.resumeAds=function(){this.adsManager.resume(),this.adPlaying=!0},o.prototype.unmute=function(){this.adsManager.setVolume(1),this.adMuted=!1},o.prototype.mute=function(){this.adsManager.setVolume(0),this.adMuted=!0},o.prototype.setVolume=function(t){this.adsManager.setVolume(t),this.adMuted=0==t},o.prototype.initializeAdDisplayContainer=function(){this.adDisplayContainer&&(this.adDisplayContainerInitialized||(this.adDisplayContainer.initialize(),this.adDisplayContainerInitialized=!0))},o.prototype.playAdBreak=function(){this.autoPlayAdBreaks||(this.controller.showAdContainer(),this.adsManager.setVolume(this.controller.getPlayerVolume()),this.adsManager.start())},o.prototype.addEventListener=function(t,e){this.adsManager&&this.adsManager.addEventListener(t,e)},o.prototype.getAdsManager=function(){return this.adsManager},o.prototype.reset=function(){this.adsActive=!1,this.adPlaying=!1,this.adTrackingTimer&&clearInterval(this.adTrackingTimer),this.adsManager&&(this.adsManager.destroy(),this.adsManager=null),this.adsLoader&&!this.contentCompleteCalled&&this.adsLoader.contentComplete(),this.contentCompleteCalled=!1,this.allAdsCompleted=!1};var r=function(t,n){this.settings={},this.contentAndAdsEndedListeners=[],this.isMobile=navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPad/i)||navigator.userAgent.match(/Android/i),this.isIos=navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPad/i),this.initWithSettings(n);var s={debug:this.settings.debug,timeout:this.settings.timeout,prerollTimeout:this.settings.prerollTimeout},r=this.extend({},s,n.contribAdsSettings||{});this.playerWrapper=new e(t,r,this),this.adUi=new i(this),this.sdkImpl=new o(this)};r.IMA_DEFAULTS={debug:!1,timeout:5e3,prerollTimeout:1e3,adLabel:"Advertisement",adLabelNofN:"of",showControlsForJSAds:!0},r.prototype.initWithSettings=function(t){this.settings=this.extend({},r.IMA_DEFAULTS,t||{}),this.warnAboutDeprecatedSettings(),this.showCountdown=!0,!1===this.settings.showCountdown&&(this.showCountdown=!1)},r.prototype.warnAboutDeprecatedSettings=function(){var t=this;["adWillAutoplay","adsWillAutoplay","adWillPlayMuted","adsWillPlayMuted"].forEach(function(e){void 0!==t.settings[e]&&console.warn("WARNING: videojs.ima setting "+e+" is deprecated")})},r.prototype.getSettings=function(){return this.settings},r.prototype.getIsMobile=function(){return this.isMobile},r.prototype.getIsIos=function(){return this.isIos},r.prototype.injectAdContainerDiv=function(t){this.playerWrapper.injectAdContainerDiv(t)},r.prototype.getAdContainerDiv=function(){return this.adUi.getAdContainerDiv()},r.prototype.getContentPlayer=function(){return this.playerWrapper.getContentPlayer()},r.prototype.getContentPlayheadTracker=function(){return this.playerWrapper.getContentPlayheadTracker()},r.prototype.requestAds=function(){this.sdkImpl.requestAds()},r.prototype.setSetting=function(t,e){this.settings[t]=e},r.prototype.onErrorLoadingAds=function(t){this.adUi.onAdError(),this.playerWrapper.onAdError(t)},r.prototype.onAdPlayPauseClick=function(){this.sdkImpl.isAdPlaying()?(this.adUi.onAdsPaused(),this.sdkImpl.pauseAds()):(this.adUi.onAdsPlaying(),this.sdkImpl.resumeAds())},r.prototype.onAdMuteClick=function(){this.sdkImpl.isAdMuted()?(this.playerWrapper.unmute(),this.adUi.unmute(),this.sdkImpl.unmute()):(this.playerWrapper.mute(),this.adUi.mute(),this.sdkImpl.mute())},r.prototype.setVolume=function(t){this.playerWrapper.setVolume(t),this.sdkImpl.setVolume(t)},r.prototype.getPlayerVolume=function(){return this.playerWrapper.getVolume()},r.prototype.toggleFullscreen=function(){this.playerWrapper.toggleFullscreen()},r.prototype.onAdError=function(t){this.adUi.onAdError(),this.playerWrapper.onAdError(t)},r.prototype.onAdBreakStart=function(t){this.playerWrapper.onAdBreakStart(),this.adUi.onAdBreakStart(t)},r.prototype.showAdContainer=function(){this.adUi.showAdContainer()},r.prototype.onAdBreakEnd=function(){this.playerWrapper.onAdBreakEnd(),this.adUi.onAdBreakEnd()},r.prototype.onAllAdsCompleted=function(){this.adUi.onAllAdsCompleted(),this.playerWrapper.onAllAdsCompleted()},r.prototype.onAdsPaused=function(){this.adUi.onAdsPaused()},r.prototype.onAdsResumed=function(){this.adUi.onAdsResumed()},r.prototype.onAdPlayheadUpdated=function(t,e,i,n,s){this.adUi.updateAdUi(t,e,i,n,s)},r.prototype.onAdLog=function(t){this.playerWrapper.onAdLog(t)},r.prototype.getCurrentAd=function(){return this.sdkImpl.getCurrentAd()},r.prototype.playContent=function(){this.playerWrapper.play()},r.prototype.onLinearAdStart=function(){this.adUi.onLinearAdStart(),this.playerWrapper.onAdStart()},r.prototype.onNonLinearAdLoad=function(){this.adUi.onNonLinearAdLoad()},r.prototype.onNonLinearAdStart=function(){this.adUi.onNonLinearAdLoad(),this.playerWrapper.onAdStart()},r.prototype.getPlayerWidth=function(){return this.playerWrapper.getPlayerWidth()},r.prototype.getPlayerHeight=function(){return this.playerWrapper.getPlayerHeight()},r.prototype.onAdsReady=function(){this.playerWrapper.onAdsReady()},r.prototype.onPlayerResize=function(t,e){this.sdkImpl.onPlayerResize(t,e)},r.prototype.onContentComplete=function(){this.sdkImpl.onContentComplete()},r.prototype.onNoPostroll=function(){this.playerWrapper.onNoPostroll()},r.prototype.onContentAndAdsCompleted=function(){for(var t in this.contentAndAdsEndedListeners)"function"==typeof this.contentAndAdsEndedListeners[t]&&this.contentAndAdsEndedListeners[t]()},r.prototype.onPlayerDisposed=function(){this.contentAndAdsEndedListeners=[],this.sdkImpl.onPlayerDisposed()},r.prototype.onPlayerReadyForPreroll=function(){this.sdkImpl.onPlayerReadyForPreroll()},r.prototype.onPlayerReady=function(){this.sdkImpl.onPlayerReady()},r.prototype.onPlayerEnterFullscreen=function(){this.adUi.onPlayerEnterFullscreen(),this.sdkImpl.onPlayerEnterFullscreen()},r.prototype.onPlayerExitFullscreen=function(){this.adUi.onPlayerExitFullscreen(),this.sdkImpl.onPlayerExitFullscreen()},r.prototype.onPlayerVolumeChanged=function(t){this.adUi.onPlayerVolumeChanged(t),this.sdkImpl.onPlayerVolumeChanged(t)},r.prototype.setContentWithAdTag=function(t,e){this.reset(),this.settings.adTagUrl=e||this.settings.adTagUrl,this.playerWrapper.changeSource(t)},r.prototype.setContentWithAdsResponse=function(t,e){this.reset(),this.settings.adsResponse=e||this.settings.adsResponse,this.playerWrapper.changeSource(t)},r.prototype.setContentWithAdsRequest=function(t,e){this.reset(),this.settings.adsRequest=e||this.settings.adsRequest,this.playerWrapper.changeSource(t)},r.prototype.reset=function(){this.sdkImpl.reset(),this.playerWrapper.reset(),this.adUi.reset()},r.prototype.addContentEndedListener=function(t){this.playerWrapper.addContentEndedListener(t)},r.prototype.addContentAndAdsEndedListener=function(t){this.contentAndAdsEndedListeners.push(t)},r.prototype.setAdBreakReadyListener=function(t){this.sdkImpl.setAdBreakReadyListener(t)},r.prototype.setShowCountdown=function(t){this.adUi.setShowCountdown(t),this.showCountdown=t,this.countdownDiv.style.display=this.showCountdown?"block":"none"},r.prototype.initializeAdDisplayContainer=function(){this.sdkImpl.initializeAdDisplayContainer()},r.prototype.playAdBreak=function(){this.sdkImpl.playAdBreak()},r.prototype.addEventListener=function(t,e){this.sdkImpl.addEventListener(t,e)},r.prototype.getAdsManager=function(){return this.sdkImpl.getAdsManager()},r.prototype.getPlayerId=function(){return this.playerWrapper.getPlayerId()},r.prototype.changeAdTag=function(t){this.reset(),this.settings.adTagUrl=t},r.prototype.pauseAd=function(){this.adUi.onAdsPaused(),this.sdkImpl.pauseAds()},r.prototype.resumeAd=function(){this.adUi.onAdsPlaying(),this.sdkImpl.resumeAds()},r.prototype.adsWillAutoplay=function(){return void 0!==this.settings.adsWillAutoplay?this.settings.adsWillAutoplay:void 0!==this.settings.adWillAutoplay?this.settings.adWillAutoplay:!!this.playerWrapper.getPlayerOptions().autoplay},r.prototype.adsWillPlayMuted=function(){return void 0!==this.settings.adsWillPlayMuted?this.settings.adsWillPlayMuted:void 0!==this.settings.adWillPlayMuted?this.settings.adWillPlayMuted:void 0!==this.playerWrapper.getPlayerOptions().muted?this.playerWrapper.getPlayerOptions().muted:0==this.playerWrapper.getVolume()},r.prototype.triggerPlayerEvent=function(t,e){this.playerWrapper.triggerPlayerEvent(t,e)},r.prototype.extend=function(t){for(var e=void 0,i=void 0,n=void 0,s=arguments.length,o=Array(s>1?s-1:0),r=1;rthis.seekCheckInterval+this.seekThreshold?this.contentPlayheadTracker.seeking=!0:this.contentPlayheadTracker.seeking=!1,this.contentPlayheadTracker.previousTime=this.vjsPlayer.currentTime()},e.prototype.checkForResize=function(){var t=this.getPlayerWidth(),e=this.getPlayerHeight();t==this.vjsPlayerDimensions.width&&e==this.vjsPlayerDimensions.height||(this.vjsPlayerDimensions.width=t,this.vjsPlayerDimensions.height=e,this.controller.onPlayerResize(t,e))},e.prototype.localContentEndedListener=function(){for(var t in this.contentComplete||(this.contentComplete=!0,this.controller.onContentComplete()),this.contentEndedListeners)"function"==typeof this.contentEndedListeners[t]&&this.contentEndedListeners[t]();clearInterval(this.updateTimeIntervalHandle),clearInterval(this.seekCheckIntervalHandle),clearInterval(this.resizeCheckIntervalHandle),this.vjsPlayer.el()&&this.vjsPlayer.one("play",this.setUpPlayerIntervals.bind(this))},e.prototype.onNoPostroll=function(){this.vjsPlayer.trigger("nopostroll")},e.prototype.playerDisposedListener=function(){this.contentEndedListeners=[],this.controller.onPlayerDisposed(),this.contentComplete=!0,this.vjsPlayer.off("contentended",this.boundContentEndedListener),this.vjsPlayer.ads.adTimeoutTimeout&&clearTimeout(this.vjsPlayer.ads.adTimeoutTimeout);var t=[this.updateTimeIntervalHandle,this.seekCheckIntervalHandle,this.resizeCheckIntervalHandle];for(var e in t)t[e]&&clearInterval(t[e])},e.prototype.onReadyForPreroll=function(){this.controller.onPlayerReadyForPreroll()},e.prototype.onPlayerReady=function(){this.h5Player=document.getElementById(this.getPlayerId()).getElementsByClassName("vjs-tech")[0],this.h5Player.hasAttribute("autoplay")&&this.controller.setSetting("adWillAutoPlay",!0),this.onVolumeChange(),this.vjsPlayer.on("fullscreenchange",this.onFullscreenChange.bind(this)),this.vjsPlayer.on("volumechange",this.onVolumeChange.bind(this)),this.controller.onPlayerReady()},e.prototype.onFullscreenChange=function(){this.vjsPlayer.isFullscreen()?this.controller.onPlayerEnterFullscreen():this.controller.onPlayerExitFullscreen()},e.prototype.onVolumeChange=function(){var t=this.vjsPlayer.muted()?0:this.vjsPlayer.volume();this.controller.onPlayerVolumeChanged(t)},e.prototype.injectAdContainerDiv=function(t){this.vjsControls.el().parentNode.appendChild(t)},e.prototype.getContentPlayer=function(){return this.h5Player},e.prototype.getVolume=function(){return this.vjsPlayer.muted()?0:this.vjsPlayer.volume()},e.prototype.setVolume=function(t){this.vjsPlayer.volume(t),0==t?this.vjsPlayer.muted(!0):this.vjsPlayer.muted(!1)},e.prototype.unmute=function(){this.vjsPlayer.muted(!1)},e.prototype.mute=function(){this.vjsPlayer.muted(!0)},e.prototype.play=function(){this.vjsPlayer.play()},e.prototype.getPlayerWidth=function(){var t=(getComputedStyle(this.vjsPlayer.el())||{}).width;return t&&0!==parseFloat(t)||(t=(this.vjsPlayer.el().getBoundingClientRect()||{}).width),parseFloat(t)||this.vjsPlayer.width()},e.prototype.getPlayerHeight=function(){var t=(getComputedStyle(this.vjsPlayer.el())||{}).height;return t&&0!==parseFloat(t)||(t=(this.vjsPlayer.el().getBoundingClientRect()||{}).height),parseFloat(t)||this.vjsPlayer.height()},e.prototype.getPlayerOptions=function(){return this.vjsPlayer.options_},e.prototype.getPlayerId=function(){return this.vjsPlayer.id()},e.prototype.toggleFullscreen=function(){this.vjsPlayer.isFullscreen()?this.vjsPlayer.exitFullscreen():this.vjsPlayer.requestFullscreen()},e.prototype.getContentPlayheadTracker=function(){return this.contentPlayheadTracker},e.prototype.onAdError=function(t){this.vjsControls.show();var e=void 0!==t.getError?t.getError():t.stack;this.vjsPlayer.trigger({type:"adserror",data:{AdError:e,AdErrorEvent:t}})},e.prototype.onAdLog=function(t){var e=t.getAdData(),i=void 0!==e.adError?e.adError.getMessage():void 0;this.vjsPlayer.trigger({type:"adslog",data:{AdError:i,AdEvent:t}})},e.prototype.onAdBreakStart=function(){this.contentSource=this.vjsPlayer.currentSrc(),this.contentSourceType=this.vjsPlayer.currentType(),this.vjsPlayer.off("contentended",this.boundContentEndedListener),this.vjsPlayer.ads.startLinearAdMode(),this.vjsControls.hide(),this.vjsPlayer.pause()},e.prototype.onAdBreakEnd=function(){this.vjsPlayer.on("contentended",this.boundContentEndedListener),this.vjsPlayer.ads.inAdBreak()&&this.vjsPlayer.ads.endLinearAdMode(),this.vjsControls.show()},e.prototype.onAdStart=function(){this.vjsPlayer.trigger("ads-ad-started")},e.prototype.onAllAdsCompleted=function(){1==this.contentComplete&&(this.vjsPlayer.currentSrc()!=this.contentSource&&this.vjsPlayer.src({src:this.contentSource,type:this.contentSourceType}),this.controller.onContentAndAdsCompleted())},e.prototype.onAdsReady=function(){this.vjsPlayer.trigger("adsready")},e.prototype.changeSource=function(t){this.vjsPlayer.currentSrc()&&(this.vjsPlayer.currentTime(0),this.vjsPlayer.pause()),t&&this.vjsPlayer.src(t),this.vjsPlayer.one("loadedmetadata",this.seekContentToZero.bind(this))},e.prototype.seekContentToZero=function(){this.vjsPlayer.currentTime(0)},e.prototype.triggerPlayerEvent=function(t,e){this.vjsPlayer.trigger(t,e)},e.prototype.addContentEndedListener=function(t){this.contentEndedListeners.push(t)},e.prototype.reset=function(){this.vjsPlayer.on("contentended",this.boundContentEndedListener),this.vjsControls.show(),this.vjsPlayer.ads.inAdBreak()&&this.vjsPlayer.ads.endLinearAdMode(),this.contentPlayheadTracker.currentTime=0,this.contentComplete=!1};var i=function(t){this.controller=t,this.adContainerDiv=document.createElement("div"),this.controlsDiv=document.createElement("div"),this.countdownDiv=document.createElement("div"),this.seekBarDiv=document.createElement("div"),this.progressDiv=document.createElement("div"),this.playPauseDiv=document.createElement("div"),this.muteDiv=document.createElement("div"),this.sliderDiv=document.createElement("div"),this.sliderLevelDiv=document.createElement("div"),this.fullscreenDiv=document.createElement("div"),this.boundOnMouseUp=this.onMouseUp.bind(this),this.boundOnMouseMove=this.onMouseMove.bind(this),this.adPlayheadTracker={currentTime:0,duration:0,isPod:!1,adPosition:0,totalAds:0},this.controlPrefix=this.controller.getPlayerId()+"_",this.showCountdown=!0,!1===this.controller.getSettings().showCountdown&&(this.showCountdown=!1),this.createAdContainer()};i.prototype.createAdContainer=function(){this.assignControlAttributes(this.adContainerDiv,"ima-ad-container"),this.adContainerDiv.style.position="absolute",this.adContainerDiv.style.zIndex=1111,this.adContainerDiv.addEventListener("mouseenter",this.showAdControls.bind(this),!1),this.adContainerDiv.addEventListener("mouseleave",this.hideAdControls.bind(this),!1),this.createControls(),this.controller.injectAdContainerDiv(this.adContainerDiv)},i.prototype.createControls=function(){this.assignControlAttributes(this.controlsDiv,"ima-controls-div"),this.controlsDiv.style.width="100%",this.assignControlAttributes(this.countdownDiv,"ima-countdown-div"),this.countdownDiv.innerHTML=this.controller.getSettings().adLabel,this.countdownDiv.style.display=this.showCountdown?"block":"none",this.assignControlAttributes(this.seekBarDiv,"ima-seek-bar-div"),this.seekBarDiv.style.width="100%",this.assignControlAttributes(this.progressDiv,"ima-progress-div"),this.assignControlAttributes(this.playPauseDiv,"ima-play-pause-div"),this.addClass(this.playPauseDiv,"ima-playing"),this.playPauseDiv.addEventListener("click",this.onAdPlayPauseClick.bind(this),!1),this.assignControlAttributes(this.muteDiv,"ima-mute-div"),this.addClass(this.muteDiv,"ima-non-muted"),this.muteDiv.addEventListener("click",this.onAdMuteClick.bind(this),!1),this.assignControlAttributes(this.sliderDiv,"ima-slider-div"),this.sliderDiv.addEventListener("mousedown",this.onAdVolumeSliderMouseDown.bind(this),!1),this.controller.getIsIos()&&(this.sliderDiv.style.display="none"),this.assignControlAttributes(this.sliderLevelDiv,"ima-slider-level-div"),this.assignControlAttributes(this.fullscreenDiv,"ima-fullscreen-div"),this.addClass(this.fullscreenDiv,"ima-non-fullscreen"),this.fullscreenDiv.addEventListener("click",this.onAdFullscreenClick.bind(this),!1),this.adContainerDiv.appendChild(this.controlsDiv),this.controlsDiv.appendChild(this.countdownDiv),this.controlsDiv.appendChild(this.seekBarDiv),this.controlsDiv.appendChild(this.playPauseDiv),this.controlsDiv.appendChild(this.muteDiv),this.controlsDiv.appendChild(this.sliderDiv),this.controlsDiv.appendChild(this.fullscreenDiv),this.seekBarDiv.appendChild(this.progressDiv),this.sliderDiv.appendChild(this.sliderLevelDiv)},i.prototype.onAdPlayPauseClick=function(){this.controller.onAdPlayPauseClick()},i.prototype.onAdMuteClick=function(){this.controller.onAdMuteClick()},i.prototype.onAdFullscreenClick=function(){this.controller.toggleFullscreen()},i.prototype.onAdsPaused=function(){this.addClass(this.playPauseDiv,"ima-paused"),this.removeClass(this.playPauseDiv,"ima-playing"),this.showAdControls()},i.prototype.onAdsResumed=function(){this.onAdsPlaying(),this.showAdControls()},i.prototype.onAdsPlaying=function(){this.addClass(this.playPauseDiv,"ima-playing"),this.removeClass(this.playPauseDiv,"ima-paused")},i.prototype.updateAdUi=function(t,e,i,n,s){var o=Math.floor(e/60),r=Math.floor(e%60);r.toString().length<2&&(r="0"+r);var a=": ";s>1&&(a=" ("+n+" "+this.controller.getSettings().adLabelNofN+" "+s+"): "),this.countdownDiv.innerHTML=this.controller.getSettings().adLabel+a+o+":"+r;var d=100*(t/i);this.progressDiv.style.width=d+"%"},i.prototype.unmute=function(){this.addClass(this.muteDiv,"ima-non-muted"),this.removeClass(this.muteDiv,"ima-muted"),this.sliderLevelDiv.style.width=100*this.controller.getPlayerVolume()+"%"},i.prototype.mute=function(){this.addClass(this.muteDiv,"ima-muted"),this.removeClass(this.muteDiv,"ima-non-muted"),this.sliderLevelDiv.style.width="0%"},i.prototype.onAdVolumeSliderMouseDown=function(){document.addEventListener("mouseup",this.boundOnMouseUp,!1),document.addEventListener("mousemove",this.boundOnMouseMove,!1)},i.prototype.onMouseMove=function(t){this.changeVolume(t)},i.prototype.onMouseUp=function(t){this.changeVolume(t),document.removeEventListener("mouseup",this.boundOnMouseUp),document.removeEventListener("mousemove",this.boundOnMouseMove)},i.prototype.changeVolume=function(t){var e=(t.clientX-this.sliderDiv.getBoundingClientRect().left)/this.sliderDiv.offsetWidth;e*=100,e=Math.min(Math.max(e,0),100),this.sliderLevelDiv.style.width=e+"%",0==this.percent?(this.addClass(this.muteDiv,"ima-muted"),this.removeClass(this.muteDiv,"ima-non-muted")):(this.addClass(this.muteDiv,"ima-non-muted"),this.removeClass(this.muteDiv,"ima-muted")),this.controller.setVolume(e/100)},i.prototype.showAdContainer=function(){this.adContainerDiv.style.display="block"},i.prototype.hideAdContainer=function(){this.adContainerDiv.style.display="none"},i.prototype.reset=function(){this.hideAdContainer()},i.prototype.onAdError=function(){this.hideAdContainer()},i.prototype.onAdBreakStart=function(t){this.showAdContainer(),"application/javascript"!==t.getAd().getContentType()||this.controller.getSettings().showControlsForJSAds?this.controlsDiv.style.display="block":this.controlsDiv.style.display="none",this.onAdsPlaying(),this.hideAdControls()},i.prototype.onAdBreakEnd=function(){var t=this.controller.getCurrentAd();(null==t||t.isLinear())&&this.hideAdContainer(),this.controlsDiv.style.display="none",this.countdownDiv.innerHTML=""},i.prototype.onAllAdsCompleted=function(){this.hideAdContainer()},i.prototype.onLinearAdStart=function(){this.removeClass(this.adContainerDiv,"bumpable-ima-ad-container")},i.prototype.onNonLinearAdLoad=function(){this.adContainerDiv.style.display="block",this.addClass(this.adContainerDiv,"bumpable-ima-ad-container")},i.prototype.onPlayerEnterFullscreen=function(){this.addClass(this.fullscreenDiv,"ima-fullscreen"),this.removeClass(this.fullscreenDiv,"ima-non-fullscreen")},i.prototype.onPlayerExitFullscreen=function(){this.addClass(this.fullscreenDiv,"ima-non-fullscreen"),this.removeClass(this.fullscreenDiv,"ima-fullscreen")},i.prototype.onPlayerVolumeChanged=function(t){0==t?(this.addClass(this.muteDiv,"ima-muted"),this.removeClass(this.muteDiv,"ima-non-muted"),this.sliderLevelDiv.style.width="0%"):(this.addClass(this.muteDiv,"ima-non-muted"),this.removeClass(this.muteDiv,"ima-muted"),this.sliderLevelDiv.style.width=100*t+"%")},i.prototype.showAdControls=function(){this.addClass(this.controlsDiv,"ima-controls-div-showing"),this.playPauseDiv.style.display="block",this.muteDiv.style.display="block",this.fullscreenDiv.style.display="block",this.controller.getIsIos()||(this.sliderDiv.style.display="block")},i.prototype.hideAdControls=function(){this.removeClass(this.controlsDiv,"ima-controls-div-showing"),this.playPauseDiv.style.display="none",this.muteDiv.style.display="none",this.sliderDiv.style.display="none",this.fullscreenDiv.style.display="none"},i.prototype.assignControlAttributes=function(t,e){t.id=this.controlPrefix+e,t.className=this.controlPrefix+e+" "+e},i.prototype.getClassRegexp=function(t){return new RegExp("(^|[^A-Za-z-])"+t+"((?![A-Za-z-])|$)","gi")},i.prototype.elementHasClass=function(t,e){return this.getClassRegexp(e).test(t.className)},i.prototype.addClass=function(t,e){t.className=t.className.trim()+" "+e},i.prototype.removeClass=function(t,e){var i=this.getClassRegexp(e);t.className=t.className.trim().replace(i,"")},i.prototype.getAdContainerDiv=function(){return this.adContainerDiv},i.prototype.setShowCountdown=function(t){this.showCountdown=t,this.countdownDiv.style.display=this.showCountdown?"block":"none"};var n="1.6.1",s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=function(t){this.controller=t,this.adDisplayContainer=null,this.adDisplayContainerInitialized=!1,this.adsLoader=null,this.adsManager=null,this.adsRenderingSettings=null,this.adsResponse=null,this.currentAd=null,this.adTrackingTimer=null,this.allAdsCompleted=!1,this.adsActive=!1,this.adPlaying=!1,this.adMuted=!1,this.adBreakReadyListener=void 0,this.contentCompleteCalled=!1,this.adsManagerDimensions={width:0,height:0},this.autoPlayAdBreaks=!0,!1===this.controller.getSettings().autoPlayAdBreaks&&(this.autoPlayAdBreaks=!1),this.controller.getSettings().locale&&google.ima.settings.setLocale(this.controller.getSettings().locale),this.controller.getSettings().disableFlashAds&&google.ima.settings.setDisableFlashAds(this.controller.getSettings().disableFlashAds),this.controller.getSettings().disableCustomPlaybackForIOS10Plus&&google.ima.settings.setDisableCustomPlaybackForIOS10Plus(this.controller.getSettings().disableCustomPlaybackForIOS10Plus)};o.prototype.initAdObjects=function(){this.adDisplayContainer=new google.ima.AdDisplayContainer(this.controller.getAdContainerDiv(),this.controller.getContentPlayer()),this.adsLoader=new google.ima.AdsLoader(this.adDisplayContainer),this.adsLoader.getSettings().setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.ENABLED),0==this.controller.getSettings().vpaidAllowed&&this.adsLoader.getSettings().setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.DISABLED),this.controller.getSettings().vpaidMode&&this.adsLoader.getSettings().setVpaidMode(this.controller.getSettings().vpaidMode),this.controller.getSettings().locale&&this.adsLoader.getSettings().setLocale(this.controller.getSettings().locale),this.controller.getSettings().numRedirects&&this.adsLoader.getSettings().setNumRedirects(this.controller.getSettings().numRedirects),this.adsLoader.getSettings().setPlayerType("videojs-ima"),this.adsLoader.getSettings().setPlayerVersion(n),this.adsLoader.getSettings().setAutoPlayAdBreaks(this.autoPlayAdBreaks),this.adsLoader.addEventListener(google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.onAdsManagerLoaded.bind(this),!1),this.adsLoader.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,this.onAdsLoaderError.bind(this),!1)},o.prototype.requestAds=function(){var t=new google.ima.AdsRequest;this.controller.getSettings().adTagUrl?t.adTagUrl=this.controller.getSettings().adTagUrl:t.adsResponse=this.controller.getSettings().adsResponse,this.controller.getSettings().forceNonLinearFullSlot&&(t.forceNonLinearFullSlot=!0),this.controller.getSettings().vastLoadTimeout&&(t.vastLoadTimeout=this.controller.getSettings().vastLoadTimeout),t.linearAdSlotWidth=this.controller.getPlayerWidth(),t.linearAdSlotHeight=this.controller.getPlayerHeight(),t.nonLinearAdSlotWidth=this.controller.getSettings().nonLinearWidth||this.controller.getPlayerWidth(),t.nonLinearAdSlotHeight=this.controller.getSettings().nonLinearHeight||this.controller.getPlayerHeight(),t.setAdWillAutoPlay(this.controller.adsWillAutoplay()),t.setAdWillPlayMuted(this.controller.adsWillPlayMuted());var e=this.controller.getSettings().adsRequest;e&&"object"===(void 0===e?"undefined":s(e))&&Object.keys(e).forEach(function(i){t[i]=e[i]}),this.adsLoader.requestAds(t),this.controller.triggerPlayerEvent("ads-request",t)},o.prototype.onAdsManagerLoaded=function(t){this.createAdsRenderingSettings(),this.adsManager=t.getAdsManager(this.controller.getContentPlayheadTracker(),this.adsRenderingSettings),this.adsManager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,this.onAdError.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.AD_BREAK_READY,this.onAdBreakReady.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,this.onContentPauseRequested.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,this.onContentResumeRequested.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.ALL_ADS_COMPLETED,this.onAllAdsCompleted.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.LOADED,this.onAdLoaded.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.STARTED,this.onAdStarted.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.COMPLETE,this.onAdComplete.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.SKIPPED,this.onAdComplete.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.LOG,this.onAdLog.bind(this)),this.controller.getIsMobile()&&(this.adsManager.addEventListener(google.ima.AdEvent.Type.PAUSED,this.onAdPaused.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.RESUMED,this.onAdResumed.bind(this))),this.autoPlayAdBreaks||this.initAdsManager(),this.controller.onAdsReady(),this.controller.getSettings().adsManagerLoadedCallback&&this.controller.getSettings().adsManagerLoadedCallback()},o.prototype.onAdsLoaderError=function(t){window.console.warn("AdsLoader error: "+t.getError()),this.controller.onErrorLoadingAds(t),this.adsManager&&this.adsManager.destroy()},o.prototype.initAdsManager=function(){try{var t=this.controller.getPlayerWidth(),e=this.controller.getPlayerHeight();this.adsManagerDimensions.width=t,this.adsManagerDimensions.height=e,this.adsManager.init(t,e,google.ima.ViewMode.NORMAL),this.adsManager.setVolume(this.controller.getPlayerVolume()),this.initializeAdDisplayContainer()}catch(t){this.onAdError(t)}},o.prototype.createAdsRenderingSettings=function(){if(this.adsRenderingSettings=new google.ima.AdsRenderingSettings,this.adsRenderingSettings.restoreCustomPlaybackStateOnAdBreakComplete=!0,this.controller.getSettings().adsRenderingSettings)for(var t in this.controller.getSettings().adsRenderingSettings)""!==t&&(this.adsRenderingSettings[t]=this.controller.getSettings().adsRenderingSettings[t])},o.prototype.onAdError=function(t){var e=void 0!==t.getError?t.getError():t.stack;window.console.warn("Ad error: "+e),this.adsManager.destroy(),this.controller.onAdError(t),this.adsActive=!1,this.adPlaying=!1},o.prototype.onAdBreakReady=function(t){this.adBreakReadyListener(t)},o.prototype.onContentPauseRequested=function(t){this.adsActive=!0,this.adPlaying=!0,this.controller.onAdBreakStart(t)},o.prototype.onContentResumeRequested=function(t){this.adsActive=!1,this.adPlaying=!1,this.controller.onAdBreakEnd()},o.prototype.onAllAdsCompleted=function(t){this.allAdsCompleted=!0,this.controller.onAllAdsCompleted()},o.prototype.onAdLoaded=function(t){t.getAd().isLinear()||(this.controller.onNonLinearAdLoad(),this.controller.playContent())},o.prototype.onAdStarted=function(t){this.currentAd=t.getAd(),this.currentAd.isLinear()?(this.adTrackingTimer=setInterval(this.onAdPlayheadTrackerInterval.bind(this),250),this.controller.onLinearAdStart()):this.controller.onNonLinearAdStart()},o.prototype.onAdPaused=function(){this.controller.onAdsPaused()},o.prototype.onAdResumed=function(t){this.controller.onAdsResumed()},o.prototype.onAdComplete=function(){this.currentAd.isLinear()&&clearInterval(this.adTrackingTimer)},o.prototype.onAdLog=function(t){this.controller.onAdLog(t)},o.prototype.onAdPlayheadTrackerInterval=function(){var t=this.adsManager.getRemainingTime(),e=this.currentAd.getDuration(),i=e-t;i=i>0?i:0;var n=0,s=void 0;this.currentAd.getAdPodInfo()&&(s=this.currentAd.getAdPodInfo().getAdPosition(),n=this.currentAd.getAdPodInfo().getTotalAds()),this.controller.onAdPlayheadUpdated(i,t,e,s,n)},o.prototype.onContentComplete=function(){this.adsLoader&&(this.adsLoader.contentComplete(),this.contentCompleteCalled=!0),this.adsManager&&this.adsManager.getCuePoints()&&!this.adsManager.getCuePoints().includes(-1)&&this.controller.onNoPostroll(),this.allAdsCompleted&&this.controller.onContentAndAdsCompleted()},o.prototype.onPlayerDisposed=function(){this.adTrackingTimer&&clearInterval(this.adTrackingTimer),this.adsManager&&(this.adsManager.destroy(),this.adsManager=null)},o.prototype.onPlayerReadyForPreroll=function(){if(this.autoPlayAdBreaks){this.initAdsManager();try{this.controller.showAdContainer(),this.adsManager.setVolume(this.controller.getPlayerVolume()),this.adsManager.start()}catch(t){this.onAdError(t)}}},o.prototype.onPlayerReady=function(){this.initAdObjects(),(this.controller.getSettings().adTagUrl||this.controller.getSettings().adsResponse)&&this.requestAds()},o.prototype.onPlayerEnterFullscreen=function(){this.adsManager&&this.adsManager.resize(window.screen.width,window.screen.height,google.ima.ViewMode.FULLSCREEN)},o.prototype.onPlayerExitFullscreen=function(){this.adsManager&&this.adsManager.resize(this.controller.getPlayerWidth(),this.controller.getPlayerHeight(),google.ima.ViewMode.NORMAL)},o.prototype.onPlayerVolumeChanged=function(t){this.adsManager&&this.adsManager.setVolume(t),this.adMuted=0==t},o.prototype.onPlayerResize=function(t,e){this.adsManager&&(this.adsManagerDimensions.width=t,this.adsManagerDimensions.height=e,this.adsManager.resize(t,e,google.ima.ViewMode.NORMAL))},o.prototype.getCurrentAd=function(){return this.currentAd},o.prototype.setAdBreakReadyListener=function(t){this.adBreakReadyListener=t},o.prototype.isAdPlaying=function(){return this.adPlaying},o.prototype.isAdMuted=function(){return this.adMuted},o.prototype.pauseAds=function(){this.adsManager.pause(),this.adPlaying=!1},o.prototype.resumeAds=function(){this.adsManager.resume(),this.adPlaying=!0},o.prototype.unmute=function(){this.adsManager.setVolume(1),this.adMuted=!1},o.prototype.mute=function(){this.adsManager.setVolume(0),this.adMuted=!0},o.prototype.setVolume=function(t){this.adsManager.setVolume(t),this.adMuted=0==t},o.prototype.initializeAdDisplayContainer=function(){this.adDisplayContainer&&(this.adDisplayContainerInitialized||(this.adDisplayContainer.initialize(),this.adDisplayContainerInitialized=!0))},o.prototype.playAdBreak=function(){this.autoPlayAdBreaks||(this.controller.showAdContainer(),this.adsManager.setVolume(this.controller.getPlayerVolume()),this.adsManager.start())},o.prototype.addEventListener=function(t,e){this.adsManager&&this.adsManager.addEventListener(t,e)},o.prototype.getAdsManager=function(){return this.adsManager},o.prototype.reset=function(){this.adsActive=!1,this.adPlaying=!1,this.adTrackingTimer&&clearInterval(this.adTrackingTimer),this.adsManager&&(this.adsManager.destroy(),this.adsManager=null),this.adsLoader&&!this.contentCompleteCalled&&this.adsLoader.contentComplete(),this.contentCompleteCalled=!1,this.allAdsCompleted=!1};var r=function(t,n){this.settings={},this.contentAndAdsEndedListeners=[],this.isMobile=navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPad/i)||navigator.userAgent.match(/Android/i),this.isIos=navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPad/i),this.initWithSettings(n);var s={debug:this.settings.debug,timeout:this.settings.timeout,prerollTimeout:this.settings.prerollTimeout},r=this.extend({},s,n.contribAdsSettings||{});this.playerWrapper=new e(t,r,this),this.adUi=new i(this),this.sdkImpl=new o(this)};r.IMA_DEFAULTS={debug:!1,timeout:5e3,prerollTimeout:1e3,adLabel:"Advertisement",adLabelNofN:"of",showControlsForJSAds:!0},r.prototype.initWithSettings=function(t){this.settings=this.extend({},r.IMA_DEFAULTS,t||{}),this.warnAboutDeprecatedSettings(),this.showCountdown=!0,!1===this.settings.showCountdown&&(this.showCountdown=!1)},r.prototype.warnAboutDeprecatedSettings=function(){var t=this;["adWillAutoplay","adsWillAutoplay","adWillPlayMuted","adsWillPlayMuted"].forEach(function(e){void 0!==t.settings[e]&&console.warn("WARNING: videojs.ima setting "+e+" is deprecated")})},r.prototype.getSettings=function(){return this.settings},r.prototype.getIsMobile=function(){return this.isMobile},r.prototype.getIsIos=function(){return this.isIos},r.prototype.injectAdContainerDiv=function(t){this.playerWrapper.injectAdContainerDiv(t)},r.prototype.getAdContainerDiv=function(){return this.adUi.getAdContainerDiv()},r.prototype.getContentPlayer=function(){return this.playerWrapper.getContentPlayer()},r.prototype.getContentPlayheadTracker=function(){return this.playerWrapper.getContentPlayheadTracker()},r.prototype.requestAds=function(){this.sdkImpl.requestAds()},r.prototype.setSetting=function(t,e){this.settings[t]=e},r.prototype.onErrorLoadingAds=function(t){this.adUi.onAdError(),this.playerWrapper.onAdError(t)},r.prototype.onAdPlayPauseClick=function(){this.sdkImpl.isAdPlaying()?(this.adUi.onAdsPaused(),this.sdkImpl.pauseAds()):(this.adUi.onAdsPlaying(),this.sdkImpl.resumeAds())},r.prototype.onAdMuteClick=function(){this.sdkImpl.isAdMuted()?(this.playerWrapper.unmute(),this.adUi.unmute(),this.sdkImpl.unmute()):(this.playerWrapper.mute(),this.adUi.mute(),this.sdkImpl.mute())},r.prototype.setVolume=function(t){this.playerWrapper.setVolume(t),this.sdkImpl.setVolume(t)},r.prototype.getPlayerVolume=function(){return this.playerWrapper.getVolume()},r.prototype.toggleFullscreen=function(){this.playerWrapper.toggleFullscreen()},r.prototype.onAdError=function(t){this.adUi.onAdError(),this.playerWrapper.onAdError(t)},r.prototype.onAdBreakStart=function(t){this.playerWrapper.onAdBreakStart(),this.adUi.onAdBreakStart(t)},r.prototype.showAdContainer=function(){this.adUi.showAdContainer()},r.prototype.onAdBreakEnd=function(){this.playerWrapper.onAdBreakEnd(),this.adUi.onAdBreakEnd()},r.prototype.onAllAdsCompleted=function(){this.adUi.onAllAdsCompleted(),this.playerWrapper.onAllAdsCompleted()},r.prototype.onAdsPaused=function(){this.adUi.onAdsPaused()},r.prototype.onAdsResumed=function(){this.adUi.onAdsResumed()},r.prototype.onAdPlayheadUpdated=function(t,e,i,n,s){this.adUi.updateAdUi(t,e,i,n,s)},r.prototype.onAdLog=function(t){this.playerWrapper.onAdLog(t)},r.prototype.getCurrentAd=function(){return this.sdkImpl.getCurrentAd()},r.prototype.playContent=function(){this.playerWrapper.play()},r.prototype.onLinearAdStart=function(){this.adUi.onLinearAdStart(),this.playerWrapper.onAdStart()},r.prototype.onNonLinearAdLoad=function(){this.adUi.onNonLinearAdLoad()},r.prototype.onNonLinearAdStart=function(){this.adUi.onNonLinearAdLoad(),this.playerWrapper.onAdStart()},r.prototype.getPlayerWidth=function(){return this.playerWrapper.getPlayerWidth()},r.prototype.getPlayerHeight=function(){return this.playerWrapper.getPlayerHeight()},r.prototype.onAdsReady=function(){this.playerWrapper.onAdsReady()},r.prototype.onPlayerResize=function(t,e){this.sdkImpl.onPlayerResize(t,e)},r.prototype.onContentComplete=function(){this.sdkImpl.onContentComplete()},r.prototype.onNoPostroll=function(){this.playerWrapper.onNoPostroll()},r.prototype.onContentAndAdsCompleted=function(){for(var t in this.contentAndAdsEndedListeners)"function"==typeof this.contentAndAdsEndedListeners[t]&&this.contentAndAdsEndedListeners[t]()},r.prototype.onPlayerDisposed=function(){this.contentAndAdsEndedListeners=[],this.sdkImpl.onPlayerDisposed()},r.prototype.onPlayerReadyForPreroll=function(){this.sdkImpl.onPlayerReadyForPreroll()},r.prototype.onPlayerReady=function(){this.sdkImpl.onPlayerReady()},r.prototype.onPlayerEnterFullscreen=function(){this.adUi.onPlayerEnterFullscreen(),this.sdkImpl.onPlayerEnterFullscreen()},r.prototype.onPlayerExitFullscreen=function(){this.adUi.onPlayerExitFullscreen(),this.sdkImpl.onPlayerExitFullscreen()},r.prototype.onPlayerVolumeChanged=function(t){this.adUi.onPlayerVolumeChanged(t),this.sdkImpl.onPlayerVolumeChanged(t)},r.prototype.setContentWithAdTag=function(t,e){this.reset(),this.settings.adTagUrl=e||this.settings.adTagUrl,this.playerWrapper.changeSource(t)},r.prototype.setContentWithAdsResponse=function(t,e){this.reset(),this.settings.adsResponse=e||this.settings.adsResponse,this.playerWrapper.changeSource(t)},r.prototype.setContentWithAdsRequest=function(t,e){this.reset(),this.settings.adsRequest=e||this.settings.adsRequest,this.playerWrapper.changeSource(t)},r.prototype.reset=function(){this.sdkImpl.reset(),this.playerWrapper.reset(),this.adUi.reset()},r.prototype.addContentEndedListener=function(t){this.playerWrapper.addContentEndedListener(t)},r.prototype.addContentAndAdsEndedListener=function(t){this.contentAndAdsEndedListeners.push(t)},r.prototype.setAdBreakReadyListener=function(t){this.sdkImpl.setAdBreakReadyListener(t)},r.prototype.setShowCountdown=function(t){this.adUi.setShowCountdown(t),this.showCountdown=t,this.countdownDiv.style.display=this.showCountdown?"block":"none"},r.prototype.initializeAdDisplayContainer=function(){this.sdkImpl.initializeAdDisplayContainer()},r.prototype.playAdBreak=function(){this.sdkImpl.playAdBreak()},r.prototype.addEventListener=function(t,e){this.sdkImpl.addEventListener(t,e)},r.prototype.getAdsManager=function(){return this.sdkImpl.getAdsManager()},r.prototype.getPlayerId=function(){return this.playerWrapper.getPlayerId()},r.prototype.changeAdTag=function(t){this.reset(),this.settings.adTagUrl=t},r.prototype.pauseAd=function(){this.adUi.onAdsPaused(),this.sdkImpl.pauseAds()},r.prototype.resumeAd=function(){this.adUi.onAdsPlaying(),this.sdkImpl.resumeAds()},r.prototype.adsWillAutoplay=function(){return void 0!==this.settings.adsWillAutoplay?this.settings.adsWillAutoplay:void 0!==this.settings.adWillAutoplay?this.settings.adWillAutoplay:!!this.playerWrapper.getPlayerOptions().autoplay},r.prototype.adsWillPlayMuted=function(){return void 0!==this.settings.adsWillPlayMuted?this.settings.adsWillPlayMuted:void 0!==this.settings.adWillPlayMuted?this.settings.adWillPlayMuted:void 0!==this.playerWrapper.getPlayerOptions().muted?this.playerWrapper.getPlayerOptions().muted:0==this.playerWrapper.getVolume()},r.prototype.triggerPlayerEvent=function(t,e){this.playerWrapper.triggerPlayerEvent(t,e)},r.prototype.extend=function(t){for(var e=void 0,i=void 0,n=void 0,s=arguments.length,o=Array(s>1?s-1:0),r=1;r>>>>>> f5959c3... Build for samples at v1.6.1 From b76516c4f0616d282870855fa7f6fdf01a1627ed Mon Sep 17 00:00:00 2001 From: Kiro705 Date: Wed, 11 Sep 2019 15:52:58 -0400 Subject: [PATCH 14/22] 1.6.2 --- CHANGELOG.md | 5 +++-- package-lock.json | 2 +- package.json | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2eb7f34d..106d9c81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,10 @@ - -## [1.6.1](https://github.com/googleads/videojs-ima/compare/v1.6.0...v1.6.1) (2019-09-10) + +## [1.6.2](https://github.com/googleads/videojs-ima/compare/v1.6.0...v1.6.2) (2019-09-11) ### Bug Fixes * changed to parseFloat ([2b854a4](https://github.com/googleads/videojs-ima/commit/2b854a4)) +* fixed error in videojs.ima.min.js ([3d4e995](https://github.com/googleads/videojs-ima/commit/3d4e995)) * fixed small errors in Readme update ([18186f9](https://github.com/googleads/videojs-ima/commit/18186f9)) * removed second param from parseFloat ([4b5eef9](https://github.com/googleads/videojs-ima/commit/4b5eef9)) diff --git a/package-lock.json b/package-lock.json index fb269191..5db8847e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "videojs-ima", - "version": "1.6.0", + "version": "1.6.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 92fac0c2..3af1ddce 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "videojs-ima", - "version": "1.6.1", + "version": "1.6.2", "license": "Apache-2.0", "main": "./dist/videojs.ima.js", "module": "./dist/videojs.ima.es.js", From 3768f01bf7fa356e5f17bea3ef043311511e48d1 Mon Sep 17 00:00:00 2001 From: Kiro705 Date: Wed, 11 Sep 2019 15:54:01 -0400 Subject: [PATCH 15/22] Build for samples at v1.6.2 --- dist/videojs.ima.es.js | 11 +++++------ dist/videojs.ima.js | 10 +++++----- dist/videojs.ima.min.js | 2 +- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/dist/videojs.ima.es.js b/dist/videojs.ima.es.js index d26dbf1a..e15423f5 100644 --- a/dist/videojs.ima.es.js +++ b/dist/videojs.ima.es.js @@ -364,11 +364,11 @@ PlayerWrapper.prototype.play = function () { PlayerWrapper.prototype.getPlayerWidth = function () { var width = (getComputedStyle(this.vjsPlayer.el()) || {}).width; - if (!width || parseInt(width, 10) === 0) { + if (!width || parseFloat(width) === 0) { width = (this.vjsPlayer.el().getBoundingClientRect() || {}).width; } - return parseInt(width, 10) || this.vjsPlayer.width(); + return parseFloat(width) || this.vjsPlayer.width(); }; /** @@ -379,11 +379,11 @@ PlayerWrapper.prototype.getPlayerWidth = function () { PlayerWrapper.prototype.getPlayerHeight = function () { var height = (getComputedStyle(this.vjsPlayer.el()) || {}).height; - if (!height || parseInt(height, 10) === 0) { + if (!height || parseFloat(height) === 0) { height = (this.vjsPlayer.el().getBoundingClientRect() || {}).height; } - return parseInt(height, 10) || this.vjsPlayer.height(); + return parseFloat(height) || this.vjsPlayer.height(); }; /** @@ -1102,7 +1102,7 @@ AdUi.prototype.setShowCountdown = function (showCountdownIn) { }; var name = "videojs-ima"; -var version = "1.6.1"; +var version = "1.6.2"; var license = "Apache-2.0"; var main = "./dist/videojs.ima.js"; var module$1 = "./dist/videojs.ima.es.js"; @@ -1360,7 +1360,6 @@ SdkImpl.prototype.onAdsManagerLoaded = function (adsManagerLoadedEvent) { this.adsManager.addEventListener(google.ima.AdEvent.Type.LOADED, this.onAdLoaded.bind(this)); this.adsManager.addEventListener(google.ima.AdEvent.Type.STARTED, this.onAdStarted.bind(this)); - this.adsManager.addEventListener(google.ima.AdEvent.Type.CLICK, this.onAdPaused.bind(this)); this.adsManager.addEventListener(google.ima.AdEvent.Type.COMPLETE, this.onAdComplete.bind(this)); this.adsManager.addEventListener(google.ima.AdEvent.Type.SKIPPED, this.onAdComplete.bind(this)); this.adsManager.addEventListener(google.ima.AdEvent.Type.LOG, this.onAdLog.bind(this)); diff --git a/dist/videojs.ima.js b/dist/videojs.ima.js index 6f5ba5c7..ca8fab88 100644 --- a/dist/videojs.ima.js +++ b/dist/videojs.ima.js @@ -370,11 +370,11 @@ PlayerWrapper.prototype.play = function () { PlayerWrapper.prototype.getPlayerWidth = function () { var width = (getComputedStyle(this.vjsPlayer.el()) || {}).width; - if (!width || parseInt(width, 10) === 0) { + if (!width || parseFloat(width) === 0) { width = (this.vjsPlayer.el().getBoundingClientRect() || {}).width; } - return parseInt(width, 10) || this.vjsPlayer.width(); + return parseFloat(width) || this.vjsPlayer.width(); }; /** @@ -385,11 +385,11 @@ PlayerWrapper.prototype.getPlayerWidth = function () { PlayerWrapper.prototype.getPlayerHeight = function () { var height = (getComputedStyle(this.vjsPlayer.el()) || {}).height; - if (!height || parseInt(height, 10) === 0) { + if (!height || parseFloat(height) === 0) { height = (this.vjsPlayer.el().getBoundingClientRect() || {}).height; } - return parseInt(height, 10) || this.vjsPlayer.height(); + return parseFloat(height) || this.vjsPlayer.height(); }; /** @@ -1108,7 +1108,7 @@ AdUi.prototype.setShowCountdown = function (showCountdownIn) { }; var name = "videojs-ima"; -var version = "1.6.1"; +var version = "1.6.2"; var license = "Apache-2.0"; var main = "./dist/videojs.ima.js"; var module$1 = "./dist/videojs.ima.es.js"; diff --git a/dist/videojs.ima.min.js b/dist/videojs.ima.min.js index d26391e3..fc0c0564 100644 --- a/dist/videojs.ima.min.js +++ b/dist/videojs.ima.min.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("video.js")):"function"==typeof define&&define.amd?define(["video.js"],e):t.videojsIma=e(t.videojs)}(this,function(t){"use strict";t=t&&t.hasOwnProperty("default")?t.default:t;var e=function(t,e,i){this.vjsPlayer=t,this.controller=i,this.contentTrackingTimer=null,this.contentComplete=!1,this.updateTimeIntervalHandle=null,this.updateTimeInterval=1e3,this.seekCheckIntervalHandle=null,this.seekCheckInterval=1e3,this.resizeCheckIntervalHandle=null,this.resizeCheckInterval=250,this.seekThreshold=100,this.contentEndedListeners=[],this.contentSource="",this.contentSourceType="",this.contentPlayheadTracker={currentTime:0,previousTime:0,seeking:!1,duration:0},this.vjsPlayerDimensions={width:this.getPlayerWidth(),height:this.getPlayerHeight()},this.vjsControls=this.vjsPlayer.getChild("controlBar"),this.h5Player=null,this.vjsPlayer.one("play",this.setUpPlayerIntervals.bind(this)),this.boundContentEndedListener=this.localContentEndedListener.bind(this),this.vjsPlayer.on("contentended",this.boundContentEndedListener),this.vjsPlayer.on("dispose",this.playerDisposedListener.bind(this)),this.vjsPlayer.on("readyforpreroll",this.onReadyForPreroll.bind(this)),this.vjsPlayer.ready(this.onPlayerReady.bind(this)),this.vjsPlayer.ads(e)};e.prototype.setUpPlayerIntervals=function(){this.updateTimeIntervalHandle=setInterval(this.updateCurrentTime.bind(this),this.updateTimeInterval),this.seekCheckIntervalHandle=setInterval(this.checkForSeeking.bind(this),this.seekCheckInterval),this.resizeCheckIntervalHandle=setInterval(this.checkForResize.bind(this),this.resizeCheckInterval)},e.prototype.updateCurrentTime=function(){this.contentPlayheadTracker.seeking||(this.contentPlayheadTracker.currentTime=this.vjsPlayer.currentTime())},e.prototype.checkForSeeking=function(){var t=1e3*(this.vjsPlayer.currentTime()-this.contentPlayheadTracker.previousTime);Math.abs(t)>this.seekCheckInterval+this.seekThreshold?this.contentPlayheadTracker.seeking=!0:this.contentPlayheadTracker.seeking=!1,this.contentPlayheadTracker.previousTime=this.vjsPlayer.currentTime()},e.prototype.checkForResize=function(){var t=this.getPlayerWidth(),e=this.getPlayerHeight();t==this.vjsPlayerDimensions.width&&e==this.vjsPlayerDimensions.height||(this.vjsPlayerDimensions.width=t,this.vjsPlayerDimensions.height=e,this.controller.onPlayerResize(t,e))},e.prototype.localContentEndedListener=function(){for(var t in this.contentComplete||(this.contentComplete=!0,this.controller.onContentComplete()),this.contentEndedListeners)"function"==typeof this.contentEndedListeners[t]&&this.contentEndedListeners[t]();clearInterval(this.updateTimeIntervalHandle),clearInterval(this.seekCheckIntervalHandle),clearInterval(this.resizeCheckIntervalHandle),this.vjsPlayer.el()&&this.vjsPlayer.one("play",this.setUpPlayerIntervals.bind(this))},e.prototype.onNoPostroll=function(){this.vjsPlayer.trigger("nopostroll")},e.prototype.playerDisposedListener=function(){this.contentEndedListeners=[],this.controller.onPlayerDisposed(),this.contentComplete=!0,this.vjsPlayer.off("contentended",this.boundContentEndedListener),this.vjsPlayer.ads.adTimeoutTimeout&&clearTimeout(this.vjsPlayer.ads.adTimeoutTimeout);var t=[this.updateTimeIntervalHandle,this.seekCheckIntervalHandle,this.resizeCheckIntervalHandle];for(var e in t)t[e]&&clearInterval(t[e])},e.prototype.onReadyForPreroll=function(){this.controller.onPlayerReadyForPreroll()},e.prototype.onPlayerReady=function(){this.h5Player=document.getElementById(this.getPlayerId()).getElementsByClassName("vjs-tech")[0],this.h5Player.hasAttribute("autoplay")&&this.controller.setSetting("adWillAutoPlay",!0),this.onVolumeChange(),this.vjsPlayer.on("fullscreenchange",this.onFullscreenChange.bind(this)),this.vjsPlayer.on("volumechange",this.onVolumeChange.bind(this)),this.controller.onPlayerReady()},e.prototype.onFullscreenChange=function(){this.vjsPlayer.isFullscreen()?this.controller.onPlayerEnterFullscreen():this.controller.onPlayerExitFullscreen()},e.prototype.onVolumeChange=function(){var t=this.vjsPlayer.muted()?0:this.vjsPlayer.volume();this.controller.onPlayerVolumeChanged(t)},e.prototype.injectAdContainerDiv=function(t){this.vjsControls.el().parentNode.appendChild(t)},e.prototype.getContentPlayer=function(){return this.h5Player},e.prototype.getVolume=function(){return this.vjsPlayer.muted()?0:this.vjsPlayer.volume()},e.prototype.setVolume=function(t){this.vjsPlayer.volume(t),0==t?this.vjsPlayer.muted(!0):this.vjsPlayer.muted(!1)},e.prototype.unmute=function(){this.vjsPlayer.muted(!1)},e.prototype.mute=function(){this.vjsPlayer.muted(!0)},e.prototype.play=function(){this.vjsPlayer.play()},e.prototype.getPlayerWidth=function(){var t=(getComputedStyle(this.vjsPlayer.el())||{}).width;return t&&0!==parseFloat(t)||(t=(this.vjsPlayer.el().getBoundingClientRect()||{}).width),parseFloat(t)||this.vjsPlayer.width()},e.prototype.getPlayerHeight=function(){var t=(getComputedStyle(this.vjsPlayer.el())||{}).height;return t&&0!==parseFloat(t)||(t=(this.vjsPlayer.el().getBoundingClientRect()||{}).height),parseFloat(t)||this.vjsPlayer.height()},e.prototype.getPlayerOptions=function(){return this.vjsPlayer.options_},e.prototype.getPlayerId=function(){return this.vjsPlayer.id()},e.prototype.toggleFullscreen=function(){this.vjsPlayer.isFullscreen()?this.vjsPlayer.exitFullscreen():this.vjsPlayer.requestFullscreen()},e.prototype.getContentPlayheadTracker=function(){return this.contentPlayheadTracker},e.prototype.onAdError=function(t){this.vjsControls.show();var e=void 0!==t.getError?t.getError():t.stack;this.vjsPlayer.trigger({type:"adserror",data:{AdError:e,AdErrorEvent:t}})},e.prototype.onAdLog=function(t){var e=t.getAdData(),i=void 0!==e.adError?e.adError.getMessage():void 0;this.vjsPlayer.trigger({type:"adslog",data:{AdError:i,AdEvent:t}})},e.prototype.onAdBreakStart=function(){this.contentSource=this.vjsPlayer.currentSrc(),this.contentSourceType=this.vjsPlayer.currentType(),this.vjsPlayer.off("contentended",this.boundContentEndedListener),this.vjsPlayer.ads.startLinearAdMode(),this.vjsControls.hide(),this.vjsPlayer.pause()},e.prototype.onAdBreakEnd=function(){this.vjsPlayer.on("contentended",this.boundContentEndedListener),this.vjsPlayer.ads.inAdBreak()&&this.vjsPlayer.ads.endLinearAdMode(),this.vjsControls.show()},e.prototype.onAdStart=function(){this.vjsPlayer.trigger("ads-ad-started")},e.prototype.onAllAdsCompleted=function(){1==this.contentComplete&&(this.vjsPlayer.currentSrc()!=this.contentSource&&this.vjsPlayer.src({src:this.contentSource,type:this.contentSourceType}),this.controller.onContentAndAdsCompleted())},e.prototype.onAdsReady=function(){this.vjsPlayer.trigger("adsready")},e.prototype.changeSource=function(t){this.vjsPlayer.currentSrc()&&(this.vjsPlayer.currentTime(0),this.vjsPlayer.pause()),t&&this.vjsPlayer.src(t),this.vjsPlayer.one("loadedmetadata",this.seekContentToZero.bind(this))},e.prototype.seekContentToZero=function(){this.vjsPlayer.currentTime(0)},e.prototype.triggerPlayerEvent=function(t,e){this.vjsPlayer.trigger(t,e)},e.prototype.addContentEndedListener=function(t){this.contentEndedListeners.push(t)},e.prototype.reset=function(){this.vjsPlayer.on("contentended",this.boundContentEndedListener),this.vjsControls.show(),this.vjsPlayer.ads.inAdBreak()&&this.vjsPlayer.ads.endLinearAdMode(),this.contentPlayheadTracker.currentTime=0,this.contentComplete=!1};var i=function(t){this.controller=t,this.adContainerDiv=document.createElement("div"),this.controlsDiv=document.createElement("div"),this.countdownDiv=document.createElement("div"),this.seekBarDiv=document.createElement("div"),this.progressDiv=document.createElement("div"),this.playPauseDiv=document.createElement("div"),this.muteDiv=document.createElement("div"),this.sliderDiv=document.createElement("div"),this.sliderLevelDiv=document.createElement("div"),this.fullscreenDiv=document.createElement("div"),this.boundOnMouseUp=this.onMouseUp.bind(this),this.boundOnMouseMove=this.onMouseMove.bind(this),this.adPlayheadTracker={currentTime:0,duration:0,isPod:!1,adPosition:0,totalAds:0},this.controlPrefix=this.controller.getPlayerId()+"_",this.showCountdown=!0,!1===this.controller.getSettings().showCountdown&&(this.showCountdown=!1),this.createAdContainer()};i.prototype.createAdContainer=function(){this.assignControlAttributes(this.adContainerDiv,"ima-ad-container"),this.adContainerDiv.style.position="absolute",this.adContainerDiv.style.zIndex=1111,this.adContainerDiv.addEventListener("mouseenter",this.showAdControls.bind(this),!1),this.adContainerDiv.addEventListener("mouseleave",this.hideAdControls.bind(this),!1),this.createControls(),this.controller.injectAdContainerDiv(this.adContainerDiv)},i.prototype.createControls=function(){this.assignControlAttributes(this.controlsDiv,"ima-controls-div"),this.controlsDiv.style.width="100%",this.assignControlAttributes(this.countdownDiv,"ima-countdown-div"),this.countdownDiv.innerHTML=this.controller.getSettings().adLabel,this.countdownDiv.style.display=this.showCountdown?"block":"none",this.assignControlAttributes(this.seekBarDiv,"ima-seek-bar-div"),this.seekBarDiv.style.width="100%",this.assignControlAttributes(this.progressDiv,"ima-progress-div"),this.assignControlAttributes(this.playPauseDiv,"ima-play-pause-div"),this.addClass(this.playPauseDiv,"ima-playing"),this.playPauseDiv.addEventListener("click",this.onAdPlayPauseClick.bind(this),!1),this.assignControlAttributes(this.muteDiv,"ima-mute-div"),this.addClass(this.muteDiv,"ima-non-muted"),this.muteDiv.addEventListener("click",this.onAdMuteClick.bind(this),!1),this.assignControlAttributes(this.sliderDiv,"ima-slider-div"),this.sliderDiv.addEventListener("mousedown",this.onAdVolumeSliderMouseDown.bind(this),!1),this.controller.getIsIos()&&(this.sliderDiv.style.display="none"),this.assignControlAttributes(this.sliderLevelDiv,"ima-slider-level-div"),this.assignControlAttributes(this.fullscreenDiv,"ima-fullscreen-div"),this.addClass(this.fullscreenDiv,"ima-non-fullscreen"),this.fullscreenDiv.addEventListener("click",this.onAdFullscreenClick.bind(this),!1),this.adContainerDiv.appendChild(this.controlsDiv),this.controlsDiv.appendChild(this.countdownDiv),this.controlsDiv.appendChild(this.seekBarDiv),this.controlsDiv.appendChild(this.playPauseDiv),this.controlsDiv.appendChild(this.muteDiv),this.controlsDiv.appendChild(this.sliderDiv),this.controlsDiv.appendChild(this.fullscreenDiv),this.seekBarDiv.appendChild(this.progressDiv),this.sliderDiv.appendChild(this.sliderLevelDiv)},i.prototype.onAdPlayPauseClick=function(){this.controller.onAdPlayPauseClick()},i.prototype.onAdMuteClick=function(){this.controller.onAdMuteClick()},i.prototype.onAdFullscreenClick=function(){this.controller.toggleFullscreen()},i.prototype.onAdsPaused=function(){this.addClass(this.playPauseDiv,"ima-paused"),this.removeClass(this.playPauseDiv,"ima-playing"),this.showAdControls()},i.prototype.onAdsResumed=function(){this.onAdsPlaying(),this.showAdControls()},i.prototype.onAdsPlaying=function(){this.addClass(this.playPauseDiv,"ima-playing"),this.removeClass(this.playPauseDiv,"ima-paused")},i.prototype.updateAdUi=function(t,e,i,n,s){var o=Math.floor(e/60),r=Math.floor(e%60);r.toString().length<2&&(r="0"+r);var a=": ";s>1&&(a=" ("+n+" "+this.controller.getSettings().adLabelNofN+" "+s+"): "),this.countdownDiv.innerHTML=this.controller.getSettings().adLabel+a+o+":"+r;var d=100*(t/i);this.progressDiv.style.width=d+"%"},i.prototype.unmute=function(){this.addClass(this.muteDiv,"ima-non-muted"),this.removeClass(this.muteDiv,"ima-muted"),this.sliderLevelDiv.style.width=100*this.controller.getPlayerVolume()+"%"},i.prototype.mute=function(){this.addClass(this.muteDiv,"ima-muted"),this.removeClass(this.muteDiv,"ima-non-muted"),this.sliderLevelDiv.style.width="0%"},i.prototype.onAdVolumeSliderMouseDown=function(){document.addEventListener("mouseup",this.boundOnMouseUp,!1),document.addEventListener("mousemove",this.boundOnMouseMove,!1)},i.prototype.onMouseMove=function(t){this.changeVolume(t)},i.prototype.onMouseUp=function(t){this.changeVolume(t),document.removeEventListener("mouseup",this.boundOnMouseUp),document.removeEventListener("mousemove",this.boundOnMouseMove)},i.prototype.changeVolume=function(t){var e=(t.clientX-this.sliderDiv.getBoundingClientRect().left)/this.sliderDiv.offsetWidth;e*=100,e=Math.min(Math.max(e,0),100),this.sliderLevelDiv.style.width=e+"%",0==this.percent?(this.addClass(this.muteDiv,"ima-muted"),this.removeClass(this.muteDiv,"ima-non-muted")):(this.addClass(this.muteDiv,"ima-non-muted"),this.removeClass(this.muteDiv,"ima-muted")),this.controller.setVolume(e/100)},i.prototype.showAdContainer=function(){this.adContainerDiv.style.display="block"},i.prototype.hideAdContainer=function(){this.adContainerDiv.style.display="none"},i.prototype.reset=function(){this.hideAdContainer()},i.prototype.onAdError=function(){this.hideAdContainer()},i.prototype.onAdBreakStart=function(t){this.showAdContainer(),"application/javascript"!==t.getAd().getContentType()||this.controller.getSettings().showControlsForJSAds?this.controlsDiv.style.display="block":this.controlsDiv.style.display="none",this.onAdsPlaying(),this.hideAdControls()},i.prototype.onAdBreakEnd=function(){var t=this.controller.getCurrentAd();(null==t||t.isLinear())&&this.hideAdContainer(),this.controlsDiv.style.display="none",this.countdownDiv.innerHTML=""},i.prototype.onAllAdsCompleted=function(){this.hideAdContainer()},i.prototype.onLinearAdStart=function(){this.removeClass(this.adContainerDiv,"bumpable-ima-ad-container")},i.prototype.onNonLinearAdLoad=function(){this.adContainerDiv.style.display="block",this.addClass(this.adContainerDiv,"bumpable-ima-ad-container")},i.prototype.onPlayerEnterFullscreen=function(){this.addClass(this.fullscreenDiv,"ima-fullscreen"),this.removeClass(this.fullscreenDiv,"ima-non-fullscreen")},i.prototype.onPlayerExitFullscreen=function(){this.addClass(this.fullscreenDiv,"ima-non-fullscreen"),this.removeClass(this.fullscreenDiv,"ima-fullscreen")},i.prototype.onPlayerVolumeChanged=function(t){0==t?(this.addClass(this.muteDiv,"ima-muted"),this.removeClass(this.muteDiv,"ima-non-muted"),this.sliderLevelDiv.style.width="0%"):(this.addClass(this.muteDiv,"ima-non-muted"),this.removeClass(this.muteDiv,"ima-muted"),this.sliderLevelDiv.style.width=100*t+"%")},i.prototype.showAdControls=function(){this.addClass(this.controlsDiv,"ima-controls-div-showing"),this.playPauseDiv.style.display="block",this.muteDiv.style.display="block",this.fullscreenDiv.style.display="block",this.controller.getIsIos()||(this.sliderDiv.style.display="block")},i.prototype.hideAdControls=function(){this.removeClass(this.controlsDiv,"ima-controls-div-showing"),this.playPauseDiv.style.display="none",this.muteDiv.style.display="none",this.sliderDiv.style.display="none",this.fullscreenDiv.style.display="none"},i.prototype.assignControlAttributes=function(t,e){t.id=this.controlPrefix+e,t.className=this.controlPrefix+e+" "+e},i.prototype.getClassRegexp=function(t){return new RegExp("(^|[^A-Za-z-])"+t+"((?![A-Za-z-])|$)","gi")},i.prototype.elementHasClass=function(t,e){return this.getClassRegexp(e).test(t.className)},i.prototype.addClass=function(t,e){t.className=t.className.trim()+" "+e},i.prototype.removeClass=function(t,e){var i=this.getClassRegexp(e);t.className=t.className.trim().replace(i,"")},i.prototype.getAdContainerDiv=function(){return this.adContainerDiv},i.prototype.setShowCountdown=function(t){this.showCountdown=t,this.countdownDiv.style.display=this.showCountdown?"block":"none"};var n="1.6.1",s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=function(t){this.controller=t,this.adDisplayContainer=null,this.adDisplayContainerInitialized=!1,this.adsLoader=null,this.adsManager=null,this.adsRenderingSettings=null,this.adsResponse=null,this.currentAd=null,this.adTrackingTimer=null,this.allAdsCompleted=!1,this.adsActive=!1,this.adPlaying=!1,this.adMuted=!1,this.adBreakReadyListener=void 0,this.contentCompleteCalled=!1,this.adsManagerDimensions={width:0,height:0},this.autoPlayAdBreaks=!0,!1===this.controller.getSettings().autoPlayAdBreaks&&(this.autoPlayAdBreaks=!1),this.controller.getSettings().locale&&google.ima.settings.setLocale(this.controller.getSettings().locale),this.controller.getSettings().disableFlashAds&&google.ima.settings.setDisableFlashAds(this.controller.getSettings().disableFlashAds),this.controller.getSettings().disableCustomPlaybackForIOS10Plus&&google.ima.settings.setDisableCustomPlaybackForIOS10Plus(this.controller.getSettings().disableCustomPlaybackForIOS10Plus)};o.prototype.initAdObjects=function(){this.adDisplayContainer=new google.ima.AdDisplayContainer(this.controller.getAdContainerDiv(),this.controller.getContentPlayer()),this.adsLoader=new google.ima.AdsLoader(this.adDisplayContainer),this.adsLoader.getSettings().setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.ENABLED),0==this.controller.getSettings().vpaidAllowed&&this.adsLoader.getSettings().setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.DISABLED),this.controller.getSettings().vpaidMode&&this.adsLoader.getSettings().setVpaidMode(this.controller.getSettings().vpaidMode),this.controller.getSettings().locale&&this.adsLoader.getSettings().setLocale(this.controller.getSettings().locale),this.controller.getSettings().numRedirects&&this.adsLoader.getSettings().setNumRedirects(this.controller.getSettings().numRedirects),this.adsLoader.getSettings().setPlayerType("videojs-ima"),this.adsLoader.getSettings().setPlayerVersion(n),this.adsLoader.getSettings().setAutoPlayAdBreaks(this.autoPlayAdBreaks),this.adsLoader.addEventListener(google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.onAdsManagerLoaded.bind(this),!1),this.adsLoader.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,this.onAdsLoaderError.bind(this),!1)},o.prototype.requestAds=function(){var t=new google.ima.AdsRequest;this.controller.getSettings().adTagUrl?t.adTagUrl=this.controller.getSettings().adTagUrl:t.adsResponse=this.controller.getSettings().adsResponse,this.controller.getSettings().forceNonLinearFullSlot&&(t.forceNonLinearFullSlot=!0),this.controller.getSettings().vastLoadTimeout&&(t.vastLoadTimeout=this.controller.getSettings().vastLoadTimeout),t.linearAdSlotWidth=this.controller.getPlayerWidth(),t.linearAdSlotHeight=this.controller.getPlayerHeight(),t.nonLinearAdSlotWidth=this.controller.getSettings().nonLinearWidth||this.controller.getPlayerWidth(),t.nonLinearAdSlotHeight=this.controller.getSettings().nonLinearHeight||this.controller.getPlayerHeight(),t.setAdWillAutoPlay(this.controller.adsWillAutoplay()),t.setAdWillPlayMuted(this.controller.adsWillPlayMuted());var e=this.controller.getSettings().adsRequest;e&&"object"===(void 0===e?"undefined":s(e))&&Object.keys(e).forEach(function(i){t[i]=e[i]}),this.adsLoader.requestAds(t),this.controller.triggerPlayerEvent("ads-request",t)},o.prototype.onAdsManagerLoaded=function(t){this.createAdsRenderingSettings(),this.adsManager=t.getAdsManager(this.controller.getContentPlayheadTracker(),this.adsRenderingSettings),this.adsManager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,this.onAdError.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.AD_BREAK_READY,this.onAdBreakReady.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,this.onContentPauseRequested.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,this.onContentResumeRequested.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.ALL_ADS_COMPLETED,this.onAllAdsCompleted.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.LOADED,this.onAdLoaded.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.STARTED,this.onAdStarted.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.COMPLETE,this.onAdComplete.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.SKIPPED,this.onAdComplete.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.LOG,this.onAdLog.bind(this)),this.controller.getIsMobile()&&(this.adsManager.addEventListener(google.ima.AdEvent.Type.PAUSED,this.onAdPaused.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.RESUMED,this.onAdResumed.bind(this))),this.autoPlayAdBreaks||this.initAdsManager(),this.controller.onAdsReady(),this.controller.getSettings().adsManagerLoadedCallback&&this.controller.getSettings().adsManagerLoadedCallback()},o.prototype.onAdsLoaderError=function(t){window.console.warn("AdsLoader error: "+t.getError()),this.controller.onErrorLoadingAds(t),this.adsManager&&this.adsManager.destroy()},o.prototype.initAdsManager=function(){try{var t=this.controller.getPlayerWidth(),e=this.controller.getPlayerHeight();this.adsManagerDimensions.width=t,this.adsManagerDimensions.height=e,this.adsManager.init(t,e,google.ima.ViewMode.NORMAL),this.adsManager.setVolume(this.controller.getPlayerVolume()),this.initializeAdDisplayContainer()}catch(t){this.onAdError(t)}},o.prototype.createAdsRenderingSettings=function(){if(this.adsRenderingSettings=new google.ima.AdsRenderingSettings,this.adsRenderingSettings.restoreCustomPlaybackStateOnAdBreakComplete=!0,this.controller.getSettings().adsRenderingSettings)for(var t in this.controller.getSettings().adsRenderingSettings)""!==t&&(this.adsRenderingSettings[t]=this.controller.getSettings().adsRenderingSettings[t])},o.prototype.onAdError=function(t){var e=void 0!==t.getError?t.getError():t.stack;window.console.warn("Ad error: "+e),this.adsManager.destroy(),this.controller.onAdError(t),this.adsActive=!1,this.adPlaying=!1},o.prototype.onAdBreakReady=function(t){this.adBreakReadyListener(t)},o.prototype.onContentPauseRequested=function(t){this.adsActive=!0,this.adPlaying=!0,this.controller.onAdBreakStart(t)},o.prototype.onContentResumeRequested=function(t){this.adsActive=!1,this.adPlaying=!1,this.controller.onAdBreakEnd()},o.prototype.onAllAdsCompleted=function(t){this.allAdsCompleted=!0,this.controller.onAllAdsCompleted()},o.prototype.onAdLoaded=function(t){t.getAd().isLinear()||(this.controller.onNonLinearAdLoad(),this.controller.playContent())},o.prototype.onAdStarted=function(t){this.currentAd=t.getAd(),this.currentAd.isLinear()?(this.adTrackingTimer=setInterval(this.onAdPlayheadTrackerInterval.bind(this),250),this.controller.onLinearAdStart()):this.controller.onNonLinearAdStart()},o.prototype.onAdPaused=function(){this.controller.onAdsPaused()},o.prototype.onAdResumed=function(t){this.controller.onAdsResumed()},o.prototype.onAdComplete=function(){this.currentAd.isLinear()&&clearInterval(this.adTrackingTimer)},o.prototype.onAdLog=function(t){this.controller.onAdLog(t)},o.prototype.onAdPlayheadTrackerInterval=function(){var t=this.adsManager.getRemainingTime(),e=this.currentAd.getDuration(),i=e-t;i=i>0?i:0;var n=0,s=void 0;this.currentAd.getAdPodInfo()&&(s=this.currentAd.getAdPodInfo().getAdPosition(),n=this.currentAd.getAdPodInfo().getTotalAds()),this.controller.onAdPlayheadUpdated(i,t,e,s,n)},o.prototype.onContentComplete=function(){this.adsLoader&&(this.adsLoader.contentComplete(),this.contentCompleteCalled=!0),this.adsManager&&this.adsManager.getCuePoints()&&!this.adsManager.getCuePoints().includes(-1)&&this.controller.onNoPostroll(),this.allAdsCompleted&&this.controller.onContentAndAdsCompleted()},o.prototype.onPlayerDisposed=function(){this.adTrackingTimer&&clearInterval(this.adTrackingTimer),this.adsManager&&(this.adsManager.destroy(),this.adsManager=null)},o.prototype.onPlayerReadyForPreroll=function(){if(this.autoPlayAdBreaks){this.initAdsManager();try{this.controller.showAdContainer(),this.adsManager.setVolume(this.controller.getPlayerVolume()),this.adsManager.start()}catch(t){this.onAdError(t)}}},o.prototype.onPlayerReady=function(){this.initAdObjects(),(this.controller.getSettings().adTagUrl||this.controller.getSettings().adsResponse)&&this.requestAds()},o.prototype.onPlayerEnterFullscreen=function(){this.adsManager&&this.adsManager.resize(window.screen.width,window.screen.height,google.ima.ViewMode.FULLSCREEN)},o.prototype.onPlayerExitFullscreen=function(){this.adsManager&&this.adsManager.resize(this.controller.getPlayerWidth(),this.controller.getPlayerHeight(),google.ima.ViewMode.NORMAL)},o.prototype.onPlayerVolumeChanged=function(t){this.adsManager&&this.adsManager.setVolume(t),this.adMuted=0==t},o.prototype.onPlayerResize=function(t,e){this.adsManager&&(this.adsManagerDimensions.width=t,this.adsManagerDimensions.height=e,this.adsManager.resize(t,e,google.ima.ViewMode.NORMAL))},o.prototype.getCurrentAd=function(){return this.currentAd},o.prototype.setAdBreakReadyListener=function(t){this.adBreakReadyListener=t},o.prototype.isAdPlaying=function(){return this.adPlaying},o.prototype.isAdMuted=function(){return this.adMuted},o.prototype.pauseAds=function(){this.adsManager.pause(),this.adPlaying=!1},o.prototype.resumeAds=function(){this.adsManager.resume(),this.adPlaying=!0},o.prototype.unmute=function(){this.adsManager.setVolume(1),this.adMuted=!1},o.prototype.mute=function(){this.adsManager.setVolume(0),this.adMuted=!0},o.prototype.setVolume=function(t){this.adsManager.setVolume(t),this.adMuted=0==t},o.prototype.initializeAdDisplayContainer=function(){this.adDisplayContainer&&(this.adDisplayContainerInitialized||(this.adDisplayContainer.initialize(),this.adDisplayContainerInitialized=!0))},o.prototype.playAdBreak=function(){this.autoPlayAdBreaks||(this.controller.showAdContainer(),this.adsManager.setVolume(this.controller.getPlayerVolume()),this.adsManager.start())},o.prototype.addEventListener=function(t,e){this.adsManager&&this.adsManager.addEventListener(t,e)},o.prototype.getAdsManager=function(){return this.adsManager},o.prototype.reset=function(){this.adsActive=!1,this.adPlaying=!1,this.adTrackingTimer&&clearInterval(this.adTrackingTimer),this.adsManager&&(this.adsManager.destroy(),this.adsManager=null),this.adsLoader&&!this.contentCompleteCalled&&this.adsLoader.contentComplete(),this.contentCompleteCalled=!1,this.allAdsCompleted=!1};var r=function(t,n){this.settings={},this.contentAndAdsEndedListeners=[],this.isMobile=navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPad/i)||navigator.userAgent.match(/Android/i),this.isIos=navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPad/i),this.initWithSettings(n);var s={debug:this.settings.debug,timeout:this.settings.timeout,prerollTimeout:this.settings.prerollTimeout},r=this.extend({},s,n.contribAdsSettings||{});this.playerWrapper=new e(t,r,this),this.adUi=new i(this),this.sdkImpl=new o(this)};r.IMA_DEFAULTS={debug:!1,timeout:5e3,prerollTimeout:1e3,adLabel:"Advertisement",adLabelNofN:"of",showControlsForJSAds:!0},r.prototype.initWithSettings=function(t){this.settings=this.extend({},r.IMA_DEFAULTS,t||{}),this.warnAboutDeprecatedSettings(),this.showCountdown=!0,!1===this.settings.showCountdown&&(this.showCountdown=!1)},r.prototype.warnAboutDeprecatedSettings=function(){var t=this;["adWillAutoplay","adsWillAutoplay","adWillPlayMuted","adsWillPlayMuted"].forEach(function(e){void 0!==t.settings[e]&&console.warn("WARNING: videojs.ima setting "+e+" is deprecated")})},r.prototype.getSettings=function(){return this.settings},r.prototype.getIsMobile=function(){return this.isMobile},r.prototype.getIsIos=function(){return this.isIos},r.prototype.injectAdContainerDiv=function(t){this.playerWrapper.injectAdContainerDiv(t)},r.prototype.getAdContainerDiv=function(){return this.adUi.getAdContainerDiv()},r.prototype.getContentPlayer=function(){return this.playerWrapper.getContentPlayer()},r.prototype.getContentPlayheadTracker=function(){return this.playerWrapper.getContentPlayheadTracker()},r.prototype.requestAds=function(){this.sdkImpl.requestAds()},r.prototype.setSetting=function(t,e){this.settings[t]=e},r.prototype.onErrorLoadingAds=function(t){this.adUi.onAdError(),this.playerWrapper.onAdError(t)},r.prototype.onAdPlayPauseClick=function(){this.sdkImpl.isAdPlaying()?(this.adUi.onAdsPaused(),this.sdkImpl.pauseAds()):(this.adUi.onAdsPlaying(),this.sdkImpl.resumeAds())},r.prototype.onAdMuteClick=function(){this.sdkImpl.isAdMuted()?(this.playerWrapper.unmute(),this.adUi.unmute(),this.sdkImpl.unmute()):(this.playerWrapper.mute(),this.adUi.mute(),this.sdkImpl.mute())},r.prototype.setVolume=function(t){this.playerWrapper.setVolume(t),this.sdkImpl.setVolume(t)},r.prototype.getPlayerVolume=function(){return this.playerWrapper.getVolume()},r.prototype.toggleFullscreen=function(){this.playerWrapper.toggleFullscreen()},r.prototype.onAdError=function(t){this.adUi.onAdError(),this.playerWrapper.onAdError(t)},r.prototype.onAdBreakStart=function(t){this.playerWrapper.onAdBreakStart(),this.adUi.onAdBreakStart(t)},r.prototype.showAdContainer=function(){this.adUi.showAdContainer()},r.prototype.onAdBreakEnd=function(){this.playerWrapper.onAdBreakEnd(),this.adUi.onAdBreakEnd()},r.prototype.onAllAdsCompleted=function(){this.adUi.onAllAdsCompleted(),this.playerWrapper.onAllAdsCompleted()},r.prototype.onAdsPaused=function(){this.adUi.onAdsPaused()},r.prototype.onAdsResumed=function(){this.adUi.onAdsResumed()},r.prototype.onAdPlayheadUpdated=function(t,e,i,n,s){this.adUi.updateAdUi(t,e,i,n,s)},r.prototype.onAdLog=function(t){this.playerWrapper.onAdLog(t)},r.prototype.getCurrentAd=function(){return this.sdkImpl.getCurrentAd()},r.prototype.playContent=function(){this.playerWrapper.play()},r.prototype.onLinearAdStart=function(){this.adUi.onLinearAdStart(),this.playerWrapper.onAdStart()},r.prototype.onNonLinearAdLoad=function(){this.adUi.onNonLinearAdLoad()},r.prototype.onNonLinearAdStart=function(){this.adUi.onNonLinearAdLoad(),this.playerWrapper.onAdStart()},r.prototype.getPlayerWidth=function(){return this.playerWrapper.getPlayerWidth()},r.prototype.getPlayerHeight=function(){return this.playerWrapper.getPlayerHeight()},r.prototype.onAdsReady=function(){this.playerWrapper.onAdsReady()},r.prototype.onPlayerResize=function(t,e){this.sdkImpl.onPlayerResize(t,e)},r.prototype.onContentComplete=function(){this.sdkImpl.onContentComplete()},r.prototype.onNoPostroll=function(){this.playerWrapper.onNoPostroll()},r.prototype.onContentAndAdsCompleted=function(){for(var t in this.contentAndAdsEndedListeners)"function"==typeof this.contentAndAdsEndedListeners[t]&&this.contentAndAdsEndedListeners[t]()},r.prototype.onPlayerDisposed=function(){this.contentAndAdsEndedListeners=[],this.sdkImpl.onPlayerDisposed()},r.prototype.onPlayerReadyForPreroll=function(){this.sdkImpl.onPlayerReadyForPreroll()},r.prototype.onPlayerReady=function(){this.sdkImpl.onPlayerReady()},r.prototype.onPlayerEnterFullscreen=function(){this.adUi.onPlayerEnterFullscreen(),this.sdkImpl.onPlayerEnterFullscreen()},r.prototype.onPlayerExitFullscreen=function(){this.adUi.onPlayerExitFullscreen(),this.sdkImpl.onPlayerExitFullscreen()},r.prototype.onPlayerVolumeChanged=function(t){this.adUi.onPlayerVolumeChanged(t),this.sdkImpl.onPlayerVolumeChanged(t)},r.prototype.setContentWithAdTag=function(t,e){this.reset(),this.settings.adTagUrl=e||this.settings.adTagUrl,this.playerWrapper.changeSource(t)},r.prototype.setContentWithAdsResponse=function(t,e){this.reset(),this.settings.adsResponse=e||this.settings.adsResponse,this.playerWrapper.changeSource(t)},r.prototype.setContentWithAdsRequest=function(t,e){this.reset(),this.settings.adsRequest=e||this.settings.adsRequest,this.playerWrapper.changeSource(t)},r.prototype.reset=function(){this.sdkImpl.reset(),this.playerWrapper.reset(),this.adUi.reset()},r.prototype.addContentEndedListener=function(t){this.playerWrapper.addContentEndedListener(t)},r.prototype.addContentAndAdsEndedListener=function(t){this.contentAndAdsEndedListeners.push(t)},r.prototype.setAdBreakReadyListener=function(t){this.sdkImpl.setAdBreakReadyListener(t)},r.prototype.setShowCountdown=function(t){this.adUi.setShowCountdown(t),this.showCountdown=t,this.countdownDiv.style.display=this.showCountdown?"block":"none"},r.prototype.initializeAdDisplayContainer=function(){this.sdkImpl.initializeAdDisplayContainer()},r.prototype.playAdBreak=function(){this.sdkImpl.playAdBreak()},r.prototype.addEventListener=function(t,e){this.sdkImpl.addEventListener(t,e)},r.prototype.getAdsManager=function(){return this.sdkImpl.getAdsManager()},r.prototype.getPlayerId=function(){return this.playerWrapper.getPlayerId()},r.prototype.changeAdTag=function(t){this.reset(),this.settings.adTagUrl=t},r.prototype.pauseAd=function(){this.adUi.onAdsPaused(),this.sdkImpl.pauseAds()},r.prototype.resumeAd=function(){this.adUi.onAdsPlaying(),this.sdkImpl.resumeAds()},r.prototype.adsWillAutoplay=function(){return void 0!==this.settings.adsWillAutoplay?this.settings.adsWillAutoplay:void 0!==this.settings.adWillAutoplay?this.settings.adWillAutoplay:!!this.playerWrapper.getPlayerOptions().autoplay},r.prototype.adsWillPlayMuted=function(){return void 0!==this.settings.adsWillPlayMuted?this.settings.adsWillPlayMuted:void 0!==this.settings.adWillPlayMuted?this.settings.adWillPlayMuted:void 0!==this.playerWrapper.getPlayerOptions().muted?this.playerWrapper.getPlayerOptions().muted:0==this.playerWrapper.getVolume()},r.prototype.triggerPlayerEvent=function(t,e){this.playerWrapper.triggerPlayerEvent(t,e)},r.prototype.extend=function(t){for(var e=void 0,i=void 0,n=void 0,s=arguments.length,o=Array(s>1?s-1:0),r=1;rthis.seekCheckInterval+this.seekThreshold?this.contentPlayheadTracker.seeking=!0:this.contentPlayheadTracker.seeking=!1,this.contentPlayheadTracker.previousTime=this.vjsPlayer.currentTime()},e.prototype.checkForResize=function(){var t=this.getPlayerWidth(),e=this.getPlayerHeight();t==this.vjsPlayerDimensions.width&&e==this.vjsPlayerDimensions.height||(this.vjsPlayerDimensions.width=t,this.vjsPlayerDimensions.height=e,this.controller.onPlayerResize(t,e))},e.prototype.localContentEndedListener=function(){for(var t in this.contentComplete||(this.contentComplete=!0,this.controller.onContentComplete()),this.contentEndedListeners)"function"==typeof this.contentEndedListeners[t]&&this.contentEndedListeners[t]();clearInterval(this.updateTimeIntervalHandle),clearInterval(this.seekCheckIntervalHandle),clearInterval(this.resizeCheckIntervalHandle),this.vjsPlayer.el()&&this.vjsPlayer.one("play",this.setUpPlayerIntervals.bind(this))},e.prototype.onNoPostroll=function(){this.vjsPlayer.trigger("nopostroll")},e.prototype.playerDisposedListener=function(){this.contentEndedListeners=[],this.controller.onPlayerDisposed(),this.contentComplete=!0,this.vjsPlayer.off("contentended",this.boundContentEndedListener),this.vjsPlayer.ads.adTimeoutTimeout&&clearTimeout(this.vjsPlayer.ads.adTimeoutTimeout);var t=[this.updateTimeIntervalHandle,this.seekCheckIntervalHandle,this.resizeCheckIntervalHandle];for(var e in t)t[e]&&clearInterval(t[e])},e.prototype.onReadyForPreroll=function(){this.controller.onPlayerReadyForPreroll()},e.prototype.onPlayerReady=function(){this.h5Player=document.getElementById(this.getPlayerId()).getElementsByClassName("vjs-tech")[0],this.h5Player.hasAttribute("autoplay")&&this.controller.setSetting("adWillAutoPlay",!0),this.onVolumeChange(),this.vjsPlayer.on("fullscreenchange",this.onFullscreenChange.bind(this)),this.vjsPlayer.on("volumechange",this.onVolumeChange.bind(this)),this.controller.onPlayerReady()},e.prototype.onFullscreenChange=function(){this.vjsPlayer.isFullscreen()?this.controller.onPlayerEnterFullscreen():this.controller.onPlayerExitFullscreen()},e.prototype.onVolumeChange=function(){var t=this.vjsPlayer.muted()?0:this.vjsPlayer.volume();this.controller.onPlayerVolumeChanged(t)},e.prototype.injectAdContainerDiv=function(t){this.vjsControls.el().parentNode.appendChild(t)},e.prototype.getContentPlayer=function(){return this.h5Player},e.prototype.getVolume=function(){return this.vjsPlayer.muted()?0:this.vjsPlayer.volume()},e.prototype.setVolume=function(t){this.vjsPlayer.volume(t),0==t?this.vjsPlayer.muted(!0):this.vjsPlayer.muted(!1)},e.prototype.unmute=function(){this.vjsPlayer.muted(!1)},e.prototype.mute=function(){this.vjsPlayer.muted(!0)},e.prototype.play=function(){this.vjsPlayer.play()},e.prototype.getPlayerWidth=function(){var t=(getComputedStyle(this.vjsPlayer.el())||{}).width;return t&&0!==parseFloat(t)||(t=(this.vjsPlayer.el().getBoundingClientRect()||{}).width),parseFloat(t)||this.vjsPlayer.width()},e.prototype.getPlayerHeight=function(){var t=(getComputedStyle(this.vjsPlayer.el())||{}).height;return t&&0!==parseFloat(t)||(t=(this.vjsPlayer.el().getBoundingClientRect()||{}).height),parseFloat(t)||this.vjsPlayer.height()},e.prototype.getPlayerOptions=function(){return this.vjsPlayer.options_},e.prototype.getPlayerId=function(){return this.vjsPlayer.id()},e.prototype.toggleFullscreen=function(){this.vjsPlayer.isFullscreen()?this.vjsPlayer.exitFullscreen():this.vjsPlayer.requestFullscreen()},e.prototype.getContentPlayheadTracker=function(){return this.contentPlayheadTracker},e.prototype.onAdError=function(t){this.vjsControls.show();var e=void 0!==t.getError?t.getError():t.stack;this.vjsPlayer.trigger({type:"adserror",data:{AdError:e,AdErrorEvent:t}})},e.prototype.onAdLog=function(t){var e=t.getAdData(),i=void 0!==e.adError?e.adError.getMessage():void 0;this.vjsPlayer.trigger({type:"adslog",data:{AdError:i,AdEvent:t}})},e.prototype.onAdBreakStart=function(){this.contentSource=this.vjsPlayer.currentSrc(),this.contentSourceType=this.vjsPlayer.currentType(),this.vjsPlayer.off("contentended",this.boundContentEndedListener),this.vjsPlayer.ads.startLinearAdMode(),this.vjsControls.hide(),this.vjsPlayer.pause()},e.prototype.onAdBreakEnd=function(){this.vjsPlayer.on("contentended",this.boundContentEndedListener),this.vjsPlayer.ads.inAdBreak()&&this.vjsPlayer.ads.endLinearAdMode(),this.vjsControls.show()},e.prototype.onAdStart=function(){this.vjsPlayer.trigger("ads-ad-started")},e.prototype.onAllAdsCompleted=function(){1==this.contentComplete&&(this.vjsPlayer.currentSrc()!=this.contentSource&&this.vjsPlayer.src({src:this.contentSource,type:this.contentSourceType}),this.controller.onContentAndAdsCompleted())},e.prototype.onAdsReady=function(){this.vjsPlayer.trigger("adsready")},e.prototype.changeSource=function(t){this.vjsPlayer.currentSrc()&&(this.vjsPlayer.currentTime(0),this.vjsPlayer.pause()),t&&this.vjsPlayer.src(t),this.vjsPlayer.one("loadedmetadata",this.seekContentToZero.bind(this))},e.prototype.seekContentToZero=function(){this.vjsPlayer.currentTime(0)},e.prototype.triggerPlayerEvent=function(t,e){this.vjsPlayer.trigger(t,e)},e.prototype.addContentEndedListener=function(t){this.contentEndedListeners.push(t)},e.prototype.reset=function(){this.vjsPlayer.on("contentended",this.boundContentEndedListener),this.vjsControls.show(),this.vjsPlayer.ads.inAdBreak()&&this.vjsPlayer.ads.endLinearAdMode(),this.contentPlayheadTracker.currentTime=0,this.contentComplete=!1};var i=function(t){this.controller=t,this.adContainerDiv=document.createElement("div"),this.controlsDiv=document.createElement("div"),this.countdownDiv=document.createElement("div"),this.seekBarDiv=document.createElement("div"),this.progressDiv=document.createElement("div"),this.playPauseDiv=document.createElement("div"),this.muteDiv=document.createElement("div"),this.sliderDiv=document.createElement("div"),this.sliderLevelDiv=document.createElement("div"),this.fullscreenDiv=document.createElement("div"),this.boundOnMouseUp=this.onMouseUp.bind(this),this.boundOnMouseMove=this.onMouseMove.bind(this),this.adPlayheadTracker={currentTime:0,duration:0,isPod:!1,adPosition:0,totalAds:0},this.controlPrefix=this.controller.getPlayerId()+"_",this.showCountdown=!0,!1===this.controller.getSettings().showCountdown&&(this.showCountdown=!1),this.createAdContainer()};i.prototype.createAdContainer=function(){this.assignControlAttributes(this.adContainerDiv,"ima-ad-container"),this.adContainerDiv.style.position="absolute",this.adContainerDiv.style.zIndex=1111,this.adContainerDiv.addEventListener("mouseenter",this.showAdControls.bind(this),!1),this.adContainerDiv.addEventListener("mouseleave",this.hideAdControls.bind(this),!1),this.createControls(),this.controller.injectAdContainerDiv(this.adContainerDiv)},i.prototype.createControls=function(){this.assignControlAttributes(this.controlsDiv,"ima-controls-div"),this.controlsDiv.style.width="100%",this.assignControlAttributes(this.countdownDiv,"ima-countdown-div"),this.countdownDiv.innerHTML=this.controller.getSettings().adLabel,this.countdownDiv.style.display=this.showCountdown?"block":"none",this.assignControlAttributes(this.seekBarDiv,"ima-seek-bar-div"),this.seekBarDiv.style.width="100%",this.assignControlAttributes(this.progressDiv,"ima-progress-div"),this.assignControlAttributes(this.playPauseDiv,"ima-play-pause-div"),this.addClass(this.playPauseDiv,"ima-playing"),this.playPauseDiv.addEventListener("click",this.onAdPlayPauseClick.bind(this),!1),this.assignControlAttributes(this.muteDiv,"ima-mute-div"),this.addClass(this.muteDiv,"ima-non-muted"),this.muteDiv.addEventListener("click",this.onAdMuteClick.bind(this),!1),this.assignControlAttributes(this.sliderDiv,"ima-slider-div"),this.sliderDiv.addEventListener("mousedown",this.onAdVolumeSliderMouseDown.bind(this),!1),this.controller.getIsIos()&&(this.sliderDiv.style.display="none"),this.assignControlAttributes(this.sliderLevelDiv,"ima-slider-level-div"),this.assignControlAttributes(this.fullscreenDiv,"ima-fullscreen-div"),this.addClass(this.fullscreenDiv,"ima-non-fullscreen"),this.fullscreenDiv.addEventListener("click",this.onAdFullscreenClick.bind(this),!1),this.adContainerDiv.appendChild(this.controlsDiv),this.controlsDiv.appendChild(this.countdownDiv),this.controlsDiv.appendChild(this.seekBarDiv),this.controlsDiv.appendChild(this.playPauseDiv),this.controlsDiv.appendChild(this.muteDiv),this.controlsDiv.appendChild(this.sliderDiv),this.controlsDiv.appendChild(this.fullscreenDiv),this.seekBarDiv.appendChild(this.progressDiv),this.sliderDiv.appendChild(this.sliderLevelDiv)},i.prototype.onAdPlayPauseClick=function(){this.controller.onAdPlayPauseClick()},i.prototype.onAdMuteClick=function(){this.controller.onAdMuteClick()},i.prototype.onAdFullscreenClick=function(){this.controller.toggleFullscreen()},i.prototype.onAdsPaused=function(){this.addClass(this.playPauseDiv,"ima-paused"),this.removeClass(this.playPauseDiv,"ima-playing"),this.showAdControls()},i.prototype.onAdsResumed=function(){this.onAdsPlaying(),this.showAdControls()},i.prototype.onAdsPlaying=function(){this.addClass(this.playPauseDiv,"ima-playing"),this.removeClass(this.playPauseDiv,"ima-paused")},i.prototype.updateAdUi=function(t,e,i,n,s){var o=Math.floor(e/60),r=Math.floor(e%60);r.toString().length<2&&(r="0"+r);var a=": ";s>1&&(a=" ("+n+" "+this.controller.getSettings().adLabelNofN+" "+s+"): "),this.countdownDiv.innerHTML=this.controller.getSettings().adLabel+a+o+":"+r;var d=100*(t/i);this.progressDiv.style.width=d+"%"},i.prototype.unmute=function(){this.addClass(this.muteDiv,"ima-non-muted"),this.removeClass(this.muteDiv,"ima-muted"),this.sliderLevelDiv.style.width=100*this.controller.getPlayerVolume()+"%"},i.prototype.mute=function(){this.addClass(this.muteDiv,"ima-muted"),this.removeClass(this.muteDiv,"ima-non-muted"),this.sliderLevelDiv.style.width="0%"},i.prototype.onAdVolumeSliderMouseDown=function(){document.addEventListener("mouseup",this.boundOnMouseUp,!1),document.addEventListener("mousemove",this.boundOnMouseMove,!1)},i.prototype.onMouseMove=function(t){this.changeVolume(t)},i.prototype.onMouseUp=function(t){this.changeVolume(t),document.removeEventListener("mouseup",this.boundOnMouseUp),document.removeEventListener("mousemove",this.boundOnMouseMove)},i.prototype.changeVolume=function(t){var e=(t.clientX-this.sliderDiv.getBoundingClientRect().left)/this.sliderDiv.offsetWidth;e*=100,e=Math.min(Math.max(e,0),100),this.sliderLevelDiv.style.width=e+"%",0==this.percent?(this.addClass(this.muteDiv,"ima-muted"),this.removeClass(this.muteDiv,"ima-non-muted")):(this.addClass(this.muteDiv,"ima-non-muted"),this.removeClass(this.muteDiv,"ima-muted")),this.controller.setVolume(e/100)},i.prototype.showAdContainer=function(){this.adContainerDiv.style.display="block"},i.prototype.hideAdContainer=function(){this.adContainerDiv.style.display="none"},i.prototype.reset=function(){this.hideAdContainer()},i.prototype.onAdError=function(){this.hideAdContainer()},i.prototype.onAdBreakStart=function(t){this.showAdContainer(),"application/javascript"!==t.getAd().getContentType()||this.controller.getSettings().showControlsForJSAds?this.controlsDiv.style.display="block":this.controlsDiv.style.display="none",this.onAdsPlaying(),this.hideAdControls()},i.prototype.onAdBreakEnd=function(){var t=this.controller.getCurrentAd();(null==t||t.isLinear())&&this.hideAdContainer(),this.controlsDiv.style.display="none",this.countdownDiv.innerHTML=""},i.prototype.onAllAdsCompleted=function(){this.hideAdContainer()},i.prototype.onLinearAdStart=function(){this.removeClass(this.adContainerDiv,"bumpable-ima-ad-container")},i.prototype.onNonLinearAdLoad=function(){this.adContainerDiv.style.display="block",this.addClass(this.adContainerDiv,"bumpable-ima-ad-container")},i.prototype.onPlayerEnterFullscreen=function(){this.addClass(this.fullscreenDiv,"ima-fullscreen"),this.removeClass(this.fullscreenDiv,"ima-non-fullscreen")},i.prototype.onPlayerExitFullscreen=function(){this.addClass(this.fullscreenDiv,"ima-non-fullscreen"),this.removeClass(this.fullscreenDiv,"ima-fullscreen")},i.prototype.onPlayerVolumeChanged=function(t){0==t?(this.addClass(this.muteDiv,"ima-muted"),this.removeClass(this.muteDiv,"ima-non-muted"),this.sliderLevelDiv.style.width="0%"):(this.addClass(this.muteDiv,"ima-non-muted"),this.removeClass(this.muteDiv,"ima-muted"),this.sliderLevelDiv.style.width=100*t+"%")},i.prototype.showAdControls=function(){this.addClass(this.controlsDiv,"ima-controls-div-showing"),this.playPauseDiv.style.display="block",this.muteDiv.style.display="block",this.fullscreenDiv.style.display="block",this.controller.getIsIos()||(this.sliderDiv.style.display="block")},i.prototype.hideAdControls=function(){this.removeClass(this.controlsDiv,"ima-controls-div-showing"),this.playPauseDiv.style.display="none",this.muteDiv.style.display="none",this.sliderDiv.style.display="none",this.fullscreenDiv.style.display="none"},i.prototype.assignControlAttributes=function(t,e){t.id=this.controlPrefix+e,t.className=this.controlPrefix+e+" "+e},i.prototype.getClassRegexp=function(t){return new RegExp("(^|[^A-Za-z-])"+t+"((?![A-Za-z-])|$)","gi")},i.prototype.elementHasClass=function(t,e){return this.getClassRegexp(e).test(t.className)},i.prototype.addClass=function(t,e){t.className=t.className.trim()+" "+e},i.prototype.removeClass=function(t,e){var i=this.getClassRegexp(e);t.className=t.className.trim().replace(i,"")},i.prototype.getAdContainerDiv=function(){return this.adContainerDiv},i.prototype.setShowCountdown=function(t){this.showCountdown=t,this.countdownDiv.style.display=this.showCountdown?"block":"none"};var n="1.6.2",s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=function(t){this.controller=t,this.adDisplayContainer=null,this.adDisplayContainerInitialized=!1,this.adsLoader=null,this.adsManager=null,this.adsRenderingSettings=null,this.adsResponse=null,this.currentAd=null,this.adTrackingTimer=null,this.allAdsCompleted=!1,this.adsActive=!1,this.adPlaying=!1,this.adMuted=!1,this.adBreakReadyListener=void 0,this.contentCompleteCalled=!1,this.adsManagerDimensions={width:0,height:0},this.autoPlayAdBreaks=!0,!1===this.controller.getSettings().autoPlayAdBreaks&&(this.autoPlayAdBreaks=!1),this.controller.getSettings().locale&&google.ima.settings.setLocale(this.controller.getSettings().locale),this.controller.getSettings().disableFlashAds&&google.ima.settings.setDisableFlashAds(this.controller.getSettings().disableFlashAds),this.controller.getSettings().disableCustomPlaybackForIOS10Plus&&google.ima.settings.setDisableCustomPlaybackForIOS10Plus(this.controller.getSettings().disableCustomPlaybackForIOS10Plus)};o.prototype.initAdObjects=function(){this.adDisplayContainer=new google.ima.AdDisplayContainer(this.controller.getAdContainerDiv(),this.controller.getContentPlayer()),this.adsLoader=new google.ima.AdsLoader(this.adDisplayContainer),this.adsLoader.getSettings().setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.ENABLED),0==this.controller.getSettings().vpaidAllowed&&this.adsLoader.getSettings().setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.DISABLED),this.controller.getSettings().vpaidMode&&this.adsLoader.getSettings().setVpaidMode(this.controller.getSettings().vpaidMode),this.controller.getSettings().locale&&this.adsLoader.getSettings().setLocale(this.controller.getSettings().locale),this.controller.getSettings().numRedirects&&this.adsLoader.getSettings().setNumRedirects(this.controller.getSettings().numRedirects),this.adsLoader.getSettings().setPlayerType("videojs-ima"),this.adsLoader.getSettings().setPlayerVersion(n),this.adsLoader.getSettings().setAutoPlayAdBreaks(this.autoPlayAdBreaks),this.adsLoader.addEventListener(google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.onAdsManagerLoaded.bind(this),!1),this.adsLoader.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,this.onAdsLoaderError.bind(this),!1)},o.prototype.requestAds=function(){var t=new google.ima.AdsRequest;this.controller.getSettings().adTagUrl?t.adTagUrl=this.controller.getSettings().adTagUrl:t.adsResponse=this.controller.getSettings().adsResponse,this.controller.getSettings().forceNonLinearFullSlot&&(t.forceNonLinearFullSlot=!0),this.controller.getSettings().vastLoadTimeout&&(t.vastLoadTimeout=this.controller.getSettings().vastLoadTimeout),t.linearAdSlotWidth=this.controller.getPlayerWidth(),t.linearAdSlotHeight=this.controller.getPlayerHeight(),t.nonLinearAdSlotWidth=this.controller.getSettings().nonLinearWidth||this.controller.getPlayerWidth(),t.nonLinearAdSlotHeight=this.controller.getSettings().nonLinearHeight||this.controller.getPlayerHeight(),t.setAdWillAutoPlay(this.controller.adsWillAutoplay()),t.setAdWillPlayMuted(this.controller.adsWillPlayMuted());var e=this.controller.getSettings().adsRequest;e&&"object"===(void 0===e?"undefined":s(e))&&Object.keys(e).forEach(function(i){t[i]=e[i]}),this.adsLoader.requestAds(t),this.controller.triggerPlayerEvent("ads-request",t)},o.prototype.onAdsManagerLoaded=function(t){this.createAdsRenderingSettings(),this.adsManager=t.getAdsManager(this.controller.getContentPlayheadTracker(),this.adsRenderingSettings),this.adsManager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,this.onAdError.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.AD_BREAK_READY,this.onAdBreakReady.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,this.onContentPauseRequested.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,this.onContentResumeRequested.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.ALL_ADS_COMPLETED,this.onAllAdsCompleted.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.LOADED,this.onAdLoaded.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.STARTED,this.onAdStarted.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.COMPLETE,this.onAdComplete.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.SKIPPED,this.onAdComplete.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.LOG,this.onAdLog.bind(this)),this.controller.getIsMobile()&&(this.adsManager.addEventListener(google.ima.AdEvent.Type.PAUSED,this.onAdPaused.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.RESUMED,this.onAdResumed.bind(this))),this.autoPlayAdBreaks||this.initAdsManager(),this.controller.onAdsReady(),this.controller.getSettings().adsManagerLoadedCallback&&this.controller.getSettings().adsManagerLoadedCallback()},o.prototype.onAdsLoaderError=function(t){window.console.warn("AdsLoader error: "+t.getError()),this.controller.onErrorLoadingAds(t),this.adsManager&&this.adsManager.destroy()},o.prototype.initAdsManager=function(){try{var t=this.controller.getPlayerWidth(),e=this.controller.getPlayerHeight();this.adsManagerDimensions.width=t,this.adsManagerDimensions.height=e,this.adsManager.init(t,e,google.ima.ViewMode.NORMAL),this.adsManager.setVolume(this.controller.getPlayerVolume()),this.initializeAdDisplayContainer()}catch(t){this.onAdError(t)}},o.prototype.createAdsRenderingSettings=function(){if(this.adsRenderingSettings=new google.ima.AdsRenderingSettings,this.adsRenderingSettings.restoreCustomPlaybackStateOnAdBreakComplete=!0,this.controller.getSettings().adsRenderingSettings)for(var t in this.controller.getSettings().adsRenderingSettings)""!==t&&(this.adsRenderingSettings[t]=this.controller.getSettings().adsRenderingSettings[t])},o.prototype.onAdError=function(t){var e=void 0!==t.getError?t.getError():t.stack;window.console.warn("Ad error: "+e),this.adsManager.destroy(),this.controller.onAdError(t),this.adsActive=!1,this.adPlaying=!1},o.prototype.onAdBreakReady=function(t){this.adBreakReadyListener(t)},o.prototype.onContentPauseRequested=function(t){this.adsActive=!0,this.adPlaying=!0,this.controller.onAdBreakStart(t)},o.prototype.onContentResumeRequested=function(t){this.adsActive=!1,this.adPlaying=!1,this.controller.onAdBreakEnd()},o.prototype.onAllAdsCompleted=function(t){this.allAdsCompleted=!0,this.controller.onAllAdsCompleted()},o.prototype.onAdLoaded=function(t){t.getAd().isLinear()||(this.controller.onNonLinearAdLoad(),this.controller.playContent())},o.prototype.onAdStarted=function(t){this.currentAd=t.getAd(),this.currentAd.isLinear()?(this.adTrackingTimer=setInterval(this.onAdPlayheadTrackerInterval.bind(this),250),this.controller.onLinearAdStart()):this.controller.onNonLinearAdStart()},o.prototype.onAdPaused=function(){this.controller.onAdsPaused()},o.prototype.onAdResumed=function(t){this.controller.onAdsResumed()},o.prototype.onAdComplete=function(){this.currentAd.isLinear()&&clearInterval(this.adTrackingTimer)},o.prototype.onAdLog=function(t){this.controller.onAdLog(t)},o.prototype.onAdPlayheadTrackerInterval=function(){var t=this.adsManager.getRemainingTime(),e=this.currentAd.getDuration(),i=e-t;i=i>0?i:0;var n=0,s=void 0;this.currentAd.getAdPodInfo()&&(s=this.currentAd.getAdPodInfo().getAdPosition(),n=this.currentAd.getAdPodInfo().getTotalAds()),this.controller.onAdPlayheadUpdated(i,t,e,s,n)},o.prototype.onContentComplete=function(){this.adsLoader&&(this.adsLoader.contentComplete(),this.contentCompleteCalled=!0),this.adsManager&&this.adsManager.getCuePoints()&&!this.adsManager.getCuePoints().includes(-1)&&this.controller.onNoPostroll(),this.allAdsCompleted&&this.controller.onContentAndAdsCompleted()},o.prototype.onPlayerDisposed=function(){this.adTrackingTimer&&clearInterval(this.adTrackingTimer),this.adsManager&&(this.adsManager.destroy(),this.adsManager=null)},o.prototype.onPlayerReadyForPreroll=function(){if(this.autoPlayAdBreaks){this.initAdsManager();try{this.controller.showAdContainer(),this.adsManager.setVolume(this.controller.getPlayerVolume()),this.adsManager.start()}catch(t){this.onAdError(t)}}},o.prototype.onPlayerReady=function(){this.initAdObjects(),(this.controller.getSettings().adTagUrl||this.controller.getSettings().adsResponse)&&this.requestAds()},o.prototype.onPlayerEnterFullscreen=function(){this.adsManager&&this.adsManager.resize(window.screen.width,window.screen.height,google.ima.ViewMode.FULLSCREEN)},o.prototype.onPlayerExitFullscreen=function(){this.adsManager&&this.adsManager.resize(this.controller.getPlayerWidth(),this.controller.getPlayerHeight(),google.ima.ViewMode.NORMAL)},o.prototype.onPlayerVolumeChanged=function(t){this.adsManager&&this.adsManager.setVolume(t),this.adMuted=0==t},o.prototype.onPlayerResize=function(t,e){this.adsManager&&(this.adsManagerDimensions.width=t,this.adsManagerDimensions.height=e,this.adsManager.resize(t,e,google.ima.ViewMode.NORMAL))},o.prototype.getCurrentAd=function(){return this.currentAd},o.prototype.setAdBreakReadyListener=function(t){this.adBreakReadyListener=t},o.prototype.isAdPlaying=function(){return this.adPlaying},o.prototype.isAdMuted=function(){return this.adMuted},o.prototype.pauseAds=function(){this.adsManager.pause(),this.adPlaying=!1},o.prototype.resumeAds=function(){this.adsManager.resume(),this.adPlaying=!0},o.prototype.unmute=function(){this.adsManager.setVolume(1),this.adMuted=!1},o.prototype.mute=function(){this.adsManager.setVolume(0),this.adMuted=!0},o.prototype.setVolume=function(t){this.adsManager.setVolume(t),this.adMuted=0==t},o.prototype.initializeAdDisplayContainer=function(){this.adDisplayContainer&&(this.adDisplayContainerInitialized||(this.adDisplayContainer.initialize(),this.adDisplayContainerInitialized=!0))},o.prototype.playAdBreak=function(){this.autoPlayAdBreaks||(this.controller.showAdContainer(),this.adsManager.setVolume(this.controller.getPlayerVolume()),this.adsManager.start())},o.prototype.addEventListener=function(t,e){this.adsManager&&this.adsManager.addEventListener(t,e)},o.prototype.getAdsManager=function(){return this.adsManager},o.prototype.reset=function(){this.adsActive=!1,this.adPlaying=!1,this.adTrackingTimer&&clearInterval(this.adTrackingTimer),this.adsManager&&(this.adsManager.destroy(),this.adsManager=null),this.adsLoader&&!this.contentCompleteCalled&&this.adsLoader.contentComplete(),this.contentCompleteCalled=!1,this.allAdsCompleted=!1};var r=function(t,n){this.settings={},this.contentAndAdsEndedListeners=[],this.isMobile=navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPad/i)||navigator.userAgent.match(/Android/i),this.isIos=navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPad/i),this.initWithSettings(n);var s={debug:this.settings.debug,timeout:this.settings.timeout,prerollTimeout:this.settings.prerollTimeout},r=this.extend({},s,n.contribAdsSettings||{});this.playerWrapper=new e(t,r,this),this.adUi=new i(this),this.sdkImpl=new o(this)};r.IMA_DEFAULTS={debug:!1,timeout:5e3,prerollTimeout:1e3,adLabel:"Advertisement",adLabelNofN:"of",showControlsForJSAds:!0},r.prototype.initWithSettings=function(t){this.settings=this.extend({},r.IMA_DEFAULTS,t||{}),this.warnAboutDeprecatedSettings(),this.showCountdown=!0,!1===this.settings.showCountdown&&(this.showCountdown=!1)},r.prototype.warnAboutDeprecatedSettings=function(){var t=this;["adWillAutoplay","adsWillAutoplay","adWillPlayMuted","adsWillPlayMuted"].forEach(function(e){void 0!==t.settings[e]&&console.warn("WARNING: videojs.ima setting "+e+" is deprecated")})},r.prototype.getSettings=function(){return this.settings},r.prototype.getIsMobile=function(){return this.isMobile},r.prototype.getIsIos=function(){return this.isIos},r.prototype.injectAdContainerDiv=function(t){this.playerWrapper.injectAdContainerDiv(t)},r.prototype.getAdContainerDiv=function(){return this.adUi.getAdContainerDiv()},r.prototype.getContentPlayer=function(){return this.playerWrapper.getContentPlayer()},r.prototype.getContentPlayheadTracker=function(){return this.playerWrapper.getContentPlayheadTracker()},r.prototype.requestAds=function(){this.sdkImpl.requestAds()},r.prototype.setSetting=function(t,e){this.settings[t]=e},r.prototype.onErrorLoadingAds=function(t){this.adUi.onAdError(),this.playerWrapper.onAdError(t)},r.prototype.onAdPlayPauseClick=function(){this.sdkImpl.isAdPlaying()?(this.adUi.onAdsPaused(),this.sdkImpl.pauseAds()):(this.adUi.onAdsPlaying(),this.sdkImpl.resumeAds())},r.prototype.onAdMuteClick=function(){this.sdkImpl.isAdMuted()?(this.playerWrapper.unmute(),this.adUi.unmute(),this.sdkImpl.unmute()):(this.playerWrapper.mute(),this.adUi.mute(),this.sdkImpl.mute())},r.prototype.setVolume=function(t){this.playerWrapper.setVolume(t),this.sdkImpl.setVolume(t)},r.prototype.getPlayerVolume=function(){return this.playerWrapper.getVolume()},r.prototype.toggleFullscreen=function(){this.playerWrapper.toggleFullscreen()},r.prototype.onAdError=function(t){this.adUi.onAdError(),this.playerWrapper.onAdError(t)},r.prototype.onAdBreakStart=function(t){this.playerWrapper.onAdBreakStart(),this.adUi.onAdBreakStart(t)},r.prototype.showAdContainer=function(){this.adUi.showAdContainer()},r.prototype.onAdBreakEnd=function(){this.playerWrapper.onAdBreakEnd(),this.adUi.onAdBreakEnd()},r.prototype.onAllAdsCompleted=function(){this.adUi.onAllAdsCompleted(),this.playerWrapper.onAllAdsCompleted()},r.prototype.onAdsPaused=function(){this.adUi.onAdsPaused()},r.prototype.onAdsResumed=function(){this.adUi.onAdsResumed()},r.prototype.onAdPlayheadUpdated=function(t,e,i,n,s){this.adUi.updateAdUi(t,e,i,n,s)},r.prototype.onAdLog=function(t){this.playerWrapper.onAdLog(t)},r.prototype.getCurrentAd=function(){return this.sdkImpl.getCurrentAd()},r.prototype.playContent=function(){this.playerWrapper.play()},r.prototype.onLinearAdStart=function(){this.adUi.onLinearAdStart(),this.playerWrapper.onAdStart()},r.prototype.onNonLinearAdLoad=function(){this.adUi.onNonLinearAdLoad()},r.prototype.onNonLinearAdStart=function(){this.adUi.onNonLinearAdLoad(),this.playerWrapper.onAdStart()},r.prototype.getPlayerWidth=function(){return this.playerWrapper.getPlayerWidth()},r.prototype.getPlayerHeight=function(){return this.playerWrapper.getPlayerHeight()},r.prototype.onAdsReady=function(){this.playerWrapper.onAdsReady()},r.prototype.onPlayerResize=function(t,e){this.sdkImpl.onPlayerResize(t,e)},r.prototype.onContentComplete=function(){this.sdkImpl.onContentComplete()},r.prototype.onNoPostroll=function(){this.playerWrapper.onNoPostroll()},r.prototype.onContentAndAdsCompleted=function(){for(var t in this.contentAndAdsEndedListeners)"function"==typeof this.contentAndAdsEndedListeners[t]&&this.contentAndAdsEndedListeners[t]()},r.prototype.onPlayerDisposed=function(){this.contentAndAdsEndedListeners=[],this.sdkImpl.onPlayerDisposed()},r.prototype.onPlayerReadyForPreroll=function(){this.sdkImpl.onPlayerReadyForPreroll()},r.prototype.onPlayerReady=function(){this.sdkImpl.onPlayerReady()},r.prototype.onPlayerEnterFullscreen=function(){this.adUi.onPlayerEnterFullscreen(),this.sdkImpl.onPlayerEnterFullscreen()},r.prototype.onPlayerExitFullscreen=function(){this.adUi.onPlayerExitFullscreen(),this.sdkImpl.onPlayerExitFullscreen()},r.prototype.onPlayerVolumeChanged=function(t){this.adUi.onPlayerVolumeChanged(t),this.sdkImpl.onPlayerVolumeChanged(t)},r.prototype.setContentWithAdTag=function(t,e){this.reset(),this.settings.adTagUrl=e||this.settings.adTagUrl,this.playerWrapper.changeSource(t)},r.prototype.setContentWithAdsResponse=function(t,e){this.reset(),this.settings.adsResponse=e||this.settings.adsResponse,this.playerWrapper.changeSource(t)},r.prototype.setContentWithAdsRequest=function(t,e){this.reset(),this.settings.adsRequest=e||this.settings.adsRequest,this.playerWrapper.changeSource(t)},r.prototype.reset=function(){this.sdkImpl.reset(),this.playerWrapper.reset(),this.adUi.reset()},r.prototype.addContentEndedListener=function(t){this.playerWrapper.addContentEndedListener(t)},r.prototype.addContentAndAdsEndedListener=function(t){this.contentAndAdsEndedListeners.push(t)},r.prototype.setAdBreakReadyListener=function(t){this.sdkImpl.setAdBreakReadyListener(t)},r.prototype.setShowCountdown=function(t){this.adUi.setShowCountdown(t),this.showCountdown=t,this.countdownDiv.style.display=this.showCountdown?"block":"none"},r.prototype.initializeAdDisplayContainer=function(){this.sdkImpl.initializeAdDisplayContainer()},r.prototype.playAdBreak=function(){this.sdkImpl.playAdBreak()},r.prototype.addEventListener=function(t,e){this.sdkImpl.addEventListener(t,e)},r.prototype.getAdsManager=function(){return this.sdkImpl.getAdsManager()},r.prototype.getPlayerId=function(){return this.playerWrapper.getPlayerId()},r.prototype.changeAdTag=function(t){this.reset(),this.settings.adTagUrl=t},r.prototype.pauseAd=function(){this.adUi.onAdsPaused(),this.sdkImpl.pauseAds()},r.prototype.resumeAd=function(){this.adUi.onAdsPlaying(),this.sdkImpl.resumeAds()},r.prototype.adsWillAutoplay=function(){return void 0!==this.settings.adsWillAutoplay?this.settings.adsWillAutoplay:void 0!==this.settings.adWillAutoplay?this.settings.adWillAutoplay:!!this.playerWrapper.getPlayerOptions().autoplay},r.prototype.adsWillPlayMuted=function(){return void 0!==this.settings.adsWillPlayMuted?this.settings.adsWillPlayMuted:void 0!==this.settings.adWillPlayMuted?this.settings.adWillPlayMuted:void 0!==this.playerWrapper.getPlayerOptions().muted?this.playerWrapper.getPlayerOptions().muted:0==this.playerWrapper.getVolume()},r.prototype.triggerPlayerEvent=function(t,e){this.playerWrapper.triggerPlayerEvent(t,e)},r.prototype.extend=function(t){for(var e=void 0,i=void 0,n=void 0,s=arguments.length,o=Array(s>1?s-1:0),r=1;r Date: Mon, 30 Sep 2019 10:18:58 -0400 Subject: [PATCH 16/22] Updates readme for accurate locale codes --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 60680bfb..5d89453f 100644 --- a/README.md +++ b/README.md @@ -155,7 +155,7 @@ the previous snippet. A summary of all settings follows: | disableCustomPlaybackForIOS10Plus | boolean | Sets whether to disable custom playback on iOS 10+ browsers. If true, ads will play inline if the content video is inline. Defaults to false. | | forceNonLinearFullSlot | boolean | True to force non-linear AdSense ads to render as linear fullslot.,If set, the content video will be paused and the non-linear text or image ad will be rendered as,fullslot. The content video will resume once the ad has been skipped or closed. | | id | string | **DEPRECATED** as of v.1.5.0, no longer used or required. | -| locale | string | Locale for ad localization. This may be any,ISO 639-1 (two-letter) or ISO 639-2,(three-letter) code(4). Defaults to 'en'. | +| locale | string | Locale for ad localization. The supported locale codes can be found in [Localizing for Language and Locale](//developers.google.com/interactive-media-ads/docs/sdks/html5/localization)| | nonLinearWidth | number | Desired width of non-linear ads. Defaults to player width. | | nonLinearHeight | number | Desired height for non-linear ads. Defaults to 1/3 player height. | | numRedirects | number | Maximum number of VAST redirects before the subsequent redirects will be denied,,and the ad load aborted. The number of redirects directly affects latency and thus user experience.,This applies to all VAST wrapper ads. | @@ -172,7 +172,7 @@ the previous snippet. A summary of all settings follows:
(3) [contrib-ads plugin](//github.com/videojs/videojs-contrib-ads)
-(4) [Valid locale codes](http://www.loc.gov/standards/iso639-2/php/English_list.php) +(4) [Valid locale codes](//developers.google.com/interactive-media-ads/docs/sdks/html5/localization)
(5) [google.ima.ImaSdkSettings.VpaidMode](//developers.google.com/interactive-media-ads/docs/sdks/html5/v3/apis#ima.ImaSdkSettings.VpaidMode) From 054a57bff43aa18e785009b8c07e856939f4960c Mon Sep 17 00:00:00 2001 From: Kiro705 Date: Mon, 30 Sep 2019 10:25:31 -0400 Subject: [PATCH 17/22] update to v1.6.3 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5db8847e..0235ab1f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "videojs-ima", - "version": "1.6.2", + "version": "1.6.3", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 3af1ddce..244c790f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "videojs-ima", - "version": "1.6.2", + "version": "1.6.3", "license": "Apache-2.0", "main": "./dist/videojs.ima.js", "module": "./dist/videojs.ima.es.js", From 3e10247b9570b9acab6728156ca3e97dfe2f3a3e Mon Sep 17 00:00:00 2001 From: Kiro705 Date: Mon, 30 Sep 2019 14:13:32 -0400 Subject: [PATCH 18/22] updated dist files for 1.6.3 --- dist/videojs.ima.es.js | 11 ++++++++--- dist/videojs.ima.js | 11 ++++++++--- dist/videojs.ima.min.js | 2 +- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/dist/videojs.ima.es.js b/dist/videojs.ima.es.js index e15423f5..b0d15c2a 100644 --- a/dist/videojs.ima.es.js +++ b/dist/videojs.ima.es.js @@ -141,6 +141,10 @@ var PlayerWrapper = function PlayerWrapper(player, adsPluginSettings, controller this.vjsPlayer.on('readyforpreroll', this.onReadyForPreroll.bind(this)); this.vjsPlayer.ready(this.onPlayerReady.bind(this)); + if (this.controller.getSettings().requestMode === 'onPlay') { + this.vjsPlayer.one('play', this.controller.requestAds.bind(this.controller)); + } + this.vjsPlayer.ads(adsPluginSettings); }; @@ -1102,7 +1106,7 @@ AdUi.prototype.setShowCountdown = function (showCountdownIn) { }; var name = "videojs-ima"; -var version = "1.6.2"; +var version = "1.6.3"; var license = "Apache-2.0"; var main = "./dist/videojs.ima.js"; var module$1 = "./dist/videojs.ima.es.js"; @@ -1610,7 +1614,7 @@ SdkImpl.prototype.onPlayerReadyForPreroll = function () { SdkImpl.prototype.onPlayerReady = function () { this.initAdObjects(); - if (this.controller.getSettings().adTagUrl || this.controller.getSettings().adsResponse) { + if ((this.controller.getSettings().adTagUrl || this.controller.getSettings().adsResponse) && this.controller.getSettings().requestMode === 'onLoad') { this.requestAds(); } }; @@ -1895,7 +1899,8 @@ Controller.IMA_DEFAULTS = { prerollTimeout: 1000, adLabel: 'Advertisement', adLabelNofN: 'of', - showControlsForJSAds: true + showControlsForJSAds: true, + requestMode: 'onLoad' }; /** diff --git a/dist/videojs.ima.js b/dist/videojs.ima.js index ca8fab88..9d005969 100644 --- a/dist/videojs.ima.js +++ b/dist/videojs.ima.js @@ -147,6 +147,10 @@ var PlayerWrapper = function PlayerWrapper(player, adsPluginSettings, controller this.vjsPlayer.on('readyforpreroll', this.onReadyForPreroll.bind(this)); this.vjsPlayer.ready(this.onPlayerReady.bind(this)); + if (this.controller.getSettings().requestMode === 'onPlay') { + this.vjsPlayer.one('play', this.controller.requestAds.bind(this.controller)); + } + this.vjsPlayer.ads(adsPluginSettings); }; @@ -1108,7 +1112,7 @@ AdUi.prototype.setShowCountdown = function (showCountdownIn) { }; var name = "videojs-ima"; -var version = "1.6.2"; +var version = "1.6.3"; var license = "Apache-2.0"; var main = "./dist/videojs.ima.js"; var module$1 = "./dist/videojs.ima.es.js"; @@ -1616,7 +1620,7 @@ SdkImpl.prototype.onPlayerReadyForPreroll = function () { SdkImpl.prototype.onPlayerReady = function () { this.initAdObjects(); - if (this.controller.getSettings().adTagUrl || this.controller.getSettings().adsResponse) { + if ((this.controller.getSettings().adTagUrl || this.controller.getSettings().adsResponse) && this.controller.getSettings().requestMode === 'onLoad') { this.requestAds(); } }; @@ -1901,7 +1905,8 @@ Controller.IMA_DEFAULTS = { prerollTimeout: 1000, adLabel: 'Advertisement', adLabelNofN: 'of', - showControlsForJSAds: true + showControlsForJSAds: true, + requestMode: 'onLoad' }; /** diff --git a/dist/videojs.ima.min.js b/dist/videojs.ima.min.js index fc0c0564..83884d80 100644 --- a/dist/videojs.ima.min.js +++ b/dist/videojs.ima.min.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("video.js")):"function"==typeof define&&define.amd?define(["video.js"],e):t.videojsIma=e(t.videojs)}(this,function(t){"use strict";t=t&&t.hasOwnProperty("default")?t.default:t;var e=function(t,e,i){this.vjsPlayer=t,this.controller=i,this.contentTrackingTimer=null,this.contentComplete=!1,this.updateTimeIntervalHandle=null,this.updateTimeInterval=1e3,this.seekCheckIntervalHandle=null,this.seekCheckInterval=1e3,this.resizeCheckIntervalHandle=null,this.resizeCheckInterval=250,this.seekThreshold=100,this.contentEndedListeners=[],this.contentSource="",this.contentSourceType="",this.contentPlayheadTracker={currentTime:0,previousTime:0,seeking:!1,duration:0},this.vjsPlayerDimensions={width:this.getPlayerWidth(),height:this.getPlayerHeight()},this.vjsControls=this.vjsPlayer.getChild("controlBar"),this.h5Player=null,this.vjsPlayer.one("play",this.setUpPlayerIntervals.bind(this)),this.boundContentEndedListener=this.localContentEndedListener.bind(this),this.vjsPlayer.on("contentended",this.boundContentEndedListener),this.vjsPlayer.on("dispose",this.playerDisposedListener.bind(this)),this.vjsPlayer.on("readyforpreroll",this.onReadyForPreroll.bind(this)),this.vjsPlayer.ready(this.onPlayerReady.bind(this)),this.vjsPlayer.ads(e)};e.prototype.setUpPlayerIntervals=function(){this.updateTimeIntervalHandle=setInterval(this.updateCurrentTime.bind(this),this.updateTimeInterval),this.seekCheckIntervalHandle=setInterval(this.checkForSeeking.bind(this),this.seekCheckInterval),this.resizeCheckIntervalHandle=setInterval(this.checkForResize.bind(this),this.resizeCheckInterval)},e.prototype.updateCurrentTime=function(){this.contentPlayheadTracker.seeking||(this.contentPlayheadTracker.currentTime=this.vjsPlayer.currentTime())},e.prototype.checkForSeeking=function(){var t=1e3*(this.vjsPlayer.currentTime()-this.contentPlayheadTracker.previousTime);Math.abs(t)>this.seekCheckInterval+this.seekThreshold?this.contentPlayheadTracker.seeking=!0:this.contentPlayheadTracker.seeking=!1,this.contentPlayheadTracker.previousTime=this.vjsPlayer.currentTime()},e.prototype.checkForResize=function(){var t=this.getPlayerWidth(),e=this.getPlayerHeight();t==this.vjsPlayerDimensions.width&&e==this.vjsPlayerDimensions.height||(this.vjsPlayerDimensions.width=t,this.vjsPlayerDimensions.height=e,this.controller.onPlayerResize(t,e))},e.prototype.localContentEndedListener=function(){for(var t in this.contentComplete||(this.contentComplete=!0,this.controller.onContentComplete()),this.contentEndedListeners)"function"==typeof this.contentEndedListeners[t]&&this.contentEndedListeners[t]();clearInterval(this.updateTimeIntervalHandle),clearInterval(this.seekCheckIntervalHandle),clearInterval(this.resizeCheckIntervalHandle),this.vjsPlayer.el()&&this.vjsPlayer.one("play",this.setUpPlayerIntervals.bind(this))},e.prototype.onNoPostroll=function(){this.vjsPlayer.trigger("nopostroll")},e.prototype.playerDisposedListener=function(){this.contentEndedListeners=[],this.controller.onPlayerDisposed(),this.contentComplete=!0,this.vjsPlayer.off("contentended",this.boundContentEndedListener),this.vjsPlayer.ads.adTimeoutTimeout&&clearTimeout(this.vjsPlayer.ads.adTimeoutTimeout);var t=[this.updateTimeIntervalHandle,this.seekCheckIntervalHandle,this.resizeCheckIntervalHandle];for(var e in t)t[e]&&clearInterval(t[e])},e.prototype.onReadyForPreroll=function(){this.controller.onPlayerReadyForPreroll()},e.prototype.onPlayerReady=function(){this.h5Player=document.getElementById(this.getPlayerId()).getElementsByClassName("vjs-tech")[0],this.h5Player.hasAttribute("autoplay")&&this.controller.setSetting("adWillAutoPlay",!0),this.onVolumeChange(),this.vjsPlayer.on("fullscreenchange",this.onFullscreenChange.bind(this)),this.vjsPlayer.on("volumechange",this.onVolumeChange.bind(this)),this.controller.onPlayerReady()},e.prototype.onFullscreenChange=function(){this.vjsPlayer.isFullscreen()?this.controller.onPlayerEnterFullscreen():this.controller.onPlayerExitFullscreen()},e.prototype.onVolumeChange=function(){var t=this.vjsPlayer.muted()?0:this.vjsPlayer.volume();this.controller.onPlayerVolumeChanged(t)},e.prototype.injectAdContainerDiv=function(t){this.vjsControls.el().parentNode.appendChild(t)},e.prototype.getContentPlayer=function(){return this.h5Player},e.prototype.getVolume=function(){return this.vjsPlayer.muted()?0:this.vjsPlayer.volume()},e.prototype.setVolume=function(t){this.vjsPlayer.volume(t),0==t?this.vjsPlayer.muted(!0):this.vjsPlayer.muted(!1)},e.prototype.unmute=function(){this.vjsPlayer.muted(!1)},e.prototype.mute=function(){this.vjsPlayer.muted(!0)},e.prototype.play=function(){this.vjsPlayer.play()},e.prototype.getPlayerWidth=function(){var t=(getComputedStyle(this.vjsPlayer.el())||{}).width;return t&&0!==parseFloat(t)||(t=(this.vjsPlayer.el().getBoundingClientRect()||{}).width),parseFloat(t)||this.vjsPlayer.width()},e.prototype.getPlayerHeight=function(){var t=(getComputedStyle(this.vjsPlayer.el())||{}).height;return t&&0!==parseFloat(t)||(t=(this.vjsPlayer.el().getBoundingClientRect()||{}).height),parseFloat(t)||this.vjsPlayer.height()},e.prototype.getPlayerOptions=function(){return this.vjsPlayer.options_},e.prototype.getPlayerId=function(){return this.vjsPlayer.id()},e.prototype.toggleFullscreen=function(){this.vjsPlayer.isFullscreen()?this.vjsPlayer.exitFullscreen():this.vjsPlayer.requestFullscreen()},e.prototype.getContentPlayheadTracker=function(){return this.contentPlayheadTracker},e.prototype.onAdError=function(t){this.vjsControls.show();var e=void 0!==t.getError?t.getError():t.stack;this.vjsPlayer.trigger({type:"adserror",data:{AdError:e,AdErrorEvent:t}})},e.prototype.onAdLog=function(t){var e=t.getAdData(),i=void 0!==e.adError?e.adError.getMessage():void 0;this.vjsPlayer.trigger({type:"adslog",data:{AdError:i,AdEvent:t}})},e.prototype.onAdBreakStart=function(){this.contentSource=this.vjsPlayer.currentSrc(),this.contentSourceType=this.vjsPlayer.currentType(),this.vjsPlayer.off("contentended",this.boundContentEndedListener),this.vjsPlayer.ads.startLinearAdMode(),this.vjsControls.hide(),this.vjsPlayer.pause()},e.prototype.onAdBreakEnd=function(){this.vjsPlayer.on("contentended",this.boundContentEndedListener),this.vjsPlayer.ads.inAdBreak()&&this.vjsPlayer.ads.endLinearAdMode(),this.vjsControls.show()},e.prototype.onAdStart=function(){this.vjsPlayer.trigger("ads-ad-started")},e.prototype.onAllAdsCompleted=function(){1==this.contentComplete&&(this.vjsPlayer.currentSrc()!=this.contentSource&&this.vjsPlayer.src({src:this.contentSource,type:this.contentSourceType}),this.controller.onContentAndAdsCompleted())},e.prototype.onAdsReady=function(){this.vjsPlayer.trigger("adsready")},e.prototype.changeSource=function(t){this.vjsPlayer.currentSrc()&&(this.vjsPlayer.currentTime(0),this.vjsPlayer.pause()),t&&this.vjsPlayer.src(t),this.vjsPlayer.one("loadedmetadata",this.seekContentToZero.bind(this))},e.prototype.seekContentToZero=function(){this.vjsPlayer.currentTime(0)},e.prototype.triggerPlayerEvent=function(t,e){this.vjsPlayer.trigger(t,e)},e.prototype.addContentEndedListener=function(t){this.contentEndedListeners.push(t)},e.prototype.reset=function(){this.vjsPlayer.on("contentended",this.boundContentEndedListener),this.vjsControls.show(),this.vjsPlayer.ads.inAdBreak()&&this.vjsPlayer.ads.endLinearAdMode(),this.contentPlayheadTracker.currentTime=0,this.contentComplete=!1};var i=function(t){this.controller=t,this.adContainerDiv=document.createElement("div"),this.controlsDiv=document.createElement("div"),this.countdownDiv=document.createElement("div"),this.seekBarDiv=document.createElement("div"),this.progressDiv=document.createElement("div"),this.playPauseDiv=document.createElement("div"),this.muteDiv=document.createElement("div"),this.sliderDiv=document.createElement("div"),this.sliderLevelDiv=document.createElement("div"),this.fullscreenDiv=document.createElement("div"),this.boundOnMouseUp=this.onMouseUp.bind(this),this.boundOnMouseMove=this.onMouseMove.bind(this),this.adPlayheadTracker={currentTime:0,duration:0,isPod:!1,adPosition:0,totalAds:0},this.controlPrefix=this.controller.getPlayerId()+"_",this.showCountdown=!0,!1===this.controller.getSettings().showCountdown&&(this.showCountdown=!1),this.createAdContainer()};i.prototype.createAdContainer=function(){this.assignControlAttributes(this.adContainerDiv,"ima-ad-container"),this.adContainerDiv.style.position="absolute",this.adContainerDiv.style.zIndex=1111,this.adContainerDiv.addEventListener("mouseenter",this.showAdControls.bind(this),!1),this.adContainerDiv.addEventListener("mouseleave",this.hideAdControls.bind(this),!1),this.createControls(),this.controller.injectAdContainerDiv(this.adContainerDiv)},i.prototype.createControls=function(){this.assignControlAttributes(this.controlsDiv,"ima-controls-div"),this.controlsDiv.style.width="100%",this.assignControlAttributes(this.countdownDiv,"ima-countdown-div"),this.countdownDiv.innerHTML=this.controller.getSettings().adLabel,this.countdownDiv.style.display=this.showCountdown?"block":"none",this.assignControlAttributes(this.seekBarDiv,"ima-seek-bar-div"),this.seekBarDiv.style.width="100%",this.assignControlAttributes(this.progressDiv,"ima-progress-div"),this.assignControlAttributes(this.playPauseDiv,"ima-play-pause-div"),this.addClass(this.playPauseDiv,"ima-playing"),this.playPauseDiv.addEventListener("click",this.onAdPlayPauseClick.bind(this),!1),this.assignControlAttributes(this.muteDiv,"ima-mute-div"),this.addClass(this.muteDiv,"ima-non-muted"),this.muteDiv.addEventListener("click",this.onAdMuteClick.bind(this),!1),this.assignControlAttributes(this.sliderDiv,"ima-slider-div"),this.sliderDiv.addEventListener("mousedown",this.onAdVolumeSliderMouseDown.bind(this),!1),this.controller.getIsIos()&&(this.sliderDiv.style.display="none"),this.assignControlAttributes(this.sliderLevelDiv,"ima-slider-level-div"),this.assignControlAttributes(this.fullscreenDiv,"ima-fullscreen-div"),this.addClass(this.fullscreenDiv,"ima-non-fullscreen"),this.fullscreenDiv.addEventListener("click",this.onAdFullscreenClick.bind(this),!1),this.adContainerDiv.appendChild(this.controlsDiv),this.controlsDiv.appendChild(this.countdownDiv),this.controlsDiv.appendChild(this.seekBarDiv),this.controlsDiv.appendChild(this.playPauseDiv),this.controlsDiv.appendChild(this.muteDiv),this.controlsDiv.appendChild(this.sliderDiv),this.controlsDiv.appendChild(this.fullscreenDiv),this.seekBarDiv.appendChild(this.progressDiv),this.sliderDiv.appendChild(this.sliderLevelDiv)},i.prototype.onAdPlayPauseClick=function(){this.controller.onAdPlayPauseClick()},i.prototype.onAdMuteClick=function(){this.controller.onAdMuteClick()},i.prototype.onAdFullscreenClick=function(){this.controller.toggleFullscreen()},i.prototype.onAdsPaused=function(){this.addClass(this.playPauseDiv,"ima-paused"),this.removeClass(this.playPauseDiv,"ima-playing"),this.showAdControls()},i.prototype.onAdsResumed=function(){this.onAdsPlaying(),this.showAdControls()},i.prototype.onAdsPlaying=function(){this.addClass(this.playPauseDiv,"ima-playing"),this.removeClass(this.playPauseDiv,"ima-paused")},i.prototype.updateAdUi=function(t,e,i,n,s){var o=Math.floor(e/60),r=Math.floor(e%60);r.toString().length<2&&(r="0"+r);var a=": ";s>1&&(a=" ("+n+" "+this.controller.getSettings().adLabelNofN+" "+s+"): "),this.countdownDiv.innerHTML=this.controller.getSettings().adLabel+a+o+":"+r;var d=100*(t/i);this.progressDiv.style.width=d+"%"},i.prototype.unmute=function(){this.addClass(this.muteDiv,"ima-non-muted"),this.removeClass(this.muteDiv,"ima-muted"),this.sliderLevelDiv.style.width=100*this.controller.getPlayerVolume()+"%"},i.prototype.mute=function(){this.addClass(this.muteDiv,"ima-muted"),this.removeClass(this.muteDiv,"ima-non-muted"),this.sliderLevelDiv.style.width="0%"},i.prototype.onAdVolumeSliderMouseDown=function(){document.addEventListener("mouseup",this.boundOnMouseUp,!1),document.addEventListener("mousemove",this.boundOnMouseMove,!1)},i.prototype.onMouseMove=function(t){this.changeVolume(t)},i.prototype.onMouseUp=function(t){this.changeVolume(t),document.removeEventListener("mouseup",this.boundOnMouseUp),document.removeEventListener("mousemove",this.boundOnMouseMove)},i.prototype.changeVolume=function(t){var e=(t.clientX-this.sliderDiv.getBoundingClientRect().left)/this.sliderDiv.offsetWidth;e*=100,e=Math.min(Math.max(e,0),100),this.sliderLevelDiv.style.width=e+"%",0==this.percent?(this.addClass(this.muteDiv,"ima-muted"),this.removeClass(this.muteDiv,"ima-non-muted")):(this.addClass(this.muteDiv,"ima-non-muted"),this.removeClass(this.muteDiv,"ima-muted")),this.controller.setVolume(e/100)},i.prototype.showAdContainer=function(){this.adContainerDiv.style.display="block"},i.prototype.hideAdContainer=function(){this.adContainerDiv.style.display="none"},i.prototype.reset=function(){this.hideAdContainer()},i.prototype.onAdError=function(){this.hideAdContainer()},i.prototype.onAdBreakStart=function(t){this.showAdContainer(),"application/javascript"!==t.getAd().getContentType()||this.controller.getSettings().showControlsForJSAds?this.controlsDiv.style.display="block":this.controlsDiv.style.display="none",this.onAdsPlaying(),this.hideAdControls()},i.prototype.onAdBreakEnd=function(){var t=this.controller.getCurrentAd();(null==t||t.isLinear())&&this.hideAdContainer(),this.controlsDiv.style.display="none",this.countdownDiv.innerHTML=""},i.prototype.onAllAdsCompleted=function(){this.hideAdContainer()},i.prototype.onLinearAdStart=function(){this.removeClass(this.adContainerDiv,"bumpable-ima-ad-container")},i.prototype.onNonLinearAdLoad=function(){this.adContainerDiv.style.display="block",this.addClass(this.adContainerDiv,"bumpable-ima-ad-container")},i.prototype.onPlayerEnterFullscreen=function(){this.addClass(this.fullscreenDiv,"ima-fullscreen"),this.removeClass(this.fullscreenDiv,"ima-non-fullscreen")},i.prototype.onPlayerExitFullscreen=function(){this.addClass(this.fullscreenDiv,"ima-non-fullscreen"),this.removeClass(this.fullscreenDiv,"ima-fullscreen")},i.prototype.onPlayerVolumeChanged=function(t){0==t?(this.addClass(this.muteDiv,"ima-muted"),this.removeClass(this.muteDiv,"ima-non-muted"),this.sliderLevelDiv.style.width="0%"):(this.addClass(this.muteDiv,"ima-non-muted"),this.removeClass(this.muteDiv,"ima-muted"),this.sliderLevelDiv.style.width=100*t+"%")},i.prototype.showAdControls=function(){this.addClass(this.controlsDiv,"ima-controls-div-showing"),this.playPauseDiv.style.display="block",this.muteDiv.style.display="block",this.fullscreenDiv.style.display="block",this.controller.getIsIos()||(this.sliderDiv.style.display="block")},i.prototype.hideAdControls=function(){this.removeClass(this.controlsDiv,"ima-controls-div-showing"),this.playPauseDiv.style.display="none",this.muteDiv.style.display="none",this.sliderDiv.style.display="none",this.fullscreenDiv.style.display="none"},i.prototype.assignControlAttributes=function(t,e){t.id=this.controlPrefix+e,t.className=this.controlPrefix+e+" "+e},i.prototype.getClassRegexp=function(t){return new RegExp("(^|[^A-Za-z-])"+t+"((?![A-Za-z-])|$)","gi")},i.prototype.elementHasClass=function(t,e){return this.getClassRegexp(e).test(t.className)},i.prototype.addClass=function(t,e){t.className=t.className.trim()+" "+e},i.prototype.removeClass=function(t,e){var i=this.getClassRegexp(e);t.className=t.className.trim().replace(i,"")},i.prototype.getAdContainerDiv=function(){return this.adContainerDiv},i.prototype.setShowCountdown=function(t){this.showCountdown=t,this.countdownDiv.style.display=this.showCountdown?"block":"none"};var n="1.6.2",s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=function(t){this.controller=t,this.adDisplayContainer=null,this.adDisplayContainerInitialized=!1,this.adsLoader=null,this.adsManager=null,this.adsRenderingSettings=null,this.adsResponse=null,this.currentAd=null,this.adTrackingTimer=null,this.allAdsCompleted=!1,this.adsActive=!1,this.adPlaying=!1,this.adMuted=!1,this.adBreakReadyListener=void 0,this.contentCompleteCalled=!1,this.adsManagerDimensions={width:0,height:0},this.autoPlayAdBreaks=!0,!1===this.controller.getSettings().autoPlayAdBreaks&&(this.autoPlayAdBreaks=!1),this.controller.getSettings().locale&&google.ima.settings.setLocale(this.controller.getSettings().locale),this.controller.getSettings().disableFlashAds&&google.ima.settings.setDisableFlashAds(this.controller.getSettings().disableFlashAds),this.controller.getSettings().disableCustomPlaybackForIOS10Plus&&google.ima.settings.setDisableCustomPlaybackForIOS10Plus(this.controller.getSettings().disableCustomPlaybackForIOS10Plus)};o.prototype.initAdObjects=function(){this.adDisplayContainer=new google.ima.AdDisplayContainer(this.controller.getAdContainerDiv(),this.controller.getContentPlayer()),this.adsLoader=new google.ima.AdsLoader(this.adDisplayContainer),this.adsLoader.getSettings().setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.ENABLED),0==this.controller.getSettings().vpaidAllowed&&this.adsLoader.getSettings().setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.DISABLED),this.controller.getSettings().vpaidMode&&this.adsLoader.getSettings().setVpaidMode(this.controller.getSettings().vpaidMode),this.controller.getSettings().locale&&this.adsLoader.getSettings().setLocale(this.controller.getSettings().locale),this.controller.getSettings().numRedirects&&this.adsLoader.getSettings().setNumRedirects(this.controller.getSettings().numRedirects),this.adsLoader.getSettings().setPlayerType("videojs-ima"),this.adsLoader.getSettings().setPlayerVersion(n),this.adsLoader.getSettings().setAutoPlayAdBreaks(this.autoPlayAdBreaks),this.adsLoader.addEventListener(google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.onAdsManagerLoaded.bind(this),!1),this.adsLoader.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,this.onAdsLoaderError.bind(this),!1)},o.prototype.requestAds=function(){var t=new google.ima.AdsRequest;this.controller.getSettings().adTagUrl?t.adTagUrl=this.controller.getSettings().adTagUrl:t.adsResponse=this.controller.getSettings().adsResponse,this.controller.getSettings().forceNonLinearFullSlot&&(t.forceNonLinearFullSlot=!0),this.controller.getSettings().vastLoadTimeout&&(t.vastLoadTimeout=this.controller.getSettings().vastLoadTimeout),t.linearAdSlotWidth=this.controller.getPlayerWidth(),t.linearAdSlotHeight=this.controller.getPlayerHeight(),t.nonLinearAdSlotWidth=this.controller.getSettings().nonLinearWidth||this.controller.getPlayerWidth(),t.nonLinearAdSlotHeight=this.controller.getSettings().nonLinearHeight||this.controller.getPlayerHeight(),t.setAdWillAutoPlay(this.controller.adsWillAutoplay()),t.setAdWillPlayMuted(this.controller.adsWillPlayMuted());var e=this.controller.getSettings().adsRequest;e&&"object"===(void 0===e?"undefined":s(e))&&Object.keys(e).forEach(function(i){t[i]=e[i]}),this.adsLoader.requestAds(t),this.controller.triggerPlayerEvent("ads-request",t)},o.prototype.onAdsManagerLoaded=function(t){this.createAdsRenderingSettings(),this.adsManager=t.getAdsManager(this.controller.getContentPlayheadTracker(),this.adsRenderingSettings),this.adsManager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,this.onAdError.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.AD_BREAK_READY,this.onAdBreakReady.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,this.onContentPauseRequested.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,this.onContentResumeRequested.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.ALL_ADS_COMPLETED,this.onAllAdsCompleted.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.LOADED,this.onAdLoaded.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.STARTED,this.onAdStarted.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.COMPLETE,this.onAdComplete.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.SKIPPED,this.onAdComplete.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.LOG,this.onAdLog.bind(this)),this.controller.getIsMobile()&&(this.adsManager.addEventListener(google.ima.AdEvent.Type.PAUSED,this.onAdPaused.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.RESUMED,this.onAdResumed.bind(this))),this.autoPlayAdBreaks||this.initAdsManager(),this.controller.onAdsReady(),this.controller.getSettings().adsManagerLoadedCallback&&this.controller.getSettings().adsManagerLoadedCallback()},o.prototype.onAdsLoaderError=function(t){window.console.warn("AdsLoader error: "+t.getError()),this.controller.onErrorLoadingAds(t),this.adsManager&&this.adsManager.destroy()},o.prototype.initAdsManager=function(){try{var t=this.controller.getPlayerWidth(),e=this.controller.getPlayerHeight();this.adsManagerDimensions.width=t,this.adsManagerDimensions.height=e,this.adsManager.init(t,e,google.ima.ViewMode.NORMAL),this.adsManager.setVolume(this.controller.getPlayerVolume()),this.initializeAdDisplayContainer()}catch(t){this.onAdError(t)}},o.prototype.createAdsRenderingSettings=function(){if(this.adsRenderingSettings=new google.ima.AdsRenderingSettings,this.adsRenderingSettings.restoreCustomPlaybackStateOnAdBreakComplete=!0,this.controller.getSettings().adsRenderingSettings)for(var t in this.controller.getSettings().adsRenderingSettings)""!==t&&(this.adsRenderingSettings[t]=this.controller.getSettings().adsRenderingSettings[t])},o.prototype.onAdError=function(t){var e=void 0!==t.getError?t.getError():t.stack;window.console.warn("Ad error: "+e),this.adsManager.destroy(),this.controller.onAdError(t),this.adsActive=!1,this.adPlaying=!1},o.prototype.onAdBreakReady=function(t){this.adBreakReadyListener(t)},o.prototype.onContentPauseRequested=function(t){this.adsActive=!0,this.adPlaying=!0,this.controller.onAdBreakStart(t)},o.prototype.onContentResumeRequested=function(t){this.adsActive=!1,this.adPlaying=!1,this.controller.onAdBreakEnd()},o.prototype.onAllAdsCompleted=function(t){this.allAdsCompleted=!0,this.controller.onAllAdsCompleted()},o.prototype.onAdLoaded=function(t){t.getAd().isLinear()||(this.controller.onNonLinearAdLoad(),this.controller.playContent())},o.prototype.onAdStarted=function(t){this.currentAd=t.getAd(),this.currentAd.isLinear()?(this.adTrackingTimer=setInterval(this.onAdPlayheadTrackerInterval.bind(this),250),this.controller.onLinearAdStart()):this.controller.onNonLinearAdStart()},o.prototype.onAdPaused=function(){this.controller.onAdsPaused()},o.prototype.onAdResumed=function(t){this.controller.onAdsResumed()},o.prototype.onAdComplete=function(){this.currentAd.isLinear()&&clearInterval(this.adTrackingTimer)},o.prototype.onAdLog=function(t){this.controller.onAdLog(t)},o.prototype.onAdPlayheadTrackerInterval=function(){var t=this.adsManager.getRemainingTime(),e=this.currentAd.getDuration(),i=e-t;i=i>0?i:0;var n=0,s=void 0;this.currentAd.getAdPodInfo()&&(s=this.currentAd.getAdPodInfo().getAdPosition(),n=this.currentAd.getAdPodInfo().getTotalAds()),this.controller.onAdPlayheadUpdated(i,t,e,s,n)},o.prototype.onContentComplete=function(){this.adsLoader&&(this.adsLoader.contentComplete(),this.contentCompleteCalled=!0),this.adsManager&&this.adsManager.getCuePoints()&&!this.adsManager.getCuePoints().includes(-1)&&this.controller.onNoPostroll(),this.allAdsCompleted&&this.controller.onContentAndAdsCompleted()},o.prototype.onPlayerDisposed=function(){this.adTrackingTimer&&clearInterval(this.adTrackingTimer),this.adsManager&&(this.adsManager.destroy(),this.adsManager=null)},o.prototype.onPlayerReadyForPreroll=function(){if(this.autoPlayAdBreaks){this.initAdsManager();try{this.controller.showAdContainer(),this.adsManager.setVolume(this.controller.getPlayerVolume()),this.adsManager.start()}catch(t){this.onAdError(t)}}},o.prototype.onPlayerReady=function(){this.initAdObjects(),(this.controller.getSettings().adTagUrl||this.controller.getSettings().adsResponse)&&this.requestAds()},o.prototype.onPlayerEnterFullscreen=function(){this.adsManager&&this.adsManager.resize(window.screen.width,window.screen.height,google.ima.ViewMode.FULLSCREEN)},o.prototype.onPlayerExitFullscreen=function(){this.adsManager&&this.adsManager.resize(this.controller.getPlayerWidth(),this.controller.getPlayerHeight(),google.ima.ViewMode.NORMAL)},o.prototype.onPlayerVolumeChanged=function(t){this.adsManager&&this.adsManager.setVolume(t),this.adMuted=0==t},o.prototype.onPlayerResize=function(t,e){this.adsManager&&(this.adsManagerDimensions.width=t,this.adsManagerDimensions.height=e,this.adsManager.resize(t,e,google.ima.ViewMode.NORMAL))},o.prototype.getCurrentAd=function(){return this.currentAd},o.prototype.setAdBreakReadyListener=function(t){this.adBreakReadyListener=t},o.prototype.isAdPlaying=function(){return this.adPlaying},o.prototype.isAdMuted=function(){return this.adMuted},o.prototype.pauseAds=function(){this.adsManager.pause(),this.adPlaying=!1},o.prototype.resumeAds=function(){this.adsManager.resume(),this.adPlaying=!0},o.prototype.unmute=function(){this.adsManager.setVolume(1),this.adMuted=!1},o.prototype.mute=function(){this.adsManager.setVolume(0),this.adMuted=!0},o.prototype.setVolume=function(t){this.adsManager.setVolume(t),this.adMuted=0==t},o.prototype.initializeAdDisplayContainer=function(){this.adDisplayContainer&&(this.adDisplayContainerInitialized||(this.adDisplayContainer.initialize(),this.adDisplayContainerInitialized=!0))},o.prototype.playAdBreak=function(){this.autoPlayAdBreaks||(this.controller.showAdContainer(),this.adsManager.setVolume(this.controller.getPlayerVolume()),this.adsManager.start())},o.prototype.addEventListener=function(t,e){this.adsManager&&this.adsManager.addEventListener(t,e)},o.prototype.getAdsManager=function(){return this.adsManager},o.prototype.reset=function(){this.adsActive=!1,this.adPlaying=!1,this.adTrackingTimer&&clearInterval(this.adTrackingTimer),this.adsManager&&(this.adsManager.destroy(),this.adsManager=null),this.adsLoader&&!this.contentCompleteCalled&&this.adsLoader.contentComplete(),this.contentCompleteCalled=!1,this.allAdsCompleted=!1};var r=function(t,n){this.settings={},this.contentAndAdsEndedListeners=[],this.isMobile=navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPad/i)||navigator.userAgent.match(/Android/i),this.isIos=navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPad/i),this.initWithSettings(n);var s={debug:this.settings.debug,timeout:this.settings.timeout,prerollTimeout:this.settings.prerollTimeout},r=this.extend({},s,n.contribAdsSettings||{});this.playerWrapper=new e(t,r,this),this.adUi=new i(this),this.sdkImpl=new o(this)};r.IMA_DEFAULTS={debug:!1,timeout:5e3,prerollTimeout:1e3,adLabel:"Advertisement",adLabelNofN:"of",showControlsForJSAds:!0},r.prototype.initWithSettings=function(t){this.settings=this.extend({},r.IMA_DEFAULTS,t||{}),this.warnAboutDeprecatedSettings(),this.showCountdown=!0,!1===this.settings.showCountdown&&(this.showCountdown=!1)},r.prototype.warnAboutDeprecatedSettings=function(){var t=this;["adWillAutoplay","adsWillAutoplay","adWillPlayMuted","adsWillPlayMuted"].forEach(function(e){void 0!==t.settings[e]&&console.warn("WARNING: videojs.ima setting "+e+" is deprecated")})},r.prototype.getSettings=function(){return this.settings},r.prototype.getIsMobile=function(){return this.isMobile},r.prototype.getIsIos=function(){return this.isIos},r.prototype.injectAdContainerDiv=function(t){this.playerWrapper.injectAdContainerDiv(t)},r.prototype.getAdContainerDiv=function(){return this.adUi.getAdContainerDiv()},r.prototype.getContentPlayer=function(){return this.playerWrapper.getContentPlayer()},r.prototype.getContentPlayheadTracker=function(){return this.playerWrapper.getContentPlayheadTracker()},r.prototype.requestAds=function(){this.sdkImpl.requestAds()},r.prototype.setSetting=function(t,e){this.settings[t]=e},r.prototype.onErrorLoadingAds=function(t){this.adUi.onAdError(),this.playerWrapper.onAdError(t)},r.prototype.onAdPlayPauseClick=function(){this.sdkImpl.isAdPlaying()?(this.adUi.onAdsPaused(),this.sdkImpl.pauseAds()):(this.adUi.onAdsPlaying(),this.sdkImpl.resumeAds())},r.prototype.onAdMuteClick=function(){this.sdkImpl.isAdMuted()?(this.playerWrapper.unmute(),this.adUi.unmute(),this.sdkImpl.unmute()):(this.playerWrapper.mute(),this.adUi.mute(),this.sdkImpl.mute())},r.prototype.setVolume=function(t){this.playerWrapper.setVolume(t),this.sdkImpl.setVolume(t)},r.prototype.getPlayerVolume=function(){return this.playerWrapper.getVolume()},r.prototype.toggleFullscreen=function(){this.playerWrapper.toggleFullscreen()},r.prototype.onAdError=function(t){this.adUi.onAdError(),this.playerWrapper.onAdError(t)},r.prototype.onAdBreakStart=function(t){this.playerWrapper.onAdBreakStart(),this.adUi.onAdBreakStart(t)},r.prototype.showAdContainer=function(){this.adUi.showAdContainer()},r.prototype.onAdBreakEnd=function(){this.playerWrapper.onAdBreakEnd(),this.adUi.onAdBreakEnd()},r.prototype.onAllAdsCompleted=function(){this.adUi.onAllAdsCompleted(),this.playerWrapper.onAllAdsCompleted()},r.prototype.onAdsPaused=function(){this.adUi.onAdsPaused()},r.prototype.onAdsResumed=function(){this.adUi.onAdsResumed()},r.prototype.onAdPlayheadUpdated=function(t,e,i,n,s){this.adUi.updateAdUi(t,e,i,n,s)},r.prototype.onAdLog=function(t){this.playerWrapper.onAdLog(t)},r.prototype.getCurrentAd=function(){return this.sdkImpl.getCurrentAd()},r.prototype.playContent=function(){this.playerWrapper.play()},r.prototype.onLinearAdStart=function(){this.adUi.onLinearAdStart(),this.playerWrapper.onAdStart()},r.prototype.onNonLinearAdLoad=function(){this.adUi.onNonLinearAdLoad()},r.prototype.onNonLinearAdStart=function(){this.adUi.onNonLinearAdLoad(),this.playerWrapper.onAdStart()},r.prototype.getPlayerWidth=function(){return this.playerWrapper.getPlayerWidth()},r.prototype.getPlayerHeight=function(){return this.playerWrapper.getPlayerHeight()},r.prototype.onAdsReady=function(){this.playerWrapper.onAdsReady()},r.prototype.onPlayerResize=function(t,e){this.sdkImpl.onPlayerResize(t,e)},r.prototype.onContentComplete=function(){this.sdkImpl.onContentComplete()},r.prototype.onNoPostroll=function(){this.playerWrapper.onNoPostroll()},r.prototype.onContentAndAdsCompleted=function(){for(var t in this.contentAndAdsEndedListeners)"function"==typeof this.contentAndAdsEndedListeners[t]&&this.contentAndAdsEndedListeners[t]()},r.prototype.onPlayerDisposed=function(){this.contentAndAdsEndedListeners=[],this.sdkImpl.onPlayerDisposed()},r.prototype.onPlayerReadyForPreroll=function(){this.sdkImpl.onPlayerReadyForPreroll()},r.prototype.onPlayerReady=function(){this.sdkImpl.onPlayerReady()},r.prototype.onPlayerEnterFullscreen=function(){this.adUi.onPlayerEnterFullscreen(),this.sdkImpl.onPlayerEnterFullscreen()},r.prototype.onPlayerExitFullscreen=function(){this.adUi.onPlayerExitFullscreen(),this.sdkImpl.onPlayerExitFullscreen()},r.prototype.onPlayerVolumeChanged=function(t){this.adUi.onPlayerVolumeChanged(t),this.sdkImpl.onPlayerVolumeChanged(t)},r.prototype.setContentWithAdTag=function(t,e){this.reset(),this.settings.adTagUrl=e||this.settings.adTagUrl,this.playerWrapper.changeSource(t)},r.prototype.setContentWithAdsResponse=function(t,e){this.reset(),this.settings.adsResponse=e||this.settings.adsResponse,this.playerWrapper.changeSource(t)},r.prototype.setContentWithAdsRequest=function(t,e){this.reset(),this.settings.adsRequest=e||this.settings.adsRequest,this.playerWrapper.changeSource(t)},r.prototype.reset=function(){this.sdkImpl.reset(),this.playerWrapper.reset(),this.adUi.reset()},r.prototype.addContentEndedListener=function(t){this.playerWrapper.addContentEndedListener(t)},r.prototype.addContentAndAdsEndedListener=function(t){this.contentAndAdsEndedListeners.push(t)},r.prototype.setAdBreakReadyListener=function(t){this.sdkImpl.setAdBreakReadyListener(t)},r.prototype.setShowCountdown=function(t){this.adUi.setShowCountdown(t),this.showCountdown=t,this.countdownDiv.style.display=this.showCountdown?"block":"none"},r.prototype.initializeAdDisplayContainer=function(){this.sdkImpl.initializeAdDisplayContainer()},r.prototype.playAdBreak=function(){this.sdkImpl.playAdBreak()},r.prototype.addEventListener=function(t,e){this.sdkImpl.addEventListener(t,e)},r.prototype.getAdsManager=function(){return this.sdkImpl.getAdsManager()},r.prototype.getPlayerId=function(){return this.playerWrapper.getPlayerId()},r.prototype.changeAdTag=function(t){this.reset(),this.settings.adTagUrl=t},r.prototype.pauseAd=function(){this.adUi.onAdsPaused(),this.sdkImpl.pauseAds()},r.prototype.resumeAd=function(){this.adUi.onAdsPlaying(),this.sdkImpl.resumeAds()},r.prototype.adsWillAutoplay=function(){return void 0!==this.settings.adsWillAutoplay?this.settings.adsWillAutoplay:void 0!==this.settings.adWillAutoplay?this.settings.adWillAutoplay:!!this.playerWrapper.getPlayerOptions().autoplay},r.prototype.adsWillPlayMuted=function(){return void 0!==this.settings.adsWillPlayMuted?this.settings.adsWillPlayMuted:void 0!==this.settings.adWillPlayMuted?this.settings.adWillPlayMuted:void 0!==this.playerWrapper.getPlayerOptions().muted?this.playerWrapper.getPlayerOptions().muted:0==this.playerWrapper.getVolume()},r.prototype.triggerPlayerEvent=function(t,e){this.playerWrapper.triggerPlayerEvent(t,e)},r.prototype.extend=function(t){for(var e=void 0,i=void 0,n=void 0,s=arguments.length,o=Array(s>1?s-1:0),r=1;rthis.seekCheckInterval+this.seekThreshold?this.contentPlayheadTracker.seeking=!0:this.contentPlayheadTracker.seeking=!1,this.contentPlayheadTracker.previousTime=this.vjsPlayer.currentTime()},e.prototype.checkForResize=function(){var t=this.getPlayerWidth(),e=this.getPlayerHeight();t==this.vjsPlayerDimensions.width&&e==this.vjsPlayerDimensions.height||(this.vjsPlayerDimensions.width=t,this.vjsPlayerDimensions.height=e,this.controller.onPlayerResize(t,e))},e.prototype.localContentEndedListener=function(){for(var t in this.contentComplete||(this.contentComplete=!0,this.controller.onContentComplete()),this.contentEndedListeners)"function"==typeof this.contentEndedListeners[t]&&this.contentEndedListeners[t]();clearInterval(this.updateTimeIntervalHandle),clearInterval(this.seekCheckIntervalHandle),clearInterval(this.resizeCheckIntervalHandle),this.vjsPlayer.el()&&this.vjsPlayer.one("play",this.setUpPlayerIntervals.bind(this))},e.prototype.onNoPostroll=function(){this.vjsPlayer.trigger("nopostroll")},e.prototype.playerDisposedListener=function(){this.contentEndedListeners=[],this.controller.onPlayerDisposed(),this.contentComplete=!0,this.vjsPlayer.off("contentended",this.boundContentEndedListener),this.vjsPlayer.ads.adTimeoutTimeout&&clearTimeout(this.vjsPlayer.ads.adTimeoutTimeout);var t=[this.updateTimeIntervalHandle,this.seekCheckIntervalHandle,this.resizeCheckIntervalHandle];for(var e in t)t[e]&&clearInterval(t[e])},e.prototype.onReadyForPreroll=function(){this.controller.onPlayerReadyForPreroll()},e.prototype.onPlayerReady=function(){this.h5Player=document.getElementById(this.getPlayerId()).getElementsByClassName("vjs-tech")[0],this.h5Player.hasAttribute("autoplay")&&this.controller.setSetting("adWillAutoPlay",!0),this.onVolumeChange(),this.vjsPlayer.on("fullscreenchange",this.onFullscreenChange.bind(this)),this.vjsPlayer.on("volumechange",this.onVolumeChange.bind(this)),this.controller.onPlayerReady()},e.prototype.onFullscreenChange=function(){this.vjsPlayer.isFullscreen()?this.controller.onPlayerEnterFullscreen():this.controller.onPlayerExitFullscreen()},e.prototype.onVolumeChange=function(){var t=this.vjsPlayer.muted()?0:this.vjsPlayer.volume();this.controller.onPlayerVolumeChanged(t)},e.prototype.injectAdContainerDiv=function(t){this.vjsControls.el().parentNode.appendChild(t)},e.prototype.getContentPlayer=function(){return this.h5Player},e.prototype.getVolume=function(){return this.vjsPlayer.muted()?0:this.vjsPlayer.volume()},e.prototype.setVolume=function(t){this.vjsPlayer.volume(t),0==t?this.vjsPlayer.muted(!0):this.vjsPlayer.muted(!1)},e.prototype.unmute=function(){this.vjsPlayer.muted(!1)},e.prototype.mute=function(){this.vjsPlayer.muted(!0)},e.prototype.play=function(){this.vjsPlayer.play()},e.prototype.getPlayerWidth=function(){var t=(getComputedStyle(this.vjsPlayer.el())||{}).width;return t&&0!==parseFloat(t)||(t=(this.vjsPlayer.el().getBoundingClientRect()||{}).width),parseFloat(t)||this.vjsPlayer.width()},e.prototype.getPlayerHeight=function(){var t=(getComputedStyle(this.vjsPlayer.el())||{}).height;return t&&0!==parseFloat(t)||(t=(this.vjsPlayer.el().getBoundingClientRect()||{}).height),parseFloat(t)||this.vjsPlayer.height()},e.prototype.getPlayerOptions=function(){return this.vjsPlayer.options_},e.prototype.getPlayerId=function(){return this.vjsPlayer.id()},e.prototype.toggleFullscreen=function(){this.vjsPlayer.isFullscreen()?this.vjsPlayer.exitFullscreen():this.vjsPlayer.requestFullscreen()},e.prototype.getContentPlayheadTracker=function(){return this.contentPlayheadTracker},e.prototype.onAdError=function(t){this.vjsControls.show();var e=void 0!==t.getError?t.getError():t.stack;this.vjsPlayer.trigger({type:"adserror",data:{AdError:e,AdErrorEvent:t}})},e.prototype.onAdLog=function(t){var e=t.getAdData(),i=void 0!==e.adError?e.adError.getMessage():void 0;this.vjsPlayer.trigger({type:"adslog",data:{AdError:i,AdEvent:t}})},e.prototype.onAdBreakStart=function(){this.contentSource=this.vjsPlayer.currentSrc(),this.contentSourceType=this.vjsPlayer.currentType(),this.vjsPlayer.off("contentended",this.boundContentEndedListener),this.vjsPlayer.ads.startLinearAdMode(),this.vjsControls.hide(),this.vjsPlayer.pause()},e.prototype.onAdBreakEnd=function(){this.vjsPlayer.on("contentended",this.boundContentEndedListener),this.vjsPlayer.ads.inAdBreak()&&this.vjsPlayer.ads.endLinearAdMode(),this.vjsControls.show()},e.prototype.onAdStart=function(){this.vjsPlayer.trigger("ads-ad-started")},e.prototype.onAllAdsCompleted=function(){1==this.contentComplete&&(this.vjsPlayer.currentSrc()!=this.contentSource&&this.vjsPlayer.src({src:this.contentSource,type:this.contentSourceType}),this.controller.onContentAndAdsCompleted())},e.prototype.onAdsReady=function(){this.vjsPlayer.trigger("adsready")},e.prototype.changeSource=function(t){this.vjsPlayer.currentSrc()&&(this.vjsPlayer.currentTime(0),this.vjsPlayer.pause()),t&&this.vjsPlayer.src(t),this.vjsPlayer.one("loadedmetadata",this.seekContentToZero.bind(this))},e.prototype.seekContentToZero=function(){this.vjsPlayer.currentTime(0)},e.prototype.triggerPlayerEvent=function(t,e){this.vjsPlayer.trigger(t,e)},e.prototype.addContentEndedListener=function(t){this.contentEndedListeners.push(t)},e.prototype.reset=function(){this.vjsPlayer.on("contentended",this.boundContentEndedListener),this.vjsControls.show(),this.vjsPlayer.ads.inAdBreak()&&this.vjsPlayer.ads.endLinearAdMode(),this.contentPlayheadTracker.currentTime=0,this.contentComplete=!1};var i=function(t){this.controller=t,this.adContainerDiv=document.createElement("div"),this.controlsDiv=document.createElement("div"),this.countdownDiv=document.createElement("div"),this.seekBarDiv=document.createElement("div"),this.progressDiv=document.createElement("div"),this.playPauseDiv=document.createElement("div"),this.muteDiv=document.createElement("div"),this.sliderDiv=document.createElement("div"),this.sliderLevelDiv=document.createElement("div"),this.fullscreenDiv=document.createElement("div"),this.boundOnMouseUp=this.onMouseUp.bind(this),this.boundOnMouseMove=this.onMouseMove.bind(this),this.adPlayheadTracker={currentTime:0,duration:0,isPod:!1,adPosition:0,totalAds:0},this.controlPrefix=this.controller.getPlayerId()+"_",this.showCountdown=!0,!1===this.controller.getSettings().showCountdown&&(this.showCountdown=!1),this.createAdContainer()};i.prototype.createAdContainer=function(){this.assignControlAttributes(this.adContainerDiv,"ima-ad-container"),this.adContainerDiv.style.position="absolute",this.adContainerDiv.style.zIndex=1111,this.adContainerDiv.addEventListener("mouseenter",this.showAdControls.bind(this),!1),this.adContainerDiv.addEventListener("mouseleave",this.hideAdControls.bind(this),!1),this.createControls(),this.controller.injectAdContainerDiv(this.adContainerDiv)},i.prototype.createControls=function(){this.assignControlAttributes(this.controlsDiv,"ima-controls-div"),this.controlsDiv.style.width="100%",this.assignControlAttributes(this.countdownDiv,"ima-countdown-div"),this.countdownDiv.innerHTML=this.controller.getSettings().adLabel,this.countdownDiv.style.display=this.showCountdown?"block":"none",this.assignControlAttributes(this.seekBarDiv,"ima-seek-bar-div"),this.seekBarDiv.style.width="100%",this.assignControlAttributes(this.progressDiv,"ima-progress-div"),this.assignControlAttributes(this.playPauseDiv,"ima-play-pause-div"),this.addClass(this.playPauseDiv,"ima-playing"),this.playPauseDiv.addEventListener("click",this.onAdPlayPauseClick.bind(this),!1),this.assignControlAttributes(this.muteDiv,"ima-mute-div"),this.addClass(this.muteDiv,"ima-non-muted"),this.muteDiv.addEventListener("click",this.onAdMuteClick.bind(this),!1),this.assignControlAttributes(this.sliderDiv,"ima-slider-div"),this.sliderDiv.addEventListener("mousedown",this.onAdVolumeSliderMouseDown.bind(this),!1),this.controller.getIsIos()&&(this.sliderDiv.style.display="none"),this.assignControlAttributes(this.sliderLevelDiv,"ima-slider-level-div"),this.assignControlAttributes(this.fullscreenDiv,"ima-fullscreen-div"),this.addClass(this.fullscreenDiv,"ima-non-fullscreen"),this.fullscreenDiv.addEventListener("click",this.onAdFullscreenClick.bind(this),!1),this.adContainerDiv.appendChild(this.controlsDiv),this.controlsDiv.appendChild(this.countdownDiv),this.controlsDiv.appendChild(this.seekBarDiv),this.controlsDiv.appendChild(this.playPauseDiv),this.controlsDiv.appendChild(this.muteDiv),this.controlsDiv.appendChild(this.sliderDiv),this.controlsDiv.appendChild(this.fullscreenDiv),this.seekBarDiv.appendChild(this.progressDiv),this.sliderDiv.appendChild(this.sliderLevelDiv)},i.prototype.onAdPlayPauseClick=function(){this.controller.onAdPlayPauseClick()},i.prototype.onAdMuteClick=function(){this.controller.onAdMuteClick()},i.prototype.onAdFullscreenClick=function(){this.controller.toggleFullscreen()},i.prototype.onAdsPaused=function(){this.addClass(this.playPauseDiv,"ima-paused"),this.removeClass(this.playPauseDiv,"ima-playing"),this.showAdControls()},i.prototype.onAdsResumed=function(){this.onAdsPlaying(),this.showAdControls()},i.prototype.onAdsPlaying=function(){this.addClass(this.playPauseDiv,"ima-playing"),this.removeClass(this.playPauseDiv,"ima-paused")},i.prototype.updateAdUi=function(t,e,i,n,s){var o=Math.floor(e/60),r=Math.floor(e%60);r.toString().length<2&&(r="0"+r);var a=": ";s>1&&(a=" ("+n+" "+this.controller.getSettings().adLabelNofN+" "+s+"): "),this.countdownDiv.innerHTML=this.controller.getSettings().adLabel+a+o+":"+r;var d=100*(t/i);this.progressDiv.style.width=d+"%"},i.prototype.unmute=function(){this.addClass(this.muteDiv,"ima-non-muted"),this.removeClass(this.muteDiv,"ima-muted"),this.sliderLevelDiv.style.width=100*this.controller.getPlayerVolume()+"%"},i.prototype.mute=function(){this.addClass(this.muteDiv,"ima-muted"),this.removeClass(this.muteDiv,"ima-non-muted"),this.sliderLevelDiv.style.width="0%"},i.prototype.onAdVolumeSliderMouseDown=function(){document.addEventListener("mouseup",this.boundOnMouseUp,!1),document.addEventListener("mousemove",this.boundOnMouseMove,!1)},i.prototype.onMouseMove=function(t){this.changeVolume(t)},i.prototype.onMouseUp=function(t){this.changeVolume(t),document.removeEventListener("mouseup",this.boundOnMouseUp),document.removeEventListener("mousemove",this.boundOnMouseMove)},i.prototype.changeVolume=function(t){var e=(t.clientX-this.sliderDiv.getBoundingClientRect().left)/this.sliderDiv.offsetWidth;e*=100,e=Math.min(Math.max(e,0),100),this.sliderLevelDiv.style.width=e+"%",0==this.percent?(this.addClass(this.muteDiv,"ima-muted"),this.removeClass(this.muteDiv,"ima-non-muted")):(this.addClass(this.muteDiv,"ima-non-muted"),this.removeClass(this.muteDiv,"ima-muted")),this.controller.setVolume(e/100)},i.prototype.showAdContainer=function(){this.adContainerDiv.style.display="block"},i.prototype.hideAdContainer=function(){this.adContainerDiv.style.display="none"},i.prototype.reset=function(){this.hideAdContainer()},i.prototype.onAdError=function(){this.hideAdContainer()},i.prototype.onAdBreakStart=function(t){this.showAdContainer(),"application/javascript"!==t.getAd().getContentType()||this.controller.getSettings().showControlsForJSAds?this.controlsDiv.style.display="block":this.controlsDiv.style.display="none",this.onAdsPlaying(),this.hideAdControls()},i.prototype.onAdBreakEnd=function(){var t=this.controller.getCurrentAd();(null==t||t.isLinear())&&this.hideAdContainer(),this.controlsDiv.style.display="none",this.countdownDiv.innerHTML=""},i.prototype.onAllAdsCompleted=function(){this.hideAdContainer()},i.prototype.onLinearAdStart=function(){this.removeClass(this.adContainerDiv,"bumpable-ima-ad-container")},i.prototype.onNonLinearAdLoad=function(){this.adContainerDiv.style.display="block",this.addClass(this.adContainerDiv,"bumpable-ima-ad-container")},i.prototype.onPlayerEnterFullscreen=function(){this.addClass(this.fullscreenDiv,"ima-fullscreen"),this.removeClass(this.fullscreenDiv,"ima-non-fullscreen")},i.prototype.onPlayerExitFullscreen=function(){this.addClass(this.fullscreenDiv,"ima-non-fullscreen"),this.removeClass(this.fullscreenDiv,"ima-fullscreen")},i.prototype.onPlayerVolumeChanged=function(t){0==t?(this.addClass(this.muteDiv,"ima-muted"),this.removeClass(this.muteDiv,"ima-non-muted"),this.sliderLevelDiv.style.width="0%"):(this.addClass(this.muteDiv,"ima-non-muted"),this.removeClass(this.muteDiv,"ima-muted"),this.sliderLevelDiv.style.width=100*t+"%")},i.prototype.showAdControls=function(){this.addClass(this.controlsDiv,"ima-controls-div-showing"),this.playPauseDiv.style.display="block",this.muteDiv.style.display="block",this.fullscreenDiv.style.display="block",this.controller.getIsIos()||(this.sliderDiv.style.display="block")},i.prototype.hideAdControls=function(){this.removeClass(this.controlsDiv,"ima-controls-div-showing"),this.playPauseDiv.style.display="none",this.muteDiv.style.display="none",this.sliderDiv.style.display="none",this.fullscreenDiv.style.display="none"},i.prototype.assignControlAttributes=function(t,e){t.id=this.controlPrefix+e,t.className=this.controlPrefix+e+" "+e},i.prototype.getClassRegexp=function(t){return new RegExp("(^|[^A-Za-z-])"+t+"((?![A-Za-z-])|$)","gi")},i.prototype.elementHasClass=function(t,e){return this.getClassRegexp(e).test(t.className)},i.prototype.addClass=function(t,e){t.className=t.className.trim()+" "+e},i.prototype.removeClass=function(t,e){var i=this.getClassRegexp(e);t.className=t.className.trim().replace(i,"")},i.prototype.getAdContainerDiv=function(){return this.adContainerDiv},i.prototype.setShowCountdown=function(t){this.showCountdown=t,this.countdownDiv.style.display=this.showCountdown?"block":"none"};var n="1.6.3",s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=function(t){this.controller=t,this.adDisplayContainer=null,this.adDisplayContainerInitialized=!1,this.adsLoader=null,this.adsManager=null,this.adsRenderingSettings=null,this.adsResponse=null,this.currentAd=null,this.adTrackingTimer=null,this.allAdsCompleted=!1,this.adsActive=!1,this.adPlaying=!1,this.adMuted=!1,this.adBreakReadyListener=void 0,this.contentCompleteCalled=!1,this.adsManagerDimensions={width:0,height:0},this.autoPlayAdBreaks=!0,!1===this.controller.getSettings().autoPlayAdBreaks&&(this.autoPlayAdBreaks=!1),this.controller.getSettings().locale&&google.ima.settings.setLocale(this.controller.getSettings().locale),this.controller.getSettings().disableFlashAds&&google.ima.settings.setDisableFlashAds(this.controller.getSettings().disableFlashAds),this.controller.getSettings().disableCustomPlaybackForIOS10Plus&&google.ima.settings.setDisableCustomPlaybackForIOS10Plus(this.controller.getSettings().disableCustomPlaybackForIOS10Plus)};o.prototype.initAdObjects=function(){this.adDisplayContainer=new google.ima.AdDisplayContainer(this.controller.getAdContainerDiv(),this.controller.getContentPlayer()),this.adsLoader=new google.ima.AdsLoader(this.adDisplayContainer),this.adsLoader.getSettings().setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.ENABLED),0==this.controller.getSettings().vpaidAllowed&&this.adsLoader.getSettings().setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.DISABLED),this.controller.getSettings().vpaidMode&&this.adsLoader.getSettings().setVpaidMode(this.controller.getSettings().vpaidMode),this.controller.getSettings().locale&&this.adsLoader.getSettings().setLocale(this.controller.getSettings().locale),this.controller.getSettings().numRedirects&&this.adsLoader.getSettings().setNumRedirects(this.controller.getSettings().numRedirects),this.adsLoader.getSettings().setPlayerType("videojs-ima"),this.adsLoader.getSettings().setPlayerVersion(n),this.adsLoader.getSettings().setAutoPlayAdBreaks(this.autoPlayAdBreaks),this.adsLoader.addEventListener(google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.onAdsManagerLoaded.bind(this),!1),this.adsLoader.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,this.onAdsLoaderError.bind(this),!1)},o.prototype.requestAds=function(){var t=new google.ima.AdsRequest;this.controller.getSettings().adTagUrl?t.adTagUrl=this.controller.getSettings().adTagUrl:t.adsResponse=this.controller.getSettings().adsResponse,this.controller.getSettings().forceNonLinearFullSlot&&(t.forceNonLinearFullSlot=!0),this.controller.getSettings().vastLoadTimeout&&(t.vastLoadTimeout=this.controller.getSettings().vastLoadTimeout),t.linearAdSlotWidth=this.controller.getPlayerWidth(),t.linearAdSlotHeight=this.controller.getPlayerHeight(),t.nonLinearAdSlotWidth=this.controller.getSettings().nonLinearWidth||this.controller.getPlayerWidth(),t.nonLinearAdSlotHeight=this.controller.getSettings().nonLinearHeight||this.controller.getPlayerHeight(),t.setAdWillAutoPlay(this.controller.adsWillAutoplay()),t.setAdWillPlayMuted(this.controller.adsWillPlayMuted());var e=this.controller.getSettings().adsRequest;e&&"object"===(void 0===e?"undefined":s(e))&&Object.keys(e).forEach(function(i){t[i]=e[i]}),this.adsLoader.requestAds(t),this.controller.triggerPlayerEvent("ads-request",t)},o.prototype.onAdsManagerLoaded=function(t){this.createAdsRenderingSettings(),this.adsManager=t.getAdsManager(this.controller.getContentPlayheadTracker(),this.adsRenderingSettings),this.adsManager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,this.onAdError.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.AD_BREAK_READY,this.onAdBreakReady.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,this.onContentPauseRequested.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,this.onContentResumeRequested.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.ALL_ADS_COMPLETED,this.onAllAdsCompleted.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.LOADED,this.onAdLoaded.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.STARTED,this.onAdStarted.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.COMPLETE,this.onAdComplete.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.SKIPPED,this.onAdComplete.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.LOG,this.onAdLog.bind(this)),this.controller.getIsMobile()&&(this.adsManager.addEventListener(google.ima.AdEvent.Type.PAUSED,this.onAdPaused.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.RESUMED,this.onAdResumed.bind(this))),this.autoPlayAdBreaks||this.initAdsManager(),this.controller.onAdsReady(),this.controller.getSettings().adsManagerLoadedCallback&&this.controller.getSettings().adsManagerLoadedCallback()},o.prototype.onAdsLoaderError=function(t){window.console.warn("AdsLoader error: "+t.getError()),this.controller.onErrorLoadingAds(t),this.adsManager&&this.adsManager.destroy()},o.prototype.initAdsManager=function(){try{var t=this.controller.getPlayerWidth(),e=this.controller.getPlayerHeight();this.adsManagerDimensions.width=t,this.adsManagerDimensions.height=e,this.adsManager.init(t,e,google.ima.ViewMode.NORMAL),this.adsManager.setVolume(this.controller.getPlayerVolume()),this.initializeAdDisplayContainer()}catch(t){this.onAdError(t)}},o.prototype.createAdsRenderingSettings=function(){if(this.adsRenderingSettings=new google.ima.AdsRenderingSettings,this.adsRenderingSettings.restoreCustomPlaybackStateOnAdBreakComplete=!0,this.controller.getSettings().adsRenderingSettings)for(var t in this.controller.getSettings().adsRenderingSettings)""!==t&&(this.adsRenderingSettings[t]=this.controller.getSettings().adsRenderingSettings[t])},o.prototype.onAdError=function(t){var e=void 0!==t.getError?t.getError():t.stack;window.console.warn("Ad error: "+e),this.adsManager.destroy(),this.controller.onAdError(t),this.adsActive=!1,this.adPlaying=!1},o.prototype.onAdBreakReady=function(t){this.adBreakReadyListener(t)},o.prototype.onContentPauseRequested=function(t){this.adsActive=!0,this.adPlaying=!0,this.controller.onAdBreakStart(t)},o.prototype.onContentResumeRequested=function(t){this.adsActive=!1,this.adPlaying=!1,this.controller.onAdBreakEnd()},o.prototype.onAllAdsCompleted=function(t){this.allAdsCompleted=!0,this.controller.onAllAdsCompleted()},o.prototype.onAdLoaded=function(t){t.getAd().isLinear()||(this.controller.onNonLinearAdLoad(),this.controller.playContent())},o.prototype.onAdStarted=function(t){this.currentAd=t.getAd(),this.currentAd.isLinear()?(this.adTrackingTimer=setInterval(this.onAdPlayheadTrackerInterval.bind(this),250),this.controller.onLinearAdStart()):this.controller.onNonLinearAdStart()},o.prototype.onAdPaused=function(){this.controller.onAdsPaused()},o.prototype.onAdResumed=function(t){this.controller.onAdsResumed()},o.prototype.onAdComplete=function(){this.currentAd.isLinear()&&clearInterval(this.adTrackingTimer)},o.prototype.onAdLog=function(t){this.controller.onAdLog(t)},o.prototype.onAdPlayheadTrackerInterval=function(){var t=this.adsManager.getRemainingTime(),e=this.currentAd.getDuration(),i=e-t;i=i>0?i:0;var n=0,s=void 0;this.currentAd.getAdPodInfo()&&(s=this.currentAd.getAdPodInfo().getAdPosition(),n=this.currentAd.getAdPodInfo().getTotalAds()),this.controller.onAdPlayheadUpdated(i,t,e,s,n)},o.prototype.onContentComplete=function(){this.adsLoader&&(this.adsLoader.contentComplete(),this.contentCompleteCalled=!0),this.adsManager&&this.adsManager.getCuePoints()&&!this.adsManager.getCuePoints().includes(-1)&&this.controller.onNoPostroll(),this.allAdsCompleted&&this.controller.onContentAndAdsCompleted()},o.prototype.onPlayerDisposed=function(){this.adTrackingTimer&&clearInterval(this.adTrackingTimer),this.adsManager&&(this.adsManager.destroy(),this.adsManager=null)},o.prototype.onPlayerReadyForPreroll=function(){if(this.autoPlayAdBreaks){this.initAdsManager();try{this.controller.showAdContainer(),this.adsManager.setVolume(this.controller.getPlayerVolume()),this.adsManager.start()}catch(t){this.onAdError(t)}}},o.prototype.onPlayerReady=function(){this.initAdObjects(),(this.controller.getSettings().adTagUrl||this.controller.getSettings().adsResponse)&&"onLoad"===this.controller.getSettings().requestMode&&this.requestAds()},o.prototype.onPlayerEnterFullscreen=function(){this.adsManager&&this.adsManager.resize(window.screen.width,window.screen.height,google.ima.ViewMode.FULLSCREEN)},o.prototype.onPlayerExitFullscreen=function(){this.adsManager&&this.adsManager.resize(this.controller.getPlayerWidth(),this.controller.getPlayerHeight(),google.ima.ViewMode.NORMAL)},o.prototype.onPlayerVolumeChanged=function(t){this.adsManager&&this.adsManager.setVolume(t),this.adMuted=0==t},o.prototype.onPlayerResize=function(t,e){this.adsManager&&(this.adsManagerDimensions.width=t,this.adsManagerDimensions.height=e,this.adsManager.resize(t,e,google.ima.ViewMode.NORMAL))},o.prototype.getCurrentAd=function(){return this.currentAd},o.prototype.setAdBreakReadyListener=function(t){this.adBreakReadyListener=t},o.prototype.isAdPlaying=function(){return this.adPlaying},o.prototype.isAdMuted=function(){return this.adMuted},o.prototype.pauseAds=function(){this.adsManager.pause(),this.adPlaying=!1},o.prototype.resumeAds=function(){this.adsManager.resume(),this.adPlaying=!0},o.prototype.unmute=function(){this.adsManager.setVolume(1),this.adMuted=!1},o.prototype.mute=function(){this.adsManager.setVolume(0),this.adMuted=!0},o.prototype.setVolume=function(t){this.adsManager.setVolume(t),this.adMuted=0==t},o.prototype.initializeAdDisplayContainer=function(){this.adDisplayContainer&&(this.adDisplayContainerInitialized||(this.adDisplayContainer.initialize(),this.adDisplayContainerInitialized=!0))},o.prototype.playAdBreak=function(){this.autoPlayAdBreaks||(this.controller.showAdContainer(),this.adsManager.setVolume(this.controller.getPlayerVolume()),this.adsManager.start())},o.prototype.addEventListener=function(t,e){this.adsManager&&this.adsManager.addEventListener(t,e)},o.prototype.getAdsManager=function(){return this.adsManager},o.prototype.reset=function(){this.adsActive=!1,this.adPlaying=!1,this.adTrackingTimer&&clearInterval(this.adTrackingTimer),this.adsManager&&(this.adsManager.destroy(),this.adsManager=null),this.adsLoader&&!this.contentCompleteCalled&&this.adsLoader.contentComplete(),this.contentCompleteCalled=!1,this.allAdsCompleted=!1};var r=function(t,n){this.settings={},this.contentAndAdsEndedListeners=[],this.isMobile=navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPad/i)||navigator.userAgent.match(/Android/i),this.isIos=navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPad/i),this.initWithSettings(n);var s={debug:this.settings.debug,timeout:this.settings.timeout,prerollTimeout:this.settings.prerollTimeout},r=this.extend({},s,n.contribAdsSettings||{});this.playerWrapper=new e(t,r,this),this.adUi=new i(this),this.sdkImpl=new o(this)};r.IMA_DEFAULTS={debug:!1,timeout:5e3,prerollTimeout:1e3,adLabel:"Advertisement",adLabelNofN:"of",showControlsForJSAds:!0,requestMode:"onLoad"},r.prototype.initWithSettings=function(t){this.settings=this.extend({},r.IMA_DEFAULTS,t||{}),this.warnAboutDeprecatedSettings(),this.showCountdown=!0,!1===this.settings.showCountdown&&(this.showCountdown=!1)},r.prototype.warnAboutDeprecatedSettings=function(){var t=this;["adWillAutoplay","adsWillAutoplay","adWillPlayMuted","adsWillPlayMuted"].forEach(function(e){void 0!==t.settings[e]&&console.warn("WARNING: videojs.ima setting "+e+" is deprecated")})},r.prototype.getSettings=function(){return this.settings},r.prototype.getIsMobile=function(){return this.isMobile},r.prototype.getIsIos=function(){return this.isIos},r.prototype.injectAdContainerDiv=function(t){this.playerWrapper.injectAdContainerDiv(t)},r.prototype.getAdContainerDiv=function(){return this.adUi.getAdContainerDiv()},r.prototype.getContentPlayer=function(){return this.playerWrapper.getContentPlayer()},r.prototype.getContentPlayheadTracker=function(){return this.playerWrapper.getContentPlayheadTracker()},r.prototype.requestAds=function(){this.sdkImpl.requestAds()},r.prototype.setSetting=function(t,e){this.settings[t]=e},r.prototype.onErrorLoadingAds=function(t){this.adUi.onAdError(),this.playerWrapper.onAdError(t)},r.prototype.onAdPlayPauseClick=function(){this.sdkImpl.isAdPlaying()?(this.adUi.onAdsPaused(),this.sdkImpl.pauseAds()):(this.adUi.onAdsPlaying(),this.sdkImpl.resumeAds())},r.prototype.onAdMuteClick=function(){this.sdkImpl.isAdMuted()?(this.playerWrapper.unmute(),this.adUi.unmute(),this.sdkImpl.unmute()):(this.playerWrapper.mute(),this.adUi.mute(),this.sdkImpl.mute())},r.prototype.setVolume=function(t){this.playerWrapper.setVolume(t),this.sdkImpl.setVolume(t)},r.prototype.getPlayerVolume=function(){return this.playerWrapper.getVolume()},r.prototype.toggleFullscreen=function(){this.playerWrapper.toggleFullscreen()},r.prototype.onAdError=function(t){this.adUi.onAdError(),this.playerWrapper.onAdError(t)},r.prototype.onAdBreakStart=function(t){this.playerWrapper.onAdBreakStart(),this.adUi.onAdBreakStart(t)},r.prototype.showAdContainer=function(){this.adUi.showAdContainer()},r.prototype.onAdBreakEnd=function(){this.playerWrapper.onAdBreakEnd(),this.adUi.onAdBreakEnd()},r.prototype.onAllAdsCompleted=function(){this.adUi.onAllAdsCompleted(),this.playerWrapper.onAllAdsCompleted()},r.prototype.onAdsPaused=function(){this.adUi.onAdsPaused()},r.prototype.onAdsResumed=function(){this.adUi.onAdsResumed()},r.prototype.onAdPlayheadUpdated=function(t,e,i,n,s){this.adUi.updateAdUi(t,e,i,n,s)},r.prototype.onAdLog=function(t){this.playerWrapper.onAdLog(t)},r.prototype.getCurrentAd=function(){return this.sdkImpl.getCurrentAd()},r.prototype.playContent=function(){this.playerWrapper.play()},r.prototype.onLinearAdStart=function(){this.adUi.onLinearAdStart(),this.playerWrapper.onAdStart()},r.prototype.onNonLinearAdLoad=function(){this.adUi.onNonLinearAdLoad()},r.prototype.onNonLinearAdStart=function(){this.adUi.onNonLinearAdLoad(),this.playerWrapper.onAdStart()},r.prototype.getPlayerWidth=function(){return this.playerWrapper.getPlayerWidth()},r.prototype.getPlayerHeight=function(){return this.playerWrapper.getPlayerHeight()},r.prototype.onAdsReady=function(){this.playerWrapper.onAdsReady()},r.prototype.onPlayerResize=function(t,e){this.sdkImpl.onPlayerResize(t,e)},r.prototype.onContentComplete=function(){this.sdkImpl.onContentComplete()},r.prototype.onNoPostroll=function(){this.playerWrapper.onNoPostroll()},r.prototype.onContentAndAdsCompleted=function(){for(var t in this.contentAndAdsEndedListeners)"function"==typeof this.contentAndAdsEndedListeners[t]&&this.contentAndAdsEndedListeners[t]()},r.prototype.onPlayerDisposed=function(){this.contentAndAdsEndedListeners=[],this.sdkImpl.onPlayerDisposed()},r.prototype.onPlayerReadyForPreroll=function(){this.sdkImpl.onPlayerReadyForPreroll()},r.prototype.onPlayerReady=function(){this.sdkImpl.onPlayerReady()},r.prototype.onPlayerEnterFullscreen=function(){this.adUi.onPlayerEnterFullscreen(),this.sdkImpl.onPlayerEnterFullscreen()},r.prototype.onPlayerExitFullscreen=function(){this.adUi.onPlayerExitFullscreen(),this.sdkImpl.onPlayerExitFullscreen()},r.prototype.onPlayerVolumeChanged=function(t){this.adUi.onPlayerVolumeChanged(t),this.sdkImpl.onPlayerVolumeChanged(t)},r.prototype.setContentWithAdTag=function(t,e){this.reset(),this.settings.adTagUrl=e||this.settings.adTagUrl,this.playerWrapper.changeSource(t)},r.prototype.setContentWithAdsResponse=function(t,e){this.reset(),this.settings.adsResponse=e||this.settings.adsResponse,this.playerWrapper.changeSource(t)},r.prototype.setContentWithAdsRequest=function(t,e){this.reset(),this.settings.adsRequest=e||this.settings.adsRequest,this.playerWrapper.changeSource(t)},r.prototype.reset=function(){this.sdkImpl.reset(),this.playerWrapper.reset(),this.adUi.reset()},r.prototype.addContentEndedListener=function(t){this.playerWrapper.addContentEndedListener(t)},r.prototype.addContentAndAdsEndedListener=function(t){this.contentAndAdsEndedListeners.push(t)},r.prototype.setAdBreakReadyListener=function(t){this.sdkImpl.setAdBreakReadyListener(t)},r.prototype.setShowCountdown=function(t){this.adUi.setShowCountdown(t),this.showCountdown=t,this.countdownDiv.style.display=this.showCountdown?"block":"none"},r.prototype.initializeAdDisplayContainer=function(){this.sdkImpl.initializeAdDisplayContainer()},r.prototype.playAdBreak=function(){this.sdkImpl.playAdBreak()},r.prototype.addEventListener=function(t,e){this.sdkImpl.addEventListener(t,e)},r.prototype.getAdsManager=function(){return this.sdkImpl.getAdsManager()},r.prototype.getPlayerId=function(){return this.playerWrapper.getPlayerId()},r.prototype.changeAdTag=function(t){this.reset(),this.settings.adTagUrl=t},r.prototype.pauseAd=function(){this.adUi.onAdsPaused(),this.sdkImpl.pauseAds()},r.prototype.resumeAd=function(){this.adUi.onAdsPlaying(),this.sdkImpl.resumeAds()},r.prototype.adsWillAutoplay=function(){return void 0!==this.settings.adsWillAutoplay?this.settings.adsWillAutoplay:void 0!==this.settings.adWillAutoplay?this.settings.adWillAutoplay:!!this.playerWrapper.getPlayerOptions().autoplay},r.prototype.adsWillPlayMuted=function(){return void 0!==this.settings.adsWillPlayMuted?this.settings.adsWillPlayMuted:void 0!==this.settings.adWillPlayMuted?this.settings.adWillPlayMuted:void 0!==this.playerWrapper.getPlayerOptions().muted?this.playerWrapper.getPlayerOptions().muted:0==this.playerWrapper.getVolume()},r.prototype.triggerPlayerEvent=function(t,e){this.playerWrapper.triggerPlayerEvent(t,e)},r.prototype.extend=function(t){for(var e=void 0,i=void 0,n=void 0,s=arguments.length,o=Array(s>1?s-1:0),r=1;r Date: Mon, 30 Sep 2019 14:27:30 -0400 Subject: [PATCH 19/22] 1.6.3 --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 106d9c81..f53838cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ + +## [1.6.3](https://github.com/googleads/videojs-ima/compare/v1.6.2...v1.6.3) (2019-09-30) + ## [1.6.2](https://github.com/googleads/videojs-ima/compare/v1.6.0...v1.6.2) (2019-09-11) @@ -11,6 +14,10 @@ # [1.6.0](https://github.com/googleads/videojs-ima/compare/v1.5.2...v1.6.0) (2019-06-26) +### Features + +* adds a request mode for ad requests ([278556b](https://github.com/googleads/videojs-ima/commit/278556b)) + ### Bug Fixes * fix via npm audit, take two ([#771](https://github.com/googleads/videojs-ima/issues/771)) ([e0d59f5](https://github.com/googleads/videojs-ima/commit/e0d59f5)) From 5f643a352fb1e8d1e299d0037909672272cfa79a Mon Sep 17 00:00:00 2001 From: Viktor K Date: Tue, 16 Jul 2019 17:14:21 -0400 Subject: [PATCH 20/22] CI and test-stage edits inside origin: .travis.yml & package.json --- .travis.yml | 20 +-- package.json | 2 +- test/webdriver/basic-hearst-mod.js | 128 ++++++++++++++++++ .../content/capabilities-hearst-mod.js | 64 +++++++++ 4 files changed, 203 insertions(+), 11 deletions(-) create mode 100644 test/webdriver/basic-hearst-mod.js create mode 100644 test/webdriver/content/capabilities-hearst-mod.js diff --git a/.travis.yml b/.travis.yml index bf4d2da0..0866251b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,18 +3,18 @@ node_js: - node dist: trusty sudo: required -env: - matrix: - - MOZ_HEADLESS=1 - global: - secure: byXkN+FuQNpI15xX5TUjFHoZCpEPI4o8Ophb1OvaE10dwlN0tnS7rsFkWJD6u3Ipx7y5VmpTkvxYOtvWYVt3ZbpP8sJTB+bOSsp2zrgX5vByEvZ7z3W2mkDYW1nuwM9zBtv9lkhdKlNCjNNsvw4izoFhOZXoWWsPjMEkanWzkq0= +#env: +# matrix: +# - MOZ_HEADLESS=1 +# global: +# secure: byXkN+FuQNpI15xX5TUjFHoZCpEPI4o8Ophb1OvaE10dwlN0tnS7rsFkWJD6u3Ipx7y5VmpTkvxYOtvWYVt3ZbpP8sJTB+bOSsp2zrgX5vByEvZ7z3W2mkDYW1nuwM9zBtv9lkhdKlNCjNNsvw4izoFhOZXoWWsPjMEkanWzkq0= addons: chrome: stable - firefox: latest - browserstack: - username: adsdevrel1 - access_key: - secure: CD76OVHjif8tBfkULJASD84oFh0bAoYpZJkRIy6f5+gi46iPS7GA/t2++Fatuxi11XZ6EDH3y0eFrGeXau0/3Ut6Et2br2TWzwpt/TSbfpjkGGXKy6IJb0Jbsy/HMEJrmr8krkF9rALND1geJMgy2RVF9u3ri21JQqA2uMCOpYs= +# firefox: latest +# browserstack: +# username: adsdevrel1 +# access_key: +# secure: CD76OVHjif8tBfkULJASD84oFh0bAoYpZJkRIy6f5+gi46iPS7GA/t2++Fatuxi11XZ6EDH3y0eFrGeXau0/3Ut6Et2br2TWzwpt/TSbfpjkGGXKy6IJb0Jbsy/HMEJrmr8krkF9rALND1geJMgy2RVF9u3ri21JQqA2uMCOpYs= script: - npm run lint - npm test diff --git a/package.json b/package.json index 244c790f..d48c1b15 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "preversion": "node scripts/preversion.js && npm run lint && npm test", "version": "node scripts/version.js", "postversion": "node scripts/postversion.js", - "webdriver": "mocha test/webdriver/*.js --no-timeouts" + "webdriver": "mocha test/webdriver/basic-hearst-mod.js --no-timeouts" }, "repository": { "type": "git", diff --git a/test/webdriver/basic-hearst-mod.js b/test/webdriver/basic-hearst-mod.js new file mode 100644 index 00000000..4fe27ccc --- /dev/null +++ b/test/webdriver/basic-hearst-mod.js @@ -0,0 +1,128 @@ +/** + * Copyright 2017 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * IMA SDK integration plugin for Video.js. For more information see + * https://www.github.com/googleads/videojs-ima + */ + +var browsers = require('./content/capabilities-hearst-mod'); + +browsers.browsers.forEach(function(browser) { + + describe('Basic Tests ' + browser.name, function() { + + this.timeout(0); + this.slow(15000); + + var webdriver = require('selenium-webdriver'), + until = webdriver.until; + By = webdriver.By; + + var driver; + + before(async function() { + driver = await new webdriver.Builder() + .forBrowser(browser.capabilities.browserName) + .usingServer(browser.server) + .withCapabilities(browser.capabilities) + .build(); + return driver; + }); + + after(async function() { + await driver.quit(); + }); + + it( 'Displays ad UI ' + browser.name, async function(){ + await driver.get('http://localhost:8000/test/webdriver/index.html?ad=linear'); + await driver.findElement(By.id('content_video')).click(); + let log = await driver.findElement(By.id('log')); + await driver.wait(until.elementTextContains(log, 'start'), 60000); + await driver.wait(until.elementIsVisible(driver.findElement( + By.id('content_video_ima-controls-div'))), 60000); + }); + + it( 'Hides controls when ad ends ' + browser.name, async function(){ + await driver.get('http://localhost:8000/test/webdriver/index.html?ad=linear'); + await driver.findElement(By.id('content_video')).click(); + let log = await driver.findElement(By.id('log')); + await driver.wait(until.elementTextContains(log, 'start'), 60000); + await driver.wait(until.elementIsNotVisible(driver.findElement( + By.id('content_video_ima-controls-div'))), 60000); + await driver.sleep(); + }); + + it( 'Plays content when ad ends ' + browser.name, async function(){ + await driver.get('http://localhost:8000/test/webdriver/index.html?ad=linear'); + await driver.findElement(By.id('content_video')).click(); + let log = await driver.findElement(By.id('log')); + await driver.wait(until.elementTextContains(log, 'start'), 60000); + await driver.wait(until.elementIsNotVisible(driver.findElement( + By.id('content_video_ima-controls-div'))), 60000); + await driver.wait(until.elementTextContains(log, 'playing'), 60000); + await driver.sleep(); + }); + + it( 'Displays skip ad button ' + browser.name, async function(){ + await driver.get('http://localhost:8000/test/webdriver/index.html?ad=skippable'); + await driver.findElement(By.id('content_video')).click(); + let log = driver.findElement(By.id('log')); + await driver.wait(until.elementTextContains(log, 'start'), 60000); + await driver.switchTo().frame(driver.findElement( + By.css('#content_video_ima-ad-container > div:nth-child(1) > iframe'))); + let skipButton = await driver.findElement( + By.css('div.videoAdUi button.videoAdUiSkipButton')); + await driver.wait(until.elementIsVisible(skipButton), 60000); + await driver.sleep(); + }); + + it( 'VMAP: Preroll ' + browser.name, async function(){ + await driver.get('http://localhost:8000/test/webdriver/index.html?ad=vmap_preroll'); + await driver.findElement(By.id('content_video')).click(); + let log = await driver.findElement(By.id('log')); + await driver.wait(until.elementTextContains(log, 'start'), 60000); + await driver.wait(until.elementIsVisible(driver.findElement( + By.id('content_video_ima-controls-div'))), 60000); + await driver.sleep(); + }); + + it( 'VMAP: Midroll ' + browser.name, async function(){ + await driver.get('http://localhost:8000/test/webdriver/index.html?ad=vmap_midroll'); + await driver.findElement(By.id('content_video')).click(); + await driver.wait(until.elementIsVisible(driver.findElement( + By.id('content_video_ima-controls-div'))), 60000); + await driver.sleep(); + }); + + it( 'Nonlinear ' + browser.name, async function(){ + await driver.get('http://localhost:8000/test/webdriver/index.html?ad=nonlinear'); + await driver.findElement(By.id('content_video')).click(); + let log = await driver.findElement(By.id('log')); + await driver.wait(until.elementTextContains(log, 'start'), 60000); + await driver.switchTo().frame(driver.findElement( + By.css('#content_video_ima-ad-container > div:nth-child(1) > iframe'))); + await driver.wait(until.elementIsVisible(driver.findElement( + By.css('div.nonLinearContainer div.overlayContainer'))), 60000); + await driver.sleep(); + }); + + it( 'Handles ad error 303: wrappers ' + browser.name, async function(){ + await driver.get('http://localhost:8000/test/webdriver/index.html?ad=error_303'); + let log = await driver.findElement(By.id('log')); + await driver.wait(until.elementTextContains(log, '303'), 60000); + await driver.sleep(); + }); + }); +}); diff --git a/test/webdriver/content/capabilities-hearst-mod.js b/test/webdriver/content/capabilities-hearst-mod.js new file mode 100644 index 00000000..883fda05 --- /dev/null +++ b/test/webdriver/content/capabilities-hearst-mod.js @@ -0,0 +1,64 @@ +/** + * Copyright 2018 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +require('chromedriver'); +// require('geckodriver'); + +// var browserstackCapabilities = { +// 'browserstack.console': 'verbose', +// 'browserstack.key' : process.env.BROWSERSTACK_ACCESS_KEY, +// 'browserstack.local' : 'true', +// 'browserstack.localIdentifier' : process.env.BROWSERSTACK_LOCAL_IDENTIFIER, +// 'browserstack.networkLogs': 'true', +// 'browserstack.user' : process.env.BROWSERSTACK_USER, +// 'build' : '1.1.0', +// 'project' : 'videojs_ima' +// } + +var browsers = [ + { + name: 'chrome-local', + server: '', //local + capabilities: { + 'browserName' : 'chrome', + 'chromeOptions' : {args: ['--headless']} + } + } + // { + // name: 'firefox-local', + // server: '', //local + // capabilities: { + // 'browserName' : 'firefox', + // 'moz:firefoxOptions' : {args: ['-headless']} + // } + // }, +]; + +// for (let browser of browsers) { +// if (browser.server == 'http://hub-cloud.browserstack.com/wd/hub') { +// browser.capabilities = +// Object.assign(browser.capabilities, browserstackCapabilities); +// } +// } + +// Remove if we don't have browserstack credentials. +if (process.env.BROWSERSTACK_USER === undefined || + process.env.BROWSERSTACK_ACCESS_KEY === undefined) { + browsers = browsers.filter(browser => + browser.server != 'http://hub-cloud.browserstack.com/wd/hub'); +} + +exports.browsers = browsers; From a3a263ac399bf9604b4b2ccfbe4477fcbec1f7d0 Mon Sep 17 00:00:00 2001 From: Viktor K Date: Mon, 15 Jul 2019 13:44:42 -0400 Subject: [PATCH 21/22] fix: edge case for iOS: no mouse enter/leave events on adContainerDiv --- src/ad-ui.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ad-ui.js b/src/ad-ui.js index 4e25cd10..0efe6e14 100644 --- a/src/ad-ui.js +++ b/src/ad-ui.js @@ -17,6 +17,8 @@ * https://www.github.com/googleads/videojs-ima */ +import videojs from 'video.js'; + /** * Ad UI implementation. * @@ -126,14 +128,16 @@ AdUi.prototype.createAdContainer = function() { this.adContainerDiv, 'ima-ad-container'); this.adContainerDiv.style.position = 'absolute'; this.adContainerDiv.style.zIndex = 1111; - this.adContainerDiv.addEventListener( + if (!videojs.browser.IS_IOS) { + this.adContainerDiv.addEventListener( 'mouseenter', this.showAdControls.bind(this), false); - this.adContainerDiv.addEventListener( + this.adContainerDiv.addEventListener( 'mouseleave', this.hideAdControls.bind(this), false); + } this.createControls(); this.controller.injectAdContainerDiv(this.adContainerDiv); }; From 70ca5d831e53a5b0a9138a57eefc715403bb253a Mon Sep 17 00:00:00 2001 From: Viktor K Date: Tue, 16 Jul 2019 17:47:06 -0400 Subject: [PATCH 22/22] dist manual update (temp) --- .gitignore | 1 - dist/videojs.ima.es.js | 8 +++++--- dist/videojs.ima.js | 8 +++++--- dist/videojs.ima.min.js | 2 +- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index b9470778..c2658d7d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ node_modules/ -dist/ diff --git a/dist/videojs.ima.es.js b/dist/videojs.ima.es.js index b0d15c2a..5c5b2ccb 100644 --- a/dist/videojs.ima.es.js +++ b/dist/videojs.ima.es.js @@ -701,8 +701,10 @@ AdUi.prototype.createAdContainer = function () { this.assignControlAttributes(this.adContainerDiv, 'ima-ad-container'); this.adContainerDiv.style.position = 'absolute'; this.adContainerDiv.style.zIndex = 1111; - this.adContainerDiv.addEventListener('mouseenter', this.showAdControls.bind(this), false); - this.adContainerDiv.addEventListener('mouseleave', this.hideAdControls.bind(this), false); + if (!videojs.browser.IS_IOS) { + this.adContainerDiv.addEventListener('mouseenter', this.showAdControls.bind(this), false); + this.adContainerDiv.addEventListener('mouseleave', this.hideAdControls.bind(this), false); + } this.createControls(); this.controller.injectAdContainerDiv(this.adContainerDiv); }; @@ -1112,7 +1114,7 @@ var main = "./dist/videojs.ima.js"; var module$1 = "./dist/videojs.ima.es.js"; var author = { "name": "Google Inc." }; var engines = { "node": ">=0.8.0" }; -var scripts = { "contBuild": "watch 'npm run rollup:max' src", "predevServer": "echo \"Starting up server on localhost:8000.\"", "devServer": "npm-run-all -p testServer contBuild", "lint": "eslint \"src/*.js\"", "rollup": "npm-run-all rollup:*", "rollup:max": "rollup -c configs/rollup.config.js", "rollup:es": "rollup -c configs/rollup.config.es.js", "rollup:min": "rollup -c configs/rollup.config.min.js", "pretest": "npm run rollup", "start": "npm run devServer", "test": "npm-run-all test:*", "test:vjs5": "npm install video.js@5.19.2 --no-save && npm-run-all -p -r testServer webdriver", "test:vjs6": "npm install video.js@6 --no-save && npm-run-all -p -r testServer webdriver", "test:vjs7": "npm install video.js@7 --no-save && npm-run-all -p -r testServer webdriver", "testServer": "http-server --cors -p 8000 --silent", "preversion": "node scripts/preversion.js && npm run lint && npm test", "version": "node scripts/version.js", "postversion": "node scripts/postversion.js", "webdriver": "mocha test/webdriver/*.js --no-timeouts" }; +var scripts = { "contBuild": "watch 'npm run rollup:max' src", "predevServer": "echo \"Starting up server on localhost:8000.\"", "devServer": "npm-run-all -p testServer contBuild", "lint": "eslint \"src/*.js\"", "rollup": "npm-run-all rollup:*", "rollup:max": "rollup -c configs/rollup.config.js", "rollup:es": "rollup -c configs/rollup.config.es.js", "rollup:min": "rollup -c configs/rollup.config.min.js", "pretest": "npm run rollup", "start": "npm run devServer", "test": "npm-run-all test:*", "test:vjs5": "npm install video.js@5.19.2 --no-save && npm-run-all -p -r testServer webdriver", "test:vjs6": "npm install video.js@6 --no-save && npm-run-all -p -r testServer webdriver", "test:vjs7": "npm install video.js@7 --no-save && npm-run-all -p -r testServer webdriver", "testServer": "http-server --cors -p 8000 --silent", "preversion": "node scripts/preversion.js && npm run lint && npm test", "version": "node scripts/version.js", "postversion": "node scripts/postversion.js", "webdriver": "mocha test/webdriver/basic-hearst-mod.js --no-timeouts" }; var repository = { "type": "git", "url": "https://github.com/googleads/videojs-ima" }; var files = ["CHANGELOG.md", "LICENSE", "README.md", "dist/", "src/"]; var dependencies = { "can-autoplay": "^3.0.0", "cryptiles": "^4.1.2", "video.js": "^5.19.2 || ^6 || ^7", "videojs-contrib-ads": "^6" }; diff --git a/dist/videojs.ima.js b/dist/videojs.ima.js index 9d005969..e8709c17 100644 --- a/dist/videojs.ima.js +++ b/dist/videojs.ima.js @@ -707,8 +707,10 @@ AdUi.prototype.createAdContainer = function () { this.assignControlAttributes(this.adContainerDiv, 'ima-ad-container'); this.adContainerDiv.style.position = 'absolute'; this.adContainerDiv.style.zIndex = 1111; - this.adContainerDiv.addEventListener('mouseenter', this.showAdControls.bind(this), false); - this.adContainerDiv.addEventListener('mouseleave', this.hideAdControls.bind(this), false); + if (!videojs.browser.IS_IOS) { + this.adContainerDiv.addEventListener('mouseenter', this.showAdControls.bind(this), false); + this.adContainerDiv.addEventListener('mouseleave', this.hideAdControls.bind(this), false); + } this.createControls(); this.controller.injectAdContainerDiv(this.adContainerDiv); }; @@ -1118,7 +1120,7 @@ var main = "./dist/videojs.ima.js"; var module$1 = "./dist/videojs.ima.es.js"; var author = { "name": "Google Inc." }; var engines = { "node": ">=0.8.0" }; -var scripts = { "contBuild": "watch 'npm run rollup:max' src", "predevServer": "echo \"Starting up server on localhost:8000.\"", "devServer": "npm-run-all -p testServer contBuild", "lint": "eslint \"src/*.js\"", "rollup": "npm-run-all rollup:*", "rollup:max": "rollup -c configs/rollup.config.js", "rollup:es": "rollup -c configs/rollup.config.es.js", "rollup:min": "rollup -c configs/rollup.config.min.js", "pretest": "npm run rollup", "start": "npm run devServer", "test": "npm-run-all test:*", "test:vjs5": "npm install video.js@5.19.2 --no-save && npm-run-all -p -r testServer webdriver", "test:vjs6": "npm install video.js@6 --no-save && npm-run-all -p -r testServer webdriver", "test:vjs7": "npm install video.js@7 --no-save && npm-run-all -p -r testServer webdriver", "testServer": "http-server --cors -p 8000 --silent", "preversion": "node scripts/preversion.js && npm run lint && npm test", "version": "node scripts/version.js", "postversion": "node scripts/postversion.js", "webdriver": "mocha test/webdriver/*.js --no-timeouts" }; +var scripts = { "contBuild": "watch 'npm run rollup:max' src", "predevServer": "echo \"Starting up server on localhost:8000.\"", "devServer": "npm-run-all -p testServer contBuild", "lint": "eslint \"src/*.js\"", "rollup": "npm-run-all rollup:*", "rollup:max": "rollup -c configs/rollup.config.js", "rollup:es": "rollup -c configs/rollup.config.es.js", "rollup:min": "rollup -c configs/rollup.config.min.js", "pretest": "npm run rollup", "start": "npm run devServer", "test": "npm-run-all test:*", "test:vjs5": "npm install video.js@5.19.2 --no-save && npm-run-all -p -r testServer webdriver", "test:vjs6": "npm install video.js@6 --no-save && npm-run-all -p -r testServer webdriver", "test:vjs7": "npm install video.js@7 --no-save && npm-run-all -p -r testServer webdriver", "testServer": "http-server --cors -p 8000 --silent", "preversion": "node scripts/preversion.js && npm run lint && npm test", "version": "node scripts/version.js", "postversion": "node scripts/postversion.js", "webdriver": "mocha test/webdriver/basic-hearst-mod.js --no-timeouts" }; var repository = { "type": "git", "url": "https://github.com/googleads/videojs-ima" }; var files = ["CHANGELOG.md", "LICENSE", "README.md", "dist/", "src/"]; var dependencies = { "can-autoplay": "^3.0.0", "cryptiles": "^4.1.2", "video.js": "^5.19.2 || ^6 || ^7", "videojs-contrib-ads": "^6" }; diff --git a/dist/videojs.ima.min.js b/dist/videojs.ima.min.js index 83884d80..db1bcfde 100644 --- a/dist/videojs.ima.min.js +++ b/dist/videojs.ima.min.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("video.js")):"function"==typeof define&&define.amd?define(["video.js"],e):t.videojsIma=e(t.videojs)}(this,function(t){"use strict";t=t&&t.hasOwnProperty("default")?t.default:t;var e=function(t,e,i){this.vjsPlayer=t,this.controller=i,this.contentTrackingTimer=null,this.contentComplete=!1,this.updateTimeIntervalHandle=null,this.updateTimeInterval=1e3,this.seekCheckIntervalHandle=null,this.seekCheckInterval=1e3,this.resizeCheckIntervalHandle=null,this.resizeCheckInterval=250,this.seekThreshold=100,this.contentEndedListeners=[],this.contentSource="",this.contentSourceType="",this.contentPlayheadTracker={currentTime:0,previousTime:0,seeking:!1,duration:0},this.vjsPlayerDimensions={width:this.getPlayerWidth(),height:this.getPlayerHeight()},this.vjsControls=this.vjsPlayer.getChild("controlBar"),this.h5Player=null,this.vjsPlayer.one("play",this.setUpPlayerIntervals.bind(this)),this.boundContentEndedListener=this.localContentEndedListener.bind(this),this.vjsPlayer.on("contentended",this.boundContentEndedListener),this.vjsPlayer.on("dispose",this.playerDisposedListener.bind(this)),this.vjsPlayer.on("readyforpreroll",this.onReadyForPreroll.bind(this)),this.vjsPlayer.ready(this.onPlayerReady.bind(this)),"onPlay"===this.controller.getSettings().requestMode&&this.vjsPlayer.one("play",this.controller.requestAds.bind(this.controller)),this.vjsPlayer.ads(e)};e.prototype.setUpPlayerIntervals=function(){this.updateTimeIntervalHandle=setInterval(this.updateCurrentTime.bind(this),this.updateTimeInterval),this.seekCheckIntervalHandle=setInterval(this.checkForSeeking.bind(this),this.seekCheckInterval),this.resizeCheckIntervalHandle=setInterval(this.checkForResize.bind(this),this.resizeCheckInterval)},e.prototype.updateCurrentTime=function(){this.contentPlayheadTracker.seeking||(this.contentPlayheadTracker.currentTime=this.vjsPlayer.currentTime())},e.prototype.checkForSeeking=function(){var t=1e3*(this.vjsPlayer.currentTime()-this.contentPlayheadTracker.previousTime);Math.abs(t)>this.seekCheckInterval+this.seekThreshold?this.contentPlayheadTracker.seeking=!0:this.contentPlayheadTracker.seeking=!1,this.contentPlayheadTracker.previousTime=this.vjsPlayer.currentTime()},e.prototype.checkForResize=function(){var t=this.getPlayerWidth(),e=this.getPlayerHeight();t==this.vjsPlayerDimensions.width&&e==this.vjsPlayerDimensions.height||(this.vjsPlayerDimensions.width=t,this.vjsPlayerDimensions.height=e,this.controller.onPlayerResize(t,e))},e.prototype.localContentEndedListener=function(){for(var t in this.contentComplete||(this.contentComplete=!0,this.controller.onContentComplete()),this.contentEndedListeners)"function"==typeof this.contentEndedListeners[t]&&this.contentEndedListeners[t]();clearInterval(this.updateTimeIntervalHandle),clearInterval(this.seekCheckIntervalHandle),clearInterval(this.resizeCheckIntervalHandle),this.vjsPlayer.el()&&this.vjsPlayer.one("play",this.setUpPlayerIntervals.bind(this))},e.prototype.onNoPostroll=function(){this.vjsPlayer.trigger("nopostroll")},e.prototype.playerDisposedListener=function(){this.contentEndedListeners=[],this.controller.onPlayerDisposed(),this.contentComplete=!0,this.vjsPlayer.off("contentended",this.boundContentEndedListener),this.vjsPlayer.ads.adTimeoutTimeout&&clearTimeout(this.vjsPlayer.ads.adTimeoutTimeout);var t=[this.updateTimeIntervalHandle,this.seekCheckIntervalHandle,this.resizeCheckIntervalHandle];for(var e in t)t[e]&&clearInterval(t[e])},e.prototype.onReadyForPreroll=function(){this.controller.onPlayerReadyForPreroll()},e.prototype.onPlayerReady=function(){this.h5Player=document.getElementById(this.getPlayerId()).getElementsByClassName("vjs-tech")[0],this.h5Player.hasAttribute("autoplay")&&this.controller.setSetting("adWillAutoPlay",!0),this.onVolumeChange(),this.vjsPlayer.on("fullscreenchange",this.onFullscreenChange.bind(this)),this.vjsPlayer.on("volumechange",this.onVolumeChange.bind(this)),this.controller.onPlayerReady()},e.prototype.onFullscreenChange=function(){this.vjsPlayer.isFullscreen()?this.controller.onPlayerEnterFullscreen():this.controller.onPlayerExitFullscreen()},e.prototype.onVolumeChange=function(){var t=this.vjsPlayer.muted()?0:this.vjsPlayer.volume();this.controller.onPlayerVolumeChanged(t)},e.prototype.injectAdContainerDiv=function(t){this.vjsControls.el().parentNode.appendChild(t)},e.prototype.getContentPlayer=function(){return this.h5Player},e.prototype.getVolume=function(){return this.vjsPlayer.muted()?0:this.vjsPlayer.volume()},e.prototype.setVolume=function(t){this.vjsPlayer.volume(t),0==t?this.vjsPlayer.muted(!0):this.vjsPlayer.muted(!1)},e.prototype.unmute=function(){this.vjsPlayer.muted(!1)},e.prototype.mute=function(){this.vjsPlayer.muted(!0)},e.prototype.play=function(){this.vjsPlayer.play()},e.prototype.getPlayerWidth=function(){var t=(getComputedStyle(this.vjsPlayer.el())||{}).width;return t&&0!==parseFloat(t)||(t=(this.vjsPlayer.el().getBoundingClientRect()||{}).width),parseFloat(t)||this.vjsPlayer.width()},e.prototype.getPlayerHeight=function(){var t=(getComputedStyle(this.vjsPlayer.el())||{}).height;return t&&0!==parseFloat(t)||(t=(this.vjsPlayer.el().getBoundingClientRect()||{}).height),parseFloat(t)||this.vjsPlayer.height()},e.prototype.getPlayerOptions=function(){return this.vjsPlayer.options_},e.prototype.getPlayerId=function(){return this.vjsPlayer.id()},e.prototype.toggleFullscreen=function(){this.vjsPlayer.isFullscreen()?this.vjsPlayer.exitFullscreen():this.vjsPlayer.requestFullscreen()},e.prototype.getContentPlayheadTracker=function(){return this.contentPlayheadTracker},e.prototype.onAdError=function(t){this.vjsControls.show();var e=void 0!==t.getError?t.getError():t.stack;this.vjsPlayer.trigger({type:"adserror",data:{AdError:e,AdErrorEvent:t}})},e.prototype.onAdLog=function(t){var e=t.getAdData(),i=void 0!==e.adError?e.adError.getMessage():void 0;this.vjsPlayer.trigger({type:"adslog",data:{AdError:i,AdEvent:t}})},e.prototype.onAdBreakStart=function(){this.contentSource=this.vjsPlayer.currentSrc(),this.contentSourceType=this.vjsPlayer.currentType(),this.vjsPlayer.off("contentended",this.boundContentEndedListener),this.vjsPlayer.ads.startLinearAdMode(),this.vjsControls.hide(),this.vjsPlayer.pause()},e.prototype.onAdBreakEnd=function(){this.vjsPlayer.on("contentended",this.boundContentEndedListener),this.vjsPlayer.ads.inAdBreak()&&this.vjsPlayer.ads.endLinearAdMode(),this.vjsControls.show()},e.prototype.onAdStart=function(){this.vjsPlayer.trigger("ads-ad-started")},e.prototype.onAllAdsCompleted=function(){1==this.contentComplete&&(this.vjsPlayer.currentSrc()!=this.contentSource&&this.vjsPlayer.src({src:this.contentSource,type:this.contentSourceType}),this.controller.onContentAndAdsCompleted())},e.prototype.onAdsReady=function(){this.vjsPlayer.trigger("adsready")},e.prototype.changeSource=function(t){this.vjsPlayer.currentSrc()&&(this.vjsPlayer.currentTime(0),this.vjsPlayer.pause()),t&&this.vjsPlayer.src(t),this.vjsPlayer.one("loadedmetadata",this.seekContentToZero.bind(this))},e.prototype.seekContentToZero=function(){this.vjsPlayer.currentTime(0)},e.prototype.triggerPlayerEvent=function(t,e){this.vjsPlayer.trigger(t,e)},e.prototype.addContentEndedListener=function(t){this.contentEndedListeners.push(t)},e.prototype.reset=function(){this.vjsPlayer.on("contentended",this.boundContentEndedListener),this.vjsControls.show(),this.vjsPlayer.ads.inAdBreak()&&this.vjsPlayer.ads.endLinearAdMode(),this.contentPlayheadTracker.currentTime=0,this.contentComplete=!1};var i=function(t){this.controller=t,this.adContainerDiv=document.createElement("div"),this.controlsDiv=document.createElement("div"),this.countdownDiv=document.createElement("div"),this.seekBarDiv=document.createElement("div"),this.progressDiv=document.createElement("div"),this.playPauseDiv=document.createElement("div"),this.muteDiv=document.createElement("div"),this.sliderDiv=document.createElement("div"),this.sliderLevelDiv=document.createElement("div"),this.fullscreenDiv=document.createElement("div"),this.boundOnMouseUp=this.onMouseUp.bind(this),this.boundOnMouseMove=this.onMouseMove.bind(this),this.adPlayheadTracker={currentTime:0,duration:0,isPod:!1,adPosition:0,totalAds:0},this.controlPrefix=this.controller.getPlayerId()+"_",this.showCountdown=!0,!1===this.controller.getSettings().showCountdown&&(this.showCountdown=!1),this.createAdContainer()};i.prototype.createAdContainer=function(){this.assignControlAttributes(this.adContainerDiv,"ima-ad-container"),this.adContainerDiv.style.position="absolute",this.adContainerDiv.style.zIndex=1111,this.adContainerDiv.addEventListener("mouseenter",this.showAdControls.bind(this),!1),this.adContainerDiv.addEventListener("mouseleave",this.hideAdControls.bind(this),!1),this.createControls(),this.controller.injectAdContainerDiv(this.adContainerDiv)},i.prototype.createControls=function(){this.assignControlAttributes(this.controlsDiv,"ima-controls-div"),this.controlsDiv.style.width="100%",this.assignControlAttributes(this.countdownDiv,"ima-countdown-div"),this.countdownDiv.innerHTML=this.controller.getSettings().adLabel,this.countdownDiv.style.display=this.showCountdown?"block":"none",this.assignControlAttributes(this.seekBarDiv,"ima-seek-bar-div"),this.seekBarDiv.style.width="100%",this.assignControlAttributes(this.progressDiv,"ima-progress-div"),this.assignControlAttributes(this.playPauseDiv,"ima-play-pause-div"),this.addClass(this.playPauseDiv,"ima-playing"),this.playPauseDiv.addEventListener("click",this.onAdPlayPauseClick.bind(this),!1),this.assignControlAttributes(this.muteDiv,"ima-mute-div"),this.addClass(this.muteDiv,"ima-non-muted"),this.muteDiv.addEventListener("click",this.onAdMuteClick.bind(this),!1),this.assignControlAttributes(this.sliderDiv,"ima-slider-div"),this.sliderDiv.addEventListener("mousedown",this.onAdVolumeSliderMouseDown.bind(this),!1),this.controller.getIsIos()&&(this.sliderDiv.style.display="none"),this.assignControlAttributes(this.sliderLevelDiv,"ima-slider-level-div"),this.assignControlAttributes(this.fullscreenDiv,"ima-fullscreen-div"),this.addClass(this.fullscreenDiv,"ima-non-fullscreen"),this.fullscreenDiv.addEventListener("click",this.onAdFullscreenClick.bind(this),!1),this.adContainerDiv.appendChild(this.controlsDiv),this.controlsDiv.appendChild(this.countdownDiv),this.controlsDiv.appendChild(this.seekBarDiv),this.controlsDiv.appendChild(this.playPauseDiv),this.controlsDiv.appendChild(this.muteDiv),this.controlsDiv.appendChild(this.sliderDiv),this.controlsDiv.appendChild(this.fullscreenDiv),this.seekBarDiv.appendChild(this.progressDiv),this.sliderDiv.appendChild(this.sliderLevelDiv)},i.prototype.onAdPlayPauseClick=function(){this.controller.onAdPlayPauseClick()},i.prototype.onAdMuteClick=function(){this.controller.onAdMuteClick()},i.prototype.onAdFullscreenClick=function(){this.controller.toggleFullscreen()},i.prototype.onAdsPaused=function(){this.addClass(this.playPauseDiv,"ima-paused"),this.removeClass(this.playPauseDiv,"ima-playing"),this.showAdControls()},i.prototype.onAdsResumed=function(){this.onAdsPlaying(),this.showAdControls()},i.prototype.onAdsPlaying=function(){this.addClass(this.playPauseDiv,"ima-playing"),this.removeClass(this.playPauseDiv,"ima-paused")},i.prototype.updateAdUi=function(t,e,i,n,s){var o=Math.floor(e/60),r=Math.floor(e%60);r.toString().length<2&&(r="0"+r);var a=": ";s>1&&(a=" ("+n+" "+this.controller.getSettings().adLabelNofN+" "+s+"): "),this.countdownDiv.innerHTML=this.controller.getSettings().adLabel+a+o+":"+r;var d=100*(t/i);this.progressDiv.style.width=d+"%"},i.prototype.unmute=function(){this.addClass(this.muteDiv,"ima-non-muted"),this.removeClass(this.muteDiv,"ima-muted"),this.sliderLevelDiv.style.width=100*this.controller.getPlayerVolume()+"%"},i.prototype.mute=function(){this.addClass(this.muteDiv,"ima-muted"),this.removeClass(this.muteDiv,"ima-non-muted"),this.sliderLevelDiv.style.width="0%"},i.prototype.onAdVolumeSliderMouseDown=function(){document.addEventListener("mouseup",this.boundOnMouseUp,!1),document.addEventListener("mousemove",this.boundOnMouseMove,!1)},i.prototype.onMouseMove=function(t){this.changeVolume(t)},i.prototype.onMouseUp=function(t){this.changeVolume(t),document.removeEventListener("mouseup",this.boundOnMouseUp),document.removeEventListener("mousemove",this.boundOnMouseMove)},i.prototype.changeVolume=function(t){var e=(t.clientX-this.sliderDiv.getBoundingClientRect().left)/this.sliderDiv.offsetWidth;e*=100,e=Math.min(Math.max(e,0),100),this.sliderLevelDiv.style.width=e+"%",0==this.percent?(this.addClass(this.muteDiv,"ima-muted"),this.removeClass(this.muteDiv,"ima-non-muted")):(this.addClass(this.muteDiv,"ima-non-muted"),this.removeClass(this.muteDiv,"ima-muted")),this.controller.setVolume(e/100)},i.prototype.showAdContainer=function(){this.adContainerDiv.style.display="block"},i.prototype.hideAdContainer=function(){this.adContainerDiv.style.display="none"},i.prototype.reset=function(){this.hideAdContainer()},i.prototype.onAdError=function(){this.hideAdContainer()},i.prototype.onAdBreakStart=function(t){this.showAdContainer(),"application/javascript"!==t.getAd().getContentType()||this.controller.getSettings().showControlsForJSAds?this.controlsDiv.style.display="block":this.controlsDiv.style.display="none",this.onAdsPlaying(),this.hideAdControls()},i.prototype.onAdBreakEnd=function(){var t=this.controller.getCurrentAd();(null==t||t.isLinear())&&this.hideAdContainer(),this.controlsDiv.style.display="none",this.countdownDiv.innerHTML=""},i.prototype.onAllAdsCompleted=function(){this.hideAdContainer()},i.prototype.onLinearAdStart=function(){this.removeClass(this.adContainerDiv,"bumpable-ima-ad-container")},i.prototype.onNonLinearAdLoad=function(){this.adContainerDiv.style.display="block",this.addClass(this.adContainerDiv,"bumpable-ima-ad-container")},i.prototype.onPlayerEnterFullscreen=function(){this.addClass(this.fullscreenDiv,"ima-fullscreen"),this.removeClass(this.fullscreenDiv,"ima-non-fullscreen")},i.prototype.onPlayerExitFullscreen=function(){this.addClass(this.fullscreenDiv,"ima-non-fullscreen"),this.removeClass(this.fullscreenDiv,"ima-fullscreen")},i.prototype.onPlayerVolumeChanged=function(t){0==t?(this.addClass(this.muteDiv,"ima-muted"),this.removeClass(this.muteDiv,"ima-non-muted"),this.sliderLevelDiv.style.width="0%"):(this.addClass(this.muteDiv,"ima-non-muted"),this.removeClass(this.muteDiv,"ima-muted"),this.sliderLevelDiv.style.width=100*t+"%")},i.prototype.showAdControls=function(){this.addClass(this.controlsDiv,"ima-controls-div-showing"),this.playPauseDiv.style.display="block",this.muteDiv.style.display="block",this.fullscreenDiv.style.display="block",this.controller.getIsIos()||(this.sliderDiv.style.display="block")},i.prototype.hideAdControls=function(){this.removeClass(this.controlsDiv,"ima-controls-div-showing"),this.playPauseDiv.style.display="none",this.muteDiv.style.display="none",this.sliderDiv.style.display="none",this.fullscreenDiv.style.display="none"},i.prototype.assignControlAttributes=function(t,e){t.id=this.controlPrefix+e,t.className=this.controlPrefix+e+" "+e},i.prototype.getClassRegexp=function(t){return new RegExp("(^|[^A-Za-z-])"+t+"((?![A-Za-z-])|$)","gi")},i.prototype.elementHasClass=function(t,e){return this.getClassRegexp(e).test(t.className)},i.prototype.addClass=function(t,e){t.className=t.className.trim()+" "+e},i.prototype.removeClass=function(t,e){var i=this.getClassRegexp(e);t.className=t.className.trim().replace(i,"")},i.prototype.getAdContainerDiv=function(){return this.adContainerDiv},i.prototype.setShowCountdown=function(t){this.showCountdown=t,this.countdownDiv.style.display=this.showCountdown?"block":"none"};var n="1.6.3",s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=function(t){this.controller=t,this.adDisplayContainer=null,this.adDisplayContainerInitialized=!1,this.adsLoader=null,this.adsManager=null,this.adsRenderingSettings=null,this.adsResponse=null,this.currentAd=null,this.adTrackingTimer=null,this.allAdsCompleted=!1,this.adsActive=!1,this.adPlaying=!1,this.adMuted=!1,this.adBreakReadyListener=void 0,this.contentCompleteCalled=!1,this.adsManagerDimensions={width:0,height:0},this.autoPlayAdBreaks=!0,!1===this.controller.getSettings().autoPlayAdBreaks&&(this.autoPlayAdBreaks=!1),this.controller.getSettings().locale&&google.ima.settings.setLocale(this.controller.getSettings().locale),this.controller.getSettings().disableFlashAds&&google.ima.settings.setDisableFlashAds(this.controller.getSettings().disableFlashAds),this.controller.getSettings().disableCustomPlaybackForIOS10Plus&&google.ima.settings.setDisableCustomPlaybackForIOS10Plus(this.controller.getSettings().disableCustomPlaybackForIOS10Plus)};o.prototype.initAdObjects=function(){this.adDisplayContainer=new google.ima.AdDisplayContainer(this.controller.getAdContainerDiv(),this.controller.getContentPlayer()),this.adsLoader=new google.ima.AdsLoader(this.adDisplayContainer),this.adsLoader.getSettings().setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.ENABLED),0==this.controller.getSettings().vpaidAllowed&&this.adsLoader.getSettings().setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.DISABLED),this.controller.getSettings().vpaidMode&&this.adsLoader.getSettings().setVpaidMode(this.controller.getSettings().vpaidMode),this.controller.getSettings().locale&&this.adsLoader.getSettings().setLocale(this.controller.getSettings().locale),this.controller.getSettings().numRedirects&&this.adsLoader.getSettings().setNumRedirects(this.controller.getSettings().numRedirects),this.adsLoader.getSettings().setPlayerType("videojs-ima"),this.adsLoader.getSettings().setPlayerVersion(n),this.adsLoader.getSettings().setAutoPlayAdBreaks(this.autoPlayAdBreaks),this.adsLoader.addEventListener(google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.onAdsManagerLoaded.bind(this),!1),this.adsLoader.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,this.onAdsLoaderError.bind(this),!1)},o.prototype.requestAds=function(){var t=new google.ima.AdsRequest;this.controller.getSettings().adTagUrl?t.adTagUrl=this.controller.getSettings().adTagUrl:t.adsResponse=this.controller.getSettings().adsResponse,this.controller.getSettings().forceNonLinearFullSlot&&(t.forceNonLinearFullSlot=!0),this.controller.getSettings().vastLoadTimeout&&(t.vastLoadTimeout=this.controller.getSettings().vastLoadTimeout),t.linearAdSlotWidth=this.controller.getPlayerWidth(),t.linearAdSlotHeight=this.controller.getPlayerHeight(),t.nonLinearAdSlotWidth=this.controller.getSettings().nonLinearWidth||this.controller.getPlayerWidth(),t.nonLinearAdSlotHeight=this.controller.getSettings().nonLinearHeight||this.controller.getPlayerHeight(),t.setAdWillAutoPlay(this.controller.adsWillAutoplay()),t.setAdWillPlayMuted(this.controller.adsWillPlayMuted());var e=this.controller.getSettings().adsRequest;e&&"object"===(void 0===e?"undefined":s(e))&&Object.keys(e).forEach(function(i){t[i]=e[i]}),this.adsLoader.requestAds(t),this.controller.triggerPlayerEvent("ads-request",t)},o.prototype.onAdsManagerLoaded=function(t){this.createAdsRenderingSettings(),this.adsManager=t.getAdsManager(this.controller.getContentPlayheadTracker(),this.adsRenderingSettings),this.adsManager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,this.onAdError.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.AD_BREAK_READY,this.onAdBreakReady.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,this.onContentPauseRequested.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,this.onContentResumeRequested.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.ALL_ADS_COMPLETED,this.onAllAdsCompleted.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.LOADED,this.onAdLoaded.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.STARTED,this.onAdStarted.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.COMPLETE,this.onAdComplete.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.SKIPPED,this.onAdComplete.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.LOG,this.onAdLog.bind(this)),this.controller.getIsMobile()&&(this.adsManager.addEventListener(google.ima.AdEvent.Type.PAUSED,this.onAdPaused.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.RESUMED,this.onAdResumed.bind(this))),this.autoPlayAdBreaks||this.initAdsManager(),this.controller.onAdsReady(),this.controller.getSettings().adsManagerLoadedCallback&&this.controller.getSettings().adsManagerLoadedCallback()},o.prototype.onAdsLoaderError=function(t){window.console.warn("AdsLoader error: "+t.getError()),this.controller.onErrorLoadingAds(t),this.adsManager&&this.adsManager.destroy()},o.prototype.initAdsManager=function(){try{var t=this.controller.getPlayerWidth(),e=this.controller.getPlayerHeight();this.adsManagerDimensions.width=t,this.adsManagerDimensions.height=e,this.adsManager.init(t,e,google.ima.ViewMode.NORMAL),this.adsManager.setVolume(this.controller.getPlayerVolume()),this.initializeAdDisplayContainer()}catch(t){this.onAdError(t)}},o.prototype.createAdsRenderingSettings=function(){if(this.adsRenderingSettings=new google.ima.AdsRenderingSettings,this.adsRenderingSettings.restoreCustomPlaybackStateOnAdBreakComplete=!0,this.controller.getSettings().adsRenderingSettings)for(var t in this.controller.getSettings().adsRenderingSettings)""!==t&&(this.adsRenderingSettings[t]=this.controller.getSettings().adsRenderingSettings[t])},o.prototype.onAdError=function(t){var e=void 0!==t.getError?t.getError():t.stack;window.console.warn("Ad error: "+e),this.adsManager.destroy(),this.controller.onAdError(t),this.adsActive=!1,this.adPlaying=!1},o.prototype.onAdBreakReady=function(t){this.adBreakReadyListener(t)},o.prototype.onContentPauseRequested=function(t){this.adsActive=!0,this.adPlaying=!0,this.controller.onAdBreakStart(t)},o.prototype.onContentResumeRequested=function(t){this.adsActive=!1,this.adPlaying=!1,this.controller.onAdBreakEnd()},o.prototype.onAllAdsCompleted=function(t){this.allAdsCompleted=!0,this.controller.onAllAdsCompleted()},o.prototype.onAdLoaded=function(t){t.getAd().isLinear()||(this.controller.onNonLinearAdLoad(),this.controller.playContent())},o.prototype.onAdStarted=function(t){this.currentAd=t.getAd(),this.currentAd.isLinear()?(this.adTrackingTimer=setInterval(this.onAdPlayheadTrackerInterval.bind(this),250),this.controller.onLinearAdStart()):this.controller.onNonLinearAdStart()},o.prototype.onAdPaused=function(){this.controller.onAdsPaused()},o.prototype.onAdResumed=function(t){this.controller.onAdsResumed()},o.prototype.onAdComplete=function(){this.currentAd.isLinear()&&clearInterval(this.adTrackingTimer)},o.prototype.onAdLog=function(t){this.controller.onAdLog(t)},o.prototype.onAdPlayheadTrackerInterval=function(){var t=this.adsManager.getRemainingTime(),e=this.currentAd.getDuration(),i=e-t;i=i>0?i:0;var n=0,s=void 0;this.currentAd.getAdPodInfo()&&(s=this.currentAd.getAdPodInfo().getAdPosition(),n=this.currentAd.getAdPodInfo().getTotalAds()),this.controller.onAdPlayheadUpdated(i,t,e,s,n)},o.prototype.onContentComplete=function(){this.adsLoader&&(this.adsLoader.contentComplete(),this.contentCompleteCalled=!0),this.adsManager&&this.adsManager.getCuePoints()&&!this.adsManager.getCuePoints().includes(-1)&&this.controller.onNoPostroll(),this.allAdsCompleted&&this.controller.onContentAndAdsCompleted()},o.prototype.onPlayerDisposed=function(){this.adTrackingTimer&&clearInterval(this.adTrackingTimer),this.adsManager&&(this.adsManager.destroy(),this.adsManager=null)},o.prototype.onPlayerReadyForPreroll=function(){if(this.autoPlayAdBreaks){this.initAdsManager();try{this.controller.showAdContainer(),this.adsManager.setVolume(this.controller.getPlayerVolume()),this.adsManager.start()}catch(t){this.onAdError(t)}}},o.prototype.onPlayerReady=function(){this.initAdObjects(),(this.controller.getSettings().adTagUrl||this.controller.getSettings().adsResponse)&&"onLoad"===this.controller.getSettings().requestMode&&this.requestAds()},o.prototype.onPlayerEnterFullscreen=function(){this.adsManager&&this.adsManager.resize(window.screen.width,window.screen.height,google.ima.ViewMode.FULLSCREEN)},o.prototype.onPlayerExitFullscreen=function(){this.adsManager&&this.adsManager.resize(this.controller.getPlayerWidth(),this.controller.getPlayerHeight(),google.ima.ViewMode.NORMAL)},o.prototype.onPlayerVolumeChanged=function(t){this.adsManager&&this.adsManager.setVolume(t),this.adMuted=0==t},o.prototype.onPlayerResize=function(t,e){this.adsManager&&(this.adsManagerDimensions.width=t,this.adsManagerDimensions.height=e,this.adsManager.resize(t,e,google.ima.ViewMode.NORMAL))},o.prototype.getCurrentAd=function(){return this.currentAd},o.prototype.setAdBreakReadyListener=function(t){this.adBreakReadyListener=t},o.prototype.isAdPlaying=function(){return this.adPlaying},o.prototype.isAdMuted=function(){return this.adMuted},o.prototype.pauseAds=function(){this.adsManager.pause(),this.adPlaying=!1},o.prototype.resumeAds=function(){this.adsManager.resume(),this.adPlaying=!0},o.prototype.unmute=function(){this.adsManager.setVolume(1),this.adMuted=!1},o.prototype.mute=function(){this.adsManager.setVolume(0),this.adMuted=!0},o.prototype.setVolume=function(t){this.adsManager.setVolume(t),this.adMuted=0==t},o.prototype.initializeAdDisplayContainer=function(){this.adDisplayContainer&&(this.adDisplayContainerInitialized||(this.adDisplayContainer.initialize(),this.adDisplayContainerInitialized=!0))},o.prototype.playAdBreak=function(){this.autoPlayAdBreaks||(this.controller.showAdContainer(),this.adsManager.setVolume(this.controller.getPlayerVolume()),this.adsManager.start())},o.prototype.addEventListener=function(t,e){this.adsManager&&this.adsManager.addEventListener(t,e)},o.prototype.getAdsManager=function(){return this.adsManager},o.prototype.reset=function(){this.adsActive=!1,this.adPlaying=!1,this.adTrackingTimer&&clearInterval(this.adTrackingTimer),this.adsManager&&(this.adsManager.destroy(),this.adsManager=null),this.adsLoader&&!this.contentCompleteCalled&&this.adsLoader.contentComplete(),this.contentCompleteCalled=!1,this.allAdsCompleted=!1};var r=function(t,n){this.settings={},this.contentAndAdsEndedListeners=[],this.isMobile=navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPad/i)||navigator.userAgent.match(/Android/i),this.isIos=navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPad/i),this.initWithSettings(n);var s={debug:this.settings.debug,timeout:this.settings.timeout,prerollTimeout:this.settings.prerollTimeout},r=this.extend({},s,n.contribAdsSettings||{});this.playerWrapper=new e(t,r,this),this.adUi=new i(this),this.sdkImpl=new o(this)};r.IMA_DEFAULTS={debug:!1,timeout:5e3,prerollTimeout:1e3,adLabel:"Advertisement",adLabelNofN:"of",showControlsForJSAds:!0,requestMode:"onLoad"},r.prototype.initWithSettings=function(t){this.settings=this.extend({},r.IMA_DEFAULTS,t||{}),this.warnAboutDeprecatedSettings(),this.showCountdown=!0,!1===this.settings.showCountdown&&(this.showCountdown=!1)},r.prototype.warnAboutDeprecatedSettings=function(){var t=this;["adWillAutoplay","adsWillAutoplay","adWillPlayMuted","adsWillPlayMuted"].forEach(function(e){void 0!==t.settings[e]&&console.warn("WARNING: videojs.ima setting "+e+" is deprecated")})},r.prototype.getSettings=function(){return this.settings},r.prototype.getIsMobile=function(){return this.isMobile},r.prototype.getIsIos=function(){return this.isIos},r.prototype.injectAdContainerDiv=function(t){this.playerWrapper.injectAdContainerDiv(t)},r.prototype.getAdContainerDiv=function(){return this.adUi.getAdContainerDiv()},r.prototype.getContentPlayer=function(){return this.playerWrapper.getContentPlayer()},r.prototype.getContentPlayheadTracker=function(){return this.playerWrapper.getContentPlayheadTracker()},r.prototype.requestAds=function(){this.sdkImpl.requestAds()},r.prototype.setSetting=function(t,e){this.settings[t]=e},r.prototype.onErrorLoadingAds=function(t){this.adUi.onAdError(),this.playerWrapper.onAdError(t)},r.prototype.onAdPlayPauseClick=function(){this.sdkImpl.isAdPlaying()?(this.adUi.onAdsPaused(),this.sdkImpl.pauseAds()):(this.adUi.onAdsPlaying(),this.sdkImpl.resumeAds())},r.prototype.onAdMuteClick=function(){this.sdkImpl.isAdMuted()?(this.playerWrapper.unmute(),this.adUi.unmute(),this.sdkImpl.unmute()):(this.playerWrapper.mute(),this.adUi.mute(),this.sdkImpl.mute())},r.prototype.setVolume=function(t){this.playerWrapper.setVolume(t),this.sdkImpl.setVolume(t)},r.prototype.getPlayerVolume=function(){return this.playerWrapper.getVolume()},r.prototype.toggleFullscreen=function(){this.playerWrapper.toggleFullscreen()},r.prototype.onAdError=function(t){this.adUi.onAdError(),this.playerWrapper.onAdError(t)},r.prototype.onAdBreakStart=function(t){this.playerWrapper.onAdBreakStart(),this.adUi.onAdBreakStart(t)},r.prototype.showAdContainer=function(){this.adUi.showAdContainer()},r.prototype.onAdBreakEnd=function(){this.playerWrapper.onAdBreakEnd(),this.adUi.onAdBreakEnd()},r.prototype.onAllAdsCompleted=function(){this.adUi.onAllAdsCompleted(),this.playerWrapper.onAllAdsCompleted()},r.prototype.onAdsPaused=function(){this.adUi.onAdsPaused()},r.prototype.onAdsResumed=function(){this.adUi.onAdsResumed()},r.prototype.onAdPlayheadUpdated=function(t,e,i,n,s){this.adUi.updateAdUi(t,e,i,n,s)},r.prototype.onAdLog=function(t){this.playerWrapper.onAdLog(t)},r.prototype.getCurrentAd=function(){return this.sdkImpl.getCurrentAd()},r.prototype.playContent=function(){this.playerWrapper.play()},r.prototype.onLinearAdStart=function(){this.adUi.onLinearAdStart(),this.playerWrapper.onAdStart()},r.prototype.onNonLinearAdLoad=function(){this.adUi.onNonLinearAdLoad()},r.prototype.onNonLinearAdStart=function(){this.adUi.onNonLinearAdLoad(),this.playerWrapper.onAdStart()},r.prototype.getPlayerWidth=function(){return this.playerWrapper.getPlayerWidth()},r.prototype.getPlayerHeight=function(){return this.playerWrapper.getPlayerHeight()},r.prototype.onAdsReady=function(){this.playerWrapper.onAdsReady()},r.prototype.onPlayerResize=function(t,e){this.sdkImpl.onPlayerResize(t,e)},r.prototype.onContentComplete=function(){this.sdkImpl.onContentComplete()},r.prototype.onNoPostroll=function(){this.playerWrapper.onNoPostroll()},r.prototype.onContentAndAdsCompleted=function(){for(var t in this.contentAndAdsEndedListeners)"function"==typeof this.contentAndAdsEndedListeners[t]&&this.contentAndAdsEndedListeners[t]()},r.prototype.onPlayerDisposed=function(){this.contentAndAdsEndedListeners=[],this.sdkImpl.onPlayerDisposed()},r.prototype.onPlayerReadyForPreroll=function(){this.sdkImpl.onPlayerReadyForPreroll()},r.prototype.onPlayerReady=function(){this.sdkImpl.onPlayerReady()},r.prototype.onPlayerEnterFullscreen=function(){this.adUi.onPlayerEnterFullscreen(),this.sdkImpl.onPlayerEnterFullscreen()},r.prototype.onPlayerExitFullscreen=function(){this.adUi.onPlayerExitFullscreen(),this.sdkImpl.onPlayerExitFullscreen()},r.prototype.onPlayerVolumeChanged=function(t){this.adUi.onPlayerVolumeChanged(t),this.sdkImpl.onPlayerVolumeChanged(t)},r.prototype.setContentWithAdTag=function(t,e){this.reset(),this.settings.adTagUrl=e||this.settings.adTagUrl,this.playerWrapper.changeSource(t)},r.prototype.setContentWithAdsResponse=function(t,e){this.reset(),this.settings.adsResponse=e||this.settings.adsResponse,this.playerWrapper.changeSource(t)},r.prototype.setContentWithAdsRequest=function(t,e){this.reset(),this.settings.adsRequest=e||this.settings.adsRequest,this.playerWrapper.changeSource(t)},r.prototype.reset=function(){this.sdkImpl.reset(),this.playerWrapper.reset(),this.adUi.reset()},r.prototype.addContentEndedListener=function(t){this.playerWrapper.addContentEndedListener(t)},r.prototype.addContentAndAdsEndedListener=function(t){this.contentAndAdsEndedListeners.push(t)},r.prototype.setAdBreakReadyListener=function(t){this.sdkImpl.setAdBreakReadyListener(t)},r.prototype.setShowCountdown=function(t){this.adUi.setShowCountdown(t),this.showCountdown=t,this.countdownDiv.style.display=this.showCountdown?"block":"none"},r.prototype.initializeAdDisplayContainer=function(){this.sdkImpl.initializeAdDisplayContainer()},r.prototype.playAdBreak=function(){this.sdkImpl.playAdBreak()},r.prototype.addEventListener=function(t,e){this.sdkImpl.addEventListener(t,e)},r.prototype.getAdsManager=function(){return this.sdkImpl.getAdsManager()},r.prototype.getPlayerId=function(){return this.playerWrapper.getPlayerId()},r.prototype.changeAdTag=function(t){this.reset(),this.settings.adTagUrl=t},r.prototype.pauseAd=function(){this.adUi.onAdsPaused(),this.sdkImpl.pauseAds()},r.prototype.resumeAd=function(){this.adUi.onAdsPlaying(),this.sdkImpl.resumeAds()},r.prototype.adsWillAutoplay=function(){return void 0!==this.settings.adsWillAutoplay?this.settings.adsWillAutoplay:void 0!==this.settings.adWillAutoplay?this.settings.adWillAutoplay:!!this.playerWrapper.getPlayerOptions().autoplay},r.prototype.adsWillPlayMuted=function(){return void 0!==this.settings.adsWillPlayMuted?this.settings.adsWillPlayMuted:void 0!==this.settings.adWillPlayMuted?this.settings.adWillPlayMuted:void 0!==this.playerWrapper.getPlayerOptions().muted?this.playerWrapper.getPlayerOptions().muted:0==this.playerWrapper.getVolume()},r.prototype.triggerPlayerEvent=function(t,e){this.playerWrapper.triggerPlayerEvent(t,e)},r.prototype.extend=function(t){for(var e=void 0,i=void 0,n=void 0,s=arguments.length,o=Array(s>1?s-1:0),r=1;rthis.seekCheckInterval+this.seekThreshold?this.contentPlayheadTracker.seeking=!0:this.contentPlayheadTracker.seeking=!1,this.contentPlayheadTracker.previousTime=this.vjsPlayer.currentTime()},e.prototype.checkForResize=function(){var t=this.getPlayerWidth(),e=this.getPlayerHeight();t==this.vjsPlayerDimensions.width&&e==this.vjsPlayerDimensions.height||(this.vjsPlayerDimensions.width=t,this.vjsPlayerDimensions.height=e,this.controller.onPlayerResize(t,e))},e.prototype.localContentEndedListener=function(){for(var t in this.contentComplete||(this.contentComplete=!0,this.controller.onContentComplete()),this.contentEndedListeners)"function"==typeof this.contentEndedListeners[t]&&this.contentEndedListeners[t]();clearInterval(this.updateTimeIntervalHandle),clearInterval(this.seekCheckIntervalHandle),clearInterval(this.resizeCheckIntervalHandle),this.vjsPlayer.el()&&this.vjsPlayer.one("play",this.setUpPlayerIntervals.bind(this))},e.prototype.onNoPostroll=function(){this.vjsPlayer.trigger("nopostroll")},e.prototype.playerDisposedListener=function(){this.contentEndedListeners=[],this.controller.onPlayerDisposed(),this.contentComplete=!0,this.vjsPlayer.off("contentended",this.boundContentEndedListener),this.vjsPlayer.ads.adTimeoutTimeout&&clearTimeout(this.vjsPlayer.ads.adTimeoutTimeout);var t=[this.updateTimeIntervalHandle,this.seekCheckIntervalHandle,this.resizeCheckIntervalHandle];for(var e in t)t[e]&&clearInterval(t[e])},e.prototype.onReadyForPreroll=function(){this.controller.onPlayerReadyForPreroll()},e.prototype.onPlayerReady=function(){this.h5Player=document.getElementById(this.getPlayerId()).getElementsByClassName("vjs-tech")[0],this.h5Player.hasAttribute("autoplay")&&this.controller.setSetting("adWillAutoPlay",!0),this.onVolumeChange(),this.vjsPlayer.on("fullscreenchange",this.onFullscreenChange.bind(this)),this.vjsPlayer.on("volumechange",this.onVolumeChange.bind(this)),this.controller.onPlayerReady()},e.prototype.onFullscreenChange=function(){this.vjsPlayer.isFullscreen()?this.controller.onPlayerEnterFullscreen():this.controller.onPlayerExitFullscreen()},e.prototype.onVolumeChange=function(){var t=this.vjsPlayer.muted()?0:this.vjsPlayer.volume();this.controller.onPlayerVolumeChanged(t)},e.prototype.injectAdContainerDiv=function(t){this.vjsControls.el().parentNode.appendChild(t)},e.prototype.getContentPlayer=function(){return this.h5Player},e.prototype.getVolume=function(){return this.vjsPlayer.muted()?0:this.vjsPlayer.volume()},e.prototype.setVolume=function(t){this.vjsPlayer.volume(t),0==t?this.vjsPlayer.muted(!0):this.vjsPlayer.muted(!1)},e.prototype.unmute=function(){this.vjsPlayer.muted(!1)},e.prototype.mute=function(){this.vjsPlayer.muted(!0)},e.prototype.play=function(){this.vjsPlayer.play()},e.prototype.getPlayerWidth=function(){var t=(getComputedStyle(this.vjsPlayer.el())||{}).width;return t&&0!==parseFloat(t)||(t=(this.vjsPlayer.el().getBoundingClientRect()||{}).width),parseFloat(t)||this.vjsPlayer.width()},e.prototype.getPlayerHeight=function(){var t=(getComputedStyle(this.vjsPlayer.el())||{}).height;return t&&0!==parseFloat(t)||(t=(this.vjsPlayer.el().getBoundingClientRect()||{}).height),parseFloat(t)||this.vjsPlayer.height()},e.prototype.getPlayerOptions=function(){return this.vjsPlayer.options_},e.prototype.getPlayerId=function(){return this.vjsPlayer.id()},e.prototype.toggleFullscreen=function(){this.vjsPlayer.isFullscreen()?this.vjsPlayer.exitFullscreen():this.vjsPlayer.requestFullscreen()},e.prototype.getContentPlayheadTracker=function(){return this.contentPlayheadTracker},e.prototype.onAdError=function(t){this.vjsControls.show();var e=void 0!==t.getError?t.getError():t.stack;this.vjsPlayer.trigger({type:"adserror",data:{AdError:e,AdErrorEvent:t}})},e.prototype.onAdLog=function(t){var e=t.getAdData(),i=void 0!==e.adError?e.adError.getMessage():void 0;this.vjsPlayer.trigger({type:"adslog",data:{AdError:i,AdEvent:t}})},e.prototype.onAdBreakStart=function(){this.contentSource=this.vjsPlayer.currentSrc(),this.contentSourceType=this.vjsPlayer.currentType(),this.vjsPlayer.off("contentended",this.boundContentEndedListener),this.vjsPlayer.ads.startLinearAdMode(),this.vjsControls.hide(),this.vjsPlayer.pause()},e.prototype.onAdBreakEnd=function(){this.vjsPlayer.on("contentended",this.boundContentEndedListener),this.vjsPlayer.ads.inAdBreak()&&this.vjsPlayer.ads.endLinearAdMode(),this.vjsControls.show()},e.prototype.onAdStart=function(){this.vjsPlayer.trigger("ads-ad-started")},e.prototype.onAllAdsCompleted=function(){1==this.contentComplete&&(this.vjsPlayer.currentSrc()!=this.contentSource&&this.vjsPlayer.src({src:this.contentSource,type:this.contentSourceType}),this.controller.onContentAndAdsCompleted())},e.prototype.onAdsReady=function(){this.vjsPlayer.trigger("adsready")},e.prototype.changeSource=function(t){this.vjsPlayer.currentSrc()&&(this.vjsPlayer.currentTime(0),this.vjsPlayer.pause()),t&&this.vjsPlayer.src(t),this.vjsPlayer.one("loadedmetadata",this.seekContentToZero.bind(this))},e.prototype.seekContentToZero=function(){this.vjsPlayer.currentTime(0)},e.prototype.triggerPlayerEvent=function(t,e){this.vjsPlayer.trigger(t,e)},e.prototype.addContentEndedListener=function(t){this.contentEndedListeners.push(t)},e.prototype.reset=function(){this.vjsPlayer.on("contentended",this.boundContentEndedListener),this.vjsControls.show(),this.vjsPlayer.ads.inAdBreak()&&this.vjsPlayer.ads.endLinearAdMode(),this.contentPlayheadTracker.currentTime=0,this.contentComplete=!1};var i=function(t){this.controller=t,this.adContainerDiv=document.createElement("div"),this.controlsDiv=document.createElement("div"),this.countdownDiv=document.createElement("div"),this.seekBarDiv=document.createElement("div"),this.progressDiv=document.createElement("div"),this.playPauseDiv=document.createElement("div"),this.muteDiv=document.createElement("div"),this.sliderDiv=document.createElement("div"),this.sliderLevelDiv=document.createElement("div"),this.fullscreenDiv=document.createElement("div"),this.boundOnMouseUp=this.onMouseUp.bind(this),this.boundOnMouseMove=this.onMouseMove.bind(this),this.adPlayheadTracker={currentTime:0,duration:0,isPod:!1,adPosition:0,totalAds:0},this.controlPrefix=this.controller.getPlayerId()+"_",this.showCountdown=!0,!1===this.controller.getSettings().showCountdown&&(this.showCountdown=!1),this.createAdContainer()};i.prototype.createAdContainer=function(){this.assignControlAttributes(this.adContainerDiv,"ima-ad-container"),this.adContainerDiv.style.position="absolute",this.adContainerDiv.style.zIndex=1111,t.browser.IS_IOS||(this.adContainerDiv.addEventListener("mouseenter",this.showAdControls.bind(this),!1),this.adContainerDiv.addEventListener("mouseleave",this.hideAdControls.bind(this),!1)),this.createControls(),this.controller.injectAdContainerDiv(this.adContainerDiv)},i.prototype.createControls=function(){this.assignControlAttributes(this.controlsDiv,"ima-controls-div"),this.controlsDiv.style.width="100%",this.assignControlAttributes(this.countdownDiv,"ima-countdown-div"),this.countdownDiv.innerHTML=this.controller.getSettings().adLabel,this.countdownDiv.style.display=this.showCountdown?"block":"none",this.assignControlAttributes(this.seekBarDiv,"ima-seek-bar-div"),this.seekBarDiv.style.width="100%",this.assignControlAttributes(this.progressDiv,"ima-progress-div"),this.assignControlAttributes(this.playPauseDiv,"ima-play-pause-div"),this.addClass(this.playPauseDiv,"ima-playing"),this.playPauseDiv.addEventListener("click",this.onAdPlayPauseClick.bind(this),!1),this.assignControlAttributes(this.muteDiv,"ima-mute-div"),this.addClass(this.muteDiv,"ima-non-muted"),this.muteDiv.addEventListener("click",this.onAdMuteClick.bind(this),!1),this.assignControlAttributes(this.sliderDiv,"ima-slider-div"),this.sliderDiv.addEventListener("mousedown",this.onAdVolumeSliderMouseDown.bind(this),!1),this.controller.getIsIos()&&(this.sliderDiv.style.display="none"),this.assignControlAttributes(this.sliderLevelDiv,"ima-slider-level-div"),this.assignControlAttributes(this.fullscreenDiv,"ima-fullscreen-div"),this.addClass(this.fullscreenDiv,"ima-non-fullscreen"),this.fullscreenDiv.addEventListener("click",this.onAdFullscreenClick.bind(this),!1),this.adContainerDiv.appendChild(this.controlsDiv),this.controlsDiv.appendChild(this.countdownDiv),this.controlsDiv.appendChild(this.seekBarDiv),this.controlsDiv.appendChild(this.playPauseDiv),this.controlsDiv.appendChild(this.muteDiv),this.controlsDiv.appendChild(this.sliderDiv),this.controlsDiv.appendChild(this.fullscreenDiv),this.seekBarDiv.appendChild(this.progressDiv),this.sliderDiv.appendChild(this.sliderLevelDiv)},i.prototype.onAdPlayPauseClick=function(){this.controller.onAdPlayPauseClick()},i.prototype.onAdMuteClick=function(){this.controller.onAdMuteClick()},i.prototype.onAdFullscreenClick=function(){this.controller.toggleFullscreen()},i.prototype.onAdsPaused=function(){this.addClass(this.playPauseDiv,"ima-paused"),this.removeClass(this.playPauseDiv,"ima-playing"),this.showAdControls()},i.prototype.onAdsResumed=function(){this.onAdsPlaying(),this.showAdControls()},i.prototype.onAdsPlaying=function(){this.addClass(this.playPauseDiv,"ima-playing"),this.removeClass(this.playPauseDiv,"ima-paused")},i.prototype.updateAdUi=function(t,e,i,n,s){var o=Math.floor(e/60),r=Math.floor(e%60);r.toString().length<2&&(r="0"+r);var a=": ";s>1&&(a=" ("+n+" "+this.controller.getSettings().adLabelNofN+" "+s+"): "),this.countdownDiv.innerHTML=this.controller.getSettings().adLabel+a+o+":"+r;var d=100*(t/i);this.progressDiv.style.width=d+"%"},i.prototype.unmute=function(){this.addClass(this.muteDiv,"ima-non-muted"),this.removeClass(this.muteDiv,"ima-muted"),this.sliderLevelDiv.style.width=100*this.controller.getPlayerVolume()+"%"},i.prototype.mute=function(){this.addClass(this.muteDiv,"ima-muted"),this.removeClass(this.muteDiv,"ima-non-muted"),this.sliderLevelDiv.style.width="0%"},i.prototype.onAdVolumeSliderMouseDown=function(){document.addEventListener("mouseup",this.boundOnMouseUp,!1),document.addEventListener("mousemove",this.boundOnMouseMove,!1)},i.prototype.onMouseMove=function(t){this.changeVolume(t)},i.prototype.onMouseUp=function(t){this.changeVolume(t),document.removeEventListener("mouseup",this.boundOnMouseUp),document.removeEventListener("mousemove",this.boundOnMouseMove)},i.prototype.changeVolume=function(t){var e=(t.clientX-this.sliderDiv.getBoundingClientRect().left)/this.sliderDiv.offsetWidth;e*=100,e=Math.min(Math.max(e,0),100),this.sliderLevelDiv.style.width=e+"%",0==this.percent?(this.addClass(this.muteDiv,"ima-muted"),this.removeClass(this.muteDiv,"ima-non-muted")):(this.addClass(this.muteDiv,"ima-non-muted"),this.removeClass(this.muteDiv,"ima-muted")),this.controller.setVolume(e/100)},i.prototype.showAdContainer=function(){this.adContainerDiv.style.display="block"},i.prototype.hideAdContainer=function(){this.adContainerDiv.style.display="none"},i.prototype.reset=function(){this.hideAdContainer()},i.prototype.onAdError=function(){this.hideAdContainer()},i.prototype.onAdBreakStart=function(t){this.showAdContainer(),"application/javascript"!==t.getAd().getContentType()||this.controller.getSettings().showControlsForJSAds?this.controlsDiv.style.display="block":this.controlsDiv.style.display="none",this.onAdsPlaying(),this.hideAdControls()},i.prototype.onAdBreakEnd=function(){var t=this.controller.getCurrentAd();(null==t||t.isLinear())&&this.hideAdContainer(),this.controlsDiv.style.display="none",this.countdownDiv.innerHTML=""},i.prototype.onAllAdsCompleted=function(){this.hideAdContainer()},i.prototype.onLinearAdStart=function(){this.removeClass(this.adContainerDiv,"bumpable-ima-ad-container")},i.prototype.onNonLinearAdLoad=function(){this.adContainerDiv.style.display="block",this.addClass(this.adContainerDiv,"bumpable-ima-ad-container")},i.prototype.onPlayerEnterFullscreen=function(){this.addClass(this.fullscreenDiv,"ima-fullscreen"),this.removeClass(this.fullscreenDiv,"ima-non-fullscreen")},i.prototype.onPlayerExitFullscreen=function(){this.addClass(this.fullscreenDiv,"ima-non-fullscreen"),this.removeClass(this.fullscreenDiv,"ima-fullscreen")},i.prototype.onPlayerVolumeChanged=function(t){0==t?(this.addClass(this.muteDiv,"ima-muted"),this.removeClass(this.muteDiv,"ima-non-muted"),this.sliderLevelDiv.style.width="0%"):(this.addClass(this.muteDiv,"ima-non-muted"),this.removeClass(this.muteDiv,"ima-muted"),this.sliderLevelDiv.style.width=100*t+"%")},i.prototype.showAdControls=function(){this.addClass(this.controlsDiv,"ima-controls-div-showing"),this.playPauseDiv.style.display="block",this.muteDiv.style.display="block",this.fullscreenDiv.style.display="block",this.controller.getIsIos()||(this.sliderDiv.style.display="block")},i.prototype.hideAdControls=function(){this.removeClass(this.controlsDiv,"ima-controls-div-showing"),this.playPauseDiv.style.display="none",this.muteDiv.style.display="none",this.sliderDiv.style.display="none",this.fullscreenDiv.style.display="none"},i.prototype.assignControlAttributes=function(t,e){t.id=this.controlPrefix+e,t.className=this.controlPrefix+e+" "+e},i.prototype.getClassRegexp=function(t){return new RegExp("(^|[^A-Za-z-])"+t+"((?![A-Za-z-])|$)","gi")},i.prototype.elementHasClass=function(t,e){return this.getClassRegexp(e).test(t.className)},i.prototype.addClass=function(t,e){t.className=t.className.trim()+" "+e},i.prototype.removeClass=function(t,e){var i=this.getClassRegexp(e);t.className=t.className.trim().replace(i,"")},i.prototype.getAdContainerDiv=function(){return this.adContainerDiv},i.prototype.setShowCountdown=function(t){this.showCountdown=t,this.countdownDiv.style.display=this.showCountdown?"block":"none"};var n="1.6.3",s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=function(t){this.controller=t,this.adDisplayContainer=null,this.adDisplayContainerInitialized=!1,this.adsLoader=null,this.adsManager=null,this.adsRenderingSettings=null,this.adsResponse=null,this.currentAd=null,this.adTrackingTimer=null,this.allAdsCompleted=!1,this.adsActive=!1,this.adPlaying=!1,this.adMuted=!1,this.adBreakReadyListener=void 0,this.contentCompleteCalled=!1,this.adsManagerDimensions={width:0,height:0},this.autoPlayAdBreaks=!0,!1===this.controller.getSettings().autoPlayAdBreaks&&(this.autoPlayAdBreaks=!1),this.controller.getSettings().locale&&google.ima.settings.setLocale(this.controller.getSettings().locale),this.controller.getSettings().disableFlashAds&&google.ima.settings.setDisableFlashAds(this.controller.getSettings().disableFlashAds),this.controller.getSettings().disableCustomPlaybackForIOS10Plus&&google.ima.settings.setDisableCustomPlaybackForIOS10Plus(this.controller.getSettings().disableCustomPlaybackForIOS10Plus)};o.prototype.initAdObjects=function(){this.adDisplayContainer=new google.ima.AdDisplayContainer(this.controller.getAdContainerDiv(),this.controller.getContentPlayer()),this.adsLoader=new google.ima.AdsLoader(this.adDisplayContainer),this.adsLoader.getSettings().setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.ENABLED),0==this.controller.getSettings().vpaidAllowed&&this.adsLoader.getSettings().setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.DISABLED),this.controller.getSettings().vpaidMode&&this.adsLoader.getSettings().setVpaidMode(this.controller.getSettings().vpaidMode),this.controller.getSettings().locale&&this.adsLoader.getSettings().setLocale(this.controller.getSettings().locale),this.controller.getSettings().numRedirects&&this.adsLoader.getSettings().setNumRedirects(this.controller.getSettings().numRedirects),this.adsLoader.getSettings().setPlayerType("videojs-ima"),this.adsLoader.getSettings().setPlayerVersion(n),this.adsLoader.getSettings().setAutoPlayAdBreaks(this.autoPlayAdBreaks),this.adsLoader.addEventListener(google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.onAdsManagerLoaded.bind(this),!1),this.adsLoader.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,this.onAdsLoaderError.bind(this),!1)},o.prototype.requestAds=function(){var t=new google.ima.AdsRequest;this.controller.getSettings().adTagUrl?t.adTagUrl=this.controller.getSettings().adTagUrl:t.adsResponse=this.controller.getSettings().adsResponse,this.controller.getSettings().forceNonLinearFullSlot&&(t.forceNonLinearFullSlot=!0),this.controller.getSettings().vastLoadTimeout&&(t.vastLoadTimeout=this.controller.getSettings().vastLoadTimeout),t.linearAdSlotWidth=this.controller.getPlayerWidth(),t.linearAdSlotHeight=this.controller.getPlayerHeight(),t.nonLinearAdSlotWidth=this.controller.getSettings().nonLinearWidth||this.controller.getPlayerWidth(),t.nonLinearAdSlotHeight=this.controller.getSettings().nonLinearHeight||this.controller.getPlayerHeight(),t.setAdWillAutoPlay(this.controller.adsWillAutoplay()),t.setAdWillPlayMuted(this.controller.adsWillPlayMuted());var e=this.controller.getSettings().adsRequest;e&&"object"===(void 0===e?"undefined":s(e))&&Object.keys(e).forEach(function(i){t[i]=e[i]}),this.adsLoader.requestAds(t),this.controller.triggerPlayerEvent("ads-request",t)},o.prototype.onAdsManagerLoaded=function(t){this.createAdsRenderingSettings(),this.adsManager=t.getAdsManager(this.controller.getContentPlayheadTracker(),this.adsRenderingSettings),this.adsManager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,this.onAdError.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.AD_BREAK_READY,this.onAdBreakReady.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,this.onContentPauseRequested.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,this.onContentResumeRequested.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.ALL_ADS_COMPLETED,this.onAllAdsCompleted.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.LOADED,this.onAdLoaded.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.STARTED,this.onAdStarted.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.COMPLETE,this.onAdComplete.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.SKIPPED,this.onAdComplete.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.LOG,this.onAdLog.bind(this)),this.controller.getIsMobile()&&(this.adsManager.addEventListener(google.ima.AdEvent.Type.PAUSED,this.onAdPaused.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.RESUMED,this.onAdResumed.bind(this))),this.autoPlayAdBreaks||this.initAdsManager(),this.controller.onAdsReady(),this.controller.getSettings().adsManagerLoadedCallback&&this.controller.getSettings().adsManagerLoadedCallback()},o.prototype.onAdsLoaderError=function(t){window.console.warn("AdsLoader error: "+t.getError()),this.controller.onErrorLoadingAds(t),this.adsManager&&this.adsManager.destroy()},o.prototype.initAdsManager=function(){try{var t=this.controller.getPlayerWidth(),e=this.controller.getPlayerHeight();this.adsManagerDimensions.width=t,this.adsManagerDimensions.height=e,this.adsManager.init(t,e,google.ima.ViewMode.NORMAL),this.adsManager.setVolume(this.controller.getPlayerVolume()),this.initializeAdDisplayContainer()}catch(t){this.onAdError(t)}},o.prototype.createAdsRenderingSettings=function(){if(this.adsRenderingSettings=new google.ima.AdsRenderingSettings,this.adsRenderingSettings.restoreCustomPlaybackStateOnAdBreakComplete=!0,this.controller.getSettings().adsRenderingSettings)for(var t in this.controller.getSettings().adsRenderingSettings)""!==t&&(this.adsRenderingSettings[t]=this.controller.getSettings().adsRenderingSettings[t])},o.prototype.onAdError=function(t){var e=void 0!==t.getError?t.getError():t.stack;window.console.warn("Ad error: "+e),this.adsManager.destroy(),this.controller.onAdError(t),this.adsActive=!1,this.adPlaying=!1},o.prototype.onAdBreakReady=function(t){this.adBreakReadyListener(t)},o.prototype.onContentPauseRequested=function(t){this.adsActive=!0,this.adPlaying=!0,this.controller.onAdBreakStart(t)},o.prototype.onContentResumeRequested=function(t){this.adsActive=!1,this.adPlaying=!1,this.controller.onAdBreakEnd()},o.prototype.onAllAdsCompleted=function(t){this.allAdsCompleted=!0,this.controller.onAllAdsCompleted()},o.prototype.onAdLoaded=function(t){t.getAd().isLinear()||(this.controller.onNonLinearAdLoad(),this.controller.playContent())},o.prototype.onAdStarted=function(t){this.currentAd=t.getAd(),this.currentAd.isLinear()?(this.adTrackingTimer=setInterval(this.onAdPlayheadTrackerInterval.bind(this),250),this.controller.onLinearAdStart()):this.controller.onNonLinearAdStart()},o.prototype.onAdPaused=function(){this.controller.onAdsPaused()},o.prototype.onAdResumed=function(t){this.controller.onAdsResumed()},o.prototype.onAdComplete=function(){this.currentAd.isLinear()&&clearInterval(this.adTrackingTimer)},o.prototype.onAdLog=function(t){this.controller.onAdLog(t)},o.prototype.onAdPlayheadTrackerInterval=function(){var t=this.adsManager.getRemainingTime(),e=this.currentAd.getDuration(),i=e-t;i=i>0?i:0;var n=0,s=void 0;this.currentAd.getAdPodInfo()&&(s=this.currentAd.getAdPodInfo().getAdPosition(),n=this.currentAd.getAdPodInfo().getTotalAds()),this.controller.onAdPlayheadUpdated(i,t,e,s,n)},o.prototype.onContentComplete=function(){this.adsLoader&&(this.adsLoader.contentComplete(),this.contentCompleteCalled=!0),this.adsManager&&this.adsManager.getCuePoints()&&!this.adsManager.getCuePoints().includes(-1)&&this.controller.onNoPostroll(),this.allAdsCompleted&&this.controller.onContentAndAdsCompleted()},o.prototype.onPlayerDisposed=function(){this.adTrackingTimer&&clearInterval(this.adTrackingTimer),this.adsManager&&(this.adsManager.destroy(),this.adsManager=null)},o.prototype.onPlayerReadyForPreroll=function(){if(this.autoPlayAdBreaks){this.initAdsManager();try{this.controller.showAdContainer(),this.adsManager.setVolume(this.controller.getPlayerVolume()),this.adsManager.start()}catch(t){this.onAdError(t)}}},o.prototype.onPlayerReady=function(){this.initAdObjects(),(this.controller.getSettings().adTagUrl||this.controller.getSettings().adsResponse)&&"onLoad"===this.controller.getSettings().requestMode&&this.requestAds()},o.prototype.onPlayerEnterFullscreen=function(){this.adsManager&&this.adsManager.resize(window.screen.width,window.screen.height,google.ima.ViewMode.FULLSCREEN)},o.prototype.onPlayerExitFullscreen=function(){this.adsManager&&this.adsManager.resize(this.controller.getPlayerWidth(),this.controller.getPlayerHeight(),google.ima.ViewMode.NORMAL)},o.prototype.onPlayerVolumeChanged=function(t){this.adsManager&&this.adsManager.setVolume(t),this.adMuted=0==t},o.prototype.onPlayerResize=function(t,e){this.adsManager&&(this.adsManagerDimensions.width=t,this.adsManagerDimensions.height=e,this.adsManager.resize(t,e,google.ima.ViewMode.NORMAL))},o.prototype.getCurrentAd=function(){return this.currentAd},o.prototype.setAdBreakReadyListener=function(t){this.adBreakReadyListener=t},o.prototype.isAdPlaying=function(){return this.adPlaying},o.prototype.isAdMuted=function(){return this.adMuted},o.prototype.pauseAds=function(){this.adsManager.pause(),this.adPlaying=!1},o.prototype.resumeAds=function(){this.adsManager.resume(),this.adPlaying=!0},o.prototype.unmute=function(){this.adsManager.setVolume(1),this.adMuted=!1},o.prototype.mute=function(){this.adsManager.setVolume(0),this.adMuted=!0},o.prototype.setVolume=function(t){this.adsManager.setVolume(t),this.adMuted=0==t},o.prototype.initializeAdDisplayContainer=function(){this.adDisplayContainer&&(this.adDisplayContainerInitialized||(this.adDisplayContainer.initialize(),this.adDisplayContainerInitialized=!0))},o.prototype.playAdBreak=function(){this.autoPlayAdBreaks||(this.controller.showAdContainer(),this.adsManager.setVolume(this.controller.getPlayerVolume()),this.adsManager.start())},o.prototype.addEventListener=function(t,e){this.adsManager&&this.adsManager.addEventListener(t,e)},o.prototype.getAdsManager=function(){return this.adsManager},o.prototype.reset=function(){this.adsActive=!1,this.adPlaying=!1,this.adTrackingTimer&&clearInterval(this.adTrackingTimer),this.adsManager&&(this.adsManager.destroy(),this.adsManager=null),this.adsLoader&&!this.contentCompleteCalled&&this.adsLoader.contentComplete(),this.contentCompleteCalled=!1,this.allAdsCompleted=!1};var r=function(t,n){this.settings={},this.contentAndAdsEndedListeners=[],this.isMobile=navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPad/i)||navigator.userAgent.match(/Android/i),this.isIos=navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPad/i),this.initWithSettings(n);var s={debug:this.settings.debug,timeout:this.settings.timeout,prerollTimeout:this.settings.prerollTimeout},r=this.extend({},s,n.contribAdsSettings||{});this.playerWrapper=new e(t,r,this),this.adUi=new i(this),this.sdkImpl=new o(this)};r.IMA_DEFAULTS={debug:!1,timeout:5e3,prerollTimeout:1e3,adLabel:"Advertisement",adLabelNofN:"of",showControlsForJSAds:!0,requestMode:"onLoad"},r.prototype.initWithSettings=function(t){this.settings=this.extend({},r.IMA_DEFAULTS,t||{}),this.warnAboutDeprecatedSettings(),this.showCountdown=!0,!1===this.settings.showCountdown&&(this.showCountdown=!1)},r.prototype.warnAboutDeprecatedSettings=function(){var t=this;["adWillAutoplay","adsWillAutoplay","adWillPlayMuted","adsWillPlayMuted"].forEach(function(e){void 0!==t.settings[e]&&console.warn("WARNING: videojs.ima setting "+e+" is deprecated")})},r.prototype.getSettings=function(){return this.settings},r.prototype.getIsMobile=function(){return this.isMobile},r.prototype.getIsIos=function(){return this.isIos},r.prototype.injectAdContainerDiv=function(t){this.playerWrapper.injectAdContainerDiv(t)},r.prototype.getAdContainerDiv=function(){return this.adUi.getAdContainerDiv()},r.prototype.getContentPlayer=function(){return this.playerWrapper.getContentPlayer()},r.prototype.getContentPlayheadTracker=function(){return this.playerWrapper.getContentPlayheadTracker()},r.prototype.requestAds=function(){this.sdkImpl.requestAds()},r.prototype.setSetting=function(t,e){this.settings[t]=e},r.prototype.onErrorLoadingAds=function(t){this.adUi.onAdError(),this.playerWrapper.onAdError(t)},r.prototype.onAdPlayPauseClick=function(){this.sdkImpl.isAdPlaying()?(this.adUi.onAdsPaused(),this.sdkImpl.pauseAds()):(this.adUi.onAdsPlaying(),this.sdkImpl.resumeAds())},r.prototype.onAdMuteClick=function(){this.sdkImpl.isAdMuted()?(this.playerWrapper.unmute(),this.adUi.unmute(),this.sdkImpl.unmute()):(this.playerWrapper.mute(),this.adUi.mute(),this.sdkImpl.mute())},r.prototype.setVolume=function(t){this.playerWrapper.setVolume(t),this.sdkImpl.setVolume(t)},r.prototype.getPlayerVolume=function(){return this.playerWrapper.getVolume()},r.prototype.toggleFullscreen=function(){this.playerWrapper.toggleFullscreen()},r.prototype.onAdError=function(t){this.adUi.onAdError(),this.playerWrapper.onAdError(t)},r.prototype.onAdBreakStart=function(t){this.playerWrapper.onAdBreakStart(),this.adUi.onAdBreakStart(t)},r.prototype.showAdContainer=function(){this.adUi.showAdContainer()},r.prototype.onAdBreakEnd=function(){this.playerWrapper.onAdBreakEnd(),this.adUi.onAdBreakEnd()},r.prototype.onAllAdsCompleted=function(){this.adUi.onAllAdsCompleted(),this.playerWrapper.onAllAdsCompleted()},r.prototype.onAdsPaused=function(){this.adUi.onAdsPaused()},r.prototype.onAdsResumed=function(){this.adUi.onAdsResumed()},r.prototype.onAdPlayheadUpdated=function(t,e,i,n,s){this.adUi.updateAdUi(t,e,i,n,s)},r.prototype.onAdLog=function(t){this.playerWrapper.onAdLog(t)},r.prototype.getCurrentAd=function(){return this.sdkImpl.getCurrentAd()},r.prototype.playContent=function(){this.playerWrapper.play()},r.prototype.onLinearAdStart=function(){this.adUi.onLinearAdStart(),this.playerWrapper.onAdStart()},r.prototype.onNonLinearAdLoad=function(){this.adUi.onNonLinearAdLoad()},r.prototype.onNonLinearAdStart=function(){this.adUi.onNonLinearAdLoad(),this.playerWrapper.onAdStart()},r.prototype.getPlayerWidth=function(){return this.playerWrapper.getPlayerWidth()},r.prototype.getPlayerHeight=function(){return this.playerWrapper.getPlayerHeight()},r.prototype.onAdsReady=function(){this.playerWrapper.onAdsReady()},r.prototype.onPlayerResize=function(t,e){this.sdkImpl.onPlayerResize(t,e)},r.prototype.onContentComplete=function(){this.sdkImpl.onContentComplete()},r.prototype.onNoPostroll=function(){this.playerWrapper.onNoPostroll()},r.prototype.onContentAndAdsCompleted=function(){for(var t in this.contentAndAdsEndedListeners)"function"==typeof this.contentAndAdsEndedListeners[t]&&this.contentAndAdsEndedListeners[t]()},r.prototype.onPlayerDisposed=function(){this.contentAndAdsEndedListeners=[],this.sdkImpl.onPlayerDisposed()},r.prototype.onPlayerReadyForPreroll=function(){this.sdkImpl.onPlayerReadyForPreroll()},r.prototype.onPlayerReady=function(){this.sdkImpl.onPlayerReady()},r.prototype.onPlayerEnterFullscreen=function(){this.adUi.onPlayerEnterFullscreen(),this.sdkImpl.onPlayerEnterFullscreen()},r.prototype.onPlayerExitFullscreen=function(){this.adUi.onPlayerExitFullscreen(),this.sdkImpl.onPlayerExitFullscreen()},r.prototype.onPlayerVolumeChanged=function(t){this.adUi.onPlayerVolumeChanged(t),this.sdkImpl.onPlayerVolumeChanged(t)},r.prototype.setContentWithAdTag=function(t,e){this.reset(),this.settings.adTagUrl=e||this.settings.adTagUrl,this.playerWrapper.changeSource(t)},r.prototype.setContentWithAdsResponse=function(t,e){this.reset(),this.settings.adsResponse=e||this.settings.adsResponse,this.playerWrapper.changeSource(t)},r.prototype.setContentWithAdsRequest=function(t,e){this.reset(),this.settings.adsRequest=e||this.settings.adsRequest,this.playerWrapper.changeSource(t)},r.prototype.reset=function(){this.sdkImpl.reset(),this.playerWrapper.reset(),this.adUi.reset()},r.prototype.addContentEndedListener=function(t){this.playerWrapper.addContentEndedListener(t)},r.prototype.addContentAndAdsEndedListener=function(t){this.contentAndAdsEndedListeners.push(t)},r.prototype.setAdBreakReadyListener=function(t){this.sdkImpl.setAdBreakReadyListener(t)},r.prototype.setShowCountdown=function(t){this.adUi.setShowCountdown(t),this.showCountdown=t,this.countdownDiv.style.display=this.showCountdown?"block":"none"},r.prototype.initializeAdDisplayContainer=function(){this.sdkImpl.initializeAdDisplayContainer()},r.prototype.playAdBreak=function(){this.sdkImpl.playAdBreak()},r.prototype.addEventListener=function(t,e){this.sdkImpl.addEventListener(t,e)},r.prototype.getAdsManager=function(){return this.sdkImpl.getAdsManager()},r.prototype.getPlayerId=function(){return this.playerWrapper.getPlayerId()},r.prototype.changeAdTag=function(t){this.reset(),this.settings.adTagUrl=t},r.prototype.pauseAd=function(){this.adUi.onAdsPaused(),this.sdkImpl.pauseAds()},r.prototype.resumeAd=function(){this.adUi.onAdsPlaying(),this.sdkImpl.resumeAds()},r.prototype.adsWillAutoplay=function(){return void 0!==this.settings.adsWillAutoplay?this.settings.adsWillAutoplay:void 0!==this.settings.adWillAutoplay?this.settings.adWillAutoplay:!!this.playerWrapper.getPlayerOptions().autoplay},r.prototype.adsWillPlayMuted=function(){return void 0!==this.settings.adsWillPlayMuted?this.settings.adsWillPlayMuted:void 0!==this.settings.adWillPlayMuted?this.settings.adWillPlayMuted:void 0!==this.playerWrapper.getPlayerOptions().muted?this.playerWrapper.getPlayerOptions().muted:0==this.playerWrapper.getVolume()},r.prototype.triggerPlayerEvent=function(t,e){this.playerWrapper.triggerPlayerEvent(t,e)},r.prototype.extend=function(t){for(var e=void 0,i=void 0,n=void 0,s=arguments.length,o=Array(s>1?s-1:0),r=1;r