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

View in English Always switch to English

SpeechSynthesis: speaking プロパティ

Baseline 広く利用可能

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

speakingSpeechSynthesis インターフェイスの読み取り専用プロパティで、論理値であり、発話が現在処理中の場合、SpeechSynthesispaused 状態であっても true を返します。

論理値です。

js
const synth = window.speechSynthesis;

const utterance1 = new SpeechSynthesisUtterance(
  "こう言ってみてはどうでしょうか?これを言うと、かなり長い文章になります。",
);
const utterance2 = new SpeechSynthesisUtterance("念のため、もう一言言います。");

synth.speak(utterance1);
synth.speak(utterance2);

const amISpeaking = synth.speaking; // utterance1 または utterance2 が現在話されている場合、true を返す

仕様書

仕様書
Web Speech API
# dom-speechsynthesis-speaking

ブラウザーの互換性

関連情報