Using the <audio> Element
The <audio> element is an HTML 5 element, unknown to HTML 4, but it works in new browsers.Example
<audio controls="controls"><source src="song.mp3" type="audio/mpeg" />
<source src="song.ogg" type="audio/ogg" />
Your browser does not support this audio
</audio> The example above uses an Ogg file, to make it work in Firefox, Opera and Chrome. To make the audio work in Internet Explorer and Safari, a file of the type MP3 is added.
Currently, there are 3 main formats for the audio element:
Format | IE 9 | Firefox 3.5 | Opera 10.5 | Chrome 3.0 | Safari 3.0 |
---|---|---|---|---|---|
Ogg Vorbis | No | Yes | Yes | Yes | No |
MP3 | Yes | No | No | Yes | Yes |
Wav | No | Yes | Yes | Yes | Yes |
- You must convert your videos to many different formats.
- The <audio> element does not work in older browsers.
- The <audio> element does not validate in HTML 4 and XHTML.
Comments
Post a Comment