Hi Scott,
The SENSOR_ORIENTATION is 90 on both phones.
and I am using CameraSelector lensFacing to select the camera.
and I also used it to get the SENSOR_ORIENTATION because I clud not and I way to get camera ID in CmaraX
val characteristics = cameraManager.getCameraCharacteristics(CameraSelector.
LENS_FACING_FRONT .toString());
(I think I should not ) but both CameraSelector.
LENS_FACING_FRONT and Camera2 cManager.getCameraIdList() with if statement CameraCharacteristics.LENS_FACING_FRONT will both give '0'
code used to choose and launch the camera
val screenAspectRatio = AspectRatio.
RATIO_4_3
val rotation = cameraPreview.
display.
rotation
// CameraProvider
val cameraProvider = cameraProvider
?: throw IllegalStateException("Camera initialization failed.")
// CameraSelector
val cameraSelector = CameraSelector.Builder().requireLensFacing(lensFacing).build()
//lensFacing is either CameraSelector.
LENS_FACING_FRONT or CameraSelector.
LENS_FACING_BACK // Preview
preview = Preview.Builder()
.setTargetAspectRatio(screenAspectRatio)
.setTargetRotation(rotation)
.build()
// ImageCapture
imageCapture = ImageCapture.Builder()
.setCaptureMode(ImageCapture.
CAPTURE_MODE_MINIMIZE_LATENCY)
.setTargetAspectRatio(screenAspectRatio)
.setTargetRotation(rotation)
.build()
cameraProvider.unbindAll()
try {
camera = cameraProvider.bindToLifecycle(
this, cameraSelector, preview, imageCapture)
mcameraControl = camera!!.
cameraControl
mCamera2CameraControl = Camera2CameraControl.from(mcameraControl)
preview?.setSurfaceProvider(cameraPreview.
surfaceProvider)
} catch (exc: Exception) {
Log.e(TAG, "Use case binding failed", exc)