SwiftyCam
SwiftyCam copied to clipboard
[SwiftyCam]: Cannot take photo. Capture session is not running (swift4)
Unable to manually call takePhoto() or startVideoRecording() - console prints that capture session is not running.
Same here.
I have the same issue here.
I looked into the code.
Seems like the following is never called to set sessionRunning to true
@objc private func captureSessionDidStartRunning() { sessionRunning = true DispatchQueue.main.async { self.cameraDelegate?.swiftyCamSessionDidStartRunning(self) } }
hence sessionRunning is always false
guard sessionRunning == true else { print("[SwiftyCam]: Cannot take photo. Capture session is not running") return }
would changing the guard to self.session.isRunning == true be a better check ?
+1
Has anyone figured this out? If so what should I do? I'm having the same issue
@specc you are right, the reason is that captureSessionDidStartRunning
method isn't called.
This method receives notification from event named AVCaptureSessionDidStartRunning
. Subscription happens in viewWillApear
.
Make sure that you call super.viewWillAppear
in overrided method.
this happend because your viewwillapper and viewdidapper don't have super.viewWillAppear(animated) so just added in viewWillAppear its work override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) }