1
I need to have a video download button, I have no idea how I can do this.
<video id="videoDownloadLink" style="max-height:320px;" width="100%" controls>
<source src="<?=$video?>" type="video/mp4">
</video>
<button onclick="myFunction()" id="submit"> Downdload </button>
And to download I’m trying with download js but it’s not working, someone knows a better way to download the video
function myFunction() {
var x=new XMLHttpRequest();
x.open("GET", "<?=$video?>", true);
x.responseType = 'blob';
x.onload=function(e){download(x.response, "dlBinAjax.mp4, video/mp4" ); }
x.send();
}
It is possible to have the programming of this button, in another button created by me?
yeah, but there’s a problem, I don’t have the video on the server, I’m working with api
– Ricardo
you can always put the video online and private and use URL instead of file!
– Marcelo Domingues
I didn’t get it, I api is just passing the video link, if I <a class="site-btn Sb-light" href="<?= $video? >" target="_Blank" download>Download</a> opens only the video
– Ricardo
https://stackoverflow.com/questions/20222769/download-own-videos-in-the-youtube-api
– Marcelo Domingues
Ricardo, did you try to do as Marcelo said? Try to create a link and add the attribute
download
and tell us if it worked. Ex.:<a href="<?= $video ?>" download>Download</a>
– fernandosavio
Marcelo, it would be nice if you edit your reply and add more information about your solution and explain more about it... and don’t forget to always link to documentation of the concepts you are using, so your answer gets better. ;)
– fernandosavio
done. Thank you
– Marcelo Domingues
Fernando, create a link like, I didn’t notice " <a class="site-btn Sb-light" href="<?= $video? >" target="_Blank" download>Download</a> " I have this, video variable is passing the URL of the video, when I click on the button to download just open the video in new window
– Ricardo
video link passed by API -> https://d28je5hezfy7mw.cloudfront.net/dev/videos/pitches/full/be6f1f4d-5d94-49cb-a94f-2c09fcf66cc6?Expires=1573657949&Signature=4JleFSiprtp0DEcWP2b25Aas9Ac6CQgWRvaNDuT5yerg4ft-aK2CpaPuOGOSJ01h0fSKrOn3LVVGnpkscwiHwlxBabGK5pWp5as~L3Ykr6aOmz5kSmlDSggsgyKa2wdDybaZcDqGxsHDlb~FHDKX6TwfY8gt5RViTR0sD0~fsoQkP-tjWWRFyy1Hy1l9HbidrKKQRl4Nrme3BeLSzOD39LzAH9k1Z09ycNshnADqPnQGpMt44r8qDsAxjC7qSrHUodCADffGLdgRzoRkFo4F8rS~tpsSUazWznF4SfDcyvU-Seq7pm-dhWAUvzvt2C46O0NXoyWorOVbBYLzxIaAg__&Key-Pair-Id=APKAJNVL777XIHTPI2BA
– Ricardo