Search code examples
androidandroid-camera2android-camerax

CameraX: Check if device supports photo and video use cases together


Our CameraX application currently supports taking photos while recording a video (3 target surfaces/use-cases). This works fine for most devices, however on some devices the maximum number of supported target surfaces is 2. Is there any way we could manually check this before calling the bindToLifecycle method?


Solution

  • You can query the current supported hardware level of the device using https://developer.android.com/reference/android/hardware/camera2/CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL

    Each hardware level supports minimum targets and stream sizes. check more details here: https://developer.android.com/reference/android/hardware/camera2/CameraDevice#createCaptureSession(android.hardware.camera2.params.SessionConfiguration)