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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.