80,351
社区成员
发帖
与我相关
我的任务
分享
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;
}