注册

android 实时语音,调用MediaRecorder录音之后,语音没有声音

在VoiceActivity中加入如下代码
recorder = new MediaRecorder(); recorder.setAudioSource(MediaRecorder.AudioSource.MIC); recorder.setOutputFormat(MediaRecorder.OutputFormat.DEFAULT); recorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT);
try { Date date = new Date();
SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
filename = df.format(date);
File file = new File(App.dir,filename+".3gpp");
 file.createNewFile();
recorder.setOutputFile(file.getAbsolutePath());
recorder.prepare(); recorder.start(); } catch (IOException e) { e.printStackTrace(); }
实时语音就没有声音了
 
已邀请:
首先看看语音文件有没有正式生成,
然后播放语音文件的话 调用播放语音的api了。
 

要回复问题请先登录注册