Skip to content

Conversation

@pushpender-singh-ap
Copy link
Owner

@pushpender-singh-ap pushpender-singh-ap commented Nov 25, 2025

This pull request improves how the camera preview layer's video orientation is managed in the CameraView class. 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:

  • Replaced hardcoded .portrait video orientation assignments with calls to the new updateVideoOrientation() method in session setup callbacks, enabling dynamic orientation updates. (ios/CameraView.swift) [1] [2]
  • Added the 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)
  • Invoked updateVideoOrientation() in layoutSubviews to ensure the preview layer orientation updates whenever the view's layout changes, such as during device rotation. (ios/CameraView.swift)

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 .portrait assignments 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.

@pushpender-singh-ap pushpender-singh-ap requested review from Copilot and removed request for Copilot November 25, 2025 09:18
Copilot finished reviewing on behalf of pushpender-singh-ap November 25, 2025 09:20
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@pushpender-singh-ap pushpender-singh-ap requested review from Copilot and removed request for Copilot November 25, 2025 09:30
Copilot finished reviewing on behalf of pushpender-singh-ap November 25, 2025 09:33
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@pushpender-singh-ap pushpender-singh-ap merged commit 88b48dd into main Nov 25, 2025
6 checks passed
@pushpender-singh-ap pushpender-singh-ap deleted the fix/62 branch November 25, 2025 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CameraView shows flipped/rotated camera image in landscape mode on iOS

1 participant