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

feat: add 'screen' to systemPreferences.getMediaAccessStatus() #20764

Merged
merged 2 commits into from Nov 13, 2019

Conversation

miniak
Copy link
Contributor

@miniak miniak commented Oct 27, 2019

Description of Change

Adding screen to systemPreferences.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

Release Notes

Notes: Added screen to systemPreferences.getMediaAccessStatus() for detecting the new macOS Catalina permissions.

@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Oct 27, 2019
@miniak miniak self-assigned this Oct 27, 2019
@miniak miniak marked this pull request as ready for review October 27, 2019 11:40
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label Oct 28, 2019
Copy link
Member

@MarshallOfSound MarshallOfSound left a 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?

@nornagon
Copy link
Member

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.

@dwilson6
Copy link

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?

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.

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.

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.

docs/api/system-preferences.md Outdated Show resolved Hide resolved
@miniak miniak force-pushed the miniak/catalina-permissions branch from 83cc176 to ecf0a91 Compare November 5, 2019 08:31
@miniak miniak changed the title feat: add systemPreferences.isScreenCaptureAllowed() feat: add 'screen' to systemPreferences.getMediaAccessStatus() Nov 5, 2019
@miniak miniak force-pushed the miniak/catalina-permissions branch from ecf0a91 to 594bb6e Compare November 5, 2019 08:36
@miniak miniak force-pushed the miniak/catalina-permissions branch from 594bb6e to ef5a0ea Compare November 5, 2019 08:43
Copy link
Member

@codebytere codebytere left a 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!

@miniak miniak removed the wip ⚒ label Nov 8, 2019
@jkleinsc jkleinsc merged commit 97e2569 into master Nov 13, 2019
@release-clerk
Copy link

release-clerk bot commented Nov 13, 2019

Release Notes Persisted

Added screen to systemPreferences.getMediaAccessStatus() for detecting the new macOS Catalina permissions.

@trop
Copy link
Contributor

trop bot commented Nov 13, 2019

I was unable to backport this PR to "8-x-y" cleanly;
you will need to perform this backport manually.

@trop
Copy link
Contributor

trop bot commented Nov 13, 2019

@miniak has manually backported this PR to "8-x-y", please check out #21116

@dwilson6
Copy link

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

@CapOM
Copy link
Contributor

CapOM commented Dec 10, 2019

Could this change be back ported to 4-2-x branch as well ? Thx!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
8.2.x
Fixed in 8.0.0-beta.3
Development

Successfully merging this pull request may close these issues.

None yet

10 participants