O'Reilly logo

HTML5 Developer’s Cookbook by Tom Leadbetter, Chuck Hudson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required