My task was to merge two videos together and play them one after another automatically.
This is the source code of my project
html code –
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>video js</title>
<link rel="stylesheet" href="index.css">
</head>
<body>
<video id="videoPlayer" width="500" height="350" controls style="background:black">
<source class="current" src="MY_VIDEO.mp4" type="video/mp4" />
<source src="video2.mp4" type="video/mp4" />
</video>
<script src="script.js"></script>
</body>
</html>
script code –
var video = document.getElementById('videoPlayer');
video.addEventListener('ended', function(event) {
var currentVid = document.querySelector("#videoPlayer source.current");
var nextVid = document.querySelector("#videoPlayer source.current + source") || document.querySelector("#videoPlayer source:first-child");
currentVid.className = "";
nextVid.className = "current";
video.src = nextVid.src;
video.play();
});
My next task says https://videojs.com/ is the URL to access the source files for the library.
I am not getting what does this means?
Any idea?
Thanks in advance 🙂