'Exception in native call from JS error when triggering Audio Recording function using react-native-audio-recorder-player
I am trying to implement a recording function using react-native-audio-recorder-player, but whenever I try to trigger the onStartRecord() function I receive the following error :
My code for the onStartRecord() being:
const onStartRecord = async () => {
let iswritestoragegranted = await writetoexternalstorage();
let isrecordgranted = await recordaudiopermission();
if (iswritestoragegranted && isrecordgranted) {
const path = "sdcard/hello.m4a";
const audioSet = {
AudioEncoderAndroid: AudioEncoderAndroidType.AAC,
AudioSourceAndroid: AudioSourceAndroidType.MIC,
AVEncoderAudioQualityKeyIOS: AVEncoderAudioQualityIOSType.high,
AVNumberOfChannelsKeyIOS: 2,
AVFormatIDKeyIOS: AVEncodingOption.aac,
};
console.log("audioSet", audioSet);
const uri = await audioRecorderPlayer.startRecorder(path, audioSet);
audioRecorderPlayer.addRecordBackListener((e) => {
setRecordSecs(e.current_position);
setRecordTime(
audioRecorderPlayer.mmssss(Math.floor(e.current_position))
);
});
console.log(`uri: ${uri}`);
}
};
my console shows the following :
after this it crashes and shows the above error.
Have been trying to implement since a week now, and have not no clue why this keeps crashing, kindly let me know where have I gone wrong here and how could I resolve this. it would be a great help. Thanking you in advance. Let me know, if anything else is required for better understanding.
Thanks you
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|


