Capture system/loopback audio via getDisplayMedia. In Electron, the
main-process display-media handler grants this request as a loopback audio
track (Core Audio Tap or ScreenCaptureKit on macOS, WASAPI loopback on
Windows), letting us mix the far-end of a call (e.g. Zoom) with the mic.
The primary path requests audio-only. Some macOS versions only grant loopback
alongside a video track, so on failure we retry requesting video too. We keep
(but disable) any video track because on the ScreenCaptureKit-backed path the
loopback audio is bound to that screen-capture session — stopping the video
would end the audio. We never record the video; the caller stops every track
on cleanup.
Core Audio Tap (macOS 14.2+) can hand back a dead/ended or muted loopback
track with no thrown error when the System Audio Recording permission or the
NSAudioCaptureUsageDescription Info.plist key is missing. We detect that and
throw so callers can fall back instead of silently recording silence.
Capture system/loopback audio via
getDisplayMedia. In Electron, the main-process display-media handler grants this request as a loopback audio track (Core Audio Tap or ScreenCaptureKit on macOS, WASAPI loopback on Windows), letting us mix the far-end of a call (e.g. Zoom) with the mic.The primary path requests audio-only. Some macOS versions only grant loopback alongside a video track, so on failure we retry requesting video too. We keep (but disable) any video track because on the ScreenCaptureKit-backed path the loopback audio is bound to that screen-capture session — stopping the video would end the audio. We never record the video; the caller stops every track on cleanup.
Core Audio Tap (macOS 14.2+) can hand back a dead/
endedor muted loopback track with no thrown error when the System Audio Recording permission or theNSAudioCaptureUsageDescriptionInfo.plist key is missing. We detect that and throw so callers can fall back instead of silently recording silence.