Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/mouseenter mouseleave handlers on i os upd 10 2019 #3

Open
wants to merge 30 commits into
base: master-hearst
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
278556b
feat: adds a request mode for ad requests
Jan 29, 2019
168c3c1
Readme Update: updates the Readme to highlight an example using es6 i…
Kiro705 Aug 19, 2019
18186f9
fix: fixed small errors in Readme update
Kiro705 Aug 19, 2019
8dd1922
updates for spelling
Kiro705 Aug 19, 2019
8be147e
grammer update
Kiro705 Aug 19, 2019
1f685b2
one comma
Kiro705 Aug 19, 2019
4f34a54
Merge pull request #815 from googleads/es6-readme-update
Kiro705 Aug 20, 2019
9968f03
Removes the click eventListener on the adContainer
arnaudcasame Aug 27, 2019
0f88d33
Generates the distribution files
arnaudcasame Aug 27, 2019
0b63fb1
Merge pull request #1 from googleads/master
arnaudcasame Aug 27, 2019
2b854a4
fix: changed to parseFloat
Kiro705 Sep 9, 2019
4b5eef9
fix: removed second param from parseFloat
Kiro705 Sep 9, 2019
3ceda1b
1.6.1
Kiro705 Sep 10, 2019
f8d9546
merge commits for v1.6.1
Kiro705 Sep 10, 2019
b32c1dc
Merge pull request #818 from arnaudcasame/master
gschoppe Sep 10, 2019
3d4e995
fix: fixed error in videojs.ima.min.js
Kiro705 Sep 11, 2019
a8026ec
Merge pull request #822 from googleads/minified-fix
Kiro705 Sep 11, 2019
b76516c
1.6.2
Kiro705 Sep 11, 2019
3768f01
Build for samples at v1.6.2
Kiro705 Sep 11, 2019
6790115
Updates readme for accurate locale codes
Kiro705 Sep 30, 2019
054a57b
update to v1.6.3
Kiro705 Sep 30, 2019
16d3c8b
Merge pull request #781 from Afrozaar/master
gschoppe Sep 30, 2019
b9c93f5
Merge pull request #827 from googleads/currentChange
Kiro705 Sep 30, 2019
6675841
Merge pull request #828 from googleads/locale-update
Kiro705 Sep 30, 2019
3e10247
updated dist files for 1.6.3
Kiro705 Sep 30, 2019
93d70d2
Merge pull request #829 from googleads/updated-files
Kiro705 Sep 30, 2019
43a87b9
1.6.3
Kiro705 Sep 30, 2019
5f643a3
CI and test-stage edits inside origin: .travis.yml & package.json
Viktor286hearts Jul 16, 2019
a3a263a
fix: edge case for iOS: no mouse enter/leave events on adContainerDiv
Viktor286hearts Jul 15, 2019
70ca5d8
dist manual update (temp)
Viktor286hearts Jul 16, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
node_modules/
dist/
20 changes: 10 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
<a name="1.6.3"></a>
## [1.6.3](https://github.com/googleads/videojs-ima/compare/v1.6.2...v1.6.3) (2019-09-30)

<a name="1.6.2"></a>
## [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))

<a name="1.6.0"></a>
# [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))
Expand Down
61 changes: 59 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,69 @@ 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 module),
a video player to be used for playback, and script tags for the IMA SDK and your own
javascript file.

```html
<html>
<head>
<!-- Load dependent stylesheets. -->
<link href="path/to/video-js.css" rel="stylesheet">
</head>

<body>
<video id='content-player' class="video-js">
<p class='vjs-no-js'>
To view this video, please enable JavaScript and consider upgrading to a web browser that
<a href='https://videojs.com/html5-video-support/' target='_blank'>supports HTML5 video</a>
</p>
</video>
<!-- Load dependent scripts -->
<script src="//imasdk.googleapis.com/js/sdkloader/ima3.js"></script>
<script src="player.js"></script>
</body>
</html>
```

Three imports are required to use the videojs-ima module, as seen in the player.js example 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 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).
Expand Down Expand Up @@ -98,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. |
Expand All @@ -115,7 +172,7 @@ the previous snippet. A summary of all settings follows:
<br />
(3) [contrib-ads plugin](//github.com/videojs/videojs-contrib-ads)
<br />
(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)
<br />
(5) [google.ima.ImaSdkSettings.VpaidMode](//developers.google.com/interactive-media-ads/docs/sdks/html5/v3/apis#ima.ImaSdkSettings.VpaidMode)

Expand Down
28 changes: 17 additions & 11 deletions dist/videojs.ima.es.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};

Expand Down Expand Up @@ -364,11 +368,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();
};

/**
Expand All @@ -379,11 +383,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();
};

/**
Expand Down Expand Up @@ -697,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) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the reason for this check?

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);
};
Expand Down Expand Up @@ -1102,13 +1108,13 @@ AdUi.prototype.setShowCountdown = function (showCountdownIn) {
};

var name = "videojs-ima";
var version = "1.6.0";
var version = "1.6.3";
var license = "Apache-2.0";
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 [email protected] --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 [email protected] --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" };
Expand Down Expand Up @@ -1360,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));
Expand Down Expand Up @@ -1611,7 +1616,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();
}
};
Expand Down Expand Up @@ -1896,7 +1901,8 @@ Controller.IMA_DEFAULTS = {
prerollTimeout: 1000,
adLabel: 'Advertisement',
adLabelNofN: 'of',
showControlsForJSAds: true
showControlsForJSAds: true,
requestMode: 'onLoad'
};

/**
Expand Down
28 changes: 17 additions & 11 deletions dist/videojs.ima.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};

Expand Down Expand Up @@ -370,11 +374,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();
};

/**
Expand All @@ -385,11 +389,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();
};

/**
Expand Down Expand Up @@ -703,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);
};
Expand Down Expand Up @@ -1108,13 +1114,13 @@ AdUi.prototype.setShowCountdown = function (showCountdownIn) {
};

var name = "videojs-ima";
var version = "1.6.0";
var version = "1.6.3";
var license = "Apache-2.0";
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 [email protected] --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 [email protected] --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" };
Expand Down Expand Up @@ -1366,7 +1372,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));
Expand Down Expand Up @@ -1617,7 +1622,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();
}
};
Expand Down Expand Up @@ -1902,7 +1907,8 @@ Controller.IMA_DEFAULTS = {
prerollTimeout: 1000,
adLabel: 'Advertisement',
adLabelNofN: 'of',
showControlsForJSAds: true
showControlsForJSAds: true,
requestMode: 'onLoad'
};

/**
Expand Down
2 changes: 1 addition & 1 deletion dist/videojs.ima.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "videojs-ima",
"version": "1.6.0",
"version": "1.6.3",
"license": "Apache-2.0",
"main": "./dist/videojs.ima.js",
"module": "./dist/videojs.ima.es.js",
Expand Down Expand Up @@ -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",
Expand Down
Loading