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.

Documentation SpeechRecognition by Mozilla Contributors, licensed under CC-BY-SA 2.5.

See also:

Constructor

new()

Throws:

null

DOMError

Variables

continuous:Bool

Controls whether continuous results are returned for each recognition, or only a single result. Defaults to single (false.)

grammars:SpeechGrammarList

Returns and sets a collection of SpeechGrammar objects that represent the grammars that will be understood by the current SpeechRecognition.

interimResults:Bool

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.)

lang:String

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.

maxAlternatives:Int

Sets the maximum number of SpeechRecognitionAlternatives provided per result. The default value is 1.

onaudioend:Function

Fired when the user agent has finished capturing audio.

onaudiostart:Function

Fired when the user agent has started to capture audio.

onend:Function

Fired when the speech recognition service has disconnected.

onerror:Function

Fired when a speech recognition error occurs.

onnomatch:Function

Fired when the speech recognition service returns a final result with no significant recognition. This may involve some degree of recognition, which doesn't meet or exceed the SpeechRecognitionAlternative.confidence threshold.

onresult:Function

Fired when the speech recognition service returns a result — a word or phrase has been positively recognized and this has been communicated back to the app.

onsoundend:Function

Fired when any sound — recognisable speech or not — has stopped being detected.

onsoundstart:Function

Fired when any sound — recognisable speech or not — has been detected.

onspeechend:Function

Fired when speech recognised by the speech recognition service has stopped being detected.

onspeechstart:Function

Fired when sound that is recognised by the speech recognition service as speech has been detected.

onstart:Function

Fired when the speech recognition service has begun listening to incoming audio with intent to recognize grammars associated with the current SpeechRecognition.

serviceURI:String

Specifies the location of the speech recognition service used by the current SpeechRecognition to handle the actual recognition. The default is the user agent's default speech service.

Methods

abort():Void

Stops the speech recognition service from listening to incoming audio, and doesn't attempt to return a SpeechRecognitionResult.

start(?stream:MediaStream):Void

Starts the speech recognition service listening to incoming audio with intent to recognize grammars associated with the current SpeechRecognition.

Throws:

null

DOMError

stop():Void

Stops the speech recognition service from listening to incoming audio, and attempts to return a SpeechRecognitionResult using the audio captured so far.

Inherited Variables

Inherited Methods

Defined by EventTarget

addEventListener(type:String, listener:Function, ?options:EitherType<AddEventListenerOptions, Bool>, ?wantsUntrusted:Bool):Void

addEventListener(type:String, listener:EventListener, ?options:EitherType<AddEventListenerOptions, Bool>, ?wantsUntrusted:Bool):Void

Register an event handler of a specific event type on the EventTarget.

Throws:

null

DOMError

dispatchEvent(event:Event):Bool

Dispatch an event to this EventTarget.

Throws:

null

DOMError

removeEventListener(type:String, listener:Function, ?options:EitherType<EventListenerOptions, Bool>):Void

removeEventListener(type:String, listener:EventListener, ?options:EitherType<EventListenerOptions, Bool>):Void

Removes an event listener from the EventTarget.

Throws:

null

DOMError