@capgo/capacitor-audio-recorder
Crash-safe recording with format: 'aac'
Section titled “Crash-safe recording with format: 'aac'”Shipped in plugin 8.4.0 (implementation PR). startRecording accepts format?: 'm4a' | 'aac' on Android and iOS. The default 'm4a' is unchanged for existing apps.
Choose 'aac' when a recording must survive a crash, force quit, low battery, or a killed mediaserver process. ADTS writes self contained AAC frames into an .aac file, so playback works up to the last complete frame even when stopRecording never runs. 'm4a' still fits when you need a standard MPEG-4 container and you always get a clean stop.
On iOS, interrupted 'aac' segments are joined when recording stops by copying complete ADTS frames, without re-encoding or AVAssetExportSession. If joining fails, stopRecording can still resolve with mergeFailed and segments so you can recover manually.
See Crash-safe recording (format: 'aac') for when to opt in, tradeoffs, and platform specific stopRecording behavior.
Overview
Section titled “Overview”Use @capgo/capacitor-audio-recorder when your Capacitor app needs microphone capture without bolting on a separate native module per platform. Start and stop clips, pause mid take, poll input level for waveforms, and listen for recording errors while users move between foreground and background (with the right native entitlements).
Typical fits: voice memos, in app audio messages, field notes, lightweight podcast capture, and speech first features that must work in the mobile WebView and in mobile browsers.
Platform support
Section titled “Platform support”| Platform | Support | Notes |
|---|---|---|
| iOS | Yes | AVFoundation capture, optional resetToPlaybackOnStop to avoid quiet playback after recording |
| Android | Yes | MediaRecorder, pause or resume on API 24+ |
| Web | Yes | Browser MediaRecorder, stopRecording returns a Blob instead of a file URI |
Core Capabilities
Section titled “Core Capabilities”startRecording- Start recording audio using the device microphone. Optionalformat: 'm4a' | 'aac'on Android and iOS for crash tolerant ADTS output.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.
Public API
Section titled “Public API”| 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. |
addListener | Listen for recording errors. |
addListener | Listen for pause events emitted when a recording is paused. |
addListener | Listen for recording completion events. |
removeAllListeners | Remove all registered listeners. |
getPluginVersion | Get the native Capacitor plugin version. |
Source Of Truth
Section titled “Source Of Truth”This reference is synced from src/definitions.ts in capacitor-audio-recorder.
Keep going from @capgo/capacitor-audio-recorder
Section titled “Keep going from @capgo/capacitor-audio-recorder”If you are using @capgo/capacitor-audio-recorder to plan native media and interface behavior, connect it with Using @capgo/capacitor-audio-recorder for the native capability in Using @capgo/capacitor-audio-recorder, 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, Using @capgo/capacitor-video-player for the native capability in Using @capgo/capacitor-video-player, and @capgo/capacitor-video-player for the implementation detail in @capgo/capacitor-video-player.