Push-to-talk with custom key/mouse button, Hotkeys options, standalone store

- Push-to-talk: configurable key or middle/side mouse button (tab must be
  focused), hold button in the toolbar, settings under Capture and the new
  Options -> Hotkeys page, which also lists the fixed shortcuts.
- Design Store rejects uploads whose CSS is already in the store.
- gateway/src/store-server.ts runs the store as its own process from the
  same image, so store deploys don't drop voice connections.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU
This commit is contained in:
MoepchiandClaude Opus 5.5 committed 2026-10-19 08:40:03 +00:00
1 parent 803cefd653
commit 603cedd907
11 files changed
+368 -18

No files matched your search

+1 -1
View File
@@ -197,7 +197,7 @@ All optional; add them under `environment:` in your compose override next to `PO
| `DEFAULT_SERVER` / `DEFAULT_CHANNEL` | unset | Server (and optionally channel) every visitor auto-connects to — see [Bake in a default server](#2-bake-in-a-default-server). |
| `BROADCAST_TOKEN` | unset | Bearer token required to call `/api/broadcast` (send an in-app notice to all connected clients before a maintenance restart). Endpoint 404s while unset. |
| `TLS_CERT` / `TLS_KEY` | unset | Paths to serve the gateway over HTTPS/WSS directly instead of behind a reverse proxy/tunnel. Both must be set together. |
| `STORE_ENABLED` | off | Set to `1` to turn this gateway's own `/api/store/themes` endpoint on. Only needed if you want to run your own Design Store instead of using the maintainer's shared one (see `STORE_URL` build arg above) — the endpoint 404s while unset. |
| `STORE_ENABLED` | off | Set to `1` to turn this gateway's own `/api/store/themes` endpoint on. Only needed if you want to run your own Design Store instead of using the maintainer's shared one (see `STORE_URL` build arg above) — the endpoint 404s while unset. The store can also run as its own process (`node dist/store-server.js`, same image) so redeploying it never drops voice connections; route `/api/store/*` to it in your reverse proxy. |
| `STORE_DATA_FILE` | `store-themes.json` in the container's working dir | Where submitted themes (including screenshots) are stored. Mount a volume over this path if they should survive a container recreate. |
| `STORE_ALLOWED_ORIGIN` | `*` | CORS origin allowed to call the store endpoint, if you want to restrict it to your own frontend's origin. |
| `STORE_ADMIN_TOKEN` | unset | Bearer token for moderation. New submissions wait as "pending" until approved on the review page at `/api/store/admin` (enter the token there); the token holder's own submissions and the reserved author name(s) skip the queue. Without it, nothing ever gets published. Submitted CSS is also checked server-side: no `@import`/`@font-face`, no external `url()` — only inline `data:` images. |
+32
View File
@@ -0,0 +1,32 @@
// Standalone Design Store: the same /api/store/* routes index.ts serves, in a
// process of its own. Lets the store be redeployed or restarted without
// dropping anyone's voice connection. Same image, different command:
// node dist/store-server.js (with STORE_ENABLED=1)
// The gateway in front of the same hostname then runs with STORE_ENABLED off
// and the reverse proxy routes /api/store/* here.
import { createServer } from "node:http";
import { handleStore } from "./store.js";
const PORT = Number(process.env.PORT ?? 8080);
createServer((req, res) => {
res.setHeader("X-Content-Type-Options", "nosniff");
const { pathname } = new URL(req.url ?? "/", "http://localhost");
if (pathname === "/healthz") {
res.writeHead(200, { "Content-Type": "text/plain; charset=utf-8" });
res.end("ok\n");
return;
}
if (pathname === "/api/store/admin" || pathname === "/api/store/themes" || pathname.startsWith("/api/store/themes/")) {
handleStore(req, res, pathname).catch((err) => {
console.error("[store] Request failed:", err);
if (!res.headersSent) {
res.writeHead(500, { "Content-Type": "application/json" });
res.end(JSON.stringify({ error: "internal" }));
}
});
return;
}
res.writeHead(404, { "Content-Type": "application/json" });
res.end(JSON.stringify({ error: "not_found" }));
}).listen(PORT, () => console.log(`WebSpeak3 store listening on http://localhost:${PORT}`));
+7
View File
@@ -367,6 +367,13 @@ async function handleStoreSubmit(req: IncomingMessage, res: ServerResponse) {
}
const themes = await loadStoreThemes();
// Re-uploading an installed store theme unchanged would just duplicate it.
const cssKey = normalizeCss(css).replace(/\s+/g, "");
if (themes.some((t) => normalizeCss(t.css).replace(/\s+/g, "") === cssKey)) {
res.writeHead(409, { "Content-Type": "application/json" });
res.end(JSON.stringify({ error: "duplicate" }));
return;
}
if (themes.length >= STORE_MAX_THEMES) {
res.writeHead(507, { "Content-Type": "application/json" });
res.end(JSON.stringify({ error: "store_full" }));
+22
View File
@@ -1734,6 +1734,28 @@
margin: 0 0.2rem;
}
.ts-ptt-button {
/* Holding it on a phone must not scroll, zoom or pop the long-press menu */
touch-action: none;
-webkit-touch-callout: none;
}
.ts-ptt-key-listening {
outline: 2px solid var(--accent);
}
.ts-hotkeys-table td {
padding: 0.2rem 1rem 0.2rem 0;
}
.ts-hotkeys-table kbd {
font-family: inherit;
padding: 0.05rem 0.4rem;
border: 1px solid var(--border);
border-radius: 4px;
white-space: nowrap;
}
.ts-icon-slider,
.ts-icon-select {
display: flex;
+249 -15
View File
@@ -391,6 +391,8 @@ const ECHO_CANCELLATION_KEY = "webspeak3:echo-cancellation";
const AUTO_GAIN_CONTROL_KEY = "webspeak3:auto-gain-control";
const AEC3_ENABLED_KEY = "webspeak3:aec3-enabled";
const VAD_HANGOVER_KEY = "webspeak3:vad-hangover";
const PUSH_TO_TALK_KEY = "webspeak3:push-to-talk";
const PTT_BINDING_KEY = "webspeak3:ptt-key";
const DESIGN_THEME_KEY = "webspeak3:design-theme";
// The user's actual pick - "standard" | "nova" | "greenteaspeak" | "custom:<id>".
// DESIGN_THEME_KEY above keeps tracking just the resolved structural base, since a
@@ -505,6 +507,29 @@ function loadBoolPref(key: string, fallback: boolean): boolean {
return raw === null ? fallback : raw === "1";
}
interface PttBinding {
code: string;
label: string;
}
function loadPttBinding(): PttBinding | null {
try {
const v = JSON.parse(localStorage.getItem(PTT_BINDING_KEY) ?? "null");
return v && typeof v.code === "string" && typeof v.label === "string" ? v : null;
} catch {
return null;
}
}
function keyBindingLabel(e: KeyboardEvent): string {
return e.key.length === 1 && e.key !== " " ? e.key.toUpperCase() : e.code;
}
function isTypingTarget(target: EventTarget | null): boolean {
const el = target as HTMLElement | null;
return !!el && (el.isContentEditable || /^(INPUT|TEXTAREA|SELECT)$/.test(el.tagName));
}
function loadNumberPref(key: string, fallback: number): number {
const raw = localStorage.getItem(key);
const parsed = raw === null ? NaN : Number(raw);
@@ -5289,6 +5314,10 @@ interface AudioSettings {
onVadThresholdChange: (v: number) => void;
vadHangover: number;
onVadHangoverChange: (v: number) => void;
pushToTalk: boolean;
onPushToTalkChange: (on: boolean) => void;
pttBinding: PttBinding | null;
onPttBindingChange: (binding: PttBinding) => void;
noiseSuppressionEnabled: boolean;
onToggleNoiseSuppression: () => void;
echoCancellationEnabled: boolean;
@@ -5300,6 +5329,88 @@ interface AudioSettings {
onToggleAec3: () => void;
}
function PttKeyButton({ binding, onChange }: { binding: PttBinding | null; onChange: (b: PttBinding) => void }) {
const t = useT();
const [listening, setListening] = useState(false);
useEffect(() => {
if (!listening) return;
// Capture phase on window: the next key or mouse button wins wherever the
// pointer is, and never reaches the dialog (Escape) or the live PTT listener.
const take = (e: Event, next?: PttBinding) => {
e.preventDefault();
e.stopPropagation();
setListening(false);
if (next) onChange(next);
};
const onKey = (e: KeyboardEvent) => {
if (e.key === "Tab") return setListening(false);
take(e, e.key === "Escape" ? undefined : { code: e.code, label: keyBindingLabel(e) });
};
const onMouse = (e: MouseEvent) => {
// Left click is how you started (and how you click away), so it can't be PTT.
if (e.button === 0) return setListening(false);
take(e, { code: `Mouse${e.button}`, label: `Mouse ${e.button + 1}` });
// The back/forward side buttons navigate on release; keep the page.
window.addEventListener("mouseup", (up) => up.preventDefault(), { capture: true, once: true });
};
window.addEventListener("keydown", onKey, true);
window.addEventListener("mousedown", onMouse, true);
return () => {
window.removeEventListener("keydown", onKey, true);
window.removeEventListener("mousedown", onMouse, true);
};
}, [listening, onChange]);
return (
<button className={listening ? "ts-ptt-key-listening" : undefined} onClick={() => setListening(true)}>
{listening ? t("recording.pttKeyPress") : (binding?.label ?? t("recording.pttKeyNone"))}
</button>
);
}
function HotkeysPanel({ audio }: { audio: AudioSettings }) {
const t = useT();
return (
<>
<h3>{t("options.section.hotkeys")}</h3>
<p className="ts-options-subtitle">{t("hotkeys.subtitle")}</p>
<fieldset className="ts-options-fieldset">
<legend>{t("recording.pushToTalk")}</legend>
<label className="ts-options-checkbox">
<input type="checkbox" checked={audio.pushToTalk} onChange={(e) => audio.onPushToTalkChange(e.target.checked)} />
{t("hotkeys.pttEnabled")}
</label>
<div className="ts-options-field-row">
{t("recording.pttKey")}
<PttKeyButton binding={audio.pttBinding} onChange={audio.onPttBindingChange} />
</div>
<p className="ts-options-hint">{t("recording.pttHint")}</p>
</fieldset>
<fieldset className="ts-options-fieldset">
<legend>{t("hotkeys.shortcuts")}</legend>
<table className="ts-hotkeys-table">
<tbody>
{(
[
["Ctrl + S", "menu.connections.connect"],
["Ctrl + D", "menu.connections.disconnectCurrent"],
["Ctrl + B", "menu.favorites.add"],
] as const
).map(([keys, label]) => (
<tr key={keys}>
<td>
<kbd>{keys}</kbd>
</td>
<td>{t(label)}</td>
</tr>
))}
</tbody>
</table>
<p className="ts-options-hint">{t("hotkeys.shortcutsHint")}</p>
</fieldset>
</>
);
}
function MicLevelBar({ levelRef, active }: { levelRef: React.MutableRefObject<number>; active: boolean }) {
const [level, setLevel] = useState(0);
useEffect(() => {
@@ -5423,15 +5534,34 @@ function AufnahmePanel({ audio }: { audio: AudioSettings }) {
<fieldset className="ts-options-fieldset">
<legend>{t("recording.activation")}</legend>
<label className="ts-options-radio">
<input type="radio" name="activation" disabled readOnly />
<input
type="radio"
name="activation"
checked={audio.pushToTalk}
onChange={() => audio.onPushToTalkChange(true)}
/>
{t("recording.pushToTalk")}
</label>
{audio.pushToTalk && (
<>
<div className="ts-options-field-row">
{t("recording.pttKey")}
<PttKeyButton binding={audio.pttBinding} onChange={audio.onPttBindingChange} />
</div>
<p className="ts-options-hint">{t("recording.pttHint")}</p>
</>
)}
<label className="ts-options-radio">
<input type="radio" name="activation" disabled readOnly />
{t("recording.continuous")}
</label>
<label className="ts-options-radio">
<input type="radio" name="activation" checked readOnly />
<input
type="radio"
name="activation"
checked={!audio.pushToTalk}
onChange={() => audio.onPushToTalkChange(false)}
/>
{t("recording.voiceActivation")}
</label>
<div className="ts-options-level-wrap">
@@ -5838,7 +5968,7 @@ function DesignStorePanel({
() => localStorage.getItem(STORE_ADMIN_TOKEN_KEY) ?? ""
);
const [publishing, setPublishing] = useState(false);
const [publishResult, setPublishResult] = useState<"ok" | "pending" | "error" | null>(null);
const [publishResult, setPublishResult] = useState<"ok" | "pending" | "duplicate" | "error" | null>(null);
const [ratedIds, setRatedIds] = useState<Set<string>>(new Set());
const refreshThemes = () =>
@@ -5917,6 +6047,10 @@ function DesignStorePanel({
screenshot: publishScreenshot ?? undefined,
}),
});
if (res.status === 409) {
setPublishResult("duplicate");
return;
}
if (!res.ok) throw new Error(String(res.status));
const body = (await res.json().catch(() => ({}))) as { status?: string };
setPublishResult(body.status === "pending" ? "pending" : "ok");
@@ -6068,6 +6202,7 @@ function DesignStorePanel({
</button>
{publishResult === "ok" && <p className="ts-options-subtitle">{t("design.store.publish.success")}</p>}
{publishResult === "pending" && <p className="ts-options-subtitle">{t("design.store.publish.pending")}</p>}
{publishResult === "duplicate" && <p className="ts-options-subtitle">{t("design.store.publish.duplicate")}</p>}
{publishResult === "error" && <p className="ts-options-subtitle">{t("design.store.publish.error")}</p>}
</>
)}
@@ -6419,6 +6554,8 @@ function OptionsDialog({
<WiedergabePanel audio={audio} />
) : active.id === "aufnahme" ? (
<AufnahmePanel audio={audio} />
) : active.id === "hotkeys" ? (
<HotkeysPanel audio={audio} />
) : active.id === "sounds" ? (
<SoundsPanel />
) : active.id === "design" ? (
@@ -6913,6 +7050,12 @@ function AppInner() {
const [selfActive, setSelfActive] = useState(false);
const [vadThreshold, setVadThreshold] = useState(0.02);
const [vadHangover, setVadHangover] = useState(() => loadNumberPref(VAD_HANGOVER_KEY, 0.3));
const [pushToTalk, setPushToTalk] = useState(() => loadBoolPref(PUSH_TO_TALK_KEY, false));
const [pttBinding, setPttBinding] = useState<PttBinding | null>(loadPttBinding);
const [pttPressed, setPttPressed] = useState(false);
// Read when a new MicCapture is created, which happens outside render.
const pushToTalkRef = useRef(pushToTalk);
const pttPressedRef = useRef(false);
const [outputDevices, setOutputDevices] = useState<MediaDeviceInfo[]>([]);
const [outputDeviceId, setOutputDeviceId] = useState("");
const [inputDevices, setInputDevices] = useState<MediaDeviceInfo[]>([]);
@@ -7132,6 +7275,64 @@ function AppInner() {
localStorage.setItem(VAD_HANGOVER_KEY, String(vadHangover));
}, [vadHangover]);
useEffect(() => {
pushToTalkRef.current = pushToTalk;
if (micCaptureRef.current) micCaptureRef.current.pushToTalk = pushToTalk;
localStorage.setItem(PUSH_TO_TALK_KEY, pushToTalk ? "1" : "0");
}, [pushToTalk]);
useEffect(() => {
pttPressedRef.current = pttPressed;
if (micCaptureRef.current) micCaptureRef.current.pttPressed = pttPressed;
}, [pttPressed]);
useEffect(() => {
if (pttBinding) localStorage.setItem(PTT_BINDING_KEY, JSON.stringify(pttBinding));
}, [pttBinding]);
// Browsers only deliver keys while this tab has focus - there's no global
// hotkey for websites, so PTT can't work while another program is in front.
useEffect(() => {
if (!pushToTalk || !pttBinding) return;
const onKeyDown = (e: KeyboardEvent) => {
if (e.code !== pttBinding.code || e.defaultPrevented) return;
// A letter key still has to type in chat; F-keys or modifiers work anywhere.
if (e.key.length === 1 && isTypingTarget(e.target)) return;
if (!isTypingTarget(e.target)) e.preventDefault();
setPttPressed(true);
};
const onKeyUp = (e: KeyboardEvent) => {
if (e.code === pttBinding.code) setPttPressed(false);
};
// preventDefault: no middle-click autoscroll, no back/forward navigation
// from the side buttons (which fires on release).
const onMouseDown = (e: MouseEvent) => {
if (`Mouse${e.button}` !== pttBinding.code) return;
e.preventDefault();
setPttPressed(true);
};
const onMouseUp = (e: MouseEvent) => {
if (`Mouse${e.button}` !== pttBinding.code) return;
e.preventDefault();
setPttPressed(false);
};
// The keyup goes to whatever has focus next; don't leave the mic open.
const release = () => setPttPressed(false);
window.addEventListener("keydown", onKeyDown);
window.addEventListener("keyup", onKeyUp);
window.addEventListener("mousedown", onMouseDown);
window.addEventListener("mouseup", onMouseUp);
window.addEventListener("blur", release);
return () => {
window.removeEventListener("keydown", onKeyDown);
window.removeEventListener("keyup", onKeyUp);
window.removeEventListener("mousedown", onMouseDown);
window.removeEventListener("mouseup", onMouseUp);
window.removeEventListener("blur", release);
release();
};
}, [pushToTalk, pttBinding]);
useEffect(() => {
audioPlayerRef.current?.setVolume(playbackVolume);
localStorage.setItem(PLAYBACK_VOLUME_KEY, String(playbackVolume));
@@ -8863,6 +9064,8 @@ function AppInner() {
}
micCaptureRef.current?.stop();
micCaptureRef.current = mic;
mic.pushToTalk = pushToTalkRef.current;
mic.pttPressed = pttPressedRef.current;
mic.setExtraAudio(tabAudioRef.current);
setMicOn(true);
refreshOutputDevices();
@@ -10695,18 +10898,45 @@ function AppInner() {
>
{micOn && !inputMuted ? "🎤" : "🔇"}
</button>
<label className="ts-icon-slider" title={t("toolbar.vadSensitivity")}>
🎚️
<input
type="range"
min={0.002}
max={0.15}
step={0.002}
value={vadThreshold}
onChange={(e) => setVadThreshold(Number(e.target.value))}
aria-label={t("toolbar.vadSensitivity")}
/>
</label>
{pushToTalk ? (
<button
className={`ts-icon-button ts-ptt-button${pttPressed ? " ts-mic-on" : ""}`}
onPointerDown={(e) => {
e.currentTarget.setPointerCapture(e.pointerId);
setPttPressed(true);
}}
onPointerUp={() => setPttPressed(false)}
onPointerCancel={() => setPttPressed(false)}
onKeyDown={(e) => {
if ((e.key === " " || e.key === "Enter") && !e.repeat) {
e.preventDefault();
setPttPressed(true);
}
}}
onKeyUp={(e) => {
if (e.key === " " || e.key === "Enter") setPttPressed(false);
}}
onContextMenu={(e) => e.preventDefault()}
title={t("toolbar.pushToTalk")}
aria-label={t("toolbar.pushToTalk")}
aria-pressed={pttPressed}
>
🗣️
</button>
) : (
<label className="ts-icon-slider" title={t("toolbar.vadSensitivity")}>
🎚️
<input
type="range"
min={0.002}
max={0.15}
step={0.002}
value={vadThreshold}
onChange={(e) => setVadThreshold(Number(e.target.value))}
aria-label={t("toolbar.vadSensitivity")}
/>
</label>
)}
<button
className={`ts-icon-button${publishState === "live" ? " ts-mic-on" : ""}`}
onClick={handleStreamButton}
@@ -11148,6 +11378,10 @@ function AppInner() {
onVadThresholdChange: setVadThreshold,
vadHangover,
onVadHangoverChange: setVadHangover,
pushToTalk,
onPushToTalkChange: setPushToTalk,
pttBinding,
onPttBindingChange: setPttBinding,
noiseSuppressionEnabled,
onToggleNoiseSuppression: handleToggleNoiseSuppression,
echoCancellationEnabled,
+10
View File
@@ -90,6 +90,7 @@
"toolbar.micMute": "Ztlumit mikrofon",
"toolbar.micUnmute": "Zrušit ztlumení mikrofonu",
"toolbar.vadSensitivity": "Citlivost aktivace hlasem",
"toolbar.pushToTalk": "Držte pro mluvení",
"tabAudio.start": "Sdílet zvuk karty nebo okna do hlasového kanálu (sluchátka zabrání ozvěně)",
"tabAudio.stop": "Zastavit sdílení zvuku",
"tabAudio.noAudio": "Nebyl sdílen žádný zvuk. Ve výběru zvolte kartu nebo okno a zapněte jeho zvuk.",
@@ -323,6 +324,7 @@
"design.store.publish.submit": "Publikovat do obchodu",
"design.store.publish.success": "Vzhled byl publikován!",
"design.store.publish.pending": "Děkujeme! Váš vzhled byl odeslán a po kontrole se objeví v obchodě.",
"design.store.publish.duplicate": "Tento vzhled už v obchodě je. Před dalším zveřejněním ho trochu upravte.",
"design.store.publish.error": "Publikování se nezdařilo.",
"options.section.erweiterungen": "Doplňky",
"options.section.hotkeys": "Klávesové zkratky",
@@ -366,6 +368,14 @@
"recording.device": "Vstupní zařízení:",
"recording.activation": "Aktivace",
"recording.pushToTalk": "Stiskni a mluv",
"recording.pttKey": "Klávesa Push-To-Talk:",
"recording.pttKeyNone": "Nenastaveno",
"recording.pttKeyPress": "Stiskněte klávesu nebo tlačítko myši…",
"recording.pttHint": "Funguje jakákoli klávesa nebo tlačítko myši (prostřední či boční), ale jen když je WebSpeak3 aktivní okno. Prohlížeče nedovolí webovým stránkám vidět vstup z jiných programů, takže ve hře to nefunguje. Můžete také podržet tlačítko 🗣️ na panelu nástrojů.",
"hotkeys.subtitle": "Klávesové a myší zkratky",
"hotkeys.pttEnabled": "Použít Push-To-Talk (místo aktivace hlasem)",
"hotkeys.shortcuts": "Zkratky",
"hotkeys.shortcutsHint": "Nefungují, když píšete do textového pole.",
"recording.continuous": "Nepřetržitý přenos",
"recording.voiceActivation": "Detekce aktivace hlasem",
"recording.testStart": "Spustit test",
+10
View File
@@ -90,6 +90,7 @@
"toolbar.micMute": "Mikrofon stummschalten",
"toolbar.micUnmute": "Mikrofon aktivieren (unmute)",
"toolbar.vadSensitivity": "Empfindlichkeit der Sprachaktivierung",
"toolbar.pushToTalk": "Zum Sprechen gedrückt halten",
"tabAudio.start": "Ton eines Tabs oder Fensters in den Sprachkanal geben (mit Kopfhörer kein Echo)",
"tabAudio.stop": "Ton-Freigabe beenden",
"tabAudio.noAudio": "Es wurde kein Ton freigegeben. Im Auswahldialog einen Tab oder ein Fenster wählen und den Ton einschalten.",
@@ -323,6 +324,7 @@
"design.store.publish.submit": "Im Store veröffentlichen",
"design.store.publish.success": "Design wurde veröffentlicht!",
"design.store.publish.pending": "Danke! Dein Design wurde eingereicht und erscheint im Store, sobald es geprüft wurde.",
"design.store.publish.duplicate": "Dieses Design ist schon im Store. Ändere es etwas, bevor du es erneut veröffentlichst.",
"design.store.publish.error": "Veröffentlichen fehlgeschlagen.",
"options.section.erweiterungen": "Erweiterungen",
"options.section.hotkeys": "Hotkeys",
@@ -366,6 +368,14 @@
"recording.device": "Aufnahmegerät:",
"recording.activation": "Aktivierung",
"recording.pushToTalk": "Push-To-Talk",
"recording.pttKey": "Push-To-Talk-Taste:",
"recording.pttKeyNone": "Nicht festgelegt",
"recording.pttKeyPress": "Taste oder Maustaste drücken…",
"recording.pttHint": "Jede Taste oder Maustaste (mittlere oder Seitentasten) geht, aber nur solange WebSpeak3 das aktive Fenster ist. Browser lassen Webseiten keine Eingaben aus anderen Programmen sehen, im Spiel klappt es also nicht. Alternativ den 🗣️-Knopf in der Toolbar gedrückt halten.",
"hotkeys.subtitle": "Tastatur- und Maus-Kürzel",
"hotkeys.pttEnabled": "Push-To-Talk verwenden (statt Sprachaktivierung)",
"hotkeys.shortcuts": "Tastenkürzel",
"hotkeys.shortcutsHint": "Greifen nicht, während du in ein Textfeld tippst.",
"recording.continuous": "Dauersenden",
"recording.voiceActivation": "Automatische Spracherkennung",
"recording.testStart": "Test starten",
+10
View File
@@ -90,6 +90,7 @@
"toolbar.micMute": "Mute microphone",
"toolbar.micUnmute": "Unmute microphone",
"toolbar.vadSensitivity": "Voice activation sensitivity",
"toolbar.pushToTalk": "Hold to talk",
"tabAudio.start": "Share tab or window audio into the voice channel (headphones avoid an echo)",
"tabAudio.stop": "Stop sharing audio",
"tabAudio.noAudio": "No audio was shared. In the picker, choose a tab or window and turn on its audio.",
@@ -323,6 +324,7 @@
"design.store.publish.submit": "Publish to the store",
"design.store.publish.success": "Design published!",
"design.store.publish.pending": "Thanks! Your design was submitted and will appear in the store once it has been reviewed.",
"design.store.publish.duplicate": "This design is already in the store. Change it a little before publishing it again.",
"design.store.publish.error": "Publishing failed.",
"options.section.erweiterungen": "Addons",
"options.section.hotkeys": "Hotkeys",
@@ -366,6 +368,14 @@
"recording.device": "Capture device:",
"recording.activation": "Activation",
"recording.pushToTalk": "Push-To-Talk",
"recording.pttKey": "Push-to-talk key:",
"recording.pttKeyNone": "Not set",
"recording.pttKeyPress": "Press a key or mouse button…",
"recording.pttHint": "Any key or mouse button (middle or side buttons) works, but only while WebSpeak3 is the active window. Browsers don't let websites see input in other programs, so it won't work while you're in a game. You can also hold the 🗣️ button in the toolbar.",
"hotkeys.subtitle": "Keyboard and mouse shortcuts",
"hotkeys.pttEnabled": "Use push-to-talk (instead of voice activation)",
"hotkeys.shortcuts": "Shortcuts",
"hotkeys.shortcutsHint": "These don't fire while you're typing in a text field.",
"recording.continuous": "Continuous transmission",
"recording.voiceActivation": "Voice activation detection",
"recording.testStart": "Start test",
+10
View File
@@ -90,6 +90,7 @@
"toolbar.micMute": "بی‌صدا کردن میکروفون",
"toolbar.micUnmute": "فعال کردن صدای میکروفون",
"toolbar.vadSensitivity": "حساسیت فعال‌سازی صوتی",
"toolbar.pushToTalk": "برای صحبت نگه دارید",
"tabAudio.start": "صدای یک زبانه یا پنجره را در کانال صوتی پخش کن (با هدفون پژواک ایجاد نمی‌شود)",
"tabAudio.stop": "توقف اشتراک صدا",
"tabAudio.noAudio": "صدایی به اشتراک گذاشته نشد. در پنجره انتخاب، یک زبانه یا پنجره را انتخاب و صدای آن را روشن کنید.",
@@ -323,6 +324,7 @@
"design.store.publish.submit": "انتشار در فروشگاه",
"design.store.publish.success": "طراحی منتشر شد!",
"design.store.publish.pending": "ممنون! طراحی تو ارسال شد و پس از بررسی در فروشگاه نمایش داده می‌شود.",
"design.store.publish.duplicate": "این طرح از قبل در فروشگاه وجود دارد. قبل از انتشار دوباره، کمی آن را تغییر دهید.",
"design.store.publish.error": "انتشار ناموفق بود.",
"options.section.erweiterungen": "افزونه‌ها",
"options.section.hotkeys": "کلیدهای میانبر",
@@ -366,6 +368,14 @@
"recording.device": "دستگاه ضبط:",
"recording.activation": "فعال‌سازی",
"recording.pushToTalk": "فشار برای صحبت (Push-To-Talk)",
"recording.pttKey": "کلید Push-To-Talk:",
"recording.pttKeyNone": "تنظیم نشده",
"recording.pttKeyPress": "یک کلید یا دکمه ماوس را فشار دهید…",
"recording.pttHint": "هر کلید یا دکمه ماوس (دکمه وسط یا کناری) کار می‌کند، اما فقط وقتی WebSpeak3 پنجره فعال باشد. مرورگرها اجازه نمی‌دهند وب‌سایت‌ها ورودی برنامه‌های دیگر را ببینند، پس داخل بازی کار نمی‌کند. می‌توانید دکمه 🗣️ را در نوار ابزار نگه دارید.",
"hotkeys.subtitle": "میان‌برهای صفحه‌کلید و ماوس",
"hotkeys.pttEnabled": "استفاده از Push-To-Talk (به جای فعال‌سازی صوتی)",
"hotkeys.shortcuts": "میان‌برها",
"hotkeys.shortcutsHint": "هنگام تایپ در یک فیلد متنی کار نمی‌کنند.",
"recording.continuous": "ارسال پیوسته",
"recording.voiceActivation": "تشخیص فعال‌سازی صوتی",
"recording.testStart": "شروع آزمایش",
+10
View File
@@ -43,6 +43,7 @@
"toolbar.micMute": "麦克风静音",
"toolbar.micUnmute": "取消麦克风静音",
"toolbar.vadSensitivity": "语音激活灵敏度",
"toolbar.pushToTalk": "按住说话",
"tabAudio.start": "将标签页或窗口的声音共享到语音频道(戴耳机可避免回声)",
"tabAudio.stop": "停止共享声音",
"tabAudio.noAudio": "没有共享声音。请在选择窗口中选择标签页或窗口,并开启其声音。",
@@ -269,6 +270,14 @@
"recording.device": "录音设备:",
"recording.activation": "激活方式",
"recording.pushToTalk": "按键说话",
"recording.pttKey": "按键说话键:",
"recording.pttKeyNone": "未设置",
"recording.pttKeyPress": "请按下按键或鼠标按键…",
"recording.pttHint": "可使用任意按键或鼠标按键(中键或侧键),但仅在 WebSpeak3 为当前活动窗口时有效。浏览器不允许网站读取其他程序中的输入,因此在游戏中无法使用。也可以按住工具栏中的 🗣️ 按钮。",
"hotkeys.subtitle": "键盘和鼠标快捷键",
"hotkeys.pttEnabled": "使用按键说话(代替语音激活)",
"hotkeys.shortcuts": "快捷键",
"hotkeys.shortcutsHint": "在文本框中输入时不会触发。",
"recording.continuous": "持续传输",
"recording.voiceActivation": "语音激活检测",
"recording.testStart": "开始测试",
@@ -617,6 +626,7 @@
"design.store.publish.submit": "发布到商店",
"design.store.publish.success": "设计已发布!",
"design.store.publish.pending": "谢谢!你的设计已提交,审核通过后将显示在商店中。",
"design.store.publish.duplicate": "该设计已在商店中。请稍作修改后再发布。",
"design.store.publish.error": "发布失败。",
"recording.autoGainControl": "自动增益控制",
"tree.streaming": "正在直播",
+7 -2
View File
@@ -54,7 +54,8 @@ export interface MicCaptureOptions {
*
* Uses voice activation (like TeamSpeak's own "Sprachaktivierung"): frames are
* only sent while the input level is above `threshold`, plus a short hangover
* so the tail of a word isn't cut off. `onActivity` reports transitions so the
* so the tail of a word isn't cut off. With `pushToTalk` set, only while
* `pttPressed` is. `onActivity` reports transitions so the
* UI can show a local "currently transmitting" indicator.
*/
export class MicCapture {
@@ -83,6 +84,9 @@ export class MicCapture {
private context: AudioContext;
threshold: number;
hangoverSeconds: number;
/** Push-to-talk: send while `pttPressed` instead of voice activation. */
pushToTalk = false;
pttPressed = false;
constructor(context: AudioContext, options: MicCaptureOptions) {
this.context = context;
@@ -148,8 +152,9 @@ export class MicCapture {
const now = this.context.currentTime;
if (rms >= this.threshold) this.activeUntil = now + this.hangoverSeconds;
const talking = this.pushToTalk ? this.pttPressed : now < this.activeUntil;
// Shared audio (music, a video) has its own pauses; keep sending throughout.
const shouldBeActive = this.extra !== null || now < this.activeUntil;
const shouldBeActive = this.extra !== null || talking;
if (shouldBeActive !== this.active) {
this.active = shouldBeActive;
this.onActivity?.(this.active);