ios - Swift 3/AV Foundation - trouble setting delegate with setsamplebufferdelegate -


im having trouble setsamplebufferdelegate. 1 of parameters dispatch queue , im not sure should feeding it. ive tried few things doesnt seem working, , result captureoutput not being called because delegate not being set.

let queue = dispatchqueue.global(qos: .background)      videooutput.setsamplebufferdelegate(self, queue: queue)      if videooutput.samplebufferdelegate != nil {         print("buffer delegate set")     } 

the print statement not being called nor delegate method captureoutput

ive tried

  videooutput.setsamplebufferdelegate(self, queue: dispatchqueue.main) 

and

videooutput.setsamplebufferdelegate(self, queue: dispatchqueue.background) 

im shaky on dispatch queues right now, , have no deep understanding. im not sure if problem stemming misuse of queues or else. being called in viewdidload right now.

*edit - yes adding output capture sessions in viewdidload

 dispatchqueue.global(qos: .background).async {          if self.capturesession.canaddoutput(self.videooutput) {             self.capturesession.addoutput(self.videooutput)             print("added video output capture session")         }          self.capturesession.startrunning()     } 

and can confirm code runs expected


Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -