how to add audio file in html | Sololearn: Learn to code for FREE!

+1

how to add audio file in html

12/5/2020 7:18:59 PM

Sagar Jamaria

2 Answers

New Answer

+14

Please use the search bar Sagar Jamaria https://www.sololearn.com/Discuss/1865452/?ref=apphttps://www.sololearn.com/Discuss/2430352/?ref=app https://www.sololearn.com/discuss/1730618/?ref=app https://www.sololearn.com/discuss/2208373/?ref=app https://www.sololearn.com/discuss/81627/?ref=app https://www.sololearn.com/discuss/1134762/?ref=app https://www.sololearn.com/discuss/2316175/?ref=app https://www.sololearn.com/discuss/1425849/?ref=app

+1

The audio element creates an audio player inside the browser The below audio tags play the same audio file but can be written in two ways <audio controls source src="http://www.sololearn.com/uploads/audio.mp3" type="audio/mpeg"> Audio File not supported by browser </audio> <audio controls> <source src="http://www.sololearn.com/uploads/audio.mp3" type="audio/mpeg"> Audio File not supported by browser <!--This text will be displayed if the user's browser does not support the file format--> </audio> You can use Audio Attributes: *Controls - Specifies that audio controls should be displayed (such as a play/pause button, etc). *Autoplay - When this attribute is defined, audio starts playing as soon as it is ready. Without asking for the visitor's permission. Which can be very unpleasant experience for users, so should be avoided when possible. *Loop - This attribute is used to have the audio replay every time it finishes. https://code.sololearn.com/WC0CGPvL3X2O/#html Hope it is helpful. Regards,