I'm making a voice recognition program and when I press the microphone button, an error occurs and I can't record. Is there any way to fix it?

It is written 'react' and this foundation 'react-c l i'

there has problem to Speech Recognition Error"Value below was evaluated just now.". I used chrome.

I think it maybe console.log() has the problem

how to solve this problem? Please help if you need more problem information please leave your comment

state = {
show: false,
listening: false,
text: "Sorry, can't hear",
component Did Mount() {
const Recognition =
window.Speech Recognition || window.web kit Speech Recognition;
if (!Recognition) {
'Speech Recognition API is not supported in this browser, try chrome'
this.recognition = new Recognition();
this.recognition.lang =  'k o-KR';
this.recognition.continuous = false;
this.recognition.interim Results = false;
this.recognition.max Alternatives = 1;
this.recognition.on result = event => {
  const text = event.results[0][0].transcript;
  console.log('transcript', text);
  this.set State({ text });
this.recognition.on speech end = () => {
this.set State({ show: true });
this.recognition.on no match = () => {
console.log('no match');
this.set State({ text: "Sorry, can't hear" });
this.recognition.on start = () => {
  this.set State({listening: true});
this.recognition.on end = () => {
  this.set State({listening: false});
this.recognition.on error = event => {
console.log('error', event);
this.set State({
show: true,
text: event.error

"error SpeechRecognitionError {isTrusted: true, error: "not-allowed", message: "", type: "error", target: SpeechRecognition, …} bubbles: false cancelBubble: false cancelable: false composed: false currentTarget: SpeechRecognition continuous: false grammars: SpeechGrammarList {length: 0} interimResults: false lang: "ko-KR" maxAlternatives: 1 onaudioend: null onaudiostart: null onend: ƒ () onerror: ƒ (t) onnomatch: ƒ () onresult: ƒ (t) onsoundend: null onsoundstart: null onspeechend: ƒ () onspeechstart: null onstart: ƒ () proto: SpeechRecognition defaultPrevented: false error: "not-allowed" eventPhase: 0 isTrusted: true message: "" path: [] returnValue: true srcElement: SpeechRecognition {grammars: SpeechGrammarList, lang: "ko-KR", continuous: false, interimResults: false, maxAlternatives: 1, …} target: SpeechRecognition {grammars: SpeechGrammarList, lang: "ko-KR", continuous: false, interimResults: false, maxAlternatives: 1, …} timeStamp: 14645.344999998997 type: "error" proto: SpeechRecognitionError"

0 Answers