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