react-speech-kit icon indicating copy to clipboard operation
react-speech-kit copied to clipboard

Speak function calls continously on onEnd

Open naonvl opened this issue 4 years ago • 0 comments

I'm calling the speak function on onEnd function from useSpeechRecognition like this

  const onEnd = () => {
    fetch(
      "http://api/Main?id=test&lang=kor&req=" +
        value,
      {}
    )
      .then((res) => res.json())
      .then(
        (result) => {
          setResponse(result.res);
          speak({
            text: result.res,
            voices: {
              lang: "ko-KR",
            },
          });
          console.log(result);
        },
        (error) => {
          console.log(error);
        }
      );
  };

but the voice language doesn't changed to korean, also it speak continously. where did i do wrong?

naonvl avatar Nov 03 '21 04:11 naonvl