findCamera

fun CameraEnumerator.findCamera(deviceId: String? = null, position: CameraPosition? = null, fallback: Boolean = true): String?

Finds the device id of first available camera based on the criteria given. Returns null if no camera matches the criteria.

Parameters

deviceId

an id of a camera. Available device ids can be found through CameraEnumerator.getDeviceNames. If null, device id search is skipped. Defaults to null.

position

the position of a camera. If null, search based on camera position is skipped. Defaults to null.

fallback

if true, when no camera is found by device id/position search, the first available camera on the list will be returned.


fun CameraEnumerator.findCamera(predicate: (deviceName: String) -> Boolean): String?

Finds the device id of a camera that matches the predicate.