【问题标题】:Supported AVCaptureSessionPreset on iOS deviceiOS 设备上支持的 AVCaptureSessionPreset
【发布时间】:2013-08-28 10:39:43
【问题描述】:

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

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

// Here I would like to perform a check.

[_session setSessionPreset:_sessionPreset];

【问题讨论】:

    标签: ios objective-c avfoundation avcapturesession avcapture


    【解决方案1】:

    使用这个:

    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;
            }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-02-27
      • 1970-01-01
      • 1970-01-01
      • 2013-12-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多