MediaRecorder音频不会在电脑上播放

时间:2011-02-27 22:48:12

标签: android audio

我正在Android设备上录制音频,它将在设备上播放但不在计算机上播放。我觉得这与我给它的路径有关。在路径中,我指定了文件扩展名。我没有尝试过扩展和.3gp(设置了适当的输出格式),但它不会在电脑上播放。任何人都可以对此有所了解吗?

VLC发出以下错误

  

没有合适的解码器模块:   VLC不支持音频或视频格式“samr”。不幸的是,你无法解决这个问题。

// Set up sound recording
    recorder = new MediaRecorder();
    path = "/sdcard/prism/sound/";

    // Make sure the directory we plan to store the recording in exists
    directory = new File(path);
    directory.mkdirs();

    recorder.reset();

    recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
    recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
    recorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT);
    recorder.setOutputFile(path + username + "_" + taskId + ".mpeg4");// + ".mp3");

    //Sometime later after button presses recorder.prepare() and recorder.start() are called
    // then after stop is pressed recorder.stop() and recorder.release() are called

2 个答案:

答案 0 :(得分:1)

问题不在于您的应用,而是使用VLC,它只是不支持AMR。你怎么试着在AAC录音? mMediaRecorder.setAudioEncoder(3);

答案 1 :(得分:0)

不是最好的解决方案,但我使用AMR播放器将.amr文件转换为.mp3。

http://www.amrplayer.com/

如果有人有更好的解决方案,请回答问题,我会接受你的答案,而不是我的答案。

相关问题