Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. SpeechRecognition
  4. error

SpeechRecognition: error event

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Theerror event of theWeb Speech APISpeechRecognition object is fired when a speech recognition error occurs.

Syntax

Use the event name in methods likeaddEventListener(), or set an event handler property.

js
addEventListener("error", (event) => { })onerror = (event) => { }

Event type

ASpeechRecognitionErrorEvent. Inherits fromEvent.

Event SpeechRecognitionErrorEvent

Event properties

In addition to the properties listed below, properties from the parent interface,Event, are available.

SpeechRecognitionErrorEvent.errorRead only

Returns the type of error raised.

SpeechRecognitionErrorEvent.messageRead only

Returns a message describing the error in more detail.

Examples

You can use theerror event in anaddEventListener method:

js
const recognition = new (SpeechRecognition || webkitSpeechRecognition)();recognition.addEventListener("error", (event) => {  console.error(`Speech recognition error detected: ${event.error}`);});

Or use theonerror event handler property:

js
recognition.onerror = (event) => {  console.error(`Speech recognition error detected: ${event.error}`);};

Specifications

Specification
Web Speech API
# eventdef-speechrecognition-error
Web Speech API
# dom-speechrecognition-onerror

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp