Status Update
Comments
wu...@google.com <wu...@google.com> #2
sc...@google.com <sc...@google.com> #3
Great! Thanks a lot, I'll look for the live updates soon!
sh...@gmail.com <sh...@gmail.com> #4
I've tried that as well, but didn't worked.
ra...@gmail.com <ra...@gmail.com> #5
ra...@gmail.com <ra...@gmail.com> #6
sc...@google.com <sc...@google.com> #7
Please try the the snippet below. It should work.
cameraController.getInitializationFuture().addListener({
cameraController.bindToLifecycle(activity)
cameraController.setZoomRatio(1.5f)
// The following codes are needed if you want to keep the zoom ratio 1.5x after stop/start the activity or fragment.
cameraController.cameraInfo!!.cameraState.removeObservers(activity)
cameraController.cameraInfo!!.cameraState.observe(activity) {
if (it.type == CameraState.Type.OPEN || it.type == CameraState.Type.OPEN) {
cameraController.setZoomRatio(1.5f)
}
}
}, ContextCompat.getMainExecutor(applicationContext))
+Xi to see if there is a better approach.
xi...@google.com <xi...@google.com>
xi...@google.com <xi...@google.com>
xi...@google.com <xi...@google.com>
xi...@google.com <xi...@google.com>
sh...@gmail.com <sh...@gmail.com> #8
The above solution is working as expected. Thanks!
ap...@google.com <ap...@google.com> #9
Branch: androidx-main
commit 19a88266d210181cd3ee7fa742eebdb4d57a678b
Author: Xi Zhang <xizh@google.com>
Date: Wed Jan 04 10:38:27 2023
Cleanup: remove unused code in CameraController.
The Display object and the TapToFocusStates annotation are no longer used.
Bug: 264157663
Test: manual test and ./gradlew bOS
Change-Id: I4d20d52e6e0e7bac1ae5e7cce3d358f24800c024
M camera/camera-view/src/androidTest/java/androidx/camera/view/PreviewViewDeviceTest.kt
M camera/camera-view/src/main/java/androidx/camera/view/CameraController.java
M camera/camera-view/src/main/java/androidx/camera/view/PreviewView.java
ap...@google.com <ap...@google.com> #10
Branch: androidx-main
commit 0a95adb75d68ecc43e27640e913ee876193b9b09
Author: Xi Zhang <xizh@google.com>
Date: Wed Jan 04 11:49:16 2023
Cleanup: create a wrapper interface for ProcessCameraProvider for injecting dependencies in unit tests.
It's hard to fake ProcessCameraProvider in unit tests. This CL creates a wrapper interface for ProcessCameraProvider so that it can be faked. This allows us to test initialization related code with unit tests.
- Create a ProcessCameraProviderWrapper with all the methods needed by CameraController.
- Create a ProcessCameraProviderWrapperImpl that wraps the real object.
- Add two tests for delayed initialization.
Bug: 264157663
Test: manual test and ./gradlew bOS
Change-Id: I1848135d58550ee1f1628f50075fff73e42896e5
M camera/camera-view/src/main/java/androidx/camera/view/CameraController.java
M camera/camera-view/src/main/java/androidx/camera/view/LifecycleCameraController.java
A camera/camera-view/src/main/java/androidx/camera/view/ProcessCameraProviderWrapper.java
A camera/camera-view/src/main/java/androidx/camera/view/ProcessCameraProviderWrapperImpl.java
M camera/camera-view/src/test/java/androidx/camera/view/CameraControllerTest.kt
A camera/camera-view/src/test/java/androidx/camera/view/FakeProcessCameraProviderWrapper.kt
xi...@google.com <xi...@google.com>
ap...@google.com <ap...@google.com> #11
Branch: androidx-main
commit 1bd96bc31127f262b206dcf15b3897b79dc5a039
Author: Xi Zhang <xizh@google.com>
Date: Fri Jan 06 09:58:01 2023
In CameraController, allow setting CameraControl values before init
Save pending values and wait for the init to complete before setting them.
- Create a PendingValue class. This represents a pending CameraControl value set before init.
- In CameraController, if setting CameraControl values before init, set the PendingValue instead.
- In CameraController, once init completes, propagate the pending values. If init/bindToLifecycle fails, no-op and continue to wait.
- Updated FakeCameraControl to track the latest zoom and torch values.
Relnote: when setting torch/zoom prior before camera initialization compelets, e.g. calling CameraController#enableTorch, the pending action is cached and submitted once the initialization compeltes.
Bug: 264157663
Test: manual test and ./gradlew bOS
Change-Id: I11e926246983a760b0e65652abe89c67f6434cff
M camera/camera-testing/src/main/java/androidx/camera/testing/fakes/FakeCamera.java
M camera/camera-testing/src/main/java/androidx/camera/testing/fakes/FakeCameraControl.java
M camera/camera-view/src/main/java/androidx/camera/view/CameraController.java
A camera/camera-view/src/main/java/androidx/camera/view/PendingValue.java
M camera/camera-view/src/test/java/androidx/camera/view/CameraControllerTest.kt
M camera/camera-view/src/test/java/androidx/camera/view/FakeProcessCameraProviderWrapper.kt
A camera/camera-view/src/test/java/androidx/camera/view/PendingValueTest.kt
pr...@google.com <pr...@google.com> #12
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.camera:camera-view:1.3.0-alpha03
sh...@gmail.com <sh...@gmail.com> #13
Just wanted to let know that the solution in
sh...@gmail.com <sh...@gmail.com> #14
Hi, I checked the above commits and you should do same for exposure controlling. Because it also affects while setting exposure initially.
xi...@google.com <xi...@google.com> #15
Thanks for the feedback CameraController
does not support setting exposure.
sh...@gmail.com <sh...@gmail.com> #16
In the coming future, can we expect all the methods of CameraController
? It would be great if provided.
[Deleted User] <[Deleted User]> #17
Can you tentatively let us know when can we expect the stable release of v1.3.0? OR is it possible to cherry-pick this into a minor version of 1.2.0?
xi...@google.com <xi...@google.com> #18
Thank you for your interest. The release date is TBD. You can take a look at historical record and see how long it usually takes to reach stable. Cherry picking is for critical bugs. We have no plan cherry picking this feature.
Description
CAMERAX VERSION: 1.2.0
ANDROID OS BUILD NUMBER: Android 13
DEVICE NAME: Realme X7 Pro
DESCRIPTION:
I was trying basic CameraX implementation with MLKit Barcode scanning analyzer ( as in this sample ). I wanted to have zoom ratio of does not work right after calling
1.5f
to start Camera preview with. So callingsetZoomRatio()
previewView.controller = cameraController
. But it works when called right afterPreviewView
's state is inSTREAMING
. But then, it doesn't look like a good UX that it starts camera with 1x and suddenly starts with some another zoom ratio.Can I initialize CameraX with predefined zoom before preview starts?