-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
App crashes after switching cameras multiple times #8
Comments
@nominalista what device are you experiencing this in? |
@owahltinez Pixel 3. |
Unfortunately this is an error happening inside of CameraX which cannot be (easily) caught by the app. If I'm reading the logs correctly, it could be caused by the camera session sending frames to a surface that has been recycled. Based on the behavior that you described, a workaround could be to prevent users from switching fragments until the session has been properly started. For example, keeping the button disabled until preview starts. I'll work on getting a reliable way to reproduce this on our side, and see if we can add the workaround to the sample as well. |
@nominalista I am not able to reproduce this issue on a Pixel 3 XL. I tried pressing the switch button 15-20 times very fast, not giving the preview enough time to load; then a little slower, immediately after preview is shown; and then even slower, every 2-3 seconds. Unfortunately I have been unable to test on the emulator due to #9 |
Now that #9 is fixed I tested on the emulator but I'm also unable to reproduce. Are you still able to reproduce this issue? Can you please try again with the updated sample and, if it still crashes, share what OS build your Pixel 3 is running? |
Sorry for late response, this video shows the issue. |
@nominalista I think the camera is working fine. You can add some blocker/stopper when user pressed 300-400 milliseconds interval. You can use handler. I fixed things like this using |
When you try to switch cameras by clicking really fast in a switch button, the app crashes due to this exception:
To reproduce this issue just run the app and tap switch button multiple times (like 15-20). I know this is not production ready app and tapping so many times fakes user behavior, but I have encountered the same issue in my own implementation just because of fragment replacing. It would be much appreciated if someone give a clue or some explanation of this issue.
The text was updated successfully, but these errors were encountered: