electron: [Bug]: desktopCapturer.getSources does not get Electron
Preflight Checklist
- I have read the Contributing Guidelines for this project.
- #33833
- I have searched the issue tracker for a feature request that matches the one I want to file, without success.
Electron Version
12.0.0+
What operating system are you using?
Windows
Operating System Version
Windows 10 Pro build 19042.1052
What arch are you using?
x64
Last Known Working Electron version
12.0.0-beta1
Expected Behavior
desktopCapturer.getSources({ types: ['screen', 'window'], fetchWindowIcons: true });
should return every screen and visible window, including the electron window that ran it.
Actual Behavior
desktopCapturer.getSources(...);
Gets other windows, but not the Electron window that ran it.
Testcase Gist URL
https://gist.github.com/ghli2/1fac4cfeb05db557baf2bd60d9b60899
Additional Information
It worked fine 11.4.9 and before, as well as 12.0.0-beta1, but not in several versions between 12.0.0-13.1.3 that I’ve tested
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 1
- Comments: 23 (7 by maintainers)
We’ve found a workaround that allows us to record our own electron window by using webContents.getMediaSourceId instead of desktopCapturer.getSources.
Hm, possibly relevant: there’s a
add_current_process_windows
parameter to NativeDesktopMediaList that we’re not currently setting: https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/media/webrtc/native_desktop_media_list.h;l=29-31;drc=494bf1e595e8ec1560a1c18c6eb55e9851208dc1Added by https://source.chromium.org/chromium/chromium/src/+/f507c5362a3058955d21775ae039fbcbd8d69793
this worked for 19.x
This is a blocker for an update from 11 for us
It might be a race condition. I tested it again with all the versions @ghli2 tested.
Ran them all 3 or more times with the following results:
worked: 12.0.0.beta.1 (3/3) 11.4.9 (3/3) 12.0.2 (3/6 screenPicker occasionally doesn’t appear) 12.0.0 (4/5 didn’t work the first time but does afterwards)
didn’t work: 13.0.0 (0/3) 13.1.4 (0/3)