HTML and CSS Reference
In-Depth Information
Table 8-5 Commonly Used Parameters for QuickTime (continued)
Parameter
Default
Description
loop
false
Plays the clip in a continuous loop
starttime
[no default]
Specifies the time in the clip at which the video begins
volume
[last setting]
Sets the initial audio volume
In the sample code (repeated below), one parameter is added in the <object>
</object> container for the audio clip.
<object data="longfellow-audio.mp3" height=”45” width=”250”>
<param name=”URL” value=”longfellow-audio.mp3” />
</object>
The URL parameter, as shown in Table 8-4, identifies what audio clip is to be played.
In this case, you are inserting an MPEG (.mp3) file. This is a recording in which
Longfellow's poem “Changed” is read. As soon as you open the Web page with this
<object> statement, the longfellow-audio.mp3 audio clip starts immediately (note the
autostart default in Table 8-4). As stated before, the purpose of the Web site dictates
what parameters you use. Think about yourself as a Web site visitor. How do you feel
when a loud audio clip plays as soon as you enter a Web site? What do you think if you
have no option to pause or stop the clip? Always consider your own browsing habits,
likes, and dislikes when you design Web sites. If you did not want to start the .mp3 file
automatically, you would add a <param name="autostart" value="false" /> statement
within the <object> </object> container. With this audio clip insertion, you do provide the
player control panel that gives the user the opportunity to pause or stop the audio clip.
The HMTL5 <audio> Tag
One of the most long-awaited features in HTML5 is the audio element. The
<audio> tag is used to define sound, such as music or other audio streams. At the writing
of this topic, the <audio> tag is supported in all major browsers. If you use an older
browser that doesn't support the <audio> tag, you can fall back to using the <object> tag.
The negative about this new tag is that it does not currently support all audio formats.
However, you can use a variety of software applications to convert from one audio form to
another. Table 8-6 shows the attributes and values that can be used with the <audio> tag.
Table 8-6 Attributes for <audio> Tag
Attribute
Value
Description
autoplay
autoplay
Specifies that the audio will start playing as soon as it is ready
controls
controls
Specifies that audio controls should be displayed (such as a play/pause button, etc.)
loop
loop
Specifies that the audio will start over again, every time it is finished
preload
auto
metadata
none
Specifies if and how the author thinks the audio should be loaded when the
page loads
src
URL
Specifies the URL of the audio file
 
Search WWH ::




Custom Search