CanSetSessionPreset: AVCaptureSessionPreset1920x1080 returns yes on iPhone 4

I want to check if the user's iPhone supports full high-definition video capture. I found out that I should ask the AV session if

avSession = [[AVCaptureSession alloc] init]; [avSession beginConfiguration]; if ([avSession canSetSessionPreset:AVCaptureSessionPreset1920x1080]) { avSession.sessionPreset = AVCaptureSessionPreset1920x1080; NSLog(@"FULLHD"); } else { avSession.sessionPreset = AVCaptureSessionPreset1280x720; NSLog(@"HDREADY"); } [avSession commitConfiguration]; 

This works fine on the iPhone 5 (which does support full HD capture), but on the iPhone 4 it also tries to install a preset, but clearly fails. What am I doing wrong?

Thanks in advance, Matthias

+6
source share
1 answer

Did you call canSetSettingPreset after adding input to the capture session?

 [captureSession addInput:captureInput]; // <--- you should add an input before canSetSessionPreset [captureSession addOutput:captureOutput]; if( [captureSession canSetSessionPreset:AVCaptureSessionPreset1280x720] == YES ) { captureSession.sessionPreset = AVCaptureSessionPresetiFrame1280x720; } else { captureSession.sessionPreset = AVCaptureSessionPreset640x480; } 
+15
source

All Articles