Android intent 如何以编程方式捕获视频持续时间?

Android intent 如何以编程方式捕获视频持续时间?,android-intent,Android Intent,在我的应用程序中,我以10秒的时间捕获视频。使用“额外持续时间”限制的方法。我的代码在索尼2.3中运行得很好。但在htc和lg等其他移动设备中,我的时间持续时间超过10秒。。。如何纠正这种情况 Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); Uri videofileuri = getOutputMediaFileUri(MEDIA_TYPE_VIDEO); // cre

在我的应用程序中,我以10秒的时间捕获视频。使用“额外持续时间”限制的方法。我的代码在索尼2.3中运行得很好。但在htc和lg等其他移动设备中,我的时间持续时间超过10秒。。。如何纠正这种情况

            Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);

            Uri videofileuri = getOutputMediaFileUri(MEDIA_TYPE_VIDEO);  // create a file to save the video
            intent.putExtra(MediaStore.EXTRA_OUTPUT,videofileuri);  // set the image file name
            intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1); 
            intent.putExtra(MediaStore.EXTRA_DURATION_LIMIT,10);

            // start the Video Capture Intent
            startActivityForResult(intent, CAPTURE_VIDEO_ACTIVITY_REQUEST_CODE);
我的代码是:

Intent videoIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
videoIntent.putExtra(MediaStore.EXTRA_DURATION_LIMIT, limit);
videoIntent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 0);
startActivityForResult(videoIntent, ACTION_TAKE_VIDEO);
            Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);

            Uri videofileuri = getOutputMediaFileUri(MEDIA_TYPE_VIDEO);  // create a file to save the video
            intent.putExtra(MediaStore.EXTRA_OUTPUT,videofileuri);  // set the image file name
            intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1); 
            intent.putExtra(MediaStore.EXTRA_DURATION_LIMIT,10);

            // start the Video Capture Intent
            startActivityForResult(intent, CAPTURE_VIDEO_ACTIVITY_REQUEST_CODE);

是否有其他方法限制持续时间???

您可以这样使用

            Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);

            Uri videofileuri = getOutputMediaFileUri(MEDIA_TYPE_VIDEO);  // create a file to save the video
            intent.putExtra(MediaStore.EXTRA_OUTPUT,videofileuri);  // set the image file name
            intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1); 
            intent.putExtra(MediaStore.EXTRA_DURATION_LIMIT,10);

            // start the Video Capture Intent
            startActivityForResult(intent, CAPTURE_VIDEO_ACTIVITY_REQUEST_CODE);

意向视频意向=新意向(MediaStore.ACTION\u VIDEO\u CAPTURE);videoIntent.putExtra(MediaStore.EXTRA\u DURATION\u LIMIT,LIMIT);videoIntent.putExtra(MediaStore.EXTRA视频质量,0);startActivityForResult(视频意图、行动和视频);