5

I have a link that I want to download the video from.

<video name="media">
 <source src="https://foo.bar" type="video/mp4">
</video>

I want to be able to download the vid to the user storage using javascript.

Pingo
  • 413
  • 2
  • 4
  • 8

2 Answers2

5

Just add an anchor tag with the same link and a download attribute:

<a href="https://foo.bar" download>
    Download Me!
</a>
ryanpcmcquen
  • 6,285
  • 3
  • 24
  • 37
5

Since you have the link, you can trigger it manually.

var a = $("<a>")
    .attr("href", "LINK HERE")
    .attr("download", "vid.mp4")
    .appendTo("body");

a[0].click();

a.remove();
Achraf
  • 1,412
  • 10
  • 14