446 CHAPTER 11 HTML5 supports multimedia
■■preload pecifies how the audio should be loaded when the page loads. It can be set S
to auto, metadata, or none. The auto setting starts loading the audio when the page
loads. The metadata setting loads only the metadata, and the none setting doesn’t
load anything.
■■src pecifies the URL of the audio.S
Quick check
■■You want to repeat the audio continuously when it completes. Which attribute
must you set?
Quick check answer
■■Set the loop attribute as follows.
<audio loop='loop'>
Lesson summary
■■The <audio> element is new in HTML5.
■■The most common audio formats for the web are .ogg/Vorbis, .mp3, and .wav.
■■When implementing the <audio> element, at a minimum you must provide an audio
source.
■■It’s best to provide multiple audio sources to be compatible with most browsers.
■■Use the autoplay attribute to start playing immediately.
Lesson review
Answer the following questions to test your knowledge of the information in this lesson. You
can find the answers to these questions and explanations of why each answer choice is correct
or incorrect in the “Answers” section at the end of this chapter.
- You want to supply an audio file using a format that is compatible with the Internet
Explorer, Safari, and Chrome browsers. Which audio formats can you include to be
compatible with most browsers? (Choose all that apply.)
A. .mp4
B. .wav
C. .mp3
D. .oga - You don’t want to supply an .mp3 format because you are concerned about potentially
paying royalties. What other audio formats can you include to be compatible with
most browsers? (Choose all that apply.)