Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. SpeechSynthesisEvent
  4. SpeechSynthesisEvent()

SpeechSynthesisEvent: SpeechSynthesisEvent() constructor

Baseline Widely available

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

TheSpeechSynthesisEvent() constructor creates a newSpeechSynthesisEvent object.

Note:A web developer doesn't typically need to call this constructor, as the browser creates these objects itself when firing events.

Syntax

js
new SpeechSynthesisEvent(type, options)

Parameters

type

A string with the name of the event.It is case-sensitive and browsers set it tostart,end,error,pause,resume,mark, orboundary.

options

An object that,in addition to the properties defined inEvent(), has the following properties:

utterance

ASpeechSynthesisUtterance object, which is the speech request the event was triggered on.

charIndexOptional

The index position of the character inSpeechSynthesisUtterance.text that was being spoken when the event was triggered. Its default value is0.

charLengthOptional

The number of characters left to be spoken after the character at thecharIndex position. Its default value is0.

elapsedTimeOptional

The elapsed time in seconds, after theSpeechSynthesisUtterance.text started being spoken, at which the event was triggered. Its default value is0.

nameOptional

The name associated with certain types of events: the name of theSSML marker reached in the case of amark event, or the type of boundary reached in the case of aboundary event. It defaults to the empty string ("").

Return value

A newSpeechSynthesisEvent object.

Specifications

Specification
Web Speech API
# dom-speechsynthesisevent-speechsynthesisevent

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp