开发者

Autostart recording in MediaStore

开发者 https://www.devze.com 2023-01-26 03:14 出处:网络
I managed to record audio by sending intent with action Media开发者_如何学运维Store.Audio.Media.RECORD_SOUND_ACTION.

I managed to record audio by sending intent with action Media开发者_如何学运维Store.Audio.Media.RECORD_SOUND_ACTION. But is there a way to tell MediaStore application to automatically start recording without the need for user to press record button? I don't see relevant parameters nor MediaStore.Audio.Media nor in MediaStore.

And same question for video...


You can directly use the MediaRecorder object to record. This way you can control when and how to start the voice recording.

recorder = new MediaRecorder();
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
recorder.setOutputFile(path);
recorder.prepare();
recorder.start();
0

精彩评论

暂无评论...
验证码 换一张
取 消