如何检查苹果设备(至少iPhone和iPad)是否支持Slo-Mo录制?目前,我使用屏幕尺寸作为iPhone的支票,因此仍然保留iPhone 5s和iPhone SE。对于iPad,我也面临类似的问题。
我正在使用以下代码,但这似乎不起作用
NSArray *cameraDevices = [AVCaptureDevice devicesWithMediaType: AVMediaTypeVideo];
for (AVCaptureDevice *camera in cameraDevices) {
if ([camera position] == AVCaptureDevicePositionBack) {
if ([camera activeVideoMaxFrameDuration].timescale >= 120) {
[self showChooseAlert];
} else {
[self performSegueWithIdentifier:@"startVideoRecording" sender:self];
}
}
}
答案 0 :(得分:2)
检查以下代码:
NSArray *cameraDevices = [AVCaptureDevice devicesWithMediaType: AVMediaTypeVideo];
AVCaptureDevice *currentDevice;
for (AVCaptureDevice *camera in cameraDevices) {
if ([camera position] == AVCaptureDevicePositionBack) {
currentDevice = camera;
}
}
for (AVCaptureDeviceFormat *format in currentDevice.formats)
{
NSArray *ranges = format.videoSupportedFrameRateRanges;
AVFrameRateRange *frameRates = ranges[0];
if (frameRates.maxFrameRate >= 120) {
// Do Slow Motion stuff
}
}