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 🙏

© 2026 – Pkg Stats / Ryan Hefner

rns-recplay

v2.0.4

Published

High-performance React Native module for audio recording and audio playback on Android and iOS.

Readme

🎤 rns-recplay

A high-performance React Native audio recording and playback module with native-level control & compatible with webRTC. Designed for voice notes, chats, and media apps, offering smooth looping, precise progress tracking, and automatic playback interruption.


✨ Features

  • 🎙️ Audio Recording

    • High-quality AAC / M4A format
    • Real-time recording timer
    • Pause & resume support
  • 🔊 Audio Playback

    • Powered by ExoPlayer (Android) and AVPlayer (iOS)
    • Native-level performance
  • 🔄 Seamless Looping

    • Gapless looping handled natively
  • 📊 Progress Tracking

    • Position & duration updates every 500ms
  • 🛡️ Smart Audio Control

    • Automatically stops playback when recording begins
    • Prevents overlapping audio sessions

📦 Installation

npm install rns-recplay

or (Expo):

npx expo install rns-recplay

⚙️ Expo Configuration

Add the plugin to your app.json or app.config.json:

[
  "rns-recplay",
  {
    "microphonePermission": "Microphone is used strictly for voice messages and live audio or video interactions. Tap 'Allow' to enable microphone usage when needed."
  }
]

🚀 Usage

🎙️ Recording Example

import Recplay from 'rns-recplay';

const startMyRecording = async () => {
  try {
    const fileName = await Recplay.startRecording({
      fileName: "my_voice_note", // optional file name
      shouldStopPlayback: true,
      duck: true,
      mixWithOthers: true,
      onSecondsUpdate: (seconds) => console.log(`Recorded: ${seconds}s`)
    });

    console.log("Recording started:", fileName);
  } catch (err) {
    console.error(err);
  }
};

const stopMyRecording = async () => {
  const fileUri = await Recplay.stopRecording();
  console.log("File saved at:", fileUri);
};

🔊 Playback Example (Looping Enabled)

import Recplay from 'rns-recplay';

Recplay.playAudio({
  uri: "file:///path/to/audio.m4a",
  shouldStopPrevious: true,
  loop: true,
  mixWithOthers: true,
  duck: false,
  callbacks: {
    onStatus: (status) => console.log("Status:", status),
    onProgress: (position, duration) => console.log(`Progress: ${position} / ${duration}`),
    onPlaybackFinished: () => console.log("Playback finished"),
  }
});

📚 API Reference

🔌 Permission Checks

| Method | Description | | --------------------- | ------------------------------------------------ | | checkPermission() | Checks the current microphone permission status. | | requestPermission() | Triggers the system permission dialog. |

Returns: Promise<"granted" | "denied" | "blocked" | "unavailable">

Status Meanings:

  • granted: Permission is active. Ready to record.
  • denied: Not asked yet (iOS) or dismissed (Android). Can still ask.
  • blocked: User selected "Don't Allow" or "Never ask again". Must redirect to System Settings.
  • unavailable: Hardware is missing or restricted by OS.

🎙️ Recording

startRecording({ fileName?, shouldStopPlayback?, duck?, mixWithOthers?, onSecondsUpdate? })

| Parameter | Type | Default | Description | | -------------------- | ---------- | ------- | ------------------------------------------- | | fileName | string | null | Custom .m4a file name | | shouldStopPlayback | boolean | true | Stops any playing audio | | duck | boolean | true | Reduce volume of other audio when recording | | mixWithOthers | boolean | true | Mix recording with device playing audio | | onSecondsUpdate | function | null | Called every second |

Returns: Promise<string> (file name)


stopRecording()

Stops recording and releases the microphone.

Returns: Promise<string> (file URI)


pauseRecording()

Pauses the active recording session.

resumeRecording()

Resumes a paused recording session.


🔊 Playback

playAudio({ uri, shouldStopPrevious?, loop?, mixWithOthers?, duck?, callbacks? })

| Parameter | Type | Default | Description | | -------------------- | --------- | ------- | -------------------------------------------- | | uri | string | — | Audio file URI | | shouldStopPrevious | boolean | false | Stops previous playback | | loop | boolean | false | Enables native looping | | mixWithOthers | boolean | true | Mix audio playback with device playing audio | | duck | boolean | false | Reduce volume of other audio when playing | | callbacks | object | {} | Playback event callbacks |

Callback Options

| Callback | Params | Description | | -------------------- | ---------------------- | ------------------------ | | onStatus | (status) | Player state updates | | onProgress | (position, duration) | Playback progress | | onPlaybackFinished | () | Fired when playback ends |


stopPlayback()

Stops playback immediately.

togglePlayback()

Toggles between play and pause.

seekTo({ seconds })

| Parameter | Type | Description | | --------- | -------- | ------------------------ | | seconds | number | Seek position in seconds |


📌 Status Types

  • BUFFERING
  • PLAYING
  • PAUSED
  • ERROR
  • ENDED
  • IDLE

🛠️ Platform Support

| Platform | Supported | | ---------------- | --------- | | Android | ✅ | | iOS | ✅ | | Expo (Dev / EAS) | ✅ |


📄 License

MIT License