我已錄製3gp格式的音頻,並將其保存在SD卡中..這是我的代碼,它運行sucessfull ..我需要添加圖像到該音頻文件,以便添加的圖像將是專輯封面&當我嘗試播放從SD卡位置的android..like這個默認媒體播放器所記錄的聲音..在Android中錄製音頻
圖片中顯示的圖像是專輯封面,我有把它給我錄製的音頻文件
/**
* Starts a new recording.
*/
public void start() throws IOException {
String state = android.os.Environment.getExternalStorageState();
if (!state.equals(android.os.Environment.MEDIA_MOUNTED)) {
throw new IOException("SD Card is not mounted. It is " + state
+ ".");
}
// make sure the directory we plan to store the recording in exists
File directory = new File(path).getParentFile();
if (!directory.exists() && !directory.mkdirs()) {
throw new IOException("Path to file could not be created.");
}
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
System.out.println("audio_file_path : = " + path);
recorder.setOutputFile(path);
recorder.prepare();
recorder.start(); // Recording is now started
}