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

[Bug]: On macOS, desktopCapturer.getSources promise does not resolve nor reject unless user grants permissions #42143

Open
3 tasks done
AlexSchwabauer opened this issue May 13, 2024 · 0 comments
Labels
29-x-y 30-x-y 31-x-y bug 🪲 component/desktopcapturer has-repro-gist Issue can be reproduced with code at https://gist.github.com/ platform/macOS status/confirmed A maintainer reproduced the bug or agreed with the feature

Comments

@AlexSchwabauer
Copy link

Preflight Checklist

Electron Version

29.3.1

What operating system are you using?

macOS

Operating System Version

macOS Sonoma 14.4.1 (23E224)

What arch are you using?

arm64 (including Apple Silicon)

Last Known Working Electron version

29.0.1

Expected Behavior

When using desktopCapturer.getSources({ types: ["screen"] }) on macOS Sonoma, the returned promise should immediately resolve/reject when no permissions are given.

Actual Behavior

desktopCapturer.getSources({ types: ["screen"] }) correctly prompts a system permission dialog and adds the Electron app to the permissions list if not already present. However, the promise returned by the function call does not terminate unless the user enables the permission switch in the settings page. This causes the app to deadlock if the user decides not to grant the permission, as the promise never resolves (nor rejects).

Testcase Gist URL

https://gist.github.com/AlexSchwabauer/1de7f7d737d7826a53e6429045dc77c3

Additional Information

Running the test case from the gist on electron v29.0.1, the promise will immediately resolve and output the log from the finally branch.
On v29.1.0 and above, the promise will never resolve, unless the user checks the permission switch in the system settings.
Looking at the release notes of 29.1.0, it seems that this MR is related:
use ScreenCaptureKit exclusively on macOS 14.4 and higher

@electron-issue-triage electron-issue-triage bot added 29-x-y has-repro-gist Issue can be reproduced with code at https://gist.github.com/ labels May 13, 2024
@codebytere codebytere added status/confirmed A maintainer reproduced the bug or agreed with the feature component/desktopcapturer 30-x-y 31-x-y platform/macOS labels May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
29-x-y 30-x-y 31-x-y bug 🪲 component/desktopcapturer has-repro-gist Issue can be reproduced with code at https://gist.github.com/ platform/macOS status/confirmed A maintainer reproduced the bug or agreed with the feature
Projects
Status: 👍 Does Not Block Stable
Status: 👍 Does Not Block Stable
Development

No branches or pull requests

2 participants