title: How to play a second .mp4 video after one has ended?
body: <p>I am currently working on a project where it plays a .mp4 file, and after the .mp4 file has ended, it will select another .mp4 file to play.</p>
  
  <p>I'm trying to copy the mechanics of a television.
  It plays an episode of a show, then plays another episode.</p>
  
  <p>After the .mp4 file ends, I would like for it to autoplay another .mp4 file.</p>
  
  <p>This is the code I have so far:</p>
  
  <pre><code>&lt;!doctype html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;title&gt;HTML Television&lt;/title&gt;
      &lt;style&gt;
          * {
              margin: 0; /* fallback style */
              margin: initial;
          }
          html {
              background-color: black;
              color: white;
          }
          video {
              display: block;
              margin: 0 auto;
              max-height: 200vh;
              max-width: 400vw;
          }
  
      &lt;/style&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;section id="videos"&gt;
  
          &lt;video poster="video3.png" controls="controls" preload="none"&gt;
              &lt;source type="video/mp4" src="../TV/TV/1.mp4"&gt;
          &lt;/video&gt;
          &lt;video poster="" controls="controls" preload="none"&gt;
          &lt;source type="videp/mp4" src="../TV/Commercial/1.mp4"&gt;
      &lt;/section&gt;
      &lt;script&gt;
          (function () {
              "use strict";
              var videosSection = document.getElementById("videos");
              var videosSectionClone = videosSection.cloneNode();
              var videos = videosSection.getElementsByTagName("video");
              var randomVideo = videos.item(Math.floor(Math.random() * videos.length)).cloneNode(true);
              randomVideo.removeAttribute("controls");
              randomVideo.setAttribute("preload", "auto");
              videosSectionClone.appendChild(randomVideo);
              videosSection.parentNode.replaceChild(videosSectionClone, videosSection);
              randomVideo.play();
          })();
      &lt;/script&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p></p>
  
  <p>How can I do this?</p>