SpeechSynthesisEvent: elapsedTime プロパティ

elapsedTimeSpeechSynthesisEvent の読み取り専用プロパティで、このイベントが発生した時点での SpeechSynthesisUtterance.text を発話し始めてからの経過時間を秒単位で返します。

経過時間を秒単位で格納した浮動小数点数です。

メモ: 初期のバージョンの仕様書では、ミリ秒単位の経過時刻が必要でした。 ブラウザーの互換性一覧表を確認してください。

js
utterThis.onboundary = (event) => {
  console.log(
    `${event.name} boundary reached after ${event.elapsedTime} seconds.`,
  );
};

仕様書

Specification
Web Speech API
# dom-speechsynthesisevent-elapsedtime

ブラウザーの互換性

BCD tables only load in the browser

関連情報