+ 4

How to embed audio in HTML?

Can anyone please tell me how to add audio in HTML? I’m a beginner and just exploring new things.

17th Apr 2025, 9:19 AM
Someone
Someone - avatar
5 odpowiedzi
+ 2
The <audio> tag in HTML5 is used to embed audio content on a web page. Here's how to use it: <audio controls> <source src="audio-file.mp3" type="audio/mpeg"> <source src="audio-file.ogg" type="audio/ogg"> Your browser does not support the audio element. </audio> Key points: The controls attribute adds the default audio controls (play, pause, volume). Inside the <audio> tag, you can include multiple <source> elements with different audio formats to ensure better browser compatibility. Attributes: autoplay — starts playing the audio automatically when the page loads. loop — makes the audio play repeatedly. muted — starts the audio muted. preload — hints to the browser how to preload the audio (auto, metadata, none). You can also control the audio via JavaScript, for example, to play, pause, or change the volume programmatically.
17th Apr 2025, 10:56 PM
TwisterFaith
TwisterFaith - avatar
+ 1
Good sharing friends. Can you also let me know from where I'll get the source url?
21st Apr 2025, 11:15 AM
Brainstorm
Brainstorm - avatar
+ 1
Thank you friends for helping me out.😊
21st Apr 2025, 12:30 PM
Someone
Someone - avatar