Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 8. Embedding Audio with HTML5 > Beginner Recipe: Including Audio with t...

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, nothing would display on the user interface.

Listing 8.1. Basic Example of the audio Element

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>8_1 Basic Audio Example</title>
</head>
<body>
  <audio src="music.mp3" controls />
</body>
</html>


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint