1.0.4 • Published 2 years ago

react-stt v1.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

React-STT

This package lets you convert speech to text in a react app.

Instalation

 npm i react-stt

Attributes

Name Description
exportTextReturns the converted text.
startMessageStart Message. Start by default
stopMessageStop Message. Stop by default

Example

Given below is a simple unstyled example that converts the speech and fills the input field.

import { useEffect, useState } from "react";
import SpeechTotext from "react-stt";

function App() {
  const [message, setMessage] = useState(null);

  useEffect(() => {
    //Scrolls to the bottom of the div tag.
    document.getElementById("message-box").value = message;
    const div = document.getElementById("message-box");
    div.scrollTop = div.scrollHeight - div.clientHeight;
  }, [message]);

  return (
    <>
      <SpeechTotext
        exportText={(note) => setMessage(note)}
        startMessage={"start"}
        stopMessage={"stop"}
      />

      <textarea id="message-box" cols="30" rows="10"></textarea>
    </>
  );
}

export default App;
1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago