Reputation: 2372
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.
Upvotes: 3
Views: 15590
Reputation: 318182
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>
Upvotes: 4