react-speech-recognition package not working

268 Views Asked by At

It's a simple react package that convert user audio to text. I install the package and try its basic code example but it shows a error "RecognitionManager.js:247 Uncaught ReferenceError: regeneratorRuntime is not defined".

import React from 'react';
import SpeechRecognition, { useSpeechRecognition } from 'react-speech-recognition'

const App = () => {
    const {transcript, listening,resetTranscript, browserSupportsSpeechRecognition } = useSpeechRecognition();
    if (!browserSupportsSpeechRecognition) {
        return <span>Browser doesn't support speech recognition.</span>;
      }
    //   const startListening = () => SpeechRecognition.startListening({ continuous: true, language: 'en-IN' });
    return (
        <>
       <div>
      <p>Microphone: {listening ? 'on' : 'off'}</p>
      <button onClick={SpeechRecognition.startListening}>Start</button>
      <button onClick={SpeechRecognition.stopListening}>Stop</button>
      <button onClick={resetTranscript}>Reset</button>
      <p>{transcript}</p>
    </div>
        </>
    );
};

export default App;

! error RecognitionManager.js:247 Uncaught ReferenceError: regeneratorRuntime is not defined at RecognitionManager.js:247:61 at RecognitionManager.js:332:5 at node_modules/react-speech-recognition/lib/RecognitionManager.js (RecognitionManager.js:452:1) at __require (chunk-76J2PTFD.js?v=a062c6e0:3:50) at node_modules/react-speech-recognition/lib/SpeechRecognition.js (SpeechRecognition.js:16:50) at __require (chunk-76J2PTFD.js?v=a062c6e0:3:50) at node_modules/react-speech-recognition/lib/index.js (index.js:16:50) at __require (chunk-76J2PTFD.js?v=a062c6e0:3:50) at index.js:23:22

0

There are 0 best solutions below