
Research
Security News
Lazarus Strikes npm Again with New Wave of Malicious Packages
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
@intentface/react-speech-recognition
Advanced tools
`@intentface/react-speech-recognition` is a custom React hook that provides an easy-to-use interface for integrating speech recognition capabilities into your React applications. It leverages the native browser `SpeechRecognition` API, allowing you to cap
@intentface/react-speech-recognition
is a custom React hook that provides an easy-to-use interface for integrating speech recognition capabilities into your React applications. It leverages the native browser SpeechRecognition
API, allowing you to capture and process voice inputs with customizable options.
You can install this package via npm:
npm install @intentface/react-speech-recognition
Here’s a basic example of how to use the useSpeechRecognition
hook in your React project:
import React from "react";
import { useSpeechRecognition } from "@intentface/react-speech-recognition";
const SpeechComponent = () => {
const {
transcript,
interimTranscript,
isListening,
isFinal,
isSupported,
start,
stop,
error,
} = useSpeechRecognition({
lang: "en-US", // Language for speech recognition (default is "en-US")
continuous: false, // Whether to keep listening or stop after receiving input
timeout: 5000, // Automatically stop listening after 5 seconds
onUpdate: ({ transcript, interimTranscript, isFinal }) => {
console.log("Update:", { transcript, interimTranscript, isFinal });
},
onError: ({ error }) => {
console.error("Speech recognition error:", error);
},
});
if (!isSupported) {
return <p>Your browser does not support Speech Recognition.</p>;
}
return (
<div>
<h1>Speech Recognition Example</h1>
<p>Transcript: {transcript}</p>
<p>Interim Transcript: {interimTranscript}</p>
<p>
Status:{" "}
{isListening ? "Listening..." : isFinal ? "Finalized" : "Stopped"}
</p>
{error && <p>Error: {error.message}</p>}
<button onClick={start}>Start Listening</button>
<button onClick={stop}>Stop Listening</button>
</div>
);
};
export default SpeechComponent;
The useSpeechRecognition
hook returns an object containing the following properties:
transcript
: The final processed transcript of the recognized speech.interimTranscript
: The current intermediate transcript while speech is being processed.isListening
: A boolean indicating whether the recognition is currently active.isFinal
: A boolean indicating whether the current session has ended and the transcript is finalized.isSupported
: A boolean indicating whether the browser supports speech recognition.start()
: A function to start speech recognition.stop()
: A function to stop speech recognition.error
: An object containing any speech recognition errors that occurred.The hook accepts an options object with the following fields:
lang
: The language for speech recognition (default is "en-US"
).continuous
: If true
, the recognition will continue until stopped manually (default: false
).timeout
: Time in milliseconds to automatically stop recognition after no speech is detected (default: undefined
). If left undefined, browsers default behaviour is respected.onUpdate
: A callback function triggered when there is an update in the transcript. Receives an object with { transcript, interimTranscript, isFinal }
.onError
: A callback function triggered when an error occurs. Receives an object with { error }
.lang
option.onError
callback.This hook uses the native SpeechRecognition
API (also known as webkitSpeechRecognition
in some browsers). Below is a list of supported browsers:
Browser | Supported Versions |
---|---|
Chrome | Version 33+ |
Safari | Version 14+ |
Edge | Version 79+ |
Note: The
SpeechRecognition
API is not supported in Firefox or Internet Explorer. Please check for browser compatibility using theisSupported
flag provided by the hook.
Contributions are welcome! If you encounter any issues or have suggestions for improvements, feel free to create a pull request or file an issue in the repository.
Please remember to add the changes you are making by running
npm run add-change
MIT
After finishing your feature normally, to automatically bump version number, update changelog and do an npm release:
npm run add-change
For more details about who we are, visit our website: Intentface.
1.0.6
FAQs
`@intentface/react-speech-recognition` is a custom React hook that provides an easy-to-use interface for integrating speech recognition capabilities into your React applications. It leverages the native browser `SpeechRecognition` API, allowing you to cap
The npm package @intentface/react-speech-recognition receives a total of 11 weekly downloads. As such, @intentface/react-speech-recognition popularity was classified as not popular.
We found that @intentface/react-speech-recognition demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.
Security News
Opengrep continues building momentum with the alpha release of its Playground tool, demonstrating the project's rapid evolution just two months after its initial launch.