mirror of
https://github.com/Moepchi/webspeak3.git
synced 2026-12-01 00:42:49 +08:00
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 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU
This commit is contained in:
1 parent
deabfbff3c
commit
5268c8f57a
1 file changed
+9
-1
+9
-1
@@ -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" ? "🛑" : "🖥️"}
|
||||
</button>
|
||||
{typeof navigator.mediaDevices?.getDisplayMedia === "function" && (
|
||||
{TAB_AUDIO_SUPPORTED && (
|
||||
<button
|
||||
className={`ts-icon-button${tabAudioOn ? " ts-mic-on" : ""}`}
|
||||
onClick={handleToggleTabAudio}
|
||||
|
||||
Reference in new issue
Block a user