Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- </head>
- <body>
- <label id="info"></label>
- <video id="reproductor" controls></video>
- <script>
- window.onload = function playlist(){
- var reproductor = document.getElementById("reproductor"),
- videos = ["video1", "video2"];
- info = document.getElementById("info");
- info.innerHTML = "Vídeo: " + videos[0];
- reproductor.src = videos[0] + ".mp4";
- reproductor.play();
- reproductor.addEventListener("ended", function() {
- var nombreActual = info.innerHTML.split(": ")[1];
- var actual = videos.indexOf(nombreActual);
- actual = actual == videos.length - 1 ? 0 : actual + 1;
- this.src = videos[actual] + ".mp4";
- info.innerHTML = "Vídeo: " + videos[actual];
- this.play();
- }, false);
- }
- </script>
- </body>
Add Comment
Please, Sign In to add comment