From 7f93c4b9787d2ccca19ee27ac521438a90748fbe Mon Sep 17 00:00:00 2001 From: David Gumberg Date: Tue, 12 Aug 2025 17:30:57 -0700 Subject: [PATCH 1/2] frontend: Don't let screen sleep when transcribing. --- whisperlivekit/web/live_transcription.html | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/whisperlivekit/web/live_transcription.html b/whisperlivekit/web/live_transcription.html index 5c50600..e27189d 100644 --- a/whisperlivekit/web/live_transcription.html +++ b/whisperlivekit/web/live_transcription.html @@ -385,6 +385,7 @@ let chunkDuration = 1000; let websocketUrl = "ws://localhost:8000/asr"; let userClosing = false; + let wakeLock = null; let startTime = null; let timerInterval = null; let audioContext = null; @@ -712,6 +713,16 @@ async function startRecording() { try { + + // https://developer.mozilla.org/en-US/docs/Web/API/Screen_Wake_Lock_API + // create an async function to request a wake lock + try { + wakeLock = await navigator.wakeLock.request("screen"); + } catch (err) { + // The Wake Lock request has failed - usually system related, such as battery. + console.log("Error acquiring wake lock.") + } + const stream = await navigator.mediaDevices.getUserMedia({ audio: true }); audioContext = new (window.AudioContext || window.webkitAudioContext)(); @@ -741,6 +752,10 @@ } async function stopRecording() { + wakeLock.release().then(() => { + wakeLock = null; + }); + userClosing = true; waitingForStop = true; From 3b96fb8776de399f1f94700d3636888513d7a1bb Mon Sep 17 00:00:00 2001 From: David Gumberg Date: Tue, 12 Aug 2025 17:31:32 -0700 Subject: [PATCH 2/2] frontend: Scroll down when appending transcription --- whisperlivekit/web/live_transcription.html | 1 + 1 file changed, 1 insertion(+) diff --git a/whisperlivekit/web/live_transcription.html b/whisperlivekit/web/live_transcription.html index e27189d..b851e8e 100644 --- a/whisperlivekit/web/live_transcription.html +++ b/whisperlivekit/web/live_transcription.html @@ -666,6 +666,7 @@ }).join(""); linesTranscriptDiv.innerHTML = linesHtml; + window.scrollTo({ top: document.body.scrollHeight, behavior: 'smooth' }); } function updateTimer() {