Skip to content

Keep screen awake on Gladia transcription page#278

Merged
HugoGresse merged 2 commits into
mainfrom
copilot/force-gladia-page-to-keep-screen-on
Jul 3, 2026
Merged

Keep screen awake on Gladia transcription page#278
HugoGresse merged 2 commits into
mainfrom
copilot/force-gladia-page-to-keep-screen-on

Conversation

Copilot AI commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

The transcription page could dim/lock the screen during long sessions, interrupting the live captioning workflow.

Changes

  • useWakeLock.ts — new hook wrapping the Screen Wake Lock API: requests a "screen" lock on mount, re-acquires it on visibilitychange (browsers auto-release on tab hide), releases on unmount, silently no-ops on unsupported browsers
  • TranscriptionApp.tsx — calls useWakeLock() unconditionally so the lock is held for the full page lifetime

@HugoGresse

Copy link
Copy Markdown
Owner

@copilot add a console log if mot supported

Copilot AI commented Jul 3, 2026

Copy link
Copy Markdown
Contributor Author

@copilot add a console log if mot supported

Done — added in 0c9e87b. When navigator.wakeLock is absent, useWakeLock now logs:

useWakeLock: Screen Wake Lock API is not supported in this browser.

Copilot AI requested a review from HugoGresse July 3, 2026 08:21
Copilot AI deployed to GitHub Action PR July 3, 2026 08:21 Active
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown

Visit the preview URL for this PR (updated for commit 7ab838d):

(expires Fri, 10 Jul 2026 08:22:41 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 0c15c45ea5a4c54095387eacf30c3755c9260f22

@HugoGresse HugoGresse marked this pull request as ready for review July 3, 2026 08:30
Copilot AI review requested due to automatic review settings July 3, 2026 08:30
@HugoGresse HugoGresse merged commit 9c6ce48 into main Jul 3, 2026
5 checks passed
@HugoGresse HugoGresse deleted the copilot/force-gladia-page-to-keep-screen-on branch July 3, 2026 08:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to prevent the device screen from dimming/locking during long-running public transcription sessions by requesting a Screen Wake Lock while the transcription page is mounted.

Changes:

  • Added a new useWakeLock React hook that requests a "screen" wake lock and re-acquires it on visibilitychange.
  • Wired the new hook into TranscriptionApp so the wake lock is requested for the lifetime of the transcription page.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/public/transcription/useWakeLock.ts Introduces a hook that requests/releases a Screen Wake Lock and re-acquires it after tab visibility changes.
src/public/transcription/TranscriptionApp.tsx Uses useWakeLock() so the transcription page keeps the screen awake during usage.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +12 to +15
if (!('wakeLock' in navigator)) {
console.log('useWakeLock: Screen Wake Lock API is not supported in this browser.')
return
}
Comment on lines +17 to +24
const acquire = async () => {
try {
wakeLockRef.current = await navigator.wakeLock.request('screen')
} catch {
// Wake lock request may fail if the document is not visible or the
// browser / OS denies the request. Fail silently.
}
}
Comment on lines +35 to +39
return () => {
document.removeEventListener('visibilitychange', handleVisibilityChange)
wakeLockRef.current?.release()
wakeLockRef.current = null
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants