Repository navigation
feat: expose upright Preview resolution for responsive camera UIs - #4224
Open
ismaelsousa wants to merge 22 commits into
Open
ismaelsousa wants to merge 22 commits into
ismaelsousa wants to merge 22 commits into
Conversation
|
@ismaelsousa is attempting to deploy a commit to the Margelo Team on Vercel. A member of the Team first needs to authorize it. |
ismaelsousa
marked this pull request as ready for review
October 27, 2026 22:28
Contributor
Author
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.
Use AVCaptureDevice.RotationCoordinator on iOS 17 and later, creating the interface orientation manager only on older versions. Apply preview rotation updates synchronously and clean up observation on reconfiguration and deinit. Related PR: margelo#4237 Validation: VisionCamera iOS target build, Swift formatting, and git diff --check passed.
…nfiguration because does nothing anymore on android
ismaelsousa
force-pushed
the
feat/output-rotation-degrees
branch
from
October 29, 2026 18:25
fbbc46b to
30087eb
Compare
This branch has not been deployed
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

No more guessing the Preview’s upright resolution
The existing
currentResolutiondescribes the Preview stream in its native, unrotated orientation. To align UI with the image users actually see, apps have had to infer its upright size and keep resolution and rotation in sync themselves.This PR adds
onPreviewResolutionto<Camera />. It reports upright stream dimensions directly as the Preview configuration changes:upright-res-android-1.mov
upright-reso.mp4
PiP-android-1.mov
PiP.mp4
adaptative-controls.mp4
adapative-controls-android-2.mov
Same Preview, same resize mode. Using its reported upright ratio moves the frame and controls into alignment with the visible image.
Why it matters
contain.What changed
<Camera onPreviewResolution>provides upright dimensions for the common layout use case.<Camera onPreviewConfigurationChanged>exposes the complete configuration when needed.CameraPreviewOutput.currentConfigurationor subscribe throughonConfigurationChanged. Itsresolutionremains in native, unrotated pixels alongsiderotationDegrees.Compatibility
Android is supported. On iOS, upright resolution requires iOS 17.0+;
onPreviewResolutionis not called on earlier versions.Fixes #4236