I want to capture video and store video at specific location other than default location.
I know there is a method with MediaStore called setOutPutFile(\"Strin
I wasn't happy with any of the solutions provided here. Here's an extremely simple solution that will save the video in folder of your choice.
private static final int REQUEST_VIDEO_CAPTURE = 300;
private Uri videoUri;
private void dispatchVideoIntent(){
Intent takeVideoIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
File outputFile = new File("your file path goes here");
videoUri = Uri.fromFile(outputFile);
takeVideoIntent.putExtra(MediaStore.EXTRA_OUTPUT, videoUri);
if (takeVideoIntent.resolveActivity(getPackageManager()) != null) {
startActivityForResult(takeVideoIntent, REQUEST_VIDEO_CAPTURE);
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == REQUEST_VIDEO_CAPTURE && resultCode == RESULT_OK && videoUri != null) {
// do what you want with videoUri
}
}