Skip to content

Latest commit

 

History

History
55 lines (40 loc) · 1.25 KB

README.md

File metadata and controls

55 lines (40 loc) · 1.25 KB

react-native-recording npm version

React Native audio recording module used for DSP with Android + iOS

Install

$ npm i react-native-recording

Usage

import { PermissionsAndroid } from "react-native";
import Recording from "react-native-recording";

await PermissionsAndroid.requestMultiple([
  PermissionsAndroid.PERMISSIONS.RECORD_AUDIO,
]);

Recording.init({
  bufferSize: 4096,
  sampleRate: 44100,
  bitsPerChannel: 16,
  channelsPerFrame: 1,
});

const listener = Recording.addRecordingEventListener((data) =>
  console.log(data)
);

Recording.start();

// stop recording
Recording.stop();
listener.remove();

Microphone request for iOS 10 and above

As of iOS 10.0, you must declare an intention to access a microphone. Add NSMicrophoneUsageDescription key and declaration value in Info.plist.

<dict>
    ...
	<key>NSMicrophoneUsageDescription</key>
	<string>This app uses the microphone to record the soundscape.</string>
    ...
</dict>