getCameraFormat

function getCameraFormat(device: CameraDevice, filters: FormatFilter[]): CameraFormat

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

The Camera Device you're currently using

filters

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

Returns

The format that matches your filter the closest.

Example

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