2013-03-21 45 views
4

设置路径我用的时间限制我已经使用基于如何使用意图和记录,并限制记录时间

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

记录使用意向的影像的例子来捕获视频:intent.putExtra("android.intent.extra.durationLimit", 5); 它记录5秒然后自动停止。

我从URL中使用例如: http://android-er.blogspot.cz/2011/04/start-video-recording-using.html 这个例子对我来说是有趣的,因为我所有的设备工程和易于实现。

是否可以设置保存录制视频的路径? 让我们假设简单我需要视频来保存到指定的文件“myrecordedvideo.mp4”到指定的文件夹,并需要视频有5秒。用这个Intent有可能让它变得简单吗?

回答

6

设置时间限制,并设置路径保存视频

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); 
+0

不,它不是5.1 – swapnil7 2016-03-08 05:08:25

+0

工作这不工作的牛轧糖 – 2017-09-04 09:45:49