The Page Visibility API provides events you can watch for to know when a document becomes visible or hidden, as well as features to look at the current visibility state of the page....window, switches to another tab, or the document is entirely...video when the user puts the tab into the background, and resume...