SpeechRecognition: stop() メソッド
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
stop() はウェブ音声 API のメソッドで、音声認識サービスが入ってくる音声を待機するのを停止し、これまでにキャプチャした結果に基づいて SpeechRecognitionResult を返そうとします。
構文
js
stop()
引数
なし。
返値
なし (undefined)。
例
js
const recognition = new SpeechRecognition();
const diagnostic = document.querySelector(".output");
const bg = document.querySelector("html");
const startBtn = document.querySelector("button");
startBtn.onclick = () => {
recognition.start();
console.log("色のコマンドを受け付ける準備ができました。");
};
recognition.onspeechend = () => {
recognition.stop();
console.log("音声認識サービスが停止されました。");
};
仕様書
| Specification |
|---|
| Web Speech API> # dom-speechrecognition-stop> |
ブラウザーの互換性
Loading…