ee
npm install capacitor-plugin-recorderee
``bash`
npm install capacitor-plugin-recorder
npx cap sync
* requestPermission()
* checkPermission()
* startRecord(...)
* stopRecord()
* pauseRecord()
* resumeRecord()
* preparePlay(...)
* play(...)
* pausePlay(...)
* resumePlay(...)
* stopPlay(...)
* seekTo(...)
* getPlaybackStatus(...)
* getRecordingStatus()
* destroyPlayer(...)
* addListener('recordingStatusChange', ...)
* addListener('playbackStatusChange', ...)
* removeAllListeners()
* Interfaces
* Type Aliases
`typescript`
requestPermission() => Promise
Request microphone permission
Returns: Promise<PermissionStatus>
--------------------
`typescript`
checkPermission() => Promise
Check current permission status
Returns: Promise<PermissionStatus>
--------------------
`typescript`
startRecord(options?: StartRecordOptions | undefined) => Promise
Start recording audio
| Param | Type |
| ------------- | ----------------------------------------------------------------- |
| options | StartRecordOptions |
--------------------
`typescript`
stopRecord() => Promise
Stop recording and return the recorded file path
Returns: Promise<StopRecordResult>
--------------------
`typescript`
pauseRecord() => Promise
Pause the current recording
--------------------
`typescript`
resumeRecord() => Promise
Resume a paused recording
--------------------
`typescript`
preparePlay(options: PlayOptions) => Promise
Prepare an audio file for playback (loads metadata without playing).
Returns a playerId that must be used for all subsequent operations on this player.
| Param | Type |
| ------------- | --------------------------------------------------- |
| options | PlayOptions |
Returns: Promise<PreparePlayResult>
--------------------
`typescript`
play(options: PlayerOptions) => Promise
Start playing an audio file
| Param | Type |
| ------------- | ------------------------------------------------------- |
| options | PlayerOptions |
--------------------
`typescript`
pausePlay(options: PlayerOptions) => Promise
Pause audio playback
| Param | Type |
| ------------- | ------------------------------------------------------- |
| options | PlayerOptions |
--------------------
`typescript`
resumePlay(options: PlayerOptions) => Promise
Resume paused audio playback
| Param | Type |
| ------------- | ------------------------------------------------------- |
| options | PlayerOptions |
--------------------
`typescript`
stopPlay(options: PlayerOptions) => Promise
Stop audio playback
| Param | Type |
| ------------- | ------------------------------------------------------- |
| options | PlayerOptions |
--------------------
`typescript`
seekTo(options: SeekOptions) => Promise
Seek to a specific position in the audio
| Param | Type |
| ------------- | --------------------------------------------------- |
| options | SeekOptions |
--------------------
`typescript`
getPlaybackStatus(options: PlayerOptions) => Promise
Get current playback status for a specific player
| Param | Type |
| ------------- | ------------------------------------------------------- |
| options | PlayerOptions |
Returns: Promise<PlaybackStatusChangeEvent>
--------------------
`typescript`
getRecordingStatus() => Promise
Get current recording status
Returns: Promise<RecordingStatusChangeEvent>
--------------------
`typescript`
destroyPlayer(options: PlayerOptions) => Promise
Destroy a player and release its resources
| Param | Type |
| ------------- | ------------------------------------------------------- |
| options | PlayerOptions |
--------------------
`typescript`
addListener(eventName: 'recordingStatusChange', listenerFunc: (event: RecordingStatusChangeEvent) => void) => Promise
Listen for recording status changes
| Param | Type |
| ------------------ | ----------------------------------------------------------------------------------------------------- |
| eventName | 'recordingStatusChange' |
| listenerFunc | (event: RecordingStatusChangeEvent) => void |
Returns: Promise<PluginListenerHandle>
--------------------
`typescript`
addListener(eventName: 'playbackStatusChange', listenerFunc: (event: PlaybackStatusChangeEvent) => void) => Promise
Listen for playback status changes (includes playerId to identify which player)
| Param | Type |
| ------------------ | --------------------------------------------------------------------------------------------------- |
| eventName | 'playbackStatusChange' |
| listenerFunc | (event: PlaybackStatusChangeEvent) => void |
Returns: Promise<PluginListenerHandle>
--------------------
`typescript`
removeAllListeners() => Promise
Remove all listeners
--------------------
#### PermissionStatus
| Prop | Type |
| ---------------- | ---------------------------------------------- |
| microphone | 'granted' \| 'denied' \| 'prompt' |
#### StartRecordOptions
| Prop | Type | Description |
| ---------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| path | string | Optional relative path for the recording (including extension), relative to the app's data directory. If not provided, a default filename will be used. |
#### StopRecordResult
| Prop | Type | Description |
| -------------- | ------------------- | ----------------------------------------- |
| path | string | Path to the recorded file |
| duration | number | Duration of the recording in milliseconds |
#### PreparePlayResult
| Prop | Type | Description |
| -------------- | ------------------- | ------------------------------------------ |
| playerId | string | Unique identifier for this player instance |
| duration | number | Duration of the audio in milliseconds |
#### PlayOptions
| Prop | Type | Description |
| ---------- | ------------------- | ------------------------------------------------------------------------------ |
| path | string | Relative path to the audio file to play (relative to the app's data directory) |
#### PlayerOptions
| Prop | Type | Description |
| -------------- | ------------------- | --------------------------------------- |
| playerId | string | The player ID returned from preparePlay |
#### SeekOptions
| Prop | Type | Description |
| -------------- | ------------------- | --------------------------------------- |
| playerId | string | The player ID returned from preparePlay |
| position | number | Position to seek to in milliseconds |
#### PlaybackStatusChangeEvent
| Prop | Type | Description |
| --------------------- | --------------------------------------------------------- | ------------------------------------------- |
| playerId | string | The player ID this event belongs to |
| status | PlaybackStatus | |
| currentPosition | number | Current playback position in milliseconds |
| duration | number | Total duration of the audio in milliseconds |
#### RecordingStatusChangeEvent
| Prop | Type | Description |
| -------------- | ----------------------------------------------------------- | ------------------------------------------ |
| status | RecordingStatus | |
| duration | number | Current recording duration in milliseconds |
#### PluginListenerHandle
| Prop | Type |
| ------------ | ----------------------------------------- |
| remove` | () => Promise<void> |
#### PlaybackStatus
'playing' | 'paused' | 'stopped' | 'ended'
#### RecordingStatus
'recording' | 'paused' | 'stopped'