[Bug]: On macOS, desktopCapturer.getSources promise does not resolve nor reject unless user grants permissions #42143
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
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
The text was updated successfully, but these errors were encountered: