S
S
syrpo2018-09-04 14:25:46
JavaScript
syrpo, 2018-09-04 14:25:46

How to catch on JS the moment the phone screen turns off?

Hello. How can I use javascript to catch the moment when the phone screen turns off (by pressing a button or by itself). The task is to mute the background music on the site in the mobile browser during this event

Answer the question

In order to leave comments, you need to log in

3 answer(s)
E
Eugene, 2018-09-04
@AppFA

No, it's hardware.

M
My joy, 2018-09-04
@t-alexashka

Try this: https://developer.mozilla.org/en-US/docs/Web/API/P...

A
alterEgoChaos, 2018-09-06
@alterEgoChaos

I don't know how it is in JS, but when the screen turns off in androyd, the onPause method is called in the life cycle of the browser screen.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question