- From: Glen Shires <gshires@google.com>
- Date: Tue, 11 Sep 2012 14:48:18 -0700
- To: Dominic Mazzoni <dmazzoni@google.com>
- Cc: public-speech-api@w3.org
- Message-ID: <CAEE5bcgJXXkwJ4osfe+fAX=56ETtpx78v2OeSH7LkQKsZHHnZA@mail.gmail.com>
Is this preferable to: interface SpeechSynthesisUtterance { ... attribute Function onstart; attribute Function onend; On Tue, Sep 11, 2012 at 1:19 AM, Dominic Mazzoni <dmazzoni@google.com>wrote: > I propose adding a mechanism by which JavaScript clients can attach > event listeners to an utterance to get notified when it starts > speaking, when it finishes, and optionally with updates of the > progress. > > Here's what could be added to the spec: > > callback SpeechSynthesisStartCallback = void(); > callback SpeechSynthesisEndCallback = void(); > callback SpeechSynthesisUpdateCallback = void(DOMString markerName, > unsigned long charIndex, float elapsedTime); > > interface SpeechSynthesisUtterance { > ... > attribute SpeechSynthesisStartCallback onstart; > attribute SpeechSynthesisEndCallback onend; > attribute SpeechSynthesisUpdateCallback onupdate; > } > > I propose that "onstart" and "onend" must be supported for an > implementation to be fully compliant. There are too many applications > that can't be implemented without these. > > I think "onupdate" should be optional because it depends on what's > possible in the speech engine. If the speech engine provides > word-level information, for example, then every time there's a break > between works it'd call onupdate() with the character index (into the > original utterance string) and the elapsed time since speech began. An > engine might also notify when certain named "markers" (e.g. in SSML) > are reached. > > Other ideas - in the Chrome TTS extension API I also implemented these > events - what do you think? > > * Error > * Cancelled (stopAndFlushQueue called before it ever started playing) > * Interrupted (stop called while it was in the middle of speaking) > > - Dominic > >
Received on Tuesday, 11 September 2012 21:49:28 UTC