videojs / videojs-contrib-ads

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

Fix: content can play too early after contentupdate #318

Closed alex-barstow closed 6 years ago

alex-barstow commented 6 years ago

Description

This addresses a couple of issues surrounding contentupdates:

  1. Content can start playing immediately after a source change because we don't proactively pause the player if it is playing following a contentupdate
  2. There is no contentupdate event handler in the 'preroll?' state, so if one occurs we remain in ‘preroll?’ through the source change. And because the ad timeout isn’t cleared, the eventual adtimeout event causes a transition directly into ‘content-playback’, bypassing 'content-set' / 'ads-ready?' / 'ads-ready'

EDIT: We are going to wait to address no.2 in the upcoming refactor

Specific Additions

  1. If we are in 'content-playback' and a contentupdate occurs, pause the player if it is not already paused.
  2. Add a contentupdate() handler in 'preroll?' that changes state to 'content-set'

As mentioned above: we'll hold off on no.2 until the refactor

alex-barstow commented 6 years ago

This fix has been moved into the refactor. Closing.