SpeechRecognition: Thuộc tính continuous

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Thuộc tính continuous của giao diện SpeechRecognition kiểm soát việc trả về kết quả liên tục cho mỗi lần nhận dạng, hay chỉ một kết quả duy nhất.

Mặc định là kết quả duy nhất (false).

Giá trị

Một giá trị boolean biểu diễn trạng thái continuous hiện tại của SpeechRecognition. true nghĩa là liên tục, và false nghĩa là không liên tục (mỗi lần một kết quả duy nhất).

Ví dụ

Đoạn mã này được trích từ ví dụ Speech color changer của chúng ta.

js
const recognition = new SpeechRecognition();
recognition.continuous = false;
recognition.lang = "en-US";
recognition.interimResults = false;
recognition.maxAlternatives = 1;

// …

Đặc tả kỹ thuật

Specification
Web Speech API
# dom-speechrecognition-continuous

Tương thích trình duyệt

Xem thêm