最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - HTML5 audio tag in which Download possible? - Stack Overflow

programmeradmin0浏览0评论

I used audio tag of HTML5 and put 1 button for download that can any functionality provide by audio tag that we directly download as mp3 file.

<audio id="range" src="audio/1.mp3" type="audio/mp3" controls="controls">
  <a href='audio/1.mp3'>DownloadButton</a> 
</audio>
//used .play() , .volume() , .pause()  working proper

Above functionality i tried but not working which i want. I want just click on button and direct downloaded that audio file. Please tell me if any one know proper way than guide me.!

The Chrome browser is used.

I used audio tag of HTML5 and put 1 button for download that can any functionality provide by audio tag that we directly download as mp3 file.

<audio id="range" src="audio/1.mp3" type="audio/mp3" controls="controls">
  <a href='audio/1.mp3'>DownloadButton</a> 
</audio>
//used .play() , .volume() , .pause()  working proper

Above functionality i tried but not working which i want. I want just click on button and direct downloaded that audio file. Please tell me if any one know proper way than guide me.!

The Chrome browser is used.

Share Improve this question edited Feb 27, 2015 at 8:37 Johan Karlsson 1,1371 gold badge14 silver badges39 bronze badges asked Feb 27, 2015 at 7:29 Gunjan PatelGunjan Patel 2,3724 gold badges26 silver badges51 bronze badges 2
  • Please elaborate on what you have tried. What browser is also interesting. Different browser might behave different. – Johan Karlsson Commented Feb 27, 2015 at 7:41
  • @JohanKarlsson chrome browser – Gunjan Patel Commented Feb 27, 2015 at 7:55
Add a ment  | 

1 Answer 1

Reset to default 4

If you're just going to download the file, you don't need <audio> tags, which are for playing the file, not downloading, you can of course use both, but the anchor has nothing to do with the audio tag

<audio id="range" src="audio/1.mp3" type="audio/mp3" controls="controls"></audio>

<a href="audio/1.mp3" download="filename.mp3">DownloadButton</a> 
发布评论

评论列表(0)

  1. 暂无评论