SpeechRecognition: speechend 事件
Web Speech API 的 speechend 事件在語音識別服務停止檢測到語音後觸發。
語法
在諸如 addEventListener() 之類的方法中使用事件名稱,或設定事件處理程式屬性。
js
addEventListener("speechend", (event) => { })
onspeechend = (event) => { }
事件型別
一個通用的 Event,沒有額外的屬性。
示例
您可以在 addEventListener 方法中使用 speechend 事件
js
const recognition = new (SpeechRecognition || webkitSpeechRecognition)();
recognition.addEventListener("speechend", () => {
console.log("Speech has stopped being detected");
});
或者使用 onspeechend 事件處理程式屬性
js
recognition.onspeechend = () => {
console.log("Speech has stopped being detected");
};
規範
| 規範 |
|---|
| Web Speech API # eventdef-speechrecognition-speechend |
| Web Speech API # dom-speechrecognition-onspeechend |
瀏覽器相容性
載入中…