capacitor-plugin-speech-to-text
capacitor-plugin-speech-to-text
Install
npm install capacitor-plugin-speech-to-text
npx cap sync
API
hasPermission()initialize()locales()stop()cancel()listen(...)addListener('textRecognition', ...)addListener('notifyStatus', ...)addListener('notifyError', ...)addListener('soundLevelChange', ...)- Interfaces
- Enums
hasPermission()
hasPermission() => Promise<{ permission: boolean; }>
Returns: Promise<{ permission: boolean; }>
initialize()
initialize() => Promise<{ available: boolean; }>
Returns: Promise<{ available: boolean; }>
locales()
locales() => Promise<{ languages: any[]; }>
Returns: Promise<{ languages: any[]; }>
stop()
stop() => Promise<{ stopped: boolean; }>
Returns: Promise<{ stopped: boolean; }>
cancel()
cancel() => Promise<{ cancelled: boolean; }>
Returns: Promise<{ cancelled: boolean; }>
listen(...)
listen(options: SpeechParams) => Promise<{ listening: boolean; }>
| Param | Type |
|---|---|
options |
SpeechParams |
Returns: Promise<{ listening: boolean; }>
addListener('textRecognition', ...)
addListener(eventName: "textRecognition", listenerFunc: (data: { speechString: string; }) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
Called on textRecognition and result received
Provides textRecognition result.
| Param | Type |
|---|---|
eventName |
'textRecognition' |
listenerFunc |
(data: { speechString: string; }) => void |
Returns: Promise<PluginListenerHandle> & PluginListenerHandle
Since: 0.0.1
addListener('notifyStatus', ...)
addListener(eventName: "notifyStatus", listenerFunc: (data: { status: string; }) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
Called when status changes and result received
Provides speech recognition status.
| Param | Type |
|---|---|
eventName |
'notifyStatus' |
listenerFunc |
(data: { status: string; }) => void |
Returns: Promise<PluginListenerHandle> & PluginListenerHandle
Since: 0.0.1
addListener('notifyError', ...)
addListener(eventName: "notifyError", listenerFunc: (data: { error: string; }) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
Called when there is an error and result received
Provides speech recognition error.
| Param | Type |
|---|---|
eventName |
'notifyError' |
listenerFunc |
(data: { error: string; }) => void |
Returns: Promise<PluginListenerHandle> & PluginListenerHandle
Since: 0.0.1
addListener('soundLevelChange', ...)
addListener(eventName: "soundLevelChange", listenerFunc: (data: { soundLevel: string; }) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
Called when sound level changes and result received
Provides sound level change.
| Param | Type |
|---|---|
eventName |
'soundLevelChange' |
listenerFunc |
(data: { soundLevel: string; }) => void |
Returns: Promise<PluginListenerHandle> & PluginListenerHandle
Since: 0.0.1
Interfaces
SpeechParams
| Prop | Type |
|---|---|
onDevice |
boolean |
partialResults |
boolean |
sampleRate |
number |
listenMode |
ListenMode |
localeStr |
string |
PluginListenerHandle
| Prop | Type |
|---|---|
remove |
() => Promise<void> |
Enums
ListenMode
| Members |
|---|
devcieDefault |
dictation |
search |
confirmation |