diff --git a/web/src/App.tsx b/web/src/App.tsx index 09a02f3..5c8cfed 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -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 = () => { diff --git a/web/src/locales/de.json b/web/src/locales/de.json index 7a32005..a48b61a 100644 --- a/web/src/locales/de.json +++ b/web/src/locales/de.json @@ -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", diff --git a/web/src/locales/en.json b/web/src/locales/en.json index e99e551..1a3de93 100644 --- a/web/src/locales/en.json +++ b/web/src/locales/en.json @@ -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", diff --git a/web/src/locales/fa.json b/web/src/locales/fa.json index 25929c9..af0289f 100644 --- a/web/src/locales/fa.json +++ b/web/src/locales/fa.json @@ -93,6 +93,7 @@ "tabAudio.start": "صدای یک زبانه یا پنجره را در کانال صوتی پخش کن (با هدفون پژواک ایجاد نمی‌شود)", "tabAudio.stop": "توقف اشتراک صدا", "tabAudio.noAudio": "صدایی به اشتراک گذاشته نشد. در پنجره انتخاب، یک زبانه یا پنجره را انتخاب و صدای آن را روشن کنید.", + "tabAudio.silent": "صدای اشتراک‌گذاشته‌شده ۵ ثانیه است که بی‌صداست. با «صدای سیستم»، مرورگر فقط دستگاه پخش پیش‌فرض ویندوز را ضبط می‌کند؛ موسیقی‌ای که روی دستگاه دیگری پخش شود منتقل نمی‌شود.", "toolbar.muteSound": "بی‌صدا کردن صدا (کر کردن)", "toolbar.unmuteSound": "فعال کردن صدا", "toolbar.chooseOutputDevice": "انتخاب دستگاه خروجی", diff --git a/web/src/locales/zh-CN.json b/web/src/locales/zh-CN.json index b6b7623..94013e9 100644 --- a/web/src/locales/zh-CN.json +++ b/web/src/locales/zh-CN.json @@ -46,6 +46,7 @@ "tabAudio.start": "将标签页或窗口的声音共享到语音频道(戴耳机可避免回声)", "tabAudio.stop": "停止共享声音", "tabAudio.noAudio": "没有共享声音。请在选择窗口中选择标签页或窗口,并开启其声音。", + "tabAudio.silent": "共享的声音已静音 5 秒。使用“系统音频”时,浏览器只录制 Windows 默认播放设备;在其他设备上播放的音乐不会被传送。", "toolbar.muteSound": "关闭声音(拒听)", "toolbar.unmuteSound": "开启声音(取消拒听)", "toolbar.chooseOutputDevice": "选择输出设备", diff --git a/web/src/voice.ts b/web/src/voice.ts index 60af81b..4f755fe 100644 --- a/web/src/voice.ts +++ b/web/src/voice.ts @@ -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);