Constraint

Constraints are session configuration options that are negotiated by the CameraSession to find a closest-matching working Camera configuration.

In other words, Constraints describe intent.

See

Examples

If Photo capture is more important than Video capture, list a { resolutionBias: ... } constraint (and potentially also a { photoHDR: ... } constraint) above your video constraints:

const contraints = [
  { resolutionBias: photoOutput },
  { photoHDR: true },
  { resolutionBias: videoOutput }
] satisfies Constraint[]

To stream at 60 FPS, simply set an { fps: ... } constraint to your target frame rate:

const contraints = [
  { fps: 60 },
] satisfies Constraint[]

To prefer a specific StabilizationMode, use a { videoStabilizationMode: ... } constraint:

const contraints = [
  { videoStabilizationMode: 'cinematic-extended' },
] satisfies Constraint[]