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 'screen' to systemPreferences.getMediaAccessStatus() #20764
Conversation
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.
What is the proposed behavior / use case of this API for the failure / false case?
What can an app do when this returns false that it couldn't do before? What additional information does this provide that a rejected get media promise doesn't?
Is a boolean the right return value for this API? Can we capture the difference between "screen capture allowed", "screen capture denied", and "screen capture permission not yet requested"? (Assuming the latter is a possible situation, I'm not too familiar with the Catalina APIs.) Even if that's not yet possible, it might be a good idea to leave the door open to more than 2 states in the future. |
The getUserMedia promise is currently resolves if permissions aren't granted (at least on 7.x.x, I haven't tried on 8.x.x). The stream captures the user's background and the first frame of the app which initiated the capture and will capture the cursor's movement. That said, getUserMedia rejecting if the permission isn't granted would make more sense.
Currently there are no proper apis in Catalina to determine the state of the screen capture permission. The code referenced by this PR uses a heuristic to determine if the permissions have been granted or not. |
83cc176
to
ecf0a91
Compare
ecf0a91
to
594bb6e
Compare
594bb6e
to
ef5a0ea
Compare
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.
approving again following changes and API-WG consensus!
Release Notes Persisted
|
I was unable to backport this PR to "8-x-y" cleanly; |
Could this change be backported to 7-x-y as well so it can be used in an already stable version of electron? I believe the changes used here were present in chromium 77 |
Could this change be back ported to 4-2-x branch as well ? Thx! |
Description of Change
Adding
screen
tosystemPreferences.getMediaAccessStatus()
as macOS 10.15 Catalina requires consent for capturing the screen contents. Related to #20242.This permission can only be granted manually in the System Preferences. Therefore
systemPreferences.askForMediaAccess()
cannot be extended in the same way.Checklist
npm test
passesRelease Notes
Notes: Added
screen
tosystemPreferences.getMediaAccessStatus()
for detecting the new macOS Catalina permissions.