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

View in English Always switch to English

SpeechSynthesisEvent: elapsedTime プロパティ

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨2018年9月⁩.

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

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

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

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

仕様書

Specification
Web Speech API
# dom-speechsynthesisevent-elapsedtime

ブラウザーの互換性

関連情報