Skip to content

feat: use window DesktopMediaID when no source ID specified OS-15494#144

Open
t-bashir-bs wants to merge 1 commit into
28-x-y-bsfrom
tbashir/28-x-y-bs-desktop-sharing-OS-15494
Open

feat: use window DesktopMediaID when no source ID specified OS-15494#144
t-bashir-bs wants to merge 1 commit into
28-x-y-bsfrom
tbashir/28-x-y-bs-desktop-sharing-OS-15494

Conversation

@t-bashir-bs

Copy link
Copy Markdown

Description of Change

When getUserMedia is called with chromeMediaSource: 'desktop' but no chromeMediaSourceId, the fallback of TYPE_SCREEN with kFullDesktopScreenId (-1) hangs indefinitely on ozone/wayland + nexus.

Instead, look up the NativeWindow for the requesting WebContents via NativeWindowRelay and use its GetDesktopMediaID(), which returns a TYPE_WINDOW ID. This is the same ID returned by BrowserWindow.getMediaSourceId() and works correctly on all platforms including ozone/wayland + nexus.

The TYPE_SCREEN/-1 path is retained as a fallback for cases where no NativeWindow can be found.

Checklist

Release Notes

Notes:

When getUserMedia is called with chromeMediaSource: 'desktop' but no
chromeMediaSourceId, the fallback of TYPE_SCREEN with kFullDesktopScreenId
(-1) hangs indefinitely on ozone/wayland + nexus.

Instead, look up the NativeWindow for the requesting WebContents via
NativeWindowRelay and use its GetDesktopMediaID(), which returns a
TYPE_WINDOW ID. This is the same ID returned by BrowserWindow.getMediaSourceId()
and works correctly on all platforms including ozone/wayland + nexus.

The TYPE_SCREEN/-1 path is retained as a fallback for cases where no
NativeWindow can be found.
@caneraltinbasak

Copy link
Copy Markdown

Does this mean we can't do full screen desktop capture? Have you tried this:
https://www.electronjs.org/docs/latest/api/desktop-capturer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants