-
Notifications
You must be signed in to change notification settings - Fork 15k
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
feat: add webContents.getMediaSourceId() method #31204
Conversation
💖 Thanks for opening this pull request! 💖 We use semantic commit messages to streamline the release process. Before your pull request can be merged, you should update your pull request title to start with a semantic prefix. Examples of commit messages with semantic prefixes:
Things that will help get your PR across the finish line:
We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API looks good to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than the minor stylish thing the code looks good to me.
bump |
API LGTM |
Congrats on merging your first pull request! 🎉🎉🎉 |
Release Notes Persisted
|
* feat: add webContents.getMediaSourceId() method * fix: account for null frame_hosts in webContents.getMediaSourceId() * fix: move webContents.getMediaSourceId definition to be more organised * fix: move webContents.getMediaSourceId implementation * fix: move webContents.getMediaSourceId docs
* feat: add webContents.getMediaSourceId() method * fix: account for null frame_hosts in webContents.getMediaSourceId() * fix: move webContents.getMediaSourceId definition to be more organised * fix: move webContents.getMediaSourceId implementation * fix: move webContents.getMediaSourceId docs
* feat: add webContents.getMediaSourceId() method * fix: account for null frame_hosts in webContents.getMediaSourceId() * fix: move webContents.getMediaSourceId definition to be more organised * fix: move webContents.getMediaSourceId implementation * fix: move webContents.getMediaSourceId docs
* feat: add webContents.getMediaSourceId() method * fix: account for null frame_hosts in webContents.getMediaSourceId() * fix: move webContents.getMediaSourceId definition to be more organised * fix: move webContents.getMediaSourceId implementation * fix: move webContents.getMediaSourceId docs
* feat: add webContents.getMediaSourceId() method * fix: account for null frame_hosts in webContents.getMediaSourceId() * fix: move webContents.getMediaSourceId definition to be more organised * fix: move webContents.getMediaSourceId implementation * fix: move webContents.getMediaSourceId docs
* feat: add webContents.getMediaSourceId() method * fix: account for null frame_hosts in webContents.getMediaSourceId() * fix: move webContents.getMediaSourceId definition to be more organised * fix: move webContents.getMediaSourceId implementation * fix: move webContents.getMediaSourceId docs
Description of Change
New feature: add
webContents.getMediaSourceId()
to provide a way to get a MediaStream from a WebContents using getUserMedia.This aims to fix the issues from #22701 which was removed with #25414.
The first main issue was with claiming to be available in both the renderer and main process but only working in the renderer.
This is fixed here by moving the api from the DesktopCapturer to a method on a WebContents. This means the API can only be consumed in the main process but I think this is inline with restricting the access for the DesktopCapturer to the main process in v17.
The next issue was with the lack of access control to the caller.
This is fixed here by requiring the user of the api to pass in the web contents that the media source ID will be registered to.
This allows you to restrict access to only the web contents you trust.
Checklist
npm test
passesRelease Notes
Notes: Added
webContents.getMediaSourceId()
, can be used withgetUserMedia
to get a stream for aWebContents
.