SpeechRecognition

The SpeechRecognition interface of the Web Speech API is the controller interface for the recognition service; this also handles the SpeechRecognitionEvent sent from the recognition service. Available only in secure contexts.

MDN Reference

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open external var continuous: Boolean

The continuous property of the SpeechRecognition interface controls whether continuous results are returned for each recognition, or only a single result.

Link copied to clipboard
open external var interimResults: Boolean

The interimResults property of the SpeechRecognition interface controls whether interim results should be returned (true) or not (false). Interim results are results that are not yet final (e.g., the SpeechRecognitionResult.isFinal property is false).

Link copied to clipboard
open external var lang: String

The lang property of the SpeechRecognition interface returns and sets the language of the current SpeechRecognition. If not specified, this defaults to the HTML lang attribute value, or the user agent's language setting if that isn't set either.

Link copied to clipboard
open external var maxAlternatives: Int

The maxAlternatives property of the SpeechRecognition interface sets the maximum number of SpeechRecognitionAlternatives provided per SpeechRecognitionResult.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The phrases property of the SpeechRecognition interface sets an array of SpeechRecognitionPhrase objects to be used for contextual biasing.

Link copied to clipboard
open external var processLocally: Boolean

The processLocally property of the SpeechRecognition interface specifies whether speech recognition must be performed locally on the user's device.

Link copied to clipboard
open external var unspokenPunctuation: Boolean

The unspokenPunctuation property of the SpeechRecognition interface specifies whether the speech recognition engine will infer and insert punctuation marks based on the user's natural speech patterns.

Functions

Link copied to clipboard
open external fun abort()

The abort() method of the Web Speech API stops the speech recognition service from listening to incoming audio, and doesn't attempt to return a SpeechRecognitionResult.

Link copied to clipboard
open external override fun dispatchEvent(event: Event): Boolean
Link copied to clipboard
open external fun start()

The start() method of the Web Speech API starts the speech recognition service to listen for incoming audio (from a microphone or an audio track) and returns the results of that recognition.

open external fun start(audioTrack: MediaStreamTrack)
Link copied to clipboard
open external fun stop()

The stop() method of the Web Speech API stops the speech recognition service from listening for incoming audio and attempts to return a SpeechRecognitionResult based on the results captured so far.

Link copied to clipboard
open external fun <T : Event> when(type: EventType<T>, options: ObservableEventListenerOptions?): Observable<T>