Repository navigation
Description
Preflight Checklist
- I have read the Contributing Guidelines for this project.
- I agree to follow the Code of Conduct that this project adheres to.
- I have searched the issue tracker for a bug report that matches the one I want to file, without success.
Electron Version
40.1.0
What operating system(s) are you using?
macOS
Operating System Version
macOS Sequoia 15.2
What arch are you using?
arm64 (including Apple Silicon)
Last Known Working Electron version
35.1.2 v39.0.0-beta.3
Does the issue also appear in Chromium / Google Chrome?
No
Expected Behavior
Previously, I had used a 0px by 0px screen-capture to achieve Desktop Audio Capture on MacOS with electron. This was a two-step process (code below).
I expected this working code to continue working on upgrade from electron 35.1.2 > 40.1.0
Step 1: [NodeJS Init]
app.whenReady().then( async () => {
//...
session.defaultSession.setDisplayMediaRequestHandler((request, callback) => {
desktopCapturer.getSources({ types: ['screen'] }).then((sources) => {
// Grant access to the first screen found.
callback({ video: sources[0], audio: 'loopback' })
})
})
//...
}Step 2: [ClientSide Access]
//...
this.tryScreenAudio=()=>{
navigator.mediaDevices.getDisplayMedia({
audio: true,
video: {
width: 0,
height: 0,
frameRate: 1
}
}).then(function(stream) {
let music = this.context.createMediaStreamSource(stream);
if(this.inputNode){this.inputNode.disconnect(this.anal)}
music.connect(this.anal)
this.inputNode=music;
this.inputDevice = "DESKTOP AUDIO";
}.bind(this))
}
//...Actual Behavior
Major Bug
I can still get a desktop-capture stream after upgrade to 40.1.0. However the stream does not capture audio anymore and instead contains an audio-stream of silence. No errors are omitted, the stream can be confirmed to be playing, the audio analyzer node shows silence.
Since my app is an electron based three.js music-visualizer, this is a critical issue for my business.
Tangential New Issue
Upon update got an error in NodeJS world: [9982:0130/175946.872027:ERROR:third_party/blink/renderer/platform/video_capture/video_capture_impl.cc:598] Can't wrap SharedImage as VideoFrame. It seems we can no-longer start a 0px by 0px video stream. It'd be perhaps nice if there was some escape hatch to not immediately wrap a video stream as GPU texture to avoid this error?
This error has a pretty easy work-around, was able to simply do a 4px X 4px capture and all errors vanished:
Workaround Configuration
//...
navigator.mediaDevices.getDisplayMedia({
audio: true,
video: {
width: 4,
height: 4,
frameRate: 1
}
})
//...Testcase Gist URL
Additional Information
Linked is a gist which demonstrates the issue:
- The nodejs setup for a desktop-capture stream.
- Minimal page to display the frequency bin volumes of an audio analyzer.
- The clientside setup to start a 4px X 4px Desktop Capture stream. This stream is connected to an audio-analyzer and the page is updated to show frequency bin volume data via basic
requestAnimationFrameloop.
Conveniently, if you run this fiddle with electron 35.1.2 it works fine and if you run it with electron 40.1.0 you can see the desktop audio stream is broken (insert joke about silent failure). Here is a video where I run the fiddle on both electron versions (YouTube Link b/c vid too large for GitHub embed):
Debug Notes:
- When you run the fiddle, macOS will prompt you to give
desktop video & audio capture permissionto the Electron-Fiddle application. After granting the permissions, it'll prompt you to restart the Electron Fiddle application so the new permissions can take effect. - Probably obvious but don't forget to actually have some audio playing during your test. Since it is desktop-capture the audio can be playing from any application.
Relevant macOS desktop audio historical note:
- For a long time, desktop-audio capture was not possible on macOS due to OS Limitation. You may encounter outdated sources which erroneously claim this but in macOS 13 Ventura Apple introduced methods to properly capture Desktop Audio (w/o signed kernel extension). Major applications like OBS also cite this introduced capability of being able to achieve desktop audio via desktop capture with macOS 13 Ventura and onward.
Appreciate your consideration and assistance, put a lot of work into serving this information up in a cohesive way and feel free to reach out with questions. I'll continue to add additional information I discover to this issue. Sorry to drop an issue over the weekend!
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fields👍 Does Not Block Stable

Activity
Bug-Reaper commentedon Feb 1, 2026
Did a more proper back-test today
Desktop stream audio capture:
✅ : works fine in
38.8.0❌ : is broken in
39.0.0.Further tests and the last true version where desktop audio capture worked was
v39.0.0-beta3.Looking back on the release notes of
v39.0.0-beta4I don't see any standout suspect. I may start digging into the code-changes or pin to v39.0.0-beta3 until I hear back from maintainers.Bug-Reaper commentedon Feb 1, 2026
I reviewed code changes in identified version jump where bug appears
v39.0.0-beta.3...v39.0.0-beta.4.I think bug maybe introduced in this change which adjusts DesktopCapture to prefer a generic capturer to fix an issue on Linux with pipewire. My suspicion is that change results in the unwanted side-effect which causes DesktopCapturer to not capture audio on macOS.
If so, I think a simple adjustment to this patch file with some OS-flag based conditional could easily fix this bug. I have an updated patch file to test but my attempts to install the build tools have not been fruitful.
My
e init ...command died after like 6 hrs`e init` Error Crash
Will hopefully try again tomorrow. I've been using electron for so many years now and it'd be great to be able to upstream fixes more actively 🤞
nikwen commentedon Feb 1, 2026
Thanks for debugging and describing the issue in so much detail!
The patch that you linked to was last changed during #48307, which is in the range you mentioned.
The patch being updated likely means that something changed upstream in Chromium that required us to change the patch that we have for it. Thus, it might also be worth to grep the upstream Chromium changes from that PR for any changes related to that part of the code.
Appreciate you looking into this. We are always happy about PRs. :)
The
e initerror is weird. It definitely shouldn't take 6 hours to fail. Do you have any local certs installed that might be causing this?Bug-Reaper commentedon Feb 1, 2026
Per Feedback
Glad to assist and thank you for the additional insight!
After a better review today I am less suspect of this specific patch file. Looks unlikely it's introducing the bug here downstream.
Is possible to build electron with arbitrary minor chromium versions to narrow in the range upstream? That'd be convenient but I'm unsure if the patch-ed nature of this build allows for it.
Have started to dig into the upstream chromium changes a bit. Lots of stuff, hard to tell what may be relevant. I'm also looking into exactly the way electron
desktopCapturerbinds to chromium features. Ideally I'd like to narrow down exactly what upstream.c/.hfiles are interacted with so I can focus in on changes to those specific files upstream.Ongoing build tool battle
Resolved my cert issue by refreshing the python managed certificates:
/Applications/Python\ 3.11/Install\ Certificates.commandIt seems like the first run of
notgommaalso stalls out the init (the very first time). Was prompted to give notgomma github access permissions which I did but the init execution never continued. Subsequent run had an interactive notgomma permission link and continued running after I followed it.Log where notgomma stalled (first run)
Thanks!
Awesome! I really appreciate the welcome atmosphere! If the stars align for me this week perhaps maybe I can get a CL and PR
Bug-Reaper commentedon Feb 2, 2026
Of potential interest this cl. Occurs in the target range and deals with how edge-cases for audio-streams are handled on macOS.
If my
e init ...completes by tomorrow I'll be able to do some cool chromium X electron black magic to test further.nikwen commentedon Feb 2, 2026
It's hard to do arbitrary Chromium versions because we patch Chromium. Then you'll need to adjust the patches every time you change the Chromium version. Not impossible, but harder than the alternatives.
If you don't know it yet, https://source.chromium.org is the best way to navigate the Chromium source code.
You can then use the "History" tab at the bottom to view changes to each file (or to whole directories).
If you want to see which commit caused this issue, you can revert any commits made to these directories individually in your
/path/to/electron/srcdirectory.Bug-Reaper commentedon Feb 2, 2026
Yea that makes total sense. On the topic of simpler alternatives, had good idea to enable chromium loggin via:
and my initial tests have yielded some promising leads. Like here where we see
CatapAudioInputStreamfailing to handleloopback.[39940:0202/162733.038664:VERBOSE1:content/browser/renderer_host/media/media_stream_manager.cc:1555] CatapAudioInputStream::CatapAudioInputStream({device_id=loopback}, {default_device=[BuiltInSpeakerDevice]}, {params=[format: PCM_LOW_LATENCY, channel_layout: 3, channels: 2, sample_rate: 48000, frames_per_buffer: 960, effects: NONE, mic_positions: , latency_tag: LatencyUnknown]}) [id=FD338407CBF72157BFEA0E9F4497D30C] [39940:0202/162733.038673:VERBOSE1:content/browser/renderer_host/media/media_stream_manager.cc:1555] AMB::MakeAudioInputStream => (number of streams=1) [id=FD338407CBF72157BFEA0E9F4497D30C] [39940:0202/162733.038680:VERBOSE1:content/browser/renderer_host/media/media_stream_manager.cc:1555] CatapAudioInputStream::Open => deviceId: loopback [id=FD338407CBF72157BFEA0E9F4497D30C] [39940:0202/162733.038690:VERBOSE1:content/browser/renderer_host/media/media_stream_manager.cc:1555] CatapAudioInputStream::Open => Error when probing audio tap permissions. [id=FD338407CBF72157BFEA0E9F4497D30C] [39940:0202/162733.038698:VERBOSE1:content/browser/renderer_host/media/media_stream_manager.cc:1555] CatapAudioInputStream::Close => deviceId: loopback [id=FD338407CBF72157BFEA0E9F4497D30C] [39940:0202/162733.038712:VERBOSE1:content/browser/renderer_host/media/media_stream_manager.cc:1555] CatapAudioInputStream::Stop [id=FD338407CBF72157BFEA0E9F4497D30C]Log Comparison Working vs Broken Version
The logs trails for both have perfect parity in a lot of successful setup for
Desktop Audio Capturethen diverge like so:When we start
local audio devicefor our desktop audio capture stream.In 39.0.0-beta.3:
In 39.0.0-beta.4
Logs (Director's Cut)
Success (v39.0.0-beta.3)
Fail (v39.0.0-beta4)
Of some note, we never hit
audio_loopback_input_mac_impl.mmin the broken flow.In other good news, my
e init ...finished successfully today, so hopefully next time I have something more tangible to share.9 remaining items
Bug-Reaper commentedon Feb 5, 2026
Really tricky issue because it fails silently and acts like it did succeed. @nartmadi You should be able to include this in your electron js file early on near where you import all the electron libs:
Bug-Reaper commentedon Feb 5, 2026
Kind of a big turn of events. So just to summarize the current status of things. The issue is half downstream, half upstream.
Upstream Issue
CoreAudio Tapa new API from Apple for audio capture. In fact they make it the default.Screen & System Audio Recording.CoreAudio TapAPI from Apple has no way to query the permission state.CoreAudio Tapwas successful by probing the created stream. However, there is no fallback to use the old method if it fails.CoreAudio Tapdoes not rely on the permissions tied toScreen & System Audio Recordingand instead wants apps to add a newly introducedinfo.plistfile entryNSAudioCaptureUsageDescription.So if you have a chromium app with proper permissions granted for
Screen & System Audio Recording. It still tries to use the new system first and if you don't have thatinfo.plistpermission it fails and doesn't fallback to the old system you do have permission for.We can imagine chromium doesn't want this behavior but also let's not forget Apple made it very annoying to provide a fallback b/c you cannot query the current permission for the new API.
Anyways all this leads to is:
Downstream Issue(s)
Apple kinda quietly rolled out this new api for audio capture and didn't do a good job communicating to downstream developers. Particularly impacted are tools like terminals, code-playgrounds & IDEs. These tools have user code running underneath them and thus need to have the proper
info.plistentry themselves to support people developing with Apple's new audio capture API.A big problem is you never really need to update your app's info.plist file. You configure it once when you build your app for the first time and then never interact with it unless you're adding some new. There's a big eco-system of tools that do not have this new
NSAudioCaptureUsageDescriptionentry in their.plistand most of them are probably not aware a change needs to occur.I've shot off some PRs tonight to tools where this lack of permission impacts me and development of my app. I anticipate to send off some more tomorrow.
For electron specifically @nikwen I also plan to add some warnings about
NSAudioCaptureUsageDescriptionsimilar to how we handle it in a few other places. The screenCapture page also has some doc bumps I'd like to make.nikwen commentedon Feb 5, 2026
Thank you so much for finding this, @Bug-Reaper! Truly amazing work! 🙌
Your ideas sound great. I think it would be great to also add a line to the Electron 39 release blog post.
👻 : Add Support For Use of Apple's New API - Core Audio Tap API `CATa…
nartmadi commentedon Feb 6, 2026
Thank you, @Bug-Reaper!
fix: update `desktopCapturer` docs to explain macOS version caveats
fix: update `desktopCapturer` docs to explain macOS version caveats
fix: update `desktopCapturer` docs to explain macOS version caveats
blog: Adds breaking change around `desktopCapturer` incurred by upstr…
Bug-Reaper commentedon Feb 9, 2026
Appreciate the assistance from maintainers all-around here. I'm close to closing this issue.
Hope you guys had a good weekend, I got these PRs out for the electron ecosystem:
Docs PR - Proud of this doc update - it gets the
desktopCapturerdocumentation back up to current on the macOS side of things. Also includes that note in the Electron 39 Blog @nikwen 👍.Config Bump PR - Seemed sensible to bump the
Info.plisthere to include the new relevant permission required for Electron'sdesktopCapturer.Also of note, fiddle has been upgraded 🎉 along with some downstream fixes in VSCode & Ghostty :)
What's Next
After I see the docs changes merged, I plan to close the issue as resolved here.
There's an upstream fix where chrome could either:
Given chromium already detects failed
CoreAudio Tap APIstreams by default. I think I may try to CL the former in. If I don't get around to it in ~1month or so I may just put up an issue up so that upstream is aware.👋 I'm a solo developer with limited resources but I do love to contribute to opensource software whenever I can. If you're interested in supporting me checkout my music visualizer app SoundSafari, For $2.99 a month you can support me and you get a cool app out of it.
nikwen commentedon Feb 9, 2026
Thank you so much for your work on this!
That would be awesome!
fix: updated blog 39.0.0 to include breaking change in `desktopCaptur…
Bug-Reaper commentedon Feb 22, 2026
Docs are up to date https://www.electronjs.org/docs/latest/api/desktop-capturer 🎉
And the PRs are merged
desktopCapturerwebsite#1010CoreAudio Tap APIfor audio capture used in electron'sdesktopCapturer(🍏 macOS). #49717Closing out this Issue, we've resolved all the downstream actionables. Still plan to follow up on this upstream on the chromium end, will edit this comment if/when I do.
We got em on this one ✌️
Buy me a coffee (or in this case sub to my app)
fix: real macOS system-audio loopback capture for the sample recorder