title: How to Download mp4 video in JS/React?
body: <p>This might have been asked early, but I am unable to figure it out, please help me and thanks in advance.</p>
  <p>Problem:</p>
  <blockquote>
  <p>I have a link to mp4 video (ex: <a href="https://www.learningcontainer.com/wp-content/uploads/2020/05/sample-mp4-file.mp4" rel="nofollow noreferrer">https://www.learningcontainer.com/wp-content/uploads/2020/05/sample-mp4-file.mp4</a>)</p>
  </blockquote>
  <p>I want to download this video from front end.</p>
  <p>I have tried the following method:</p>
  <pre><code> const videoHref ='https://www.learningcontainer.com/wp-content/uploads/2020/05/sample-mp4-file.mp4';
   const a = Object.assign(document.createElement('a'), {
   href: videoHref,
   style: 'display: none',
   download: 'video.mp4'
   });
   document.body.appendChild(a);
   a.click();
   a.remove();
  </code></pre>
  <p>But when I execute this code,</p>
  <p>the download will start and fails immediately with error</p>
  <blockquote>
  <p>Failed - No file</p>
  </blockquote>
  <p>Please help me resolve this.</p>