Skip to content
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

Photo file is 0 bytes in saveToFile().whenDone #234

Closed
akirmse opened this issue Mar 27, 2018 · 5 comments
Closed

Photo file is 0 bytes in saveToFile().whenDone #234

akirmse opened this issue Mar 27, 2018 · 5 comments
Labels

Comments

@akirmse
Copy link

akirmse commented Mar 27, 2018

I recently upgraded from version 1.5 to 2.2. My project is in Java and everything had been working fine for months. After the upgrade and the requisite syntax changes (because the library is now Kotlin), I am observing that in saveToFile().whenDone(), the file size of the saved photo is 0 bytes, as if it hasn't been written yet.

               PhotoResult photoResult = mFotoapparat.takePicture();
                photoResult.saveToFile(photoFile).whenDone((Unit unit) -> {
                    // Did we get a picture?

I had been calling whenAvailable() but I can't get that to compile in 2.2. Do I have to change anything else?

This is my initialization code

        mFotoapparat = Fotoapparat
                .with(getActivity())
                .into(cameraView)           // view that will draw the camera preview
                .previewScaleType(ScaleType.CenterCrop)  // we want the preview to fill the view
                .photoResolution(highestResolution())   // we want to have the biggest photo possible
                .build();
        mFotoapparat.start();
@scifinder
Copy link

scifinder commented Mar 27, 2018

@akirmse, hi! See my question: #198

@akirmse
Copy link
Author

akirmse commented Mar 28, 2018

Yes, thanks, I am seeing the problem after I made similar changes in upgrading to 2.2.

@akirmse
Copy link
Author

akirmse commented Apr 1, 2018

Any thoughts on this? I've had to revert to 1.5.

@akirmse
Copy link
Author

akirmse commented Apr 16, 2018 via email

@akirmse
Copy link
Author

akirmse commented Jan 26, 2019

The problem was on my side. I was calling stop() before whenDone() completed.

@akirmse akirmse closed this as completed Jan 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants