22.06.2015 Views

o_19octlt3v29m1ul81r9513q81i4ra.pdf

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Incorporating Audio on a Web Page 283<br />

Here’s an example that shows the tag with two files, which are called with the<br />

help of the element that you saw earlier in the video section of this chapter:<br />

<br />

<br />

<br />

<br />

Playing Audio in Older Browsers<br />

As with video, playing audio in older browsers requires the tag. When used<br />

with audio, you’ll typically use two attributes, src and autostart; src configures the source<br />

of the audio, and autostart controls whether the audio clip should play automatically<br />

upon page load. Adding the tag to the previous example results in this HTML:<br />

<br />

<br />

<br />

<br />

<br />

By default, content included with will be automatically played. If you don’t<br />

want this, then add the autostart=”false” attribute tag, like so:<br />

<br />

Note Even when using to include audio, the visitor must still have software capable<br />

of playing the type of file being sent.<br />

One other attribute commonly used with is the loop attribute. The loop attribute,<br />

when set to true or infinite, restarts the audio clip when it completes. It can also be<br />

set to false to indicate that the audio clip should play only once. However, the default<br />

is to play the audio clip only once; therefore, omitting the loop attribute is the same as<br />

setting it to false.<br />

Placing an Audio Clip on a Web Page<br />

Now you get to practice placing an audio clip. In this exercise, you’ll add an audio file to<br />

an HTML5 page.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!