The deprecated createCaptureSession() method is used in an old code in the following way:
cameraDevice.createCaptureSession(Arrays.asList(surface), new CameraCaptureSession.StateCallback() {
@Override
public void onConfigured(@NonNull CameraCaptureSession session) {
if (mycameraDevice == null){
return;
}
cameraCaptureSession = session;
if (cameraDevice == null){
return;
}
captureRequestBuilder.set(CaptureRequest.CONTROL_MODE, CameraMetadata.CONTROL_MODE_AUTO);
try {
cameraCaptureSession.setRepeatingRequest(captureRequestBuilder.build(), null, mBackgroundHandler);
} catch (CameraAccessException e) {
e.printStackTrace();
}
}
@Override
public void onConfigureFailed(@NonNull CameraCaptureSession session) {
Toast.makeText(MainActivity.this, "Configuration Failed! :(", Toast.LENGTH_SHORT).show();
}
}, null);
I also found out this question on StackOverflow, where it is given that we must do something like:
SessionConfiguration sessionConfiguration = new SessionConfiguration(SessionConfiguration.SESSION_REGULAR, Collections.singletonList(outputConfiguration), new HandlerExecutor(mCameraHandler.getLooper()), mCameraSessionListener);
cameraDevice.createCaptureSession(sessionConfiguration);
Firstly, is this the correct way to use, and if yes, then what is outputConfiguration and how to declare it correctly? In the Youtube tutorial, any outputConfiguration was never created!
So what changes am I expected to make to be able to use the code again?