내용으로 건너뛰기

시작하기

GitHub

Capgo AI-Assisted Setup을 사용하여 플러그인을 설치할 수 있습니다. AI 도구에 Capgo 기능을 추가하려면 다음 명령어를 사용하세요:

터미널 창
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins

다음 명령어를 사용하세요:

Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-audio-recorder` plugin in my project.

만약 Manual Setup을 선호한다면, 플러그인을 설치하기 위해 다음 명령어를 실행하고 아래 플랫폼별 지침을 따르세요:

터미널 창
bun add @capgo/capacitor-audio-recorder
bunx cap sync
import { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';

startRecording

녹음 시작

__CAPGO_KEEP_1__

import { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';
await CapacitorAudioRecorder.startRecording();

pauseRecording

녹음 중단

녹음 중단은 Android (API 24+), iOS, 및 Web에서만 사용할 수 있습니다.

import { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';
await CapacitorAudioRecorder.pauseRecording();

resumeRecording

녹음 재개

녹음이 중단된 경우 다시 시작합니다.

import { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';
await CapacitorAudioRecorder.resumeRecording();

stopRecording

녹음 중단

현재 녹음 중인 녹음을 저장하고 녹음된 오디오를 유지합니다.

import { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';
await CapacitorAudioRecorder.stopRecording();

cancelRecording

녹음 취소

현재 녹음 중인 녹음을 취소하고 캡처된 오디오를 폐기합니다.

import { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';
await CapacitorAudioRecorder.cancelRecording();

getRecordingStatus

녹음 상태 조회

클립보드에 복사

import { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';
await CapacitorAudioRecorder.getRecordingStatus();

getCurrentAmplitude

클립보드에 복사

현재 입력 진폭 (마이크 레벨)을 정규화된 숫자로 반환합니다. [0, 1] 범위.

녹음 중인 경우를 제외하고 항상 반환됩니다. 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();

권한 확인

타입 참조

StartRecordingOptions

녹음 시작 옵션

accept()에 의해 받은 옵션

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

녹음 중지 결과

stopRecording()에 의해 반환된 결과

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

녹음 상태 결과

getRecordingStatus()에 의해 반환된 결과

export interface GetRecordingStatusResult {
/**
* The current recording status.
*
* @since 1.0.0
*/
status: RecordingStatus;
}

GetCurrentAmplitudeResult

현재 진폭 결과

getCurrentAmplitude()에 의해 반환된 결과

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;
}

복사

export type RecordingStoppedEvent = StopRecordingResult;

권한 상태

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',
}

iOS에서 사용 가능한 오디오 세션 모드입니다.

export enum AudioSessionMode {
Default = 'DEFAULT',
GameChat = 'GAME_CHAT',
Measurement = 'MEASUREMENT',
SpokenAudio = 'SPOKEN_AUDIO',
VideoChat = 'VIDEO_CHAT',
VideoRecording = 'VIDEO_RECORDING',
VoiceChat = 'VOICE_CHAT',
}

녹음 상태입니다.

export enum RecordingStatus {
Inactive = 'INACTIVE',
Recording = 'RECORDING',
Paused = 'PAUSED',
}

Capacitor에서 지원하는 플랫폼 권한 상태입니다.

export type PermissionState = 'prompt' | 'prompt-with-rationale' | 'granted' | 'denied';

이 페이지는 플러그인의 src/definitions.ts. upstream에서 API이 변경되면 다시 싱크를 실행하세요.

Getting Started에서 계속

Getting Started에서 계속하는 섹션

이 플러그인을 사용하는 경우 Getting Started native 미디어 및 인터페이스 동작을 계획하는 경우, Using @capgo/capacitor-audio-recorder for the native capability in Using @capgo/capacitor-audio-recorder, Using @capgo/capacitor-live-activities for the native capability in Using @capgo/capacitor-live-activities, @capgo/capacitor-live-activities 구현 세부 사항에 대한 @capgo/capacitor-live-activities 사용 @capgo/capacitor-video-player 사용 @capgo/capacitor-video-player @capgo/capacitor-video-player for the implementation detail in @capgo/capacitor-video-player.