Closed yumweb closed 6 years ago
Which option is actually causing the error? source or format?
Any of the option throws this error. I tried them both together and individually as well
The error is thrown when the library tries to read the recorded file, to get the duration. Since you said the output file is corrupted, I think that's why the error is thrown.
Now the problem gets to why the recorder can't produce the correct file.
I suggest debugging by making sure the parameters passed to the Media Recorder are valid e.g. setOutputFormat()
Let me check that.
Will SoundRecorder.VOICE_CALL
require additional permissions?
I'm not sure. Btw I think it should be SoundRecorder.SOURCE_VOICE_CALL
Oops! That's right. Will change it and re-check. Thanks!
Okay. I think I figured it out. There is a problem with SoundRecorder.SOURCE_VOICE_CALL
This source does not work with all devices. Some manufacturers disable this and can't be used. Ref: https://developer.android.com/reference/android/media/MediaRecorder.AudioSource.html#VOICE_CALL
Closing this issue for now. Thanks!
This fix occurs on stop:
Try to put this
try { retriever.setDataSource(mOutput); } catch (Exception e) { promise.reject("stopping_failed" , "Stop failed " + e); return; }
This catch the error and solve the issue!
Hi Kevin,
Thanks for this module. It has been quite easier to use than the other libraries. Although, I have been facing some issues when recording using options on Android. I am not sure if this issue is specific to me or a bug in general. Recording works perfectly fine if no options are passed; but when any options are passed the app throws an error.
Below is the code that I am trying to use passing the additional
source
andformat
options. With the source set toSoundRecorder.VOICE_CALL
I am basically trying to record the call conversation.I get the following error at the time of stopping the recording. A corrupted file is saved to the location specified.
Here is the screenshot from the app
Will appreciate your help!