开发者

Capture audio from android app

开发者 https://www.devze.com 2023-03-04 12:24 出处:网络
I am trying to capture audio from the app. I use: Intent intent = new Intent(开发者_Python百科MediaStore.Audio.Media.RECORD_SOUND_ACTION);

I am trying to capture audio from the app.

I use:

Intent intent = new Intent(开发者_Python百科MediaStore.Audio.Media.RECORD_SOUND_ACTION);
startActivityForResult(intent, Constants.RESULT_UPLOAD_AUDIO);

As soon as I click the capture audio button, I am returned back to the app in onActivityResult(int requestCode, int resultCode, Intent data), where data is null.

It works fine for video:

Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
startActivityForResult(intent,Constants.RESULT_UPLOAD_VIDEO);


I was facing the similar problem. I did the following as a work around and it works perfectly fine:

Invoking audio recorder and getting the resulting file

Hope this helps.

0

精彩评论

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