SpeechRecognition: end 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 end event of the Web Speech API SpeechRecognition object is fired when the speech recognition service has disconnected.

Syntax

Use the event name in addEventListener():

js
addEventListener("end", (event) => { })

Alternatively, assign to the event handler property of the interface:

js
onend = (event) => { }

Event type

A generic Event with no added properties.

Examples

You can use the end event in an addEventListener method:

js
const recognition = new (
  window.SpeechRecognition || window.webkitSpeechRecognition
)();

recognition.addEventListener("end", () => {
  console.log("Speech recognition service disconnected");
});

Or use the onend event handler property (but note that this replaces other event listeners added using onend, if any):

js
recognition.onend = () => {
  console.log("Speech recognition service disconnected");
};

Specifications

Specification
Web Speech API
# eventdef-speechrecognition-end
Web Speech API
# dom-speechrecognition-onend

Browser compatibility

See also