HTML and CSS Reference
In-Depth Information
FiGure 24-4
incorPoraTinG HTML5 audio
Until HTML5, playing music, sound effects, or background audio required the use of a plug-in.
With the advent of the new
<audio>
tag, certain audio formats can be played natively, without any
helper applications.
The basic
<audio>
tag is very straightforward:
<audio src=”assets/fb_demo_song.mp3” controls=”controls”></audio>
As with the
<img>
and other tags, the
src
attribute sets the path to an appropriate file,
either relative or absolute. The
controls
attribute tells the compliant browser to dis-
play basic play/pause and volume controls as
well as a seek bar, as shown in Figure 24-5.
FiGure 24-5