I am trying to set the frame rate to 10 frames per second when capturing using AVCaptureDevice in Swift.
I believe that this is achieved by setting activeVideoMaxFrameDuration AVCaptureDevice, but maybe I'm doing it all wrong and it's different there.
Here is my current code that works without errors, but has nothing to do with the frame rate in the preview or captured video, which still seems complete.
var devices = AVCaptureDevice.devicesWithMediaType(mediaType); var captureDevice: AVCaptureDevice = devices[0] as AVCaptureDevice; captureDevice.lockForConfiguration(&error) captureDevice.activeVideoMinFrameDuration = CMTimeMake(1,10) captureDevice.activeVideoMaxFrameDuration = CMTimeMake(1,10) captureDevice.unlockForConfiguration()
I checked in AVCaptureDeviceFormat videoSupportedFrameRateRanges minFrameRate and 10 frames per second.
Changing CMTime to something outside of videoSupportedFrameRateRanges causes an error, so I know the code is being used, it just has no effect.
Thank you in advance for your help.
source share