Audio recorder with React Native

2.1k Views Asked by At

I am trying to add audio recorder in my app but facing too many issues because I am new in React Native please guide me about any good package for audio recording.

Thank you.

2

There are 2 best solutions below

0
Meisan Saba On

you can use react-native-audio-record with this link

for sample code can see this:

import AudioRecord from 'react-native-audio-record';
 
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);
 
AudioRecord.start();
 
AudioRecord.stop();
// or to get the wav file path
audioFile = await AudioRecord.stop();
 
AudioRecord.on('data', data => {
  // base64-encoded audio data chunks
});
1
Akram Syed On

Best option is to use react-native-audio-recorder-player.

It has a lot of examples and full support.