external camera support

585 views
Skip to first unread message

yang tian

unread,
Jan 18, 2021, 2:53:57 AM1/18/21
to Android CameraX Discussion Group
Hi  CameraX Development Team!

Currently, Seems cameraX has no support of external caemra?

Do you plan to add the support later?

Thanks!

Vinit Modi

unread,
Jan 18, 2021, 2:01:01 PM1/18/21
to yang tian, Android CameraX Discussion Group
Hi Yang,

Correct, we currently do not support external cameras. Thanks for making the suggestion, adding an external camera isn't currently on our roadmap but we will take the feedback into consideration. 

Vinit

--
You received this message because you are subscribed to the Google Groups "Android CameraX Discussion Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to camerax-develop...@android.com.
To view this discussion on the web visit https://groups.google.com/a/android.com/d/msgid/camerax-developers/47c7f307-262f-47c6-9fa0-5f957b849e45n%40android.com.

tonyt...@google.com

unread,
Jan 18, 2021, 10:11:15 PM1/18/21
to Android CameraX Discussion Group, Vinit Modi, Android CameraX Discussion Group, yang...@nxp.com
You may try Camera2CameraFilter to select the external camera if needed. A basic implementation may looks like below. Note that this is experimental and hasn't been fully verified. Hope it helps!

// Implement a camera filter that selects LENS_FACING_EXTERNAL cameras.
CameraFilter cameraFilter = Camera2CameraFilter.createCameraFilter((cameraInfos) -> {
    List<CameraInfo> resultCameraInfos = new ArrayList<>();
    for (CameraInfo cameraInfo : cameraInfos) {
        Integer lensFacing = Camrea2CameraInfo.from(cameraInfo).getCameraCharacteristic(CameraCharacteristics.LENS_FACING);
        if (lensFacing != null && lensFacing == CameraMetadata.LENS_FACING_EXTERNAL) {
            resultCameraInfos.add(cameraInfo);
        }
    }
    return resultCameraInfos;
});

// Create a camera selector without specifying lens facing and add the customized camera filter to it. Then use the camera selector to bind to the external camera.
CameraSelector cameraSelector = new CameraSelector.Builder().addCameraFilter(cameraFilter).build();

yang tian

unread,
Jan 18, 2021, 10:14:29 PM1/18/21
to Android CameraX Discussion Group, tonyt...@google.com, Vinit Modi, Android CameraX Discussion Group, yang tian
Thanks!
I will have a try with this  Camera2CameraFilter . 
Reply all
Reply to author
Forward
0 new messages