このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docs コミュニティーについてもっと知り、仲間になるにはこちらから。

View in English Always switch to English

SpeechRecognition: soundstart イベント

Limited availability

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

soundstartウェブ音声 API のイベントで、何らかの音(認識できる音声、できない音声にかかわらず)が検出できた時に発生します。

構文

このイベント名を addEventListener() などのメソッドで使用するか、イベントハンドラープロパティを設定するかしてください。

js
addEventListener("soundstart", (event) => {}); onsoundstart = (event) => {}; 

イベント型

一般的な Event であり、追加のプロパティはありません。

soundstart イベントは、 addEventListener メソッドで使用することができます。

js
const recognition = new webkitSpeechRecognition() || new SpeechRecognition(); recognition.addEventListener("soundstart", () => { console.log("音を受信し始めました"); }); 

または onsoundstart イベントハンドラープロパティを使用してください。

js
recognition.onsoundstart = () => { console.log("音を受信し始めました"); }; 

仕様書

Specification
Web Speech API
# eventdef-speechrecognition-soundstart
Web Speech API
# dom-speechrecognition-onsoundstart

ブラウザーの互換性

関連情報