videojs / videojs-contrib-ads

A Tool for Building Video.js Ad Plugins
http://videojs.github.io/videojs-contrib-ads/
Other
379 stars 257 forks source link

fix: Ad plugin stuck in Preroll when adserror due empty VAST #525

Closed marcodeltorob closed 3 years ago

marcodeltorob commented 3 years ago

Problem Description

When the Ads plugin throws an adserror (Preroll) due AdError 1009: The VAST response document is empty is getting stuck in the Preroll state and not switching to ContentPlayback because of this behavior the Ads plugin is dispatching timeupdate as contenttimeupdate. So, in and adserror we want to transition to ContentPlayback with a contentresumed if the player is actually playing content.

marguinbc commented 3 years ago

I don not believe this error should cause the the ad to fail. It is common for VMAP wrapper ads to return 1009, empty vast when one or more wrappers returns without a matching ad. This triggers the VMAP to look at the next wrapper, and so on. Killing the ad when the first 1009 occurs would be problematic as the ad would stop and not proceed to the next wrapper candidate.

marguinbc commented 3 years ago

I'm suspecting an issue in the IMA SDK or Chrome as there are 3-4 threads about weird behavior with 1009 on the IMA SDK Google Group, like this one for example: https://groups.google.com/g/ima-sdk/c/nqWj9IZBJzk/m/76cy8255AAAJ

misteroneill commented 3 years ago

Discussed offline. Since this looks like it's related to the IMA SDK, we probably don't want to work around it in the contrib-ads plugin (it should be agnostic as pertains to the ad provider).

But these changes can inform what we might do in our internal IMA-specific implementation!

misteroneill commented 3 years ago

After doing some investigation on this myself, it looks like what happens sometimes is that the playing event occurs while the player is still in ad mode. When we go to resume from the Preroll state, the code that triggers playback doesn't do anything because the player is already playing.

I think we should detect this condition and, instead, trigger the playing event so that it doesn't get swallowed and content mode resumes properly.