Skip to main content

Audio Recorder Capacitor plugin

Record audio on iOS, Android, and Web with simple controls and formats

Install

bun add @capgo/capacitor-audio-recorder bunx cap sync
npm, pnpm or yarn
  • npm install @capgo/capacitor-audio-recorder
  • pnpm add @capgo/capacitor-audio-recorder
  • yarn add @capgo/capacitor-audio-recorder

Guide

How to use Audio Recorder in Capacitor

Test on device

Download the Capgo app, then scan the QR code.

Audio Recorder plugin preview QR code

Using @capgo/capacitor-audio-recorder

Capacitor plugin contract for recording audio.

Install

bun add @capgo/capacitor-audio-recorder
bunx cap sync

bunx cap sync copies the plugin's native code into your native projects. Run it again after every plugin upgrade.

Import

import { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';

API at a glance

Method Description
startRecording Start recording audio using the device microphone.
pauseRecording Pause the ongoing recording. Only available on Android (API 24+), iOS, and Web.
resumeRecording Resume a previously paused recording.
stopRecording Stop the current recording and persist the recorded audio.
cancelRecording Cancel the current recording and discard any captured audio.
getRecordingStatus Retrieve the current recording status.
getCurrentAmplitude Retrieve the current input amplitude (microphone level) as a normalized number in the [0, 1] range.
checkPermissions Return the current permission state for accessing the microphone.
requestPermissions Request permission to access the microphone.

Examples

startRecording()

Start recording audio using the device microphone.

import { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';

await CapacitorAudioRecorder.startRecording();

pauseRecording()

Pause the ongoing recording. Only available on Android (API 24+), iOS, and Web.

import { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';

await CapacitorAudioRecorder.pauseRecording();

resumeRecording()

Resume a previously paused recording.

import { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';

await CapacitorAudioRecorder.resumeRecording();

stopRecording()

Stop the current recording and persist the recorded audio.

import { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';

const result = await CapacitorAudioRecorder.stopRecording();
console.log(result);

cancelRecording()

Cancel the current recording and discard any captured audio.

import { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';

await CapacitorAudioRecorder.cancelRecording();

getRecordingStatus()

Retrieve the current recording status.

import { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';

const result = await CapacitorAudioRecorder.getRecordingStatus();
console.log(result);

The table above lists the 9 core methods. Listener and version helpers, and the full contract of each method, are documented in the GitHub repository.

Listen to events

addListener returns a handle. Call handle.remove() when the screen unmounts, or CapacitorAudioRecorder.removeAllListeners() to clear every listener.

Full reference

Keep going from Using @capgo/capacitor-audio-recorder

If you are using Using @capgo/capacitor-audio-recorder to plan native media and interface behavior, connect it with @capgo/capacitor-audio-recorder for the implementation detail in @capgo/capacitor-audio-recorder, Getting Started for the implementation detail in Getting Started, Using @capgo/capacitor-live-activities for the native capability in Using @capgo/capacitor-live-activities, @capgo/capacitor-live-activities for the implementation detail in @capgo/capacitor-live-activities, and Using @capgo/capacitor-video-player for the native capability in Using @capgo/capacitor-video-player.

FAQ

Audio Recorder plugin FAQ

How do I install the Audio Recorder plugin in a Capacitor app?

Run "bun add @capgo/capacitor-audio-recorder" (or "npm install @capgo/capacitor-audio-recorder"), then run "bunx cap sync" so the iOS and Android projects pick up the native code. Import it from "@capgo/capacitor-audio-recorder" in your app code.

Does @capgo/capacitor-audio-recorder work with React, Vue and Angular?

Yes. Audio Recorder is a Capacitor package, so it works with any web framework that runs inside Capacitor, including Ionic, React, Vue, Angular, Svelte and plain JavaScript.

Which Capacitor version does @capgo/capacitor-audio-recorder support?

Capgo plugins follow Capacitor's major version: use the plugin major version that matches your Capacitor major version (for example plugin v8 with Capacitor 8). The compatibility table in the GitHub README lists the maintained versions.

Is @capgo/capacitor-audio-recorder free and open source?

Yes. The source code is public on GitHub at https://github.com/Cap-go/capacitor-audio-recorder/ and the package is free to install from npm. Bug reports and pull requests are welcome.

Can I update code that uses Audio Recorder without an App Store review?

Installing or upgrading the plugin changes native code, so it needs a new store build. After that, JavaScript, HTML and CSS changes that call the plugin can ship instantly with Capgo live updates.

Ship Audio Recorder changes without waiting for app review

Once the plugin is in your store build, Capgo live updates push your JavaScript, HTML and CSS changes to users in minutes.

Start with Capgo