Skip to content

Feat/output rotation degrees - #4224

Draft
ismaelsousa wants to merge 4 commits into
margelo:mainfrom
ismaelsousa:feat/output-rotation-degrees
Draft

ismaelsousa wants to merge 4 commits into
margelo:mainfrom
ismaelsousa:feat/output-rotation-degrees

Conversation

@ismaelsousa

@ismaelsousa ismaelsousa commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

This pull request adds support for reporting the rotation angle (in degrees) of camera outputs on both Android and iOS. This allows consumers of the camera API to know how much the camera buffer needs to be rotated to match the desired output orientation. The change includes updates to the native modules, platform-specific output classes, and the TypeScript interface.

Rotation Degrees Support

  • Added a new rotationDegrees property to the CameraOutput TypeScript interface to expose the clockwise rotation (in degrees) needed to transform the native buffer to the target output orientation.
  • Implemented the rotationDegrees property in all relevant Android output classes (HybridPreviewOutput, HybridPhotoOutput, HybridVideoOutput, HybridFrameOutput, HybridDepthFrameOutput, HybridBarcodeScannerOutput) by reading from the platform's resolution info. [1] [2] [3] [4] [5] [6]
  • Implemented the rotationDegrees property in all relevant iOS output classes by extending AVCaptureConnection and exposing the rotation angle (iOS 17+). [1] [2] [3] [4] [5] [6] [7] [8] [9]

Android Output Orientation Handling

  • Updated HybridPreviewOutput to properly set the target rotation on the preview when outputOrientation is changed, ensuring the preview aligns with the specified orientation. [1] [2]

iOS Foundation Extension

  • Added a new Swift extension to AVCaptureConnection to expose the rotationDegrees property, using the native videoRotationAngle on iOS 17+.

These changes ensure that all camera output types consistently report their rotation angle, improving the ability to correctly orient camera frames across platforms.

Store and forward outputOrientation to Preview.targetRotation so CameraX updates ResolutionInfo for the new target orientation. This keeps resolutionInfo.rotationDegrees synchronized instead of leaving it based on the default rotation.
@vercel

vercel Bot commented Oct 18, 2026

Copy link
Copy Markdown

@ismaelsousa is attempting to deploy a commit to the Margelo Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
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.

1 participant