This repository was archived by the owner on Jul 10, 2025. It is now read-only.
Repository navigation
Bump CameraX to alpha06 - #198
Merged
Merged
Conversation
…ng() and takePicture()
…late optimal sizes for preview and capture
…ners as they now run on diffeent executors
|
You can test the changes on this Pull Request by downloading the APK here. |
…evice screen aspect ratio, given passing the enum 4:3 would make the preview stretched
…it for the VideoCapture use case configuration
Contributor
Author
|
This one should be ready for review @aforcier 🙇 |
Collaborator
|
Looks good @mzorz! Tested photo and video a Pixel 3 API29, works great. |
Collaborator
Contributor
Author
|
Yeah I've seen the stretching, it's got to do with the video player, I'll open an issue for that 👍 |
Contributor
Author
|
Opened issue #200 - also added new label to describe the component the bug belongs to. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.


Fix #197, #157
Bumps CameraX library and updates the code to cope with the breaking changes in the library, following descriptions in https://developer.android.com/jetpack/androidx/releases/camera#camera2-core-1.0.0-alpha06
UseCaseErrors to new names (437eabf)startRecording()andtakePicture()(c627519)currentFileadded given non-nullable parameter expected on CameraX's side now (4258395)On optimal resolution calculations
Original idea was to rollback #128 given the release notes for
alpha06of CameraX mention the followingbut, while we now don't calculate the optimal preview size based on current screen / camera resolution ourselves anymore in this PR (5ec8efe), a few tests on the recommended strategy of using the simplified
setTargetAspectRatio()with the enum valuesAspectRatio.RATIO_4_3andAspectRatio.RATIO_16_9have shown artifacts (stretched preview) on a Pixel 2 so, we're considering it a work in progress on the library's side for now, and leaving the code in if we need it (a9867a3).For now, we're using the screen's aspect ratio calculation in c736593 (as opposed to calculating the optimal target resolution) to indicate as a target hint on the configuration for preview, image capture and video capture, these are the tests results so far:
Using
setTargetAspectRatio(RATIO_16_9):Using
screenAspectRatio = Rational(metrics.widthPixels, metrics.heightPixels)and
setTargetAspectRatioCustom(screenAspectRatio)Given both have similar results, the second approach is a bit more flexible in that it doesn't hardcode 16:9 as the aspect ratio but rather tries to identify the current device's one and set it to it, which should be preferred.
As discussed previously, it doesn't seem worth it to pursue a perfect solution for all possibilities, but rather wait and keep the upcoming versions of the CameraX library updated (just to keep track of breaking changes and avoid having these pile up).