SpeechRecognition: Sự kiện audioend
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Sự kiện audioend của Web Speech API được kích hoạt khi tác nhân người dùng kết thúc ghi âm thanh cho nhận dạng giọng nói.
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("audioend", (event) => { })
onaudioend = (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 audioend trong phương thức addEventListener:
js
const recognition = new (SpeechRecognition || webkitSpeechRecognition)();
recognition.addEventListener("audioend", () => {
console.log("Audio capturing ended");
});
Hoặc sử dụng thuộc tính trình xử lý sự kiện onaudioend:
js
recognition.onaudioend = () => {
console.log("Audio capturing ended");
};
Đặc tả kỹ thuật
| Specification |
|---|
| Web Speech API> # eventdef-speechrecognition-audioend> |
| Web Speech API> # dom-speechrecognition-onaudioend> |