summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatthewsotoudeh <matthewsot@outlook.com>2017-02-05 12:47:57 -0800
committermatthewsotoudeh <matthewsot@outlook.com>2017-02-05 12:47:57 -0800
commitdf15aa053e5bf3e4f67c7612cf475e0ddcf854d7 (patch)
tree702f42960d6b6b4395a79db5ca37d49e31412a8b
parentbb55c3a292dca512605ebeb83faec6ad15304c1f (diff)
abort instead of stop
-rw-r--r--content/scripts/speech-rec.js6
-rw-r--r--ps/sr-abstraction.js8
2 files changed, 10 insertions, 4 deletions
diff --git a/content/scripts/speech-rec.js b/content/scripts/speech-rec.js
index b8faa91..23e6a53 100644
--- a/content/scripts/speech-rec.js
+++ b/content/scripts/speech-rec.js
@@ -14,6 +14,8 @@ speechRecognizer.finalHypothesisCallback = function (hyp) {
//Prime the speech recognition with ~0.5s of previous data
setInterval(function () {
if (window.recognizingSpeech) return;
- speechRecognizer.stopRecognizing();
- speechRecognizer.startRecognizing();
+ try {
+ speechRecognizer.stopRecognizing(true);
+ speechRecognizer.startRecognizing();
+ } catch (err) { }
}, 500);
diff --git a/ps/sr-abstraction.js b/ps/sr-abstraction.js
index 3cb4fc3..215be09 100644
--- a/ps/sr-abstraction.js
+++ b/ps/sr-abstraction.js
@@ -42,7 +42,11 @@ if (typeof SpeechRecognition == "undefined" && typeof webkitSpeechRecognition ==
speechRecognizer.startRecognizing = function () {
recognition.start();
};
- speechRecognizer.stopRecognizing = function () {
- recognition.stop();
+ speechRecognizer.stopRecognizing = function (abort) {
+ if (abort) {
+ recognition.abort();
+ } else {
+ recognition.stop();
+ }
};
}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback