HTML and CSS Reference
In-Depth Information
metadata : All audio (and video) i les have metadata like duration or some other sound
data that the sound author placed in the audio's i le. When the chance of using an audio
i le is low, but (just in case) loading the metadata is reasonable and doesn't take up much
in the way of Internet resources.
auto : If the preload attribute is present, it automatically preloads the audio i le
information. h e auto assignment simply acts as a reminder that the i le is going to
preload. (It's the same as not have any value assignment to a preload attribute.)
h e more varied your audience and the more audio in your Web page, the more you want to
provide the preload attribute with options.
LOOP
When you want a sound to endlessly repeat itself, you use a loop. h e advantage of using a
loop is that you can take a relatively short piece of music and have it repeat itself so that it
sounds like a full composition. In this way, you can use a minimum amount of Internet
resources and have continuous music. h e format is like the other attributes that act like
Booleans — they're either of or on. h e following is an example:
< audio src = ”Shadows.wav” autoplay loop ></ audio >
In that line lies the seeds of its own destruction. For many good reasons, users may want to
turn of sound. You can use JavaScript to put together a simple routine that will do that, but
it's easier simply to add the controls attribute and let the user turn it of . However, some
designers, with good reason, would rather not have the audio control anywhere in the design;
they believe that some nice music would be an integral part of the design. In that case, start
looking up the JavaScript to turn the thing of . No matter how nice a piece of sound is,
repeated endlessly it becomes brainwashing, and that's not allowed by the Geneva
Convention.
203
BROWSER SUPPORT FOR AUDIO
At the time of this writing, while testing audio formats, I could i nd no format that all
browsers supported. Worse still, no single format is supported by all HTML5 browsers. Table
10.1 shows the breakdown.
Table 10.1
Browsers and Audio Format Support
Browser
MP3
WAV
OGG
Chrome
Yes
No
Yes
Firefox
No
Yes
Yes
Internet Explorer 9*
Yes
No
No*
Opera
No
Yes
No
Safari Yes Yes No
* Microsoft announced that IE9 would be supporting the OGG format, but in the beta version of IE9, it did not.
Search WWH ::




Custom Search