mat*_*m86 6 iphone video camera preset
我想检查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];
Run Code Online (Sandbox Code Playgroud)
这在iPhone 5上运行良好(它确实支持全高清捕获),但在iPhone 4上也尝试设置预设,但显然失败了.我究竟做错了什么?
先谢谢,马蒂亚斯
alo*_*nes 15
在向捕获会话添加输入后,您是否调用了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;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2575 次 |
| 最近记录: |