This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for the proper prefixes to use in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the spec changes.
The SpeechSynthesisEvent
interface of the Web Speech API contains information about the current state of SpeechSynthesisUtterance
objects that have been processed in the speech service.
Properties
The SpeechSynthesisEvent
interface also inherits properties from its parent interface, Event
.
SpeechSynthesisEvent.charIndex
Read only- Returns the index position of the character in the
SpeechSynthesisUtterance.text
that was being spoken when the event was triggered. SpeechSynthesisEvent.elapsedTime
Read only- Returns the elapsed time in milliseconds after the
SpeechSynthesisUtterance.text
started being spoken that the event was triggered at. SpeechSynthesisEvent.name
Read only- Returns the name associated with certain types of events occuring as the
SpeechSynthesisUtterance.text
is being spoken: the name of the SSML marker reached in the case of amark
event, or the type of boundary reached in the case of aboundary
event. SpeechSynthesisEvent.utterance
Read only- Returns the
SpeechSynthesisUtterance
instance that the event was triggered on.
Methods
The SpeechSynthesisEvent
interface also inherits methods from its parent interface, Event
.
Examples
utterThis.onpause = function(event) { var char = event.utterance.text.charAt(event.charIndex); console.log('Speech paused at character ' + event.charIndex + ' of "' + event.utterance.text + '", which is "' + char + '".'); } utterThis.onboundary = function(event) { console.log(event.name + ' boundary reached after ' + event.elapsedTime + ' milliseconds.'); }
Specifications
Specification | Status | Comment |
---|---|---|
Web Speech API The definition of 'SpeechSynthesisEvent' in that specification. |
Draft |
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|
Basic support | 33 | 44 (44) [1] | Not supported | Not supported | Not supported |
Feature | Android | Chrome | Firefox Mobile (Gecko) | Firefox OS | IE Phone | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|---|
Basic support | (Yes) | (Yes) | ? | 2.5 | Not supported | Not supported | Not supported |
- [1] Can be enabled via the
media.webspeech.synth.enabled
flag in about:config.
See also
Document Tags and Contributors
Tags:
Contributors to this page:
chrisdavidmills
Last updated by:
chrisdavidmills,