mirror of
https://github.com/Moepchi/webspeak3.git
synced 2026-12-01 00:42:49 +08:00
feat: warn when shared tab/system audio stays silent
Windows system audio only covers the default playback device, so music on another device is mixed in as pure silence with no hint why. 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
5268c8f57a
commit
9d736dbfdd
6 files changed
+17
-1
No files matched your search
@@ -8735,6 +8735,12 @@ function AppInner() {
|
||||
tabAudioRef.current = stream;
|
||||
micCaptureRef.current?.setExtraAudio(stream);
|
||||
setTabAudioOn(true);
|
||||
// Windows system audio only covers the default output device; music on
|
||||
// another device arrives as pure silence, with nothing else to tell why.
|
||||
setTimeout(() => {
|
||||
if (tabAudioRef.current === stream && micCaptureRef.current && micCaptureRef.current.extraPeak < 1e-4)
|
||||
appendLog({ text: t("tabAudio.silent"), kind: "error" });
|
||||
}, 5000);
|
||||
};
|
||||
|
||||
const handleToggleMicTest = () => {
|
||||
|
||||
@@ -93,6 +93,7 @@
|
||||
"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.",
|
||||
"tabAudio.silent": "Der geteilte Ton ist seit 5 Sekunden still. Bei „Systemaudio“ nimmt der Browser nur das Windows-Standard-Wiedergabegerät auf. Läuft die Musik auf einem anderen Gerät, kommt nichts an.",
|
||||
"toolbar.muteSound": "Ton stummschalten (Ausgabe stumm)",
|
||||
"toolbar.unmuteSound": "Ton aktivieren (Ausgabe an)",
|
||||
"toolbar.chooseOutputDevice": "Wiedergabegerät wählen",
|
||||
|
||||
@@ -93,6 +93,7 @@
|
||||
"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.",
|
||||
"tabAudio.silent": "The shared audio has been silent for 5 seconds. With \"system audio\" the browser only captures the Windows default playback device; music playing on another device doesn't come through.",
|
||||
"toolbar.muteSound": "Mute sound (deafen)",
|
||||
"toolbar.unmuteSound": "Unmute sound (undeafen)",
|
||||
"toolbar.chooseOutputDevice": "Choose output device",
|
||||
|
||||
@@ -93,6 +93,7 @@
|
||||
"tabAudio.start": "صدای یک زبانه یا پنجره را در کانال صوتی پخش کن (با هدفون پژواک ایجاد نمیشود)",
|
||||
"tabAudio.stop": "توقف اشتراک صدا",
|
||||
"tabAudio.noAudio": "صدایی به اشتراک گذاشته نشد. در پنجره انتخاب، یک زبانه یا پنجره را انتخاب و صدای آن را روشن کنید.",
|
||||
"tabAudio.silent": "صدای اشتراکگذاشتهشده ۵ ثانیه است که بیصداست. با «صدای سیستم»، مرورگر فقط دستگاه پخش پیشفرض ویندوز را ضبط میکند؛ موسیقیای که روی دستگاه دیگری پخش شود منتقل نمیشود.",
|
||||
"toolbar.muteSound": "بیصدا کردن صدا (کر کردن)",
|
||||
"toolbar.unmuteSound": "فعال کردن صدا",
|
||||
"toolbar.chooseOutputDevice": "انتخاب دستگاه خروجی",
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
"tabAudio.start": "将标签页或窗口的声音共享到语音频道(戴耳机可避免回声)",
|
||||
"tabAudio.stop": "停止共享声音",
|
||||
"tabAudio.noAudio": "没有共享声音。请在选择窗口中选择标签页或窗口,并开启其声音。",
|
||||
"tabAudio.silent": "共享的声音已静音 5 秒。使用“系统音频”时,浏览器只录制 Windows 默认播放设备;在其他设备上播放的音乐不会被传送。",
|
||||
"toolbar.muteSound": "关闭声音(拒听)",
|
||||
"toolbar.unmuteSound": "开启声音(取消拒听)",
|
||||
"toolbar.chooseOutputDevice": "选择输出设备",
|
||||
|
||||
+7
-1
@@ -63,6 +63,8 @@ export class MicCapture {
|
||||
private merger: ChannelMergerNode | null = null;
|
||||
private extra: MediaStreamAudioSourceNode | null = null;
|
||||
private pendingExtra: number[] = [];
|
||||
/** Loudest extra-source sample since setExtraAudio(), to spot a silent share. */
|
||||
extraPeak = 0;
|
||||
private processor: ScriptProcessorNode | null = null;
|
||||
private silence: GainNode | null = null;
|
||||
private monitorTarget: AudioNode | null = null;
|
||||
@@ -162,7 +164,10 @@ export class MicCapture {
|
||||
// it (it isn't an echo of anything).
|
||||
if (this.extra) {
|
||||
const extra = event.inputBuffer.getChannelData(1);
|
||||
for (let i = 0; i < extra.length; i++) this.pendingExtra.push(extra[i]);
|
||||
for (let i = 0; i < extra.length; i++) {
|
||||
this.pendingExtra.push(extra[i]);
|
||||
this.extraPeak = Math.max(this.extraPeak, Math.abs(extra[i]));
|
||||
}
|
||||
}
|
||||
while (this.pending.length >= FRAME_SAMPLES) {
|
||||
const frame = this.pending.splice(0, FRAME_SAMPLES);
|
||||
@@ -191,6 +196,7 @@ export class MicCapture {
|
||||
this.extra?.disconnect();
|
||||
this.extra = null;
|
||||
this.pendingExtra = [];
|
||||
this.extraPeak = 0;
|
||||
if (stream && this.merger) {
|
||||
this.extra = this.context.createMediaStreamSource(stream);
|
||||
this.extra.connect(this.merger, 0, 1);
|
||||
|
||||
Reference in new issue
Block a user