HTML and CSS Reference
In-Depth Information
Table 12.4 lists the attributes of the <audio> tag.
Table 12.4 <audio> Attributes
Attribute
Description
The URL for the video to be played.
src
Boolean attribute that indicates that the browser should supply its
own controls for the video. The default is to leave out the controls.
controls
Boolean attribute that indicates that the video should play immedi-
ately when the page loads.
autoplay
Boolean attribute. If present, the video will loop when it reaches the
end, replaying until the user manually stops the video from playing.
loop
Boolean attribute. If present, the browser will begin downloading
the video as soon as the page loads to get it ready to play. Ignored
if autoplay is present.
preload
To provide background music for the page, you can add the autoplay and loop attributes
to the tag. Chances are, if you use autoplay , or even worse, autoplay and loop without
also providing controls for the audio, your users will leave in a hurry.
Flash Audio Players
Embedding Flash audio players is exactly the same as embedding Flash video players in
a page. You can use the <object> tag, nested <object> tags, or SWFObject to embed
your Flash movie. You can also nest <object> tags within <audio> tags to maximize
browser support.
Both JW Player and Flowplayer can play audio as well as video files. To do so, supply
the path to an MP3 file rather than to a video file. There are also a number of Flash play-
ers that are just for audio.
One popular Flash audio player is just called Audio Player. You'll want to download the
standalone version from http://wpaudioplayer.com/. It is also available as a plug-in for
the WordPress blogging tool; be sure not to download that version.
After you've downloaded it, copy the audio-player.js and player.swf files to your
website. Then, set up the audio player, as shown in this example page, which appears in
Figure 12.16:
<!DOCTYPE html>
<html>
<head>
<title> Audio Player </title>
<script src=”audio-player.js” type=”text/javascript”></script>
 
 
Search WWH ::




Custom Search