download HTML5 mp4 video using Javascript

HTML5 browsers now allow you to add the download attribute to <a> tags to achieve this in your DOM. You cannot do this in pure javascript.

Source: https://stackoverflow.com/a/6794432/5203655

If however, you have access to the server response, then in PHP you could do something like

<?php
header('Content-type: application/octet-stream');
readfile('myvideo.mp4');

You can use this:

$('submit').click(function() {
  $('<a/>',{
     "href":"The/video/src/path",
    "download":"video.mp4",
    id:"videoDownloadLink"
  }).appendTo(document.body);
  $('#videoDownloadLink').get(0).click().remove();

});