Assigned
Status Update
Comments
ka...@blitzz.co <ka...@blitzz.co>
wu...@google.com <wu...@google.com>
wu...@google.com <wu...@google.com> #3
Successful workaround: Kill the ADB process if it does not return within 120 seconds.
Description
Please describe your issue and include details such as the version of CameraX you are using and any relevant logs related to your issue.
// If at all possible, capture an Android logcat (
CAMERAX VERSION 1.3.1
CAMERA APPLICATION NAME AND VERSION: (CameraX Basic, 1)
ANDROID OS BUILD NUMBER: (UP1A.231005.007.E346BXXS3BXA1)
DEVICE NAME: (Samsung F34, Samsung A52, etc)
DESCRIPTION:
How to mirror font camera in preview
Is there a way to mirror the front camera in preview mode?
eg: would like to see text normal
STEPS TO REPRODUCE:
1. open app
2. flip camera
OBSERVED RESULTS: see text mirror.
EXPECTED RESULTS: would like to see text normal
REPRODUCIBILITY: (5 of 5, 100 of 100, etc)
ADDITIONAL INFORMATION: we have used for CameraX with ProcessCameraProvider.
CODE FRAGMENTS (this will help us troubleshoot your issues):
/** Declare and bind preview, capture and analysis use cases */
private fun bindCameraUseCases() {
// Get screen metrics used to setup camera for full screen resolution
val metrics = windowManager.getCurrentWindowMetrics().bounds
Log.d(TAG, "Screen metrics: ${metrics.width()} x ${metrics.height()}")
val screenAspectRatio = aspectRatio(metrics.width(), metrics.height())
Log.d(TAG, "Preview aspect ratio: $screenAspectRatio")
val rotation = fragmentCameraBinding.viewFinder.display.rotation
Log.d(TAG, "Preview rotation: $rotation")
// CameraProvider
val cameraProvider = cameraProvider
?: throw IllegalStateException("Camera initialization failed.")
// CameraSelector
val cameraSelector = CameraSelector.Builder().requireLensFacing(lensFacing).build()
// Preview
preview = Preview.Builder()
// We request aspect ratio but no resolution
.setTargetAspectRatio(screenAspectRatio)
// Set initial target rotation
.setTargetRotation(rotation)
.build()
// Must unbind the use-cases before rebinding them
cameraProvider.unbindAll()
if (camera != null) {
// Must remove observers from the previous camera instance
removeCameraStateObservers(camera!!.cameraInfo)
}
try {
// A variable number of use-cases can be passed here -
// camera provides access to CameraControl & CameraInfo
camera = cameraProvider.bindToLifecycle(
this, cameraSelector, preview)
// Attach the viewfinder's surface provider to preview use case
preview?.setSurfaceProvider(fragmentCameraBinding.viewFinder.surfaceProvider)
observeCameraState(camera?.cameraInfo!!)
} catch (exc: Exception) {
Log.e(TAG, "Use case binding failed", exc)
}
}