Android的限制时间使用意图记录 [英] Android limit time recording using intent

查看:969
本文介绍了Android的限制时间使用意图记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何限制的录制意图是什么时候? 我trye​​d这code:

How can I limit recording when using intents ? I tryed this code:

 Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
 intent.putExtra("android.intent.extra.durationLimit",5);    
 startActivityForResult(intent,RQS_RECORDING);

的code这部分工作正常,当我录制视频。时间是倒数从5到0和5秒记录自动停止之后。但是这有限的时间内不,当我录音的工作。为什么呢?

This part of code works fine when I record video. Time is countdown from 5 to 0 and after 5 seconds recording automatically stop. But this limited time does not work when I record sound. Why ?

Intent intent = new Intent(MediaStore.Audio.Media.RECORD_SOUND_ACTION);
intent.putExtra("android.intent.extra.durationLimit", 5);
startActivityForResult(intent, RQS_RECORDING);

为什么这个时候极值5秒的时候我录音不工作?

Why this time limit 5 seconds does not work when I record sound ?

推荐答案

我有一个类似的问题,我用低于code段固定我的问题:

I Have a similar problem and I fixed my problem using below code snippet:

Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_VIDEO_CAPTURE);
cameraIntent.putExtra(MediaStore.EXTRA_DURATION_LIMIT, 5);
startActivityForResult(this, cameraIntent,CAMERA_PIC_REQUEST);

在这里CAMERA_PIC_REQUEST是我的int类型为:

where CAMERA_PIC_REQUEST is my int type as:

private static final int CAMERA_PIC_REQUEST = 1337;

这篇关于Android的限制时间使用意图记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆