googleads / videojs-ima

IMA SDK Plugin for Video.js
Apache License 2.0
450 stars 284 forks source link

Tries to load nonexistent postroll ad if preroll ad errors out #807

Closed christianbkoehler closed 4 years ago

christianbkoehler commented 5 years ago

If the ad tag url only has a preroll ad defined and the preroll ad encounters an error, the plugin will try and load a postroll ad that doesn't exist. This causes the videojs loading spinner to unexpectedly appear at the end of the video.

If the preroll ad encountered an error this is logged:

VIDEOJS: ADS: Received readyforpostroll event
VIDEOJS: ADS: ContentPlayback -> Postroll
VIDEOJS: ADS: Postroll abort (adtimeout)
VIDEOJS: ADS: Postroll -> AdsDone

If the preroll ad played with no errors this is logged:

VIDEOJS: ADS: Received nopostroll event
VIDEOJS: ADS: Received readyforpostroll event
VIDEOJS: ADS: ContentPlayback -> Postroll
VIDEOJS: ADS: Postroll -> AdsDone

What I found is that SdkImpl.prototype.onContentComplete is never called if a preroll ad errors out and therefore never checks whether or not a postroll ad exists. I think this happens because on PlayerWrapper.prototype.onAdBreakStart this event listener is turned off

this.vjsPlayer.off('contentended', this.boundContentEndedListener);

and if the preroll ad encounters an error PlayerWrapper.prototype.onAdBreakEnd is never called and the event listener is not turned back on.

A workaround that I found is listening to ads-ima-adError and if there is an error I trigger the nopostroll event player.trigger('nopostroll')

arnaudcasame commented 5 years ago

Hi,

I was not able to reproduce the behavior that you're seeing with the videojs loading spinner. Is it specific to your implementation? Are you able to reproduce it using your ad tag against our Advanced sample?

christianbkoehler commented 5 years ago

I wasn't able to reproduce the spinning wheel showing up in the Advanced sample, but I was able to reproduce the same behavior where the contentended event handler wasn't being turned back on after an ad error. So using the debugger I was able to see that SdkImpl.prototype.onContentComplete was never called after a preroll ad error.

arnaudcasame commented 5 years ago

Hi,

As per the videojs-contrib-ads integrator reference, the contentended event is deprecated. Can you share the ad tag you were using when you encountered this issue?

arnaudcasame commented 4 years ago

Hi,

I’m closing this issue because it has been inactive for more than a month. Please reopen if you still encounter this issue with the latest stable version

Thank you!