@lite-v3/speech-to-text
v1.1.0
Published
Basic utility package to convert speech input to text input
Downloads
678
Readme
@lite-v3/lite-speech-to-text
Basic utility package to convert speech input to text input
Installation
Install deps
# Use pnpm
pnpm add @lite-v3/speech-to-text
# Use npm
npm i @lite-v3/lite-speech-to-text
# Use yarn
yarn add @lite-v3/lite-speech-to-text
Hooks
useSpeechToText
React hook to use the browser speechRecognition's API
Usage
useSpeechToText
import { useSpeechToText } from '@lite-v3/speech-to-text';
const { listening, startListening, abortListening } = useSpeechToText({
lang: 'id-ID',
isListeningAnything: false,
onSpeechEnd: handleSpeechEnd,
});
const handleSpeechIconClick = () => {
if (!listening) {
startListening();
} else {
abortListening();
}
};
return <div onClick={handleSpeechIconClick} />;
Code By WPE Team @Tokopedia