This page demonstrates the Page Visibility API.
The API can be used to check when a web page is visible or not.
If you minimise this page or move to another tab, JavaScript in the page detects a webkitvisibilitychange event. The video will stop playing and the page title will stop changing – and vice versa if you return to the page.
Please note: this example requires a browser such as Google Chrome that supports the Page Visibility API.
For more information, please see my blog at samdutton.wordpress.com