How to capture video using Intent and set path of recorded and limit recording time
11,735
To set the time limit and set the path to save the video
Intent takeVideoIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
takeVideoIntent.putExtra(MediaStore.EXTRA_DURATION_LIMIT, 30);
takeVideoIntent.putExtra(MediaStore.EXTRA_OUTPUT, Environment.getExternalStorageDirectory().getPath()+"videocapture_example.mp4");
startActivityForResult(takeVideoIntent, ACTION_TAKE_VIDEO);
Author by
mira
Updated on June 14, 2022Comments
-
mira almost 2 years
I use an example of recording video using intent based on
Intent intent = new Intent(android.provider.MediaStore.ACTION_VIDEO_CAPTURE); startActivityForResult(intent, REQUEST_VIDEO_CAPTURED);
For time limit I have used:
intent.putExtra("android.intent.extra.durationLimit", 5);
This records 5 seconds and then stop automatically.I have used example from URL: http://android-er.blogspot.cz/2011/04/start-video-recording-using.html This example is for me interesting because works on all my devices and is easy to implement.
Is it possible to set the path to save recorded video ? Let's say simple I need video to save to a specified file "myrecordedvideo.mp4" to a specified folder and need video to have exactly 5 seconds. Is it possible to make it easy way with this Intent ?