videojs-contrib-ads

Integrator Docs | Developer Docs | Github

Autoplay

Using the autoplay attribute on the video element is not supported. Due to Autoplay Restrictions introduced by browsers, such as Safari and Chrome, using the autoplay attribute on the player will often not behave as expected. The recommended best practice is to use the player.play() method to autoplay.

Contrib Ads blocks play requests so that prerolls can be handled. To get access to the play promise, you must wait until the play event. For example:

player.on('play', () => {
  var playPromise = player.play();

  playPromise.then(() => {
    // play succeeded
  })
  .catch(() => {
    // play failed
  });
});