Skip to content

This Microphone API provides the ability to interact with the microphone and record Audio

License

Notifications You must be signed in to change notification settings

simonschmalfeld/capacitor-microphone

 
 

Repository files navigation

Mozartec Capacitor Microphone

@mozartec/capacitor-microphone

This Microphone API provides the ability to interact with the microphone and record Audio

Maintenance License
Dependency Status devDependency Status
npm version NPM Downloads

Platform support

iOS Android Web
Availability ✔️ ✔️
Encoding kAudioFormatMPEG4AAC MPEG_4 / AAC
Extension .m4a .m4a

Installation

Install

npm install @mozartec/capacitor-microphone
npx cap sync

Demo

Demo code

iOS

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.

Android

This API requires the following permission to be added to your AndroidManifest.xml:

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

The RECORD_AUDIO permission is for recording audio.

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

API

checkPermissions()

checkPermissions() => Promise<PermissionStatus>

Checks microphone permission

Returns: Promise<PermissionStatus>


requestPermissions()

requestPermissions() => Promise<PermissionStatus>

Requests microphone permission

Returns: Promise<PermissionStatus>


enableMicrophone(...)

enableMicrophone(options: { recordingEnabled: boolean; silenceDetection: boolean; }) => Promise<void>
Param Type
options { recordingEnabled: boolean; silenceDetection: boolean; }

disableMicrophone()

disableMicrophone() => Promise<void>

requestData()

requestData() => void

getAudioContext()

getAudioContext() => Promise<AudioContext | null>

Returns: Promise<any>


Interfaces

PermissionStatus

Prop Type
microphone MicrophonePermissionState

Type Aliases

MicrophonePermissionState

PermissionState | 'limited'

PermissionState

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

About

This Microphone API provides the ability to interact with the microphone and record Audio

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 28.9%
  • Swift 27.2%
  • Java 15.9%
  • SCSS 13.0%
  • JavaScript 4.4%
  • HTML 4.2%
  • Other 6.4%