Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: disable kWindowCaptureMacV2 for desktop capturer #30507

Merged
merged 1 commit into from Aug 13, 2021

Conversation

VerteDinde
Copy link
Member

@VerteDinde VerteDinde commented Aug 11, 2021

Description of Change

Fixes #29458

When trying to screen capture an Electron application's own window, the screen will show as blank. This is because when kWindowCaptureMacV2 is enabled, the latter portion of the DesktopMediaID is incorrectly replaced. For example: the DesktopMediaID is changed from window:626:0 (correct) to window:626:626 (incorrect). Passing the incorrect id into the desktop capture API results in the window not being found, and a blank or default-colored screen.

kWindowCaptureMacV2 is already disabled by default in upstream Chromium (see here: https://chromium-review.googlesource.com/c/chromium/src/+/3069272). This PR also disables the feature by default until the upstream fix is in main. It also adds a new desktop capture test to keep the issue from happening again.

Checklist

Release Notes

Notes: Fixed an issue on Mac where an application could not capture its own window using the desktop capture or getMediaSourceId APIs.

@VerteDinde VerteDinde added semver/patch backwards-compatible bug fixes target/13-x-y labels Aug 11, 2021
@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Aug 11, 2021
@VerteDinde VerteDinde force-pushed the 29458-mac-desktop-capture-id branch 2 times, most recently from f517d38 to 78797cf Compare August 11, 2021 23:40
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label Aug 12, 2021
@VerteDinde VerteDinde merged commit a11a234 into main Aug 13, 2021
@VerteDinde VerteDinde deleted the 29458-mac-desktop-capture-id branch August 13, 2021 20:23
@release-clerk
Copy link

release-clerk bot commented Aug 13, 2021

Release Notes Persisted

Fixed an issue on Mac where an application could not capture its own window using the desktop capture or getMediaSourceId APIs.

@trop
Copy link
Contributor

trop bot commented Aug 13, 2021

I have automatically backported this PR to "13-x-y", please check out #30523

@trop
Copy link
Contributor

trop bot commented Aug 13, 2021

I have automatically backported this PR to "14-x-y", please check out #30524

@trop trop bot removed the target/14-x-y label Aug 13, 2021
@trop
Copy link
Contributor

trop bot commented Aug 13, 2021

I have automatically backported this PR to "15-x-y", please check out #30525

@bingery
Copy link

bingery commented Nov 24, 2021

is there any settings on linux, my linux electron app screenshot black screen, mac is ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver/patch backwards-compatible bug fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Black Video When getUserMedia with chromeMediaSourceId === window.getMediaSourceId()
3 participants