<div class="flex w-full h-auto my-auto">
<video class="video-js vjs-default-skin vjs-fluid " crossorigin="anonymous" controls="" id="multi-playlist"></video>
</div>
<script type="text/javascript">
var player = videojs("multi-playlist", {
"plugins": {
"qualitymenu": {},
"youtube": {}
}
});
const playlistPlugin = player.playlistPlugin(player, {});
const PlaylistPluginClass = videojs.getPlugin('playlistPlugin');
const videoList = [
{
"name": "Big Buck Bunny",
"sources": [
{
"src": "http://www.youtube.com/watch?v=Vpg9yizPP_g",
"type": "video/youtube"
}
]
},
{
"name": "Elephants Dream",
"sources": [
{
"src": "http://www.youtube.com/watch?v=MFg8mBaMoPs",
"type": "video/youtube"
}
]
}
];
const playlist = PlaylistPluginClass.createPlaylistFrom(videoList);
// Plugin methods
playlistPlugin.loadPlaylist(playlist);
player.playlistUi({playOnSelect: true});
playlistPlugin.loadFirstItem();
playlistPlugin.setAutoadvanceDelay(0);
</script>