Get started with videojs-vast-plugin CDN

MIT licensed

Video.js add-on: `videojs-vast-plugin` handles VAST ads in HTML5 video players.

Tags:
  • video
  • videojs
  • vast

Stable version

Copied!

How to start using videojs-vast-plugin CDN


<!DOCTYPE html>
<html>
<head>
  <title>Get started with videojs-vast-plugin CDN - cdnhub.io</title>
  <link href="https://cdn.jsdelivr.net/npm/video.js@7.12.5/dist/video-js.min.css" rel="stylesheet"/>
  <script src="https://cdn.jsdelivr.net/npm/video.js@7.12.5/dist/video.min.js"></script>
  <script src="https://cdn.cdnhub.io/videojs-vast-plugin/0.2.1/videojs.vast.min.js"></script>
</head>
<body>
  <div id="my-video" class="video-container">
    <video id="video" class="video-js" controls preload="auto" width="640" height="360" data-setup='{"techOrder": ["flash"]}'>
      <source src="example.mp4" type="video/mp4">
      <source src="example.webm" type="video/webm">
    </video>
  </div>
  <script>
    const player = videojs('video');
    player.vast(async function(ads) {
      try {
        await ads[0].load();
        await ads[0].play();
      } catch (error) {
        console.error('Error loading VAST ad:', error);
      }
    });
  </script>
</body>
</html>
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!

All versions