OLD | NEW |
1 <table class="intro"> | 1 <table class="intro"> |
2 <tr> | 2 <tr> |
3 <th scope="col"></th> | 3 <th scope="col"></th> |
4 <th scope="col"></th> | 4 <th scope="col"></th> |
5 </tr> | 5 </tr> |
6 <tr> | 6 <tr> |
7 <td><strong>Description:</strong></td> | 7 <td><strong>Description:</strong></td> |
8 <td>Use the <code>chrome.tts</code> module to play synthesized | 8 <td>Use the <code>chrome.tts</code> module to play synthesized |
9 text-to-speech (TTS). | 9 text-to-speech (TTS). |
10 See also the related | 10 See also the related |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 <p>To catch errors and make sure you're calling <code>speak()</code> | 80 <p>To catch errors and make sure you're calling <code>speak()</code> |
81 correctly, pass a callback function that takes no arguments. Inside | 81 correctly, pass a callback function that takes no arguments. Inside |
82 the callback, check | 82 the callback, check |
83 $ref:runtime.lastError | 83 $ref:runtime.lastError |
84 to see if there were any errors.</p> | 84 to see if there were any errors.</p> |
85 | 85 |
86 <pre>chrome.tts.speak( | 86 <pre>chrome.tts.speak( |
87 utterance, | 87 utterance, |
88 options, | 88 options, |
89 function() { | 89 function() { |
90 if (chrome.extension.lastError) { | 90 if (chrome.runtime.lastError) { |
91 console.log('Error: ' + chrome.extension.lastError.message); | 91 console.log('Error: ' + chrome.runtime.lastError.message); |
92 } | 92 } |
93 });</pre> | 93 });</pre> |
94 | 94 |
95 <p>The callback returns right away, before the engine has started | 95 <p>The callback returns right away, before the engine has started |
96 generating speech. The purpose of the callback is to alert you to | 96 generating speech. The purpose of the callback is to alert you to |
97 syntax errors in your use of the TTS API, not to catch all possible | 97 syntax errors in your use of the TTS API, not to catch all possible |
98 errors that might occur in the process of synthesizing and outputting | 98 errors that might occur in the process of synthesizing and outputting |
99 speech. To catch these errors too, you need to use an event listener, | 99 speech. To catch these errors too, you need to use an event listener, |
100 described below.</p> | 100 described below.</p> |
101 | 101 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 <pre>chrome.tts.getVoices( | 195 <pre>chrome.tts.getVoices( |
196 function(voices) { | 196 function(voices) { |
197 for (var i = 0; i < voices.length; i++) { | 197 for (var i = 0; i < voices.length; i++) { |
198 console.log('Voice ' + i + ':'); | 198 console.log('Voice ' + i + ':'); |
199 console.log(' name: ' + voices[i].voiceName); | 199 console.log(' name: ' + voices[i].voiceName); |
200 console.log(' lang: ' + voices[i].lang); | 200 console.log(' lang: ' + voices[i].lang); |
201 console.log(' gender: ' + voices[i].gender); | 201 console.log(' gender: ' + voices[i].gender); |
202 console.log(' extension id: ' + voices[i].extensionId); | 202 console.log(' extension id: ' + voices[i].extensionId); |
203 console.log(' event types: ' + voices[i].eventTypes); | 203 console.log(' event types: ' + voices[i].eventTypes); |
204 } | 204 } |
205 });</pre> | 205 });</pre> |
OLD | NEW |