kevinresol / react-native-sound-recorder

Simplest Sound Recorder for React Native
MIT License
119 stars 36 forks source link

Fix Options parsing on Android #51

Closed chakflying closed 3 years ago

chakflying commented 3 years ago

I'm on react-native 0.63.4, and kept getting native error "Cannot cast String to Double". I think either getConstants() is not getting used correctly, or something is different in the way NativeMap works. Either way this commit should fix the error.

kevinresol commented 3 years ago

This is not correct. You are not supposed to pass the name of the constants to the API.

aytacabay commented 3 years ago

I am getting the same error. What @chakflying said is true.

kevinresol commented 3 years ago

As I said, this is caused by a wrong use of the API.

Instead of SoundRecorder.start(path, {quality: 'QUALITY_MAX'}) you should write SoundRecorder.start(path, {quality: SoundRecorder.QUALITY_MAX})

aytacabay commented 3 years ago

@kevinresol I saw it as "FORMAT_" in the README.md document so I guess I'm confused and thought we would define it as this string. Now fixed to {source: SoundRecorder.SOURCE_MIC} and it works. Thank you