RedApparat / Fotoapparat

Making Camera for Android more friendly. 📸
Apache License 2.0
3.81k stars 405 forks source link

freeze when takephoto and convert to bitmap #336

Closed RowanG1 closed 5 years ago

RowanG1 commented 5 years ago

When I use the code: fotoapparat?.takePicture()?.toBitmap(),

the preview freezes for about one second. Is there any way to overcome this? I am testing on a Xiaomi device, MiA1. I am using a timer to capture the image every 2 seconds.

Diolor commented 5 years ago

Migration to Camera 2 is the only way which is currently not in the roadmap.

shedeed1 commented 5 years ago

I managed to get around this issue by using RxJava and subscribing on IO thread.

Disposable disposable = fotoapparat.takePicture() .toBitmap() .adapt(SingleAdapter.toSingle()) .subscribeOn(Schedulers.io()) .subscribe(new Consumer() ......