SpeechRecognitionErrorEvent

这是 实验性技术
检查 浏览器兼容性表格 在生产中使用这之前。

SpeechRecognitionErrorEvent interface of the Web 语音 API represents error messages from the recognition service.

特性

SpeechRecognitionErrorEvent also inherits properties from its parent interface, Event .

SpeechRecognitionErrorEvent.error 只读
Returns the type of error raised.
SpeechRecognitionErrorEvent.message 只读
Returns a message describing the error in more detail.

范例

var recognition = new SpeechRecognition();
recognition.onerror = function(event) {
  console.log('Speech recognition error detected: ' + event.error);
  console.log('Additional information: ' + event.message);
}
					

规范

规范 状态 Comment
Web 语音 API
The definition of 'SpeechRecognitionErrorEvent' in that specification.
草案

浏览器兼容性

更新 GitHub 上的兼容性数据
Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
SpeechRecognitionErrorEvent
Chrome 77
注意事项
77
注意事项
You'll need to serve your code through a web server for recognition to work.
33 — 77
Alternate Name
Alternate Name Uses the non-standard name: webkitSpeechRecognitionError
Edge 79 Firefox 不支持 No IE 不支持 No Opera 不支持 No Safari 不支持 No WebView Android 77
注意事项
77
注意事项
You'll need to serve your code through a web server for recognition to work.
≤37 — 77
Alternate Name
Alternate Name Uses the non-standard name: webkitSpeechRecognitionError
Chrome Android 77
注意事项
77
注意事项
You'll need to serve your code through a web server for recognition to work.
33 — 77
Alternate Name
Alternate Name Uses the non-standard name: webkitSpeechRecognitionError
Firefox Android 不支持 No Opera Android 不支持 No Safari iOS 不支持 No Samsung Internet Android 12.0
注意事项
12.0
注意事项
You'll need to serve your code through a web server for recognition to work.
2.0 — 12.0
Alternate Name
Alternate Name Uses the non-standard name: webkitSpeechRecognitionError
error
Chrome 77 Edge 79 Firefox 不支持 No IE 不支持 No Opera 不支持 No Safari 不支持 No WebView Android 77 Chrome Android 77 Firefox Android 不支持 No Opera Android 不支持 No Safari iOS 不支持 No Samsung Internet Android 12.0
message
Chrome 77 Edge 79 Firefox 不支持 No IE 不支持 No Opera 不支持 No Safari 不支持 No WebView Android 77 Chrome Android 77 Firefox Android 不支持 No Opera Android 不支持 No Safari iOS 不支持 No Samsung Internet Android 12.0

图例

完整支持
完整支持
不支持
不支持
实验。期望将来行为有所改变。
实验。期望将来行为有所改变。
见实现注意事项。
使用非标名称。
使用非标名称。

Firefox OS permissions

To use speech recognition in an app, you need to specify the following permissions in your manifest :

"permissions": {
  "audio-capture" : {
    "description" : "Audio capture"
  },
  "speech-recognition" : {
    "description" : "Speech recognition"
  }
}
					

You also need a privileged app, so you need to include this as well:

  "type": "privileged"
					

另请参阅