我想检查一下用户的iPhone是否支持全高清视频采集。我发现,我应该问AV会议,如果
avSession = [[AVCaptureSession alloc] init];
[avSession beginConfiguration];
if ([avSession canSetSessionPreset:AVCaptureSessionPreset1920x1080]) {
avSession.sessionPreset = AVCaptureSessionPreset1920x1080;
NSLog(@"FULLHD");
} else {
avSession.sessionPreset = AVCaptureSessionPreset1280x720;
NSLog(@"HDREADY");
}
[avSession commitConfiguration];
这在iPhone 5上运行得很好(它确实支持全高清捕捉),但在iPhone 4上也尝试设置预设,但显然失败了。我做错了什么?
提前谢谢你,马蒂亚斯
发布于 2013-07-05 15:53:42
在将输入添加到捕获会话之后,是否调用了canSetSettingPreset?
[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;
}
https://stackoverflow.com/questions/15727583
复制相似问题