I would like to obtain a pixelBuffer from didFinishProcessingPhoto
delegate method but it's nil.
func capturePhoto() {
let format = [AVVideoCodecKey: AVVideoCodecType.jpeg]
let settings = AVCapturePhotoSettings(format: format)
output.capturePhoto(with: settings, delegate: self)
}
and extension:
extension CaptureSessionManager: AVCapturePhotoCaptureDelegate {
func photoOutput(_ output: AVCapturePhotoOutput, didFinishProcessingPhoto photo: AVCapturePhoto, error: Error?) {
guard let pixelBuffer = photo.pixelBuffer else {
return
}
bufferSubject.onNext(pixelBuffer)
}
}
Before that I'm obviously adding output to the session. Should I use some different method from this delegate?