RedApparat / Fotoapparat

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

Add setOneShotPreviewCallback to get single preview frame #199

Closed Raenar4k closed 6 years ago

Raenar4k commented 6 years ago

This adds setOneShotPreviewCallback to get single frame from preview. It is different fro$ 1) It only returns one frame and removes callback after 2) It produces frame that has no tearing, unlike the ones from frame processor where move$

Im not sure whether it belongs in another routine or if the runBlocking is needed at all. I quickly did it like focusRoutine and it works for me, feedback is welcome.

Issue: https://github.com/Fotoapparat/Fotoapparat/issues/200

Diolor commented 6 years ago

Thanks @Raenar4k ! I have added 2 comments, so this will need to some extra work.

runBlocking is needed to obtain the available camera.