Html5 audio and html5 audio
Currently, the audio element supports three audio formats:
|
IE 9 + |
Firefox 3.5 |
Opera 10.5 |
Google Chrome 3.0 |
Safari 3.0 |
Ogg Vorbis |
|
√ |
√ |
√ |
|
MP3 |
√ |
|
|
√ |
√ |
Wav |
|
√ |
√ |
|
√ |
Eg.
<audio controls="controls"> <source src="song.ogg" type="audio/ogg"> <source src="song.mp3" type="audio/mpeg">Your browser does not support the audio tag.</audio>
<Audio> tag attributes
Attribute |
Value |
Description |
Autoplay |
Autoplay |
If this attribute appears, the audio will be played immediately after it is ready. |
Controls |
Controls |
If this attribute is displayed, the control, such as the play button, is displayed to the user. |
Loop |
Loop |
If this attribute is displayed, the video is played again whenever the audio ends. |
Preload |
Preload |
If this attribute is displayed, the audio is loaded when the page is loaded and ready for playing. If "autoplay" is used, this attribute is ignored. |
Src |
Url |
The URL of the audio to be played. |