useCameraDevice

function useCameraDevice(position: CameraPosition, filter?: DeviceFilter): CameraDevice | undefined

Get the best matching Camera device that best satisfies your requirements using a sorting filter.

This hook is reactive to device changes. If a new device is plugged in, this hook updates.

Parameters

position

The position of the Camera device relative to the phone.

filter

The filter you want to use. The Camera device that matches your filter the closest will be returned

Returns

The Camera device that matches your filter the closest, or undefined if no such Camera Device exists on the given position.

Example

const device = useCameraDevice('back', {
   physicalDevices: ['wide-angle']
})