From 5268c8f57a17c941826f59824ffa3e50b373a68a Mon Sep 17 00:00:00 2001 From: Moepchi Date: Sat, 3 Oct 2026 09:02:30 +0000 Subject: [PATCH] fix: offer tab audio only in Chromium-based browsers Firefox and Safari give getDisplayMedia video without audio, so the button could only ever answer "no audio" there. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU --- web/src/App.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/web/src/App.tsx b/web/src/App.tsx index 1d7f25b..09a02f3 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -489,6 +489,14 @@ function loadFavorites(): Favorite[] { } } +// Only Chromium hands out tab/system audio via getDisplayMedia; Firefox and +// Safari return video only, so the button would just say "no audio" there. +// userAgentData itself only exists in Chromium-based browsers. +const TAB_AUDIO_SUPPORTED = + typeof navigator.mediaDevices?.getDisplayMedia === "function" && + !!(navigator as Navigator & { userAgentData?: { brands: { brand: string }[] } }).userAgentData?.brands.some( + (b) => b.brand === "Chromium" + ); const AWAY_PRESETS_KEY = "webspeak3:away-presets"; /** "off" hides the server banner: it loads from whatever host the server * admin picked, which then sees the viewer's IP (review S12). */ @@ -10416,7 +10424,7 @@ function AppInner() { > {publishState === "live" ? "🛑" : "🖥️"} - {typeof navigator.mediaDevices?.getDisplayMedia === "function" && ( + {TAB_AUDIO_SUPPORTED && (