-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Android preview aspect ratio #2964
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Hi - thanks for your PR, maybe I am missing something but doesn't the PreviewView automatically match the aspect ratio of other outputs? |
No, unfortunately the preview does not match the aspect ratio of the other outputs, which means that depending on the device, there can be a significant difference between the photo/video captured and what is seen in the preview at the moment of capture/recording. |
I pushed a commit that cleans up the code a bit, Otherwise that's cool - I am a bit hesitant about merging this because it differs from how iOS works (and how the formats documentation works). On iOS, the Preview View size (and aspect ratio) is always bound to the I think in practise it should be fine, but it is different behaviour now between iOS and Android. I have code in ShadowLens that finds a format with a video size where the aspect ratio matches the screen aspect ratio, and this also has the assumption that the preview view uses that aspect ratio. I have Maybe I will change this in the future to always use the |
Anyways - thank you for your contribution, LGTM!!! :) |
Thanks for the review and the modifications! It's true that I adapted the code to my test case by taking the photo format when video mode is deactivated. |
What
Currently on iOS, the previewer ratio matches the video capture ratio (or the photo ratio if video mode is disabled).
This ensures that the preview corresponds to the captured result.
The idea of this pull request is to have the same behavior on Android.
Changes
The previewer uses the resolution with the aspect ratio closest to the video capture resolution (or photo resolution if video mode is disabled).
Maybe someone has a better idea, such as adding the preview resolution to the format (but this would significantly increase the number of formats) or adding a new prop to define the previewer resolution.
Tested on