TTS proposal to split Utterance into its own interface

Hi - I've got a few ideas for the TTS part of the Speech API and I'd like
to propose them in a few separate threads.

The first idea I'd like to propose is to put each Utterance into its own
interface. The current TTS interface, with instance variables that
represent just one utterance, opens up a lot of confusion as to what
happens if you try to speak multiple things at once. Many engines would not
support this, and most users wouldn't want this anyway, so I think it'd be
better if the interface was designed around around a single static
controller and multiple utterance objects.

Here's an example of how it could look instead:

interface SpeechSynthesis {
  static SpeechSynthesisUtterance createUtterance();

  static readonly attribute boolean pending;
  static readonly attribute boolean speaking;
  static readonly attribute boolean paused;

  static void speak(SpeechSynthesisUtterance utterance);
  static void cancel(SpeechSynthesisUtterance utterance);
  static void pause();
  static void continue();
  static void stopAndFlushQueue();
}

interface SpeechSynthesisUtterance {
  attribute DOMString text;
  attribute DOMString lang;
  attribute DOMString serviceURI;

  readonly attribute boolean speaking;
  readonly attribute boolean paused;
  readonly attribute boolean ended;

  attribute Function onstart;
  attribute Function onend;
}

Thoughts?

- Dominic

Received on Wednesday, 8 August 2012 21:15:43 UTC