Don't Miss a Frame: Using the Page Visibility API + HTML5 Video

The Page Visibility API can be used to check if the current tab is visible or not. Sam Dutton has thrown together a nice demo highlighting one great use case for the API: pausing a playing HTML5 video if the user switches tabs.

Demo

The demo requires Chrome 13 or higher but could be adapted to work with the upcoming IE10, which will include support for the Page Visibility API.