[Unhandled promise rejection: TypeError: null is not an object (evaluating 'RNAudioRecord.init')]
at node_modules/react-native-audio-record/index.js:7:43 in AudioRecord.init
at components/AudioTest.tsx:38:20 in recordSound
In AudioTest.tsx I just have a button that calls the following method (basically copied from the README):
import AudioRecord from "react-native-audio-record";
...
async function recordSound() {
await PermissionsAndroid.requestMultiple([
PermissionsAndroid.PERMISSIONS.RECORD_AUDIO,
]);
const options = {
sampleRate: 16000, // default 44100
channels: 1, // 1 or 2, default 1
bitsPerSample: 16, // 8 or 16, default 16
audioSource: 6, // android only (see below)
wavFile: 'test.wav' // default 'audio.wav'
};
AudioRecord.init(options); // <--- error happens here
AudioRecord.start();
AudioRecord.stop();
// or to get the wav file path
let audioFile = await AudioRecord.stop();
AudioRecord.on('data', data => {
console.log('data');
// base64-encoded audio data chunks
});
}
Can you tell me what I am doing wrong?
I am using expo
on Android
versions "react-native-audio-record": "^0.2.2"
Hi there,
I am getting this error:
In AudioTest.tsx I just have a button that calls the following method (basically copied from the README):
Can you tell me what I am doing wrong?
I am using
expo
onAndroid
versions"react-native-audio-record": "^0.2.2"