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

I am using an example of video recording using intent based on

Intent intent = new Intent(android.provider.MediaStore.ACTION_VIDEO_CAPTURE); startActivityForResult(intent, REQUEST_VIDEO_CAPTURED); 

For the duration I used: intent.putExtra("android.intent.extra.durationLimit", 5); It records 5 seconds and then stops automatically.

I used the example from the URL: http://android-er.blogspot.cz/2011/04/start-video-recording-using.html This example is interesting to me because it works on all my devices and is easy to implement.

Can I set the path to save the recorded video? Say, I just need the video to be saved in the specified file β€œmyrecordedvideo.mp4” to the specified folder and the video should be exactly 5 seconds. Can this be done with this intention?

+4
source share
1 answer

To set a 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); 
+6
source

All Articles