March 29, 2025

ikayaniaamirshahzad@gmail.com

Need help with electron js application



Hi everyone,

I'm facing a persistent issue trying to capture audio output from desktop applications (or the entire screen) in my Electron app and could really use some help or insights.

Goal: Capture audio from sources like Spotify, Chrome, VLC, or the entire screen output, process it using the Web Audio API (split channels, effects), and play it back.

Problem: Both standard methods for desktop audio capture are failing on my system (windows 11):

Using getUserMedia + chromeMediaSourceId:

I get the source list (windows/screens) using desktopCapturer.getSources in the Main process (via IPC, as direct preload access failed initially).

The source list (IDs like window:XYZ:N, screen:XYZ:N) is received correctly in the Renderer.

When I call navigator.mediaDevices.getUserMedia({ audio: { mandatory: { chromeMediaSource: 'desktop', chromeMediaSourceId: source.id } }, video: false }) in the Renderer, the Renderer process crashes instantly.

The terminal shows: [PID:Timestamp:ERROR:bad_message.cc(29)] Terminating renderer for bad IPC message, reason 263 (which maps to DESKTOP_CAPTURER_INVALID_OR_UNKNOWN_ID).

This happens for all sources (specific windows like Chrome/Spotify/VLC and "Entire Screen").

Using getDisplayMedia({ audio: true }):

When I try the alternative navigator.mediaDevices.getDisplayMedia({ audio: true, video: false }) in the Renderer (with enableBlinkFeatures: 'GetDisplayMedia' enabled), the call fails immediately.

It throws a NotSupportedError: Not supported. This indicates desktop audio capture via getDisplayMedia is explicitly not supported in my Electron environment.

Troubleshooting Done:

Tested across Electron versions – problem persists.

Confirmed source ID (string) is correctly passed to getUserMedia.

Verified no non-serializable objects are sent over IPC leading up to the crash.

Implemented session permission handlers (setPermissionCheckHandler/setPermissionRequestHandler for 'media') in main.js – no change.

Removed icon/thumbnail fetching from desktopCapturer.

Temporarily disabled antivirus.

Ensured OS and drivers are up-to-date.

Confirmed the issue happens even in minimal test cases on this machine.

Conclusion:

It seems both standard Electron/Web APIs for desktop audio capture are fundamentally non-functional or incompatible with my specific system environment, leading to either an immediate crash (getUserMedia) or an explicit unsupported error (getDisplayMedia). The crash error 263 suggests an internal problem validating or using the desktop source ID within Chromium/Electron.

Has anyone encountered a similar instant renderer crash (error 263) with getUserMedia/chromeMediaSourceId, or the NotSupportedError for getDisplayMedia({ audio: true }) on windows 11?

Are there any known workarounds, specific system configurations/drivers known to cause this, or alternative methods (besides full native modules or virtual cables) to capture application audio within Electron that might bypass these issues?

Thanks in advance for any help!

submitted by /u/Fair_Illustrator_936
[comments]



Source link

Leave a Comment