Keep screen awake on Gladia transcription page#278
Conversation
|
@copilot add a console log if mot supported |
Done — added in 0c9e87b. When |
|
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 |
There was a problem hiding this comment.
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
useWakeLockReact hook that requests a"screen"wake lock and re-acquires it onvisibilitychange. - Wired the new hook into
TranscriptionAppso 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.
| if (!('wakeLock' in navigator)) { | ||
| console.log('useWakeLock: Screen Wake Lock API is not supported in this browser.') | ||
| return | ||
| } |
| 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. | ||
| } | ||
| } |
| return () => { | ||
| document.removeEventListener('visibilitychange', handleVisibilityChange) | ||
| wakeLockRef.current?.release() | ||
| wakeLockRef.current = null | ||
| } |
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 onvisibilitychange(browsers auto-release on tab hide), releases on unmount, silently no-ops on unsupported browsersTranscriptionApp.tsx— callsuseWakeLock()unconditionally so the lock is held for the full page lifetime