Question

I am working on an android app and I want to record two way audio of a call. I am performing the test via the emulator by doing a gsm call and then pressing the start record button from my app.

I keep on getting the following error though:

java.lang.RuntimeException: start failed.

Below is how I am performing the record:

private void startRecording()
    {
        mRecorder = new MediaRecorder();
        mRecorder.setAudioSource(MediaRecorder.AudioSource.VOICE_CALL);
        mRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
        mRecorder.setOutputFile(mFileName);
        mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
        try
        {
            mRecorder.prepare();
            mRecorder.start();
        }
        catch (IOException ex)
        {
            Log.e(LOG_TAG, ex.toString());
        }
        catch (Exception ex)
        {
            Log.e(LOG_TAG, ex.toString());
        }

    }

I read that some device don't allow two way audio recording and that in that case you should default back to using the MIC to do the recording, however, I assume that this wouldn't be the reason for the emulator.

Thanks for any help you can provide,

Was it helpful?

Solution

In the documentation, you can find:

Note: Currently, MediaRecorder does not work on the emulator.

Hope it can help you.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top