Firefox Tomorrow

web api instance property

SpeechRecognitionErrorEvent: error property

View on MDN ↗

The error read-only property of the SpeechRecognitionErrorEvent interface returns the type of error raised.

Value

An enumerated value representing the type of error. Possible values include:

  • aborted
    • : Speech input was aborted in some manner, perhaps by some user-agent-specific behavior like a button the user can press to cancel speech input.
  • audio-capture
    • : Audio capture failed.
  • bad-grammar Deprecated
    • : There was an error in the speech recognition grammar or semantic tags, or the chosen grammar format or semantic tag format was unsupported.

      [!NOTE] This error is no longer part of the Web Speech API specification; the concept of grammar has been removed from the Web Speech API. Related features remain in the specification and are still recognized by supporting browsers for backwards compatibility, but they have no effect on speech recognition services.

  • language-not-supported
    • : The user agent does not support the language specified in the lang attribute of the SpeechRecognition object. The set of supported languages is browser-dependent, and there is no way to programmatically determine from front-end code the languages a user’s browser supports for speech recognition.
  • network
    • : Network communication required for completing the recognition failed.
  • no-speech
    • : No speech was detected.
  • not-allowed
    • : The user agent disallowed any speech input from occurring for reasons of security, privacy or user preference.
  • phrases-not-supported
  • service-not-allowed
    • : The user agent disallowed the requested speech recognition service, either because the user agent doesn’t support it or because of reasons of security, privacy or user preference. In this case it would allow another more suitable speech recognition service to be used instead.

Examples

const recognition = new SpeechRecognition();

recognition.onerror = (event) => {
  console.log(`Speech recognition error detected: ${event.error}`);
  console.log(`Additional information: ${event.message}`);
};

Specifications

SpecificationsStandards references are available on the canonical MDN page.

Browser compatibility

Browser compatibilityCompatibility data is available on the canonical MDN page.

See also