I'm totally new to this. I have managed to make video.js work on my site but I need to create playlists with videos to choose from. Is there an easy way to do this?
Thanks
<link href="videojs-playlist-ui.vertical.css" rel="stylesheet">
<script src="videojs.min.js"></script>
<script src="videojs-playlist.js"></script>
<script src="videojs-playlist-ui.min.js"></script>
//The HTML Code
<video autoplay id="player" class="video-js vjs-fluid" controls>
<source src="somevideo.mp4" type="video/mp4">
</video>
<div class="playlist-container preview-player-dimensions vjs-fluid">
<ol class="vjs-playlist"></ol>
</div>
// Your script
<script>
var player = videojs('player');
player.playlistUi();
player.playlist([{
sources: [{
src: 'http://media.w3.org/2010/05/sintel/trailer.mp4',
type: 'video/mp4'
}],
poster: 'http://media.w3.org/2010/05/sintel/poster.png'
}, {
sources: [{
src: 'http://media.w3.org/2010/05/bunny/trailer.mp4',
type: 'video/mp4'
}],
poster: 'http://media.w3.org/2010/05/bunny/poster.png'
}, {
sources: [{
src: 'http://vjs.zencdn.net/v/oceans.mp4',
type: 'video/mp4'
}],
poster: 'http://www.videojs.com/img/poster.jpg'
}, {
sources: [{
src: 'http://media.w3.org/2010/05/bunny/movie.mp4',
type: 'video/mp4'
}],
poster: 'http://media.w3.org/2010/05/bunny/poster.png'
}, {
sources: [{
src: 'http://media.w3.org/2010/05/video/movie_300.mp4',
type: 'video/mp4'
}],
poster: 'http://media.w3.org/2010/05/video/poster.png'
}]);
// Play through the playlist automatically.
player.playlist.autoadvance(0);
</script>
// Reference https://www.npmjs.com/package/videojs-playlist