This Microphone API provides the ability to interact with the microphone and record Audio
npm install @mozartec/capacitor-microphoneThis Microphone API provides the ability to interact with the microphone and record Audio
 
 
 
``bash`
npm install @mozartec/capacitor-microphone
npx cap sync
iOS requires the following usage description to be added and filled out for your app in Info.plist:
- NSMicrophoneUsageDescription (Privacy - Microphone Usage Description)
Read about Configuring Info.plist in the iOS Guide for more information on setting iOS permissions in Xcode.
This API requires the following permission to be added to your AndroidManifest.xml:
`xml`
The RECORD_AUDIO permission is for recording audio.
Read about Setting Permissions in the Android Guide for more information on setting Android permissions.
* checkPermissions()
* requestPermissions()
* startRecording()
* stopRecording()
* Interfaces
* Type Aliases
`typescript`
checkPermissions() => Promise
Checks microphone permission
Returns: Promise<PermissionStatus>
Since: 0.0.3
--------------------
`typescript`
requestPermissions() => Promise
Requests microphone permission
Returns: Promise<PermissionStatus>
Since: 0.0.3
--------------------
`typescript`
startRecording() => Promise<{ status: string; }>
Starts recoding session if no session is in progress
Returns: Promise<{ status: string; }>
Since: 0.0.3
--------------------
`typescript`
stopRecording() => Promise
Stops recoding session if one is in progress
Returns: Promise<AudioRecording>
Since: 0.0.3
--------------------
#### PermissionStatus
| Prop | Type |
| ---------------- | ------------------------------------------------------------------------------- |
| microphone | MicrophonePermissionState |
#### AudioRecording
| Prop | Type | Description | Since |
| ------------------ | ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
| base64String | string | The base64 encoded string representation of the audio file. | 0.0.3 |
| dataUrl | string | The url starting with 'data:audio/aac;base64,' and the base64 encoded string representation of the audio file. | 0.0.3 |
| 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 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 |
#### MicrophonePermissionState
PermissionState | 'limited'
#### PermissionState
'prompt' | 'prompt-with-rationale' | 'granted' | 'denied'