Re: TTS proposal to split Utterance into its own interface

The API feels quite odd, the static part of it.
Normally one would just have interface SpeechSynthesis and let
window object to have getter to such object.
Then one could use speechSynthesis.speak("hello world");

Also, why createUtterance. Why not
var utterance = new SpeechSynthesisUtterance({ text: "hello world"});


In DOM world we've been moving away from create* methods. Events for example are
created nowadays using constructors.


-Olli

On 08/16/2012 12:15 AM, Dominic Mazzoni wrote:
> Any thoughts?
>
> Is there anyone else interested in TTS following this list, in particular anyone outside of Google?
>
> - Dominic
>
> On Wed, Aug 8, 2012 at 2:15 PM, Dominic Mazzoni <dmazzoni@google.com <mailto:dmazzoni@google.com>> wrote:
>
>     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, 15 August 2012 21:26:57 UTC