Integrator Docs | Developer Docs | Github

API Reference

This page contains reference documentation for the interaction points between videojs-contrib-ads and ad plugins that use it. All methods are called on; for example, All events are triggered or listened to on the player object; for example player.trigger('nopreroll') or player.on('readyforpreroll', () => {...}).

Informational methods and events

How contrib-ads talks to your ad plugin

Your ad plugin will listen to these events to trigger its behaviors. See Getting Started for more information.

How your ad plugin talks to contrib-ads

Your ad plugin can invoke these methods and events to play (or skip) ads. See Getting Started for more information.

Advanced Properties

Once the plugin is initialized, there are a couple properties you can access modify its behavior.


In order to detect changes to the content video, videojs-contrib-ads monitors the src attribute of the player. If you need to make a change to the src attribute during content playback that should not be interpreted as loading a new video, you can update this property with the new source you will be loading:

// you might want to switch from a low bitrate version of a video to a
// higher quality one at the user's request without forcing them to
// re-watch all the ad breaks they've already viewed

// first, you'd update contentSrc on the ads plugin to the URL of the
// higher bitrate rendition: = 'movie-high.mp4';

// then, modify the src attribute as usual


Advanced option. Prevents videojs-contrib-ads from restoring the previous video source.

If you need to change the video source during an ad break, you can use disableNextSnapshotRestore to prevent videojs-contrib-ads from restoring the snapshot from the previous video source.

if ( { = true;


The following are slated for removal from contrib-ads and will have no special behavior once removed. These should no longer be used in integrating ad plugins. Replacements are provided for matching functionality that will continue to be supported.