Skip to content
Discussion options

You must be logged in to vote

Hey @p-larson!
I've checked your Gist, and after fixing a few issues around authorization status (it seems you're not calling AVCaptureDevice.requestAccess(for: .video) when the status is unauthorized), I've managed to get it in a working state by updating a little your delegate. I never really used the video part of AVFoundation, so I may be wrong, but I'm not getting why you keep a reference to the feed image in your delegate. If you write your buffer in a local variable instead, it seems to work:

// private var feed: CGImage! // Removed
func captureOutput(
  _ output: AVCaptureOutput, didOutput sampleBuffer: CMSampleBuffer,
  from connection: AVCaptureConnection
) {
  if let imageBuffer =

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@p-larson
Comment options

Answer selected by p-larson
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants