I met very strange problem - on Samsun Galaxy Note (and few other samsung devices), when I locking the screen (using lock screen button), video and sound from the webpage continue play in background...
I need to prevent it.
I made some debugging and realized that, when you press on the home button browser minimizing and tab is not active... but!!! when I press on the lock screen button - device lock the screen, but tab IS active in the browser, but orientation changed...
Also I tried to check, what kind of events fires, when you press on lock screen button... I used for that monitorEvents
function and it shows, that only few events fires: devicemotion
- which fires all time, deviceorientation
- which fires on any moves with the device and resize
- when phone changes the orientation...
At the moment I broke my brain looking for the solution... but I can't find anything related to the problem... Also I realized, that youtube handle this issue, on youtube it doesn't appears... but I have no idea how they did it...
Another things that I tried:
- Visibility API doesn't handle this issue.
- Events like
focusout
,blur
not handling this issue. - Timers also not stoping their work, when screen is locked.
Any ideas or suggestions?