In my app I created a custom camera view for image capturing. When I trigger capturing, I use the following code:
private func takePhoto() {
let settings = AVCapturePhotoSettings()
self.stillImageOutput.capturePhoto(with: settings, delegate: self)
}
This then triggers photoOutput didFinishProcessingPhoto
There I extract the UIImage from the AVCapturePhoto and carry on.
My problem is in between I call self.stillImageOutput.capturePhoto and the image arrives in didFinishProcessingPhoto an average 0.5 second passes and I would need the capture image (almost) exactly at the time capturePhoto was called.
Is there a way to speed this process up or is there another way how I can achieve the same result?
let settings = AVCapturePhotoSettings()write outside oftakePhotofunction, when you calltakePhotofunction at that time create a new memory and allocate tosettingsvariable, So If you define globally in this controller then memory will allocate when this controller load and it would speed up process to take photo.