1
votes

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.

1
Please elaborate on what you have tried. What browser is also interesting. Different browser might behave different.Johan Karlsson
@JohanKarlsson chrome browserGunjan Patel

1 Answers

4
votes

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>