jsierles / react-native-audio

Audio recorder library for React Native
MIT License
1.16k stars 539 forks source link

The callback prepareRecordingAtPath() exists in module AudioRecorderManager, but only one callback may be registered to a function in a native module. #334

Closed grs786 closed 5 years ago

grs786 commented 5 years ago

Version

Tell us which versions you are using ( you can see the versions in your package.json ):

react-native-audio : 4.3.0 react-native :0.57.4 react : 16.6.0-alpha.8af6728 using react-native-sound ? Yes

Expected behaviour : it should record audio when user click multiple times on record audio.

It keeps on crashing and prompt with a message "The callback prepareRecordingAtPath() exists in module AudioRecorderManager, but only one callback may be registered to a function in a native module". when user click on the record audio.

Steps to reproduce

let newPath = audioPath + '/' + this.nameGenerator() this.setState({ currentAudioPath: newPath }, () => { console.log('checkl==== ', this.state.currentAudioPath)

  if (this.state.currentAudioPath && this.state.currentAudioPath.length > 1) {
    AudioRecorder.prepareRecordingAtPath(newPath, {
      SampleRate: 22050,
      Channels: 2,
      AudioQuality: "High",
      AudioEncoding: "aac"
    });
  } else {
    console.log('esle block')
  }
aJIEw commented 5 years ago

I think it means the if statement gets called twice before recording started, you can try log it before prepareRecordingAtPath