Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add isListening method and listeningState listener #83

Merged
merged 9 commits into from
Mar 25, 2024

Conversation

khromov
Copy link
Contributor

@khromov khromov commented Mar 12, 2024

As per #43 and #68 there is currently some usability issues caused by differences between iOS and Android API:s where Android will stop listening automatically after a few seconds while iOS will continue listening indefinitely.

This PR aims to solve the problem by allowing users better control over when the speech recognition is ongoing by adding the isListening() method for polling whether speech recognition is currently running, as well as addListener('listeningState', ...) for notifying users when speech recognition starts and stops.

The new API:s as per the readme are:

addListener('listeningState', ...)

addListener(eventName: "listeningState", listenerFunc: (data: { status: 'started' | 'stopped'; }) => void) => Promise<PluginListenerHandle> & PluginListenerHandle

Called when listening state changed.

Param Type
eventName 'listeningState'
listenerFunc (data: { status: 'started'

Returns: Promise<PluginListenerHandle> & PluginListenerHandle

Since: 6.0.0


isListening()

isListening() => Promise<{ listening: boolean }>

Check if the player is currently listening.

Since: 6.0.0

@robingenz robingenz merged commit 5a9b532 into capacitor-community:master Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants