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

View in English Always switch to English

SpeechSynthesisEvent: utterance プロパティ

Baseline 広く利用可能

この機能は広く実装されており、多くのバージョンの端末やブラウザーで動作します。2022年9月以降、すべてのブラウザーで利用可能です。

utteranceSpeechSynthesisUtterance インターフェイスの読み取り専用プロパティで、イベントが発生した SpeechSynthesisUtterance インスタンスを返します。

SpeechSynthesisUtterance オブジェクトです。

js
utterThis.onpause = (event) => {
  const char = event.utterance.text.charAt(event.charIndex);
  console.log(
    `Speech paused at character ${event.charIndex} of "${event.utterance.text}", which is "${char}".`,
  );
};

仕様書

仕様書
Web Speech API
# dom-speechsynthesisevent-utterance

ブラウザーの互換性

関連情報