HTML5 Audio Tag
HTML5 is the evolution of web with audio support on different browsers.
<audio>tag is one of the success of HTML5 in the media field.<audio>tag is the standard form of playing sound on the web after using flash.<audio>tag embed an audio file on the web.<audio>tag view is different on different browsers.- You need to set the source of sound file as a attribute of <audio>tag.
Syntax :
<audio controls preload="none"> <source src="./../media/sound.mp3" type="audio/mpeg"> <source src="./../media/sound.ogg" type="audio/ogg"> <source src="./../media/sound.wav" type="audio/wav"> </audio>
Output :
Supported audio format in different Browsers
| Browser | .mp3 | .ogg | .wav |
|---|---|---|---|
| Google Chrome | |||
| Mozilla Firefox | |||
| Apple Safari | |||
| Opera | |||
| Internet Explorer |
Attribute used in <audio> tag
autoplay :autoplay used to play the audio files on the time of web page loading.autobuffer :autobuffer used to stream the audio on the time of loading.controls :controls used to give functionality of play back, play/pause and volume up/down.loop :loop used to repeat that audio file many times.preload :preload used to load the audio file same as autoplay.src :src used to give the source path of audio file.
View of <audio> tag in different Browsers
- In Google Chrome
- In Mozilla Firefox
- In Apple Safari
- In Opera
- In Internet Explorer







