Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including videojs-contrib-ads with all npm packages installed. Try it out:

var videojsContribAds = require("videojs-contrib-ads")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

videojs-contrib-ads v6.6.5

A framework that provides common functionality needed by video advertisement libraries working with video.js.

Contrib Ads: A Tool for Building Video.js Ad Plugins

Build Status Greenkeeper badge

videojs-contrib-ads provides common functionality needed by video advertisement libraries working with video.js. It takes care of a number of concerns for you, reducing the code you have to write for your ad plugin.

videojs-contrib-ads is not a stand-alone ad plugin. It is a library that is used by other ad plugins in order to fully support video.js. If you want to build an ad plugin, you've come to the right place. If you want to play ads in video.js without writing code, this is not the right project for you.

Maintenance Status: Stable


  • Ad timeouts are implemented by default. If ads take too long to load, content automatically plays.
  • Player state is automatically restored after ad playback, even if the ad played back in the content's video element.
  • Content is automatically paused and a loading spinner is shown while preroll ads load.
  • Media events will fire as though ads don't exist. For more information, read the documentation on Redispatch.
  • Useful macros in ad server URLs are provided.
  • Preroll checks automatically happen again when the video source changes.


Documentation Index

Release History

A short list of features, fixes and changes for each release is available in




RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free