+ 1
How to insert audio in html
2 Réponses
+ 1
<audio controls>
<source src="audio.mp3" type="audio/mpeg">
<source src="audio.ogg" type="audio/ogg">
</audio>
+ 2
Use the <source> element inside the <audio> element:
<audio controls>
<source src="audio.mp3" type="audio/mpeg">
<source src="audio.ogg" type="audio/ogg">
Audio element not supported by your browser
</audio>
You must place the file with mp3, ogg or wav extension in the folder where your .html file is so that it works normally. I recommend this way and I suggest you save the audio file in at least two different formats mp3 and ogg.
If the mp3 format file cannot be played in the browser then it will select the second option in this case ogg format if it also fails then the alternative text will be displayed (Audio element not supported by your browser).
Regards