CameraDeviceFactory

interface CameraDeviceFactory extends HybridObject

The CameraDeviceFactory allows getting CameraDevices, listening to device changes, and querying extensions or preferred Cameras.

Properties

cameraDevices

readonly cameraDevices: CameraDevice[]

Get a list of all devices. This list may change as camera devices get plugged in/out.


userPreferredCamera?

optional userPreferredCamera: CameraDevice

Get or set the user's default preferred camera device. Setting a device here will persist the preference between apps.

Methods

addOnCameraDevicesChangedListener()

addOnCameraDevicesChangedListener(listener: (newDevices: CameraDevice[]) => void): ListenerSubscription

Add a listener to be called whenever the available cameraDevices change, for example when an external USB Camera gets plugged in- or out- of the Device.


getCameraForId()

getCameraForId(id: string): CameraDevice | undefined

Get the CameraDevice with the given unique id.

If no device with the given id is found, this method returns undefined.


getDefaultCamera()

getDefaultCamera(position: CameraPosition): CameraDevice | undefined

Get the platform's default CameraDevice at the given CameraPosition.


getSupportedExtensions()

getSupportedExtensions(camera: CameraDevice): Promise<CameraExtension[]>

Gets a list of all vendor-specific CameraExtensions the given CameraDevice supports.

A CameraExtension can be enabled when creating a CameraSession via configure(...).