Démarrage
Copier un prompt de configuration avec les étapes d'installation et la guide markdown complète pour ce plugin.
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-audio-recorder`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/audio-recorder/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
Installer
Section intitulée « Installer »bun add @capgo/capacitor-audio-recorderbunx cap syncImporter
Section intitulée “Importer”import { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';API Vue d'ensemble
Section intitulée “API Vue d'ensemble”startRecording
Section intitulée “enregistrer”Enregistrer l'audio à l'aide du microphone de l'appareil.
import { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';
await CapacitorAudioRecorder.startRecording();pauseRecording
Section intitulée “pause”Suspendre l'enregistrement en cours. Disponible uniquement sur Android (API 24+), iOS et Web.
import { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';
await CapacitorAudioRecorder.pauseRecording();resumeRecording
Section intitulée “reprendre”Résumer une enregistrement précédemment suspendu.
import { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';
await CapacitorAudioRecorder.resumeRecording();stopRecording
Section intitulée “stopRecording”Arrêtez l'enregistrement en cours et persistez l'audio enregistré.
import { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';
await CapacitorAudioRecorder.stopRecording();cancelRecording
Section intitulée “cancelRecording”Annulez l'enregistrement en cours et jetez l'audio capturé.
import { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';
await CapacitorAudioRecorder.cancelRecording();getRecordingStatus
Section intitulée “getRecordingStatus”Récupérez l'état d'enregistrement actuel.
import { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';
await CapacitorAudioRecorder.getRecordingStatus();getCurrentAmplitude
Section intitulée “getCurrentAmplitude”Récupérer l'amplitude actuelle de l'entrée (niveau du microphone) sous forme de nombre normalisé
dans la plage. [0, 1] plage.
Conçu pour alimenter des visualisations en direct telles que les compteurs VU ou les formes d'onde
pendant l'enregistrement. Renvoie
lorsqu'il n'y a pas d'enregistrement en cours. Conçu pour
la mise à jour de l'interface utilisateur — un intervalle de 60 à 100 ms est un bon point de départ pour une
forme d'onde. Évitez d'appeler cette fonction dans un boucle serrée ; chaque appel franchit le pont
JS/natif. 0 Copier dans le presse-papier
import { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';
await CapacitorAudioRecorder.getCurrentAmplitude();Copier dans le presse-papier
import { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';
await CapacitorAudioRecorder.checkPermissions();requestPermissions
Demander l'autorisation d'accéder au microphone.Copier dans le presse-papier
import { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';
await CapacitorAudioRecorder.requestPermissions();Récupérer l'amplitude actuelle de l'entrée (niveau du microphone) sous forme de nombre normalisé dans la plage.
Référence de typeStartRecordingOptions
Section intitulée « Options de démarrage de la prise de son »Options acceptées par .
export interface StartRecordingOptions { /** * The audio session category options for recording. Only available on iOS. * * @since 1.0.0 */ audioSessionCategoryOptions?: AudioSessionCategoryOption[];
/** * The audio session mode for recording. Only available on iOS. * * @since 1.0.0 */ audioSessionMode?: AudioSessionMode;
/** * The audio bit rate in bytes per second. * Only available on Android and iOS. * * @since 1.0.0 */ bitRate?: number;
/** * The audio sample rate in Hz. * Only available on Android and iOS. * * @since 1.0.0 */ sampleRate?: number;}StopRecordingResult
Section intitulée « Résultat d'arrêt de la prise de son »Résultat retourné par .
export interface StopRecordingResult { /** * The recorded audio as a Blob. Only available on Web. * * @since 1.0.0 */ blob?: Blob;
/** * The duration of the recording in milliseconds. * * @since 1.0.0 */ duration?: number;
/** * The URI pointing to the recorded file. Only available on Android and iOS. * * @since 1.0.0 */ uri?: string;}GetRecordingStatusResult
Section intitulée « Résultat de la récupération de l'état de la prise de son »Résultat retourné par .
export interface GetRecordingStatusResult { /** * The current recording status. * * @since 1.0.0 */ status: RecordingStatus;}GetCurrentAmplitudeResult
Section intitulée « Résultat de la récupération de l'amplitude actuelle »Résultat retourné par .
export interface GetCurrentAmplitudeResult { /** * The current input amplitude normalized to the `[0, 1]` range, where `0` * represents silence and `1` represents the maximum level the platform can * report. The value is `0` when no recording is active. * * Note: the source signal differs between platforms — Android reports the * peak sample amplitude since the last call, iOS reports the average power * in dB converted to linear, and Web reports the RMS of the latest frame. * Consumers that need cross-platform parity may want to apply a * per-platform scaling curve. * * @since 8.1.0 */ value: number;}PermissionStatus
Section intitulée « PermissionStatus »Informations sur les permissions renvoyées par et .
export interface PermissionStatus { /** * The permission state for audio recording. * * @since 1.0.0 */ recordAudio: PermissionState;}RecordingErrorEvent
Section intitulée « RecordingErrorEvent »Événement émis lorsqu'une erreur se produit lors de l'enregistrement.
export interface RecordingErrorEvent { /** * The error message. * * @since 1.0.0 */ message: string;}RecordingStoppedEvent
Section intitulée « RecordingStoppedEvent »Événement émis lorsqu'un enregistrement est terminé.
export type RecordingStoppedEvent = StopRecordingResult;AudioSessionCategoryOption
Section intitulée « AudioSessionCategoryOption »Options de catégorie de session audio disponibles sur iOS.
export enum AudioSessionCategoryOption { AllowAirPlay = 'ALLOW_AIR_PLAY', AllowBluetooth = 'ALLOW_BLUETOOTH', AllowBluetoothA2DP = 'ALLOW_BLUETOOTH_A2DP', DefaultToSpeaker = 'DEFAULT_TO_SPEAKER', DuckOthers = 'DUCK_OTHERS', InterruptSpokenAudioAndMixWithOthers = 'INTERRUPT_SPOKEN_AUDIO_AND_MIX_WITH_OTHERS', MixWithOthers = 'MIX_WITH_OTHERS', OverrideMutedMicrophoneInterruption = 'OVERRIDE_MUTED_MICROPHONE_INTERRUPTION',}AudioSessionMode
Section intitulée « Mode de session audio »Modes de session audio disponibles sur iOS.
export enum AudioSessionMode { Default = 'DEFAULT', GameChat = 'GAME_CHAT', Measurement = 'MEASUREMENT', SpokenAudio = 'SPOKEN_AUDIO', VideoChat = 'VIDEO_CHAT', VideoRecording = 'VIDEO_RECORDING', VoiceChat = 'VOICE_CHAT',}RecordingStatus
Section intitulée « Statut d'enregistrement »Statut d'enregistrement.
export enum RecordingStatus { Inactive = 'INACTIVE', Recording = 'RECORDING', Paused = 'PAUSED',}PermissionState
Section intitulée « État de permission »États de permission pris en charge par Capacitor.
export type PermissionState = 'prompt' | 'prompt-with-rationale' | 'granted' | 'denied';Section intitulée « Source De Vérité »
Copier dans le presse-papierCette page est générée à partir du plugin’s src/definitions.ts. Re-run the sync when the public API changes upstream.