Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

fix: meeting system audio transcription and chat scroll overlap

Gabriel Stein59e9fb9a94b8
diff --git a/src/components/notes/MeetingTranscriptChat.tsx b/src/components/notes/MeetingTranscriptChat.tsx
index 730123d0f..5eae1dc92 100644
--- a/src/components/notes/MeetingTranscriptChat.tsx
+++ b/src/components/notes/MeetingTranscriptChat.tsx
@@ -82,7 +82,7 @@ export function MeetingTranscriptChat({
return (
<div
ref={scrollRef}
- className="h-full overflow-y-auto px-4 py-3 flex flex-col gap-1.5 agent-chat-scroll"
+ className="h-full overflow-y-auto px-4 pt-3 pb-24 flex flex-col gap-1.5 agent-chat-scroll"
>
{segments.map((segment, i) => {
const isMic = segment.source === "mic";
diff --git a/src/helpers/ipcHandlers.js b/src/helpers/ipcHandlers.js
index a90991f04..5c132b5d4 100644
--- a/src/helpers/ipcHandlers.js
+++ b/src/helpers/ipcHandlers.js
@@ -2547,10 +2547,28 @@ class IPCHandlers {
}
});
+ let meetingSendCounts = { mic: 0, system: 0 };
ipcMain.on("meeting-transcription-send", (_event, audioBuffer, source) => {
const streaming = source === "mic" ? this._meetingMicStreaming : this._meetingSystemStreaming;
- if (!streaming) return;
- streaming.sendAudio(Buffer.from(audioBuffer));
+ if (!streaming) {
+ if (meetingSendCounts[source] === 0) {
+ debugLogger.error("Meeting audio send: no streaming instance", { source });
+ }
+ return;
+ }
+ const buf = Buffer.from(audioBuffer);
+ const sent = streaming.sendAudio(buf);
+ meetingSendCounts[source]++;
+ if (meetingSendCounts[source] <= 5 || meetingSendCounts[source] % 100 === 0) {
+ debugLogger.debug("Meeting audio send", {
+ source,
+ bytes: buf.length,
+ sent,
+ wsReady: streaming.ws?.readyState,
+ totalSent: streaming.audioBytesSent,
+ count: meetingSendCounts[source],
+ });
+ }
});
ipcMain.handle("meeting-transcription-stop", async () => {
diff --git a/src/hooks/useMeetingTranscription.ts b/src/hooks/useMeetingTranscription.ts
index 3fb020a31..1853aa12e 100644
--- a/src/hooks/useMeetingTranscription.ts
+++ b/src/hooks/useMeetingTranscription.ts
@@ -475,14 +475,6 @@ export function useMeetingTranscription(): UseMeetingTranscriptionReturn {
onChunk: (chunk) => {
if (!isRecordingRef.current) return;
let samples = new Int16Array(chunk);
- let hasSignal = false;
- for (let i = 0; i < samples.length; i++) {
- if (samples[i] !== 0) {
- hasSignal = true;
- break;
- }
- }
- if (!hasSignal) return;
// Downsample to 24kHz for the OpenAI Realtime API
if (systemNeedsResample) {
diff --git a/src/utils/systemAudio.ts b/src/utils/systemAudio.ts
index da77cdbc5..ede7d0683 100644
--- a/src/utils/systemAudio.ts
+++ b/src/utils/systemAudio.ts
@@ -1,5 +1,10 @@
import logger from "./logger";
+// Module-level reference prevents the hidden video element from being garbage
+// collected while the capture session is active. ScreenCaptureKit on macOS
+// requires active video frame consumption to keep the loopback audio pump alive.
+let activeVideoSink: HTMLVideoElement | null = null;
+
/**
* Capture system audio via getDisplayMedia (ScreenCaptureKit loopback on macOS).
* Returns a MediaStream with audio (and video tracks that must stay alive on macOS).
@@ -56,14 +61,18 @@ export async function getSystemAudioStream(): Promise<MediaStream | null> {
// session. Without a consumer, the loopback audio track produces silence even
// though the track is "live". Attach the stream to a hidden <video> element so
// Chromium pulls frames and keeps the session active.
- const videoSink = document.createElement("video");
- videoSink.srcObject = new MediaStream(videoTracks);
- videoSink.muted = true;
- videoSink.play().catch(() => {});
+ // IMPORTANT: Store in module-level variable to prevent garbage collection.
+ activeVideoSink = document.createElement("video");
+ activeVideoSink.srcObject = new MediaStream(videoTracks);
+ activeVideoSink.muted = true;
+ activeVideoSink.play().catch(() => {});
audioTracks[0].addEventListener("ended", () => {
logger.error("System audio track ended unexpectedly", {}, "audio");
- videoSink.srcObject = null;
+ if (activeVideoSink) {
+ activeVideoSink.srcObject = null;
+ activeVideoSink = null;
+ }
});
return stream;
@@ -81,4 +90,8 @@ export function stopSystemAudioStream(stream: MediaStream | null): void {
try {
stream.getTracks().forEach((t) => t.stop());
} catch {}
+ if (activeVideoSink) {
+ activeVideoSink.srcObject = null;
+ activeVideoSink = null;
+ }
}