Summary: | Feature Request: Implement the Wake Lock API | ||
---|---|---|---|
Product: | WebKit | Reporter: | Thomas Steiner <tomac> |
Component: | New Bugs | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED FIXED | ||
Severity: | Normal | CC: | clshortfuse, eoconnor, henry, hi, igorsantos07, jer.noble, kieren, marcosc, mlopez, pierre-etienne.lord, simon.fraser, webkit-bug-importer, yordan.kanchelov, youennf |
Priority: | P2 | Keywords: | InRadar |
Version: | Safari Technology Preview | ||
Hardware: | Unspecified | ||
OS: | Unspecified |
Description
Thomas Steiner
2019-12-10 23:33:56 PST
Our web app displays long running photo slideshows and we would love this feature. Like many other sites, we are currently forced to use the 'nosleep' library (https://github.com/richtr/NoSleep.js/) to keep the display awake, but a native solution would be preferable, and presumably much better for battery life. We also use the 'nosleep' library when users are performing long running file uploads (e.g. large selections of photos), because whenever the screen goes to sleep the upload dies. (I assume this problem would be better solved by allowing background uploads of some sort, but at the moment 'nosleep' seems to be the only option). (The data upload feature would ideally be solved with Background Fetch: https://wicg.github.io/background-fetch/.) Our platform uses a queue where customers need to wait for to someone answer the call, like a call center. There we need to prevent the screen of a device from turning off or browser go to disconnect from the websocket. Use a hidden video with a loop is a hack, but is not respectful with battery. Our site uses this for big downloads - The display must be kept on or the requests will fail Useful for creating games which don't require often user interaction We need this for fleet management while users use the application while driving. Having to constantly touch the screen is a distraction as well as a safety risk. Right now iOS users extend the system-wide timeout to 30 minutes to bypass this since NoSleep.js workaround have failed in recent updates. Users can also receive calls with WebRTC while in the application, and it would be useful for the device to stay on, though we've already worked around it for the previous reasons. Wake lock API has been released (https://github.com/WebKit/WebKit/tree/main/Source/WebCore/Modules/screen-wake-lock) on iOS 16.4 I use NoSleep.js to handle Wake Lock API. NoSleep.js is correctly handled with iOS 16.4. Here the issue, on iOS 16.4. When using the Wake Lock API, on Safari, in a browser mode, the Wake Lock API work properly. On the same website, opened after have done "Add to home screen", the Wake Lock API don't work properly. The Wake Lock API seem to not be able to be acquired. Here the test page: https://pelord.github.io/wakeLockApiAddHomeScreen/ To test the Wake Lock API, you have to toggle the ZZZ button. Unchecked ZZZ = Wake Lock API released Checked ZZZ = Wake Lock API acquired Is it normal? More info. The previous test page is a PWA. Thanks PE Lord! We will take a look. Hi again PE Lord! tried it on both the Simulator (iPad) and on a couple of iPhones. Can confirm that the behavior you described is occurring. I've filed an internal bug rdar://107397143 I'll file a separate bug for this as the API itself is implemented: https://bugs.webkit.org/show_bug.cgi?id=245551 Actually, other folks already file it: https://bugs.webkit.org/show_bug.cgi?id=254545 |