I am building a viewfinder app using Android Camera2 api on Xamarin and I have a problem when preview is very dark.
My phone is LG G3, came2Basic app has similar behaviour except that after first picture has been taken the preview gets "normal" brightness and maintain it no matter how much light is it on scene (this is expected behaviour, that can be seen on a standart camera app).
Here is a code I use to start preview in my app:
var surface = new Surface(texture);
var builder = cameraDevice.CreateCaptureRequest(CameraTemplate.Preview);
previewRequestBuilder.AddTarget(surface);
var surfaces = new List<Surface> { surface };
cameraDevice.CreateCaptureSession(surfaces, createCameraPreviewStateObservable, backgroundHandler);
builder.Set(CaptureRequest.ControlMode, (int)ControlMode.Auto);
var previewRequest = builder.Build();
configured.Session.SetRepeatingRequest(
previewRequest,
cameraCatpureCallbackHandlerObservable,
backgroundHandler);
I've seen similar questions (1, 2, 3, 4 and 5) but none of them has the solution workerd for me.
I assume there is some kind of process to obtain correct auto exposure parametes that I am missing.
So the question is: How to make Camera2 api to calculate correct exposure parameters?
Thanks.