相关疑难解决方法(0)

如何将音频文件录制为.m4a格式?

如何将音频文件录制为.m4a格式.

我使用下面的代码:

public void startRecording() throws IOException {

    recorder = new MediaRecorder();

    path = "/sdcard/pithysongs_" + System.currentTimeMillis() + ".m4a";

    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
                + ".");
    }

    recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
    recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
    recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
    recorder.setOutputFile(path);
    recorder.prepare();
    recorder.start();
    }
Run Code Online (Sandbox Code Playgroud)

谢谢..

android record

3
推荐指数
1
解决办法
7839
查看次数

标签 统计

android ×1

record ×1