Closed konmavrakis closed 5 years ago
Hi,
Your implementation makes it look like you're trying to pause the video content instead of the ad (pre-roll). I modified your code and used the player.ima
instance so that the pre-roll can be paused at the specified cue point. I hope this solves your issue.
player.on("adsready", () => {
player.ima.addEventListener(google.ima.AdEvent.Type.STARTED, () => {
var adsManager = player.ima.getAdsManager();
interval = setInterval(() => {
if (adsManager.getRemainingTime() <= 2) { // here, I am using the IMA getRemainingTime method to get the ad's video remaining time
clearInterval(interval);
player.ima.pauseAd();
}
}, 500);
});
});
Hey @arnaudcasame your implementation worked great! Thanks a lot! :+1:
We are facing an issue where we want to pause the preroll ad when play time is equal or higher than the duration time minus 2 seconds. What we want to achieve is pause the ad at the last frame. If we pause the video at minus 4 seconds, or more, the ad will pause. I've also tried to utilize the "ended" event without any success.
This is a log with timestamps and the duration at (10 seconds) - 3.
Is any event listener or action prohibiting this to work? Any guidance will be useful. Also, i've tried with interval of 1ms but still nothing.