开发者

Downloading from audio html5 tags

开发者 https://www.devze.com 2023-03-12 04:07 出处:网络
In HTML5, is there a way to download the current song in an audio tag? I am feed开发者_JAVA技巧ing it an octet stream that it is playing, but the user cannot directly download the song from the link.

In HTML5, is there a way to download the current song in an audio tag? I am feed开发者_JAVA技巧ing it an octet stream that it is playing, but the user cannot directly download the song from the link. Is there a way to allow the user to download the song that is playing? Audio shows up as transparent so there is no way for the user to do a simple right click + save as. Can you encapsulate audio in something that has a save as ability? Or maybe some JavaScript might do the trick?


You can use a link if it's not a live streaming audio. If it's live streaming, I don't think you can download it with a browser because it doesn't have a finite file size.

If it's a problem about download file naming, you can use content-disposition header. It should be like this:

content-disposition: attachment; filename=playing.mp3

Adding this to the header shouldn't affect the streaming to the audio tag.


If the audio is served it means that the audio file is present.

You can even make a link to the audio file and it should work.

0

精彩评论

暂无评论...
验证码 换一张
取 消