Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to capture video using Intent and set path of recorded and limit recording time

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 ?

like image 680
mira Avatar asked Mar 21 '13 09:03

mira


People also ask

How do you record video on Android?

For most Android devices, you can find the video recorder under the camera app. Once you're in your camera, scroll along the bottom of your screen to find the Video tab. From here, you can press the record button on your screen to start the video and then press stop to end it.


1 Answers

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);
like image 141
Sunday G Akinsete Avatar answered Oct 31 '22 02:10

Sunday G Akinsete