CameraView fix for iOS: orientation and video recording#3167
Merged
TheCodeTraveler merged 15 commits intoCommunityToolkit:mainfrom Apr 2, 2026
Merged
CameraView fix for iOS: orientation and video recording#3167TheCodeTraveler merged 15 commits intoCommunityToolkit:mainfrom
TheCodeTraveler merged 15 commits intoCommunityToolkit:mainfrom
Conversation
2 tasks
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves iOS CameraView behavior by centralizing orientation configuration for photo/video capture and refining video recording resource management to prevent post-recording crashes.
Changes:
- Centralizes photo/video orientation configuration via a new
ConfigureAVCaptureConnection()helper (iOS 17+ rotation coordinator; iOS ≤16 accelerometer fallback). - Simplifies iOS video recording by reusing the existing camera input and only adding/removing recording-specific resources (
audioInput,videoOutput). - Adds lifecycle cleanup for rotation coordinator and motion manager resources in
Dispose().
…os' into fix/camera-update-ios
Collaborator
|
Thanks @zhitaop! Could you take a second to review CoPilot's recommendations and implement the fix if you deem it appropriate? |
Contributor
Author
|
Hi @TheCodeTraveler, I've reviewed Copilot's feedback and implement the fix accordingly. |
TheCodeTraveler
previously approved these changes
Apr 2, 2026
Collaborator
TheCodeTraveler
left a comment
There was a problem hiding this comment.
Thanks @zhitaop!!
6 tasks
matt-goldman
pushed a commit
to matt-goldman/Maui-1
that referenced
this pull request
Apr 2, 2026
…lkit#3167) * CameraView update for iOS: orientation, video recording * Address Copilot review * Update mirroring handle * Address Copilot review * Reduce scope of `OnLoaded` and `IsInitialized` * Use `ICommand` for `StopCameraPreviewCommand` * Refactor `TryConfigureAVCaptureConnection` * Update CameraManager.windows.cs * Update CameraManager.macios.cs * Update XML docs * `dotnet format` --------- Co-authored-by: Brandon Minnick <13558917+TheCodeTraveler@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of Change
This PR fixes a bug on iOS where camera preview is stopped after video recording, and attempting to capture an image would crash the app. This is done by fixing video recording clean up logic so only recording-specific resources (
audioInput,videoOutput) are added and removed.Simplifies video recording session management by removing the separate video input and reusing the existing capture input
Improves iOS camera orientation handling for both photo capture and video recording. Centralized orientation handling logic in
ConfigureAVCaptureConnection():AVCaptureDeviceRotationCoordinatoron iOS 17+CMMotionManageron iOS 16 and belowLinked Issues
PR Checklist
approved(bug) orChampioned(feature/proposal)mainat time of PRAdditional information