fix: update video orientation handling in CameraView for session readiness - #64
Conversation
There was a problem hiding this comment.
Pull request overview
This PR enhances camera preview orientation handling in CameraView to dynamically adapt to device rotation. Instead of hardcoding the preview layer to portrait orientation, the code now responds to the device's current orientation state.
- Introduced
updateVideoOrientation()method to set preview layer orientation based on device orientation - Replaced hardcoded
.portraitassignments with dynamic orientation updates - Added orientation updates in
layoutSubviews()to handle rotation events
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
…rface orientation fallback
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
This pull request improves how the camera preview layer's video orientation is managed in the
CameraViewclass. Instead of always setting the orientation to portrait, the code now dynamically updates the video orientation based on the device's current orientation. This ensures the camera preview adapts correctly when the device is rotated.Camera preview orientation improvements:
.portraitvideo orientation assignments with calls to the newupdateVideoOrientation()method in session setup callbacks, enabling dynamic orientation updates. (ios/CameraView.swift) [1] [2]updateVideoOrientation()method, which sets the preview layer's video orientation according to the device's orientation, supporting portrait, landscape left/right, and upside-down modes. (ios/CameraView.swift)updateVideoOrientation()inlayoutSubviewsto ensure the preview layer orientation updates whenever the view's layout changes, such as during device rotation. (ios/CameraView.swift)