findCamera

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

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: (deviceId: String, position: CameraPosition?) -> Boolean): CameraCapturerUtils.CameraDeviceInfo?

Returns information about a camera by searching for the specified device ID.

Return

CameraDeviceInfo with camera id and position if found, null otherwise

Parameters

predicate

with deviceId and position, return true if camera is found