过时
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.
SpeechRecognitionError
接口在
Web 语音 API
represents error messages from the recognition service.
This
SpeechRecognitionError
interface was renamed to
SpeechRecognitionErrorEvent
in the Web Speech API specification.
SpeechRecognitionError
also inherits properties from its parent interface,
事件
.
SpeechRecognitionError.error
只读
Returns the type of error raised.
SpeechRecognitionError.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);
}
No compatibility data found. Please contribute data for "api.SpeechRecognitionError" (depth: 1) to the MDN 兼容性数据存储库 .
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"