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
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

5. Audio and Video > Controlling Your Player with JavaScript

Controlling Your Player with JavaScript

So far, you’ve covered some heavy ground. You’ve learned how to take the new <audio> and <video> elements and turn them into a reasonably supported solution that works on more web pages than today’s Flash-based players. Not bad for a bleeding-edge technology.

That’s about the most you can do with the <audio> and <video> elements if you stick to markup only. But both elements have an extensive JavaScript object model, which lets you control playback with code. In fact, you can even adjust some details—like playback speed—that aren’t available in the browser’s standard audio and video players.

In the following sections, you’ll explore the JavaScript support by considering two practical examples. First, you’ll add sound effects to a game. Next, you’ll create a custom video player. And finally, you’ll consider the solutions that other people have developed using this potent mix of HTML5 and JavaScript, including supercharged, skinnable players and accessible captioning.


  

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