I would like to take pictures with the proper Camera2 API way with ARCore SharedCamera:
Lock focus.
Run precapture sequence.
Capture still picture.
Unlock focus.
I try to use auto flash as well:
captureRequestBuilder.set(CaptureRequest.CONTROL_AE_MODE, CameraMetadata.CONTROL_AE_MODE_ON_AUTO_FLASH)
So based on the result of the precapture sequence I might need flash for image taking. I realized that I have to stop the AR session with ARCore Session's pause() function before starting the image taking process with lock focus to make it work.
The problem is that this does not work on all devices. Here is a table of my test results:
Device
OS Version
Is flash working?
Samsung Galaxy A30
Android 9
YES
Samsung Galaxy A7
Android 10
YES
Samsung Galaxy Tab S3
Android 9
NO
Samsung Galaxy A20s
Android 10
NO
Samsung Galaxy S20 FE
Android 11
NO
Pixel2
Android 11
NO
Samsung S7
Android 8
NO
Samsung A8
Android 9
YES
Huawei Nova 2i
Android 8
YES
Huawei P10
Android 9
YES
Samsung Galaxy A51
Android 11
NO
You can see that it is not related to device manufacturer or OS version.
After some tests and investigation I figured out, that if I wait for at least 1 sec after pausing the AR session the flash is working properly, however it is a very ugly workaround to fix it. It seems the in case of some device AR session needs more time to stop(?), so the camera2 part can do its job. But it just a guess.
The question is:
Is there any event or workaround by which we know that ARCore session is paused successfully and Camera2 is ready to work? Or is my assumption totally wrong and it should work in a different way?
VERSIONS USED
Android Studio: 4.1.1
ARCore SDK for Android: 1.28.0
Device manufacturer, model, and O/S: See the table above.
Google Play Services for AR (ARCore): 1.28.212840223
SPECIFIC ISSUE ENCOUNTERED
I would like to take pictures with the proper Camera2 API way with ARCore SharedCamera:
I try to use auto flash as well:
captureRequestBuilder.set(CaptureRequest.CONTROL_AE_MODE, CameraMetadata.CONTROL_AE_MODE_ON_AUTO_FLASH)
So based on the result of the precapture sequence I might need flash for image taking. I realized that I have to stop the AR session with ARCore Session's
pause()
function before starting the image taking process with lock focus to make it work.You can see that it is not related to device manufacturer or OS version.
After some tests and investigation I figured out, that if I wait for at least 1 sec after pausing the AR session the flash is working properly, however it is a very ugly workaround to fix it. It seems the in case of some device AR session needs more time to stop(?), so the camera2 part can do its job. But it just a guess.
The question is: Is there any event or workaround by which we know that ARCore session is paused successfully and Camera2 is ready to work? Or is my assumption totally wrong and it should work in a different way?
VERSIONS USED