Licence
ISC
Version
0.1.0
Deps
0
Size
114 kB
Vulns
0
Weekly
0
capacitor-plugin-speech-recognition
Capacitor plugin for speech recognition.
Install
npm install capacitor-plugin-speech-recognition
npx cap sync
iOS Platform: No further action required.
Android Platform: Register the plugin in your main activity:
import com.getcapacitor.community.speechrecognition.SpeechRecognition;
public class MainActivity extends BridgeActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Initializes the Bridge
registerPlugin(SpeechRecognitionPlugin.class);
}
}
Configuration
No configuration required for this plugin
Supported methods
| Name | Android | iOS | Web |
|---|---|---|---|
| available | |||
| start | |||
| stop | |||
| getSupportedLanguages | |||
| hasPermission | |||
| requestPermission |
API
available()start(...)stop()getSupportedLanguages()hasPermission()requestPermission()addListener('partialResults', ...)- Interfaces
available()
available() => Promise<{ available: boolean; }>
Returns: Promise<{ available: boolean; }>
start(...)
start(options?: UtteranceOptions | undefined) => Promise<{ matches: string[]; }>
| Param | Type |
|---|---|
options |
UtteranceOptions |
Returns: Promise<{ matches: string[]; }>
stop()
stop() => Promise<void>
getSupportedLanguages()
getSupportedLanguages() => Promise<{ languages: any[]; }>
Returns: Promise<{ languages: any[]; }>
hasPermission()
hasPermission() => Promise<{ permission: boolean; }>
Returns: Promise<{ permission: boolean; }>
requestPermission()
requestPermission() => Promise<void>
addListener('partialResults', ...)
addListener(eventName: 'partialResults', listenerFunc: (data: { matches: string[]; }) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
Called when partialResults set to true and result received
Provides partial result.
| Param | Type |
|---|---|
eventName |
'partialResults' |
listenerFunc |
(data: { matches: string[]; }) => void |
Returns: Promise<PluginListenerHandle> & PluginListenerHandle
Since: 2.0.2
Interfaces
UtteranceOptions
| Prop | Type |
|---|---|
language |
string |
maxResults |
number |
prompt |
string |
popup |
boolean |
partialResults |
boolean |
PluginListenerHandle
| Prop | Type |
|---|---|
remove |
() => Promise<void> |