E
E
Ening_apps2018-06-24 21:33:11
Android
Ening_apps, 2018-06-24 21:33:11

How to enable flash in Camera2 API without creating a new session?

Good day to all. I'm working on an application based on the Camera 2 API and I want to add the ability to enable/disable the flash in this application.
I know it can be done like this:

mPreviewBuilder.set(CaptureRequest.FLASH_MODE, CaptureRequest.FLASH_MODE_SINGLE);
mPreviewSession.setRepeatingRequest(mPreviewBuilder.build(), null, null);

But as far as I understand, creating a new session is a costly procedure and plus I don't want to lose frames from the camera.
Can you please tell me if there is a way to enable flash without creating a new session? I wonder how this is done in standard applications, maybe there is some kind of open source code (normally working)?
Or am I mistaken, and creating a session does not particularly require resources, etc.?
Thank you all in advance for your replies!

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question