npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

react-native-live-audio-record

v1.1.7

Published

Get live audio recorder data for React Native

Downloads

117

Readme

react-native-live-audio-record

npm

Get live audio stream data for React Native with Android background recording support. Ideal for live voice recognition, transcribing, and continuous audio monitoring.

📖 About

This library is forked from xiqi/react-native-live-audio-stream and enhanced with background audio recording capabilities.

What's New:

  • Android: Foreground service with wake lock and battery optimization awareness

Install

yarn add react-native-live-audio-record
cd ios
pod install

Permissions and Setup

iOS

Add these lines to ios/[YOUR_APP_NAME]/info.plist

<key>NSMicrophoneUsageDescription</key>
<string>This app needs access to microphone to record audio for streaming.</string>

<!-- Background modes for audio recording -->
<key>UIBackgroundModes</key>
<array>
    <string>audio</string>
    <string>background-processing</string>
</array>

<!-- Required device capabilities -->
<key>UIRequiredDeviceCapabilities</key>
<array>
    <string>microphone</string>
</array>

Android

Add the following permissions to android/app/src/main/AndroidManifest.xml

<!-- Required permissions -->
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MICROPHONE" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />

<!-- Service declaration -->
<application>
    <service
        android:name="com.imxiqi.rnliveaudiostream.RNLiveAudioStreamService"
        android:enabled="true"
        android:exported="false"
        android:foregroundServiceType="microphone" />
</application>

Background Recording Support

This library now supports background audio recording on both platforms:

  • Android: Uses foreground service with persistent notification

Important: For reliable background recording, users should:

  1. iOS: Enable "Background App Refresh" for your app
  2. Android: Disable battery optimization for your app in device settings

Usage

import LiveAudioStream from 'react-native-live-audio-record';
// yarn add buffer
import { Buffer } from 'buffer';

const options = {
  sampleRate: 32000,  // default is 44100 but 32000 is adequate for accurate voice recognition
  channels: 1,        // 1 or 2, default 1
  bitsPerSample: 16,  // 8 or 16, default 16
  audioSource: 6,     // android only (see below)
  bufferSize: 4096    // default is 2048
};

LiveAudioStream.init(options);
LiveAudioStream.on('data', data => {
  // base64-encoded audio data chunks
  var chunk = Buffer.from(data, 'base64');
});
  ...
LiveAudioStream.start();
  ...
LiveAudioStream.stop();
  ...

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

Contributing

Feel free to submit issues and pull requests. For major changes, please open an issue first to discuss what you would like to change.

Development Setup

git clone <your-fork>
cd react-native-live-audio-record
npm install

# Test on example project
cd example
npm install
npx react-native run-ios
npx react-native run-android

Credits/References

Original Library:

Background Recording Enhancements:

Additional References:

License

MIT

Support