SpeechRecognition: start event
Web Speech API
Web Speech API
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():
addEventListener("start", (event) => { })
Alternatively, assign to the event handler property of the interface:
onstart = (event) => { }
Event type
A generic Event with no added properties.
Examples
You can use the start event in an addEventListener method:
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):
recognition.onstart = () => {
console.log("Speech recognition service has started");
};