Video.js Preroll Video

DOCUMENTATION

Preroll video for Video.js player Preroll video is one of built-in features offered by Nuevo plugin. It's great looking and is easy to setup. Preroll sub plugin requires videojs.ads javascript file from videojs-contrib-ads 3rd party plugin to be loaded after video.js core player included. You can either use file delivered by Nuevolab or get it from Video.js plugins GITHUB website. Check example code below.

Setup HTML5 video tag and initialize Nuevo plugin with preroll plugin.


<script>
var player = videojs('example_video_1',{},function(){ 
	this.nuevoPlugin({
		logo: '//domain.com/path/to/logo.png',
		logourl: '//domain.com',
		logoposition: 'RT'
	});
	this.preroll({
		id: unique_id,  //optional
		src:{src:baseurl+"/domain.com/path/to/preroll_video.mp4",type:"video/mp4"},
		skipTime:5,  //optional
		href: '//domain.com/target.html'
	});
});
</script>

If you do not want to use skip option, simply do not include it in setup code.
id optional patameter is some unique value that you can assign to track preroll adclick event (check javascript example code).

<script>
player.on('adclick', function (event, param) {
    var ad_id = param.id;
});
</script>