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

@dimer47/capacitor-microphone

v8.0.0

Published

Capacitor plugin for microphone audio recording with pause/resume support, status events, and cross-platform compatibility (iOS, Android, Web). Fork of @mozartec/capacitor-microphone.

Readme

A Capacitor plugin for microphone audio recording with pause/resume support, real-time status events, and cross-platform compatibility.

npm version License

Lire en Français

About

This plugin is a fork of @mozartec/capacitor-microphone originally created by Mozart. We are grateful for the solid foundation provided by the original project.

This fork was created to add advanced recording control needed for long-form audio recording use cases (meetings, interviews, lectures, etc.):

  • Pause & Resume — Full control over the recording flow without losing data
  • Status Tracking — Query the current recording state at any time
  • Native Events — Real-time status change notifications via event listeners
  • Full cross-platform support: iOS, Android, and Web

Platform Support

| | iOS | Android | Web | | ------------ | -------------------- | -------------------- | -------------------- | | Availability | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | Encoding | kAudioFormatMPEG4AAC (audio/aac) | MPEG_4 / AAC (audio/aac) | audio/webm or audio/mp4 or audio/ogg or audio/wav | | Extension | .m4a | .m4a | .webm or .mp4 or .ogg or .wav |

Installation

npm install @dimer47/capacitor-microphone
npx cap sync

iOS Setup

Add the following usage description to your app's Info.plist:

  • NSMicrophoneUsageDescription (Privacy - Microphone Usage Description)

Read about Configuring Info.plist in the iOS Guide for more information.

Android Setup

Add the following permission to your AndroidManifest.xml:

<uses-permission android:name="android.permission.RECORD_AUDIO" />

Note: Pause/Resume requires Android API 24+ (Android 7.0 Nougat).

Read about Setting Permissions in the Android Guide for more information.

Usage

import { Microphone } from '@dimer47/capacitor-microphone';

// Request permissions
const { microphone } = await Microphone.requestPermissions();

// Start recording
await Microphone.startRecording();

// Pause / Resume
await Microphone.pauseRecording();
await Microphone.resumeRecording();

// Check status
const { status } = await Microphone.getCurrentStatus();

// Listen to status changes
await Microphone.addListener('status', ({ status }) => {
  console.log('Recording status:', status);
});

// Stop and get the audio file
const recording = await Microphone.stopRecording();
console.log(recording.path, recording.duration, recording.mimeType);

API

checkPermissions()

checkPermissions() => Promise<PermissionStatus>

Checks microphone permission

Returns: Promise<PermissionStatus>

Since: 0.0.3


requestPermissions()

requestPermissions() => Promise<PermissionStatus>

Requests microphone permission

Returns: Promise<PermissionStatus>

Since: 0.0.3


startRecording()

startRecording() => Promise<{ status: string; }>

Starts recoding session if no session is in progress

Returns: Promise<{ status: string; }>

Since: 0.0.3


pauseRecording()

pauseRecording() => Promise<{ status: string; }>

Pauses recoding session if one is in progress

Returns: Promise<{ status: string; }>

Since: 0.0.3


resumeRecording()

resumeRecording() => Promise<{ status: string; }>

Resumes recoding session if one is paused

Returns: Promise<{ status: string; }>

Since: 0.0.3


getCurrentStatus()

getCurrentStatus() => Promise<{ status: string; }>

Gets current recording status

Returns: Promise<{ status: string; }>

Since: 0.0.3


addListener('status', ...)

addListener(eventName: 'status', listenerFunc: (status: { status: string; }) => void) => Promise<PluginListenerHandle>

Adds a listener to microphone status updates

| Param | Type | Description | | ------------------ | ----------------------------------------------------- | -------------------------------- | | eventName | 'status' | status | | listenerFunc | (status: { status: string; }) => void | function to be executed on event |

Returns: Promise<PluginListenerHandle>

Since: 0.0.4


removeStatusListener(...)

removeStatusListener(eventName: 'status', listenerFunc: (status: { status: string; }) => void) => Promise<void>

Removes a specific listener from microphone status updates

| Param | Type | Description | | ------------------ | ----------------------------------------------------- | ---------------------- | | eventName | 'status' | status | | listenerFunc | (status: { status: string; }) => void | function to be removed |

Since: 0.0.4


removeAllListeners()

removeAllListeners() => Promise<void>

Removes all listeners from microphone status updates

Since: 0.0.4


stopRecording()

stopRecording() => Promise<AudioRecording>

Stops recoding session if one is in progress

Returns: Promise<AudioRecording>

Since: 0.0.3


Interfaces

PermissionStatus

| Prop | Type | | ---------------- | ------------------------------------------------------------------------------- | | microphone | MicrophonePermissionState |

PluginListenerHandle

| Prop | Type | | ------------ | ----------------------------------------- | | remove | () => Promise<void> |

AudioRecording

| Prop | Type | Description | Since | | -------------- | ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | ----- | | path | string | Platform-specific file URL that can be read later using the Filesystem API. | 0.0.3 | | webPath | string | webPath returns a path that can be used to set the src attribute of an audio element and can be useful for testing. | 0.0.3 | | duration | number | recoding duration in milliseconds | 0.0.3 | | format | string | file extension: ".m4a" for (iOS and Android) and ".webm" | ".mp4" | ".ogg" | ".wav" for Web based on compatibility | 0.0.3 | | mimeType | string | file encoding: "audio/aac" for (iOS and Android) and "audio/webm | "audio/mp4" | "audio/ogg" | "audio/wav" for Web based on compatibility | 0.0.3 |

Type Aliases

MicrophonePermissionState

PermissionState | 'limited'

PermissionState

'prompt' | 'prompt-with-rationale' | 'granted' | 'denied'

Status Messages

The following status strings are returned by the API methods and emitted through status events:

| Status | Description | | ---------------------------------- | ------------------------------------------ | | recording stared | Recording has started successfully | | recording in progress | A recording is currently in progress | | recording paused | Recording has been paused | | recording resumed | Recording has been resumed | | no recording in progress | No active recording session | | microphone permission not granted| Microphone permission was not granted | | cannot record on this phone | Device does not support audio recording | | recording failed | An error occurred during recording | | failed to fetch recording | Could not retrieve the recorded audio file | | microphone is busy | Microphone is already in use |

Acknowledgments

This project is a fork of @mozartec/capacitor-microphone by Mozart. Thank you for creating and maintaining the original plugin that made this work possible.

License

MIT - See LICENSE for details.