SpeechSynthesisEvent: elapsedTime property

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2018.

Thuộc tính chỉ đọc elapsedTime của giao diện SpeechSynthesisEvent trả về thời gian đã trôi qua tính bằng giây, sau khi SpeechSynthesisUtterance.text bắt đầu được nói, tại thời điểm sự kiện được kích hoạt.

Giá trị

Một số thực chứa thời gian đã trôi qua, tính bằng giây.

Note: Các phiên bản đầu tiên của thông số kỹ thuật yêu cầu thời gian đã trôi qua theo mili giây. Kiểm tra bảng tương thích bên dưới để biết thông tin về trình duyệt của bạn.

Ví dụ

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

Thông số kỹ thuật

Thông số kỹ thuật
Web Speech API
# dom-speechsynthesisevent-elapsedtime

Tương thích trình duyệt

Xem thêm