在android中播放html问题中嵌入的mp3文件
使用以下代码录制mp3音频并将其嵌入html时,该音频不会在浏览器中播放:在android中播放html问题中嵌入的mp3文件,android,Android,使用以下代码录制mp3音频并将其嵌入html时,该音频不会在浏览器中播放: mRecorder = new MediaRecorder(); mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC); mRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP
mRecorder = new MediaRecorder();
mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
mRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
mRecorder.setOutputFile("filepath");
mRecorder.prepare();
mRecorder.start();
addRecordingToMediaLibrary();
protected void addRecordingToMediaLibrary() {
ContentValues values = new ContentValues(4);
long current = System.currentTimeMillis();
//values.put(MediaStore.Audio.Media.TITLE,audiofile.getName());
values.put(MediaColumns.DATE_ADDED, (int) (current / 1000));
values.put(MediaColumns.MIME_TYPE, "audio/3gpp");
values.put(MediaColumns.DATA, audiofile.getAbsolutePath());
ContentResolver contentResolver = getContentResolver();
Uri base = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
Uri newUri = contentResolver.insert(base, values);
sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, newUri));
}
但是如果我把它改成
mRecorder = new MediaRecorder();
mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
mRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
mRecorder.setOutputFile("filepath");
mRecorder.prepare();
mRecorder.start();
addRecordingToMediaLibrary();
声音在浏览器中播放,但干扰很大
i、 e.用MPEG_4替换outputformat,用AudioEncoder.AAC替换AudioEncoder
有谁能建议哪种格式最适合在android中嵌入html