SpeechRecognition: start イベント
speechstart
はウェブ音声 API の SpeechRecognition
オブジェクトのイベントで、これは、音声認識サービスが、現在の SpeechRecognition
に関連する文法を認識するために、入力される音声を聞き始めたときに発行されます。
構文
このイベント名を addEventListener()
などのメソッドで使用するか、イベントハンドラープロパティを設定するかしてください。
addEventListener('start', (event) => { })
onstart = (event) => { }
イベント型
一般的な Event
であり、追加のプロパティはありません。
例
start
イベントは、 addEventListener
メソッドで使用することができます。
const recognition = new webkitSpeechRecognition() || new SpeechRecognition();
recognition.addEventListener('start', () => {
console.log('音声認識サービスが開始しました');
});
または onstart
イベントハンドラープロパティを使用してください。
recognition.onstart = () => {
console.log('音声認識サービスが開始しました');
}
仕様書
Specification |
---|
Web Speech API # eventdef-speechrecognition-start |
Web Speech API # dom-speechrecognition-onstart |
ブラウザーの互換性
BCD tables only load in the browser