OLD | NEW |
---|---|
(Empty) | |
1 <html> | |
2 <script> | |
3 function checkStart() { | |
Satish
2011/11/17 16:29:23
since this is a small enough function and used onl
Leandro Graciá Gil
2011/11/17 22:02:45
Done.
| |
4 if (chrome.extension.lastError) { | |
5 alert("Couldn't start speech input: " + chrome.extension.lastError.message); | |
6 } | |
7 } | |
8 | |
9 chrome.browserAction.onClicked.addListener(function(tab) { | |
10 chrome.experimental.speechInput.isRecording(function (recording) { | |
11 if (!recording) | |
Satish
2011/11/17 16:29:23
use braces here?
Leandro Graciá Gil
2011/11/17 22:02:45
Done.
| |
12 chrome.experimental.speechInput.start({}, checkStart); | |
Satish
2011/11/17 16:29:23
it may be useful if we change the browser action i
Satish
2011/11/17 16:29:23
is that empty dictionary {} required or can a null
Leandro Graciá Gil
2011/11/17 22:02:45
Done.
Leandro Graciá Gil
2011/11/17 22:02:45
It is required.
| |
13 else | |
14 chrome.experimental.speechInput.stop(); | |
15 }); | |
16 }); | |
17 | |
18 chrome.experimental.speechInput.onError.addListener(function(error) { | |
19 alert("Speech input failed: " + error.code); | |
20 }); | |
21 | |
22 chrome.experimental.speechInput.onResult.addListener(function(result) { | |
23 alert(result.hypotheses[0].utterance); | |
24 }); | |
25 </script> | |
26 </html> | |
OLD | NEW |