From 43f79466b2bc35ea489a22fe8c7f32430a5cae9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B3=95=E8=98=AD=E6=96=AF?= <34397289+fustyles@users.noreply.github.com> Date: Sun, 4 Aug 2019 20:32:20 +0800 Subject: [PATCH] Update ESP32_SpeechRecognition.html --- ESP32_SpeechRecognition.html | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ESP32_SpeechRecognition.html b/ESP32_SpeechRecognition.html index 03f669a909..7d3acfa9a2 100644 --- a/ESP32_SpeechRecognition.html +++ b/ESP32_SpeechRecognition.html @@ -165,7 +165,12 @@ var interim_transcript = ''; var final_transcript = ''; var Recognition_interim = ''; - var Recognition_final = ''; + var Recognition_final = ''; + if (typeof(event.results) == 'undefined') { + recognition.onend = null; + recognition.stop(); + return; + } for (var i = event.resultIndex; i < event.results.length; ++i) { if (event.results[i].isFinal) { final_transcript = event.results[i][0].transcript;