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 ...

Get Jump Start HTML5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.