Audio Recording
React Native Quick Start
Platforms
- Android (5.0+, API 21+)
- iOS (11.0+)
Requirements
- Node.js (16+)
- Android SDK (21+)
- JDK (8+)
- Xcode (11+)
- CocoaPods
Quick Start
Setup
Set up the React Native environment.
- Enable the proper permission for recording with the hardware's microphone on both iOS and Android:
iOS
Open your Info.plist
and add the following line:
Android
Open your AndroidManifest.xml
and add the following line:
Usage
Access the singleton instance of VoiceProcessor
:
Add listeners for audio frames and errors:
Ask for audio record permission and start recording with the desired frame length and audio sample rate:
Stop audio capture:
Once audio capture has started successfully, any frame listeners assigned to the VoiceProcessor
will start receiving audio frames with the given frameLength
and sampleRate
.
Capturing with Multiple Listeners
Any number of listeners can be added to and removed from the VoiceProcessor
instance. However,
the instance can only record audio with a single audio configuration (frameLength
and sampleRate
),
which all listeners will receive once a call to start()
has been made. To add multiple listeners:
Demo
For the Voice Processor React Native SDK we have an example app that demonstrates how to use VoiceProcessor
in a React Native app.
Setup
Clone the react-native-voice-processor repository from GitHub:
Usage
- Install dependencies and setup environment:
- Connect a mobile device or launch a simulator. Then build and run the app:
- Toggle recording on and off with the button in the center of the screen. While recording, the VU meter on the screen will respond to the volume of incoming audio.
For more information on our Voice Processor demo for React Native, head over to our GitHub repository.