docs.rodeo

MDN Web Docs mirror

SpeechRecognition: speechstart event

{{APIRef("Web Speech API")}} 

The speechstart event of the Web Speech API is fired when sound recognized by the speech recognition service as speech has been detected.

Syntax

Use the event name in methods like {{domxref("EventTarget.addEventListener", "addEventListener()")}} , or set an event handler property.

addEventListener("speechstart", (event) => {});

onspeechstart = (event) => {};

Event type

A generic {{DOMxRef("Event")}}  with no added properties.

Examples

You can use the speechstart event in an addEventListener method:

const recognition = new webkitSpeechRecognition() || new SpeechRecognition();

recognition.addEventListener("speechstart", () => {
  console.log("Speech has been detected");
});

Or use the onspeechstart event handler property:

recognition.onspeechstart = () => {
  console.log("Speech has been detected");
};

Specifications

{{Specifications}} 

Browser compatibility

{{Compat}} 

See also

In this article

View on MDN