jsierles / react-native-audio

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

prepareRecordingAtPath with default options fails #322

Open sankar4n opened 5 years ago

sankar4n 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.2 react : 16.5.0 using react-native-sound ? Yes

Expected behaviour :

AudioRecorder.prepareRecordingAtPath(path, {}) should prepare the file at the given path with default options

What were you trying to do and what did you expect to happen ?

Actual behaviour

File is not getting saved, no error is thrown.

What happened when your issue occurred ? The more details you provide here the better the odds are that someone will help you resolve your issue

Steps to reproduce

Please provide us with some code that we can run to reproduce your error.

Link to a git repo that reproduces bug

If you put a GitHub repo that reproduces your issue then you significantly increase your chances of getting help !

sankar4n commented 5 years ago

I just saw an error in the console and I noticed the TODO mark also: https://github.com/jsierles/react-native-audio/blob/master/ios/AudioRecorderManager.m#L246

error logged on the console is: error: The operation couldn’t be completed. (OSStatus error 1718449215.)

josefpohl commented 5 years ago

Hi there, I replicated this error seen by @hisankaran using a subset of the default configuration items. Similar setup except I am not using react-native-sound (yet). react: 16.8.3 react-native: 0.59.3 react-native-audio: 4.3.0

AudioRecorder.prepareRecordingAtPath(audioPath, {
       SampleRate: 44100.0,
       Channels: 2,
       AudioQuality: 'High',
       AudioEncoding: 'ima4',
      OutputFormat: 'mpeg_4',
       AudioSource: 0
    });

When I swapped it out for the AudioDemo config settings it worked as expected.

AudioRecorder.prepareRecordingAtPath(audioPath, {
      SampleRate: 22050,
      Channels: 1,
      AudioQuality: 'Low',
      AudioEncoding: 'aac',
      AudioEncodingBitRate: 32000
});

If I remove "ima4" and replace it with "aac" it does seem to work. Could "ima4" be the culprit?

Thanks, Joe