SpeechRecognition: soundstart event
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Thesoundstart event of theWeb Speech API is fired when any sound — recognizable speech or not — has been detected.
In this article
Syntax
Use the event name in methods likeaddEventListener(), or set an event handler property.
js
addEventListener("soundstart", (event) => { })onsoundstart = (event) => { }Event type
A genericEvent with no added properties.
Examples
You can use thesoundstart event in anaddEventListener method:
js
const recognition = new (SpeechRecognition || webkitSpeechRecognition)();recognition.addEventListener("soundstart", () => { console.log("Some sound is being received");});Or use theonsoundstart event handler property:
js
recognition.onsoundstart = () => { console.log("Some sound is being received");};Specifications
| Specification |
|---|
| Web Speech API> # eventdef-speechrecognition-soundstart> |
| Web Speech API> # dom-speechrecognition-onsoundstart> |