내용으로 건너뛰기

Getting Started

GitHub

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-speech-recognition` plugin in my project.

만약 Manual Setup을 선호한다면, 다음 명령어를 실행하고 아래의 플랫폼별 지침을 따르세요:

터미널 창
bun add @capgo/capacitor-speech-recognition
bunx cap sync
import { SpeechRecognition } from '@capgo/capacitor-speech-recognition';

기기에서 사용할 수 있는 네이티브 음성 인식 서비스가 있는지 확인합니다.

import { SpeechRecognition } from '@capgo/capacitor-speech-recognition';
await SpeechRecognition.available();

isOnDeviceRecognitionAvailable

isOnDeviceRecognitionAvailable

선택한 지역에서 플랫폼의 최신 기기 인식 경로가 사용 가능한지 확인합니다.

이 기능을 사용하기 전에 사용해야 하는 기능 체크입니다. useOnDeviceRecognition결과는 기기, OS 버전 및 지역이 최신 기기 경로를 사용할 수 있는지 확인합니다. true 반환

기기에서만 지원하는 레거시 인식 경로만 사용할 수 있는 경우 false 플랫폼 __CAPGO_KEEP_0__ 문서:

Platform SDK docs: iOS: 음성 Android: 음성 인식기

import { SpeechRecognition } from '@capgo/capacitor-speech-recognition';
await SpeechRecognition.isOnDeviceRecognitionAvailable();

start

시작

음성 녹음과 음성 인식을 시작합니다.

언제 partialResultstrue, 반환된 약속이 즉시 해결되고 업데이트는 세션 종료까지 partialResults listener

통해 스트리밍됩니다. useOnDeviceRecognition: true 기본 경로는 이전 호환성을 위해 레거시 인식기 동작을 유지합니다.

import { SpeechRecognition } from '@capgo/capacitor-speech-recognition';
await SpeechRecognition.start();

음성 인식을 중단하고 네이티브 리소스를 해제합니다.

import { SpeechRecognition } from '@capgo/capacitor-speech-recognition';
await SpeechRecognition.stop();

forceStop

강제 중단

현재 세션을 강제로 중단합니다.

안드로이드에서는 일반적인 중단을 시도한 후 destroy/recreate로 fallback합니다. timeout. iOS에서는 현재 세션을 즉시 중단합니다.

부분 전사 결과가 캐시되어 있다면, partialResults listener forced: true.

import { SpeechRecognition } from '@capgo/capacitor-speech-recognition';
await SpeechRecognition.forceStop();

클립보드에 복사

import { SpeechRecognition } from '@capgo/capacitor-speech-recognition';
await SpeechRecognition.getLastPartialResult();

현재 푸시-투-톡 버튼 상태를 업데이트합니다.

이것을 사용하여 continuousPTT 또는 사용자 정의 홀드-투-톡 흐름과 함께 사용하세요.

import { SpeechRecognition } from '@capgo/capacitor-speech-recognition';
await SpeechRecognition.setPTTState({} as PTTStateOptions);

언더라이징 인식기에서 지원하는 지역을 가져옵니다.

Android 13+ 장치에서는 이 목록을 더 이상 노출하지 않습니다. 그 경우 languages 빈 목록입니다.

import { SpeechRecognition } from '@capgo/capacitor-speech-recognition';
await SpeechRecognition.getSupportedLanguages();

플러그인이 음성을 듣고 있는지 여부를 반환합니다.

import { SpeechRecognition } from '@capgo/capacitor-speech-recognition';
await SpeechRecognition.isListening();

checkPermissions

권한 확인

현재 권한 상태를 가져옵니다.

import { SpeechRecognition } from '@capgo/capacitor-speech-recognition';
await SpeechRecognition.checkPermissions();

requestPermissions

권한 요청

마이크 + 음성 인식 권한을 요청합니다.

import { SpeechRecognition } from '@capgo/capacitor-speech-recognition';
await SpeechRecognition.requestPermissions();

SpeechRecognitionAvailability

복사
export interface SpeechRecognitionAvailability {
available: boolean;
}

SpeechRecognitionStartOptions

SpeechRecognitionStartOptions

인식기 사용 시 호출할 때 recognizer가 어떻게 행동할지 설정합니다.

export interface SpeechRecognitionStartOptions {
/**
* Locale identifier such as `en-US`. When omitted the device language is used.
*/
language?: string;
/**
* Maximum number of final matches returned by native APIs. Defaults to `5`.
*/
maxResults?: number;
/**
* Prompt message shown inside the Android system dialog (ignored on iOS).
*/
prompt?: string;
/**
* When `true`, Android shows the OS speech dialog instead of running inline recognition.
* Defaults to `false`.
*/
popup?: boolean;
/**
* Emits partial transcription updates through the `partialResults` listener while audio is captured.
*/
partialResults?: boolean;
/**
* Enables native punctuation handling where supported (iOS 16+).
*/
addPunctuation?: boolean;
/**
* Opt in to the platform's newer on-device recognition path when available.
*
* On iOS 26+, this uses Apple's `SpeechAnalyzer` / `SpeechTranscriber` pipeline.
* On recent Android versions, this uses the on-device `SpeechRecognizer` path.
*
* It is intentionally opt-in so existing apps keep the legacy flow unless they choose
* to roll out the new behavior.
*
* Use {@link SpeechRecognitionPlugin.isOnDeviceRecognitionAvailable} before enabling it in production.
*
* Platform SDK docs:
* iOS: [Speech](https://developer.apple.com/documentation/speech),
* [SpeechAnalyzer](https://developer.apple.com/documentation/speech/speechanalyzer),
* [SpeechTranscriber](https://developer.apple.com/documentation/speech/speechtranscriber)
* Android: [SpeechRecognizer](https://developer.android.com/reference/android/speech/SpeechRecognizer)
*
* Defaults to `false`.
*/
useOnDeviceRecognition?: boolean;
/**
* Allow a number of milliseconds of silence before splitting the recognition session into segments.
* Required to be greater than zero and currently supported on Android only.
*/
allowForSilence?: number;
/**
* EXPERIMENTAL: Keep a PTT session alive across silence by restarting recognition while the button stays held.
*
* This restart behavior is implemented for Android inline recognition and iOS native recognition.
*/
continuousPTT?: boolean;
}

SpeechRecognitionMatches

SpeechRecognitionMatches
export interface SpeechRecognitionMatches {
matches?: string[];
}

ForceStopOptions

ForceStopOptions

. 옵션

export interface ForceStopOptions {
/**
* Android only: timeout in milliseconds before forcing stop via destroy/recreate.
*
* On iOS, the current session is stopped immediately and this value is ignored.
*
* Defaults to `1500`.
*/
timeout?: number;
}

LastPartialResult

LastPartialResult

. 결과

export interface LastPartialResult {
/**
* Whether a partial result is currently cached.
*/
available: boolean;
/**
* The most recent transcript text known to the native recognizer.
*/
text: string;
/**
* All current match alternatives when available.
*/
matches?: string[];
}

PTTStateOptions

PTTStateOptions

. 옵션

export interface PTTStateOptions {
/**
* Whether the PTT button is currently held.
*/
held: boolean;
}

SpeechRecognitionLanguages

SpeechRecognitionLanguages 섹션
export interface SpeechRecognitionLanguages {
languages: string[];
}

SpeechRecognitionListening

SpeechRecognitionListening 섹션
export interface SpeechRecognitionListening {
listening: boolean;
}

SpeechRecognitionPermissionStatus

SpeechRecognitionPermissionStatus 섹션

권한 맵 checkPermissions 그리고 requestPermissions.

export interface SpeechRecognitionPermissionStatus {
speechRecognition: PermissionState;
}

SpeechRecognitionSegmentResultEvent

SpeechRecognitionSegmentResultEvent 섹션

분할 결과가 생성될 때 발생하는 이벤트 (Android 전용)

export interface SpeechRecognitionSegmentResultEvent {
matches: string[];
}

SpeechRecognitionPartialResultEvent

음성 인식 부분 결과 이벤트

부분 음성 인식이 생성될 때 발생합니다.

export interface SpeechRecognitionPartialResultEvent {
/**
* Current recognition matches when the native recognizer reports them.
*
* This can be omitted for forced or accumulated-only payloads.
*/
matches?: string[];
/**
* Accumulated transcription from earlier continuous PTT cycles.
*/
accumulated?: string;
/**
* Final accumulated text including the current result.
*/
accumulatedText?: string;
/**
* `true` when the plugin is restarting recognition inside a continuous PTT session.
*/
isRestarting?: boolean;
/**
* `true` when the payload was emitted by `forceStop()`.
*/
forced?: boolean;
}

SpeechRecognitionListeningEvent

음성 인식 듣기 이벤트

청취 상태가 변경될 때 발생합니다.

export interface SpeechRecognitionListeningEvent {
/**
* Finite state of the recognition session.
*/
state?: ListeningFiniteState;
/**
* Unique identifier for the current listening session.
*/
sessionId?: number;
/**
* Why this state transition occurred.
*/
reason?: ListeningReason;
/**
* Error code when the transition is caused by an error.
*/
errorCode?: string;
/**
* Backward-compatible binary state used by earlier releases.
*/
status?: 'started' | 'stopped';
}

공개 __CAPGO_KEEP_0__이 업스트림에서 변경될 때 다시 싱크를 실행하세요. src/definitions.ts. Re-run the sync when the public API changes upstream.

만약에 사용 중이라면 Getting Started 계획 대시보드 및 API 작업을 계획하려면 Using @capgo/capacitor-speech-recognition Using @capgo/capacitor-speech-recognition API 개요 for the implementation detail in API Overview, Implementation __CAPGO_KEEP_0__ 키 API Keys for the implementation detail in API Keys, and Devices 장치에 대한 구현 세부 정보.