- From: Dominic Mazzoni <dmazzoni@google.com>
- Date: Fri, 17 Aug 2012 09:36:36 -0700
- To: olli@pettay.fi
- Cc: public-speech-api@w3.org
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. 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 16:37:16 UTC