如何检查苹果设备(至少为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];
            }
        }
    }

最佳答案

检查以下代码:

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

关于ios - 检查Apple设备的相机是否支持slo-mo?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/51037514/

10-12 21:51