Cant figure this one out. Everything works fine when the app is active, and than sometimes when i move the app to the background(pressing the home button) a
I faced this problem too, I fixed mine by adding this to my viewWillAppear and viewWillDissapear. Hope this helps
var session = AVCaptureSession() override func viewWillAppear(_ animated: Bool) { session.startRunning() } override func viewWillDisappear(_ animated: Bool) { session.stopRunning() }