시작하기
설치 단계와 이 플러그인의 전체 마크다운 가이드와 함께 설정 프롬프트를 복사합니다.
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.
설치
설치bun add @capgo/capacitor-audio-recorderbunx cap syncImport
Import 섹션import { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';API 개요
API 개요 섹션startRecording
녹음 시작마이크를 사용하여 녹음을 시작합니다.
import { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';
await CapacitorAudioRecorder.startRecording();pauseRecording
__CAPGO_KEEP_0__ 녹음 중단이미 녹음 중인 녹음을 중단합니다. (API 24+, iOS, Web에서만 사용 가능)
import { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';
await CapacitorAudioRecorder.pauseRecording();resumeRecording
__CAPGO_KEEP_0__ 녹음 재개__CAPGO_KEEP_0__
import { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';
await CapacitorAudioRecorder.resumeRecording();stopRecording
__CAPGO_KEEP_2____CAPGO_KEEP_0__
import { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';
await CapacitorAudioRecorder.stopRecording();cancelRecording
__CAPGO_KEEP_3____CAPGO_KEEP_0__
import { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';
await CapacitorAudioRecorder.cancelRecording();getRecordingStatus
__CAPGO_KEEP_4____CAPGO_KEEP_0__
import { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';
await CapacitorAudioRecorder.getRecordingStatus();getCurrentAmplitude
__CAPGO_KEEP_5__현재 입력 진폭 (마이크 레벨)을 정규화된 숫자로 반환합니다. [0, 1] 범위.
녹음 중인 동안 실시간 시각화를 위한 VU 메터 또는 파형과 같은 것을 구동하기 위해 설계되었습니다. 녹음 중인 경우 반환하지 않습니다. UI-레이트 폴링을 위해 설계되었습니다 — 60-100 ms 간격이 파형에 대한 좋은 시작점입니다. tight 루프에서 호출하지 마십시오; 각 호출은 JS/자연어橋梁을 건너갑니다. 0 클립보드에 복사
import { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';
await CapacitorAudioRecorder.getCurrentAmplitude();checkPermissions
마이크에 대한 현재 권한 상태를 반환합니다.클립보드에 복사
import { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';
await CapacitorAudioRecorder.checkPermissions();requestPermissions
마이크에 대한 권한을 요청합니다.클립보드에 복사
import { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';
await CapacitorAudioRecorder.requestPermissions();__CAPGO_KEEP_0__
타입 참조 섹션StartRecordingOptions
녹음 시작 옵션 섹션.에 의해 받은 옵션
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
녹음 중지 결과 섹션.에 의해 반환된 결과
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
녹음 상태 가져오기 결과 섹션.에 의해 반환된 결과
export interface GetRecordingStatusResult { /** * The current recording status. * * @since 1.0.0 */ status: RecordingStatus;}GetCurrentAmplitudeResult
현재 진폭 결과 섹션.에 의해 반환된 결과
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
권한 상태에 대한 섹션및 에서 반환되는 권한 정보.
export interface PermissionStatus { /** * The permission state for audio recording. * * @since 1.0.0 */ recordAudio: PermissionState;}RecordingErrorEvent
녹음 오류 이벤트에 대한 섹션녹음 중 오류가 발생할 때 발생하는 이벤트.
export interface RecordingErrorEvent { /** * The error message. * * @since 1.0.0 */ message: string;}RecordingStoppedEvent
녹음이 완료되었을 때 발생하는 이벤트.복사하기
export type RecordingStoppedEvent = StopRecordingResult;AudioSessionCategoryOption
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
음성 세션 모드iOS에서 사용 가능한 음성 세션 모드입니다.
export enum AudioSessionMode { Default = 'DEFAULT', GameChat = 'GAME_CHAT', Measurement = 'MEASUREMENT', SpokenAudio = 'SPOKEN_AUDIO', VideoChat = 'VIDEO_CHAT', VideoRecording = 'VIDEO_RECORDING', VoiceChat = 'VOICE_CHAT',}RecordingStatus
녹음 상태녹음 상태입니다.
export enum RecordingStatus { Inactive = 'INACTIVE', Recording = 'RECORDING', Paused = 'PAUSED',}PermissionState
__CAPGO_KEEP_0__에서 지원하는 플랫폼 권한 상태Platform permission states supported by Capacitor.
export type PermissionState = 'prompt' | 'prompt-with-rationale' | 'granted' | 'denied';이 페이지는 플러그인의 src/definitions.ts. upstream에서 변경된 경우 public API를 다시 동기화하세요.