The basic single VAST preroll ad setup is fairly simple.
Load player skin and scripts inside BODY element.<link href="/videojs/skins/skin-name/videojs.min.css" rel="stylesheet" type="text/css" /><script src="/videojs/video.min.js"></script><script src="/videojs/plugins/vast.vpaid.min.js"></script><script src="/videojs/nuevo.min.js"></script>Setup HTML5 video to play<video id="example_video_1" class="video-js" controls preload="auto" playsinline width="640" height="360" poster="//www.domain.com/path/to/poster.jpg"><source src="//www.domain.com/path/to/video.mp4" type="video/mp4" /&glt;<source src="//www.domain.com/path/to/video.webm" type="video/webm" /></video>Initialize player and plugins<script>var options = { option1: value, option2: value, option3: value }; Nuevo plugin optionsvar player=videojs("'example_video_1");player.nuevo( options );player.vastAds ({ tagURL: "your-vast-vpaid-ad-tag-here", id="unique ad ID" });</script>
player.vastAds ({ tagURL: "your-vast-vpaid-ad-tag-here", id="unique ad ID", withCredentials:true });
start, firstQuartile, midpoint, thridquartile, skip, complete, allAdsCompleted, click, pause, resumeBelow, you can see an example javascript function that allows you to track events.
<script>player.on('adEvent', function(event, data) {var ad_id = data.id;var event_type = data.type;});{</script>
player.vastAds ({ tagURL: "your-vast-vpaid-ad-tag-here", id: "uniqueId"}, {adRequestTimeout:5000,adCancelTimeout:10000}});