If you are looking to capture a video for particular time interval using default camera, then follow the below code to achieve the same.
Record video from camera for 60 seconds
private void captureVideoFromCamera(){
Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
intent.putExtra(MediaStore.EXTRA_DURATION_LIMIT, 60);
intent.putExtra("EXTRA_VIDEO_QUALITY", 0);
startActivityForResult(intent, CAPTURE_VIDEO_REQUEST);
}
Here the maximum duration is 60 seconds and not 60 milliseconds.
If you are calling this method from Fragment, then use:
getActivity().startActivityForResult(intent, CAPTURE_VIDEO_REQUEST);
But if you are calling this method from Activity then simply write the below code.
startActivityForResult(intent, CAPTURE_VIDEO_REQUEST);
0 Comment(s)