0

I encode audio using the AAC encoder in my app and all works fine in Android, but the same APK crashes out when running in Chrome with ARC Welder.

My code looks like this:

    mRecorder = new MediaRecorder();
    mRecorder.setOnInfoListener(infoListener);

    String audioFilePath = mUri.getPath();
    mRecorder.setAudioSource(MediaRecorder.AudioSource.DEFAULT);
    mRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
    mRecorder.setOutputFile(audioFilePath);
    mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
    mRecorder.setAudioEncodingBitRate(256 * 1024);
    mRecorder.setAudioSamplingRate(44100);

    mRecorder.setMaxDuration(600000); // 600000ms = 10 minutes

    try{
        mRecorder.prepare();
    }catch (IOException ex){
        Log.e(TAG, "Prepare() failed", ex);
    }
    mRecorder.start();

It crashes on

    mRecorder.start();

I've found that by changing the Encoder and format to AMR-WB I can record and playback the audio OK, is there anyway that I can get AAC to work?

4

0 回答 0