I want to develop an Android Camera App for myself (can share it if there are interested people) that has a manual focus while video recording.
I've added a SeekBar to the google sample Camera2 app but I can't find the way to implement the manual focus.
I found Manual focus in camera2, android but it doesn't work on my LG G4. The stock camera app is almost perfect since it doesn't allow the manual focus in video mode.
Does anyone of you have an idea ?
EDIT: here's the code of the SeekBar listener:
@Override
public void onStopTrackingTouch(SeekBar seekBar) {}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
mPreviewBuilder.set(CaptureRequest.CONTROL_AF_MODE, CameraMetadata.CONTROL_AF_MODE_OFF);
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
float minimumLens = characteristics.get(CameraCharacteristics.LENS_INFO_MINIMUM_FOCUS_DISTANCE);
float num = (((float)progress) * minimumLens / 100);
mPreviewBuilder.set(CaptureRequest.LENS_FOCUS_DISTANCE, num);
}