- From: Dominic Mazzoni <dmazzoni@google.com>
- Date: Tue, 21 May 2013 09:01:59 -0700
- To: "public-speech-api@w3.org" <public-speech-api@w3.org>
Received on Tuesday, 21 May 2013 16:02:32 UTC
I filed the following bug, does anyone have any thoughts? https://www.w3.org/Bugs/Public/show_bug.cgi?id=22003 The getVoices method should be asynchronous. As it is right now, user agents have three choices, all bad: 1. They can pre-load speech synthesis, which slows down application startup even though most web pages don't speak. 2. They can block until the list of voices is available, which can make the browser appear sluggish and potentially freeze script execution on that page for tens of milliseconds. 3. They can return an empty list and update it as soon as the complete list of voices is available. I propose that getVoices take a callback as an argument, so you'd use it like this: window.speechSynthesis.getVoices(function(voices) { for (var i = 0; i < voices.length; i++) ... }); If the callback is unspecified, we could allow it to be used synchronously - and we should recommend browsers adopt either #2 or #3. Alternatively, we could just remove support for the synchronous form, and require the callback.
Received on Tuesday, 21 May 2013 16:02:32 UTC