Einstieg
Einen Setup-Befehl mit den Installations-Schritten und der vollständigen Markdown-Anleitung für diesen Plugin kopieren.
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.
Installieren
Abschnitt mit dem Titel „Installieren“bun add @capgo/capacitor-audio-recorderbunx cap syncImportieren
Abschnitt: Importimport { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';API Übersicht
Abschnitt: API ÜbersichtstartRecording
Abschnitt: startRecordingMit dem Gerätemikrofon Ton aufnehmen.
import { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';
await CapacitorAudioRecorder.startRecording();pauseRecording
Abschnitt: pauseRecordingPause the ongoing recording. Only available on Android (API 24+), iOS, and Web.
import { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';
await CapacitorAudioRecorder.pauseRecording();resumeRecording
Abschnitt: resumeRecordingWiederaufnahme einer vorherigen Pause.
import { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';
await CapacitorAudioRecorder.resumeRecording();stopRecording
Abschnitt mit dem Titel “stopRecording”Beenden Sie die aktuelle Aufnahme und speichern Sie die aufgenommene Audio.
import { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';
await CapacitorAudioRecorder.stopRecording();cancelRecording
Abschnitt mit dem Titel “cancelRecording”Stornieren Sie die aktuelle Aufnahme und werfen Sie alle aufgenommenen Audio weg.
import { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';
await CapacitorAudioRecorder.cancelRecording();getRecordingStatus
Abschnitt mit dem Titel “getRecordingStatus”Abrufen Sie den aktuellen Aufnahmestatus.
import { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';
await CapacitorAudioRecorder.getRecordingStatus();getCurrentAmplitude
Abschnitt mit dem Titel “getCurrentAmplitude”Abrufen Sie die aktuelle Eingabeamplitude (Mikrofonlevel) als normalisiertes
Zahl im Bereich. [0, 1] Integriert für das Ansteuern von Echtzeitvisualisierungen wie VU-Meter oder
Wellenformen während der Aufzeichnung. Gibt zurück,
wenn keine Aufzeichnung aktiv ist. Entworfen für
UI-schrittmäßige Abfragen — ein 60–100 ms Intervall ist ein guter Ausgangspunkt für eine
Wellenform. Vermeiden Sie es, es in einem engen Schleifen aufzurufen; jeder Aufruf überschreitet
den JS/nativen Bridge.
Zwischenablage kopieren 0 Abschnitt mit dem Titel “checkPermissions”
import { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';
await CapacitorAudioRecorder.getCurrentAmplitude();checkPermissions
Zwischenablage kopierenAbschnitt mit dem Titel “requestPermissions”
import { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';
await CapacitorAudioRecorder.checkPermissions();requestPermissions
Zwischenablage kopierenTypenreferenz
import { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';
await CapacitorAudioRecorder.requestPermissions();__CAPGO_KEEP_0__
Abschnitt mit dem Titel “Typenreferenz”StartRecordingOptions
Abschnitt mit dem Titel “Startaufnahmeeinstellungen”Optionen, die von . angenommen werden
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
Abschnitt mit dem Titel “Aufnahmebeendigungsresultat”Resultat, das von . zurückgegeben wird
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
Abschnitt mit dem Titel “Aufnahmestatusabfrageergebnis”Resultat, das von . zurückgegeben wird
export interface GetRecordingStatusResult { /** * The current recording status. * * @since 1.0.0 */ status: RecordingStatus;}GetCurrentAmplitudeResult
Abschnitt mit dem Titel “Aktuelle Amplitudenabfrageergebnis”Resultat, das von . zurückgegeben wird
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
Abschnitt mit dem Titel „PermissionStatus”Zurückgegebene Berechtigungsinformationen durch und .
export interface PermissionStatus { /** * The permission state for audio recording. * * @since 1.0.0 */ recordAudio: PermissionState;}RecordingErrorEvent
Abschnitt mit dem Titel „RecordingErrorEvent”Ereignis, das ausgelöst wird, wenn während der Aufzeichnung ein Fehler auftritt.
export interface RecordingErrorEvent { /** * The error message. * * @since 1.0.0 */ message: string;}RecordingStoppedEvent
Abschnitt mit dem Titel „RecordingStoppedEvent”Ereignis, das ausgelöst wird, wenn eine Aufzeichnung abgeschlossen ist.
export type RecordingStoppedEvent = StopRecordingResult;AudioSessionCategoryOption
Abschnitt mit dem Titel „AudioSessionCategoryOption”Verfügbare Audio-Sitzungskategorioptionen auf 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
Abschnitt mit dem Titel “AudioSessionMode”Audio-Modi, die auf iOS verfügbar sind.
export enum AudioSessionMode { Default = 'DEFAULT', GameChat = 'GAME_CHAT', Measurement = 'MEASUREMENT', SpokenAudio = 'SPOKEN_AUDIO', VideoChat = 'VIDEO_CHAT', VideoRecording = 'VIDEO_RECORDING', VoiceChat = 'VOICE_CHAT',}RecordingStatus
Abschnitt mit dem Titel “RecordingStatus”Der Aufnahmestatus.
export enum RecordingStatus { Inactive = 'INACTIVE', Recording = 'RECORDING', Paused = 'PAUSED',}PermissionState
Abschnitt mit dem Titel “PermissionState”Plattformzustände der Berechtigung, die von Capacitor unterstützt werden.
export type PermissionState = 'prompt' | 'prompt-with-rationale' | 'granted' | 'denied';Abschnitt mit dem Titel “Source Of Truth”
Abschnitt mit dem Titel “__CAPGO_KEEP_0__”Diese Seite wurde aus dem Plugin generiert. src/definitions.tsRe-run die Synchronisation, wenn die öffentliche API sich upstream ändert.