Postroll video starts playing when the main video finished. It's obvious that it will not play for live streams, since livestream duration time is infinite. The only option you must set is time "offset", same like for preroll or midroll video. In case of the post-roll video this must be "100%" value.
See code example setup below:
<script>
var player=videojs('player_id');
player.nuevo({
// option1: value1,
// option2: value2
})
player.vroll({
src: '//path-to-postroll-video-file.mp4',
type: 'video/mp4',
href:'url-to-go-on-postroll-click',
offset: '100%', //starts when main video ended
id:'6' //optional id to track midroll playback and click
})
</script>
<script> player.vroll([ { src: '//path-to-preroll-video.mp4', type: 'video/mp4', href:'url-to-go-on-preroll-click', offset: '0', preroll video starts at 0 skip: '5', //optional number of seconds to allow skip preroll id:'11' }, { src: '//path-to-midroll-video.mp4', type: 'video/mp4', href:'url-to-go-on-second-midroll-click', offset: '20', //starts at 00:20 skip: '3', //optional number of seconds to allow skip midroll id:'12' },{ src: '//path-to-postroll-video.mp4', type: 'video/mp4', href:'url-to-go-on-postroll-click', offset: '100%', //starts when main video ended id:'13' } ]); </script>
<script> player.on('vroll', function(event, data) { var ad_id = data.id; var action = data.action; }); </script>