Re: TTS proposal to split Utterance into its own interface

On 08/17/2012 07:36 PM, Dominic Mazzoni wrote:
> On Wed, Aug 15, 2012 at 2:26 PM, Olli Pettay <Olli.Pettay@helsinki.fi> wrote:
>> 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");
>
> If there's just a global method speak, how would you propose to pass
> additional arguments? To allow for future expansion, we need an
> Utterance object to capture all of the information about an utterance
> to be spoken.

Oh, sorry, I didn't mean speak(string), but speak(take_whatever_params_you_suggested).
It was just those static methods which feel really odd, and unnecessary.


>
> An alternative would be to pass everything directly, for example:
>
> ALTERNATIVE 2: speechSynthesis.speak({text: "hello world", lang: 'en-US', ...});
>
> Do you prefer that alternative?
>
>> Also, why createUtterance. Why not
>> var utterance = new SpeechSynthesisUtterance({ text: "hello world"});
>
> That works for me. I still think there should be a separate synthesis
> and utterance object, but otherwise that sounds good. How about this?
>
> Ex 1:
> speechSynthesis.speak(SpeechSynthesisUtterance('Hello World'));
>
> Ex 2:
> var u = new SpeechSynthesisUtterance();
> u.text = 'Hello World';
> u.lang = 'en-US';
> u.onend = function() { alert('Finished!'); }
> speechSynthesis.speak(u);
>
> interface SpeechSynthesis {
>    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();
> }
>
> [Constructor,
>   Constructor(DOMString text)]
> 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;
> }
>

Received on Friday, 17 August 2012 17:21:34 UTC