nwjs / nw.js

Call all Node.js modules directly from DOM/WebWorker and enable a new way of writing applications with all Web technologies.
https://nwjs.io
MIT License
40.39k stars 3.88k forks source link

API to inhibit screensaver #3660

Open jaruba opened 9 years ago

jaruba commented 9 years ago

RSATom/WebChimera.js is currently the best choice for video playback in NW.js apps, but it has a major problem, it cannot stop the monitor from going into sleep mode while it's playing. (as any normal player would)

This has also been requested for Electron and has been implemented: https://github.com/atom/electron/blob/master/docs/api/power-save-blocker.md

Will NW.js also implement something that can inhibit monitor sleep in the API?

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Destreyf commented 9 years ago

With nw.js 0.13 on its way, maybe we can take advantage of chrome.power (https://developer.chrome.com/apps/power) in order to handle this.

If it were to be implemented, here's where its being done on electron: https://github.com/atom/electron/blob/master/atom/browser/api/atom_api_power_monitor.h https://github.com/atom/electron/blob/master/atom/browser/api/atom_api_power_monitor.cc https://github.com/atom/electron/blob/master/atom/browser/api/atom_api_power_save_blocker.h https://github.com/atom/electron/blob/master/atom/browser/api/atom_api_power_save_blocker.cc

Although I'm not sure how helpful this is to have, its just worth a look.

jaruba commented 9 years ago

Although I'm not sure how helpful this is to have, its just worth a look.

All apps should have the possibility to inhibit sleep. I've also seen an issue reported to an app made with NW.js that casting a video to the TV would break when monitor sleep started.

All HTTP servers are stopped in this time and all connected clients disconnect. These are just 2 cases I mentioned but there are certainly more reasons for something like this.

jaruba commented 9 years ago

Also, the WebGL context is lost during monitor sleep..

jaruba commented 9 years ago

I really hope this feature was not totally forgotten about..