Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

startRecording #18

Closed
nzala opened this issue Feb 8, 2017 · 19 comments
Closed

startRecording #18

nzala opened this issue Feb 8, 2017 · 19 comments

Comments

@nzala
Copy link

nzala commented Feb 8, 2017

wavsetupRecorder();
recorder.startRecording();

E/AudioRecord: Could not get audio input for record source 1, sample rate 44100, format 0x1, channel mask 0x10, session 161, flags 0
E/AudioRecord-JNI: Error creating AudioRecord instance: initialization check failed with status -22.
E/android.media.AudioRecord: Error code -20 when initializing native AudioRecord object.
E/AndroidRuntime: FATAL EXCEPTION: Thread-367
                  Process: com PID: 3241
                  java.lang.IllegalStateException: startRecording() called on an uninitialized AudioRecord.
                      at android.media.AudioRecord.startRecording(AudioRecord.java:885)
                      at omrecorder.PullTransport$AbstractPullTransport.preparedSourceToBePulled(PullTransport.java:89)
                      at omrecorder.PullTransport$AbstractPullTransport.start(PullTransport.java:70)
                      at omrecorder.AbstractRecorder$1.run(AbstractRecorder.java:29)
                      at java.lang.Thread.run(Thread.java:818)
@nzala nzala changed the title wavsetupRecorder(); recorder.startRecording(); startRecording Feb 8, 2017
@nzala nzala closed this as completed Feb 8, 2017
@nzala nzala reopened this Feb 8, 2017
@nzala
Copy link
Author

nzala commented Feb 8, 2017

@nzala
Copy link
Author

nzala commented Feb 8, 2017

@nzala
Copy link
Author

nzala commented Feb 8, 2017

E/android.media.AudioRecord: Error code -20 when initializing native AudioRecord

@kailash09dabhi
Copy link
Owner

pls show your wavsetupRecorder() method. It should be some illegal parameter not sure of though

@nzala
Copy link
Author

nzala commented Feb 13, 2017

private void wavsetupRecorder() {
        recorder = OmRecorder.wav(
                new PullTransport.Default(wavAudioSourcemic(), new PullTransport.OnAudioChunkPulledListener() {
                    @Override
                    public void onAudioChunkPulled(final AudioChunk audioChunk) {
                        progressbar.setProgress((int) (audioChunk.maxAmplitude()));
                    }
                }), wavfile());
    }

    private AudioSource wavAudioSourcemic() {
        smart = new AudioSource.Smart(MediaRecorder.AudioSource.MIC, AudioFormat.ENCODING_PCM_16BIT,
                AudioFormat.CHANNEL_IN_MONO, frequency);
        return smart;
    }

@nzala
Copy link
Author

nzala commented Feb 13, 2017

file is read-Owner, Group
write-Owner only
hw make
read and write-Owner, Group, Others

@kailash09dabhi
Copy link
Owner

kailash09dabhi commented Feb 14, 2017

Are you sure you have write permission to record & access external storage in manifest?

@nzala
Copy link
Author

nzala commented Feb 14, 2017

yes

@nzala
Copy link
Author

nzala commented Feb 14, 2017

hw make
read and write-Owner, Group, Others

@kailash09dabhi
Copy link
Owner

i am saying about permission in manifest.. android.permission.WRITE_EXTERNAl_STORAGE

@nzala
Copy link
Author

nzala commented Feb 16, 2017

@nzala
Copy link
Author

nzala commented Feb 16, 2017

hw make wav file
read and write-Owner, Group, Others

@kailash09dabhi
Copy link
Owner

This issue only happens due to permission.. See you are also requesting on runtime as from android 6.0 onwards we need to request permission on runtime.

@nzala
Copy link
Author

nzala commented Feb 21, 2017

i slved i called recordInstance.release()
but hw make wav file
read and write-Owner, Group, Others
i have made all permission on runtime.

@kailash09dabhi
Copy link
Owner

kailash09dabhi commented Feb 21, 2017

I am glad you solved it you can explain more here how you solved to help other users.
If you want to release the audio source you can do by simply like this:

 pulltransport.audioSource().release();

@nzala
Copy link
Author

nzala commented Feb 21, 2017

yes
pulltransport.audioSource().release();
but hw make wav file
read and write-Owner, Group, Others
i have made all permission on runtime.

@nzala
Copy link
Author

nzala commented Feb 22, 2017

jus add

if (recorder == null)
            return;
        if (recorder != null) {
            recorder.stopRecording();
            pulltransport.audioSource().release();
            recorder = null;
        }

@nzala
Copy link
Author

nzala commented Feb 23, 2017

make wav file
read and write-Owner, Group, Others
i have made all permission on runtime.

@kenchoong
Copy link

Hey @nzala , how you call pulltransport.audioSource().release(); in your project? cause I call event call for audioSource() to pullTransport.. can you give me some hint?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants