diff options
author | matthewsotoudeh <matthewsot@outlook.com> | 2017-02-05 12:40:43 -0800 |
---|---|---|
committer | matthewsotoudeh <matthewsot@outlook.com> | 2017-02-05 12:40:43 -0800 |
commit | bb55c3a292dca512605ebeb83faec6ad15304c1f (patch) | |
tree | c29fdb76551b1b883e9bbebb47f74da3e50e2037 | |
parent | f7274ab4a7387986263c156674a2b4334876ddc9 (diff) |
prime the speech recognizer
-rw-r--r-- | content/scripts/speaker-rec.js | 2 | ||||
-rw-r--r-- | content/scripts/speech-rec.js | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/content/scripts/speaker-rec.js b/content/scripts/speaker-rec.js index e2efa90..68e18e1 100644 --- a/content/scripts/speaker-rec.js +++ b/content/scripts/speaker-rec.js @@ -13,7 +13,7 @@ function startSpeakerRec() { var silenceTimeout = -1; -var recognizingSpeech = false; +window.recognizingSpeech = false; function updateSpeakerRec(data) { var attendee = window.attendees.filter(function (el) { return el.peerId == data.peerId })[0]; window.loudnesses[window.attendees.indexOf(attendee)] = data.loudness; diff --git a/content/scripts/speech-rec.js b/content/scripts/speech-rec.js index 2532fa9..b8faa91 100644 --- a/content/scripts/speech-rec.js +++ b/content/scripts/speech-rec.js @@ -10,3 +10,10 @@ speechRecognizer.finalHypothesisCallback = function (hyp) { window.sendServerMessage({ forward: true, type: "command", command: "speech-update", text: hyp, peerId: peerId }); } }; + +//Prime the speech recognition with ~0.5s of previous data +setInterval(function () { + if (window.recognizingSpeech) return; + speechRecognizer.stopRecognizing(); + speechRecognizer.startRecognizing(); +}, 500); |