开发者

Downloading from audio html5 tags

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜