以下代码在2.1中没有问题,private void startRecord(Context context, Intent intent){
String path = intent.getStringExtra(AndrecorderContactHelper.FILEPATH);
recorder.setAudioSource(MediaRecorder.AudioSource.VOICE_CALL);
//
String _type = AndrecorderConfiguration.getConfiguration(context).getRecordType();
int format = OutputFormat.DEFAULT;
if (_type.equalsIgnoreCase("amr"))
format = OutputFormat.RAW_AMR;
else if (_type.equalsIgnoreCase("3gp"))
format = OutputFormat.THREE_GPP;
else if (_type.equalsIgnoreCase("mp4"))
format = OutputFormat.MPEG_4;
recorder.setOutputFormat(format);
recorder.setAudioEncoder(AAC);
recorder.setOutputFile(path);
try {
recorder.prepare();
recorder.start();
} catch (IllegalStateException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
//
Log.i("whut", "开始录音");
recording = true;
}
但是在2.3中recorder.start()处就会出错.
logcat窗口提示 start failed: -22
在网上照了一些资料也没有看到解决的方案.
在此求助了.
String path = intent.getStringExtra(AndrecorderContactHelper.FILEPATH);
recorder.setAudioSource(MediaRecorder.AudioSource.VOICE_CALL);
//
String _type = AndrecorderConfiguration.getConfiguration(context).getRecordType();
int format = OutputFormat.DEFAULT;
if (_type.equalsIgnoreCase("amr"))
format = OutputFormat.RAW_AMR;
else if (_type.equalsIgnoreCase("3gp"))
format = OutputFormat.THREE_GPP;
else if (_type.equalsIgnoreCase("mp4"))
format = OutputFormat.MPEG_4;
recorder.setOutputFormat(format);
recorder.setAudioEncoder(AAC);
recorder.setOutputFile(path);
try {
recorder.prepare();
recorder.start();
} catch (IllegalStateException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
//
Log.i("whut", "开始录音");
recording = true;
}
但是在2.3中recorder.start()处就会出错.
logcat窗口提示 start failed: -22
在网上照了一些资料也没有看到解决的方案.
在此求助了.
解决方案 »
- 新手求助
- IOS与android开发前景如何?大家各抒己见吧~给小弟点儿源头活水
- 在adb shell下直接执行可以加载起来的服务,在NDK下用system命令跑不起来,怪!
- 跑马灯
- ArrayAdapter的问题,我传进来一个20位的数组 但是显示出来就是40位 很邪门 内有代码 显示的是传进来数组位数的2倍
- eclipse导入android程序,不能运行????????????????????????????
- 单击按钮,在屏幕上画一条直线
- 服务器上放图片,客户端获取图片并展现出来,需要学哪些知识?
- 给一个物理地址,不是自己的,如何去到地图定位
- Android 深入开发的路怎么走?求大神推荐最新开发技术
- 字符列表
- 关于圆形progressbar的问题,不是有关于颜色的
你能详细介绍下么?
尤其是xda-developer上说了,一般的ROM在2.2和2.3都禁止通话录音.
只有修改的ROM,如果机子自带通话录音的话,这个VOICE_CALL才有用.