<- Back
Video element in HTML
<video id="myVideo" controls>
<source src="video1.mp4" type="video/mp4">
<source src="video1.webm" type="video/webm">
</video>
Playlist
You can use below code to make playlist
var video = document.getElementById("myVideo");
var playlist = ["video1.mp4", "video2.mp4", "video3.mp4"];
var currentVideoIndex = 0;
video.addEventListener('ended', function() {
currentVideoIndex++;
if (currentVideoIndex == playlist.length) {
currentVideoIndex = 0;
}
video.src = playlist[currentVideoIndex];
video.play();
});
Web development and Automation testing
solutions delivered!!