I am working on a web application that plays videos. I need to detect when the user switches to another application so that I can pause the video.
E.g. the browser is still open in the background but the user is now busy in Skype or some other app.
I am working on a web application that plays videos. I need to detect when the user switches to another application so that I can pause the video.
E.g. the browser is still open in the background but the user is now busy in Skype or some other app.
document.addEventListener('visibilitychange', (event) => {
if (document.visibilityState != 'visible'){
window.location.href = "Alert.html"
}
})