SpeechRecognition: Sự kiện speechend
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Sự kiện speechend của Web Speech API được kích hoạt khi giọng nói được dịch vụ nhận dạng giọng nói nhận diện ngừng được phát hiện.
Cú pháp
Sử dụng tên sự kiện trong các phương thức như addEventListener(), hoặc thiết lập một thuộc tính trình xử lý sự kiện.
js
addEventListener("speechend", (event) => { })
onspeechend = (event) => { }
Loại sự kiện
Một Event chung chung không có thuộc tính bổ sung.
Ví dụ
Bạn có thể sử dụng sự kiện speechend trong phương thức addEventListener:
js
const recognition = new (SpeechRecognition || webkitSpeechRecognition)();
recognition.addEventListener("speechend", () => {
console.log("Speech has stopped being detected");
});
Hoặc sử dụng thuộc tính trình xử lý sự kiện onspeechend:
js
recognition.onspeechend = () => {
console.log("Speech has stopped being detected");
};
Đặc tả kỹ thuật
| Specification |
|---|
| Web Speech API> # eventdef-speechrecognition-speechend> |
| Web Speech API> # dom-speechrecognition-onspeechend> |