fix: allow camera usage when microphone permission is denied on Windows#3140
fix: allow camera usage when microphone permission is denied on Windows#3140AopBK wants to merge 9 commits into
Conversation
| } | ||
|
|
||
| var cameraPermissionStatus = await Permissions.CheckStatusAsync<Permissions.Camera>(); | ||
| if (cameraPermissionStatus == PermissionStatus.Granted) |
There was a problem hiding this comment.
We removed all permission checks from the library. It is now up to developers to request permission they need and when they need, with the way to use their own UI for user permissions.
There was a problem hiding this comment.
Thank you for the clarification.
In my PR, the CameraViewExtensions.Windows.cs only checks the permission status, but does not request or manage permissions. The actual permission requests are handled in the CameraViewPage, as expected.
@VladislavAntonyuk ,could you please advise on how to best implement this in line with the library’s current design?
For example, should I pass a parameter from the manager, or is there another approach you recommend?
There was a problem hiding this comment.
@VladislavAntonyuk How can we proceed? Can you check my comment
There was a problem hiding this comment.
Hi @VladislavAntonyuk Is there still no suggestion? We have to move forward with this topic
There was a problem hiding this comment.
I don't think we need to check for camera permission at all. For microphone permission as it is required for settings we can keep it.
There was a problem hiding this comment.
Thanks @VladislavAntonyuk . I did a second commit with you suggestion. Looking forward to your comment.
There was a problem hiding this comment.
@VladislavAntonyuk Could you please take a look and let me know what you think?
There was a problem hiding this comment.
Pull request overview
Adjusts Windows MediaCapture initialization for CameraView so camera usage can continue when microphone permission is denied, preventing UnauthorizedAccessException crashes (Issue #3139).
Changes:
- Build
MediaCaptureInitializationSettingsdynamically based on microphone permission/capability state. - Add a camera permission status check and throw a
CameraExceptionwhen not granted.
TheCodeTraveler
left a comment
There was a problem hiding this comment.
Is there a better way to fix the linked issue without using Permissions.CheckStatusAsync?
CommunityToolkit.Maui.Camera (and all MAUI Toolkit libraries) now defers all permissions requests to the developers consuming our library:
https://github.com/CommunityToolkit/Maui/releases/tag/6.0.0-camera
|
@dotnet-policy-service agree company="Bittner+Krull Softwaresysteme GmbH"
|
af24cab to
9e7e90e
Compare
9e7e90e to
7ec0b9e
Compare
|
Hey @VladislavAntonyuk! Did you get a chance to test on Windows to verify there's no popup dialog? |
VladislavAntonyuk
left a comment
There was a problem hiding this comment.
@AopBK the application crashes if microphone permission is denied. Also the app now requests microphone permission automatically on first open.
Hi @VladislavAntonyuk , |
|
@VladislavAntonyuk asking on behalf of my colleague @AopBK : Is there something we have to do here for this PR, or can it be merged? Along with my other two PRs that you recently merged it would be good if we can have all the bugfixes in one new CommunityToolkit.Maui release :-) Thanks! |
|
@MFinkBK The changes you made are not working. I see the error I shared on screenshot. |
|
@VladislavAntonyuk Ah sorry, we misunderstood your screenshot and your commit after that (switching to MSIX). We will take a look! |
|
Hello @VladislavAntonyuk, We also found that the unpackaged app can access the camera only if, in Windows Settings → Privacy & security → Camera, the option "Let desktop apps access your camera" is enabled.
|



Description of Change
The settings for initialising MediaCapture now differ depending on whether microphone permissions have been granted. This prevents the app from crashing due to an UnauthorizedAccessException.
Linked Issues
PR Checklist
approved(bug) orChampioned(feature/proposal)mainat time of PRAdditional information