以下代码在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
在网上照了一些资料也没有看到解决的方案.
在此求助了.
你能详细介绍下么?
尤其是xda-developer上说了,一般的ROM在2.2和2.3都禁止通话录音.
只有修改的ROM,如果机子自带通话录音的话,这个VOICE_CALL才有用.