piemonte / PBJVision

📸 iOS Media Capture – features touch-to-record video, slow motion, and photography
MIT License
1.94k stars 324 forks source link

Stuck recording when switching cameras #316

Closed prokopiev-cr closed 3 years ago

prokopiev-cr commented 8 years ago

Hi guys, faced the problem. I wanted to switch cameras while capturing video. I use AVCaptureSessionPreset1280x720 preset. But it led the audio&video desynchronization. So I just pause video capture on flip camera button action, and resume in delegate method -visionCameraDeviceDidChange:

But there is another problem, after multiple cameras switching the -vision:didCaptureVideoSampleBuffer: -vision:didCaptureAudioSampleBuffer: methods begin to log the same vision.capturedVideoSeconds & vision.capturedAudioSeconds, so the video seems to be broken, also after calling -endVideoCapture this method logs an error "encounted an error in video capture (Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo={NSUnderlyingError=0x15152b4c0 {Error Domain=NSOSStatusErrorDomain Code=-16364 "(null)"}, NSLocalizedFailureReason=An unknown error occurred (-16364), NSLocalizedDescription=The operation could not be completed})"

Any suggestions how to solve it? Or maybe there is a way to not pause capturing and avoid desynchronization when switching cameras? (

piemonte commented 8 years ago

Hey friends, i recommend checking out http://github.com/nextlevel/nextlevel

It's more resilient when it comes to switching devices.

holgersindbaek commented 6 years ago

I have a similar error:

https://github.com/piemonte/PBJVision/issues/345

Did you figure out what was wrong?