Skip to main content

Function: getCameraFormat()

getCameraFormat(device, filters): CameraDeviceFormat

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: 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

The format that matches your filter the closest.

Example​

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

Defined in​

devices/getCameraFormat.ts:123