In HTML5, how can I keep an Android device’s screen on?

前端 未结 5 1638
挽巷
挽巷 2020-12-06 05:37

We are developing an App in HTML5 using jQuery.

Is there a way/method, in JavaScript or another technology, to keep the screen \"on\"?

5条回答
  •  醉话见心
    2020-12-06 06:02

    Keeping the device on does not depend on the OS but on the browser. Chrome is in the process of implementing Wake Lock API, but it is still experimental.

    Until fully available, there is a way to mock the api by playing a base64 video in the background. This locks the sleep mode with all browsers.

    You can find a webcomponent implementation here https://github.com/madeInLagny/mil-no-sleep

提交回复
热议问题