Skip to content

Commit 7f81ec6

Browse files
committed
fix: check navigator.mediaDevices exists before using getUserMedia
mediaDevices is undefined in non-secure contexts (HTTP). This caused 'Cannot read properties of undefined' errors on web version.
1 parent 2820a98 commit 7f81ec6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/browser/hooks/useVoiceInput.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ function hasTouchDictation(): boolean {
4848
}
4949

5050
const HAS_TOUCH_DICTATION = hasTouchDictation();
51-
const HAS_MEDIA_RECORDER = typeof window !== "undefined" && typeof MediaRecorder !== "undefined";
51+
const HAS_MEDIA_RECORDER =
52+
typeof window !== "undefined" &&
53+
typeof MediaRecorder !== "undefined" &&
54+
typeof navigator.mediaDevices?.getUserMedia === "function";
5255

5356
// =============================================================================
5457
// Hook

0 commit comments

Comments
 (0)