-
Notifications
You must be signed in to change notification settings - Fork 879
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
Fails to connect to camera on specific models when returning to fragment #68
Comments
I'm having this issue as well on some devices running Android 4.4.2. |
so here is my work around to avoiding crash on older API devices with this library in a fragment - basically just need to give a little bit more time for stuff to settle before we call the camera to start.. also i start my fragment in a viewpager so to save battery, i don't let the camera start unless the fragment is visible this is overriding the onPause() and onResume() along with setUserVisibleHint()
|
Hey @suomi35 , I just wanted to add a comment about the above. In #68, @android-dataticket mentions there (and above!) about how to workaround the problem this library has at the moment. Rather than implement these threads, I found it much easier to pull the repo, import the module with the tiny modification of |
@tikimcfee @android-dataticket I've refactored my code into using 2 activities instead of 1 activity and 2 fragments, and this works absolutely perfect. (Without using any ugly hacks, except that not everyone can use activities instead of fragments of course) |
@khltrifork it's a very ugly hack, but it's been working great :) yea I have to use it in a fragment so I have to get creative, the user experience is fine as it's only a max half a second delay and the fragment I've created with this library is 10x faster than using the phones default camera app to snap and store a photo. |
@tikimcfee what is your exact code change to .start()? |
As @tikimcfee suggested, I've forked repo and modified CameraView#start() from
to
however, I'd still like to run camera initialization on a separate thread and in my app, I've implemented camera start by using RxJava
Don't forget to dispose everything in
I know it's far from perfect solution, and in the case of multiple retries, UX will be bad. However, it's more like the patch in case of failure. In my case, camera start fails sometimes when the camera was active in one fragment and replacing that fragment with another that also activates the camera. As for the
|
I'm having an issue with the library throwing an exception.
My setup is as follows:
Activity hosts Fragment1 (which has the CameraView)
When image is taken, Activity adds Fragment2 (which shows an ImageView with the newly taken image).
This works fine, but when i press back (and pop the backstack to return to Fragment1), then i get the following exception:
And afterwards, the log is constantly spammed with this:
The above 3 lines are spammed constantly until i close the Activity.
No matter what i call with regard to stop/start the camera while this is happening has any effect.
I'm able to reproduce the issue every single time on a Samsung Galaxy S3 (GT-I9300) running Android 4.3.
I also have a OnePlus Three (running Android 7.1) which has absolutely no issues.
I'm willing to help out and test any potential fixes, so i'll check this post regularly.
The text was updated successfully, but these errors were encountered: