start failed
moloudayat opened this issue · 1 comments
moloudayat commented
I used start and stop in document but I get this error from android studio and in my emulator it simply said start failed. I dont know what to do I'm new in audio.
java.lang.RuntimeException: start failed.
at android.media.MediaRecorder.start(Native Method)
at com.kevinresol.react_native_sound_recorder.RNSoundRecorderModule.start(RNSoundRecorderModule.java:119)
at java.lang.reflect.Method.invoke(Native Method)
at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:158)
at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29)
at android.os.Looper.loop(Looper.java:154)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:232)
at java.lang.Thread.run(Thread.java:761)
//################my code####################
_playPause = () => {
SoundRecorder.start(SoundRecorder.PATH_CACHE + '/test.mp4')
.then(function () {
console.log('started recording');
});
}
_stop = () => {
SoundRecorder.stop()
.then(function (result) {
console.log('ddd stopped recording, audio file saved at: ' + result.path);
});
}
render() {
return (
<View>
<View >
<Button title={'start recording'} onPress={this._playPause} />
<Button title={'Stop'} onPress={this._stop} />
</View>
</View>
)
}```
kevinresol commented
You need to request permission from user first.