You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Open a view that has the camera and wait for the camera session to be started
Navigate to another app (slide at the bottom or receive a call)
When you come back to the app, quickly switch to another tab that doesn't have the camera screen
After some time the camera session starts even though the view is no longer visible
Possible fix:
Remove if captureSession?.isRunning == true { check from ScannerViewController.swift's viewDidDisappear.
Why? Calling self.captureSession?.startRunning() from setupSession() hasn't completed yet before we switch to another screen, which results in isRunning returning false.
Or better refactor the state management with an enum instead of depending on multiple booleans, something like:
enum CameraSessionState {
case stopped
case requestedToStart(Run?)
case running
case interrupted
}
Thinking about it a bit more, is there a memory leak that's keeping the session? 🤔
Closing the containing sheet does release the camera though.
The trick that works to re-initialise the camera on re-appearance (#120) does not help camera to disappear.
Is it something that can be done with or without library change? Maybe expose some method to disable the camera?
The text was updated successfully, but these errors were encountered: