Chapter 7Multimedia: Using Native HTML5 Audio
In this chapter, we'll cover the audio element and
its attributes. Though we're focusing on the audio
element, keep in mind that most of these attributes also apply to
video. In fact, it's possible to use the
audio element to play video files and the
video element to play audio files. The main difference is
that the video element will display an image track if it
is available; audio never will.
The audio Element
Adding audio to your web page is super simple. Use the
<audio> tag. At a minimum, it requires a
src attribute, which is the path to and name of the
media file. Audio elements also require a closing
</audio> tag. Using your text editor, create a new HTML file, and add the snippet below, changing ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access