I am using intent for record video.
so i use following code on recordVideo button\'s click
Videofilepath = \"\";
Intent intent = new Intent(android.p
Thanks for the workaround!
Here is more brushed and copy-paste usable code:
/**
* Create intent to take video.
*/
public static Intent createTakeVideoIntent() {
Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
Uri uri = getOutputVideoUri(); // create a file to save the video in specific folder
if (uri != null) {
intent.putExtra(MediaStore.EXTRA_OUTPUT, uri);
}
intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1); // set the video image quality to high
return intent;
}
@CheckForNull
private static Uri getOutputVideoUri() {
if (Environment.getExternalStorageState() == null) {
return null;
}
File mediaStorage = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM), "YOUR_APP_VIDEO");
if (!mediaStorage.exists() &&
!mediaStorage.mkdirs()) {
Log.e(YourApplication.TAG, "failed to create directory: " + mediaStorage);
return null;
}
// Create a media file name
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.US).format(new Date());
File mediaFile = new File(mediaStorage, "VID_" + timeStamp + ".mp4");
return Uri.fromFile(mediaFile);
}
Tested on Nexus 4 v4.3 JWR66Y