Error event/callback for speech synthesis

There's one case that isn't covered in the speech synthesis spec: what
happens if there's an error with a particular utterance that isn't detected
at the time when it's enqueued?

As an example, suppose the author writes malformed SSML, but the speech is
implemented in a remote server so the fact that there was an error isn't
discovered until after several utterances have been enqueued?

Possible solutions:
* Yet another callback, onerror - that indicates that a particular
utterance was not and will not be spoken, because there was an error
processing that particular utterance. Other utterances are unaffected; if
there was another one in the queue after it, it will start speaking next
(or error as well).
* An extra argument in SpeechSynthesisEvent when an 'end' event is fired,
indicating success or failure, along with an error message. The downside is
that these arguments wouldn't apply to all callbacks, but the upside is
that clients could only listen to onend and be sure to get a callback for
every utterance, rather than needing to listen to onend and onerror.
* Or, a compromise could be that when there's an error, both onerror and
onend get fired, in that order - to make things easier for clients.

I think it'd be too limiting to expect that errors could be caught
synchronously before the call to speak() returns. Web APIs are moving in
the direction of being more asynchronous, and when speech is likely to be
implemented remotely, or even locally in a different thread or process, we
should let speak() return immediately and have an error callback later.

- Dominic

Received on Tuesday, 9 October 2012 16:11:18 UTC