electron: [Bug]: desktopCapturer.getSources does not get Electron

Preflight Checklist

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)

Most upvoted comments

We’ve found a workaround that allows us to record our own electron window by using webContents.getMediaSourceId instead of desktopCapturer.getSources.

We’ve found a workaround that allows us to record our own electron window by using webContents.getMediaSourceId instead of desktopCapturer.getSources.

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)