Skip to main content

Function: useCameraFormat()

useCameraFormat(device, filters): CameraDeviceFormat | undefined

Get the best matching Camera format for the given device that satisfies your requirements using a sorting filter. By default, formats are sorted by highest to lowest resolution.

The filters are ranked by priority, from highest to lowest. This means the first item you pass will have a higher priority than the second, and so on.

Parameters​

• device: undefined | CameraDevice

The Camera Device you're currently using

• filters: FormatFilter[]

The filters you want to use. The format that matches your filter the closest will be returned

Returns​

CameraDeviceFormat | undefined

The format that matches your filter the closest.

Example​

const device = useCameraDevice(...)
const format = useCameraFormat(device, [
{ videoResolution: { width: 3048, height: 2160 } },
{ fps: 60 }
])

Defined in​

hooks/useCameraFormat.ts:24