2

For instance, I may want to set it to hd1280x720, but only if it's supported, and use a lower res that is supported otherwise.

session = AVCaptureSession()
if(**my device supports hd1280x720**){
  session!.sessionPreset = AVCaptureSession.Preset.hd1280x720
}else if(**my device supports 640x480**){
  session!.sessionPreset = AVCaptureSession.Preset.vga640x480
}
Chewie The Chorkie
  • 4,896
  • 9
  • 46
  • 90

1 Answers1

3

Use AVCaptureSession.canSetSessionPreset(_:):

Returns a Boolean value that indicates whether the receiver can use the given preset.

Martin R
  • 529,903
  • 94
  • 1,240
  • 1,382