所有,我正在使用录音机录音.
情况1:如果我使用安装Android 2.2版本的设备,我录制的音频组合起来很好.
情况2:如果我在Android 1.6安装的设备中使用它,我无法播放组合的音频文件.
它只播放第一个录制的音频和下一个录制的音频文件保持空没有声音.
我也没有在Logcat中收到任何错误.
我使用以下代码录制音频:
mRecorder = new MediaRecorder(); mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC); mRecorder.setOutputFormat(MediaRecorder.OutputFormat.RAW_AMR); mRecorder.setOutputFile(main_record_file); mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); mRecorder.prepare(); mRecorder.start();@H_502_13@我也试过mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT);
public void createCombineRecFile(){ combined_file_stored_path=getFilename_combined_raw(); // File path in String to store recorded audio byte fileContent[]=null; FileInputStream ins; FileOutputStream fos = null; try{ fos = new FileOutputStream(combined_file_stored_path,true); } catch (FileNotFoundException e1){ // TODO Auto-generated catch block e1.printStackTrace(); } for(int i=0;i<audNames.size();i++){ try{ File f=new File(audNames.get(i)); Log.v("Record Message","File Length=========>>>"+f.length()); fileContent = new byte[(int)f.length()]; ins=new FileInputStream(audNames.get(i)); int r=ins.read(fileContent);// Reads the file content as byte from the list. Log.v("Record Message","Number Of Bytes Readed=====>>>"+r); fos.write(fileContent);//Write the byte into the combine file. Log.v("Record Message","File======="+i+"is Appended"); } catch (FileNotFoundException e){ // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } try{ fos.close(); Log.v("Record Message","===== Combine File Closed ====="); } catch (IOException e){ // TODO Auto-generated catch block e.printStackTrace(); } }@H_502_13@让我知道任何细节需要.谢谢.