4.4 KiB
0.1.2 audio devices: root cause, fix and evidence
Reported symptom
Settings → Audio listed only "System default device" for both microphone and output (user report, Windows 11, TeamsPeach 0.1.1).
Root cause (observed, real Electron, no fake-media flags, no capture)
Electron 44 calls the session permission check handler during enumerateDevices() with:
{ permission: "media", requestingOrigin: "app://teamspeach/", mediaType: "audio" | "video", securityOrigin: "app://teamspeach/" }
{ permission: "speaker-selection", requestingOrigin: "app://teamspeach/" }
The 0.1.1 handler compared requestingOrigin with "app://teamspeach" (no trailing slash), so every check
was denied. Chromium then redacts the device list to one entry per kind with empty deviceId/label, and
the renderer dropped entries with empty ids, leaving only the default option.
Fix
app/main/permissions.js: origins are parsed with WHATWGURLand rebuilt asprotocol//host(the WHATWG origin of a non-special scheme is"null"); inputs with credentials, backslashes or no host never match. Checks allowmediaonly formediaType === "audio"andspeaker-selection, for the app origin only; requests allow audio-onlygetUserMedia. Camera stays denied. Tests:test/permissions.test.js(observed arguments, lookalike originsapp://teamspeach@evil/,app://teamspeach.evil/,app://teamspeach\@evil/,app://user:pass@teamspeach/,apps://teamspeach/,app:teamspeach).app/renderer/js/audio/devices.js: default/communications aliases fold into one "system default ()" entry; an unnamed device keeps its real id with an honest label; a saved but absent device stays selectable and is marked missing. Tests:test/devices.test.mjs.- Settings and the new right-click menus on the footer microphone/headphones buttons share one path
(
voice.deviceChoices,chooseInputDevice,chooseOutputDevice). A choice is applied only after it was saved.
OS inventory (read-only, same machine)
6 capture endpoints (MiniFuse 4 Mic/Line/Inst 1-2 = default, Loopback Mix, Line 3-4, Oculus headset mic, DroidCam, Virtual Desktop) and 6 render endpoints (MiniFuse Main L/R = default, Virtual L/R, Aux L/R, Realtek Digital Output, LG ULTRAGEAR, Oculus).
Runtime evidence (runtime/2026-10-24-audio-devices/)
Real devices, no fake-media flags, disposable profiles, never connected, microphone never opened.
| Run | Result |
|---|---|
result-settings.json, 60/61 png (dev tree) |
6 inputs + 6 outputs with names; capturing=false, framesSent=0, disconnected; a non-default input and output persist across restart; no error toasts |
result-menus.json, 62/63 png (dev tree) |
right-click on the microphone opens the input menu without muting; the choice shows in Settings; Shift+F10 + arrows + Escape on headphones restores focus without deafening; left click still mutes; choices persist across restart; with enumeration slowed to 600 ms, rapid microphone → headphones requests leave exactly one (output) menu, and a dismissal before the result leaves no menu and does not steal focus |
packaged-41e90fb/ (packaged dist/win-unpacked/TeamsPeach.exe, core 0.1.2) |
same settings and menu results as above |
The UI strings in these captures are the Russian UI of that build and are kept as recorded.
Capture lifecycle
AudioEngine.startCapture is cancelable: a stop or a newer start while getUserMedia is pending stops the
late stream's tracks immediately; voice.syncCapture always cancels when capture is not wanted.
Tests: test/audio-engine.test.mjs.
Voice diagnostics (no behaviour change)
Default log level records one line per capture start (device label, sample rate, channel count, EC/NS/AGC,
track muted) and OS mute/unmute of the track. With TEAMSPEACH_LOG=debug, push-to-talk presses (source,
window focus), each transmission burst (frames, peak dBFS) and the core's transmitting state are logged.
The push-to-talk hint states when the window is unfocused (the key is read only in the focused window).
Not proven
That the official TeamSpeak 6 client hears TeamsPeach voice is not verified. The user's 0.1.1-era logs show a connection and an opened microphone, but no burst logging existed then. The pending check is user-controlled: hold the in-window push-to-talk button (or F8 with TeamsPeach focused) while the official client listens. Synthetic two-TeamsPeach voice tests (fake capture, empty channel) pass and are not hardware proof.