Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Prevent suspend during presentation w/ Screen Wake Lock API #296

Open
batonac opened this issue Mar 25, 2024 · 0 comments
Open

feat: Prevent suspend during presentation w/ Screen Wake Lock API #296

batonac opened this issue Mar 25, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@batonac
Copy link

batonac commented Mar 25, 2024

Is your feature request related to a problem? Please describe.
Currently the screen can turn off and the computer suspend during a Advanced Slides presentation, which is problematic.

Describe the solution you'd like
It seems easy enough to utilize the Screen Wake Lock API:

// Create a reference for the Wake Lock.
let wakeLock = null;

// create an async function to request a wake lock
try {
  wakeLock = await navigator.wakeLock.request("screen");
  statusElem.textContent = "Wake Lock is active!";
} catch (err) {
  // The Wake Lock request has failed - usually system related, such as battery.
  statusElem.textContent = `${err.name}, ${err.message}`;
}

Describe alternatives you've considered
The computer can be set to disable suspend, but that's a cumbersome solution.

Additional context
Secure context is required, but apparently localhost qualifies:

Locally-delivered resources such as those with http://127.0.0.1 URLs, http://localhost and http://*.localhost URLs (e.g. http://dev.whatever.localhost/), and file:// URLs are also considered to have been delivered securely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant