I want to save image stream (preferably 30fps) to the device. I came across this post.
How do I dump images in YUV_420_888 format using cameraX without encoding it in JPEG?
Also, I'll be glad if any one can suggest any direction in saving burst of images.
Till now I'm only saving an image by onclick of button
findViewById(R.id.capture_button).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
File file = new File(getExternalFilesDir(Environment.DIRECTORY_PICTURES),
"Image_" + System.currentTimeMillis() + ".jpg");
imageCapture.takePicture(file, new ImageCapture.OnImageSavedListener() {
@Override
public void onImageSaved(@NonNull File file) {
Toast.makeText(CameraCaptureActivity.this, "Photo saved as " + file.getAbsolutePath(), Toast.LENGTH_SHORT).show();
}
@Override
public void onError(@NonNull ImageCapture.ImageCaptureError imageCaptureError, @NonNull String message, @Nullable Throwable cause) {
Toast.makeText(CameraCaptureActivity.this, "Couldn't save photo: " + message, Toast.LENGTH_SHORT).show();
if (cause != null)
cause.printStackTrace();
}
});
}
});