0
votes

I am getting an error in the second line, I could not solve it at all.

videoDataOutputQueue = dispatch_queue_create("VideoDataOutputQueue", DISPATCH_QUEUE_SERIAL)
videoDataOutput.setSampleBufferDelegate(self, queue: videoDataOutputQueue)

Error: cannot invoke 'setSampleBufferDelegate' with an argument list of type '(ViewController, queue: dispatch_queue_t)'

1

1 Answers

1
votes

The signature for setSampleBufferDelegate is

func setSampleBufferDelegate(_ sampleBufferDelegate: AVCaptureVideoDataOutputSampleBufferDelegate!, queue sampleBufferCallbackQueue: dispatch_queue_t!)

In particular the first parameter needs to be a AVCaptureVideoDataOutputSampleBufferDelegate. Your class ViewController is apparently not such a delegate. You can fix that by conforming your class to it:

class ViewController : YourPreviousInheritances, AVCaptureVideoDataOutputSampleBufferDelegate { 
    ...
}