Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
react-hook-recorder
Advanced tools
A simple react hook using MediaRecorder API
https://codesandbox.io/s/react-hook-recorder-gbz6z
import React, { useCallback, useState } from "react";
import useRecorder from "react-hook-recorder";
function Recorder() {
const [url, setUrl] = useState("");
const onStop = useCallback((blob, blobUrl) => {
setUrl(blobUrl);
}, []);
const { startRecording, stopRecording, register, status } = useRecorder();
return (
<div>
<video ref={register} autoPlay muted playsInline />
{url && (
<>
Recorded video :
<video controls src={url} />
</>
)}
{status !== "init" && (
<>
<button onClick={startRecording} disabled={status === "recording"}>
Start Recording
</button>
<button
onClick={stopRecording(onStop)}
disabled={status !== "recording"}
>
Stop Recording
</button>
</>
)}
<div>
<strong>Status :</strong>
{status}
</div>
</div>
);
}
export default Recorder;
useRecorder
Args
(mediaStreamConstraints: MediaStreamConstraints, mediaRecorderOptions: MediaRecorderOptions)Property | Required | Type | Description |
---|---|---|---|
mediaStreamConstraints | false | object | MediaStreamConstraints object |
mediaRecorderOptions | false | object | MediaRecorder object |
Returns
(object)Property | Type | Args | Description |
---|---|---|---|
mediaRecorder | MediaRecorder | MediaRecorder instance ref | |
stream | MediaStream | MediaStream instance ref | |
startRecording | function | function to start recording | |
stopRecording | function | function(blob: Blob, url: string) => void | function to stop recording |
register | function | HTMLVideoElement | function to register video element |
status | RecorderStatus | return recorder status | |
error | RecorderError | return recorder error |
enum RecorderStatus
: "idle" | "init" | "recording"
enum RecorderError
: "stream-init" | "recorder-init"
FAQs
React based hook to use native MediaRecorder API
We found that react-hook-recorder demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.