为不同的设备选择正确的AVCaptureSessionPreset [英] Choosing the right AVCaptureSessionPreset for different devices

查看:75
本文介绍了为不同的设备选择正确的AVCaptureSessionPreset的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有点困惑应该为不同设备使用哪个预设.目前,我在所有设备上都使用AVCaptureSessionPresetMedium.但是,我想为不同的手机使用不同的分辨率.例如,新的iPhone 6s可以拍摄4K视频,在这种情况下,我将使用AVCaptureSessionPreset3840x2160.

I am a little confused which preset I should use for different devices. Currently I am using AVCaptureSessionPresetMedium for all devices. However, I want to take advantage of different resolutions for different phones. For example the new iPhone 6s can take 4K video, and in this case I would use AVCaptureSessionPreset3840x2160.

我要问的是一种为不同设备选择正确预设的好方法.谢谢

What I am asking is an elegant way to choose the right preset for different devices. Thanks

推荐答案

#ifdef __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_9_0
CGFloat iOSVersion = [[[UIDevice currentDevice] systemVersion] integerValue];
if (iOSVersion>=9 && [session canSetSessionPreset:AVCaptureSessionPreset3840x2160]) {
    session.sessionPreset = AVCaptureSessionPreset3840x2160;
}
#else
// the code above won't compile in Xcode 6 and older
#endif

...

这篇关于为不同的设备选择正确的AVCaptureSessionPreset的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆