从Android应用捕获音频 [英] Capture audio from android app

查看:226
本文介绍了从Android应用捕获音频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图捕捉从应用程序的音频。

我使用的:

 意向意图=新意图(MediaStore.Audio.Media.RECORD_SOUND_ACTION);
startActivityForResult(意向,Constants.RESULT_UPLOAD_AUDIO);

当我点击捕获音频按钮,我返回到应用程序中的onActivityResult(INT申请code,INT结果code,意图数据),其中数据为空。

它工作正常的视频:

 意向意图=新意图(MediaStore.ACTION_VIDEO_CAPTURE);
startActivityForResult(意向,Constants.RESULT_UPLOAD_VIDEO);


解决方案

我面临了类似的问题。我做了以下作为工作周围和它的作品完美的罚款:

<一个href=\"http://stackoverflow.com/questions/6746979/invoking-audio-recorder-and-getting-the-resulting-file\">Invoking录音机和获取所产生的文件

希望这有助于。

I am trying to capture audio from the app.

I use:

Intent intent = new Intent(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.

这篇关于从Android应用捕获音频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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