8. Embedding Audio with HTML5

Like the new video element, the new audio element allows you to embed an audio file into the page without the need for an additional plug-in like Flash. No longer having to rely on these third-party plug-ins, audio plays natively in modern web browsers, including browsers on many mobile devices.

In this chapter, you will learn the basics of the audio element and then look at ways to solve cross-browser issues. Then you will learn about the API available to see how you can create your own audio player.

Beginner Recipe: Including Audio with the audio Element

For a basic example of how to put audio on a page using the new audio element, take a look at the code in Listing 8.1. The controls attribute has been added; otherwise, ...

Get HTML5 Developer’s Cookbook now with O’Reilly online learning.

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