Reputation: 5234
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
}
Upvotes: 2
Views: 4906
Reputation: 539765
Use AVCaptureSession.canSetSessionPreset(_:)
:
Returns a Boolean value that indicates whether the receiver can use the given preset.
Upvotes: 3