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 ?
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.
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);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With