Is there a way to check whether is concrete AVCaptureSessionPreset supported on iOS device? I want to set a resolution of AVCaptureSession, but I do not know how to check whether the divice is capable to capture camera frames using selected resolution.
AVCaptureSession * _session;
NSString * _sessionPreset;
_sessionPreset = AVCaptureSessionPreset1920x1080;
// Here I would like to perform a check.
[_session setSessionPreset:_sessionPreset];
Use this:
if ([self.captureSession canSetSessionPreset:AVCaptureSessionPreset1920x1080])
{
self.captureSession.sessionPreset = AVCaptureSessionPreset1920x1080;
} else if ([self.captureSession canSetSessionPreset:AVCaptureSessionPreset640x480])
{
NSLog(@"Set preview port to 640X480");
self.captureSession.sessionPreset = AVCaptureSessionPreset640x480;
}