Skip to content

How to use your library when recording audio using mic? #9

@Gaket

Description

@Gaket

Hello!

Thank you for sharing your work!

I am struggling to make it work in parallel with audio recording. I get MediaRecorder IllegalState exception again and again.

I am using your visualiser this way:

 private void startRecording() {
        mRecorder = new MediaRecorder();
        mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
        mRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
        mRecorder.setOutputFile(mFileName);
        mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_WB);

        try {
            mRecorder.prepare();
        } catch (IOException e) {
            Timber.e("prepare() failed");
        }
       mRecorder.start();
       mVisualizer.startListening();
    }

    private void stopRecording() {
        mVisualizer.stopListening();
        mRecorder.stop();
        mRecorder.release();
        mRecorder = null;
    }

What do I do wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions