HTML and CSS Reference
In-Depth Information
<audio src="audio.ogg" controls>
Download <a href="audio.ogg">episode 42 of Learning to Love HTML5</a>
</audio>
Also be sure to include the controls attribute if you want browsers to display a default
control interface for your audio (see Figure 4-1 ):
<audio src="audio.ogg" controls >
Figure 4-1. Default audio controls in Chrome 9 include play/pause, a progress bar, and volume/mute
The audio file in this example uses Ogg Vorbis ( .ogg ), which is a royalty-free, open
source codec (see http://www.vorbis.com ) . However, there are many other audio
formats for the Web (see Table 4-1 ), which is one of the biggest challenges in
implementing HTML5 audio.
A codec is a technology used for compressing and decompressing data.
Audio codecs compress and/or decompress digital audio data into
different formats that aim to retain the highest level of quality with the
minimum bit rate.
Multiple audio codecs
The HTML5 specification does not dictate or make any recommendations about what
audio codecs should be supported. And since it would make far too much sense for
browser makers to agree (see http://lists.whatwg.org/pipermail/whatwg-whatwg.org/
2009-June/020620.html ) , there isn't a single format that works in all browsers, as you
can see in Table 4-1 .
Table 4-1. Current browser support for HTML5 audio formats
Browser
AAC ( .aac )
MP3 ( .mp3 )
Ogg Vorbis ( .ogg )
WAV ( .wav )
WebM ( .webm )
Chrome 6+
X
X
X
Firefox 3.6+
X
X
X
IE9+
X
X
X
Opera 10.5+
X
X
Safari 5+
X
X
X
 
Search WWH ::




Custom Search