Skip to content

Commit

Permalink
Publishing latest changes
Browse files Browse the repository at this point in the history
  • Loading branch information
shawnbuso committed Mar 8, 2018
1 parent d7a7eb8 commit 9ce5e8c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions attempt_to_autoplay/ads.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,16 @@ function setUpIMA() {

// An event listener to tell the SDK that our content video
// is completed so the SDK can play any post-roll ads.
var contentEndedListener = function() {adsLoader.contentComplete();};
videoContent.onended = contentEndedListener;
}

function contentEndedListener() {
videoContent.onended = null;
if (adsLoader) {
adsLoader.contentComplete();
}
}

function autoplayChecksResolved() {
// Request video ads.
var adsRequest = new google.ima.AdsRequest();
Expand Down Expand Up @@ -214,9 +220,10 @@ function onAdError(adErrorEvent) {

function onContentPauseRequested() {
videoContent.pause();
videoContent.onended = null;
}

function onContentResumeRequested() {
videoContent.play();

videoContent.onended = contentEndedListener;
}

0 comments on commit 9ce5e8c

Please sign in to comment.