SpeechRecognition: start event
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Want more browser support for this feature? Tell us why.
The start event of the SpeechRecognition interface is fired when the speech recognition service has begun listening to incoming audio with the intention of recognizing speech.
Syntax
Use the event name in addEventListener():
js
addEventListener("start", (event) => { })
Alternatively, assign to the event handler property of the interface:
js
onstart = (event) => { }
Event type
A generic Event with no added properties.
Examples
You can use the start event in an addEventListener method:
js
const recognition = new (
window.SpeechRecognition || window.webkitSpeechRecognition
)();
recognition.addEventListener("start", () => {
console.log("Speech recognition service has started");
});
Or use the onstart event handler property (but note that this replaces other event listeners added using onstart, if any):
js
recognition.onstart = () => {
console.log("Speech recognition service has started");
};
Specifications
| Specification |
|---|
| Web Speech API> # eventdef-speechrecognition-start> |
| Web Speech API> # dom-speechrecognition-onstart> |