Download from html5 audio tags

In HTML5, is there a way to load the current song into an audio tag? I feed him the octet stream that he plays, but the user cannot directly download the song from the link. Is there a way to allow the user to download a song that is playing? Audio is displayed as transparent, so the user will not be able to make a simple right-click + save as. Can you encapsulate sound in something that preserves as ability? Or maybe some kind of JavaScript can do the trick?

+3
source share
2 answers

You can use the link if it is not streaming audio. If it is broadcast live, I don’t think you can download it in a browser because it does not have a final file size.

If this is a problem with the name of the download file, you can use the header content-disposition. It should be like this:

content-disposition: attachment; filename=playing.mp3

Adding this to the header should not affect the streaming of the audio tag.

+1
source

If a sound is made, it means that a sound file is present.

You can even link to an audio file and it should work.

+1
source

All Articles