3 <title> Web Speech Recognition
</title>
7 var hash
= window
.location
.hash
;
8 var recognizer
= new webkitSpeechRecognition();
13 // Just probe if creating a SpeechRecognition object worked.
15 notify(recognizer
== null ? 'fail' : 'success');
19 recognizer
.continuous
= false;
23 recognizer
.continuous
= true;
30 recognizer
.onresult = function(e
) {
31 var value
= e
.results
[e
.resultIndex
][0].transcript
;
32 if (value
== 'Pictures of the moon') {
34 notify('goodresult' + successes
);
39 recognizer
.onerror = function(e
) {
40 console
.log('error', e
);
41 notify('error' + e
.error
);
43 recognizer
.onnomatch = function() { console
.log('nomatch'); }
44 recognizer
.onaudiostart = function() { console
.log('audiostart'); }
45 recognizer
.onsoundstart = function() { console
.log('soundstart'); }
46 recognizer
.onsoundend = function() { console
.log('soundend'); }
47 recognizer
.onaudioend = function() { console
.log('audioend'); }
53 function notify(status
) {
54 document
.location
= '#' + status
;
55 document
.location
.reload(true);