3

有没有办法检查 iOS 设备是否支持具体的 AVCaptureSessionPreset?我想设置 AVCaptureSession 的分辨率,但我不知道如何检查设备是否能够使用选定的分辨率捕获相机帧。

AVCaptureSession * _session;
NSString * _sessionPreset;
_sessionPreset = AVCaptureSessionPreset1920x1080;

// Here I would like to perform a check.

[_session setSessionPreset:_sessionPreset];
4

1 回答 1

9

用这个:

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;
        }
于 2013-08-28T10:59:15.617 回答