1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
Intent takeVideoIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
File dir = new File(Environment.getExternalStorageDirectory () + "/tmp");
if (!dir.exists())
dir.mkdirs();
File newFile = new File(dir.getPath(), "video.mp4");
try {
newFile.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
Uri uri = Uri.fromFile(newFile);
takeVideoIntent.putExtra(MediaStore.EXTRA_OUTPUT, uri);
takeVideoIntent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);
startActivityForResult(takeVideoIntent, VIDEO_RESULT); |
Partager