Skip to content

Commit

Permalink
Update speechrecognition.js
Browse files Browse the repository at this point in the history
  • Loading branch information
fustyles authored Aug 4, 2019
1 parent 8012db1 commit fc1e229
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions myBlockly/SpeechRecognition/speechrecognition.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,21 @@ if ('webkitSpeechRecognition' in window) {
recognition.onstart = function() {
recognizing = true;
};

recognition.onerror = function(event) {
if (event.error == 'no-speech') ignore_onend = true;
if (event.error == 'audio-capture') ignore_onend = true;
if (event.error == 'not-allowed') ignore_onend = true;
console.log(event.error);
};

recognition.onend = function() {
recognizing = false;
if (ignore_onend) return;
if (!final_transcript) return;
recognition.start();
};

recognition.onresult = function(event) {
var interim_transcript = '';
for (var i = event.resultIndex; i < event.results.length; ++i) {
Expand Down

0 comments on commit fc1e229

Please sign in to comment.