New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-native-audio-recording-stream

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-audio-recording-stream

Audio record buffers for React Native

latest
Source
npmnpm
Version
1.0.1
Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

react-native-audio-recording-stream

Audio record buffers for iOS and Android.

Install

yarn add react-native-audio-recording-stream
react-native link react-native-audio-recording-stream

Usage

import AudioRecord from 'react-native-audio-recording-stream';

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'
  chunkSize: 4096, //8192
};

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
});

For audioSource use one of the constant values from here. Default value is 6 (VOICE_RECOGNITION).

Use 3rd-party module like buffer to decode base64 data. Example -

// yarn add buffer
import { Buffer } from 'buffer';
chunk = Buffer.from(data, 'base64');

Don't forget to add microphone permission in your app.

Example

Example folder contain sample apps for recording (using this module) and playback (using 3rd party modules)

Credits/References

I'm not a native app developer. Most of the code is taken from online resources.

Keywords

react-native

FAQs

Package last updated on 23 Sep 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts