HTML and CSS Reference
In-Depth Information
Figure 3-4. <audio /> element in Android 4 Ice Cream Sandwich
The <audio /> tag also supports several additional media-based attributes.
Table 3-1 shows these attributes and their descriptions.
Table 3-1. HTML5 Audio Attributes
Attribute
Value
Description
src
Used to specify a single audio file instead of using
the <source /> tags.
preload
none | metadata |
auto
Used to specify whether to preload the audio file.
It's advisable to set this to either none or
metadata. This will prevent the browser from
downloading the entire audio file without the user's
knowledge.
autoplay autoplay
Used to tell the browser to automatically play the
audio file. If you do not want the audio to play
automatically, do not add this element.
loop loop
Used to specify whether the audio should
continuously loop. This attribute will not accept a
number. If you would like your audio to loop for a
specific number of times, you can do this using the
JavaScript audio API.
muted muted
This will mute the audio. Note that this does not
appear to be supported in Android Browser.
controls controls
Used to tell the browser whether to render the
default controls. If you produce your own UI for
your audio player, this can be handy.
 
Search WWH ::




Custom Search